Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

IP Sig

- - - - -

  • This topic is locked This topic is locked
150 replies to this topic

#51
gamehead200

gamehead200

    SEARCH!!! SEARCH!!!

  • Super Moderator
  • 7,039 posts
  • Joined 02-September 02
  • OS:Windows 7 x64
  • Country: Country Flag

well the qoutes not wrapping to the next line
Heres the code i used im i doing something wrong?

<?php
header ("Content-type: image/png");
Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
Header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
Header('Pragma: no-cache');

$image = imagecreatefromgif("bg.gif");
$back_color = ImageColorAllocate ($image, 0, 5, 5);
$white = ImageColorAllocate($im, 255, 255, 255);
$ip = ( !empty($_SERVER['REMOTE_ADDR']) ) ? $_SERVER['REMOTE_ADDR'] : ( ( !empty($_ENV['REMOTE_ADDR']) ) ? $_ENV['REMOTE_ADDR'] : $REMOTE_ADDR );
$quotes = file('quotes.txt');
$quote = array_rand($quotes);
$joke = wordwrap($quotes[$quote], 40, "\n", 1);
$joke = explode("\n", $joke);


ImageString  ($image, 2, 12, 50, "You are $ip", $white);
ImageString ($image, 2, 12, 70,  "Your Running:", $white);
ImageString  ($image, 2, 12, 90, "$HTTP_USER_AGENT", $white);
for($i=0; $i<count($joke); $i++) {
ImageString  ($image, 2, 12, 110,  $joke[$i], $white);}
Imagepng($image);
imagedestroy($image);
?>

Looks fine to me! :)


How to remove advertisement from MSFN

#52
tawxic

tawxic

    Newbie

  • Member
  • 35 posts
  • Joined 02-November 03
howdy again...

I have a question.. since we stopped using the imagettftext for text, and went on to imagestring.. maybe the option is available.. how do I center a text string? thanks :)
Posted Image

#53
Flynn

Flynn
  • Member
  • 6 posts
  • Joined 01-December 03

I've tried including the OS and browser but it has never come out properly for me... I'll post it in here as soon as I find out...


Well since this site was invaluable to me in figuring out how that signature image worked, here you go for OS and browser detection. This isn't my code but snips I located on the web in several places so I don't know who the original author is. It might not be perfect, but it's a really good start.

Code removed due to a bug,  new code with bugcatcher is a few post down

Posted Image

#54
un4given1

un4given1

    Elaborate Dreamer

  • Member
  • PipPipPipPipPipPipPip
  • 1,796 posts
  • Joined 25-September 03
Flynn: your IP sig says... "Your ISP is: www.85.31" needless to say... that's wrong. just thought you should know.
What if everything around you, isn't quite as it seems...
What if all the world you used to know, is an elaborate dream...
And if you look at your reflection, Is that all you want to be?
What if you could look right through the cracks, Would you find yourself... find yourself afraid to see?

#55
Flynn

Flynn
  • Member
  • 6 posts
  • Joined 01-December 03

Flynn: your IP sig says... "Your ISP is: www.85.31" needless to say... that's wrong. just thought you should know.


I guess then your IP isn't resolving and it's just ripping the last part of your IP
Posted Image

#56
Flynn

Flynn
  • Member
  • 6 posts
  • Joined 01-December 03
Ok here is the code with a bug catcher to catch non-resolved IPs as un4given1 pointed out.

$ip = The IP
$isp = The domain you need to prefix it with "www."
$endos = The OS

// get IP and resolve IP
$ip = $REMOTE_ADDR;
$resolved = gethostbyaddr ($REMOTE_ADDR);



// check for non resolve of IP and rip domain if resolved
if ($resolved == $ip) {
$isp = ".. Can't Resolve IP";
}
else
{
$str = preg_split("/\./", $resolved);
$i = count($str);
$x = $i - 1;
$n = $i - 2;
$isp = $str[$n] . "." . $str[$x];
}

// Simple OS Detection

