Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Countdown time loops in 30secs

Status
Not open for further replies.

sam8599

Programmer
Feb 16, 2006
14
US
Hi,

I am using this customised script to display the countodwon of the songs.

Using Linux server, SQL4.1 and php+java

//tables in MYSQL
`date_played` datetime NOT NULL default '0000-00-00 00:00:00',
`duration` mediumint(9) NOT NULL default '0',

//examples of data
dateplayed: 2005-09-04 17:34:13
duration: 213259 = 3.554 sec (3.55*60*1000)


//variables
$curtime = time();
$starttime = strtotime($song["date_played"]);
$secsRemain = (round($song["duration"] / 1000)-($curtime-$starttime));


//script
<script language="JavaScript">
var countDownTime = <? echo $secsRemain; ?> + 1;
var countDownR = <? if ($userdata['user_id'] == 1) echo 10; else echo rand (30, 120); ?> + 1;

if (document.all||document.getElementById)
countDown();
else
window.onload = countDown;

function countDown() {
if (document.all)
document.all.countDownText.innerText = "Time left";
else if (document.getElementById)
document.getElementById("countDownText").innerHTML = "Time left";
countDownTime--;
if (countDownTime == 0) {
countDownRe();
return;
}
else if (countDownTime < 0)
countDownTime = 30;
if (document.all)
document.all.countDownTime.innerText = secsToMins(countDownTime);
else if (document.getElementById)
document.getElementById("countDownTime").innerHTML = secsToMins(countDownTime);
counter = setTimeout("countDown()", 1000);
}

function countDownRe() {
if (document.all)
document.all.countDownText.innerText = "Reload in";
else if (document.getElementById)
document.getElementById("countDownText").innerHTML = "Reload in";
countDownR--;
if (countDownR == 0) {
window.location.reload();
return;
}
else if (countDownR < 0)
countDownR = 30;
if (document.all)
document.all.countDownTime.innerText = secsToMins(countDownR);
else if (document.getElementById)
document.getElementById("countDownTime").innerHTML = secsToMins(countDownR);
counter = setTimeout("countDownRe()", 1000);
}

function secsToMins(theValue) {
var theMin = Math.floor(theValue / 60);
var theSec = (theValue % 60);
if (theSec < 10)
theSec = "0" + theSec;
return(theMin + ":" + theSec);
}

</script>

The problem I am having is that instead the countdown should start say for example above from 3:55 secs, it always starts from 30 secs.... and duration still it strts from 30sec.

Any help or suggestion would be appreciated
 
Sam,

Can you show us the client-side code, not the server-side code. Also can you post it inside TGML [ignore]
Code:
[/ignore] tags (see the "Process TGML" link above the posting box).

While it might be possible to help from what you've given (server-side), being absolutely sure that we're getting the same code as the browser sees (client-side) is always a good start.

Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Dan,

Enclosed is the complete script for your ref; appreciate your time for help. I hope this is what you meant bythe client-side code.

Code:
<?
 include("includes/config.php");

 $SAMdb->open("SELECT songlist.*, historylist.listeners as listeners, historylist.requestID as requestID, historylist.date_played as starttime FROM historylist, songlist WHERE (historylist.songID = songlist.ID) AND (songlist.songtype='S' OR songlist.songtype='H' OR songlist.songtype='C') ORDER BY historylist.date_played DESC LIMIT 11");
 $history = $SAMdb->rows();
 reset($history);

 $SAMdb->open("SELECT songlist.*, queuelist.requestID as requestID FROM queuelist, songlist WHERE (queuelist.songID = songlist.ID) AND (songlist.songtype='S' OR songlist.songtype='H' OR songlist.songtype='C') ORDER BY queuelist.sortID ASC");
 $queue = $SAMdb->rows();
 reset($queue);

 list($key, $song) = each($history);
 $listeners = $song["listeners"];

 $starttime = strtotime($song["date_played"]);

 $secsRemain = (round($song["duration"] / 1000)-($curtime-$starttime));

function PutSongRowCurrent($song)
{
 global $songNew, $SAMdb, $userdata, $user, $cookie, $db, $admin, $pagetitle;
 PrepareSong($song);

?>
<table border="0">
  <tr>
    <td align="right" nowrap>
      <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
        Artist
        <img src="images/spacer.gif" width="15" height="13">
      </font>
    </td>
    <td>
      <font face="Verdana, Arial, Helvetica" size="1">
        <a href="modules.php?name=Playlist&letter=<? echo $song["artist"]{0}; ?>&artist=<? echo $song["artist"]; ?>" title="Get an album listing of <? echo htmlspecialchars($song["artist"]); ?>"><? echo $song["artist"]; ?></a>
      </font>
    </td>
  </tr>
  <tr>
    <td align="right" nowrap>
      <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
        Title
        <img src="images/spacer.gif" width="15" height="13">
      </font>
    </td>
    <td>
      <font face="Verdana, Arial, Helvetica" size="1">
        <a href="modules.php?name=Playlist&file=songinfo&songID=<? echo $song["songID"]; ?>" title="Get information on <? echo htmlspecialchars($song["title"]); ?> by <? echo htmlspecialchars($song["artist"]); ?>"><? echo $song["title"]; ?></a>
        <?
          if ($song["date_added"] > date("Y-m-d H:i:s",time()-$songNew*24*60*60))
            echo "<img src='images/new.gif' title=\"" . htmlspecialchars($song["title"]) . " by " . htmlspecialchars($song["artist"]) . " added ". date('M d, Y', strtotime($song["date_added"])) . "\" border='0'>";
          if ($song["requestID"] != 0)
            echo " <font color='#FF4500'>~requested~</font> ";
        ?>
      </font>
    </td>
  </tr>
  <tr>
    <td align="right" nowrap>
      <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
        Album
        <img src="images/spacer.gif" width="15" height="13">
      </font>
    </td>
    <td>
      <font face="Verdana, Arial, Helvetica" size="1">
        <a href="modules.php?name=Playlist&letter=<? echo $song["artist"]{0}; ?>&artist=<? echo $song["artist"]; ?>&album=<? echo $song["album"]; ?>" title="Get a track listing of <? echo htmlspecialchars($song["album"]); ?>"><? echo $song["album"]; ?></a>
      </font>
    </td>
  </tr>
  <tr>
    <td align="right" nowrap>
      <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
        Track #
        <img src="images/spacer.gif" width="15" height="13">
      </font>
    </td>
    <td colspan="2">
      <font face="Verdana, Arial, Helvetica" size="1">
        <? echo $song["trackno"]; ?>
      </font>
    </td>
  </tr>
  <tr>
    <td align="right" nowrap>
      <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
        Year
        <img src="images/spacer.gif" width="15" height="13">
      </font>
    </td>
    <td colspan="2">
      <font face="Verdana, Arial, Helvetica" size="1">
        <? echo $song["albumyear"]; ?>
      </font>
    </td>
  </tr>
  <tr>
    <td align="right" nowrap>
      <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
        Genre
        <img src="images/spacer.gif" width="15" height="13">
      </font>
    </td>
    <td colspan="2">
      <font face="Verdana, Arial, Helvetica" size="1">
        <? echo htmlspecialchars($song["genre"]); ?>
      </font>
    </td>
  </tr>
  <tr>
    <td align="right" nowrap>
      <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
        Composer
        <img src="images/spacer.gif" width="15" height="13">
      </font>
    </td>
    <td colspan="2">
      <font face="Verdana, Arial, Helvetica" size="1">
        <? echo htmlspecialchars($song["composer"]); ?>
      </font>
    </td>
  </tr>
  <tr>
    <td align="right" nowrap>
      <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
        Duration
        <img src="images/spacer.gif" width="15" height="13">
      </font>
    </td>
    <td colspan="2">
      <font face="Verdana, Arial, Helvetica" size="1">
        <? echo $song["mmss"]; ?>&nbsp;&nbsp;&nbsp;(<a id="countDownText"></a>:&nbsp;<a id="countDownTime"></a>)
      </font>
    </td>
  </tr>
  <tr>
    <td align="right" nowrap>
      <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
        Tabs
        <img src="images/spacer.gif" width="15" height="13">
      </font>
    </td>
    <td colspan="2">
      <font face="Verdana, Arial, Helvetica" size="1">
                  Bass:&nbsp;(<a href="[URL unfurl="true"]http://www.basstabarchive.com/cgi-bin/search.cgi?search=<?[/URL] echo htmlspecialchars($song["title"]); ?>&hits=100" title="Query Bass Tab Archives for <? echo htmlspecialchars($song["title"]); ?> by <? echo htmlspecialchars($song["artist"]); ?>" target="_blank">alt</a>)&nbsp;&nbsp;&nbsp;Guitar:&nbsp;(<a href="[URL unfurl="true"]http://www.olga.net/dynamic/search.php?search=<?[/URL] echo htmlspecialchars($song["title"]); ?>" title="Query the OnLine Guitar Archive (OLGA) for <? echo htmlspecialchars($song["title"]); ?> by <? echo htmlspecialchars($song["artist"]); ?>" target="_blank">alt</a>)&nbsp;&nbsp;&nbsp;Drum:&nbsp;(<a href="[URL unfurl="true"]http://www.tabarchive.co.uk/drumtabs.php?area=search&type=song&input=<?[/URL] echo htmlspecialchars($song["title"]); ?>&hits=100" title="Query the Drum Tab Archive for <? echo htmlspecialchars($song["title"]); ?> by <? echo htmlspecialchars($song["artist"]); ?>" target="_blank">alt</a>)
      </font>
    </td>
  </tr>
  <tr>
    <td align="right" nowrap>
      <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
        # Plays
        <img src="images/spacer.gif" width="15" height="13">
      </font>
    </td>
    <td colspan="2">
      <font face="Verdana, Arial, Helvetica" size="1">
        <? echo $song["count_played"]; ?>
      </font>
    </td>
  </tr>
  <tr>
    <td align="right" nowrap>
      <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
        # Requests
        <img src="images/spacer.gif" width="15" height="13">
      </font>
    </td>
    <td colspan="2">
      <font face="Verdana, Arial, Helvetica" size="1">
        <?
          $SAMdb->open("SELECT count(*) as cnt FROM requestlist where requestlist.songID = " . $song["songID"] . " and requestlist.status = 'played'");
          $numberRequests = $SAMdb->row();
          echo $numberRequests["cnt"];
        ?>
      </font>
    </td>
  </tr>

<?//////////////////////////////////////////////////////////////////////////////////////////////////////////?>

  <?
    if ($userdata['user_id'] == 1) {
      echo ("<tr>");
      echo ("  <td align='right' nowrap>");
      echo ("    <font face='Verdana, Arial, Helvetica' size='1' color='#006699'>");
      echo ("      # Listens");
      echo ("      <img src='images/spacer.gif' width='15' height='13'>");
      echo ("    </font>");
      echo ("  </td>");
      echo ("  <td>");
      echo ("    <font face='Verdana, Arial, Helvetica' size='1'>");
      echo $song["count_performances"] . "&nbsp;&nbsp;&nbsp;(avg ";
      if ($song["count_played"] > 0)
        echo round($song["count_performances"] / $song["count_played"], 2);
      else
        echo "0";
      echo ")";
      echo "&nbsp;&nbsp;&nbsp;(now ". $song["listeners"] . ")";
      echo ("    </font>");
      echo ("  </td>");
      echo ("  <td></td>");
      echo ("  <td></td>");
      echo ("</tr>");
    }
  ?>
            <tr>
              <td align="right" nowrap>
                <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
                  Rating (all)
                  <img src="images/spacer.gif" width="15" height="13">
                </font>
              </td>
              <td colspan="2">
                <font face="Verdana, Arial, Helvetica" size="1">
                  <?
                    if ($song["songtype"] == 'S') {
                      if ($song["rating"] == 0)
                      $rating_image = "images/stars-0-0.gif";
                      else {
                        if ($song["rating"] < 1)
                          echo " (Error)";
                        else if (($song["rating"] >= 1) && ($song["rating"] < 1.5))
                          $rating_image = "images/stars-1-0.gif";
                        else if (($song["rating"] >= 1.5) && ($song["rating"] < 2))
                          $rating_image = "images/stars-1-5.gif";
                        else if (($song["rating"] >= 2) && ($song["rating"] < 2.5))
                          $rating_image = "images/stars-2-0.gif";
                        else if (($song["rating"] >= 2.5) && ($song["rating"] < 3))
                          $rating_image = "images/stars-2-5.gif";
                        else if (($song["rating"] >= 3) && ($song["rating"] < 3.5))
                          $rating_image = "images/stars-3-0.gif";
                        else if (($song["rating"] >= 3.5) && ($song["rating"] < 4))
                          $rating_image = "images/stars-3-5.gif";
                        else if (($song["rating"] >= 4) && ($song["rating"] < 4.5))
                          $rating_image = "images/stars-4-0.gif";
                        else if (($song["rating"] >= 4.5) && ($song["rating"] < 5))
                          $rating_image = "images/stars-4-5.gif";
                        else if ($song["rating"] == 5)
                          $rating_image = "images/stars-5-0.gif";
                        else
                          echo " (Error)";
                      }

                    if ($song["songtype"] == 'S') {
                      if ($song["rating"] == 0)
                      $song["rating_saying"] = "n/a (no votes)";
                      else {
                        if ($song["rating"] < 1)
                          echo " (Error)";
                        else if (($song["rating"] >= 1) && ($song["rating"] < 1.5))
                          $song["rating_saying"] = " (Bad)";
                        else if (($song["rating"] >= 2) && ($song["rating"] < 2.5))
                          $song["rating_saying"] = " (Poor)";
                        else if (($song["rating"] >= 3) && ($song["rating"] < 3.5))
                          $song["rating_saying"] = " (Ok)";
                        else if (($song["rating"] >= 4) && ($song["rating"] < 4.5))
                          $song["rating_saying"] = " (Good)";
                        else if ($song["rating"] == 5)
                          $song["rating_saying"] = " (Excellent)";
                        else
                          echo " (Error)";
                  }}
               ?>
                    <img src="<? echo "$rating_image"; ?>" title="<? echo $song["rating"]; ?> <? echo $song["rating_saying"];   ?>" width="64" height="12"/>
                  <?
                      echo " out of " . $song["votes"];
                      if ($song["votes"] == 1)
                        echo " vote";
                      else
                        echo " votes";
                    }
                    else
                      echo "This cannot be rated";
                  ?>
                </font>
              </td>
            </tr>
            <tr>
              <?
                if (($song["songtype"] == 'S') && ($userdata['user_id'])) {
                  echo "<form name=\"theForm\" method=\"POST\" action=\"modules.php?name=Playlist&file=do_rating\">";
                  echo "<input type=\"hidden\" name=\"songID\" value=\"". $song["songID"] . "\">";

                }
              ?>
              <td align="right" nowrap>
                <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
                  Rating (you)
                  <img src="images/spacer.gif" width="15" height="13">
                </font>
              </td>
              <td colspan="2">
                <font face="Verdana, Arial, Helvetica" size="1">
                  <?
                    if ($userdata["user_id"] >= 1) {
                      if ($song["songtype"] == 'S') {
                        $SAMdb->open("SELECT song_rating.rating FROM song_rating where song_rating.songID = " . $song["songID"] . " AND song_rating.userID = " . $userdata['user_id']);
                        $the_rating = $SAMdb->row();

                        if ($the_rating["rating"] == null)
                          $my_rating = 0;
                        else
                          $my_rating = $the_rating["rating"];

                        InputComboRating("rating",$my_rating,0,'0, 1, 2, 3, 4, 5');
                      }
                      else
                        echo "This cannot be rated";
                    }
                    else
                      echo "Please <strong>login</strong> or <strong>register</strong> to use this feature.";
                  ?>
                </font>
              </td>
              <?
                if (($song["songtype"] == 'S') && ($userdata['user_id'] >= 0)) {
                  echo "</form>";
                }
              ?>
            </tr>

<?//////////////////////////////////////////////////////////////////////////////////////////////////////////?>


</table>

<? } ?>

<?
function PutSongRowRecent($song)
{
 global $rc, $songNew, $picture_dir;
 PrepareSong($song);

 $rc++;

?>
  <tr bgcolor="<? echo $bgcolor; ?>">
    <td>
      <font face="Verdana, Arial, Helvetica" size="1">
        <a href="modules.php?name=Playlist&letter=<? echo $song["artist"]{0}; ?>&artist=<? echo $song["artist"]; ?>" title="Get an album listing of <? echo htmlspecialchars($song["artist"]); ?>"><? echo $song["artist"]; ?></a>
      </font>
    </td>
    <td>
      <img src="images/spacer.gif" width="15" height="13">
    </td>
    <td>
      <a href="<? echo $song["buycd"]; ?>" target="_blank"><img width="30" height="30" src="<? echo $picture_dir . rawurlencode($song["picture"]); ?>" title="Buy <? echo htmlspecialchars($song["album"]); ?> by <? echo htmlspecialchars($song["artist"]); ?> from Amazon.com.  A percentage of your purchase goes to FesterHead Radio!" border=0></a>
    </td>
    <td>
      <img src="images/spacer.gif" width="15" height="13">
    </td>
    <td>
      <font face="Verdana, Arial, Helvetica" size="1">
        <a href="modules.php?name=playlist&letter=<? echo $song["artist"]{0}; ?>&artist=<? echo $song["artist"]; ?>&album=<? echo $song["album"]; ?>" title="Get a track listing of <? echo htmlspecialchars($song["album"]); ?>"><? echo $song["album"]; ?></a>
      </font>
    </td>
    <td>
      <img src="images/spacer.gif" width="15" height="13">
    </td>
    <td>
      <font face="Verdana, Arial, Helvetica" size="1">
        <a href="modules.php?name=Playlist&file=songinfo&songID=<? echo $song["songID"]; ?>" title="Get information on <? echo htmlspecialchars($song["title"]); ?> by <? echo htmlspecialchars($song["artist"]); ?>"><? echo $song["title"]; ?></a>
        <?
          if ($song["date_added"] > date("Y-m-d H:i:s",time()-$songNew*24*60*60))
            echo "<img src='images/new.gif' title=\"" .
              htmlspecialchars($song["title"]) . " by " . htmlspecialchars($song["artist"]) . " added ". date('M d, Y', strtotime($song["date_added"])) . "\" border='0'>";
          if ($song["requestID"] != 0)
            echo " <font color='#FF4500'>~requested~</font> ";
        ?>          
      </font>
    </td>
    <td>
      <img src="images/spacer.gif" width="15" height="13">
    </td>
    <td>
      <font face="Verdana, Arial, Helvetica" size="1">
        <? echo $song["mmss"]; ?>
      </font>
    </td>
  </tr>
<?
}//PutSongRow

