Advertisement
Guest User

blank white screen

a guest
Jul 17th, 2018
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.82 KB | None | 0 0
  1.  
  2.  
  3.         <?php
  4.             session_start();
  5.             require '../inc/connection.php';
  6.            
  7.         if(isset($_SESSION['logged_in'])){
  8.                 //echo "Dashboard";
  9.                  include 'templates/header.php';
  10.                  ?>
  11.                  
  12.               <div class="list-group">
  13.                 <div class="list-group-item">
  14.  
  15.                     <a class="list-group-item" href="add.php">
  16.                         <h4 class="list-group-item-heading">Add Post or Article</h4>
  17.                         <p class="list-group-item-text">
  18.                      Create New post or article to your CMS blog system with pdo way</p>
  19.                     </a>
  20.  
  21.                     <a class="list-group-item" href="delete.php">
  22.                         <h4 class="list-group-item-heading"> Delete Post or Article</h4>
  23.                         <p class="list-group-item-text"> Delete Old post or article from your CMS blog system with pdo way  </p>
  24.                     </a>
  25.  
  26.                     <a class="list-group-item active" href="logout.php">
  27.                         <h4 class="list-group-item-heading">  Logout</h4>
  28.                         <p class="list-group-item-text">  Logout and go have some fun</p>
  29.                     </a>
  30.  
  31.                 </div>
  32.             </div> <!-- End list-group -->      
  33.            
  34.         <?php  
  35.         include 'templates/footer.php';
  36.             }else{
  37.  
  38.            
  39.             if(isset($_POST['username'], $_POST['password'])){
  40.                     $username = $_POST['username'];
  41.                     $password = $_POST['password'];
  42.                             if(empty($username) or empty($password)){
  43.                             $error = 'Username or Password Empty';
  44.                             }else{
  45.                                
  46.         $query = $pdo->prepare("SELECT * FROM `users` WHERE username=? AND password=? ");
  47.                         $query->bindValue(1, $username);
  48.                         $query->bindValue(2, $password);
  49.                         $query->execute();
  50.                         $num = $query->rowCount();
  51.  
  52.                         if($num == 1){
  53.                             $_SESSION['logged_in'] = true;
  54.                             header('Location: index.php');
  55.                             exit();
  56.                         }else{
  57.                             $error = 'Wrong Username or Password';
  58.                         }
  59.                                
  60.             }//else
  61.         }
  62.         include 'templates/header.php';
  63.  
  64.         if(isset($error))
  65.                     echo "<p class='bg-danger btn-lg'> $error </p>";     
  66.            
  67.                
  68.  
  69.         ?>
  70.         <form action="index.php" method="post" rol="form">
  71.                
  72.         <div class="form-group">
  73.                     <label for="">Username : </label>
  74.            <input class="form-control" name="username" placeholder="username" type="text">
  75.                 </div>
  76.  
  77.                  <div class="form-group">
  78.                     <label for="">Password : </label>
  79.          <input class="form-control" name="password" placeholder="password" type="password">
  80.                 </div>
  81.  
  82.                 <input class="btn btn-info btn-lg btn-block" value="Login" type="submit">
  83.             </form>
  84.            
  85.             <?php
  86.             include 'templates/footer.php';
  87.          ?>
  88.         <?php   } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement