[网鼎杯 2020 总决赛]Game Exp
[网鼎杯 2020 总决赛]Game Exp
考点
wp
第一段 login/index.php
if (isset($_POST['username'])){
session_start();
include_once "../sqlhelper.php";
include_once "../user.php";
$username = addslashes($_POST['username']);
$password = addslashes($_POST['password']);
$mysql = new sqlhelper();
$sql = "SELECT password,id FROM user where username = '$username'";
$res = $mysql->execute_dql($sql);
$row = $res->fetch_row();
if ($row[0]==md5($password)){
session_start();
$_SESSION['username'] = $username;
$_SESSION['uid'] = $row[1];
$u = new User($row[1]);
$_SESSION['user'] = $u;
header("Location: ../index.php");
exit();
}else{
echo "<script>alert('登陆失败');</script>";
}
}第二段 login/register.php


思路


最后更新于