0

i've tried every trick i know and they won't work this is the code : the result shows me blacnk page with no errors please help me out i'm an amateur

<?php
if (isset($_POST['username']) && isset($_POST['mdp']))
{
    //creation objet base de donnée

    //requête
    try
        {
            $db = new 
PDO('mysql:host=localhost;dbname=ecrmanager','root','');
            $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
            $req = $db->prepare('SELECT idUti FROM utilisateur WHERE 
nomUti=? AND mdp =?');
            $req->execute(array($_POST['username'] ,sha1($_POST['mdp'])));  
        }
    catch(Exception $e)
        {
            die('Erreur :'.$e->getMessage());
        }


    $resultat = $req->fetch();

    if (!$resultat) 
        {
            header('location:login.php?con=0#signin');
            exit();
        }
    else
        {   
            //A changer après bdd wiring
            header('location:profil.php');
            exit();
        }
}
  • Where is the form? If `$_POST` is not filled, nothing will be outputted in the code here. And explain more, what goes on step by step. – JustOnUnderMillions Apr 20 '17 at 16:36
  • Turn on error reporting. You probably have an error or output somewhere. – John Conde Apr 20 '17 at 16:36
  • Have you tried ob_start()? Linking descriptions: http://stackoverflow.com/questions/4401949/whats-the-use-of-ob-start-in-php and http://php.net/manual/en/function.ob-start.php If that doesn't work you might want to insert some type of alerts/echos/prints in each of your conditional statements to track the processing – Vbudo Apr 20 '17 at 16:41

0 Answers0