PHP Help

S

system32

Guest
I'm just getting started with PHP and was wondering how I would write a script to do the following...

Read a cookie and if it states that a user is logged in then change the source of "image1".
 
if that description is too vague just let me know...
 
change the source of "image1"
Not sure I follow here... If you mean that image1 is allready displayed and you want to change it you a bit up the wrong tree. PHP doesn't run once the page is displayed.

Anyway:
PHP:
if($HTTP_COOKIE_VARS["cookie_name"] == "text in cookie"){
	// Change the source (??)
}
else{
	// Not logged in
}
 
Zedric, I mean when the page is loading, I want the script to check for the cookie and determine which image will be displayed.

It would be okay if once it reads the cookie to refresh the page too, if that's at all possible.
 
Like this then:

PHP:
if($HTTP_COOKIE_VARS["cookie_name"] == "text in cookie"){
	echo "<IMG SRC='user_logged_in.jpg'>";
}
else{
	echo "<IMG SRC='user_not_logged_in.jpg'>";
}
 
Originally posted by Zedric
Like this then:

PHP:
if($HTTP_COOKIE_VARS["cookie_name"] == "text in cookie"){
	echo "<IMG SRC='user_logged_in.jpg'>";
}
else{
	echo "<IMG SRC='user_not_logged_in.jpg'>";
}

My hero. lol thanks man
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,623
Latest member
AndersonLo
Back