Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Randome Quote and user info sig (dynamic)
Index -> Programming, PHP -> PHP Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Amailer




PostPosted: Sun Apr 11, 2004 1:50 pm   Post subject: Randome Quote and user info sig (dynamic)

code:

<?php
/***************************************************************************
 *                             SIG.PNG(PHP)
 *         This is a dynamic siginutre created by GFX-PRO group
 *
 *
 *           Note: The image size of your .png file (mysig.png)
 *     Must be 400x80 (if your text is longer, you have to make your
 *         image's width longer also) And it has to be in png format
 *
/***************************************************************************/


//
// Please edit the settings below, if needed...
//
$image = 'mysig.png'; // Your background image
/* Size should be 400x80 for this signiture, it can be bigger but not smaller.. */

$main_font = 'C:\windows\fonts\arial.ttf';  // Main font used
$second_font = 'C:\windows\fonts\verdana.ttf'; // Second font used

/* These are the quotes, you may add new quotes
   by simply following the pattern */

$quote = array();

$quote[] = 'There are no stupid questions, just stupid people';
$quote[] = 'Get a life';
$quote[] = 'M$ works!';
$quote[] = 'Go shoot your self';
$quote[] = 'GFX-PRO Pawns all other sites for a fact';
$quote[] = 'Is that the best turing can do?';
$quote[] = 'All your base are belong to us - CATS';
$quote[] = 'You have no chance to survive make your time - CATS';
$quote[] = 'They set us up the bomb!';
$quote[] = 'Turing? huh?';
$quote[] = 'Im with stupid';
$quote[] = 'Its hard for you to get a life, isn\'t it?';
$quote[] = 'inferior beings... bow down to my knees!';
$quote[] = 'I call it danish!';
$quote[] = 'Never go to bed mad. Stay up and fight.';
$quote[] = 'The secret of a happy marriage remains a secret.';
$quote[] = 'Life is just another worthless thing...';
$quote[] = 'Retards are just like you';
$quote[] = 'Im with stupid';
$quote[] = 'If you have something bad to say, say it often!';

$rand_quote = array_rand($quote); // leave this, just counts the number of quotes


///////////////////////////////////////////////////////////////////////////
//
//   Begin getting the users info
//   The script below has been taken from the php-nuke webportal.
//   (only the part where the borwser and os data is gotten from)
//
///////////////////////////////////////////////////////////////////////////

/* Get the users browser data */

if((ereg("Nav", $_SERVER["HTTP_USER_AGENT"])) || (ereg("Gold", $_SERVER["HTTP_USER_AGENT"])) || (ereg("X11", $_SERVER["HTTP_USER_AGENT"])) || (ereg("Mozilla", $_SERVER["HTTP_USER_AGENT"])) || (ereg("Netscape", $_SERVER["HTTP_USER_AGENT"])) AND (!ereg("MSIE", $_SERVER["HTTP_USER_AGENT"]) AND (!ereg("Konqueror", $_SERVER["HTTP_USER_AGENT"])))) $browser = "Netscape (Mozilla)";
elseif(ereg("MSIE", $_SERVER["HTTP_USER_AGENT"])) $browser = "MSIE";
elseif(ereg("Lynx", $_SERVER["HTTP_USER_AGENT"])) $browser = "Lynx";
elseif(ereg("Opera", $_SERVER["HTTP_USER_AGENT"])) $browser = "Opera";
elseif(ereg("WebTV", $_SERVER["HTTP_USER_AGENT"])) $browser = "WebTV";
elseif(ereg("Konqueror", $_SERVER["HTTP_USER_AGENT"])) $browser = "Konqueror";
elseif((eregi("bot", $_SERVER["HTTP_USER_AGENT"])) || (ereg("Google", $_SERVER["HTTP_USER_AGENT"])) || (ereg("Slurp", $_SERVER["HTTP_USER_AGENT"])) || (ereg("Scooter", $_SERVER["HTTP_USER_AGENT"])) || (eregi("Spider", $_SERVER["HTTP_USER_AGENT"])) || (eregi("Infoseek", $_SERVER["HTTP_USER_AGENT"]))) $browser = "Bot";
else $browser = "Other";

/* Get the Operating System data */

if(ereg("Win", $_SERVER["HTTP_USER_AGENT"])) $os = "Windows";
elseif((ereg("Mac", $_SERVER["HTTP_USER_AGENT"])) || (ereg("PPC", $_SERVER["HTTP_USER_AGENT"]))) $os = "Mac";
elseif(ereg("Linux", $_SERVER["HTTP_USER_AGENT"])) $os = "Linux";
elseif(ereg("FreeBSD", $_SERVER["HTTP_USER_AGENT"])) $os = "FreeBSD";
elseif(ereg("SunOS", $_SERVER["HTTP_USER_AGENT"])) $os = "SunOS";
elseif(ereg("IRIX", $_SERVER["HTTP_USER_AGENT"])) $os = "IRIX";
elseif(ereg("BeOS", $_SERVER["HTTP_USER_AGENT"])) $os = "BeOS";
elseif(ereg("OS/2", $_SERVER["HTTP_USER_AGENT"])) $os = "OS/2";
elseif(ereg("AIX", $_SERVER["HTTP_USER_AGENT"])) $os = "AIX";
else $os = "Other";
/////////
// END //
/////////


