Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Login help?

  1. #1
    Regular Coder
    Join Date
    May 2006
    Location
    Canada
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool Login help?

    PHP Code:
    <? ob_start(); ?>
    <html>
    <head>
    <title>ThugKillin</title>
    </head>
    <body>
    <center><img src="/images/THUGKILLIN.jpg" border="0" width="444" /></a></center>
    <body bgcolor="#000" text="white">
    <center>
    <?

    if( empty($_POST['username']) || empty($_POST['password']) )
    {
        echo 
    'Invalid username/password try again';

        exit();
    }

    if( !
    preg_match('/^[a-z][a-z0-9_-]{3,31}$/i'$_POST['username']) || (strlen($_POST['password']) < 6) )

    {
        echo 
    'Invalid username/password try again!';
        exit();
    }

    mysql_connect'localhost''xxx''xxx' );
    mysql_select_db'xxx' );

    $result mysql_query"SELECT id FROM users WHERE username='{$_POST['username']}' AND password='{$_POST['password']}'" );
    $user mysql_fetch_assoc$result );
    mysql_free_result$result );

    mysql_close();

    if( empty(
    $user) )
    {
        echo 
    'Invalid username/password try again!';
        exit();
    }

    $_SESSION['user_id'] = $user['id'];
    ?>
    header( 'Location: http://thugkillin.urlshort.com/base.php' );
    </center>
    </body>
    </html>

    ok , it wont take me to my BASE and i dont know why that is?


    Cheers
    Rawli
    Rawli

  • #2
    Regular Coder
    Join Date
    May 2006
    Location
    Canada
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts
    lol, i got it lol.....simple mistake

    Code:
        exit(); 
    } 
    
    $_SESSION['user_id'] = $user['id']; 
    ?> 
    header( 'Location: http://thugkillin.urlshort.com/base.php' ); 
    </center> 
    </body> 
    </html>

    should of been

    Code:
        exit(); 
    } 
    
    $_SESSION['user_id'] = $user['id']; 
    header( 'Location: http://thugkillin.urlshort.com/base.php' ); 
    ?>
    </center> 
    </body>
    ?> was in the worng place lol
    Rawli


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •