SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Guru godsfshrmn's Avatar
    Join Date
    Mar 2001
    Posts
    671
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anything inputed into the username/password field will show the pass-protected page. Any idea what's wrong here?
    Code:
    $auth = false;
    
    if (isset( $PHP_AUTH_USER ) && isset($PHP_AUTH_PW)) { 
    
    mysql_connect("db.sfy.f2s.com", "***", "***") or die ("Unable to connect to database.");
    
    mysql_select_db("sfy") or die ("Unable to select database.");
    
    	$sql = "SELECT * FROM user WHERE username='$PHP_AUTH_USER' and password='$PHP_AUTH_PW'";
    
    		$result = mysql_query($sql);
    
    		$num = mysql_numrows($result);
    		if ($num != '0') {
                    $auth = true; 
                     }
    /*if (!check_login($PHP_AUTH_USER, $PHP_AUTH_PW)) {
    } */
    }
    if ( ! $auth ) { 
    
        header( 'WWW-Authenticate: Basic realm="Private"' ); 
        header( 'HTTP/1.0 401 Unauthorized' ); 
        echo 'Authorization Required.'; 
        exit; 
    
    } else { 
    
    echo head1();
    
    	      echo "pass page";
    
    echo foot1();
    }
    Last edited by godsfshrmn; Mar 29, 2001 at 18:18.

  2. #2
    SitePoint Guru godsfshrmn's Avatar
    Join Date
    Mar 2001
    Posts
    671
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Whats up w/ the <br /> ?

  3. #3
    SitePoint Zealot moshe_be's Avatar
    Join Date
    Dec 2000
    Posts
    169
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think the problem lies with:

    if($num != '0')

    replace that with

    if($num == 1)

  4. #4
    SitePoint Guru godsfshrmn's Avatar
    Join Date
    Mar 2001
    Posts
    671
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried doing that earlier and it wouldn't accept the correct user/pass. I dunno what the problem is.
    s c r i p t s f o r y o u . n e t
    ScriptsForYou

  5. #5
    SitePoint Guru godsfshrmn's Avatar
    Join Date
    Mar 2001
    Posts
    671
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    DOH!

    I had the wrong entries in the database. No wonder it never accepted any password. Thanks anyways though. lol
    s c r i p t s f o r y o u . n e t
    ScriptsForYou

  6. #6
    midnight coder
    Join Date
    Dec 2000
    Location
    The flat edge of the world
    Posts
    838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by godsfshrmn
    Whats up w/ the <br /> ?
    The <br /> is XHTML tag, same as <br>. Why did you ask? I don't see any <br /> tags on his login script?

  7. #7
    SitePoint Guru godsfshrmn's Avatar
    Join Date
    Mar 2001
    Posts
    671
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When I originally posted the code, I used the PHP vB Code.
    It inserted a <br> thing in between each line.
    s c r i p t s f o r y o u . n e t
    ScriptsForYou

  8. #8
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's a bug with vB. Wayne knows about it and is fixing it. Its damned annoying though. Also the same thing is happening with the [\code] tags except there you get double line breaks. Arggg.


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
  •