Redirect a visitor from a restricted webpage
Auteur : A. Remus
Visité 3518,
Followers 1,
Partagé 0
Hello
I get stuck. In a website that i work on it i have restricted pages to registered users only. Now if a visitor click on that pages it show the login interface. Now what i need is a solution to redirect automaticaly if someone click on restricted pages to a hidden (or not) page with info writted by me where to be explained what and why. To be honest i search for a while but without success and i need this feature badly.
Kind regards to all and many thanks in advance for your time
Remus A
Posté le
Hello Remus
You will have to - on each restricted page to have some code where you check if the user is logged in or not. If not then make a redirect. the redirect could be something like this :
<metahttp-equiv="refresh"content="0; URL='http://new-website.com'"/>
BUT you will have a logical trap here. You must have another place where users can log in as it will then not be possible to log on to the page the user asks for, because he will be redirected.
I will advice you to have a level for restricted pages. You could have a level with restricted pages. The first page the user is presented for, should not be restricted.
Here you put some explanation and maybe a login/logout object
Then the user could have a left-menu where the restricted pages is located - one menu item could be one restricted level.
If not quite see what I mean, I could make an example for you in V 11.
Kind regards
John S.
To see some code where you could put the "redirection" between then see this post :
https://helpcenter.websitex5.com/fr/post/132687
Remember that the page-type for the page where you put the php, should be php.
But - I still suggest you to use the way I told before.
Kind regards
John S.
The php-redirection line could be : header('Location: mypage.php');
where mypage.php should be the page that you redirect to. You can use absolote or relative path.
Auteur
Hello John
It seems i am more stupid i was thinked. I really hoped is a easyer way because for me is really hard what you explained to me. I was found on internet a html code i was inserted in website but unfortunetly was crashed the website, it was not worked at all. Now i really do not contest your way but is at first look impossible for me to do that.
About what you tould me yes i allready have a login page located in Home Page, i allready setup the levels and the restricted pages (i am still in testing but ...) i was stuck on what i was posted before.
Remus A
Hello Remus
I will in the coming days try to make some tests - if I am succesful I will post you something later.
I hope to have something in the end of this year
Until then - if someone has a solution for what Remus is describing, then please post him the code to be used.
Kind regards
John S.
Auteur
Thanks in advance John.
For the moment i have work to do to the website so is not such a hurry.
Many thanks for your time.
Hello Remus
I have made something here : http://www.john-schwartz.dk/
It is a very old testsite - but it is in ver. 11.
First : In the header I have a login and a logout ( the logout is only visible when logged in )
I have created 2 users Mike ( Mikepass) and Mike2 (Mike2pass )
When you log in this way ( from the header ) , you will be directed to the "restricted area" information page ( page-50).
You also have a menu-point "Restricted area".
In the restricted area information page ( page-50 ) You will see a left menu with 3 menu-points.
1 the information page itself.
2 Area 1
3 Area 1-1
If you are logged in as Mike there are these scenarios: for area 1
- You have logged in via the header and is therefore granted access when choosing "Area 1".
- You have not logged in and are therefore presented for a login screen - when logged in from here, you will not be directed to the information page, but will be directly on the page you have asked for.
You now have access to all pages in area 1 ( and all other pages that Mike has access to )
If you "are" Mike you will not have access to area 1-1.
If you log in as Mike2 you will have access to both area 1 and to area 1-1
All this is made with NO special coding. It is made using the X5 standard ver. 11. I will suggest you try and see if this is not something you could use.
If you still need the special code, then let me know and I will do some test.
Auteur
Hello John
Thanks for your time
I allready use kind like this with several level accessing.
What is annoing me is when someone try to acces the restricted page it send to restricted area message and ask for login details. What i was tryed is when someone want to acces the restricted page to be redirected to a editable page (idealy without login option).
Me for example i was not find so far how to add text in restricted area page from website, because is quite enough even that solution
Kind regards and Happy New Year
Hello Remus
I have made what is, what I think you want.
You can test it here : http://www.john-schwartz.dk/page-50.html
You can also try to login here : http://www.john-schwartz.dk/page-52.php
When you try to access a restricted page without being logged in or without the right credentials, then you are shown a message for 5 seconds. Then you are redirected to the information page.
When you then login, you will be directed to the last locked page you tried to access.
Is this what you want ?
Auteur
Hello
Yes is something like i imaginated Except is the login posibility at redirected page but i trink is page design so ...
Thanks.
Hello John.
Sorry but i read this post and i can use something like this, is it possible i can get the iwzip from that?
Regards,Henk R.
Hello Remus and Henk ( and eventually others )
I cannot give an iwzip-file as it is not anywhere in the project.
It is not much that has to be done - in fact it is only one name in one line in a single file, that has to be changed. And then a html-page has to be made. That is all.
But if not made 100% correct, it will not function. And what has to be done is a bit different in ver 11 and in ver 13 or 14.
I want to be sure that you have it to function, and I will guide you through the process. It is important that you can upload a file via FTP, and that you can use an editor as Notepad++.
You can contact me via the contact page on calendarforum.dk : http://calendarforum.dk/contact.html
Waiting to hear from you and wishing you all a happy new year.
John S.
Hello John.
Thank you for the quick answer, first i will try your way that you describe here in the post. Again thank you and the best wishes for the comming year.
Regards, Henk
About contacting me - maybe it is better to use the chat you find here :
http://www.energifremtiden.dk/c4d/contact-us.html
I will probably not be online, but you can mail me via the green widget in the lower right corner.
I have changed a bit in my example.
I have re-made the login/logout in the header.
In the "showform" I have made the time a bit longer - about 10 seconds. And then I have made 2 choices ( to the left )
This is an image - not clickable
Go now. When clicking herre you will be directed to the information page without further dealay.
Go Back. When clicking here, you will go back to where you came from ( if you have a history for the tab ). You will be directed back without no further delay.
If doing nothing, you will be directed to the information page after about 10 seconds.
The go back, will have the function, that if you were on level11/page 31 and tried to access page 53, then you will not be brought to the information page but back to page 31.
Maybe it is a bit complicated, but I hope someone can see the potential in all this.
It could be made much more simple if the redirection were set to 0 - then - when trying to access a restricted page, you would simply be directed immediately to the information page.
I just made this to show the possibilities - you can make it as you wish.
Kind regards
John S.
PS I know my testpage is NOT beautiful to look at, but it is only a testsite.
Auteur
Hello Jonn. I was sent a message on the website that you indicated.
Kind regards Remus A
Hello Remus
I have answered you by mail - but have not heard from you again.
In my mail I informed of the first step.
We have to complete the first step - then there is only the next step and then we are done.
Please inform, if you are still interested, or if you have sorted it out yourself - I would like to know.
Kind regards
John S.