//
// This is the text that will be displayed on your image
//
$ip = "Hey ".$_SERVER["REMOTE_ADDR"] .','; // IP
$browser = 'You are using '.$browser.' to view this page'; // Browser message
$operatingsystem = 'and your operating system is '.$os; // Operating System
$quote_say = 'Random quote:'; // Randome quote
$website = 'Visit: http://gfx-pro.ath.cx'; // Site to visit (unused)

$im = ImageCreateFromPNG($image); // Create the PNG image


$white = ImageColorAllocate($im, 255, 255, 255); // White colour/color
$darkblue = ImageColorAllocate($im, 0, 6, 89);  // Dark blue colour/color
$darkred = ImageColorAllocate($im, 128, 0, 0); // Dark red colour/color

$prebackcolor = imagecolorallocate($im,255,255,255); // Assign the background color

$backcolor = imagecolortransparent($im,$prebackcolor); // Make the bg transparent, if the page is alone, make it black


//
// Display the text on the image...with the font/colour and etc
//
imagettftext($im, 8, 0, 100, 17, $darkblue, $second_font, $ip); // Display ip address
imagettftext($im, 8, 0, 100, 27, $darkblue, $second_font, $browser); // Display users browser
imagettftext($im, 8, 0, 100, 37, $darkblue, $second_font, $operatingsystem); // Display users operating system
imagettftext($im, 8, 0, 100, 57, $darkblue, $second_font, $quote_say); // Display 'randome quote' message
imagettftext($im, 7.8, 0, 100, 71, $darkblue, $second_font, $quote[$rand_quote]); // Display the randome quotes

Header("Content-Type: image/png");
Imagepng($im,'',100);
ImageDestroy ($im);
?>


Okay... so this is a simple script and it's result is in my sig.. (the image)
Now the problem here is... WHY on earth doesn't it work on other peoples server?

they changed the font path to
./font/theirfontname.tff

but it still doesn't work.. but it does work on mine :S
Happy easter btw.
Sponsor
Sponsor
Sponsor
sponsor
the_short1




PostPosted: Thu Apr 29, 2004 7:18 pm   Post subject: (No subject)

^Amailer... !!! the best.... kicks PHP A$$ as can sometimes be found in my sig pic which he helped me make Smile


for that... i will say it... this program KICKS!


... yea amailer... i wish i could use on my SHAW server.... that way there it would have unlimited bandwidth and it would download fasta. Razz


cuz rite now its pretty slow... ** but im thankful ur hosting ... so... ill shutup Wink
Paul




PostPosted: Sat May 01, 2004 7:56 am   Post subject: (No subject)

yea, ur sig doesn't work for me.
the_short1




PostPosted: Sat May 01, 2004 10:08 am   Post subject: (No subject)

hey PB.... can u see mine???? **its hosted at his site also..
.... if u also notice.. sometimes it displays ur site !!

hmm...... hey amailer....
exactly which files would i need to host on my shaw server to see if it would work ???
Amailer




PostPosted: Sat May 01, 2004 10:37 am   Post subject: (No subject)

the mysig.png and the sig.png ;D.. and the htaccess...
and to view it right click and click 'view image' or 'show image'.. dns is messed up when ever my ip changes :S so-- ya
the_short1




PostPosted: Sat May 01, 2004 1:28 pm   Post subject: (No subject)

how do i make the sig.png ???
i pasted code into notepad and saved as .png but that dont work... Sad
Amailer




PostPosted: Sat May 01, 2004 1:43 pm   Post subject: (No subject)

I just created a blank text document, renamed it to w/e.png and saved it Very Happy
the_short1




PostPosted: Mon May 03, 2004 4:52 pm   Post subject: (No subject)

yea... then it sdidn;t work...
The image "http://members.shaw.ca/rfolz/sig.png" cannot be displayed, because it contains errors.

Sad
Sponsor
Sponsor
Sponsor
sponsor
Amailer




PostPosted: Mon May 03, 2004 5:22 pm   Post subject: (No subject)

show me the code you have.
Amailer




PostPosted: Sat Jun 26, 2004 4:57 pm   Post subject: (No subject)

This needs..
GD Libary installed
and FreeType installed for your PHP Very Happy
the_short1




PostPosted: Sat Jun 26, 2004 6:19 pm   Post subject: (No subject)

hey i went to php.com and download and installed php..

and in my fileserver... i followed it wizard to install php ...


and then i ra n the test page and it was working..


yet when i hosted that sig it would not work..... Sad

and i have been using this code (see attachment)(


and are u hosting the mysig.png at ur server too??? cuz i changed that picture that is hosted on shaw (where it says in code) and it has not changed!


Sad .... i now uninstalled php..... im going to try again to sign up for this webhosting place that allow php and has unlimited bandwidth...
Amailer




PostPosted: Sat Jun 26, 2004 7:19 pm   Post subject: (No subject)

what error did you get?
the_short1




PostPosted: Sat Jun 26, 2004 7:31 pm   Post subject: (No subject)

the same that i always got when trying to host as if i didn;lt have php on..


hmm..



next time i try... ill use this random sig that u have posted here..





and i just emailed this free webshoting again.. (from gmail not hotmail)


they offere..


20 MB... CGI-BIN/PHP/perl and UNLIM<ITED BANDWIDTH.... noiw if i cant get that im in the clear.... except they make u email them because ppl were abusing free sign up...
Display posts from previous:   
   Index -> Programming, PHP -> PHP Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 13 Posts ]
Jump to:   


Style:  
Search: