php live hit counter

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
gctmpr
-


Joined: 28 Apr 2007
Posts: 18

PostPosted: Sun May 06, 2007 9:10 am    Post subject: php live hit counter Reply with quote

pls help me....
i am no way how to write wap php live hit counter code...
how to add inside here?

Code:

<?
header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""." \"http://www.wapforum.org/DTD/wml_1.1.xml\">";

 include("wapbuddy_settings.php"); ?>
<wml>
<card id="card1" title="<? echo $conf["site_name"] ?>">
   
   <p mode="nowrap">
      <b><? echo $conf["site_name"] ?></b><br/>
      <? echo $conf["welcome_message"] ?><br/>
   </p>
   <p mode="nowrap">
      <b>Results</b><br/>
      <? for ($i=0;$i<sizeof($conf["dirs"]);$i++) { ?>
         <a href="<?echo $conf["dirs"][$i]."/index.php";?>"><?echo $conf["dirs"][$i];?></a><br/>
                <? } ?>   
            <a href="http://arunothai.myvnc.com/registered/MAGNUM4D/index.php">MAGNUM4D</a><br/>
            <a href="http://arunothai.myvnc.com/registered/SPORTSTOTO/index.php">SPORTSTOTO</a><br/>
            <a href="http://arunothai.myvnc.com/registered/KUDA/index.php">KUDA</a><br/>
   
      <br/><a href="http://jonroig.com/phoneinfo.php">CHECK PHONE INFO</a><br/>
   </p>
</card>
</wml>


tq
_________________
wap site-
arunothai.myvnc.com/registered
username-abyss
password- free

web site
[url]arunothai.myvnc.com[/url]
Back to top View user's profile Send private message Visit poster's website
rrinc
-


Joined: 24 Feb 2006
Posts: 725
Location: Arkansas, USA

PostPosted: Tue May 08, 2007 12:59 am    Post subject: Reply with quote

There's a few ways you can make a hit counter. One way would be to just save the number of hits to a file and each page view to add +1 to the number in that file. And to display hits just display the number from the file. Or you could use a database.

By the way, I don't recommend php short tags, its a bad idea/habit.

Edit: I just wrote some quick code for a text file hit counter:
Code:
<?php
$file = 'hits.txt';
$hits = file_get_contents($file);
echo "$hits hits<br />";
file_put_contents($file, $hits + 1);
?>
Note: It'll throw you an error the first time if you don't create hits.txt.
_________________
-Blake | New Server :D
SaveTheInternet
Soy hispanohablante. Puedes contactarme por mensajes privados.
Back to top View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Tue May 08, 2007 7:42 am    Post subject: Reply with quote

PHP short tags will only work on a php setup that has them enabled in the php.ini so I agree it is a very bad idea/habit.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group