#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Chicago, IL USA
    Posts
    48
    Rep Power
    18
    err..sorry I suppose you where expecting something dramatic, and instead all you'll encounter here is some wannabe geek asking a stupid question, but please help, i'm sorry i've decieved you!

    I'm working on a user authentication script (half stolen) and once the user is authenticated I can't seem to get the browser to redirect to the proper url stored in the database (in the same row as the username and pass of course). Here is what I have so far and for some reason, once authenticated it redirects me back to index.php!! (well actually just the root folder of the authentication script which defaults of course to index.php)...

    <?
    if(!isset($PHP_AUTH_USER)) {
    Header("WWW-authenticate: basic realm="Comma Flex Customer"");
    Header("HTTP/1.0 401 Unauthorized");
    $title="Login Instructions";
    ?>
    <blockquote>
    In order to enter this section of the web site, you must be an Comma Flex subscriber. If you are a subscriber and you are having trouble
    logging
    in,
    please contact <a href="mailto:support@commaflex.com">support@commaflex.com</a>.
    </blockquote>
    <?
    exit;
    } else {
    mysql_pconnect("localhost","root","") or die("Unable to connect to
    SQL server");
    mysql_select_db("secretDB") or die("Unable to select database");
    $user_id=strtolower($PHP_AUTH_USER);
    $password=$PHP_AUTH_PW;
    $query = mysql_query("select * from users where username='$user_id'
    and
    password='$password'");

    if(isset($PHP_AUTH_USER)) {

    //request URL from database
    mysql_query("select * from users where statpage='$page'");
    //redirect to the URL
    header("Location: $page");

    }

    if(!mysql_num_rows($query)) {
    Header("WWW-authenticate: basic realm="Comma Flex Customer"");
    Header("HTTP/1.0 401 Unauthorized");
    $title="Login Instructions";
    ?>
    <blockquote>
    In order to enter this section of the web site, you must be an
    XXX
    subscriber. If you are a subscriber and you are having trouble
    logging in,
    please contact <a
    href="mailto:support@xxx.com">support@xxx.com</a>.
    </blockquote>
    <?
    exit;
    }
    /* Here I pick out some other useful info from my database that
    then available to any script that includes this file */
    $name=mysql_result($query,0,"statpage");
    $email=mysql_result($query,0,"statpage");
    mysql_free_result($query);
    }
    ?>

    can someone make any suggestions?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Chicago, IL USA
    Posts
    48
    Rep Power
    18
    well i fixed it forget it

Similar Threads

  1. Fellow Webmasters... HTML or Perl...
    By LoneArcher in forum HTML Programming
    Replies: 2
    Last Post: September 9th, 2003, 07:52 AM
  2. compare 2 files ... and some actions follow.
    By astrosurfer in forum PHP Development
    Replies: 0
    Last Post: July 9th, 2003, 07:02 AM
  3. Dynamically saved XML file doesn't follow structure
    By vladiator in forum XML Programming
    Replies: 3
    Last Post: June 28th, 2002, 08:45 PM
  4. Recipe Search Portal- Looking for geeks who like to cook and program!
    By Hero Zzyzzx in forum Project Help Wanted
    Replies: 0
    Last Post: January 16th, 2002, 12:58 PM
  5. Replies: 0
    Last Post: January 25th, 2001, 04:14 PM

IMN logo majestic logo threadwatch logo seochat tools logo