SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2007
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Hi, log in and remember the page.

    Every time I build my sites and the user log in, after a success i was redirecting it to the index - home page.

    I want to redirect the user in the page that it was.

    Haw i can do this ?

    Thanks for the time,

    Bye, bye.

  2. #2
    SitePoint Zealot Dachande663's Avatar
    Join Date
    Feb 2005
    Location
    Birmingham, UK
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Store the page you wish to send them to in a $_SESSION variable and then redirect to that instead.
    Web Developer & Geek: hybridlogic.co.uk ~ lukelanchester.com

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2007
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But haw can I "catch" that page ?

    I cam put in the form field a invisible input box with the value="<?=$_SERVER['PHP_SELF']?>", but another method ?

  4. #4
    play of mind Ernie1's Avatar
    Join Date
    Sep 2005
    Posts
    1,252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is an example:
    PHP Code:
    <?php
    session_start
    ();
    if(isset(
    $_POST['submit'])){
        if((
    $_POST['username'] == "admin") && ($_POST['passwd'] == "abc")){
            
    $_SESSION['auth'] = true;
            
    $redir file_get_contents("http://www.yourdomain.com/test/x.php");
            
    $_SESSION['redir'] = $redir;
            echo 
    $_SESSION['redir'];
            
    // or echo $redir;
            
    exit;
            }else{
            
    $_SESSION = array();
            
    session_destroy();
            echo 
    "<b>You login details is not correct. Pls login again</b>";
            }
        }
    ?> 
    <form method="post" action=""> 
      <table width="400"  border="0" align="center" cellpadding="2" cellspacing="2"> 
           <tr> 
          <td>Username: </td> 
          <td><input type="text" name="username"></td> 
        </tr> 
        <tr> 
          <td>Passwd: </td> 
          <td><input type="password" name="passwd"></td> 
        </tr> 
        <tr> 
          <td>&nbsp;</td> 
          <td><input type="submit" name="submit" value="Submit">&nbsp;&nbsp; 
          <input type="reset" name="reset" value="Reset"> 
    </td> 
        </tr> 
      </table> 
    </form>
    my mobile portal
    ghiris.ro


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
  •