forked from ramstram/C4L
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactivate.php
More file actions
182 lines (83 loc) · 2.57 KB
/
activate.php
File metadata and controls
182 lines (83 loc) · 2.57 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
// Jobs Portal
// http://www.netartmedia.net/jobsportal
// Copyright (c) All Rights Reserved NetArt Media
// Find out more about our products and services on:
// http://www.netartmedia.net
?><?php
ob_start();
require("config.php");
if(!$DEBUG_MODE) error_reporting(0);
require("include/SiteManager.class.php");
include("include/Database.class.php");
/// Initialization of the site manager and database objects
$database = new Database();
/// Connect to the website database
$database->Connect($DBHost, $DBUser,$DBPass );
$database->SelectDB($DBName);
$website = new SiteManager();
$website->SetDatabase($database);
/// Loading the website default settings
$website->LoadSettings();
define("LOGIN_EXPIRE_AFTER", 86400);
$id=$_GET["id"];
$website->ms_w($id);
if($database->SQLCount_Query("SELECT * FROM ".$DBprefix."employers WHERE code='$id' ") == 1)
{
$arrUser = $database->DataArray("employers","code='$id' ");
$database->SQLUpdate_SingleValue
(
"employers",
"id",
$arrUser["id"],
"active",
"1"
);
$database->SQLUpdate_SingleValue
(
"employers",
"id",
$arrUser["id"],
"code",
$arrUser["code"]."_VALIDATED"
);
$strCookie = $arrUser["username"]."~".md5($arrUser["password"])."~".(time()+LOGIN_EXPIRE_AFTER)."~";
setcookie("AuthE",$strCookie);
$database->SQLInsert
(
"login_log",
array("username","ip","date","action","cookie"),
array($arrUser["username"],$_SERVER["REMOTE_ADDR"],time(),'login',$strCookie)
);
echo "
<script>
alert('Thank you! Your account has been activated successfully!');
document.location.href='EMPLOYERS/index.php';
</script>
";
}
else
if($database->SQLCount_Query("SELECT * FROM ".$DBprefix."employers WHERE code='".$id."_VALIDATED' ") == 1)
{
$arrUser = $database->DataArray("employers","code='".$id."_VALIDATED' ");
$strCookie = $arrUser["username"]."~".md5($arrUser["password"])."~".(time()+LOGIN_EXPIRE_AFTER)."~".md5(md5($arrUser["username"]."3195".md5($arrUser["password"])."4421"));
setcookie("AuthE",$strCookie);
$database->SQLInsert
(
"login_log",
array("username","ip","date","action","cookie"),
array($arrUser["username"],$_SERVER["REMOTE_ADDR"],time(),'login',$strCookie)
);
echo "
<script>
alert('Your account has been already activated!');
document.location.href='EMPLOYERS/index.php';
</script>
";
}
else
{
echo "<h3>WRONG ACTIVATION CODE!</h3>";
}
ob_end_flush();
?>