| | |
Tut : Make Your-Self a IP Showing Siggy & hit counter
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Hi You must have seen those Signature of people which show us the IP address .. here`s how you do it .
:
1. First save a blank .txt file named counter.txt
2. then open notepad (or any PHP-editor u use) and paste this code :
[PHP]
<?php
$TextFile = "counter.txt";
$Count = trim(file_get_contents($TextFile));
$FP = fopen($TextFile, "r");
$Count=fgets($FP, 4096);
fclose ($FP);
settype($Count, "integer");
$Count++;
if ($FP = fopen ($TextFile, "w")){
fwrite ($FP, $Count);
fclose ($FP);
}
$image = "counterpic.png";
$im = imagecreatefrompng($image);
$red = ImageColorAllocate ($im, 255, 0, 0);
$blue = ImageColorAllocate ($im, 0, 0, 255);
$hit = "$Count";
$ip = $_SERVER["REMOTE_ADDR"];
ImageString($im, 2, 18, 1, "www.sr-ultimate.com", $blue);
ImageString($im, 2, 1, 19, " Your ip: $ip", $red);
ImageString($im, 2, 1, 30, " Page visited $hit times ", $red);
header("Content-Type: image/png");
Imagepng($im,'',100);
ImageDestroy ($im);
?>
[/PHP]
3. Save it as index.php or anything u like just with .php extention
4. Now save the 3 files index.php , counter.txt & this image in a folder and upload it through FTP to any server supporting php.
5. Grant counter.txt CMOD 777 ( right click in FTP > properties > all previlages)
6. Then call index.php in your browser . that`s it :cheesy:
:1. First save a blank .txt file named counter.txt
2. then open notepad (or any PHP-editor u use) and paste this code :
[PHP]
<?php
$TextFile = "counter.txt";
$Count = trim(file_get_contents($TextFile));
$FP = fopen($TextFile, "r");
$Count=fgets($FP, 4096);
fclose ($FP);
settype($Count, "integer");
$Count++;
if ($FP = fopen ($TextFile, "w")){
fwrite ($FP, $Count);
fclose ($FP);
}
$image = "counterpic.png";
$im = imagecreatefrompng($image);
$red = ImageColorAllocate ($im, 255, 0, 0);
$blue = ImageColorAllocate ($im, 0, 0, 255);
$hit = "$Count";
$ip = $_SERVER["REMOTE_ADDR"];
ImageString($im, 2, 18, 1, "www.sr-ultimate.com", $blue);
ImageString($im, 2, 1, 19, " Your ip: $ip", $red);
ImageString($im, 2, 1, 30, " Page visited $hit times ", $red);
header("Content-Type: image/png");
Imagepng($im,'',100);
ImageDestroy ($im);
?>
[/PHP]
3. Save it as index.php or anything u like just with .php extention
4. Now save the 3 files index.php , counter.txt & this image in a folder and upload it through FTP to any server supporting php.
5. Grant counter.txt CMOD 777 ( right click in FTP > properties > all previlages)
6. Then call index.php in your browser . that`s it :cheesy:
TIP:
1. You can link to the index.php with the normal image tags.
2. If you upload these files to a folder called pic.gif you will be able to use it on forums by using the url www.yourhost.com/pic.gif and it will run the index.php and output the image, Useful if the site or forum don't allow php images or html code.
3. You can enter any no. in counter.txt the image will show that much hits !!!! LOL
4. this is the final image
http://www.sr-ultimate.com/ip.gif
1. You can link to the index.php with the normal image tags.
2. If you upload these files to a folder called pic.gif you will be able to use it on forums by using the url www.yourhost.com/pic.gif and it will run the index.php and output the image, Useful if the site or forum don't allow php images or html code.
3. You can enter any no. in counter.txt the image will show that much hits !!!! LOL
4. this is the final image
http://www.sr-ultimate.com/ip.gif
Very accurate Tutorial, thanks!
dynastyCODERS#1 when it comes to Programming Tutorials, Database designs and discussions, Operating Systems, you name it, check us out and drop us a line to tell us your opinions on any and everything in mind!;)
•
•
•
•
Originally Posted by iwonder
BTW plz use this image instead of the above one I gave u
Cause that does not support hotlinking
dynastyCODERS#1 when it comes to Programming Tutorials, Database designs and discussions, Operating Systems, you name it, check us out and drop us a line to tell us your opinions on any and everything in mind!;)
![]() |
Similar Threads
- hit counter (Site Layout and Usability)
- Hit counter (JavaScript / DHTML / AJAX)
- Help!!!Need JSP Hit Counter (JSP)
- ASP .NET database hit counter (ASP.NET)
Other Threads in the PHP Forum
- Previous Thread: Tutorial for installing PHP on Winnt4 Server
- Next Thread: Parsing an atom feed
| Thread Tools | Search this Thread |
apache api array beginner beneath binary broadband broken button cakephp checkbox class cms code countingeverycharactersfromastring crack cron curl database date display dynamic echo email error fcc file files folder form forms freelancing function functions google href htaccess html image include incode insert integration ip javascript joomla limit link login mail match menu method mlm mod_rewrite multiple mysql oop pageing pagerank paypal pdf php problem query radio random recursion recursiveloop remote script search server sessions sms smtp soap source space sql strip_tags subversion support! survey syntax system table template tutorial undefined update upload url validator variable video virus web window.onbeforeunload=closeme; youtube






