Re: Call a script as an image from a remote server
| From: | Andreas Pour | Date: | Fri, 21 Jul 2000 03:54:58 +0000 |
| Subject: | Re: Call a script as an image from a remote server | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-7508@lists.php.net to get a copy of this message | ||
John wrote:
>
> Call a script as an image from a remote server
>
> Hi,
>
> In the below code(let's call it count.php) I want to insert an image.
> I want to call this script from a remote server as an image and instead
> of showing a broken image link, I want it to show an image.
>
> <img src="http://mydomain,com/count.php">
>
> Is there any way I can do this ?
>
> Thanks in advance.
>
> John
>
> ##################
> Count.php
> ##################
> //<?echo "<img
> src=\"http://mydomain.com/images/1.gif\">";?>
> <?
> include ("user.php");
> $handler=@mysql_connect($db_server,$db_username,$db_passwort);
> @mysql_select_db($db_database,$handler);
> $zeit = time();
> $ip = getenv(REMOTE_ADDR);
> $file = $PHP_SELF;
> $result=@mysql_query("INSERT INTO $db_table VALUES
> ('$zeit','$ip','$file')",$handler);
Although I can't approve of tracking user's IP addresses like this, just
add the lines
header("Content-type: image/$imgtype");
header("Content-Length: " . filesize($imgfile));
@readfile($imgfile);
Ciao,
Andreas