Jump to content

Text On an image help please


jnerotrix

Recommended Posts

hello I have a script that takes ip's and puts them into a text file

php gets the ip checks if its already in the file ip.txt if it is not in the file it adds the ip to ip.txt on a new line then another script counts the number of lines.

 

I need the Number of Lines Counted to show up on the image heres all the codes so far

 

------------

Files:

visits.php

track.php

ip.txt

index.php

 

and heres the image i need the text to show up on

track.png

I need the Text to Show up Next to Total Visits but i dont know how

 

Visit.php

<?php
include('track.php');
$file = "ip.txt";
  $users = count(file($file));

$string = $users;
$im = imagecreatefrompng('./track.png');

$textColor = imagecolorallocate ($im, 255, 255, 255);
imagestring($im, 5, 0, 0, "$string", $textColor); 


header ("Content-type: image/png");
imagepng($im);

?>

 

track.php

<?php

$ip = $_SERVER['REMOTE_ADDR'];

$myFile = "ip.txt"; 

$lines = file($myFile); 
$lines = array_map('trim',$lines);

if(!in_array($ip,$lines)){
   $fh = fopen($myFile, 'a') or die("can't open file");
   $stringData = "$ip\r\n";
   fwrite($fh, $stringData);
   fclose($fh);
}
?>

 

then theres ip.txt

 

and

 

index.php

<center>
<br><br><br>
<h1> Numbmer Of Visited Users Test
<br>

<?php include ('visits.php'); ?>
</center>

 

All I see on the page is

 

The Image "http://joeyelectric.comuf.com/search/index.php" Could Not Be Displayed Because it Contains Errors

 

Please Help Thanks,

jnerotrix

 

Link to comment
Share on other sites

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.