【问题标题】:Code PHP Not Working in Easyphp Devserver17?代码 PHP 在 Easyphp Devserver17 中不起作用?
【发布时间】:2021-03-05 01:18:38
【问题描述】:

我的项目中有问题,当我使用 DevServer 17 运行它时不起作用,但是当我使用 xampp 时它起作用了.. 问题和问题是我想知道为什么这只发生在该项目中特别 我的这部分代码

xampp中代码正常工作并与db连接,但在Devserver中它会在代码末尾显示页面_403.html(错误页面)。

有什么想法吗?

<?php

require_once ('database_connection.inc');
$statement = $connect->prepare("SELECT user_id FROM all_user WHERE email = ?");
$statement->execute(array( corection("email") ) );
if( $statement->rowCount() > 0 ){
    session_start();
    $_SESSION['err']="email Exist";
    $_SESSION['mailo'] = corection("email");
    header('location:login_err.php');
    exit;
}
else if(!($_SERVER['REQUEST_METHOD'] == 'POST') || ! isset($_POST["subscribe"]) ):
    header("location:../erreur/_403.html");
    exit;
else:

    $test = false || vide("email") ;
    $test = $test || vide("password");
    $test = $test || vide("Firstname");
    $test = $test || vide("Lastname");
    $test = $test || vide("gender"); 
    $test = $test || vide("year"); 
    $test = $test || vide("month"); 
    $test = $test || vide("day") ;
    
    if(!$test):

        $data = array(
            ':email'        =>  corection("email"),
            ':password'     =>  password_hash( corection("password") , PASSWORD_DEFAULT) ,
            ':first_name'   =>  corection("Firstname") ,
            ':last_name'    =>  corection("Lastname") ,
            ':sexe'         =>  corection("gender") ,
            ':berth_day'    =>  corection("year")  . "-" . corection("month") . "-" . corection("day"),
        );

        $query = "INSERT INTO all_user (email, password , first_name , last_name , berth_day ,sexe ) VALUES (:email, :password , :first_name , :last_name ,  :berth_day , :sexe )";

        
        $statement = $connect->prepare($query);

        if($statement->execute($data)):
            //login

            $statement = $connect->prepare(" SELECT * FROM all_user  WHERE email = :email ");
            $statement->execute( array( ':email' => corection("email") ) );
            if($statement->rowCount() > 0):
                session_start();
                $result = $statement->fetchAll();
                foreach($result as $row):
                    $_SESSION['user_id']    = $row['user_id'];
                    $_SESSION['email']      = $row['email'];
                    $statement = $connect->prepare("INSERT INTO login_details (user_id) VALUES ('".$row['user_id']."')");
                    $statement->execute();
                    $_SESSION['login_details_id'] = $connect->lastInsertId();
                    $_SESSION['etaConnt']   = $row['etaConnt'];
                    header('location:subscribe_3_valid_email.php');
                    exit;
                endforeach;
           endif;
        endif;
    endif;
endif;

header('location:../erreur/_403.html');

exit;

function corection($str){
    return trim(htmlspecialchars( $_POST[$str] ));
}

function vide($str){
    return empty($_POST[ $str ]);
}?>

【问题讨论】:

  • 你确定你没有到达第 14 行吗?
  • 不,我确定没有到达线路 //LOGIN $statement = $connect-&gt;prepare(" SELECT * FROM all_user WHERE email = :email ");

标签: php mysql xampp devserver


【解决方案1】:

返回您的表单并确保其方法定义为 post。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-24
    • 2015-10-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多