MSFN Forum: How to make a dynamic signature (IP sig) - MSFN Forum

Jump to content


  • 4 Pages +
  • 1
  • 2
  • 3
  • 4
  • You cannot start a new topic
  • You cannot reply to this topic

How to make a dynamic signature (IP sig) Rate Topic: -----

#41 User is offline   RexxCrow 

  • Group: Members
  • Posts: 6
  • Joined: 18-November 06

Posted 18 November 2006 - 01:05 AM

I was hoping I could get some guidance with issues I am having working this out, I have been through about 1/2 a dozen tutorials on how to do this and have been unable to get one to work at all, I believe I am having an issue with the .htaccess file, I keep getting a HTTP error 500, whatever this is, when I remove the htaccess file I can view other files in that directory though while it is there only this error displays.

I tried using the file that was uploaded to this site on the first page of this thread, with no luck I also tried using it with just the "AddHandler application/x-httpd-php .jpg", still same problem either way. I use an IPOWER WinPro for my web server, though do not know if they have GL installed, I did upload the verada.ttf though.

All I am really wanting to do is have a line of text display in either white or lime green stating "Total Players Currently Online: " and then merging this with a number from another file that will be updated every so many minutes i.e. 12. This will then be displayed in a Administrator's sig for a gaming website and support forums. I have had no luck with this as of yet, any ideas or suggestions would be great, thank you for your time.


UPDATE: I just got of the phone with tech support and they advised their Windows servers do not use Apache they use IIS (?), so is there an alternative for this function or do I need to downgrade my service to their Linux servers that use Apache?

This post has been edited by RexxCrow: 18 November 2006 - 01:59 AM



#42 User is offline   MGadAllah 

  • Brain Voice
  • PipPipPipPipPip
  • Group: Members
  • Posts: 786
  • Joined: 03-January 06

Posted 18 November 2006 - 07:08 AM

But for a one PC stand a lone, can I make it? :}

#43 User is offline   gamehead200 

  • SEARCH!!! SEARCH!!!
  • Group: Super Moderator
  • Posts: 7,034
  • Joined: 02-September 02
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 18 November 2006 - 11:43 AM

View PostRexxCrow, on Nov 18 2006, 03:05 AM, said:

UPDATE: I just got of the phone with tech support and they advised their Windows servers do not use Apache they use IIS (?), so is there an alternative for this function or do I need to downgrade my service to their Linux servers that use Apache?


Probably, but I have no knowledge of it. Downgrading service to Linux? Everyone out there knows that Linux is way more secure than Windows when it comes to hosting a website. You should be upgrading to Linux.

@ MGadAllah: Yes, you can. Search the network forum on how to setup an account at DynDNS.org or a similar service. (Dynamic IP Service)

#44 User is offline   RexxCrow 

  • Group: Members
  • Posts: 6
  • Joined: 18-November 06

Posted 18 November 2006 - 03:03 PM

Sorry, that is just actually sort of funny you MOD for these MS forums and yet you trash Windwos, laff. As well sorry, though I am coming here for help not to debate Win vs. Lin. Although, I will say that there is a reason Linux is more secure then Windwos, which I am sure you are aware of those reasons. By downgrading my service I meant the WinPro package offers much more then the latter Linux packages, Bandwidth, accessibility, storage size, plugins, email accounts, etc.

Personally, I hate Windwos, and I hate BG and everything that spoon feeder is about, but I use his software because, well BG has successfully monopolized the entire computer industry, sure program such as Linux and BartPE are nice alternatives, though they do not permit the necessary foundation to enable the full abilities that most software was built upon specifically for well, you know.

#45 User is offline   RexxCrow 

  • Group: Members
  • Posts: 6
  • Joined: 18-November 06

Posted 18 November 2006 - 05:21 PM

Alright, after tweeking the examples in this thread this is what I have come up to hopefully work with my application, I am making this for an Admin for a site that I believe does use Apache, I just won’t be able to test anything myself, if I have errors in this code please advise me of them, if anybody is willing to do so. I may not have understood everything fully, as this is the first time that I have actually played around with PHP code.

I am planning on setting these files in directory labeled: POAN, server side; this directory will also contain an HTML file that is used by the script I am trying to make this sig for. I have included these files to help paint the picture and limit any confusion. This is to work by having a script create the POAN.HTML and PC.txt files those are then FTP'ed to the server, the POAN.HTML will be accessed by players and the PC.txt is just for the sig, these files will be updated at a set period of time by the admin. the sig will then be linked to by the games support site and the Admins own site, etc. This is for an old online door game known as TradeWars 2002 now TradeWars 2002/TWGS, the script is for a helper called TWXProxy that allows users to make scripts to automate game play for them. This project I am working on though is more admin related, though to the players benefit. Thanks again for any assistance.


