Advertisement
Guest User

Untitled

a guest
Jun 10th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.37 KB | None | 0 0
  1. <?php
  2.     ini_set('display_errors', 'On');
  3.     error_reporting(E_ALL | E_STRICT);
  4.     session_start();
  5. ?>
  6.  
  7. <html>
  8.     <head>
  9.         <title>Admin Control Panel</title>
  10.         <link rel="stylesheet" href="style.css"/>
  11.     </head>
  12.     <body>
  13.             <?php              
  14.                 include('../include/mysql_config.php');
  15.                
  16.                 $error = 'Could not connect to database; either the table is missing, ' .
  17.                          'or mySQL is offline.';
  18.                 mysql_connect('localhost', $sql_user, $sql_password);
  19.                 @mysql_select_db($sql_database) or die ($error);
  20.                 $query = mysql_query('SELECT * FROM site_admin');
  21.                
  22.                 if (!$query) {
  23.                     print $error;
  24.                 } else {
  25.                     if (($_SESSION['valid_username']) && ($_SESSION['valid_password'])) {
  26.                         $checklogin = mysql_query('SELECT * FROM site_admin' .
  27.                                                   "WHERE 'admin_username'=" . $_POST['username'] . " " .
  28.                                                   "AND 'admin_password'=" . $_POST['password']);
  29.                         if ($checklogin) {
  30.                             echo 'Signed in.';
  31.                         }
  32.                     } else {
  33.             ?>
  34.                         <div class='title'>AdminCP</div><p>
  35.                         <div class='login'>
  36.                             Please sign in.
  37.                             <form action="login.php" method="post">
  38.                                 Username: <input type="text" name="username" maxlength="15"></br>
  39.                                 Password: <input type="password" name="password" maxlength="15"></br>
  40.                                 <input type="submit" value="Submit">
  41.                             </form>
  42.                         </div>
  43.             <?php
  44.                     }
  45.                 }
  46.             ?>
  47.     </body>
  48. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement