Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/257.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
上载网站后PHP登录表单不起作用_Php_Mysql_Session_Web Hosting - Fatal编程技术网

上载网站后PHP登录表单不起作用

上载网站后PHP登录表单不起作用,php,mysql,session,web-hosting,Php,Mysql,Session,Web Hosting,编辑:PHP标记后面有不可见的空格。我把它们移走了,现在开始工作了 所以我有一个网站项目,这是建立了4个星期。 这是login.php的代码 <?php session_start(); // Starting Session $error=''; if (isset($_POST['ComeIn'])) { //NAME OF THE BUTTON CLIKED if (empty($_POST['email']) || empty($_POST['pwd'])) {

编辑:PHP标记后面有不可见的空格。我把它们移走了,现在开始工作了

所以我有一个网站项目,这是建立了4个星期。

这是login.php的代码

<?php
 session_start(); // Starting Session
 $error=''; 

 if (isset($_POST['ComeIn'])) { //NAME OF THE BUTTON CLIKED

if (empty($_POST['email']) || empty($_POST['pwd'])) {   //IF EMPTY
$error = "Username or Password is invalid";
}
else 
    {

        $username=$_POST['email'];
        $password=$_POST['pwd'];
        include ('connection.php');


        $username = mysql_real_escape_string($username);
        $password = mysql_real_escape_string($password);


        $query = mysql_query("SELECT * from user_account where Password='$password' AND Email='$username'", $connection);
        $row1= mysql_fetch_array($query);
        $rows = mysql_num_rows($query);

            if ($rows == 1) {   //IF OK
                if ($row1['AccType'] == "Teacher")
                {
                    $_SESSION['login_user']=$username; // Initializing Session
                    header("location: teachers/teacherprofile.php"); // Redirecting To Other Page
                }
                else if ($row1['AccType'] == "Student")
                {
                    $_SESSION['login_user']=$username; // Initializing Session
                    header("location: students/studentprofile.php"); // Redirecting To Other Page
                }

                else
                {
                    echo ("<script language = 'Javascript'>
                            window.alert('Incorrect Input!')
                            window.location.href='index.php'
                            </script>");
                }
            } else 
                {
                    echo ("<script language = 'Javascript'>
                            window.alert('Incorrect Input!')
                            window.location.href='index.php'
                            </script>");
                }
                }

        mysql_close($connection); 
    }

?>

这是一种常见现象,称为。
您应该在脚本顶部打开错误报告,以找出问题所在,这就是问题的原因

<?php
ini_set('display_errors', 1);
error_reporting(-`);

您可以在
mysql\u查询()中删除
$connection
。是否有任何错误?您的脚本可能正在消亡或不符合任何条件。将此
ini\u设置('display\u errors',1);错误报告(-1)显示在脚本顶部,并向我们显示弹出的错误。另一件事是
mysql.*
已被弃用。。。。检查您现在正在运行的php版本…当我放置ini_集('display_errors',1)时;错误报告(-1);我在/hermes/bosoraweb126/b1216/ipg.meteacherscom/login2.php行中遇到以下错误:警告:session_start():无法发送会话缓存限制器-已发送头(输出从/hermes/bosoraweb126/b1216/ipg.meteacherscom/login2.php开始)4@Darren成功了!里面有看不见的字符。我现在爱你(不是同性恋)。我知道这个名字来自哪里(死亡的白色屏幕):)
<?php
ini_set('display_errors', 1);
error_reporting(-`);