mysql - cant execute properly php code inside html -


i have script contains 2 forms login , sign up. use php code inside same script connect database , authenticate user..every time run without php code runs wonderful. when use proper syntax , add php code gives me blank page

thanks

first code put inside body

if(isset($_post['submit']))  {       include_once ('db_info.php');      //painroume ta stoixeia apo th forma me ton pinaka $_post kai ta enapothetoume se metavlhtes     $user = $_post['username'];     $passw = $_post['password'];      $crypted_passwd = password_hash($passw, password_default);      //vlepoume tin ip tou xrhsth kai pairnoume thn wra pou ginetai aithma login sto server     $ip = $_server['remote_addi'];     $logtime = date("h:i:sa");      //sindesh me vash afou prwta exoume kanei include db_info.php     $conn = new mysqli($servername, $username, $password, $dbname);     if ($conn->connect_error) {         die("connection failed: " . $conn->connect_error);     }       //query sth vash gia na kanoume authedicate     $sql = "select * users username='$user' , password= '$crypted_passwd'";     $authedicate_user = $conn->query($sql);  if ($authedicate_user->recordcount()==1){             session_start();             $_session['auth']=true;             $_session['username']= $user;             $query2 = "update users set ip='$ip',time='$logtime' username='$user'" ;             $result = $conn->query($query2);              die(header("location:app.php"));              }       else {         die(header("location:login.php?loginfailed=true&reason=password"));            }  ?>     

and html

<html>   <head>      <link rel="shortcut icon" href="../favicon.ico">      <link rel="stylesheet" type="text/css" href="css/style.css" />       <link rel="stylesheet" type="text/css" href="css/animate-custom.css" /> </head>  <body>       <div class="container">              <div id="container" >                  <a class="hiddenanchor" id="toregister"></a>                 <a class="hiddenanchor" id="tologin"></a>                 <div id="wrapper">                     <div id="login" class="animate form">                         <form  action="<?php echo $_server['php_self']; ?>" autocomplete="on" method='post'>                              <h1>log in</h1>                              <p>                                  <label for="username" class="uname" data-icon="u" > username </label>                                 <input id="username" name="username" required="required" type="text" placeholder="username"/>                             </p>                             <p>                                  <label for="password" class="youpasswd" data-icon="p"> password </label>                                 <input id="password" name="password" required="required" type="password" placeholder="password " />                              </p>                              <p class="login button">                                  <input type="submit" value="login" id="submit" name= "submit"/>                                  <? $reasons = array("password" => "wrong username or password", "blank" => "you have left 1 or more fields blank.");                                  if ($_get["loginfailed"]) echo $reasons[$_get["reason"]]; ?>                             <p class="change_link">                                 not member yet ?                                 <a href="#toregister" class="to_register">join us</a>                             </p>                         </form>                     </div>                      <div id="register" class="animate form">                         <form  action="mysuperscript.php" autocomplete="on">                              <h1> sign </h1>                              <p>                                  <label for="usernamesignup" class="uname" data-icon="u">your username</label>                                 <input id="usernamesignup" name="usernamesignup" required="required" type="text" placeholder="username" />                             </p>                             <p>                                  <label for="emailsignup" class="youmail" data-icon="e" > email</label>                                 <input id="emailsignup" name="emailsignup" required="required" type="email" placeholder="email@somewhere.com"/>                              </p>                             <p>                                  <label for="passwordsignup" class="youpasswd" data-icon="p">your password </label>                                 <input id="passwordsignup" name="passwordsignup" required="required" type="password" placeholder="password"/>                             </p>                             <p>                                  <label for="address" class="youpasswd" data-icon="p">address </label>                                 <input id="address" name="address" required="required" type="text" placeholder="address"/>                             </p>                             <p class="signin button">                                  <input type="submit" value="sign up"/>                              </p>                             <p class="change_link">                                   member ?                                 <a href="#tologin" class="to_register"> go , log in </a>                             </p>                         </form>                     </div>                  </div>             </div>        </div> 


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -