forked from PHPFusion/PHPFusion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreactivate.php
84 lines (80 loc) · 3.79 KB
/
reactivate.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) PHP-Fusion Inc
| https://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: reactivate.php
| Author: Paul Beuk (muscapaul)
| Co Author: Hans Krisitan Flaatten (Starefossen)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once dirname(__FILE__).'/maincore.php';
require_once THEMES."templates/header.php";
require_once INCLUDES."suspend_include.php";
$locale = fusion_get_locale('', LOCALE.LOCALESET."reactivate.php");
if (iMEMBER) {
redirect(BASEDIR."index.php");
}
if (isset($_GET['error']) && isnum($_GET['error'])) {
$text = "";
switch ($_GET['error']) {
case 1:
$text = str_replace('[SITEEMAIL]', "<a href='mailto:".fusion_get_settings('siteemail')."'>".fusion_get_settings('siteemail')."</a>", $locale['501']);
break;
case 2:
$text = str_replace('[SITEEMAIL]', "<a href='mailto:".fusion_get_settings('siteemail')."'>".fusion_get_settings('siteemail')."</a>", $locale['502']);
break;
case 3:
$text = str_replace(['[LINK]', '[/LINK]', '[SITEEMAIL]'],
["<a href='".fusion_get_settings('siteurl')."login.php'>", "</a>", "<a href='mailto:".fusion_get_settings('siteemail')."'>".fusion_get_settings('siteemail')."</a>"],
$locale['503']
);
break;
default:
redirect(BASEDIR."index.php");
}
opentable($locale['500']);
echo "<div class='alert alert-danger text-center'>".$text."</div>\n";
closetable();
}
if (isset($_GET['user_id']) && isnum($_GET['user_id']) && isset($_GET['code']) && preg_check("/^[0-9a-z]{32}$/", $_GET['code'])) {
$result = dbquery("SELECT user_name, user_email, user_actiontime, user_password
FROM ".DB_USERS."
WHERE user_id='".$_GET['user_id']."' AND user_actiontime>'0' AND user_status='7'"
);
if (dbrows($result)) {
$data = dbarray($result);
$code = md5($data['user_actiontime'].$data['user_password']);
if ($_GET['code'] == $code) {
if ($data['user_actiontime'] > TIME) {
dbquery("UPDATE ".DB_USERS." SET user_status='0', user_actiontime='0', user_lastvisit='".TIME."' WHERE user_id='".$_GET['user_id']."'");
unsuspend_log($_GET['user_id'], 7, $locale['506'], TRUE);
$message = str_replace(
["[USER_NAME]", '[SITENAME]', '[SITEUSERNAME]'],
[$data['user_name'], fusion_get_settings('sitename'), fusion_get_settings('siteusername')],
$locale['505']
);
require_once INCLUDES."sendmail_include.php";
sendemail($data['user_name'], $data['user_email'], fusion_get_settings('siteusername'), fusion_get_settings('siteemail'), str_replace('[SITENAME]', fusion_get_settings('sitename'), $locale['504']), $message);
redirect(BASEDIR."login.php");
} else {
redirect(FUSION_SELF."?error=1");
}
} else {
redirect(FUSION_SELF."?error=2&user_id=".$data['user_id']."&code=".$_GET['code']);
}
} else {
redirect(FUSION_SELF."?error=3");
}
} else {
redirect(BASEDIR."index.php");
}
require_once THEMES."templates/footer.php";