Location: PHPKode > projects > WH Community > wh_community/verify.php
<?php require('layout/header.php'); ?>

    <script type="text/javascript">
    	function showSuccessMessage() {
    	showNotification({
    	type : "success",
    	message: "<?php echo $lang['success_verified']; ?>"
    	});    
        }                                
    
    function showErrorMessage() {
    	showNotification({
    	type : "error",
    	message: "<?php echo $lang['couldnot_verify']; ?>"
    	});    
        }                                
    </script>

<div id="content_wrapper">
    <div class="content"><?php
		
		if(isset($_GET['user']) && !empty($_GET['user']) AND isset($_GET['hash']) && !empty($_GET['hash'])) {
		
		echo '<h1>' . $lang['account_activation'] . '</h1><br>';
		
		$name = htmlentities($_GET['user']);
		$hash = htmlentities($_GET['hash']);
		
		$getid = "SELECT user_id, user_hash FROM users WHERE user_name = '" . mysql_escape_string($_GET['user']) . "' LIMIT 1";
		$check = mysql_query($getid) OR die(mysql_error());
		
		while($row = mysql_fetch_assoc($check)) {
		
    		$id = (int)$row['user_id'];
    		$uh = htmlentities($row['user_hash']);
		
		if($_SERVER['REQUEST_METHOD'] != 'POST') {
		
		echo '<p><strong>' . $lang['activate_your_account'] . '.</strong></p>
    		  <form method="post" action="">
    		  <p><input type="text" class="fields" name="user_name" value="' . $name . '" size="50" /> <strong>User Name</strong></p>
    		  <p><input type="text" class="fields" name="user_hash" value="' . $hash . '" size="50" /> <strong>Hash-Code</strong></p>
    		  <input type="hidden" name="user_id" value=' . $id . '>
    		  <p><input type="submit" class="button" value="' . $lang['activation'] . '" alt="' . $lang['activation'] . '"></p>
    		  </form><br>';
		
		}else{
		
		$errors = array();
		
		if(isset($_POST['user_name'])) {
		if(trim($_POST['user_name']) == "") {
		$errors[] = '<p>' . $lang['enter_username'] . '.</p>';
		}
		
			}else{
			$errors[] = '<p>' . $lang['false_user_name'] . '.</p>';
			}
		
		if(isset($_POST['user_hash'])) {
		if(trim($_POST['user_hash']) == "") {
		$errors[] = '<p>' . $lang['no_hash_code'] . '.</p>';
		}
		
		if($_POST['user_hash'] != $uh) {
		$errors[] = '<p>' . $lang['false_hash_code'] . '.</p>';
		}
		
			}else{
			$errors[] = '<p>' . $lang['no_valid_hash'] . '.</p>';
			}
		
		if(!empty($errors)) {
		
		echo '<p class="false"><u>' . $lang['not_filled_all'] . '</u></p>
		      <p>[ <a href="javascript:history.back();">' . $lang['back'] . '</a> ]</p><br>';
		echo '<ul>';
		
		foreach($errors as $key => $value) {
		echo '<li>' . $value . '</li>'; 
		}
		echo '</ul>';
		
			}else{
			
			$sql = "UPDATE
						users
					SET
						user_active = '1'
					WHERE
						user_id = '" . $id . "'";
			
			mysql_query($sql) OR die(mysql_error());
		
		if(mysql_affected_rows() == 1) {
		
		echo '<p class="right">' . $lang['success_verified'] . '</p>
		      <p>[ <a href="signin.php">' . $lang['signin_to'] . '</a> ]</p>';
		echo "<script type=\"text/javascript\">showSuccessMessage();</script>";
		
			}else{
			
			echo '<p class="false">' . $lang['couldnot_verify'] . '</p>
			      <p>[ <a href="javascript:history.back();">Zur&uuml;ck</a> ]</p>';
			echo "<script type=\"text/javascript\">showErrorMessage();</script>";
			
        }}}}
        
        }else{
        
        echo '<p class="false">' . $lang['now_goto_activate'] . '.</p>';
        }
		
        echo '<div class="spacer_div">&nbsp;</div>';

		?>
    </div>
</div>

<div id="infobox_wrapper">
    <div class="infobox">
        <?php include('layout/infobox.php'); ?>
    </div>
</div>

<?php require('layout/footer.php'); ?>
Return current item: WH Community