www.webdeveloper.com
Results 1 to 3 of 3

Thread: header location not redirecting

  1. #1
    Join Date
    Jan 2014
    Posts
    1

    header location not redirecting

    <?php
    include('config.php');
    if (get_magic_quotes_gpc())
    {
    $_POST['username'] = stripslashes($_POST['username']);
    $_POST['password'] = stripslashes($_POST['password']);
    }
    $myusername = mysql_real_escape_string($_POST['username']);
    $mypassword = mysql_real_escape_string($_POST['password']);
    $sql="SELECT * FROM users WHERE username='$myusername' and password='$mypassword'";
    $result= mysql_query($sql) or die(mysql_error());


    // If result matched $myusername and $mypassword, table row must be 1 row
    if($row = mysql_fetch_array($result)) {
    $userid = $_SESSION['id'] = $row['id'];
    $username = $_SESSION['username'] = $row['username'];
    $sid = defined('SID') ? '?'. SID : '';
    header("location: welcome.php$sid");
    }
    else{
    echo "Wrong username or password.";

    }



    ?>

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,227
    Anything in your PHP error log (such as a "headers already sent" error on that line)?
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    640
    It could also be the case you used. I've read that some headers have to be provided exact. Try using "Location:".

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles