disabling an image.
Moderator: General Moderators
-
Daisy Cutter
- Forum Commoner
- Posts: 75
- Joined: Sun Aug 01, 2004 9:51 am
disabling an image.
at my url http://kafene.org I have a random image on the left side. If anyone finds it irritating, i want to offer the ability to disable it via a cookie.
Could anyone help me?
I would prefer a link that reloaded the page with a cookie set to not display it, that would never expire, and when the cookie was present, a link to re-enable it. If you need page source just ask.
Thank you.
Could anyone help me?
I would prefer a link that reloaded the page with a cookie set to not display it, that would never expire, and when the cookie was present, a link to re-enable it. If you need page source just ask.
Thank you.
-
Daisy Cutter
- Forum Commoner
- Posts: 75
- Joined: Sun Aug 01, 2004 9:51 am
well is it possible to make a link set a cookie? or does it need to be a form? I've done it once with forms, but that's it. I read some tutorials on cookies but im shaky on this, ie- I dont know the methods.
something like
and then
something like
Code: Select all
setcookie ("img", $img time()+7776000)Code: Select all
if (isset($_COOKIE["img"])) {
*IMAGE CODE* }
else {}if you didnt notice it, but you'll need another comma after the $var along with an ;Daisy Cutter wrote:something like
Code: Select all
setcookie ("img", $img time()+7776000)
I know u probably are aware, but to save any future questions, plus I just want to be cool and act like I know what i'm talking about.
-
Daisy Cutter
- Forum Commoner
- Posts: 75
- Joined: Sun Aug 01, 2004 9:51 am
Im testing this with a test page and getting an error because im trying to nest php code within more code I think...
and I cant figure out how to make it so after the cookie has been set you are returned to the main page.
wierd... a book I bought on php doesnt discuss cookies really at all.
EDIT:
okay if you go to http://kafene.org/php you can see you can make it say hello or not, using a cookie. i've got that down, one page to turn it on, one to turn it off.
I need help nesting code inside code (im sure theres an easy solution im missing here) and making it redirect to the last page once the cookie is set, or better, just refresh the page setting the cookie, like I've seen with javascript.
and I cant figure out how to make it so after the cookie has been set you are returned to the main page.
wierd... a book I bought on php doesnt discuss cookies really at all.
EDIT:
okay if you go to http://kafene.org/php you can see you can make it say hello or not, using a cookie. i've got that down, one page to turn it on, one to turn it off.
I need help nesting code inside code (im sure theres an easy solution im missing here) and making it redirect to the last page once the cookie is set, or better, just refresh the page setting the cookie, like I've seen with javascript.
How you could do it also:
instead of offering a link to the image directly, use a script with header location to redirect to the image url...
thus: <img src="script.php" />
----- script.php ---------
// lookup the $url to the image to display
header('Location: $url);
------------------------------------
instead of offering a link to the image directly, use a script with header location to redirect to the image url...
thus: <img src="script.php" />
----- script.php ---------
// lookup the $url to the image to display
header('Location: $url);
------------------------------------
-
Daisy Cutter
- Forum Commoner
- Posts: 75
- Joined: Sun Aug 01, 2004 9:51 am