Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Restrict a category?


Guest

Recommended Posts

On my site I need to restrict $cpath = 22 unless the vistor agrees to unlock that category. (Adult stuff) I added the following code borrowed from

(kjeffery.com(His contribution uses cookies that wont work if disabled))

to catalog/includes/application_top.php at line 462. The problem is that I lose the session when I redirect to index.php. I do not want to use cookies how can I do this using sessions without losing the session and cart when I redirect back to index.php?

 

//////////////RESTRICTED BY AGE CODE CATEGORY///////////////
$restricted_category = 22;
$avp = 'age.php';
if ($cPath_array[0] == $restricted_category) 
{ 
if ($HTTP_SESSION_VARS['adultok'] != "Yes" )
 {  
 
	 tep_redirect(tep_href_link($avp));	
 } 

}
/////////////////// end aok code //////////////////////////////////////

 

 

the page age.php has the following relevant code starting with require application _top.php first

 

if ( $HTTP_SESSION_VARS['adultok'] != NULL )
 {
	 tep_redirect(FILENAME_DEFAULT); 
 }

 

<?php
$this_script_path =  $_SERVER['PHP_SELF'];
?>
<!--The actual age selection form, if you change these values they also need to be changed at the top of
this page -->

<FORM ACTION=<?php echo $this_script_path ?> METHOD="post">
 <div align="center">
  <INPUT TYPE="submit" NAME="adultok" VALUE="Yes"> 
  <INPUT TYPE="submit" NAME="adultok" VALUE="No">
 </div>
</FORM>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...