vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   How do i add this to our forum?? (https://vborg.vbsupport.ru/showthread.php?t=311942)

DreadsUK 06-06-2014 02:27 PM

How do i add this to our forum??
 
We now have a radio station for our site and i'm wondering which code to add and where.

If i add it to the main page. im concerned it will increase load time. Thought it best to create an article or a separate page. What would you suggest and where and which code do i add.

I've tried it using forum blocks but that means every page refresh stops the music and starts again when loaded

Javascript/HTML scripts


Song title (JS)
Code:

<script type="text/javascript" src="http://shoutcast.mixstream.net/js/song/uk30-free:16392">
You appear to have javascript turned off.
</script>

Number of listeners (JS)
Code:

<script type="text/javascript" src="http://shoutcast.mixstream.net/js/listeners/uk30-free:16392">You appear to have javascript turned off.
Online/Offline (JS)
Code:

<script type="text/javascript" src="http://shoutcast.mixstream.net/js/status/uk30-free:16392">You appear to have javascript turned off.
Online/Offline image (HTML)
Code:

<img src="http://shoutcast.mixstream.net/status/uk30-free:16392.gif" alt="Stream status" width="17" height="17" align="absmiddle">
Display Flash player (Pro Broadcasters Only)
Code:

<script>
        // MixStream Flash Player, http://mixstreamflashplayer.net/
        var flashvars = {};flashvars.serverHost = "s30.myradiostream.com:16392/;";flashvars.getStats = "1";flashvars.autoStart = "1";flashvars.textColour = "";flashvars.buttonColour = "";var params = {};params.bgcolor= "";params.wmode="transparent";
</script>
<script type="text/javascript" src="http://mixstreamflashplayer.net/v1.3.js"></script>

PHP scripts
PHP scripts are generally the most reliable and quickest way to get stats from your server. If these don't work then it's probably because either your webhost doesn't support PHP or they have a firewall blocking all outgoing connections, in which case you can either contact them or use the javascripts above.

Song title
Code:

<?php
$ip = "s30.myradiostream.com";
$port = "16392";
$fp = @fsockopen($ip,$port,$errno,$errstr,1);
if (!$fp) {
        $title = "Connection timed out or the server is offline  ";
} else {
        fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n");
        while (!feof($fp)) {
                $info = fgets($fp);
        }
        $info = str_replace('</body></html>', "", $info);
        $split = explode(',', $info);
        if (empty($split[6])) {
                $title = "The current song is not available  ";
        } else {
                $count = count($split);
                $i = "6";
                while($i<=$count) {
                        if ($i > 6) {
                                $title .= ", " . $split[$i];
                        } else {
                                $title .= $split[$i];
                        }
                        $i++;
                }
        }
}
$title = substr($title, 0, -2);
print $title;
?>

Number of listeners
Code:

<?php
$ip = "s30.myradiostream.com";
$port = "16392";
$fp = @fsockopen($ip,$port,$errno,$errstr,1);
if (!$fp) {
        $listeners = "0;";
} else {
        fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n");
        while (!feof($fp)) {
                $info = fgets($fp);
        }
        $split = explode(',', $info);
        if ($split[1] == "0") {
                $listeners = "0";
        } else {
                $listeners = $split[0];
        }
}
print $listeners;
?>

Online/Offline
Code:

<?php
// Change these to your online/offline messages //
$online = "Online"; // Displays when stream is online
$offline = "Offline"; // Displays when stream is offline
// don't edit below //
$ip = "s30.myradiostream.com";
$port = "16392";
$fp = @fsockopen($ip,$port,$errno,$errstr,1);
if (!$fp) {
        $status = $offline;
} else {
        fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n");
        while (!feof($fp)) {
                $info = fgets($fp);
        }
        $split = explode(',', $info);
        if ($split[1] == "0") {
                $status = $offline;
        } else {
                $status = $online;
        }
}
print $status;
?>



All times are GMT. The time now is 12:27 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01443 seconds
  • Memory Usage 1,724KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete