Hi, i have been looking at one of the code snippets on this site and found what i am loooking for... the code to put a cookie on a users computer to say they have seen my intro page and so the intro page wont appear after that because it sees the cookie.
I am having trouble with it though. I am a complete newbie to cookies. The code which it said to use is:
<?
// Visit arachnia-web.com
// Will allow you to have a entrance page only be displayed if
// the cookie has not already been created. Save this file
// as index.php. Change commented lines to meet your needs.
// Change YOURSTRINGs to something unique
setcookie("YOURSTRING", "vistedmain", time() + 3600);
$cookieinfo = $HTTP_COOKIE_VARS["YOURSTRING"];
if ($cookieinfo == "$cookieinfo") {
include('index2.html');
// change file name main.php to match your site
exit;
} else {
include('intro.php');
// change file name hendrix.html to match your site
exit;
}
?>
I have inserted that before the <html> tag in my intro.php page.
It seems to go straight to index2.html even when the cookie hasnt been stored.
It is certainly storing the cookie because i have cleared cookies and checked in the cookies folder and it has gone, then refreshed the page and it has appeared.
Anyone know why it isnt working?
If you want to see the page go to http://www.scouttech.org.uk/intro.php
The whole code for intro.php is:
<?
// Visit arachnia-web.com
// Will allow you to have a entrance page only be displayed if
// the cookie has not already been created. Save this file
// as index.php. Change commented lines to meet your needs.
// Change YOURSTRINGs to something unique
setcookie("YOURSTRING", "vistedmain", time() + 3600);
$cookieinfo = $HTTP_COOKIE_VARS["YOURSTRING"];
if ($cookieinfo == "$cookieinfo") {
include('index2.html');
// change file name main.php to match your site
exit;
} else {
include('intro.php');
// change file name hendrix.html to match your site
exit;
}
?>
<html>
<head>
<title>Scout Tech - Connecting Scouts With The World Of Technology</title>
<LINK REV=Made HREF="mailto:info@scouttech.org.uk">
<LINK REL=Index HREF="/index2.html">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=windows-1252">
<META NAME="Author" CONTENT="Jamie Harrop">
<META NAME="Description" CONTENT="Scout Tech - Providing free web hosting to UK Scouts, free web site templates, web site tutorials and much more">
<META NAME="Keywords" CONTENT="scouts,scouting,free web hosting,tutorials,web site,templates,uk,forum">
</head>
<body bgcolor="#DFCFFF">
<center>
<object classid="clsid😃27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://active.macromedia.com/flash4/cabs/swflash.cab#version=4,0,0,0"
id="intro" width="80%" height="80%">
<param name="movie" value="intro.swf">
<param name="quality" value="high">
<param name="bgcolor" value="#D8CCFF">
<embed name="intro" src="intro.swf" quality="high" bgcolor="#D8CCFF"
width="80%" height="80%"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
</embed>
</object>
<br><a href="/index2.html" style="color: #320966; font-family: Verdana,sans-serif; font-size: 75%; font-weight: bold;">Enter Site</a>
</center>
</body>
</html>
Regards
Jamie Harrop
http://www.jphdesigns.co.uk