session_start();
header('Content-type:text/html;charset=utf-8');
$code = $_POST["code"]; //Verification code
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (empty($_POST['username '])){
echo "";
}else {
using using using using using ’s ’ ’s ’ using using ‐ ‐ ‐ $username=$_POST['username'];
# echo "";
}else{
$password=$_POST['password'];
}
}
if($code != $_SESSION['authcode']) //Determine whether the filled-in verification code matches the information generated by the verification code PHP file
{
echo "";
}
$ mysqli = new mysqli('localhost', 'root', 'root', 'user');
$result = $mysqli->query("SELECT password FROM user WHERE username = "."' $username'");
$rs=$result->fetch_row();
if (!empty($rs)){
if ($password != $rs[0]) {
echo "";
}else{
$expire=3600;
ini_set('session .gc_maxlifetime', $expire);//Save for 1 hour
if (empty($_COOKIE['PHPSESSID'])) {
session_set_cookie_params($expire);
session_start();
}else{
session_start();
setcookie('PHPSESSID', session_id(), time() $expire);
}
iF (isset ($ _ session ['username'])) {
Header ("local: index.html");
##} else { use with $_SESSION['username']=$_POST[''];echo "Hello! {$_SESSION['username']}, welcome back!";
echo "Logout" ;
}
}else{
echo "";
added after return