$os = $HTTP_USER_AGENT;
$oslist = Array (

// Windows
"Win|Windows",
"Win16|Windows",
"Win95|Windows 95",
"Win98|Windows 98",
"WinME|Windows ME",
"Win32|Windows",
"WinNT|Windows NT",
"Windows 3.1|Windows 3.1",
"Windows 95|Windows 95",
"Windows CE|Windows CE",
"Windows 98|Windows 98",
"Windows ME|Windows ME",
"Windows NT|Windows NT",
"Windows NT 5.0|Windows 2000",
"Windows NT 5.1|Windows XP",

// Macintosh
"Mac_68000|MacOS m68K",
"Mac_68K|MacOS m68K",
"Mac_PowerPC|MacOS PPC",
"Mac_PPC|MacOS PPC",
"Macintosh|MacOS",

// Unices
"X11|UNIX",
"BSD|BSD",
"SunOS|SunOS",
"IRIX|IRIX",
"HP-UX|HP-UX",
"AIX|AIX",
"QNX|QNX",
"SCO_SV|SCO UNIX",
"FreeBSD|FreeBSD",
"NetBSD|NetBSD",

// Linux 
"Linux|Linux",
"Debian|Debian GNU/Linux",

// Other 
"BeOS|BeOS",
"OS/2|OS/2",
"AmigaOS|AmigaOS",

);

foreach ($oslist as $osnow) {
$osnow = explode ("|", $osnow);
if (eregi ($osnow[0], $os)) {
$endos = $osnow[1];
$check = "No";
} elseif ($check != "No") {
$endos = "Unknown";
}
}

Posted Image

#57
gamehead200

gamehead200

    SEARCH!!! SEARCH!!!

  • Super Moderator
  • 7,039 posts
  • Joined 02-September 02
  • OS:Windows 7 x64
  • Country: Country Flag
Thanks Flynn! Very useful! :rolleyes:

And welcome to MSFN! :)

#58
bman3022

bman3022

    Newbie

  • Member
  • 26 posts
  • Joined 22-November 03
**** i wish you had postted sonner i had to find out how to do it by asking the creator of the dansoft script
Posted Image

One question tho is there any way to make it say windows me?
CAuse i use winme and it says im using windows 98
Sig Oversized - Removed by Admin

#59
Flynn

Flynn
  • Member
  • 6 posts
  • Joined 01-December 03

One question tho is there any way to make it say windows me?


You know someone else pointed that out to me today :) I have no idea why the author of the code left out Me but it should be a simple fix

Add these two like line one each just under the 98 entries the resemble

Just under "Win98|Windows 98", insert this

"WinME|Windows ME",

Just under "Windows 98|Windows 98", insert this

"Windows ME|Windows ME",

Report back if this works as I have never had a ME machine and the other person had yet to report back if the patch worked.
Posted Image

#60
tawxic

tawxic

    Newbie

  • Member
  • 35 posts
  • Joined 02-November 03
what's wrong with this code? it just gives me the red x image box.

<?php
header ("Content-type: image/png");
header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
header('Pragma: no-cache');

define("OFFSET", 0);

define("YSECS", 365*24*60*60);
define("DSECS", 24*60*60);
define("HSECS", 60*60);
define("MSECS", 60);

function countdown($detail, $year, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0) {
	$years = $days = $hours = $minutes = $seconds = 0;
	$now = mktime() + OFFSET*60*60;	
	$then = mktime($hour, $minute, $second, $month, $day, $year);	
	$cdown = abs($then - $now);
	
	if ($detail == 1) $years = round($cdown/YSECS);
	else $years = floor($cdown/YSECS);
	$cdown %= YSECS;
	if ($detail == 2) $days = round($cdown/DSECS);
	else $days = floor($cdown/DSECS);
	$cdown %= DSECS;
	if ($detail == 3) $hours = round($cdown/HSECS);
	else $hours = floor($cdown/HSECS);
	$cdown %= HSECS;
	if ($detail == 4) $minutes = round($cdown/MSECS);
	else $minutes = floor($cdown/MSECS);
	$cdown %= MSECS;
	$seconds = $cdown;
	
	$tnums = array($years, $days, $hours, $minutes, $seconds);
	$ttext = array("year", "day", "hour", "minute", "second");
	
	$shown = 0;
	
	for ($i=0;$i<$detail;$i++) {
  if ($tnums[$i]) {
 	 echo "$tnums[$i] $ttext[$i]";
 	 $shown++;
 	 if ($tnums[$i] != 1) echo "s";
 	 $count = 0;
 	 for ($j=$i+1;$j<$detail;$j++) {
    if ($tnums[$j]) $count++;
 	 }
 	 switch($count) {
    case 0: break 2;
    case 1: if ($shown>1) echo ","; echo " and "; break;
    default: echo ", "; break;
 	 }
  }
	}
	if ($now > $then) echo " ago";
	if ($now == $then) echo "now";
}
$tilxmas = countdown(2, 2003,12,25);

$image = imagecreatefromgif("xmas.gif");

$white = imagecolorallocate($image, 255, 255, 255);

$font = "candycane.ttf";

imagettftext ($image, 24, 0, 5, 5, $white, $font, $tilxmas);

imagepng($image);
imagedestroy($image);

?>

here's the image:

Posted Image

Can't figure it out :-/
Posted Image

#61
Shotgun

Shotgun

    Advanced Member

  • Member
  • PipPipPip
  • 462 posts
  • Joined 07-November 03
Just found this on php.net under the imagecreatefromgif entry:

imagecreatefromgif() returns an empty string on failure. It also outputs an error message, which unfortunately displays as a broken link in a browser.

also:

dpetrov at nchcapital dot cm
26-Aug-1999 01:37
Support for PNG images was added to GD with the removal of GIF support. Latest patches for PHP 3.0 add new functions, in particular ImageCreateFromPng() and ImagePng(). At the time of writing, for some odd reason, PHP 4.0 does NOT have these functions.

  • check the PHP version on the server the script is running from.
  • check there for a function to output an error message in case the imagecreate functions bails out with an error.
  • Can you read a GIF to output a PNG? I've only done reading from the same type as the output (read GIF->Output GIF, read JPG -> Output JPG, and so on)


#62
bman3022

bman3022

    Newbie

  • Member
  • 26 posts
  • Joined 22-November 03

Report back if this works as I have never had a ME machine and the other person had yet to report back if the patch worked.

nope it didnt work it still says windows 98

But if anybody is interested heres how to show the browser name
Use $browser to call it
   //browser type	
    $agent = $HTTP_USER_AGENT;
    if ( strstr($agent, "MSIE 5") ) $browser = "using IE 5";
    elseif ( strstr($agent, "MSIE 6") ) $browser = "using IE 6";
    elseif ( strstr($agent, "MSIE 4") ) $browser = "using IE 4";
    elseif ( strstr($agent, "Firebird") ) $browser = "using Firebird";
    elseif ( strstr($agent, "Safari") ) $browser = "using Safari";
    elseif ( strstr($agent, "Mozilla/5") ) $browser = "using Mozilla/Netscape 5";
    elseif ( strstr($agent, "Mozilla/6") ) $browser = "using Netscape 6";
    elseif ( strstr($agent, "Mozilla/4") ) $browser = "using Netscape 4";
    elseif ( strstr($agent, "Opera") ) $browser = "using Opera";
    else $browser = "";

Sig Oversized - Removed by Admin

#63
gamehead200

gamehead200

    SEARCH!!! SEARCH!!!

  • Super Moderator
  • 7,039 posts
  • Joined 02-September 02
  • OS:Windows 7 x64
  • Country: Country Flag
Sweet! Now we can make our own IP sigs! :rolleyes:

Now to find out how to rotate backgrounds... :)

#64
Flynn

Flynn
  • Member
  • 6 posts
  • Joined 01-December 03

Now to find out how to rotate backgrounds... :rolleyes:

This snippent of code will rotate (random) backgrounds :)

Of course you need to change it around a bit to match your script (image type and names) maybe, notice the first variable in the array is left blank "", I did this just to make the image numbers match the array number without using 0 as an image number.

You also need to change your "createfrom" line to include the new random variable.

The only problem with this is that the browser doesn't refresh all the time because the linked image name remains the same, depending on your browser settings of course.

// random background

$random_image = array("",
                    "bg1.png",
                    "bg2.png",
                    "bg3.png",
                    "bg4.png");

srand ((double) microtime() * 1000000);
$rnd = rand(1,4);

// create the image
$image = imagecreatefrompng($random_image[$rnd]);

Posted Image

#65
renaxgade

renaxgade
  • Member
  • 5 posts
  • Joined 07-December 03
Ok, well I'm trying to follow all of this. I have a file called .htaccess and it looks like this
<Files ipaddress.jpg>
ForceType application/x-httpd-php
</Files>
I also have a file called ipaddress.jpg that looks like this:
<?php
Header ('Content-type: image/png');
Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
Header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
Header('Pragma: no-cache');

// create the image
$image = imagecreatefrompng("bg.png");

// set the colours
$cool = imagecolorallocate($image, 81, 86, 96);
$black = imagecolorallocate($image, 0, 0, 0);
$white = imagecolorallocate($image, 255, 255, 255);
$red = imagecolorallocate($image, 255, 0, 0);
$grey = imagecolorallocate($image, 204, 204, 204);
$green = imagecolorallocate($image, 206, 129, 18);
$blue = imagecolorallocate($image, 0, 0, 255);

// set the font and print text
$font = 'Arial.ttf'

ImageTTFText ($image, 8, 0, 10, 17, $white, $font, "Your IP Address is... ".$REMOTE_ADDR);

// output and destroy
imagepng($image);
imagedestroy($image);

?>
When I open the jpg through a php enabled browser, it just gives me the code back for ipaddress. No image just code. The bg.png is also in that folder. :)
BTW: I am using a Windows Apache server with php, and in my php info I can't find anything with "GD" in it, I searched.

#66
bman3022

bman3022

    Newbie

  • Member
  • 26 posts
  • Joined 22-November 03
you need to replace the png things since your going to use a jpg file so try this:
<?php
Header ('Content-type: image/jpg');
Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
Header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
Header('Pragma: no-cache');

// create the image
$image = imagecreatefrompng("bg.png");

// set the colours
$cool = imagecolorallocate($image, 81, 86, 96);
$black = imagecolorallocate($image, 0, 0, 0);
$white = imagecolorallocate($image, 255, 255, 255);
$red = imagecolorallocate($image, 255, 0, 0);
$grey = imagecolorallocate($image, 204, 204, 204);
$green = imagecolorallocate($image, 206, 129, 18);
$blue = imagecolorallocate($image, 0, 0, 255);

// set the font and print text
$font = 'Arial.ttf'

ImageTTFText ($image, 8, 0, 10, 17, $white, $font, "Your IP Address is... ".$REMOTE_ADDR);

// output and destroy
imagejpg($image);
imagedestroy($image);

?>

This should work. Report back if it doesnt
Sig Oversized - Removed by Admin

#67
gamehead200

gamehead200

    SEARCH!!! SEARCH!!!

  • Super Moderator
  • 7,039 posts
  • Joined 02-September 02
  • OS:Windows 7 x64
  • Country: Country Flag
Anyone know how to center text on a PHP sig?

#68
Datalore

Datalore

    Friend of MSFN

  • Member
  • PipPipPipPipPip
  • 852 posts
  • Joined 05-October 03
Anyone know how to stream a movie file into a sig? :) It should be possible. Just tell the player application to output the move to a 30 frame animated gif every second. Whoosh, 100 kb streaming gif movie player. I have no idea what I'm talking about.

#69
bman3022

bman3022

    Newbie

  • Member
  • 26 posts
  • Joined 22-November 03
I dont think thats possible using this script
Its easier just to make a gif out of the clip using an animator :)
Sig Oversized - Removed by Admin

#70
Sunil

Sunil

    Senior Member

  • Member
  • PipPipPipPip
  • 596 posts
  • Joined 24-June 03
I think to achive this you would need to create a script that would automatically create the SIG from the new image output. This could be done by simply deleting the old one and renaming the new one the same as the old, but to create the stream, i donno.

#71
Datalore

Datalore

    Friend of MSFN

  • Member
  • PipPipPipPipPip
  • 852 posts
  • Joined 05-October 03
It would be pretty cool to have entire movies playing in your sig, movies that normally couldn't be turned into a regular gif.

#72
renaxgade

renaxgade
  • Member
  • 5 posts
  • Joined 07-December 03
I'm not sure if my php is configured correctly. Can someone check if
http://renaxgade.net/test.php
is enabled for these kind of sigs?

#73
bman3022

bman3022

    Newbie

  • Member
  • 26 posts
  • Joined 22-November 03
yes GD is enabled on there so the sig should work
Sig Oversized - Removed by Admin

#74
renaxgade

renaxgade
  • Member
  • 5 posts
  • Joined 07-December 03
Hrmm, it doesn't seem to be working. The sig just displays me code of php, so I don't think that the .htaccess is working. The weird thing is, it doesn't look like it's in the directory, but If i type it in from command line it works. Do I have to tell my http.conf to look for .htaccess ?

#75
gamehead200

gamehead200

    SEARCH!!! SEARCH!!!

  • Super Moderator
  • 7,039 posts
  • Joined 02-September 02
  • OS:Windows 7 x64
  • Country: Country Flag

Hrmm, it doesn't seem to be working. The sig just displays me code of php, so I don't think that the .htaccess is working. The weird thing is, it doesn't look like it's in the directory, but If i type it in from command line it works. Do I have to tell my http.conf to look for .htaccess ?

Yes... I think there's an option for it in the httpd.conf file... :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users