An example of the code used by TWXProxy to create the needed file for PC.TXT locally on the admins computer prior to FTPing to their website (these are excerpts from the file, as they are actually written throughout the file in various functions.)
# sets up the file path and name to be used:
setVar $sigPath $POANPath & "PC.TXT"

# if no users are online:
setVar $sig "None"

# else $X is the number of users online.
setVar $sig $X

# checks for the old file, removes it and writes a new one PC.TXT:
fileExists $fc $sigPath
IF $fc
 DELETE $sigPath
END
WRITE $sigPath $sig


POAN.HTML
[displays the game and player information via website]

PC.TXT
[contains the number of players currently online, so this would just contain a number i.e. 10 (I put a little function at the bottom of the Sig.JPG file, which I modified from the random quote code, to read from this file so not sure if I have this correct? Also, does the CHMOD setting for this file matter to make this work?)]

verdana.ttf
[obvious]

.htaccess file:
AddHandler application/x-httpd-php .JPG

Sig.JPG file:
<?php
Header('Content-type: image/jpeg');
Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
Header('Pragma: no-cache');

// set the dimensions
$img_width = 200;
$img_height = 25;

// create the image
$image = imagecreate($img_width, $img_height);

// set the colours
$cool  = imagecolorallocate($image, 81, 86, 96);
$green = imagecolorallocate($image, 0, 255, 0);

// set the background colour
// number or is top left pixel x, top left pixel y, bottom right pixel x, bottom right pixel y
imagefilledrectangle($image, 0, 0, $img_width, $img_height, $cool);

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

// reading from the Player Count text file to obtain the number of players currently online.
// Still need to change CHMOD to 777 also?
$count = file('PC.txt');

// now i will create a line with font size 10, with no angle, 10 pixels to the right, and 15 pixels down
ImageTTFText ($image, 10, 0, 10, 17, $green, $font, "Total Players Currently Online: ".$count);

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


This is the basic result I am hoping for (except in lime green):

Total Players Currently Online: 10


As and alterative option how would you make the number a different color? just put a defined color $ as:

$white=imagecolorallocate($image, 255, 255, 255);
ImageTTFText ($image, 10, 0, 10, 17, $green, $font, "Total Players Currently Online: ".$white.$count);

This post has been edited by RexxCrow: 19 November 2006 - 01:52 AM


#46 User is offline   RexxCrow 

  • Group: Members
  • Posts: 6
  • Joined: 18-November 06

Posted 21 November 2006 - 02:31 PM

Okey dokey lil’ smokies, ya'll discard my prior posts in this here thread, my issues seem to be resolved, (in another forum, BTW.) Posting if anybody else needs to know. As getting assistance here is apparently like pulling teeth.


[ QUOTE ]
ImageTTFText ($image, 10, 0, 10, 17, $green, $font, "Place Text Here: "); 
ImageTTFText ($image, 10, 0, *, 17, $PlaceNewColorCodeVarHere, $font, $PlaceVarNameHere); 
// Replace the * with the number of pixels between the left side of the image and the start of the number.
[ /QUOTE ]

[ INSERT SARCASM ] Again, thanks you all for your wonderful help and attitudez onboard this here MSFN board, outstanding work guyz, ya'll r just sooo l33t! w00t! w00t! U go boyz! laff … These forums are actually eerily similar to calling MS tech support, lolol, newayz I am so outtie, kthxbye [ /INSERT SARCASM ] :hello:

#47 User is offline   gamehead200 

  • SEARCH!!! SEARCH!!!
  • Group: Super Moderator
  • Posts: 7,034
  • Joined: 02-September 02
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 21 November 2006 - 05:00 PM

View PostRexxCrow, on Nov 21 2006, 04:31 PM, said:

Okey dokey lil’ smokies, ya'll discard my prior posts in this here thread, my issues seem to be resolved, (in another forum, BTW.) Posting if anybody else needs to know. As getting assistance here is apparently like pulling teeth.


[ QUOTE ]
ImageTTFText ($image, 10, 0, 10, 17, $green, $font, "Place Text Here: "); 
ImageTTFText ($image, 10, 0, *, 17, $PlaceNewColorCodeVarHere, $font, $PlaceVarNameHere); 
// Replace the * with the number of pixels between the left side of the image and the start of the number.
[ /QUOTE ]

[ INSERT SARCASM ] Again, thanks you all for your wonderful help and attitudez onboard this here MSFN board, outstanding work guyz, ya'll r just sooo l33t! w00t! w00t! U go boyz! laff … These forums are actually eerily similar to calling MS tech support, lolol, newayz I am so outtie, kthxbye [ /INSERT SARCASM ] :hello:

I hope you realize we all have lives away from this board and more than half our time is spent AWAY from MSFN. I am currently still in school and don't have much time to reply to or even discuss stuff like this on a daily basis; I just don't have the time to go through every single post and make sure that every single little thing is taken care of during every single second of every day; that's why we have more than one moderator.

Your sarcasm is not welcome here if that's the way you're going to be. And you shouldn't be saying something such as "OMFG!!! A MOD DISSING WINDOZE!!" either because we all have our personal opinions regarding technology. It's not too surprising in my opinion to see someone saying something of that sort, and I'm sure my fellow colleagues would agree with me.

In either case, I'm glad you resolved your problem, but behaviour of that sort (sarcasm towards others) will not be tolerated here. Seeing as you are a new member here, I suggest you take another good read at the rules located beneath the MSFN logo before continuing to post. Something you might have missed:

Quote

7.b This community is built upon mutual respect. You are not allowed to flame other members. People who do not respect personal opinions and/or personal work will be warned in first instance. If you ignore the warning and keep on flaming, you will be banned without notice.

If you feel the need to reply to this small bit of information, please feel free to PM me. Do NOT, under any cirumstances, reply to this post in this thread.

#48 User is offline   RevRaz 

  • Group: Members
  • Posts: 4
  • Joined: 04-December 06

Posted 04 December 2006 - 02:48 PM

This is a great topic and I thank you for sharing it.

I have it working as intended, but I want to make it more dynamice and change some of the Text in the Image when I read a XML file.

Any chance I can post my code (that isn't working) and have some see if they can spot my error?

#49 User is offline   gamehead200 

  • SEARCH!!! SEARCH!!!
  • Group: Super Moderator
  • Posts: 7,034
  • Joined: 02-September 02
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 04 December 2006 - 04:50 PM

View PostRevRaz, on Dec 4 2006, 04:48 PM, said:

This is a great topic and I thank you for sharing it.

I have it working as intended, but I want to make it more dynamice and change some of the Text in the Image when I read a XML file.

Any chance I can post my code (that isn't working) and have some see if they can spot my error?


Go right ahead. I'll try to look at it when I get back home later tonight or tomorrow when I have a chance. :)

#50 User is offline   RevRaz 

  • Group: Members
  • Posts: 4
  • Joined: 04-December 06

Posted 04 December 2006 - 06:52 PM

Thanks for the reply, I think I have it worked out.

For some reason, when I was moving the XML data into a variable to be used, some of the data that was passed was blank (not sure why). So when I tried to use that Variable, it would not display anything and I assumed it wasn't working.

When I decided to try using an ARRAY instead, then I noticed every other array field was blank, so data was only in 0, 2, 4 & 6. I'm still not sure why, but at least it's working.

View Postgamehead200, on Dec 4 2006, 02:50 PM, said:

View PostRevRaz, on Dec 4 2006, 04:48 PM, said:

This is a great topic and I thank you for sharing it.

I have it working as intended, but I want to make it more dynamice and change some of the Text in the Image when I read a XML file.

Any chance I can post my code (that isn't working) and have some see if they can spot my error?


Go right ahead. I'll try to look at it when I get back home later tonight or tomorrow when I have a chance. :)


#51 User is offline   gamehead200 

  • SEARCH!!! SEARCH!!!
  • Group: Super Moderator
  • Posts: 7,034
  • Joined: 02-September 02
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 05 December 2006 - 07:04 PM

View PostRevRaz, on Dec 4 2006, 08:52 PM, said:

Thanks for the reply, I think I have it worked out.

For some reason, when I was moving the XML data into a variable to be used, some of the data that was passed was blank (not sure why). So when I tried to use that Variable, it would not display anything and I assumed it wasn't working.

When I decided to try using an ARRAY instead, then I noticed every other array field was blank, so data was only in 0, 2, 4 & 6. I'm still not sure why, but at least it's working.

View Postgamehead200, on Dec 4 2006, 02:50 PM, said:

View PostRevRaz, on Dec 4 2006, 04:48 PM, said:

This is a great topic and I thank you for sharing it.

I have it working as intended, but I want to make it more dynamice and change some of the Text in the Image when I read a XML file.

Any chance I can post my code (that isn't working) and have some see if they can spot my error?


Go right ahead. I'll try to look at it when I get back home later tonight or tomorrow when I have a chance. :)


It's possible you set your code to use a delimiter without a space (making the space a value), when in fact, the delimiter contained a certain character AND a space.

Post your code and the XML data you were trying to grab. I have a feeling this is what the problem was.

#52 User is offline   RevRaz 

  • Group: Members
  • Posts: 4
  • Joined: 04-December 06

Posted 05 December 2006 - 10:58 PM

Here is the code I have working now, you can see where I'm only using every other Array. I actually had 4 different variables before I changed it to the one $pilot array, and I would move each value under name/flights/hours/miles into variables $pname/$flights/$hours/$miles.

This post has been edited by RevRaz: 06 December 2006 - 07:52 PM


#53 User is offline   gamehead200 

  • SEARCH!!! SEARCH!!!
  • Group: Super Moderator
  • Posts: 7,034
  • Joined: 02-September 02
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 05 December 2006 - 11:19 PM

Everything looks fine. I would just keep quotation marks consistent. You're also missing one for the fonts.

#54 User is offline   RevRaz 

  • Group: Members
  • Posts: 4
  • Joined: 04-December 06

Posted 05 December 2006 - 11:50 PM

Thanks, I'm still puzzled on how blanks are getting in there. Should I add a check to ignore the value if it's blank or a space?

Also about the quotes, I removed some paths after I pasted, so I probably just deleted it by accident here, but the code is correct on the server.

#55 User is offline   gamehead200 

  • SEARCH!!! SEARCH!!!
  • Group: Super Moderator
  • Posts: 7,034
  • Joined: 02-September 02
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 06 December 2006 - 08:37 PM

View PostRevRaz, on Dec 6 2006, 01:50 AM, said:

Thanks, I'm still puzzled on how blanks are getting in there. Should I add a check to ignore the value if it's blank or a space?

Also about the quotes, I removed some paths after I pasted, so I probably just deleted it by accident here, but the code is correct on the server.


Try adding the check and see what happens. That is really weird. :}

#56 User is offline   bullboykennels 

  • Group: Members
  • Posts: 1
  • Joined: 02-May 07

Posted 02 May 2007 - 08:35 PM

Hi i'm trying to get this part to show up but I guess I must be doing something wrong cause i get a bland box.
could someone let me know what I may be doing wrong,.. I do have the .htaccess part done already.


gd
GD Support enabled
GD Version bundled (2.0.28 compatible)
FreeType Support enabled
FreeType Linkage with freetype
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled


Quote

// 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";
}
}

/*
to output the OS, use $endos
to output the IP, use $ip
to output the resolved IP, use $resolved
*/

This post has been edited by bullboykennels: 02 May 2007 - 08:47 PM


#57 User is offline   Sir.Frogster 

  • Group: Members
  • Posts: 1
  • Joined: 06-May 07

Posted 06 May 2007 - 01:59 PM

Hi there, having problems with it, I used your samples from the main post, and I uploaded them onto my host, and all I can see when I look at the image is a blue box, is this what I'm meant to be seeing, or what?

Also, say I wanted to add the show the persons browser thing, where would I put the coding, which place, I know in the mysig.jpg file, but where in it? Does it have to go over the top of something?

And finally, as far as I can tell I have Apache and GD on my host, here: www.primehabbo.com/phpinfo.php .

Thanks.

#58 User is offline   Zxian 

  • Scroll up - see the Google bar?
  • Group: Super Moderator
  • Posts: 5,066
  • Joined: 30-September 04
  • OS:none specified
  • Country: Country Flag

Posted 14 May 2007 - 11:19 AM

@Sir.Frogster - You'll have to edit the given sample files to give the proper path to the font files. Otherwise, the script won't find the font and won't be able to insert it into the image.

#59 User is offline   gamehead200 

  • SEARCH!!! SEARCH!!!
  • Group: Super Moderator
  • Posts: 7,034
  • Joined: 02-September 02
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 14 May 2007 - 04:19 PM

View PostSir.Frogster, on May 6 2007, 03:59 PM, said:

Hi there, having problems with it, I used your samples from the main post, and I uploaded them onto my host, and all I can see when I look at the image is a blue box, is this what I'm meant to be seeing, or what?


Like Zxian mentioned, you have to edit the path to your font. It should usually be something like /home/username/public_html/sig/font.ttf. If that doesn't work, just try putting in the name of the font file (font.ttf).

View PostSir.Frogster, on May 6 2007, 03:59 PM, said:

Also, say I wanted to add the show the persons browser thing, where would I put the coding, which place, I know in the mysig.jpg file, but where in it? Does it have to go over the top of something?


It should go somewhere before you start parsing the text (before the ImageTTFText lines).

View PostSir.Frogster, on May 6 2007, 03:59 PM, said:

And finally, as far as I can tell I have Apache and GD on my host, here: www.primehabbo.com/phpinfo.php .


Yes, it's installed! :thumbup

View PostSir.Frogster, on May 6 2007, 03:59 PM, said:

Thanks.


No problem. :)

#60 User is offline   Mhhh 

  • Group: Members
  • Posts: 1
  • Joined: 27-May 07

Posted 27 May 2007 - 09:02 PM

Hey, Im kinda new to Php. Just a few questions.

After Ive found a host site how do I host my picture there. Like for the one sir.frogster was using. What do I do once im there lol.

And what do I upload, the htaccess thing or the mysig.jpg thing.

Im a noob i know lol, but itd be greatly appreciated if you could help me!

Share this topic:


  • 4 Pages +
  • 1
  • 2
  • 3
  • 4
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy