SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Script broke...

  1. #1
    SitePoint Zealot allanon's Avatar
    Join Date
    Jan 2005
    Location
    United States
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Script broke...

    Hey, I changed my login script a bit, and it broke. Every time I post the correct login details, the script doesn't execute. Whenever I post incorrect details, it executes? It's probably a stupid error that I keep missing.

    Anyone see anything wierd?

    PHP Code:
    session_start(); 
    $status_font_color '990000'
    $status 'Please login.'
    if(!empty(
    $_GET['f'])) { 
        
    $page $domain $_GET['f']; 
    } else { 
        
    $page $domain '/affiliates/account.php'

    if(!empty(
    $_SESSION['user_id']) && !empty($_SESSION['username'])) { 
        
    Redirect($domain '/affiliates/account.php'); 

    if(isset(
    $_POST['Login'])) { 
        echo 
    '<!-- Made Pt 1 -->';
        
    $username addslashes($_POST['username']); 
        
    $password md5($_POST['password']); 
        if(empty(
    $_POST['username']) || empty($_POST['password'])) { 
            
    $continue false
            
    $status 'Empty username or password.'
            
    $status_font_color 990000
        } 
        if(
    $continue !== false) { 
            if(!
    preg_match("/^[a-z0-9_]/"$_POST['username'])) { 
                
    $continue false
                
    $status 'Invalid syntax. Only use letters "A" through "Z", and numbers "1" through "10".'
                
    $status_font_color 990000
            } 
        }
        if(
    $continue !== false) { 
            
    $SELECT mysql_query("SELECT * FROM affiliate_users WHERE username = '$username' AND password = '$password'") or die($error); 
            echo 
    '<!-- Made Pt 2 -->';
            if(
    mysql_num_rows($SELECT) == 1) { 
                
    $_SESSION['username'] = $_POST['username']; 
                
    $_SESSION['user_id'] = $fetched_userid
                
    $_SESSION['last_move'] = time() + 300
                
    Redirect($page); 
            } else { 
                
    $status 'Invalid username/password combination. Please try again.'
                
    $status_font_color 990000
            } 
        } 

    The echo'ed comments are to check how far it got.
    - Monster!

  2. #2
    SitePoint Zealot allanon's Avatar
    Join Date
    Jan 2005
    Location
    United States
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oO, noticing something, I did not fill in the variable $fetched_userid, which probably is Redirecting twice from a checking script =(. So I probably just solved my error.
    - Monster!


Bookmarks

Posting Permissions

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