Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- This script was downloaded at:
- LightPHPScripts.com
- Please support us by visiting
- out website and letting people
- know of it.
- Produced under: LGPL
- */
- /* Start session */
- if($startSession == TRUE){ session_start();}
- /* Config file */
- include('config.php');
- /* Check for submition */
- if($_POST['submitID'] == 1){
- /* Connect to database */
- if($connectDatabase == TRUE){$action=TRUE;include('connect.php');}
- /* sanitize and check info */
- $userName = mysql_real_escape_string($_POST['userName'],$dbc);
- $password = mysql_real_escape_string($_POST['password'],$dbc);
- if($userName == NULL) { $message = 'Please enter username.';}
- if($message == NULL && $password == NULL){ $message = 'Please enter password.';}
- if($message == NULL)
- {
- $userQuery = mysql_fetch_row(mysql_query("SELECT COUNT(*) FROM " . $tableName .
- " WHERE `" . $userNameField . "`='$userName' AND `" . $userPasswordField . "`='$password'"));
- /* If usercount is more than 0 -> ok */
- if($userQuery[0] > 0){
- /* Disconnect from database */
- if($connectDatabase == TRUE){$action=FALSE;include('connect.php');}
- $_SESSION['isLoged'] = 'yes';
- $_SESSION['userName'] = $userName;
- /* add cookies ?*/
- /* expire in 1 hour */
- if($useCookies == TRUE)
- {
- setcookie("isLoged", 'yes', time()+logedInFor, "/", ".$domainName", 1);
- setcookie("userName", $userName, time()+logedInFor, "/", ".$domainName", 1);
- }
- /* Redirect to login page */
- header("Location: $loginPage");
- exit();
- } else {
- $message = 'Invalid username and/or password!';
- }
- }
- /* Disconnect from database */
- if($connectDatabase == TRUE){$action=FALSE;include('connect.php');}
- }
- ?>
- <!--
- /*
- This script was downloaded at:
- LightPHPScripts.com
- Please support us by visiting
- out website and letting people
- know of it.
- Produced under: LGPL
- */
- -->
- <?php
- /* Display error messages */
- if($message != NULL){?>
- <table width="100%" border="0" cellpadding="3" cellspacing="0" bgcolor="#FFCCCC">
- <tr>
- <td><div align="center"><strong><font color="#FF0000"><?=$message;?></font></strong></div></td>
- </tr>
- </table>
- <?php } ?>
- <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" name="login" id="login" style="display:inline;">
- <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
- <tr>
- <td width="47%"><strong><font color='#F4ED1A'>Username:</strong>
- <width="53%"><input name="userName" type="text" id="userName">
- <strong><font color='#F4ED1A'>Password:</strong>
- <input name="password" type="password" id="password">
- <colspan="2"><font face="Georgia, Times New Roman, Times, serif"><strong>
- <input name="Submit" type="submit" id="Submit" value="Log In">
- <input name="submitID" type="hidden" id="submitID" value="1">
- </strong></font> </div></td>
- </tr>
- </table>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement