有了這個劇本,我必須輸入用戶名和密碼才能訪問 受保護的頁面,如果它通過地址欄可能,我才明白,自動登錄 ,我試圖自動登錄的網址
Http://example.org/index.php&myusername&mypassword
但我無法訪問它可以從地址欄自動登錄。
<?php
session_start();
$username = $_POST['username'];
$password = $_POST['pw'];
if($username == "" or $password == ""){
echo "Non puoi accedere senza Username o password";
}else if($username == "" and $password == ""){
echo "Non puoi accedere senza Username e password";
}else{
// configure your username and password
if($username == "test" AND $password == "test"){
echo "Benvenuto $username";
echo "<a href='http://www.example.com'>Vai alla pagina</a>";
}else{
echo "Accesso negato, questo username non esiste";
}
}
function loggeduser($username){
}
?>
改變'$ _POST'到'$ _REQUEST'和你的網址是通過'http:/ /example.org/index.php?username=test&pw=test' – cmorrissey