twilitegxa Posted September 25, 2008 Share Posted September 25, 2008 I have this hit counter script, and it works fine, except for the part that is supposed to display the words, "You are visitor number" before the hits. Here is the code: <?php //Opening file to get counter value $fp = fopen ("counter.txt", "r"); $count_number = fread ($fp, filesize ("counter.txt")); fclose($fp); ?> <html> <head> <title>Counter number</title> </head> <body> <?php $i=""; $ImgPath="imgs/"; //Path of image folder $counter = (int)($count_number) + 1; $count_number = (string)($counter); $len = strlen($count_number); while($len!=$i && $len!=0) { echo "<img src=".$ImgPath.$count_number[$i].".jpg alt=\"You are visitor number $count_number\" width=20 Height=22>"; $i++; } $fp = fopen ("counter.txt", "w"); fwrite ($fp, $count_number); fclose($fp); ?> </body> </html> Can anyone tell me why it's not displaying? Link to comment https://forums.phpfreaks.com/topic/125858-solved-hit-counter/ Share on other sites More sharing options...
trq Posted September 25, 2008 Share Posted September 25, 2008 echo "<img src='" . $ImgPath.$count_number[$i] . ".jpg' alt='You are visitor number $count_number' width=20 Height=22>"; Link to comment https://forums.phpfreaks.com/topic/125858-solved-hit-counter/#findComment-650811 Share on other sites More sharing options...
twilitegxa Posted September 25, 2008 Author Share Posted September 25, 2008 For some reason that didn't work. Nothing changed. Any other suggestions? Link to comment https://forums.phpfreaks.com/topic/125858-solved-hit-counter/#findComment-650814 Share on other sites More sharing options...
trq Posted September 25, 2008 Share Posted September 25, 2008 What does that part of the output look like when you view the html source? Link to comment https://forums.phpfreaks.com/topic/125858-solved-hit-counter/#findComment-650815 Share on other sites More sharing options...
peranha Posted September 25, 2008 Share Posted September 25, 2008 isnt alt='' when the image cannot be found, it puts that in its place??? Link to comment https://forums.phpfreaks.com/topic/125858-solved-hit-counter/#findComment-650817 Share on other sites More sharing options...
Stryves Posted September 25, 2008 Share Posted September 25, 2008 alt='' is used to display text when the mouse hovers over the image, it's also used for Blind users who use programs that read the text on the page. Link to comment https://forums.phpfreaks.com/topic/125858-solved-hit-counter/#findComment-650852 Share on other sites More sharing options...
twilitegxa Posted September 25, 2008 Author Share Posted September 25, 2008 Okay, so that's probably why nothing is displaying. Didn't even think about that. LOL Thanks guys! Link to comment https://forums.phpfreaks.com/topic/125858-solved-hit-counter/#findComment-650868 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.