Jump to content

Recommended Posts

I am not a hacker, but i found http://www.sr-ultimate.com/2005/02/14/ip-showing-signature-hit-counter/ and thought of trying it out, this didn't work, so i came here. :-\

 

this is what i got:

http://www.zendurl.com/x/xlrstore/in.php

 

and here is the source of my index.php please tell me what has gone wrong?

 

    < ?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);
    ?>

 

thanks in advance ;D

 

 

Link to comment
https://forums.phpfreaks.com/topic/72281-why-isnt-this-code-worrking/
Share on other sites

Your Host doesn't support PHP

Yes, it does!

otherwise the code would be displayed!...

 

OK problems

#1 you can not have anything else at the start of the page, you have this

<p align="center">
<script type="text/javascript"><!--
google_ad_client = "pub-4820636587049265";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
//2007-09-15: userpages_top
google_ad_channel = "1427674372";
//-->
</script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</p>

 

#2.at the end of the page you have this

<p align="center"><font size="1"><a href="http://www.tomorrowhosting.com">Get High Quality Hosting Starting For Only One Cent At Tomorrow Hosting</a></font></p>
<p align="center"><font size="1">These ZendURL Ads <b>Are Not </b>Forced. Click <a href="http://www.zendurl.com/noads.html" target="_blank">Here</a> To Disable Them Permanently!</font></p>

<!-- Start of StatCounter Code -->
<script type="text/javascript" language="javascript">
var sc_project=1144755; 
var sc_invisible=1; 
var sc_partition=10; 
var sc_security="d3d7ec5e"; 
</script>

<script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript><a href="http://www.statcounter.com/" target="_blank"><img  src="http://c11.statcounter.com/counter.php?sc_project=1144755&java=0&security=d3d7ec5e&invisible=1" alt="hit tracker" border="0"></a> </noscript>
<!-- End of StatCounter Code -->


<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-835715-1";
urchinTracker();
</script>

 

 

#3. < ?php should be <?php

 

#4. line 26

    Imagepng($im,'',100);"

should be

    Imagepng($im);

 

 

save the file as is (with corrections)

then add it into some HTML as you would any image

ie

<img src="balr.php">

 

EDIT: the file above should be its own file (think of it as an image)

Yu mean like this??

 

<p align="center">
<script type="text/javascript"><!--
google_ad_client = "pub-4820636587049265";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
//2007-09-15: userpages_top
google_ad_channel = "1427674372";
//-->
</script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</p>
<?
$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 = "pic.gif";
$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, "random.php", $blue);
ImageString($im, 2, 1, 19, " Your ip: $ip", $red);
ImageString($im, 2, 1, 30, " Signature viewed $hit times ", $red);
header("Content-Type: image/png");
Imagepng($im);
ImageDestroy ($im);
?>
<p align="center"><font size="1"><a href="http://www.tomorrowhosting.com">Get High Quality Hosting Starting For Only One Cent At Tomorrow Hosting</a></font></p>
<p align="center"><font size="1">These ZendURL Ads <b>Are Not </b>Forced. Click <a href="http://www.zendurl.com/noads.html" target="_blank">Here</a> To Disable Them Permanently!</font></p>

<!-- Start of StatCounter Code -->
<script type="text/javascript" language="javascript">
var sc_project=1144755; 
var sc_invisible=1; 
var sc_partition=10; 
var sc_security="d3d7ec5e"; 
</script>

<script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript><a href="http://www.statcounter.com/" target="_blank"><img  src="http://c11.statcounter.com/counter.php?sc_project=1144755&java=0&security=d3d7ec5e&invisible=1" alt="hit tracker" border="0"></a> </noscript>
<!-- End of StatCounter Code -->


<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-835715-1";
urchinTracker();
</script>

 

and my host supports php: http://xlrblog.zendurl.com//shoutpro/shoutbox.php

no you need 2 files

first create a file called ip.php

use ONLY the code below

 

file 1

<?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 = "pic.gif";
$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, "random.php", $blue);//will only display "random.php"
ImageString($im, 2, 1, 19, " Your ip: $ip", $red);
ImageString($im, 2, 1, 30, " Signature viewed $hit times ", $red);
header("Content-Type: image/png");
Imagepng($im);
ImageDestroy ($im);
?>

please note thats you have code for reading from a text file

 

then the second file, your use the above file as an image,

see <img src="ip.php"> in the below file,

 

file 2

<p align="center">
<script type="text/javascript"><!--
google_ad_client = "pub-4820636587049265";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
//2007-09-15: userpages_top
google_ad_channel = "1427674372";
//-->
</script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</p>

<img src="ip.php">

<p align="center"><font size="1"><a href="http://www.tomorrowhosting.com">Get High Quality Hosting Starting For Only One Cent At Tomorrow Hosting</a></font></p>
<p align="center"><font size="1">These ZendURL Ads <b>Are Not </b>Forced. Click <a href="http://www.zendurl.com/noads.html" target="_blank">Here</a> To Disable Them Permanently!</font></p>

<!-- Start of StatCounter Code -->
<script type="text/javascript" language="javascript">
var sc_project=1144755; 
var sc_invisible=1; 
var sc_partition=10; 
var sc_security="d3d7ec5e"; 
</script>

<script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript><a href="http://www.statcounter.com/" target="_blank"><img  src="http://c11.statcounter.com/counter.php?sc_project=1144755&java=0&security=d3d7ec5e&invisible=1" alt="hit tracker" border="0"></a> </noscript>
<!-- End of StatCounter Code -->


<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-835715-1";
urchinTracker();
</script>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.