Location: PHPKode > scripts > WH Board > wh_board/verify.php
<?php require('style/layout/header.php'); ?>

    <div class="content_left">
        <ul id="breadcrumbs">
            <li><a href="index.php"><?php echo $lang['main_page']; ?></a></li>
            <li><a href="verify.php" class="actual"><?php echo $lang['finish_registration']; ?></a></li>
        </ul>
    </div>
    <div class="content_right"><form method="post" id="search" action="search.php?search">
        <input type="text" name="search" placeholder="<?php echo $lang['enter_search_term']; ?>..." class="searchfield">
        <input type="hidden" name="submit" value="<?php echo $lang['search']; ?>" alt="<?php echo $lang['search']; ?>">
        </form>
    </div>

    <div class="clear"></div>

    <div id="headline">&nbsp;</div>

    <?php

		if(isset($_GET['user']) && !empty($_GET['user']) AND isset($_GET['hash']) && !empty($_GET['hash'])) {

		echo '<h1>' . $lang['account_activation'] . '</h1>';

		$name = htmlentities($_GET['user']);
		$hash = htmlentities($_GET['hash']);

		$getid = "SELECT user_id, user_hash FROM users WHERE user_name = '" . mysql_escape_string($name) . "' LIMIT 1";
		$check = mysql_query($getid) OR die(mysql_error());

		while($row = mysql_fetch_assoc($check)) {

    		$id = (int)$row['user_id'];
    		$uh = mysql_real_escape_string($row['user_hash']);

		if($_SERVER['REQUEST_METHOD'] != 'POST') {

        echo '<p><strong>' . $lang['activate_your_account_soon'] . '</strong></p>
        <form method="post" action="">
        <p><input type="text" class="textfields" name="user_name" value="' . $name . '" size="50"> <strong>User Name</strong></p>
        <p><input type="text" class="textfields" name="user_hash" value="' . $hash . '" size="50"> <strong>Hash Code</strong></p>
        <input type="hidden" name="user_id" value=' . $id . '>
        <p><input type="submit" value="' . $lang['blank_activate'] . '" alt="' . $lang['blank_activate'] . '" class="buttons"></p>
        </form>';

		}else{

		$errors = array();

		if(isset($_POST['user_name'])) {
		if(trim($_POST['user_name']) == "") {
		$errors[] = $lang['reg_fill_name'];
		}

			}else{
			$errors[] = $lang['user_name_invalid'];
			}

		if(isset($_POST['user_hash'])) {
		if(trim($_POST['user_hash']) == "") {
		$errors[] = $lang['no_entered_hash_code'];
		}

		if($_POST['user_hash'] != $uh) {
		$errors[] = $lang['invalid_hash_code'];
		}

			}else{
			$errors[] = $lang['invalid_hash_code'];
			}

		if(!empty($errors)) {

		echo '<p class="false">' . $lang['not_filled_all'] . '</p>
		<p>[ <a href="javascript:history.back();">' . $lang['back'] . '</a> ]</p>';
		echo '<ul>';

		foreach($errors as $key => $value) {
		echo '<li>&#8226; ' . $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="success">' . $lang['success_account_activation'] . '!</p>
		<p><a href="signin.php">' . $lang['go_to_signin'] . '</a></p>';

			}else{

			echo '<p class="false">' . $lang['failed_account_activation'] . '</p>
			<p>[ <a href="javascript:history.back();">' . $lang['back'] . '</a> ]</p>';
            }

        }}}

        }else{

        echo '<p class="false">' . $lang['activation_now_email'] . '</p>';
        }

	?>

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