jodunno Posted July 15, 2020 Share Posted July 15, 2020 Dear members, I have a self-inflicted problem but i do not know of a proper solution. My site is a subscription based members only website. Some pages are protected pages while others are low security accessible pages. This means that low-security pages only check the session for login. An example of low-security is a news article or press release. PHP on low-security pages just checks the session to see if the user is a logged in member. The low-security pages are accessed via standard hyperlinks with a constant address (e.g., place.ext/News). Protected pages, on the other hand, are hidden behind a post form which utilizes prg to send the request to the index page (place.ext). The requests are analyzed for tokens, timestamps, referrer, ip address etc. the user is checked in the database and the session data is compared to verify user login status etc. Such a design prevents me from using anchor names to jump to specific places in the page (place.ext#jumplink). I am trying to figure out a way to still use named anchors. I think that a session variable can be used to store the anchor name for jumping. Then i wonder if i could use javascript to actually make the jump? (document.location perhaps?) is there someway to use php for this task besides a session variable? has anyone done this before? i cannot think of a simple solution. Thabk you and Best Wishes. Quote Link to comment https://forums.phpfreaks.com/topic/311093-php-and-javascript-named-anchors/ Share on other sites More sharing options...
kicken Posted July 15, 2020 Share Posted July 15, 2020 Why can't your "High security" pages be just like your "Low security" pages, but with the extra checks? Doesn't make sense to me why you have to send them through some post request to the index page first. Quote Link to comment https://forums.phpfreaks.com/topic/311093-php-and-javascript-named-anchors/#findComment-1579648 Share on other sites More sharing options...
jodunno Posted July 15, 2020 Author Share Posted July 15, 2020 so back to the question: location.href has solved my problem. My page scrolls to the named anchor when it is loaded. Excellent. Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/311093-php-and-javascript-named-anchors/#findComment-1579652 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.