-4

私のコードについて助けが必要です。コンピューターの XAMPP で動作しますが、サーバーでライブになっていると動作せず、空白の画面しか表示されません。<a href="http://www.redhotessentials.com/prototype/pages/login.php</a>put username allanallan password allanallan で何が起こるかを見ることができ、何が起こるかを見ることができます

<?php
if (isset($_POST['email'])) {
//Connect to the database through our include 
require("db.php");

$email = stripslashes($_POST['email']);
$email = strip_tags($email);
$email = mysql_real_escape_string($email);
$password = preg_replace("[^A-Za-z0-9]", "", $_POST['password']); // filter everything but numbers and letters
$password = md5($password);
// Make query and then register all database data that -
// cannot be changed by member into SESSION variables.
// Data that you want member to be able to change -
// should never be set into a SESSION variable.
$sql = mysql_query("SELECT * FROM members WHERE email='$email' AND password='$password' AND emailactivated='1'"); 
$login_check = mysql_num_rows($sql);
if($login_check>0){ 
    while($row = mysql_fetch_array($sql)){ 
        // Get member ID into a session variable
        $id = $row['id'];  
        session_register('id'); 
        $_SESSION['id'] = $id;
        // Get member username into a session variable
        $username = $row['username'];   
        session_register('username'); 
        $_SESSION['username'] = $username;
        // Update last_log_date field for this member now
        mysql_query("UPDATE members SET lastlogin=now() WHERE id='$id'"); 
        // Print success message here if all went well then exit the script
        header("location: endlessnails_blog.php");

        exit();
    } // close while
} else {
// Print login failure message to the user and link them back to your login page
  print '<br /><br /><font color="#FF0000">No match in our records, try again </font><br />
<br /><a href="index.php">Click here</a> to go back to the login page.';
  exit();
}
}// close if post
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Login to your profile</title>
<link rel="stylesheet" type="text/css" href="../../css/main4.css" />
<script type="text/javascript">
<!-- Form Validation -->
function validate_form ( ) { 
valid = true; 
if ( document.logform.email.value == "" ) { 
alert ( "Please enter your User Name" ); 
valid = false;
}
if ( document.logform.pass.value == "" ) { 
alert ( "Please enter your password" ); 
valid = false;
}
return valid;
}
<!-- Form Validation -->
</script>
</head>
<?php include("header.php"); ?>
<?php include("nav.php"); ?>
<body>
       <div id="container">
        <div id="box3">
     <div align="center">
       <h3 id="login2"><br />
         <br />
       Log into Endless Nails Blog<br />  
       <br />
       </h3>
     </div>
     <div id="loginformmove">
     <table class="style7" align="center" cellpadding="5">
      <form action="index.php" method="post" enctype="multipart/form-data" name="logform" 
id="logform" onsubmit="return validate_form ( );">
        <tr>
          <td class="style7"><div align="right">Email Address:</div></td>
          <td class="style7"><input name="email" type="text" id="email" size="30" maxlength="64" /></td>
        </tr>  
        <tr>
          <td class="style7"><div align="right">Password:</div></td>
          <td class="style7"><input name="password" type="password" id="password" size="30" maxlength="24" /></td>
        </tr>
        <tr>
        <td class="style7">&nbsp;</td>
          <td id="login3"><input name="Submit" type="submit" value="Login" class="login_pad" /></td>
        </tr>
      </form>
     </table>
    </div>
   </div>
  </div>
  </div> 
</body>
</html>
4

1 に答える 1

0

ファイルをアップロードしていないため、FORM 属性から enctype を削除します。method="POST" を使用してください。

于 2012-08-22T03:26:20.990 に答える