gausie Posted July 5, 2006 Share Posted July 5, 2006 Hi everyone!Great to be back - haven't visited for quite some time - and I return with a question!To log out of my script, you send "lo=t" to a page. However, the website I am making allows user-customisable scripts, and so anyone feeling particularly vandalous might make a "fake" link that logs the visiting user out. How can I verify that the link was from the correct area?I have the feeling I could make use of the SID but I don't know how!ThanksSam Quote Link to comment https://forums.phpfreaks.com/topic/13786-verifying-internal-link/ Share on other sites More sharing options...
Orio Posted July 5, 2006 Share Posted July 5, 2006 Can you explain this a bit better? I am having a hard time understanding.Orio. Quote Link to comment https://forums.phpfreaks.com/topic/13786-verifying-internal-link/#findComment-53569 Share on other sites More sharing options...
gausie Posted July 6, 2006 Author Share Posted July 6, 2006 OkWell to log out, you click on a link that brings you to "[b]index.php?lo=t[/b]"The website has areas where users can have their own customised HTMLSomone could easily put a link like this "[b]<a href="index.php?lo=t">Click here to go to my webpage</a>[/b]", but this link would instead log the viewer out.How can I verify that the "Log Out" button is being pressed only from where I want it to be pressed? Quote Link to comment https://forums.phpfreaks.com/topic/13786-verifying-internal-link/#findComment-53719 Share on other sites More sharing options...
.josh Posted July 6, 2006 Share Posted July 6, 2006 echo "<a href='index.php?lo=t&sess_id=" . $PHPSESSID."'>Logout</a>";then check to see if sess_id exists and if so check to see if it matches up with the session id this of course assumes that your allowing of custom html does not include allowing them to insert their own php as well... Quote Link to comment https://forums.phpfreaks.com/topic/13786-verifying-internal-link/#findComment-53723 Share on other sites More sharing options...
gausie Posted July 7, 2006 Author Share Posted July 7, 2006 $PHPSESSID is an empty variable... I end up with the link [b]index.php?lo=t&v=[/b] with nothing afterwards!ThanksSam Quote Link to comment https://forums.phpfreaks.com/topic/13786-verifying-internal-link/#findComment-54509 Share on other sites More sharing options...
gausie Posted July 7, 2006 Author Share Posted July 7, 2006 Ok I did it using session_id() instead of $PHPSESSIDThanks everyone!Sam Quote Link to comment https://forums.phpfreaks.com/topic/13786-verifying-internal-link/#findComment-54525 Share on other sites More sharing options...
.josh Posted July 7, 2006 Share Posted July 7, 2006 sorry. i meant this:[code]echo "<a href='index.php?lo=t&sess_id=" . session_id() ."'>Logout</a>";[/code]i usually do like this: $PHPSESSID = session_id(); Quote Link to comment https://forums.phpfreaks.com/topic/13786-verifying-internal-link/#findComment-54536 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.