有没有什么方法可以让用户在PHP中改变代码的优势?假设他们有我的网页的完整源代码。PHP可变黑客
// make the connection
$dbhost = 'localhost';
$dbuser = 'user';
$dbpass = 'password';
$db = "db";
$conn = new PDO("mysql:host=$dbhost;dbname=$db", $dbuser, $dbpass);
// set errors
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// get the data
$stmt = $conn->prepare("select username from usernames where " . $number . " = '$session'");
$stmt->execute();
$row = $stmt->fetch();
$username = $row[0];
if ($username == "superuser") {
// code to view secure information and make changes to people accounts
}
有什么办法可以将他们的用户名更改为“超级用户”?
我计划能够快速浏览和编辑人的帐户详细信息的安全代码的一部分客户的服务选择,所以我不希望一些随机的用户能够查看和编辑其他用户的数据。
感谢
'$ number'和'$ session'设置在哪里? – D4V1D
请尝试在您的浏览器中使用例如按Ctrl-U。你看到PHP代码吗? –
请参阅http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php?rq=1。您可以接受SQL注入。 – chris85