Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

If visited page (like a form) then redirect

If visited page (like a form) then redirect

I have a form page that once it has been filled out it goes to a new page and if they have already filled out the form it redirects them straight to the new page. The only problem is that if the just refresh the page without filling out the form the cookie has been written so they jump straight to the new page. I cobbled a couple of recipes together and it worked. Feel free to correct any errors. Also remember to set the MetaMod module just to the menu item you want it to action on in the module settings or it will load cookies straight away.

$app = &JFactory::getApplication();

$c = JRequest::getInt('SeenIt', 0, 'cookie');
if ($c) $app->redirect("http://www.test.com/");
setcookie( 'SeenIt', 1, time()+60*60*24*365*10, '/' );

shriek
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: If visited page (like a form) then redirect

I fixed the refresh prob by making another instance of metamod on the page it is redirecting to and having the set cookie line on there and nothing else and deleting it off the form page. That way refreshing the form doesn't matter.

shriek
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1684
Total Polls:
6
Total Posts:
5940
Posts this week:
1
User Info:
 
Total Users:
5162
Newest User:
david30x73
Members Online:
0
Guests Online:
160

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked