adamriley Posted March 6, 2010 Share Posted March 6, 2010 Hi could any one say why this is not working it is a counter script it does work with short start php (<? ?>) but seems not to want to work with (<?php ?>) Entry.php (used to display the results) <?php include("counter_plus.php"); ?> <strong>Total Hits</strong><br /> <?php $total ?><br /><br /> <strong>Unique Hits</strong><br /> <?php $total_uniques ?> counter_plus.php (main functions of the script) <?php $visits_file = "visits_plus.txt"; $uniques_file = "uniques_plus.txt"; // Change the following number to change which style of counter you want // 1 is Regular font // 2 is Digital font // 3 is Alternate Digital font $type = "1"; $counter = fopen($visits_file, "r"); $total = fread($counter, filesize($visits_file)); fclose($counter); $total++; $counter = fopen($visits_file, "w"); fwrite($counter, $total); fclose($counter); $unique_hits = fopen($uniques_file, "r"); $total_uniques = fread($unique_hits, filesize($uniques_file)); if($_COOKIE["plus_unique"] != "set") { setcookie("plus_unique", "set", time()+2419200); $total_uniques++; } $uniques_hits = fopen($uniques_file, "w"); fwrite($uniques_hits, $total_uniques); fclose($uniques_hits); if($type == "2") $digital = "_digital"; if($type == "3") $digital = "_digital_alt"; $total_numbers = array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"); $total_images = array("<img alt=\"0\" src=\"number_images/0$digital.png\" title=\"0\" />", "<img alt=\"1\" src=\"number_images/1$digital.png\" title=\"1\" />", "<img alt=\"2\" src=\"number_images/2$digital.png\" title=\"2\" />", "<img alt=\"3\" src=\"number_images/3$digital.png\" title=\"3\" />", "<img alt=\"4\" src=\"number_images/4$digital.png\" title=\"4\" />", "<img alt=\"5\" src=\"number_images/5$digital.png\" title=\"5\" />", "<img alt=\"6\" src=\"number_images/6$digital.png\" title=\"6\" />", "<img alt=\"7\" src=\"number_images/7$digital.png\" title=\"7\" />", "<img alt=\"8\" src=\"number_images/8$digital.png\" title=\"8\" />", "<img alt=\"9\" src=\"number_images/9$digital.png\" title=\"9\" />"); $total = str_replace($total_numbers, $total_images, $total); $total_uniques_numbers = array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"); $total_uniques_images = array("<img alt=\"0\" src=\"number_images/0$digital.png\" title=\"0\" />", "<img alt=\"1\" src=\"number_images/1$digital.png\" title=\"1\" />", "<img alt=\"2\" src=\"number_images/2$digital.png\" title=\"2\" />", "<img alt=\"3\" src=\"number_images/3$digital.png\" title=\"3\" />", "<img alt=\"4\" src=\"number_images/4$digital.png\" title=\"4\" />", "<img alt=\"5\" src=\"number_images/5$digital.png\" title=\"5\" />", "<img alt=\"6\" src=\"number_images/6$digital.png\" title=\"6\" />", "<img alt=\"7\" src=\"number_images/7$digital.png\" title=\"7\" />", "<img alt=\"8\" src=\"number_images/8$digital.png\" title=\"8\" />", "<img alt=\"9\" src=\"number_images/9$digital.png\" title=\"9\" />"); $total_uniques = str_replace($total_uniques_numbers, $total_uniques_images, $total_uniques); ?> Link to comment https://forums.phpfreaks.com/topic/194359-counter-script-not-working/ Share on other sites More sharing options...
aebstract Posted March 6, 2010 Share Posted March 6, 2010 What's it doing wrong/different when you have full php tags? Link to comment https://forums.phpfreaks.com/topic/194359-counter-script-not-working/#findComment-1022425 Share on other sites More sharing options...
adamriley Posted March 6, 2010 Author Share Posted March 6, 2010 The images dont display with the full php tags Link to comment https://forums.phpfreaks.com/topic/194359-counter-script-not-working/#findComment-1022426 Share on other sites More sharing options...
meltingpoint Posted March 6, 2010 Share Posted March 6, 2010 <strong>Total Hits</strong><br /> <?php $total ?><br /><br /> <strong>Unique Hits</strong><br /> <?php $total_unique ?> Are you trying to DISPLAY the Total Hits and Unique Hits? If so then you need put the echo in there- <strong>Total Hits</strong><br /> <?php echo $total; ?><br /><br /> <strong>Unique Hits</strong><br /> <?php echo $total_uniques; ?> Link to comment https://forums.phpfreaks.com/topic/194359-counter-script-not-working/#findComment-1022440 Share on other sites More sharing options...
adamriley Posted March 6, 2010 Author Share Posted March 6, 2010 Simple stupid thing to forget thanks Link to comment https://forums.phpfreaks.com/topic/194359-counter-script-not-working/#findComment-1022459 Share on other sites More sharing options...
meltingpoint Posted March 6, 2010 Share Posted March 6, 2010 No worries................been there a ton of times Cheers- Link to comment https://forums.phpfreaks.com/topic/194359-counter-script-not-working/#findComment-1022467 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.