​ Going back to FEU protected form after login process UDT

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Locked
jakovbak
Forum Members
Forum Members
Posts: 225
Joined: Thu Dec 13, 2012 2:54 pm

​ Going back to FEU protected form after login process UDT

Post by jakovbak »

​A quick description of the situation:
A page contains FEU protected contact form. To access such form, already registrated user must log in to site. Clicking on 'Log in' link opens up a new page with log-in form. That's one step away from desired contact form.
After entering proper username and password and clicking on 'Submit' button, a new page opens up containing two links by default: 'Change user settings' and 'Sign out'. That's second step away from desired contact form.

The Problem:
I needed another link called 'Back to form' and solution for taking an user two pages back while reloading the page where 'Log in' link was initially clicked.

The Solution:
With help of my friend who diggs php, we did the following...
1) create first UDT called "remember_form" with following code:

Code: Select all

session_start();
$page = $_SERVER["REQUEST_URI"];
$_SESSION['page'] = $page;
2) put first UDT in every template for page(s) containing FEU protected form(s) right after {/strip} at the top of the template;
3) create second UDT called "back_to_form" with the following code:

Code: Select all

session_start();
echo "http://".$_SERVER['SERVER_NAME'].$_SESSION['page'];
4) open template 'FEU logout form' (or whatever your template is called but containing the same code as in original FEU template) and put this link where you think it would be most visible or useful:

Code: Select all

<a href="{back_to_form}">Back to form</a>
And that's it! After logging in to the site, "Back to form" link will take one back to the page where desired form is but this time the form itself will be unlocked and visible.

Now, I'm not security wizard so I don't know if this solution is 100% safe. If anyone suspects this two UDT's could cause some security issues, please, you're more than welcome to leave a post about it in reply!

Hope this was helpful and best regards to all!
Jakovbak
Locked

Return to “Tips and Tricks”