Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if( !$HeaderSent )
- {
- if( !empty( $_POST ) )
- {
- $Username = strtolower( $_POST["mocuser"] );
- $Password = strtolower( $_POST["mocpass"] );
- $SQLCon = mysql_connect( SETTING_MYSQL_HOST, SETTING_MYSQL_USER, SETTING_MYSQL_PASS );
- if( $SQLCon )
- {
- if( mysql_select_db( SETTING_MYSQL_DB ) )
- {
- $SQLQuery = mysql_query( "SELECT * FROM users ORDER BY id ASC;" );
- while( $User = mysql_fetch_array( $SQLQuery ) )
- {
- if( strtolower( $User["username"] ) == strtolower( $Username ) )
- {
- if( $User["password"] == $Password )
- {
- while( true )
- {
- $Cookie = GenerateCookie( 20 );
- $SQLQuery2 = mysql_query( "SELECT * FROM users WHERE cookie = '".$Cookie."';" );
- if( !mysql_fetch_array( $SQLQuery2 ) )
- {
- mysql_query( "UPDATE users SET cookie = '".$Cookie."' WHERE id = '".$User["id"]."';" );
- setcookie( "cid", $Cookie, time()+7200 );
- header( "Refresh: 0;URL=index.php?page=index" );
- break;
- }
- }
- }
- else
- {
- die( "Wrong password!" );
- }
- }
- else
- {
- die( "No such username!" );
- }
- }
- }
- else
- {
- die( "Could not select DB" );
- }
- }
- else
- {
- die( "Could not connect to MySQL service!" );
- }
- }
- }
- else
- {
- if( IsLoggedIn())
- {
- die( "You're already logged in" );
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement