Project

General

Profile

Statistics
| Branch: | Revision:

root / docs / www / colonyscout / internal / admin / validate.php @ f59acf11

History | View | Annotate | Download (2.44 KB)

1
<?php
2
include($_SERVER['DOCUMENT_ROOT']."/control/do_login.php");
3
doDB("dshope_robotics");
4

    
5
$regcode = $_GET["id"];
6

    
7
//check if code exists and has not yet expired
8
$verify_account_sql = "SELECT userName, DATE_FORMAT(validDate, '%Y-%m-%d') AS fmt_validDate FROM members WHERE validated = '".$regcode."'";
9
$verify_account_res =  mysqli_query($mysqli, $verify_account_sql) or die(mysqli_error($mysqli));
10

    
11
if (mysqli_num_rows($verify_account_res) < 1) {
12
        //the account could not be found
13

    
14
        header("Location: /members/validerr.php?t=notfound");
15
        exit;
16
} else {
17
        while ($member_info = mysqli_fetch_array($verify_account_res)) {
18
                $userName = stripslashes($member_info['userName']);
19
                $valid = $member_info['fmt_validDate'];
20
        }
21
        
22
        $today = date("Y-m-d");
23
}
24

    
25
//check if validation string is expired (redirect if expired)
26
$date_today = strtotime($today);
27
$date_expire = strtotime($valid);
28

    
29
if ($date_expire < $date_today) {
30
        //the validation string is expired
31

    
32
        header("Location: /members/validerr.php?t=expired");
33
        exit;
34
}
35

    
36
//add record into members database
37
$update_member_sql = "UPDATE members SET Validated='true'";
38
$update_member_res = mysqli_query($mysqli, $update_member_sql) or die(mysqli_error($mysqli));
39

    
40
//close connection to MySQL
41
mysqli_close($mysqli);
42

    
43
$display_block = "Hello ".$userName."! Thanks for signing up!";
44
?>
45

    
46
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
47
<html><head> 
48
                <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">                
49
                <link href="/rsc/main-style.css" rel="stylesheet" type="text/css" media="screen">
50
                <title>About | danshope.com</title>
51

    
52
                </head><body>
53

    
54
<div id="general">
55

    
56
<?php 
57
include($_SERVER['DOCUMENT_ROOT']."/nav.php");
58
?>
59

    
60
<div id="body">
61
  <div class="border-splash"></div>
62
  <div id="body-boxes">
63
    <div id="box-inside"><br>
64

    
65
        <span id="dkbluelargetext"><?php echo $display_block; ?></span>
66

    
67
    <div>
68
  </div>
69
</div>
70

    
71

    
72

    
73
<?php 
74
include($_SERVER['DOCUMENT_ROOT']."/footer.php");
75
?>
76

    
77
<script type="text/javascript">
78
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
79
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
80
</script>
81
<script type="text/javascript">
82
var pageTracker = _gat._getTracker("UA-6089041-1");
83
pageTracker._trackPageview();
84
</script>
85

    
86
<!--Page created on <?php echo date(DATE_RFC822); ?>!-->
87

    
88
</div><!--GENERAL!-->
89
</body></html>