SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Dec 2003
    Location
    South Africa
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Help ! How do I pass variables between pages ?

    Hi

    How do I pass variables between pages ?

    I have created a login script, but I need to pass the authentication variable between pages without showing the variable in the url eg.
    http://www.mysite.com/login.php?auth=true

    Can somebody please help me urgently ! This is part of a project I'm working on for college !

  2. #2
    SitePoint Zealot
    Join Date
    Oct 2003
    Location
    USA
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In the html form tag you can use post or get at the method attribute. One shows the param in the url, the other doesn't
    .
    2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
    2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
    2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

  3. #3
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Sessions would be your solution Here's an example
    PHP Code:
    <?php
    // page1.php
    session_start();

    if ( 
    $whatever ) {
         
    // check login
         
    $_SESSION['auth'] = 1;
    }
    ?>
    <a href="page2.php">Clicky</a>
    and here's the code for page two
    PHP Code:
    <?php
    // page2.php
    session_start();

    if ( 
    $_SESSION['auth'] ) {
         echo( 
    "user has authenticated" );
    } else {
         echo( 
    "hacker attack!!!!" );
    }
    ?>

  4. #4
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

  5. #5
    SitePoint Member
    Join Date
    Dec 2003
    Location
    South Africa
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks guys i've managed to sort it out !


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
  •