aminnuto Posted October 25, 2006 Share Posted October 25, 2006 I currently have use this code[code]<?phpsession_start();if ($_SESSION['discount']){include('/home/pire/www/products/DISCOUNT-course.php');} else {include('/home/pire/www/products/REGULAR-course.php');$_SESSION['discount'] = "value";}?>but its only for the session and I want save it for the first 10 visits before it expires (or if thats not possible, expire after 10 days).Can anyone help me out with the code to do this?[/code] Quote Link to comment Share on other sites More sharing options...
gmwebs Posted October 25, 2006 Share Posted October 25, 2006 See how you get on with this?[code]<?php$session = md5(uniqid(rand()));SetCookie("CookieName", "$session", time() + 14400); // last number is expiration time in seconds, 14400 sec = 4 hrs// Print an individual cookieecho $_COOKIE["CookieName"];echo $HTTP_COOKIE_VARS["CookieName"];// Another way to debug/test is to view all cookiesprint_r($_COOKIE);?>[/code][url=http://uk2.php.net/setcookie]PHP SetCookie Reference[/url] Quote Link to comment Share on other sites More sharing options...
aminnuto Posted October 25, 2006 Author Share Posted October 25, 2006 thanks. I'm kinda a novis to this. How would i implement that. Do i add the code to my existing code or do i alter it to point to my php files? Quote Link to comment 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.