aashcool198 Posted June 11, 2009 Share Posted June 11, 2009 hi.. i have a website in which a user can loon and see his details. I am passing variables in url such as: localhost/man_goals.php?name_id=1 But it is highly unsafe as anyone could write the url and open the respective page. can i pass variables in some hidden form. For every page change i have to pass more than 2 variables. Please Help! Link to comment https://forums.phpfreaks.com/topic/161769-variable-pass-security/ Share on other sites More sharing options...
cunoodle2 Posted June 11, 2009 Share Posted June 11, 2009 Look into php sessions. Link to comment https://forums.phpfreaks.com/topic/161769-variable-pass-security/#findComment-853572 Share on other sites More sharing options...
aashcool198 Posted June 11, 2009 Author Share Posted June 11, 2009 but can you pass more than one variable using sessions. kindly show me how? Link to comment https://forums.phpfreaks.com/topic/161769-variable-pass-security/#findComment-853579 Share on other sites More sharing options...
cunoodle2 Posted June 11, 2009 Share Posted June 11, 2009 You can pass as many as you want to. At the top of your page you have to ALWAYS put this on ANY page using sessions... <?php session_start(); //the create as many variables as you want.. $_SESSION['user']="aashcool198"; $_SESSION['site']="phpfreaks.com"; $_SESSION['id']="456"; $_SESSION['other']=$variable; ?> Then on another page you can do this... <?php session_start(); //echo to the screen.. echo "User name is ".$_SESSION['user']."<br />\n"; echo "Site name is ".$_SESSION['site']."<br />\n"; ?> Link to comment https://forums.phpfreaks.com/topic/161769-variable-pass-security/#findComment-853580 Share on other sites More sharing options...
aashcool198 Posted June 11, 2009 Author Share Posted June 11, 2009 <?php echo "<a href=\"man_tech.php?name_id=$array_id[$i]\">$array_f[$i] $array_l[$i]</a>";?> this code is run in a for loop and creates certain links when you click on a link you are directed to another page with respective variable. <a href="man_tech.php?name_id=$array_id[$i]"> that is.. $array_id[$i] is the variable i am passing. How can i use sessions in this case? Link to comment https://forums.phpfreaks.com/topic/161769-variable-pass-security/#findComment-853588 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.