当我上网时,表格行动无效

时间:2013-11-17 07:55:08

标签: php html forms

我使用000webhost.com测试我的网站... 当我使用localhost时,表单工作正常.. link to the testing website

它显示的错误是基于jquery ajax ... 我不认为ajax有任何问题,我认为表格不是叫做行动

...形式

<form action="login.php" method="post" id="login">
    <input id="email" placeholder="E-mail" type="text" name="em" />
    <input id="email" placeholder="Password" type="password" name="pwd"/>
    <div class="txt1"><input type="checkbox" name="check" />Keep me logged in |<a href="#"> Forgot Password ?</a></div>
    <input type="submit" id="loginButton" value="Login" name="log" />
    </form>

login.php页面..

<?php
session_start();
include "incfiles/connection.php";
$user_login=$_POST['em'];
$password_login=$_POST['pwd'];
$password_login = md5($password_login);

if(empty($user_login) || empty($password_login))
{
die (retmsg(0,"Please fill Email and Password"));
}

$query = mysqli_query($con,"select * from registration where email='$user_login' and password='$password_login'");
$read = mysqli_num_rows($query);

if(!$read)
{
    die (retmsg(0,"Incorrect Email or Password"));
}
else
{
    while($row = mysqli_fetch_array($query)){ 
         $id = $row["id"];
    }
     $_SESSION["id"] = $id;
     $_SESSION["user_login"] = $user_login;
     $_SESSION["password_login"] = $password_login;
     if (isset($_SESSION["user_login"]) && isset($_SESSION["password_login"]))
     {echo retmsg(1,"profile.php?id=$id");}
 }

 function retmsg($status,$txt)
 {
return json_encode(array('status' => $status, 'txt' => $txt));
 }
 ?>

1 个答案:

答案 0 :(得分:1)

我看了你的网站。您服务器的响应包括

Access denied for user 'root'@'localhost' (using password: NO) 

检查您正在使用的数据库登录凭据,并确保 使用密码登录数据库。