我正在嘗試創建一個帶有PDO和會話的登錄/注冊系統,用戶可以創建他的帳戶,他可以訪問歡迎頁面,但是當注銷并嘗試使用工作用戶名和密碼登錄時,它會將我發送到一個空白的php頁面,我在互聯網上查看和空白的php頁面意味著語法錯誤,我找不到任何。順便說一句,我嘗試用任何密碼輸入任何用戶名,它仍然將我發送到一個空白的php頁面,這是我的代碼:Config.phpclass config { public static function connect() { $host = "localhost"; $username = "root"; $password = ""; $dbname = "logintest"; try{ $bdd = new PDO("mysql:host=$host;dbname=$dbname",$username,$password); $bdd->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_WARNING); }catch(PDOException $e) { echo "Connection échoué" . $e->getMessage(); } return $bdd; }}?>我的過程.php(這就是我認為問題的根源:session_start(); include_once("config.php"); if(isset($_POST['register'])) { $bdd = config::connect(); $username = $_POST['username']; $email = $_POST['email']; $password = $_POST['password']; if(insertDetails($bdd,$username,$email,$password)) { $_SESSION['username'] = $username; header("Location: profile.php"); }} if(isset($_POST['login'])) { $bdd = config::connect(); $username = $_POST['username']; $password = $_POST['password']; if(checkLogin($bdd,$username,$password)) { $_SESSION['username'] = $username; header("Location: profile.php"); } else{ echo "Le mot de passe ou le nom d'utilisateur sont incorrect"; }} function insertDetails($bdd,$username,$email,$password) { $query = $bdd->prepare(" INSERT INTO users (username,email,password) VALUES(:username,:email,:password) "); $query->bindParam(":username",$username); $query->bindParam(":email",$email); $query->bindParam(":password",$password); return $query->execute();}或者這是我正在做的項目:https://github.com/AmrouHab/LoginRegister/tree/master/neptunetest我會得到任何幫助 謝謝(順便說一句,對不起我的英語不好的法語)
1 回答

BIG陽
TA貢獻1859條經驗 獲得超6個贊
Well , i found the solution I forgot to put an uppercase "L" in process.php
if(isset($_POST['login']))
I've corrected it to
if(isset($_POST['Login']))
and now it's working. Thanks for your attention.
- 1 回答
- 0 關注
- 86 瀏覽
添加回答
舉報
0/150
提交
取消