Guest User

Untitled

a guest
Aug 23rd, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. <?PHP
  2.  
  3. require_once('includes/cleanInput.php');
  4. require_once('includes/config.php');
  5. require_once('includes/db.class.php');
  6.  
  7. session_start();
  8.  
  9. // Calling mySQL
  10. $db = new db_class;
  11.  
  12. if(!$db->connect($config['MasterServer']['servername'], $config['MasterServer']['username'], $config['MasterServer']['password'], $config['Database']['dbname'], true)){
  13. $db->print_last_error(false);
  14. }
  15.  
  16. ?>
  17. <head>
  18. <title>Insurance - Administration Login</title>
  19. <style type="text/css">
  20. .style1 {text-align: center;}
  21. .style2 {background-image: url("images/logintop.png");}
  22. .style3 {background-image: url("images/loginmid.png");}
  23. .style4 {background-image: url("images/loginbtm.png");}
  24. .style5 {text-align: right;}
  25. .style6 {text-align: left;}
  26. </style>
  27. </head>
  28. <body style="background-color: #333333">
  29. <?php if(!isset($_SESSION['loggedin'])){
  30. echo'
  31. <p><br/></p>
  32. <table cellpadding="0" cellspacing="0" style="width: 410px; height: 23px;" align="center" class="style2"><tr>
  33. <td class="style1"></td></tr></table>
  34. <table cellpadding="0" cellspacing="0" class="style3" style="width: 410px; height: 23px;" align="center"><tr>
  35. <td class="style1">
  36. <form name="login" method="post" style="height: 97px" action="<?PHP $_SERVER['PHP_SELF']; ?>">
  37. <div class="style6">
  38. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please Login
  39. <img alt="" height="16" src="images/key.png" width="16" /><br /></div>
  40. <table cellpadding="2" cellspacing="0" style="width: 77%; height: 67px;">
  41. <tr><td style="width: 263px" class="style5">Username:</td>
  42. <td class="style5"><input name="username" style="width: 145px" type="text" /></td>
  43. </tr><tr><td style="width: 263px; height: 26px;" class="style5">Password:</td>
  44. <td class="style5" style="height: 26px">
  45. <input name="password" style="width: 145px" type="password" /></td>
  46. </tr><tr><td style="width: 263px" class="style5">&nbsp;</td><td class="style1">
  47. <input name="submitlogin" style="width: 74px" type="submit" value="Submit" /></td>
  48. </tr></table><br/></form></td></tr>
  49. </table><table cellpadding="0" cellspacing="0" class="style4" style="width: 410px; height: 23px;" align="center"><tr>
  50. <td class="style1">&nbsp;</td></tr></table></body></html>';
  51.  
  52. if(isset($_POST['submitlogin'])){
  53. if(isset($_POST['username']) && isset($_POST['password'])){
  54. $q = $db->select("SELECT * FROM `users` WHERE `username` = '".mysql_escape_string($_POST['username'])."' AND `password` = '".md5(mysql_escape_string($_POST['password']))."'");
  55. //$loggin = $db->select("SELECT * FROM `users` WHERE `username` = '".$_POST['username']."' AND `password` = '".md5($_POST['password'])."'");
  56. if(mysql_num_rows($q) == 1){
  57. $_SESSION['loggedin'] = true;
  58. } else {
  59.  
  60. echo '<div style="border: 1px solid red; font-size: 9pt; font-family: monospace; color: red; padding: .5em; margin: 8px; background-color: #FFE2E2">
  61. <span style="font-weight: bold">Failed Login</span>
  62. </div>';
  63.  
  64. }
  65. }
  66. }
  67. }else{
  68. echo "view page";
  69. }
  70. ?>
Add Comment
Please, Sign In to add comment