/mybookbag/activate.php
PHP | 88 lines | 72 code | 14 blank | 2 comment | 10 complexity | e204ef66ca73402351c1bc1af63f149e MD5 | raw file
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <link href='http://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
- <link rel="stylesheet" href="css/formstyles.css" type="text/css" />
- <script type="text/javascript" src="js/Placeholders.js"></script>
- <script type="text/javascript">
- Placeholders.init({
- live: true,
- hideOnFocus: true});
- </script>
- <link href="css/toolbar.css" rel="stylesheet" type="text/css" />
- <title>MyBookBag Activation</title>
- </head>
- <body><?php
- include ('db_connection.php');
- if (isset($_GET['email']) && preg_match('/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/', $_GET['email']))
- {
- $email = $_GET['email'];
- }
- if (isset($_GET['key']) && (strlen($_GET['key']) == 32))//The Activation key will always be 32 since it is MD5 Hash
- {
- $key = $_GET['key'];
- }
- if (isset($email) && isset($key))
- {
- // Update the database to set the "activation" field to null
- $query_activate_account = "UPDATE users SET activation=NULL WHERE(email ='$email' AND activation='$key')LIMIT 1";
-
- $result_activate_account = mysql_query($query_activate_account) ;
- // Print a customized message:
- if (mysql_affected_rows($dbc) == 1)//if update query was successfull
- {
- echo
- '
- <div id="carbonForm">
- <div id="logo">
- <img src="img/logo.png" />
- </div>
- <h1>Success!</h1>
- <div class="fieldContainer">
- <p>Your bookbag is now ready to go!</p><br />
- <p>Wy wait? Go <a href="index.php">grab it</a>!</p>
- </div> <!-- Closing fieldContainer -->
-
- </div>';
- } else
- {include ("php/random-bg.php");
- echo
- '
- <div id="carbonForm">
- <div id="logo">
- <img src="img/logo.png" />
- </div>
- <h1>Oops!</h1>
- <div class="fieldContainer">
- <p>Your account could not be activated.</p><br />
- <p>Perhaps your account already is activated? Try to <a href="index.php">login</a>.</p>
- </div> <!-- Closing fieldContainer -->
-
- </div>';
- }
- mysql_close($dbc);
- } else {
- echo '<div class="errormsgbox">Error Occured .</div>';
- }
- ?>
- </body>
- </html>