コード例 #1
0
ファイル: example3.php プロジェクト: nWidart/phpUserClass
Do not use this example as is. Here we do not validate anything. In your application you should validate the data first, but you don't have to addslashes() as the class does this operation.
http://phpUserClass.com
http://www.webdigity.com
*/

$settings = array(
	'dbName'=>'accessuserclass',
	'dbUser'=>'root',
	'dbPass'=>''
);
require_once 'access.class.php';
$user = new flexibleAccess();

if (!empty($_GET['activate'])){
	//This is the actual activation. User got the email and clicked on the special link we gave him/her
	$hash = $user->escape($_GET['activate']);
	$res = $user->query("SELECT `{$user->tbFields['active']}` FROM `{$user->dbTable}` WHERE `activationHash` = '$hash' LIMIT 1",__LINE__);
	if ( $rec = mysql_fetch_array($res) ){
		if ( $rec[0] == 1 )
			echo 'Your account is already activated';
		else{
			//Activate the account:
			if ($user->query("UPDATE `{$user->dbTable}` SET `{$user->tbFields['active']}` = 1 WHERE `activationHash` = '$hash' LIMIT 1", __LINE__))
				echo 'Account activated. You may login now';
			else
				echo 'Unexpected error. Please contact an administrator';
		}
	}else{
		echo 'User account does not exists';
	}
}