activate.php
来自「用PHP/MySQL/Apache实现的简单用户注册/登录系统。」· PHP 代码 · 共 31 行
PHP
31 行
<?php
require_once('includes/config.inc.php');
$page_title='Activate Your Account';
include('includes/header.html');
$x=$y=false;
if(isset($_GET['x'])&&preg_match('/^[\w.-]+@[\w.-]+\.[A-z]{2,6}$/',$_GET['x'])){
$x=$_GET['x'];
}
if(isset($_GET['y'])&&strlen($_GET['y'])==32){
$y=$_GET['y'];
}
if($x&&$y){
require_once(MYSQL);
$q="UPDATE users set active=NULL WHERE (email='".mysqli_real_escape_string($dbc,$x)."' AND active='".mysqli_real_escape_string($dbc,$y)."')LIMIT 1";
$r=mysqli_query($dbc,$q) or trigger("Query: $q\n <br/>Mysql Error: ".mysqli_error($dbc));
if(mysqli_affected_rows($dbc)==1){
echo"<h3>Your account is now active. You may now log in.</h3>";
}else{
echo'<p class="error">Your account could not be activated. Pleaase recheck the link or contact the system administrator.</font></p>';
}
mysqli_close($dbc);
}else{
$url=BASE_URL.'index.php';
ob_end_clean();
header("Location: $url");
exit();
}
include('includes/footer.html');
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?