1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2017
    Rep Power

    Redirection if the user is not logged in

    Redirection if the user is not connected

    Hello I have a project to submit soon. I started it but I have a little trouble. Actually my frontcontroller is loading the default controller(AccueilController) if there is no route. In the Accueilcontroller, the constructor check if $_Session[logged_in]= true and if it is the case, the default page is show else the constructor redirects it to the loginController which shows the user the loginform. Till there everything is working. But when I try to connect with non-existants email, password or even existants ones and click on submit, it redirects me to my Error page which is weird because it should say if my login informations are correct or not .

    Here is the link of my project: https://github.com/aita-kane/My-TAFF-

    . All help / advices appreciate. Thank you for the help
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Rep Power
    Please post your code here using the proper tags. See the sticky at the top of this forum that says READ THIS BEFORE POSTING. The built-in formatter makes your code easier to read and will generate quicker responses. Also be sure to post the errors you are getting.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2018
    Rep Power
    header('Location: index.php');
    And move the call to redirect above all the html output:

    <?php session_start();
    if(isset($_SESSION['username'])) {
    } ?>

IMN logo majestic logo threadwatch logo seochat tools logo