dongxie3352 2015-06-03 19:22
浏览 36
已采纳

网站在线托管时的空白页面

I have build a small website with some php. It works perfectly on my localhost (even without database information it loads the html and css).

However when I put it online I just get a blankpage, no errors, nothing. However when I manually type a page it redirects to the login page (which is good).

Anyone experienced this before?

Thanks EDIT2: After some debugging advice I got this error

Warning: include_once(classes/users.class.php): failed to open stream: No such file or directory in /customers/c/2/9/nicolasdecroos.be/httpd.www/eindwerk/login.php on line 8 Warning: include_once(): Failed opening 'classes/users.class.php' for inclusion (include_path='.:/usr/share/php') in /customers/c/2/9/nicolasdecroos.be/httpd.www/eindwerk/login.php on line 8 Fatal error: Class 'user' not found in /customers/c/2/9/nicolasdecroos.be/httpd.www/eindwerk/login.php on line 9

Edit: Here is the PHP code on the login page

<?php
session_start();
    include_once("classes/users.class.php");
    $user = new user();

    if(isset($_SESSION['loggedin']))
    {
        header('location: index.php');
    }
    else
    {
        if(!empty($_POST))
        {
            try
            {
                $user->login($_POST['studentennummer'],$_POST['password']);
            }
            catch (Exception $error)
            {
                $message = $error->getMessage();
            }
        }
    }
?>

This is users.class

*Sorry if it's to much code, I'm not sure which part would be the most interesting.

<?php
    include_once("classes/db.class.php");

    class user
    {
         private $m_sStudentennummer;
         private $m_sPassword;
         private $m_sStatus;



         public function __get($p_sProperty)
         {
            switch ($p_sProperty) 
            {
                case 'Studentennummer':
                    return $this->m_sStudentennummer;
                    break;

                case 'Password':
                    return $this->m_sPassword;
                    break;

                case 'Status':
                    return $this->m_sStatus;
                    break;

            }
         }

         public function __set($p_sProperty, $p_vValue)
         {
            switch ($p_sProperty) 
            {
                case 'Studentennummer':
                    $this->m_sStudentennummer = $p_vValue;
                    break;

                case 'Password':
                    $this->m_sPassword = $p_vValue;
                    break;

                case 'Status':
                    $this->m_sStatus = $p_vValue;
                    break;

            }
         }

         public function userCheck($p_sInput)
         {
            $db = new db();

            $sql = "SELECT * FROM users WHERE u_id = '". $p_sInput . "'";

            $result = $db->conn->query($sql);

            if ($result->num_rows == 0) 
            {
                return "true";
            }
            else
            {
                return "false";
            }
         }

         public function login($p_sStudentennummer, $p_sPassword)
         {
            $db = new db();

            $sql = "SELECT * FROM users WHERE u_nr = '".$db->conn->real_escape_string($p_sStudentennummer)."' AND u_pass = '".$db->conn->real_escape_string($p_sPassword)."';";

            $result = $db->conn->query($sql);

            $rows = $result->fetch_assoc();

             $status = "SELECT * FROM users WHERE u_nr = '".$db->conn->real_escape_string($p_sStudentennummer)."' AND u_pass = '".$db->conn->real_escape_string($p_sPassword)."' AND u_group = 'student'";

             $statusRes = $db->conn->query($status);

            if ($result->num_rows == 1)
            {
                if ($statusRes->num_rows == 1)
                {
                $_SESSION['u_id'] = $rows['u_id'];
                $_SESSION['loggedin'] = 1;
                header('Location: index.php');
                }
                else
                {        
                $_SESSION['u_id'] = $rows['u_id'];
                $_SESSION['loggedin'] = 1;
                header('Location: my_events.php');
                }
            }
            else
            {
                throw new Exception("Username and/or password are invalid.");
            }
         }
    }
?>
  • 写回答

2条回答 默认 最新

  • doukuangxiu1621 2015-06-03 20:07
    关注

    Alright,

    It was something dumb but I'll post it incase someone has troubles with this.

    The map was called "Classes". in the code it was written as "classes".

    On localhost it wasn't a problem, but when you put it online it is.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 ogg dd trandata 报错
  • ¥15 高缺失率数据如何选择填充方式
  • ¥50 potsgresql15备份问题
  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错