session variables help

Discussion in 'PHP' started by Kyriakos, Jun 10, 2008.

  1. #1
    hi,

    i want to send some variables from a page to another but i don't want the user to can see my variables. how i can hide those using the session variables? this is my link:
    page.php?pid=<?php echo $row['pid'];?>&sl=0
    Code (markup):
     
    Kyriakos, Jun 10, 2008 IP
  2. xlcho

    xlcho Guest

    Messages:
    532
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If the two files are opened in the same session you can save the value from this script in the $_SESSION array
    $_SESSION['pid'] = $row['pid'];
    and then in page.php you can access it with
    $_SESSION['pid']
    This will work if you have session_start() at the beginning of both files.

    Another way of partialy hiding the variables is using the post method for form submittion. The average user cannot read your variables, but a professional still can, so $_SESSION is the better choice if you want higher security.

    Remember, security isn't just about hiding the variables, it's more about processing data the right way :)
     
    xlcho, Jun 10, 2008 IP