Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我很确定这段代码有问题:
$sql="select * from user where username={$_POST['username']}AND pwd= {$_POST['password']}"; $r = mysqli_query($link,$sql); if($r) { $_SESSION['loggedin']=true; echo "Welcome". $_POST['username']; }
是的,您会接触到 SQL 注入。请了解预先准备好的陈述。
此外,您显然以纯文本形式存储密码。这是一个安全风险,因为如果您的数据库被暴露(由于 SQL 注入攻击,例如咳咳),您的所有密码都可能被泄露。
几个链接: