verify.php (1127B)
1 <?php 2 include_once 'config.php'; 3 4 if(isset($_GET['email']) && !empty($_GET['email']) AND isset($_GET['hash']) && !empty($_GET['hash'])){ 5 $email = mysql_escape_string($_GET['email']); // Set email variable 6 $hash = mysql_escape_string($_GET['hash']); // Set hash variable 7 8 $search = mysql_query("SELECT email, hash, active FROM users WHERE email='".$email."' AND hash='".$hash."' AND active='0'") or die(mysql_error()); 9 $match = mysql_num_rows($search); 10 11 if($match > 0){ 12 // We have a match, activate the account 13 mysql_query("UPDATE users SET active='1' WHERE email='".$email."' AND hash='".$hash."' AND active='0'") or die(mysql_error()); 14 echo '<div class="statusmsg">Your account has been activated, you can now login</div>'; 15 }else{ 16 // No match -> invalid url or account has already been activated. 17 echo '<div class="statusmsg">The url is either invalid or you already have activated your account.</div>'; 18 } 19 20 }else{ 21 // Invalid approach 22 echo '<div class="statusmsg">Invalid approach, please use the link that has been send to your email.</div>'; 23 } 24 ?>