-
Notifications
You must be signed in to change notification settings - Fork 3
/
activate.php
47 lines (40 loc) · 1.28 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
<?php
/*
* activate.php
*
* Activates a new account from the email verification
*
*/
include 'config.php';
include 'db.php';
// These variables should be in the URL string
if (! isset($_GET['id']) || ! isset($_GET['code'] ) )
{
$message = "Your account cannot be activated without the information that " .
"was sent to you in the email. If you have any questions, please " .
"contact $admin at $admin_email or $admin_phone\n";
include 'index.php';
}
$userid = $_GET['id'];
settype( $userid, 'int' ); // Removes any remaining characters in URL
$code = $_GET['code'];
$query = "UPDATE people SET activated = 1 " .
"WHERE personID=$userid AND password='$code'";
mysqli_query( $link, $query )
or die ("Query failed : $query<br/>" . mysqli_error($link));
$query = "SELECT count(*) FROM people " .
"WHERE personID='$userid' " .
"AND password='$code' AND activated = 1";
$result = mysqli_query( $link, $query )
or die ( "Query failed : $query<br />" . mysqli_error($link) );
list( $doublecheck ) = mysqli_fetch_row( $result );
if ( $doublecheck == 0 )
{
$message = "Your account could not be activated.";
}
else
{
$message = "Your account has been activated. You may login below.";
}
include 'login.php';
?>