Forum : php cookie
Brief description  about Online courses   join in Online courses
View nishant  gaurav 's Profile

php cookie

i am not getting any idea to write the codes for the 3rd and 4th problem given as an assignment,please help me sir.
thanking you
nishant gaurav
Asked by nishant gaurav | Oct 10, 2010 |  Reply now
Replies (1)
View teacher siliconindia 's Profile
For 3rd question
<?php
$inc_var = $_COOKIE['count'];
$expire = time() + 3600 * 24 * 30;
$inc_var ++;
setcookie(userName,"nishant",$expire);
setcookie(count,$inc_var,$expire);

echo "<br>Number of times refreshed ".$inc_var;
?>

After refresh the page count will be increase.


Also for 4th question create one log in form and some default 3 pages.
If user log in set cookie with user name and one cookie check page create and make condition with user name redirect the page.
Oct 10, 2010