0
這是我的,我嘗試作爲最後的努力最後一次嘗試:檢查登錄然後重定向到另一個頁面
的index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Customer Login</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="wrapper">
<div class="login">
<form name="loginForm" action="loginCheck.php" method="post">
<?php require("protect/serverInfo.php"); ?>
Email: <input type="text" name="Email" maxlength="35" /><br />
Password: <input type="text" name="Password" maxlength="4" /><br />
<input type="submit" name ="submit"/>
</form>
</div>
</div>
</body>
</html>
loginCheck.php
<?php
session_start();
$_SESSION['email'] = $_POST['Email'];
$_SESSION['password'] = $_POST['Password'];
require("protect/serverInfo.php");
$myusername=$_POST[Email];
$mypassword=$_POST[Password];
$result = mysql_query("SELECT * FROM Customers WHERE Email='$myusername' AND Password=$mypassword");
$count=mysql_num_rows($result);
if($count==1){
header('Location: customer.php');
exit();
}
else{
header('Location: index.php');
exit();
}
?>
客戶.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
<?php
session_start();
$myusername = $_SESSION['email'];
$mypassword = $_SESSION['password'];
?>
</head>
<body>
<?php
echo"success";
?>
</body>
</html>
我只需要一個非常簡單的方法來創建表單帖子,發佈信息將被檢查,如果正確,則重定向如果正確,並傳遞發佈數據。我一直在嘗試使用會話和重定向,但它不能很好地工作。什麼是最簡單的方法來實現這一點。目前我一直使用PHP來檢查來自MySQL數據庫的登錄信息。
請問您可以發佈不正常的代碼嗎? – 2011-02-07 19:57:07
我發佈了我的代碼。我知道位置不再是一個正確的網址我只是改變了它,所以網址不再被看到 – shinjuo 2011-02-07 20:03:34