-1

i have issue in my project, when i run it with DevServer 17 did't work, but when i use xampp it works .. the problem and the question is i want to know why this happen only in that project specially this part of my code.

in xampp the code work correctly and connect with db, but in Devserver it will show the page _403.html (error page) at the end of the code .

any idea please ?

<?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 ]);
}?>
Shadow
  • 33,525
  • 10
  • 51
  • 64
LiamSi
  • 1
  • 2

1 Answers1

0

Go back to your form and ensure its method is defined as post.

Ezekiel Arin
  • 115
  • 6