/* ## ===================================================================== ## */
?>


<br>
<br>

<? Preparesong($song); ?>

<? OpenTable(); ?>

  <tr>
    <td valign="middle" bgcolor="#006699">
      <font face="Verdana, Arial, Helvetica" color="#F5DEB3" size="2">
        <b>
          <?
            // Exercise the select statement to get what is currently playing
            $SAMdb->open("SELECT * from currentshow");

            // Populate the song variable with the result
            $theshow = $SAMdb->row();
            reset($theshow);

            // Show text1
            echo $theshow["text1"];
          ?>
        </b>
      </font>
    </td>
    <td align="left" valign="middle" bgcolor="#006699">
      <font face="Verdana, Arial, Helvetica" color="#F5DEB3" size="1">
        <?
          // Show text1
          echo $theshow["text2"];
        ?>
      </font>
    </td>
  </tr>
  <tr>
    <td colspan="2">
      <table border="0" width="100%">
        <tr>
          <td align="center" valign="middle">
            <a href="<? echo $song["buycd"]; ?>" target="_blank"><img src="<? echo $picture_dir . rawurlencode($song["picture"]); ?>" title="Buy <? echo htmlspecialchars($song["album"]); ?> by <? echo htmlspecialchars($song["artist"]); ?> from Amazon.com.  A percentage of your purchase goes to FesterHead Radio!" border=0></a>
            <br>
            <a href="<? echo $song["buycd"]; ?>" target="_blank"><img src="images/amazon.gif" title="Buy <? echo htmlspecialchars($song["album"]); ?> by <? echo htmlspecialchars($song["artist"]); ?> from Amazon.com.  A percentage of your purchase goes to FesterHead Radio!" border=0></a>
          </td>
          <td valign="top">
            <? PutSongRowCurrent($song); ?>
          </td>
        </tr>
      </table>
    </td>
  </tr>

