Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?PHP
- require_once('includes/cleanInput.php');
- require_once('includes/config.php');
- require_once('includes/db.class.php');
- session_start();
- // Calling mySQL
- $db = new db_class;
- if(!$db->connect($config['MasterServer']['servername'], $config['MasterServer']['username'], $config['MasterServer']['password'], $config['Database']['dbname'], true)){
- $db->print_last_error(false);
- }
- ?>
- <head>
- <title>Insurance - Administration Login</title>
- <style type="text/css">
- .style1 {text-align: center;}
- .style2 {background-image: url("images/logintop.png");}
- .style3 {background-image: url("images/loginmid.png");}
- .style4 {background-image: url("images/loginbtm.png");}
- .style5 {text-align: right;}
- .style6 {text-align: left;}
- </style>
- </head>
- <body style="background-color: #333333">
- <?php if(!isset($_SESSION['loggedin'])){
- echo'
- <p><br/></p>
- <table cellpadding="0" cellspacing="0" style="width: 410px; height: 23px;" align="center" class="style2"><tr>
- <td class="style1"></td></tr></table>
- <table cellpadding="0" cellspacing="0" class="style3" style="width: 410px; height: 23px;" align="center"><tr>
- <td class="style1">
- <form name="login" method="post" style="height: 97px" action="<?PHP $_SERVER['PHP_SELF']; ?>">
- <div class="style6">
- Please Login
- <img alt="" height="16" src="images/key.png" width="16" /><br /></div>
- <table cellpadding="2" cellspacing="0" style="width: 77%; height: 67px;">
- <tr><td style="width: 263px" class="style5">Username:</td>
- <td class="style5"><input name="username" style="width: 145px" type="text" /></td>
- </tr><tr><td style="width: 263px; height: 26px;" class="style5">Password:</td>
- <td class="style5" style="height: 26px">
- <input name="password" style="width: 145px" type="password" /></td>
- </tr><tr><td style="width: 263px" class="style5"> </td><td class="style1">
- <input name="submitlogin" style="width: 74px" type="submit" value="Submit" /></td>
- </tr></table><br/></form></td></tr>
- </table><table cellpadding="0" cellspacing="0" class="style4" style="width: 410px; height: 23px;" align="center"><tr>
- <td class="style1"> </td></tr></table></body></html>';
- if(isset($_POST['submitlogin'])){
- if(isset($_POST['username']) && isset($_POST['password'])){
- $q = $db->select("SELECT * FROM `users` WHERE `username` = '".mysql_escape_string($_POST['username'])."' AND `password` = '".md5(mysql_escape_string($_POST['password']))."'");
- //$loggin = $db->select("SELECT * FROM `users` WHERE `username` = '".$_POST['username']."' AND `password` = '".md5($_POST['password'])."'");
- if(mysql_num_rows($q) == 1){
- $_SESSION['loggedin'] = true;
- } else {
- echo '<div style="border: 1px solid red; font-size: 9pt; font-family: monospace; color: red; padding: .5em; margin: 8px; background-color: #FFE2E2">
- <span style="font-weight: bold">Failed Login</span>
- </div>';
- }
- }
- }
- }else{
- echo "view page";
- }
- ?>
Add Comment
Please, Sign In to add comment