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
  1. #1
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts

    Strange login problem

    I've created the code below to redirect a user to the member page when the sessions are all created. This works when the user has just filled in the login form, submitted it, and they get redirected... but it doesn't seem to redirect if the session already exists (session will already exist if they're a new member and just registered).

    PHP Code:
    // all data filtered and safe to proceed with log in
    if($loggedin == "1"){
        if(!
    $sessionon){
    // old member logging in
            
    $_SESSION['userid'] = $_POST['userid'];
            
    $_SESSION['email'] = $_POST['email'];
        }
        if(empty(
    $row['username'])){
    // new member logging in - by passed filter process
            
    @mysql_connect($dbhost,$dbuname,$dbpass) || die("Couldn't connect to database");
            @
    mysql_select_db($dbname) || die("Couldn't find database");
            
            
    $sql "select username from nm_users where id='$_SESSION[userid]' and email='$_SESSION[email]'";
            
    $result mysql_query($sql);

            
    $row = @mysql_fetch_array($result);
        }
    // redirect all users to selection.php
        
    $_SESSION['username'] = $row['username'];
        
    $redirect "<META HTTP-EQUIV=\"refresh\" CONTENT=\"4;url=selection.php\">";
        
    $content 'Logging you in '.$_SESSION[username].'...';

    It seems for some reason, the meta refresh tag gets cancelled somehow, but I can't see how

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Nevermind, after a few more tries, I decided to try different browsers than IE6, they all worked fine, so it's something with my IE6


  •  

    Posting Permissions

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