Q
PHP登錄系統?
-3
A
回答
1
0
如果你想要一個基本的網站登錄系統,試試這個。
登錄形式:
<form id="login-form" class="loginform" action='include/login.inc.php' method='POST'>
<input id="login-email" type='text' name='email' placeholder='Email'>
<input id="login-pwd" type='password' name='pwd' placeholder='Password'>
</form>
然後添加PHP代碼。
Login.inc.php:
<?php
session_start();
include '../dbh.php';
$email = $_POST['email'];
$pwd = $_POST['pwd'];
$sql = "SELECT * FROM user WHERE email= ? ";
$stmt = mysqli_prepare($conn, $sql);
mysqli_stmt_bind_param($stmt, 's', $email);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
$row = mysqli_fetch_assoc($result);
if(password_verify($pwd, $row['pwd'])) {
$_SESSION['id'] = $row['id'];
$userID = $row['id'];
header("Location: ../profile.php?id=$userID");
exit();
} else {
header("Location: ../login-error-page.php");
exit();
}
?>
相關問題
- 1. PHP登錄系統
- 2. Php登錄系統-null值登錄
- 3. PHP登錄系統錯誤?
- 4. PHP/MySQL的登錄系統
- 5. 雙重登錄PHP系統
- 6. 登錄系統使用PHP
- 7. PhP登錄/註冊系統
- 8. PHP會話登錄系統
- 9. Android php登錄系統
- 10. PHP + MySQL登錄系統
- 11. PHP登錄系統問題
- 12. PHP登錄系統。安全?
- 13. Cookie Stealer /登錄系統(PHP)
- 14. php會話登錄系統
- 15. PHP/MySQL登錄系統 -
- 16. Jquery/PHP ajax登錄系統
- 17. MySQL Php登錄系統
- 18. Php登錄系統錯誤
- 19. PHP系統登錄錯誤
- 20. SQL登錄系統
- 21. joomla登錄系統
- 22. MyspaceID登錄系統
- 23. ASP.NET登錄系統
- 24. Wpf登錄系統
- 25. 系統登錄Ruby?
- 26. Laravel登錄系統
- 27. CakePHP登錄系統
- 28. Android登錄系統
- 29. Django登錄系統
- 30. PHP的登錄系統問題
你能改一下你的問題嗎?我不明白你在問什麼,你似乎也沒有使用任何標點符號。 – Seth 2009-12-01 20:16:51