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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    May 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    redirect with session problem

    I made login page.
    When the user enter correct data I but his id in session variable and redirect the page.
    If the data is in correct it redirect to another page.
    This code worked on my local machine but when uploaded to the server it didn't work with this redirect the other pages don't see the session variable
    but when I remove the redirect code and puts links to user for navigation it works and the pages see the session variable.

    The server have many site and this happen in this site only.
    thanks in advance
    Last edited by GNabeeh; 06-29-2005 at 10:34 AM.

  • #2
    Regular Coder
    Join Date
    May 2004
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts
    please post some code to give a clearer view

  • #3
    New to the CF scene
    Join Date
    May 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The following is the code which check for the user and if correct redirect the page to mydata.php page

    header("location: mydata/mydata.php");

    This code didn't work.And when I put links instead of redirct it worked

    <?php
    session_start() ;
    mysql_select_db($database_conn, $conn);
    $query_rs = "SELECT * FROM user where user_mobileNo='$mobile' and user_password = '$password' ";
    $rs = mysql_query($query_rs, $conn) or die(mysql_error());
    $row_rs = mysql_fetch_assoc($rs);
    $totalRows_rs = mysql_num_rows($rs);
    if ($totalRows_rs > 0) {
    session_start() ;
    session_register ("userid") ;
    $userid=$row_rs['user_id'];
    header("location: mydata/mydata.php");
    }
    if ($totalRows_rs == 0) { // Show if recordset empty
    header("location: login.php");
    }
    Last edited by GNabeeh; 06-30-2005 at 12:56 PM.

  • #4
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Don't use the session_register ("userid"); format, this is deprecated and it won't work if register_globals is disabled, instead use the $_SESSION['userid'] format to work with session variables.


  •  

    Posting Permissions

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