<? CloseTable(); ?>

<script language="JavaScript">
  var countDownTime = <? echo $secsRemain; ?> + 1;
  var countDownR = <? if ($userdata['user_id'] == 1) echo 10; else echo rand (30, 120); ?> + 1;

  if (document.all||document.getElementById)
    countDown();
  else
    window.onload = countDown;

  function countDown() {
    if (document.all)
      document.all.countDownText.innerText = "Time left";
    else if (document.getElementById)
      document.getElementById("countDownText").innerHTML = "Time left";
    countDownTime--;
    if (countDownTime == 0) {
      countDownRe();
      return;
    }
    else if (countDownTime < 0)
      countDownTime = 30;
    if (document.all)
      document.all.countDownTime.innerText = secsToMins(countDownTime);
    else if (document.getElementById)
      document.getElementById("countDownTime").innerHTML = secsToMins(countDownTime);
    counter = setTimeout("countDown()", 1000);
  }

  function countDownRe() {
    if (document.all)
      document.all.countDownText.innerText = "Reload in";
    else if (document.getElementById)
      document.getElementById("countDownText").innerHTML = "Reload in";
    countDownR--;
    if (countDownR == 0) {
      window.location.reload();
      return;
    }
    else if (countDownR < 0)
      countDownR = 30;
    if (document.all)
      document.all.countDownTime.innerText = secsToMins(countDownR);
    else if (document.getElementById)
      document.getElementById("countDownTime").innerHTML = secsToMins(countDownR);
    counter = setTimeout("countDownRe()", 1000);
  }

  function secsToMins(theValue) {
    var theMin = Math.floor(theValue / 60);
    var theSec = (theValue % 60);
    if (theSec < 10)
      theSec = "0" + theSec;
    return(theMin + ":" + theSec);
  }

  function openReview(thePage, w, h) {
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,resizable';
    win = window.open(thePage, 'l', winprops);
    if (parseInt(navigator.appVersion) >= 4)
      win.window.focus();
  }
  function openLyrics(thePage, w, h) {
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,resizable';
    win = window.open(thePage, 'k', winprops);
    if (parseInt(navigator.appVersion) >= 4)
      win.window.focus();
  }
</script>

<?
if(count($queue) > 0) {
  echo "<table><tr><td nowrap>";
  echo "<font face='Verdana, Arial, Helvetica' size='1'>";
  echo "Coming up:&nbsp;";
  echo "</font></td><td>";
  echo "<font face='Verdana, Arial, Helvetica' size='1'>";
  if ($userdata['user_id'] < 1)
    echo("Please <strong>login</strong> or <strong>register</strong> to use this feature.");
  else {
    $i = 0;
    $j = 1;
    $tempArtist = '';
    $requestTag = false;
    while((list($key, $song) = each($queue)) && ($i < 4)) {
      if ($tempArtist != $song["artist"]) {
        if ($j > 1)
          echo " (" . $j . ")";
        if ($i > 0)
          echo ", ";
        $j = 1;
        $i++;
        ?><a href="modules.php?name=Playlist&letter=<? echo $song["artist"]{0}; ?>&artist=<? echo $song["artist"]; ?>" title="Get an album listing of <? echo htmlspecialchars($song["artist"]); ?>"><? echo $song["artist"]; ?></a><?
        $tempArtist = $song["artist"];
        $requestTag = false;
      }
      else
        $j++;
          if ($song["requestID"] != 0)
            echo " <font color='#FF4500'>~requested~</font> ";
    }
  }
  echo "</font>";
  echo "</td></tr></table>";
}
?>

<br>

<? OpenTable(); ?>
  <tr bgcolor="#006699">
    <td colspan="9" nowrap>
      <p align="center">
        <font face="Verdana, Arial, Helvetica" size="2" color="#F5DEB3">
          <b>Recently played songs</b>
        </font>
    </td>
  </tr>

<?
  if ($userdata['user_id'] < 1) {
    echo("<tr><td colspan='7'>");
    echo("Please <strong>login</strong> or <strong>register</strong> to use this feature.");
    echo("</td></tr>");
  }
  else {
    $rc=0;
    while(list($key, $song) = each($history))
      PutSongRowRecent($song);
  }
?>

<? CloseTable(); ?>
 
Client Side Code: Run your page in a browser, then select View > Source from the menu. Hit Ctrl+A, Ctrl+C, and then paste it in a new thread.



