Stone Gossard Posted February 17, 2006 Share Posted February 17, 2006 I want to be able to have a hyperlink at the end of a page which can be accessed from a number of pages. This hyperlink should bring the user back to a specified homepage based on their access level, e.g. administrator is brought back to admin_homepage.php and registered user is brought back to reg_user_homepage.php.I have sessions working on my site and i know this isn't too difficult but just now sure how to do the hyperlink thing.Appreciate it.Stone Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted February 17, 2006 Share Posted February 17, 2006 Something like the following:[code]<?phpsession_start();$link = "<a href=";if($_SESSION['access_lvl'] == "Admin"){ $link .= "admin_homepage.php";}elseif($_SESSION['access_lvl'] == "User"){ $link .= "reg_user_homepage.php";}$link .= "\">Home</a>";echo $link;?>[/code] Quote Link to comment Share on other sites More sharing options...
Stone Gossard Posted February 17, 2006 Author Share Posted February 17, 2006 [!--quoteo(post=346767:date=Feb 17 2006, 10:34 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Feb 17 2006, 10:34 AM) [snapback]346767[/snapback][/div][div class=\'quotemain\'][!--quotec--]Something like the following:[code]<?phpsession_start();$link = "<a href=";if($_SESSION['access_lvl'] == "Admin"){ $link .= "admin_homepage.php";}elseif($_SESSION['access_lvl'] == "User"){ $link .= "reg_user_homepage.php";}$link .= "\">Home</a>";echo $link;?>[/code][/quote]Top Class.Thanks a Mill.Stone Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted February 18, 2006 Share Posted February 18, 2006 No problem! I have code similar to that with a forum I am currently developing. Quote Link to comment Share on other sites More sharing options...
Stone Gossard Posted March 2, 2006 Author Share Posted March 2, 2006 Thanks for that code and i've tried it ok, and it does redirect to the users homepage based on their access level but it keeps adding code:reg_user_page.php%22Why does it add "%22" to the end of the URL? That's what causing it not to find the page.Stone Quote Link to comment Share on other sites More sharing options...
willpower Posted March 2, 2006 Share Posted March 2, 2006 I'd suggest that you have added a whitespace to the end of the url before closing the quotation markswill Quote Link to comment Share on other sites More sharing options...
Stone Gossard Posted March 4, 2006 Author Share Posted March 4, 2006 [!--quoteo(post=351075:date=Mar 2 2006, 02:54 PM:name=willpower)--][div class=\'quotetop\']QUOTE(willpower @ Mar 2 2006, 02:54 PM) [snapback]351075[/snapback][/div][div class=\'quotemain\'][!--quotec--]I'd suggest that you have added a whitespace to the end of the url before closing the quotation markswill[/quote]Will,I had an extra inverted comma, thanks.Stone Quote Link to comment 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.