Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   General Discussions (http://forums.winamp.com/forumdisplay.php?f=1)
-   -   someone who knows php/has a php enabled webserver (http://forums.winamp.com/showthread.php?t=52262)

John M 11th June 2001 16:23

pleeeeze test this for me.

http://johnm666.homestead.com/files/song.php.txt

its my first stab at doin anything with php, it someone else's code for the most part

ecstatic 11th June 2001 16:35

hey John, YGM

rm' 11th June 2001 16:45

FYI, BYOB ASAP. GSM NG DUI MIA DOA FCC. ATC FIAA IUPAC FIFA. ILO CAT4 HTML WAP SAC.

griffinn 11th June 2001 16:50

In the array() function, all your strings must be properly quoted and separated by commas. By "properly quoted" I mean that phrases containing double quotes must be enclosed in single quotes, and vice versa. Read the PHP docs on strings for details.

You don't need the sprintf() call because there isn't anything to substitute into $chosen anyway. Scrap that whole "$sentence = sprintf..." statement, and in all subsequent lines change all occurrences of "$sentence" into "$chosen".

John M 11th June 2001 16:59

orig:
code:
$phrases = array(As I walk through the valley where I harvest my grain
//song is Weird Al - Amish Paradise
I take a look at my wife and realize she's very plain,
But that's just perfect for an Amish like me
You know, I shun fancy things like electricity,


corrected?
code:
$phrases = array("As I walk through the valley where I harvest my grain
//song is Weird Al - Amish Paradise
I take a look at my wife and realize she's very plain",
'But that's just perfect for an Amish like me
You know, I shun fancy things like electricity',


btw, it's mainly griffins code in this thing.

griffinn 11th June 2001 17:13

Have you read the docs yet? Please do.

But here's some quick observations:

The ImageString() function can't handle line breaks, so you should make sure there aren't any line breaks in each of your strings. For example, this string would contain a line break (and is bad):
code:
'This is the first line
This is the second line'

This doesn't (and is good):
code:
'This is just one line'


Strings that contain single quotes (i.e. apostrophes) should be enclosed in double quotes. For example, this will NOT work:
code:
'But that's just perfect'
This is OK:
code:
"But that's just perfect"


Lines that begin with // normally are comments and will be ignored, but within the context of an unclosed string (i.e. you've started the string with the first double quote but haven't closed it with the second double quote), they will be included as part of that string. This is probably not the effect you want.

ecstatic 11th June 2001 19:36

Quote:

Originally posted by Radioactive Man
FYI, BYOB ASAP. GSM NG DUI MIA DOA FCC. ATC FIAA IUPAC FIFA. ILO CAT4 HTML WAP SAC.
RM: STFU, FOAD. ;P

rm' 12th June 2001 00:24

KIA INRI RIP GNU DoD TGIF CB CO FFT PB&J. SETI CFC HO IHOP IMF. TWA SLA NGO GE. SOS OS AID BO BMW.

InvisableMan 12th June 2001 00:35

need a more complamacated example than griffinns'?
 
john heres my script:

code:

<?
// Imans's (Shane Lallo) Dynamic Signature Version 3.01
// (php3 version)copyright pending under Circular 61 : Computer Programs

srand ((double) microtime() * 1000000);
$font = 2;
$phrases = array('Dynamic sigs kick ass',
"Imans's dynamic .php3 sig version 3.01",
'will code for food',
'will NOT code for %s',
'Send ideas for this sig to visman@port17.f2s.com',
'You have no chance to code make your sig!!',
'Got sig?',
'pong ownz j00!',
'%s ownz j00',
'move sig',
'my flag contains the word jordash.',
'dont mind me, im just here for the cheese.',
'%s set up us the bomb',
'all your base are belong to %s.',
'i dont care. go bother %s.',
'go to http://www.port17.f2s.com or die.',
'Radioactive Man grooving with Winamp. you should be too.',
'think different, different, and different again.',
'code, rinse, repeat forever.',
"hi. your IP is %s. just thought you'd like to know.");

$chosen = $phrases[rand(0, count($phrases) - 1)];

$sentence = sprintf($chosen, $HTTP_SERVER_VARS['REMOTE_ADDR']);


$im = ImageCreate(ImageFontWidth($font) * strlen($sentence) + 4,
ImageFontHeight($font) + 2);
$wht = ImageColorAllocate($im,233,233,233);
$blk = ImageColorAllocate($im,rand(0,150),rand(0,150),rand(0,150));
ImageString($im, $font, 2, 0, $sentence, $blk);

header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");
header ("Content-Type: image/jpeg");
ImageJPEG($im, '', 100);
?>



if you dont want the ip thinger, omit {{double-bracketed}} text:

code:

$sentence = sprintf($chosen{{, $HTTP_SERVER_VARS['REMOTE_ADDR']}});



and take out all the '%s' arguements in the phrase array.

my sig is like psy's and griffinns' mashed together in a big ball of code. if you need any more explanation, lemmie know
hope that helps in some way :)

[edit]the best php enabled server is probably f2s http://www.f2s.com [/edit]

griffinn 12th June 2001 02:13

Quote:

Originally posted by InvisableMan
// Imans's (Shane Lallo) Dynamic Signature Version 3.01
// (php3 version)copyright pending under Circular 61 : Computer Programs
:rolleyes:
Quote:

the best php enabled server is probably f2s
The only drawback is it doesn't let you have the REMOTE_ADDR variable. :D

John M 12th June 2001 02:32

yeah, see that sucks. i would coded one that was like

ROTFLMAO! I hacked %s at %t!

where %s is the ip and %t is time. or,

Lol. i took out %s at %h in the %p.

%h is the hour, and %p is the period of day (morning, afternoon, evening).

too bad i have no fekkin idea how to code that.

griffinn 12th June 2001 03:12

I'll say that again and again...
 
Quote:

Originally posted by John M
too bad i have no fekkin idea how to code that.
All this mystery shalt be no more, only if thou wouldst read thy docs.

rm' 12th June 2001 03:14

Re: I'll say that again and again...
 
Quote:

Originally posted by griffinn
read thy docs
I don't think John has to read his own docs ;)

John M 12th June 2001 03:38

Re: I'll say that again and again...
 
Quote:

Originally posted by griffinn
Quote:

Originally posted by John M
too bad i have no fekkin idea how to code that.
All this mystery shalt be no more, only if thou wouldst read thy docs.

okay, okay. i'll learn PHP if youll be my mentor. oh, and if f2s LETS ME HAVE A FUCKING ACCOUNT!!!


All times are GMT. The time now is 10:28.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.