Advertisement
kaleotter

Login test

May 25th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.20 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <!--
  3. To change this license header, choose License Headers in Project Properties.
  4. To change this template file, choose Tools | Templates
  5. and open the template in the editor.
  6. -->
  7. <html>
  8.             <?php
  9.         require 'credentials.php';
  10.         session_start();
  11.         $error = "nothing to see here. Yet.";
  12.         $userID = 0;
  13.         $errorMsg='No error message generated';
  14.        
  15.         if($_SERVER["REQUEST_METHOD"]=== "POST")
  16.         {
  17.             $username = mysqli_real_escape_string($conn,$_post['username']);
  18.             $password = mysqli_real_escape_string($conn,$_post['Password']);
  19.            
  20.            
  21.            If(!$conn->query("Set @outuser=''") || !$conn->query("Set @outmessage=''") ||  $conn->query("CALL dologin($username, $password,@outuser, @outmsg);"))
  22.            {
  23.                echo "call failed: (" . $conn->errno . ")" .$conn->error;
  24.            }
  25.            
  26.            if(!($rsUsr = $conn->query ("Select @outUser AS _dologin_out")))
  27.            {
  28.                echo "Fetch failed: (" . $conn->errno . ") " . $conn->error;
  29.            }
  30.            
  31.            if(!($rsError = $conn->query ("Select @outmsg AS _dologin_out")))
  32.            {
  33.                echo "Fetch failed: (" . $conn->errno . ") " . $conn->error;
  34.            }
  35.            
  36.            $usrRow= $rsUsr->fetch_assoc();
  37.            $userID = $usrRow['_dologin_out'];
  38.            $msgRow = $rsError->fetch_assoc();
  39.            $errorMsg = $msgRow ['_dologin_out'];
  40.            
  41.            echo $userID;
  42.            echo $errorMsg;
  43.            
  44.            
  45.         }
  46.        
  47.         ?>
  48.    
  49.     <head>
  50.         <meta charset="UTF-8">
  51.         <title>Login Page</title>
  52.         <style type ='text/css'>
  53.             body
  54.             {
  55.                 font-family:Arial,Helvetica, sans-serif;
  56.                 font-size:14px;
  57.             }
  58.            
  59.             label
  60.             {
  61.                 font-weight:bold;
  62.                 width:100px;
  63.                 font-size:14px;
  64.             }
  65.            
  66.             box
  67.             {
  68.                 border:#666666 solid 1px;
  69.             }
  70.         </style>
  71.     </head>
  72.     <body bgcolor = #fffffff>
  73.         <div align "center">
  74.              <div style =" width:300px, border: solid 1px" align ="left">
  75.                  <div style =" background-color:#333333; color:#FFFFFFF padding:3px"><b>
  76.                          <div style ="margin:30px">
  77.                              
  78.                              <form action = "" method = "post">
  79.                                    <label>UserName  :</label><input type ="text" name ="username" class ="box"/><br /><br />
  80.                                    <label>Password  :</label><input type ="password" name ="password" class ="box"/><br /><br />
  81.                                    <input type ="submit" value ="submit"/><br />
  82.                              </form>
  83.                              
  84.                              <div style ="font-size:11px; color #cc0000 margin-top:10px"><?php echo $error . " ". $errorMsg ; ?></div>
  85.                              
  86.                          </div>
  87.                  </div>
  88.             </div>
  89.  
  90.        
  91.        
  92.     </body>
  93. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement