Location: PHPKode > projects > 427BB > fourtwosevenbb/activate.php
<?php
/*************************************************************************
 * 427BB - PHP & MySQL Forum                                             *
 * Copyright (C) 2003-2006 Ben Brown                                     *
 *                                                                       *
 * This program is free software; you can redistribute it and/or modify  *
 * it under the terms of the GNU General Public License as published by  *
 * the Free Software Foundation; version 2 of the License.               *
 *                                                                       *
 * This program is distributed in the hope that it will be useful,       *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 * GNU General Public License for more details.                          *
 *                                                                       *
 * A Copy of the GNU General Public License can be found in the file     *
 * 'liscence.txt' in the root of the forum directory.                    *
 *************************************************************************/

$page_name = "Activation";
include 'header.php';

if ($auth == TRUE) {
	header ("Location: ./");
	exit;
}

echo "<div class=messtitle>Active Your Login!</div>
<div class=mess>";

if (isset($_REQUEST['name'])) {
	$sql = "SELECT AdminEmail FROM " . $t_prefix . "Forum_inf";
	$res = mysql_query($sql);
	$admin_email = mysql_result($res, 0);

	$user = $_REQUEST['name'];
	$activate = $_REQUEST['code'];
	$s_user = addslashes($user);
	$sql = "SELECT Active FROM " . $t_prefix . "Personal WHERE UserName='$s_user'";
	$res = mysql_query($sql);
	$active_code = mysql_result($res, 0);

	if ($active_code == "Yes") {
		echo "This account is already active. Please try logging in.";
		include 'footer.php';
		exit;
	}

	if ($active_code != $activate) {
		echo "The activation code is incorrect. For more help please contact the administrator by clicking <a href=mailto:$admin_email>here</a>.
</div>";
		include 'footer.php';
		exit;
	}

	$sql = "UPDATE " . $t_prefix . "Personal SET Active='Yes' WHERE UserName='$s_user'";

	if (!mysql_query($sql)) {
		echo "Error: could not update details. Please try again.";
	} else {
		echo "User Name <b>$user</b> is now active, Please log in!";
	}

}

echo "</div>";

include 'footer.php';
exit;

?>
Return current item: 427BB