Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/277.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_Authentication - Fatal编程技术网

Php 登录后的空白页

Php 登录后的空白页,php,authentication,Php,Authentication,我正在尝试创建一个带有PDO和会话的登录/注册系统,用户可以创建他的帐户,他可以访问欢迎页面,但是当注销并尝试使用工作用户名和密码重新登录时,它会将我发送到一个空白的php页面,我在internet上查看,空白的php页面表示语法错误,我找不到任何错误。 顺便说一句,我试着用任何密码键入任何用户名,但它仍然将我发送到一个空白的php页面 这是我的密码: Config.php class config { public static function connect() {

我正在尝试创建一个带有PDO和会话的登录/注册系统,用户可以创建他的帐户,他可以访问欢迎页面,但是当注销并尝试使用工作用户名和密码重新登录时,它会将我发送到一个空白的php页面,我在internet上查看,空白的php页面表示语法错误,我找不到任何错误。 顺便说一句,我试着用任何密码键入任何用户名,但它仍然将我发送到一个空白的php页面 这是我的密码: Config.php

class config {

    public static function connect()
    {
        $host = "localhost";
        $username = "root";
        $password = "";
        $dbname = "logintest";

        try{

            $bdd = new PDO("mysql:host=$host;dbname=$dbname",$username,$password);

            $bdd->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_WARNING);


        }catch(PDOException $e)
        {
            echo "Connection échoué" . $e->getMessage();
        }
        return $bdd;
    }
}

?>
My process.php(我认为这就是问题的根源:


session_start();

    include_once("config.php");

        if(isset($_POST['register']))
        {
            $bdd = config::connect();
            $username = $_POST['username'];
            $email = $_POST['email'];
            $password = $_POST['password'];

    if(insertDetails($bdd,$username,$email,$password))
    {
        $_SESSION['username'] = $username;
        header("Location: profile.php");
    }

}


    if(isset($_POST['login']))
    {
        $bdd = config::connect();
        $username = $_POST['username'];
        $password = $_POST['password'];

    if(checkLogin($bdd,$username,$password))
        {
            $_SESSION['username'] = $username;
            header("Location: profile.php");
        }
    else{
        echo "Le mot de passe ou le nom d'utilisateur sont incorrect";
    }
}


    function insertDetails($bdd,$username,$email,$password)
        {
            $query = $bdd->prepare("

                INSERT INTO users (username,email,password)

                VALUES(:username,:email,:password)

                ");
            $query->bindParam(":username",$username);
            $query->bindParam(":email",$email);
            $query->bindParam(":password",$password);

    return $query->execute();
}


    function checkLogin($bdd,$username,$password)
    {
        $query = $bdd->prepare("

            SELECT * From users WHERE username=:username AND password=:password

        ");

        $query->bindParam(":username", $username);
        $query->bindParam(":password", $password);

        $query->execute();

    // Check how many rows are returned

        if ($query->rowCount() == 1)
        {
            return true;
        }
        else {
            return false;
        }

    }

my profile.php:

session_start();

include_once("config.php");

echo "Bienvenue " . $_SESSION['username'] . "  ";

echo "<a href='logout.php'>Se deconnecter</a>". "  ";

echo "<a href='update.php'>Mettre a jour le profile</a>" . "  ";

echo "<a href='delete.php'>Supprimer mon compte</a>". "  ";

?>```
and my logout.php :
```<?php

session_destroy();

header("Location: index.html");
?>
session_start();
包括_once(“config.php”);
回显“Bienvenue”。$\u会话['username']。”;
“回声”;
“回声”;
“回声”;
?>```
以及我的logout.php:
```
或者这是我正在做的项目:

我愿意接受任何帮助 谢谢
(顺便说一句,很抱歉我的英语和法语不好)

我找到了解决办法 我忘了在process.php中输入大写字母“L”

 if(isset($_POST['login']))
我已经把它改成

 if(isset($_POST['Login']))
现在它开始工作了。 感谢您的关注。

错误报告(E_ALL);ini_set('display_errors',1);
添加到所有PHP文件的顶部以显示错误。这将有助于您调试问题,或者使用实际错误编辑问题。