*cLFlaVA
----------------------------
[tt]I already made like infinity of those at scout camp...[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
[banghead]
 
I hope this time I did correct

Code:
<script>

      function newWindow(thePage) {
        var w = 550;
        var h = 300;
        var winl = (screen.width - w) / 2;
        var wint = (screen.height - h) / 2;
        winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,resizable'
        win = window.open(thePage, 'newWindow', winprops)
        if (parseInt(navigator.appVersion) >= 4)
          win.window.focus();
      }
      function playingLite() {
        var w = 600;
        var h = 350;
        var winl = (screen.width - w) / 2;
        var wint = (screen.height - h) / 2;
        winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,resizable'
        win = window.open('modules.php?name=Now_Playing&file=playing-lite', 'playingLite', winprops)
        if (parseInt(navigator.appVersion) >= 4)
          win.window.focus();
      }
      function requestTimer() {
        var w = 250;
        var h = 50;
        var winl = (screen.width - w) / 2;
        var wint = (screen.height - h) / 2;
        winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl
        win = window.open('request-timer.php', 'requestTimer', winprops)
        if (parseInt(navigator.appVersion) >= 4)
          win.window.focus();
      }

      function showAlbumArt(image){
        theAlbumArt = setTimeout("writeLayer('" + image + "'," +
                                                  event.clientX + "," +
                                                  event.clientY + ")",500);
        theAlbumArt;
      }
      function writeLayer(image, x, y){
        document.getElementById("albumart").style.visibility = "visible";
        document.getElementById("albumart").style.top = document.body.scrollTop + y + 14 + "px";
        document.getElementById("albumart").style.left = x + "px";
        document.getElementById("albumart").innerHTML ='<img width=50 align=top border=0 src="' + image + '">';
      }
      function hideAlbumArt(){
        document.getElementById("albumart").style.visibility = "hidden";
        window.clearTimeout(theAlbumArt);
      }
</script>





<br>


<table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#cccccc"><tr><td>
<table width="100%" border="0" cellspacing="1" cellpadding="8" bgcolor="#ffffff"><tr><td>

  <tr>
    <td valign="middle" bgcolor="#006699">
      <font face="Verdana, Arial, Helvetica" color="#F5DEB3" size="2">

        <b>
          Now Playing: Regular Schedule        </b>
      </font>
    </td>
    <td align="left" valign="middle" bgcolor="#006699">
      <font face="Verdana, Arial, Helvetica" color="#F5DEB3" size="1">
        Normal Rotation and Listener Requests      </font>
    </td>

  </tr>
  <tr>
    <td colspan="2">
      <table border="0" width="100%">
        <tr>
          <td align="center" valign="middle">
            <a href="[URL unfurl="true"]http://www.bombayave.com/products_list.php?categories_id=36&keywords=Chanda%20Ki%20Doli"[/URL] target="_blank"><img src="../pictures/Sonu%20Nigam_Chanda%20Ki%20Doli.gif" border="0" width="125" title="Buy Chanda Ki Doli by Sonu Nigam CD. " border=0></a>
            <br>
            <a href="[URL unfurl="true"]http://www.bombayave.com/products_list.php?categories_id=36&keywords=Chanda%20Ki%20Doli"[/URL] target="_blank"><img src="images/amazon.gif" title="Buy Chanda Ki Doli by Sonu Nigam from Amazon.com. " border=0></a>

          </td>
          <td valign="top">
            <table border="0">
  <tr>
    <td align="right" nowrap>
      <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
        Artist
        <img src="images/spacer.gif" width="15" height="13">
      </font>

    </td>
    <td>
      <font face="Verdana, Arial, Helvetica" size="1">
        <a href="modules.php?name=Playlist&letter=S&artist=Sonu Nigam" title="Get an album listing of Sonu Nigam">Sonu Nigam</a>
      </font>
    </td>
  </tr>
  <tr>

    <td align="right" nowrap>
      <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
        Title
        <img src="images/spacer.gif" width="15" height="13">
      </font>
    </td>
    <td>
      <font face="Verdana, Arial, Helvetica" size="1">
        <a href="modules.php?name=Playlist&file=songinfo&songID=11602" title="Get information on Tu by Sonu Nigam">Tu</a>

              </font>
    </td>
  </tr>
  <tr>
    <td align="right" nowrap>
      <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
        Album
        <img src="images/spacer.gif" width="15" height="13">
      </font>

    </td>
    <td>
      <font face="Verdana, Arial, Helvetica" size="1">
        <a href="modules.php?name=Playlist&letter=S&artist=Sonu Nigam&album=Chanda Ki Doli" title="Get a track listing of Chanda Ki Doli">Chanda Ki Doli</a>
      </font>
    </td>
  </tr>
  <tr>

    <td align="right" nowrap>
      <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
        Track #
        <img src="images/spacer.gif" width="15" height="13">
      </font>
    </td>
    <td colspan="2">
      <font face="Verdana, Arial, Helvetica" size="1">
        n/a      </font>

    </td>
  </tr>
  <tr>
    <td align="right" nowrap>
      <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
        Year
        <img src="images/spacer.gif" width="15" height="13">
      </font>
    </td>

    <td colspan="2">
      <font face="Verdana, Arial, Helvetica" size="1">
        2005      </font>
    </td>
  </tr>
  <tr>
    <td align="right" nowrap>
      <font face="Verdana, Arial, Helvetica" size="1" color="#006699">

        Genre
        <img src="images/spacer.gif" width="15" height="13">
      </font>
    </td>
    <td colspan="2">
      <font face="Verdana, Arial, Helvetica" size="1">
        Pop      </font>
    </td>
  </tr>

  <tr>
    <td align="right" nowrap>
      <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
        Composer
        <img src="images/spacer.gif" width="15" height="13">
      </font>
    </td>
    <td colspan="2">
      <font face="Verdana, Arial, Helvetica" size="1">

        n/a      </font>
    </td>
  </tr>
  <tr>
    <td align="right" nowrap>
      <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
        Duration
        <img src="images/spacer.gif" width="15" height="13">
      </font>

    </td>
    <td colspan="2">
      <font face="Verdana, Arial, Helvetica" size="1">
        5:51&nbsp;&nbsp;&nbsp;(<a id="countDownText"></a>:&nbsp;<a id="countDownTime"></a>)
      </font>
    </td>
  </tr>

  <tr>
    <td align="right" nowrap>
      <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
        # Plays
        <img src="images/spacer.gif" width="15" height="13">
      </font>
    </td>
    <td colspan="2">
      <font face="Verdana, Arial, Helvetica" size="1">

        6      </font>
    </td>
  </tr>
  <tr>
    <td align="right" nowrap>
      <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
        # Requests
        <img src="images/spacer.gif" width="15" height="13">
      </font>

    </td>
    <td colspan="2">
      <font face="Verdana, Arial, Helvetica" size="1">
        0      </font>
    </td>
  </tr>


              <tr>

              <td align="right" nowrap>
                <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
                  Rating (all)
                  <img src="images/spacer.gif" width="15" height="13">
                </font>
              </td>
              <td colspan="2">
                <font face="Verdana, Arial, Helvetica" size="1">
                                      <img src="images/stars-3-0.gif" title="3  (Ok)" width="64" height="12"/>

                   out of 1 vote                </font>
              </td>
            </tr>
            <tr>
              <form name="theForm" method="POST" action="modules.php?name=Playlist&file=do_rating"><input type="hidden" name="songID" value="11602">              <td align="right" nowrap>
                <font face="Verdana, Arial, Helvetica" size="1" color="#006699">
                  Rating (you)
                  <img src="images/spacer.gif" width="15" height="13">

                </font>
              </td>
              <td colspan="2">
                <font face="Verdana, Arial, Helvetica" size="1">
                  <select name="rating" size="1" onChange="theForm.submit();">
   <option value="0" >
   none   </option>
    <option value=" 1" >

   1 (Bad)   </option>
    <option value=" 2" >
   2 (Poor)   </option>
    <option value=" 3" selected>
   3 (Ok)   </option>
    <option value=" 4" >
   4 (Good)   </option>

    <option value=" 5" >
   5 (Excellent)   </option>
 </select>
                </font>
              </td>
              </form>            </tr>



</table>

          </td>
        </tr>
      </table>
    </td>
  </tr>

</td></tr></table></td></tr></table>

<script language="JavaScript">
  var countDownTime = -13 + 1;
  var countDownR = 107 + 1;

  if (document.all||document.getElementById)
    countDown();
  else
    window.onload = countDown;

  function countDown() {
    if (document.all)
      document.all.countDownText.innerText = "Time left";
    else if (document.getElementById)
      document.getElementById("countDownText").innerHTML = "Time left";
    countDownTime--;
    if (countDownTime == 0) {
      countDownRe();
      return;
    }
    else if (countDownTime < 0)
      countDownTime = 30;
    if (document.all)
      document.all.countDownTime.innerText = secsToMins(countDownTime);
    else if (document.getElementById)
      document.getElementById("countDownTime").innerHTML = secsToMins(countDownTime);
    counter = setTimeout("countDown()", 1000);
  }

  function countDownRe() {
    if (document.all)
      document.all.countDownText.innerText = "Reload in";
    else if (document.getElementById)
      document.getElementById("countDownText").innerHTML = "Reload in";
    countDownR--;
    if (countDownR == 0) {
      window.location.reload();
      return;
    }
    else if (countDownR < 0)
      countDownR = 30;
    if (document.all)
      document.all.countDownTime.innerText = secsToMins(countDownR);
    else if (document.getElementById)
      document.getElementById("countDownTime").innerHTML = secsToMins(countDownR);
    counter = setTimeout("countDownRe()", 1000);
  }

  function secsToMins(theValue) {
    var theMin = Math.floor(theValue / 60);
    var theSec = (theValue % 60);
    if (theSec < 10)
      theSec = "0" + theSec;
    return(theMin + ":" + theSec);
  }

  function openReview(thePage, w, h) {
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,resizable';
    win = window.open(thePage, 'l', winprops);
    if (parseInt(navigator.appVersion) >= 4)
      win.window.focus();
  }
  function openLyrics(thePage, w, h) {
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,resizable';
    win = window.open(thePage, 'k', winprops);
    if (parseInt(navigator.appVersion) >= 4)
      win.window.focus();
  }
</script>


I copied the content from browser view source
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top