trajillo
01-16-2005, 02:41 AM
Ever wanted the current name of your song in your sig..well heres how to..
This requires a hosting account running PHP, e.g. any I-web account and Winamp (of course)
create a directory, e.g. music
chmod directory 777
create an empty text file called song.txt
chmod song.txt 777
upload to the folder you've created
create (and upload into the same folder) a file called update.php with the following content:
<?php
$password = putapasswordhere;
if (!$_GET[passwd]){ print "NO PASSWORD ";}
if (!$_GET[song]){ print "NO SONG ";}
if ($_GET[passwd] == $password) {
$fp=fopen("song.txt","w");
$song = stripslashes($_GET[song]);
fwrite($fp, $song);
fclose($fp);
} else {
print "password error ";
}
?>
change putapasswordhere to a password of your choice
create (and upload again) another php document called img.php with the following content:
<?php
$last_update = date ("U", filemtime('song.txt'));
if ($last_update < time()-3600) {
$txtsong = "Not Listening Right Now"; }
else {
$handle = fopen ("song.txt", "r");
while (!feof ($handle)) {
$txtsong = fgets($handle, 4096);
}
}
$font = 2;
$imgw = ImageFontWidth($font) * strlen($txtsong) + (10* ImageFontWidth($font) +30);
if (strlen($txtsong) > 45) {
$txtsong = substr($txtsong, 0, 43)."..";
$imgw = ImageFontWidth($font) * strlen($txtsong) + (10* ImageFontWidth($font) +30);
}
$imgb = ($imgw -1);
Header("Content-Type: image/png");
$im = ImageCreate($imgw, 15);
$bgc = ImageColorAllocate($im, 255, 255, 255);
$black = ImageColorAllocate($im, 0, 0, 0);
ImageFill($im, 0, 0, $bgc);
ImageString($im, $font, 3, 0, "Listening to : $txtsong", $black);
ImageLine($im, 0, 0, 0, 14, $black);
ImageLine($im, 0, 0, $imgb, 0, $black);
ImageLine($im, $imgb, 0, $imgb, 14, $black);
ImageLine($im, 0, 14, $imgb, 14, $black);
Imagepng($im);
?>
Download the "dosomething" plugin for winamp from:
http://www.oddsock.org/tools/dosome...ethingv2_12.exe
install it, open winamp, go to options/preferences, look under plug-ins/general purpose for DoSomething Plugin, double click it. Where the six check boxes are up the top, uncheck everything apart from "Enable ID3 info gathering", in the "Actions" pulldown menu, select "Submit a URL", in the URL field it brings up enter the following:http://www.yourdomain.com/music/update.php?song=%%URL_CURRENTSONG%%&passwd=putapasswordhere (in putapasswordhere, type the password you entered in php file above) then click "Add -->" near the bottom right. Close winamp, open it back up.
In your control panel here, go to signature and use some img (with the []'s round them) tags with the url to your img.php file, e.g. http://www.yourdomain.com/music/img.php
Enjoy!
This requires a hosting account running PHP, e.g. any I-web account and Winamp (of course)
create a directory, e.g. music
chmod directory 777
create an empty text file called song.txt
chmod song.txt 777
upload to the folder you've created
create (and upload into the same folder) a file called update.php with the following content:
<?php
$password = putapasswordhere;
if (!$_GET[passwd]){ print "NO PASSWORD ";}
if (!$_GET[song]){ print "NO SONG ";}
if ($_GET[passwd] == $password) {
$fp=fopen("song.txt","w");
$song = stripslashes($_GET[song]);
fwrite($fp, $song);
fclose($fp);
} else {
print "password error ";
}
?>
change putapasswordhere to a password of your choice
create (and upload again) another php document called img.php with the following content:
<?php
$last_update = date ("U", filemtime('song.txt'));
if ($last_update < time()-3600) {
$txtsong = "Not Listening Right Now"; }
else {
$handle = fopen ("song.txt", "r");
while (!feof ($handle)) {
$txtsong = fgets($handle, 4096);
}
}
$font = 2;
$imgw = ImageFontWidth($font) * strlen($txtsong) + (10* ImageFontWidth($font) +30);
if (strlen($txtsong) > 45) {
$txtsong = substr($txtsong, 0, 43)."..";
$imgw = ImageFontWidth($font) * strlen($txtsong) + (10* ImageFontWidth($font) +30);
}
$imgb = ($imgw -1);
Header("Content-Type: image/png");
$im = ImageCreate($imgw, 15);
$bgc = ImageColorAllocate($im, 255, 255, 255);
$black = ImageColorAllocate($im, 0, 0, 0);
ImageFill($im, 0, 0, $bgc);
ImageString($im, $font, 3, 0, "Listening to : $txtsong", $black);
ImageLine($im, 0, 0, 0, 14, $black);
ImageLine($im, 0, 0, $imgb, 0, $black);
ImageLine($im, $imgb, 0, $imgb, 14, $black);
ImageLine($im, 0, 14, $imgb, 14, $black);
Imagepng($im);
?>
Download the "dosomething" plugin for winamp from:
http://www.oddsock.org/tools/dosome...ethingv2_12.exe
install it, open winamp, go to options/preferences, look under plug-ins/general purpose for DoSomething Plugin, double click it. Where the six check boxes are up the top, uncheck everything apart from "Enable ID3 info gathering", in the "Actions" pulldown menu, select "Submit a URL", in the URL field it brings up enter the following:http://www.yourdomain.com/music/update.php?song=%%URL_CURRENTSONG%%&passwd=putapasswordhere (in putapasswordhere, type the password you entered in php file above) then click "Add -->" near the bottom right. Close winamp, open it back up.
In your control panel here, go to signature and use some img (with the []'s round them) tags with the url to your img.php file, e.g. http://www.yourdomain.com/music/img.php
Enjoy!