0

Warning : session_start(): open(/var/cpanel/php/sessions/ea-php56/sess_fev6dbvf7sa7icsacsbrin9cb1, O_RDWR) failed: No such file or directory (2) in /home/groupmoe/public_html/pc/index.php on line 2

Warning : session_start(): Cannot send session cache limiter - headers already sent (output started at /home/groupmoe/public_html/pc/index.php:2) in /home/groupmoe/public_html/pc/index.php on line 2

Warning : Cannot modify header information - headers already sent by (output started at /home/groupmoe/public_html/pc/index.php:2) in /home/groupmoe/public_html/pc/index.php on line 67

My Index.php source code is (this is a login page):

    <?php
    session_start(); // The line of error is just this
    //session_destroy();

  if(!empty($_POST)){
  $maVariable = $_POST;
  $_SESSION['username'] = $_POST['username'];

//Connection to database
require_once('./inc/db.php');
//Connexion à la Base de données
require_once('./inc/db2.php');


    $usernameVerification = "SELECT * FROM agent WHERE username = '".$maVariable['username']."'  ";
    $requete = mysqli_query($mysqli, $usernameVerification);


    if (mysqli_num_rows($requete) >=1){


        while($row = mysqli_fetch_assoc($requete)){ 


            //Decryption of passwords from the database
            if(password_verify($maVariable['password'], $row['password'])){
                if($row['agentStatus'] == 0){
                session_destroy();
                die("<br><br><br><br><br>
                    <center><img class='mb-4' src='img/logo.png'>
                    <br><br><br>
                    <h2>Sorry, your account are desactivated by the administrator!</h2>
                    <a href='index.php'>Go back to connexion page</center></a>");   
                }   
                $_SESSION['utilisateur'] = '';
                $_SESSION['roleuser']= $row['roleId'];

                header('Location:app/index.php');

            }else{
                $error_login = "Password incorrect";
            }
         }



    } else {
        $error_login = "Username incorrect";
    }


mysqli_close($mysqli);
  }
?>


<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="robots" content="noindex,nofollow" />
    <link rel="icon" href="img/favicon.png">

    <title>My app</title>
    <?php header("refresh:600;url=http://mywebsite.com");?>

    <!-- Bootstrap core CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="css/signin.css" rel="stylesheet">
  </head>

  <body class="text-center">


    <form class="form-signin" action="" method="post" name="connect_form">

      <img class="mb-4" src="img/logo.png" alt="" >
<?php
if (isset($error_login)){
    echo "<p style='color:red'>$error_login</p>";
} ?>
      <label for="inputEmail" class="sr-only">Username</label>
      <input type="text" id="username" class="form-control" placeholder="Username" name="username" required autofocus>
      <label for="inputPassword" class="sr-only">Password</label>
      <input type="password" id="password" class="form-control" placeholder="Password" name="password" required>

      <button class="btn btn-lg btn-primary btn-block" type="submit">Connexion</button>
    </form>
  </body>
</html>

Your help will be highly appreciated!

user3783243
  • 5,368
  • 5
  • 22
  • 41
Jackpot
  • 15
  • 5

0 Answers0