Call php within HTML.. Working, but....
Posted: Tue Jan 04, 2005 8:31 pm
feyd | Help us, help you. Please use
and..... to set the cookie, I used setcookie.php which looks like this:
Ive included this in my index.html page to call the php files:
Its working fine, but is this the proper programming etiquette way to call php files? I dont know if img src tags were meant for this...
BTW, The counter works great...its invisible. If anyone want to use it, please do. Just make sure you upload counter.dat in ascii and chmod it to 777.
Thanks!
feyd | Help us, help you. Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Ive made my own invisible counter for my site...by combining a couple of php scripts Ive found on the net. Sorry if I sound like a dope, but Im a real novice with php.Code: Select all
<?php
$tempo = $HTTP_COOKIE_VARSї'tempo'];
$file = "counter.dat";
if (!$tempo){
$count = implode('',file($file)) + 1;
if(!($fp = fopen($file, "w"))) die ("Cannot open $file.");
fwrite($fp, $count);fclose($fp);
if ($_REQUESTї"show"]) echo "You're visitor Number <b>$count</b>.";
// ------------------------------------------------
}
else { echo "You're cookied.";} // I put this in just to test the cookie.
?>Code: Select all
<?php
$value = 'something from somewhere';
setcookie("main", $value);
setcookie("main", $value, time()+3600); /* expire in 1 hour */
setcookie("main", $value, time()+3600, "/", ".mydomain.com", 1);
?>Ive included this in my index.html page to call the php files:
Code: Select all
<img src="counter.php" height="1" width="1" border="0">
<img src="setcookie.php" height="1" width="1" border="0">BTW, The counter works great...its invisible. If anyone want to use it, please do. Just make sure you upload counter.dat in ascii and chmod it to 777.
Thanks!
feyd | Help us, help you. Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]