-
Notifications
You must be signed in to change notification settings - Fork 35
/
activate.php
55 lines (44 loc) · 1.17 KB
/
activate.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
define('INSIDE', true);
$_EnginePath = './';
include($_EnginePath.'common.php');
includeLang('activate');
$Activated = false;
$_GET['code'] = (isset($_GET['code']) ? trim($_GET['code']) : null);
if(!empty($_GET['code']))
{
if(preg_match('/^[0-9a-zA-Z]{32}$/D', $_GET['code']))
{
$SQLResult = doquery("SELECT `id`, `username` FROM {{table}} WHERE `activation_code` = '{$_GET['code']}' LIMIT 1;", 'users');
if($SQLResult->num_rows > 0)
{
$SQLRowData = $SQLResult->fetch_assoc();
$Username = $SQLRowData['username'];
doquery("UPDATE {{table}} SET `activation_code` = '' WHERE `id` = '{$SQLRowData['id']}';", 'users');
$Msg = sprintf($_Lang['activation_completed'], $Username, 'overview.php', 3);
$Activated = true;
}
else
{
$Msg = $_Lang['no_code_in_db'];
}
}
else
{
$Msg = $_Lang['invalid_code_format'];
}
}
else
{
$Msg = $_Lang['empty_code'];
}
if($Activated)
{
$Color = 'lime';
}
else
{
$Color = 'red';
}
message("<span style=\"color: {$Color}\">{$Msg}</span><br/><br/>{$_Lang['go_back']}", $_Lang['title']);
?>