Advertisement
arikSarkar

index_new.php

Jan 6th, 2018
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.90 KB | None | 0 0
  1. <?php
  2.     $error = $result = "";
  3.     include('config.php');
  4.     if (isset($_POST['login-btn'])) {
  5.  
  6.         if (!$_POST['username']) {
  7.             $error = "<br>- Please enter Username.";
  8.         }
  9.         if (!$_POST['password']) {
  10.             $error.= "<br>- Please enter Password.";
  11.         }
  12.  
  13.         if (!$error) {
  14.             $username = test_input($_POST['username']);
  15.             $password = test_input($_POST['password']);
  16.  
  17.             $sql_query = "SELECT * FROM users WHERE username='$username' AND password='$password'";
  18.             # querying the database for uname and pass
  19.            $result_sql = mysqli_query($db, $sql_query);
  20.             # validating the result.
  21.  
  22.             if (mysqli_num_rows($result_sql) == 1) {
  23.             // User Logged in.
  24.                 session_start();
  25.                 $_SESSION['username'] = $username; # create username session
  26.                $_SESSION['login-success'] = "You're now logged in."; # display a success msg to the signed in user
  27.                header("location: index.php"); # redirect to the homepage
  28.            }
  29.  
  30.             else {
  31.                 $error .= "<br>- Wrong Username or Password.";
  32.             }
  33.         }
  34.  
  35.         if ($error) {
  36.            $result = "Oops! seems there's an error. Please correct the following:".$error;
  37.         }
  38.  
  39.     }
  40.  
  41.     function test_input($data) {
  42.       $data = trim($data);
  43.       $data = stripslashes($data);
  44.       $data = htmlspecialchars($data);
  45.       return $data;
  46.     }
  47.  
  48.  ?>
  49.  
  50.  
  51. <!DOCTYPE html>
  52. <html>
  53. <head>
  54.     <title>Home Page</title>
  55.     <meta name="viewport" content="width=device-width, initial-scale=1">
  56.     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  57.     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  58.     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  59.     <style type="text/css">
  60.        
  61.         body {
  62.             font-size: 120%;
  63.             background: #F8F8FF;
  64.         }
  65.  
  66.         .row.content {
  67.             height: 1500px;
  68.         }
  69.        
  70.         .gap {
  71.             margin-top: 10px;
  72.         }
  73.  
  74.         .col-sm-3 {
  75.             height: 100%;
  76.         }
  77.  
  78.  
  79.         .panel-body {
  80.             background-color: #c9c9f2;
  81.             font-size: 17px;
  82.             font-weight: bold;
  83.         }
  84.  
  85.         .well p{
  86.             font-size: 10px;
  87.         }
  88.         .panel-footer, .well b {
  89.             font-size: 14px;
  90.         }
  91.  
  92.         ul {
  93.             list-style: none;
  94.         }
  95.  
  96.         li {
  97.             font-weight: bold;
  98.         }
  99.  
  100.         #error {
  101.           margin: 5px 0px 5px 2px;
  102.           padding: 3px;
  103.           border: 1px solid #a94442;
  104.           color: #a94442;
  105.           background: #f2dede;
  106.           border-radius: 5px;
  107.           text-align: left;
  108.         }
  109.  
  110.  
  111.     </style>
  112.  
  113.  
  114. </head>
  115. <body>
  116.     <div class="container-fluid">
  117.         <div class="row content" >
  118.             <div class="gap">
  119.             </div>
  120.             <div class="col-sm-3">
  121.                 <div class="panel panel-default">
  122.                     <div class="panel-body">Features of this software</div>
  123.                     <div class="panel-footer">
  124.                         <p id="features">Probably the most popular freeware cleaner globally with over 2 billion downloads since its launch in 2003. Piriform’s CCleaner is a quick and easy to use program which makes your computer faster, more secure and more reliable. CCleaner removes cookies, temporary files and various other unused data that clogs up your operating system. This frees up valuable hard disk space allowing your system to run faster. Removing this data also protects your anonymity meaning you can browse online more securely. The built in Registry Cleaner fixes errors and broken settings to make your computer more stable. The simple, intuitive UI and rapid but powerful cleaning make CCleaner a favourite among novices and techies alike. Professional, Network, Business and Technician Editions of CCleaner are also available for serious users.
  125.                         In short it provides:
  126.                             <ul>
  127.                                 <li>A Faster Computer</li>
  128.                                 <li>Less Crashes &amp; System Errors</li>
  129.                                 <li>More Secure Browsing</li>
  130.                                 <li>Customisable Cleaning</li>
  131.                                 <li>For more details click: <a href="https://www.piriform.com/ccleaner" style="text-decoration: none;">CCleaner</a></li>
  132.                             </ul>
  133.                         </p>
  134.                     </div>
  135.                 </div>
  136.                 <div class="well">
  137.                     <b>This is another Panel</b>
  138.                     <p>.........</p>
  139.                 </div>
  140.             </div>
  141.             <div class="col-sm-6">
  142.                 <p style="font-weight: bold;font-size: 50px;">Welcome to Fixed Assets &amp; Records</p>
  143.                 <p style="font-weight: bold;font-size: 30px;">Homepage</p><br>
  144.                 <?php if(empty($_SESSION['login-success'])) { ?>
  145.                     <div id="form">
  146.                         <?php if($result): ?>
  147.                             <div id="error">
  148.                                 <?php echo $result; ?>
  149.                             </div>
  150.                         <?php endif ?>
  151.                         <form method="post" action="index.php" class="col-sm-6">
  152.                             <div class="form-group">
  153.                                 <input type="text" class="form-control" name="username" placeholder="Username">
  154.                             </div>
  155.                             <div class="form-group">
  156.                                 <input type="password" class="form-control" name="password" placeholder="Password">
  157.                             </div>
  158.                             <div align="center">
  159.                                 <a href="register.php"><button class="btn btn-primary">Register</button></a>
  160.                                 <input type="submit" name="login-btn" class="btn btn-success" value="Login">
  161.                                 <a href="#"><button class="btn btn-info">Reset Password</button></a>
  162.                             </div>
  163.                         </form>
  164.                     </div>
  165.                 <?php } ?>
  166.             </div>
  167.             <div class="col-sm-3">
  168.                 <div class="panel panel-default">
  169.                     <div class="panel-body" id="attr">
  170.                         <p>Date<br>TimeStamp<br>
  171.                             <?php if (isset($_SESSION['login-success'])): ?>
  172.                                     <?php echo $_SESSION['username']; ?><br><a href="logout.php" style="padding: 2px;"><button class="btn btn-default">Logout</button></a>
  173.                             <?php endif ?>
  174.                         </p>
  175.                     </div>
  176.                 </div>
  177.                 <div class="panel panel-default">
  178.                     <div class="panel-body">Few Similar Softwares</div>
  179.                     <div class="panel-footer">
  180.                         <p id="features">
  181.                             <ul>
  182.                                 <li>Glary Utilities 5.72</li>
  183.                                 <li>BleachBit 1.10</li>
  184.                                 <li>Wise Registry Cleaner 9.24.597</li>
  185.                                 <li>Wise Disk Cleaner 9.28.647</li>
  186.                                 <li>For more details click: <a href="https://www.piriform.com/ccleaner" style="text-decoration: none;">CCleaner alternatives</a></li>
  187.                             </ul>
  188.                         </p>
  189.                     </div>
  190.                 </div>
  191.                 <div class="well">
  192.                     <b>Other Softwares<b>
  193.                     <p>......</p>
  194.                 </div>
  195.             </div>
  196.         </div>
  197.     </div>
  198. </body>
  199. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement