- Messages
- 3,819
- Reaction score
- 163
- Points
- 63
Hey guys, I'm trying to re-work a script written by someone (i forget their name, they are from x10)
It gets the current song name and song length and outputs it on an image. Ok, great, however, since the headers are already sent, you can't update the image (i think... lol).
I tried to re-work it with text, but I'm pretty sure I failed miserably.
Heres my code:
and time_remaining.php:
If you could help, that would be great. I am in a rush, so i could probably do this normally...but. yeah.
Its probably a very simple error, or just me being a noob at f-op.
Any help is appreciated, if you give a me a new code that will do the same thing, 300 credits (or more depending on..well...stuff)
Thanks a bunch,
Neil
It gets the current song name and song length and outputs it on an image. Ok, great, however, since the headers are already sent, you can't update the image (i think... lol).
I tried to re-work it with text, but I'm pretty sure I failed miserably.
Heres my code:
PHP:
<?PHP
require_once("song.txt");
require_once("length_remaining.php");
require_once("song_temp.txt");
$file = song.txt;
$next = song_temp.txt;
$fp = @fopen($file, 'r');
$song = fread($fp, 512);
fclose($fp);
list($song, $length) = explode("\n", $song);
$length = explode(':', $length);
$length = (intval($length[0]) * 60) + intval($length[1]);
$length -= length() - filemlength($file);
if ($length < 1) {
echo "Between songs or offline";
}
if (strlen($song) > 32) {
$p = strrpos(substr($song, 0, 32), ' ');
$song = array(trim(substr($song, 0, $p)), trim(substr($song, $p)));
if (strlen($song[1]) > 32) {
$song[1] = substr($song[1], 0, 32) . '...';
echo $song[1];
}
echo $song;
}
}
else {
$song = array($song, '');
}
//getnew... i hope
if ($length <= 0) {
$fp = @fopen($next, 'r');
$nextsong = fread($fp, 512);
fclose($fp);
list($nextsongsong, $length) = explode("\n", $song);
$length = explode(':', $length);
$length = (intval($length[0]) * 60) + intval($length[1]);
$length -= length() - filemlength($file);
if ($length < 1) {
echo "Between songs or offline";
}
if (strlen($nextsong) > 32) {
$p = strrpos(substr($nextsong, 0, 32), ' ');
$nextsong = array(trim(substr($nextsong, 0, $p)), trim(substr($nextsong, $p)));
if (strlen($nextsong[1]) > 32) {
$nextsong[1] = substr($nextsong[1], 0, 32) . '...';
echo $nextsong[1];
}
echo $nextsong;
}
}
else {
$nextsong = array($nextsong, '');
}
}
?>
and time_remaining.php:
PHP:
<?php
//time_remaining.php
if (!isset($length)) {
$file = 'song.txt';
$fp = @fopen($file, 'r');
$length = fread($fp, 512);
fclose($fp);
$length = explode("\n", $length);
$length = $length[1];
}
$length = explode(':', $length);
$length = (intval($length[0]) * 60) + intval($length[1]);
$length -= time() - filemtime($file);
if (isset($_GET['show'])) {
print $length;
}
?>
If you could help, that would be great. I am in a rush, so i could probably do this normally...but. yeah.
Its probably a very simple error, or just me being a noob at f-op.
Any help is appreciated, if you give a me a new code that will do the same thing, 300 credits (or more depending on..well...stuff)
Thanks a bunch,
Neil