Moh
18-08-2008, 04:18 PM
If you own a site which dosn't use iframes or ajax, and want a radio player like Habbox, then why not use cookies :D
To do this, all you need is two pages. player.php and setplayer.php.
A demo of this can be found here (http://crazyvalues.net/cookieradioplayer).
player.php
<?php
$cookie_name = "RadioPlayer";
if($_COOKIE[$cookie_name]) {
?>
You have set the Radio not to play.<br>
<a href="setplayer.php?play=yes">Listen To the Radio</a>
<?
}
if(!$_COOKIE[$cookie_name]) {
?>
<object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" standby="Loading" name="player" width="168" height="45" codebase="http://habbcrazy.net/CODEBASE=http:/activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715">
<param ref name="url" value="http://67.152.46.182:8002">
<param value="-1" name="autostart">
<param value="mini" name="uimode">
<param value="1" name="rate">
<param value="0" name="balance">
<param value="0" name="currentPosition">
<param value name="defaultFrame">
<param value="1" name="playCount">
<param value="0" name="currentMarker">
<param value="-1" name="invokeURLs">
<param value name="baseURL">
<param value="100" name="volume">
<param value="0" name="mute">
<param value="0" name="stretchToFit">
<param value="0" name="windowlessVideo">
<param value="-1" name="enabled">
<param value="-1" name="enableContextMenu">
<param value="0" name="fullScreen">
<param value name="SAMIStyle">
<param value name="SAMILang">
<param value name="SAMIFilename">
<param value name="captioningID">
<param value="0" name="enableErrorDialogs">
<embed name="player" uimode="mini" autoplay="true" url="http://www.habbcrazy.net/pages/radio/mediafile.asx" showstatusbar="false" controls="playbutton" autostart="True" src="mediafile.asx" width="168" height="45"></object>
<br>
<a href="setplayer.php?play=no" title="Stop the Radio">Stop the Radio</a>
<?
}
?>
setplayer.php
<?php
$cookie_name = "RadioPlayer";
if($_GET["play"] == "no") {
echo("The radio will stop playing for 31 days if your cookies are enabled.
Do you wish to continue?<br>
<a href=\"setplayer.php?stop=yes\" title=\"Yes\">Yes</a> | <a href=\"setplayer.php?stop=no\" title=\"No\">No</a>");
}
elseif($_GET["play"] == "yes") {
header('Location: setplayer.php?stop=no');
}
elseif($_GET["stop"] == "yes") {
setcookie($cookie_name, "stop_radio", time() + (30*24*60*60) );
header('Location: player.php');
}
elseif($_GET["stop"] == "no") {
$value = "stop_radio";
setcookie($cookie_name, "stop_radio", time() - 3600 );
header('Location: player.php');
}
else {
header('Location: player.php');
}
?>
Moved by Invent (Forum Moderator) from Designing & Development: Please post in the correct forum next time, thanks :).
To do this, all you need is two pages. player.php and setplayer.php.
A demo of this can be found here (http://crazyvalues.net/cookieradioplayer).
player.php
<?php
$cookie_name = "RadioPlayer";
if($_COOKIE[$cookie_name]) {
?>
You have set the Radio not to play.<br>
<a href="setplayer.php?play=yes">Listen To the Radio</a>
<?
}
if(!$_COOKIE[$cookie_name]) {
?>
<object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" standby="Loading" name="player" width="168" height="45" codebase="http://habbcrazy.net/CODEBASE=http:/activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715">
<param ref name="url" value="http://67.152.46.182:8002">
<param value="-1" name="autostart">
<param value="mini" name="uimode">
<param value="1" name="rate">
<param value="0" name="balance">
<param value="0" name="currentPosition">
<param value name="defaultFrame">
<param value="1" name="playCount">
<param value="0" name="currentMarker">
<param value="-1" name="invokeURLs">
<param value name="baseURL">
<param value="100" name="volume">
<param value="0" name="mute">
<param value="0" name="stretchToFit">
<param value="0" name="windowlessVideo">
<param value="-1" name="enabled">
<param value="-1" name="enableContextMenu">
<param value="0" name="fullScreen">
<param value name="SAMIStyle">
<param value name="SAMILang">
<param value name="SAMIFilename">
<param value name="captioningID">
<param value="0" name="enableErrorDialogs">
<embed name="player" uimode="mini" autoplay="true" url="http://www.habbcrazy.net/pages/radio/mediafile.asx" showstatusbar="false" controls="playbutton" autostart="True" src="mediafile.asx" width="168" height="45"></object>
<br>
<a href="setplayer.php?play=no" title="Stop the Radio">Stop the Radio</a>
<?
}
?>
setplayer.php
<?php
$cookie_name = "RadioPlayer";
if($_GET["play"] == "no") {
echo("The radio will stop playing for 31 days if your cookies are enabled.
Do you wish to continue?<br>
<a href=\"setplayer.php?stop=yes\" title=\"Yes\">Yes</a> | <a href=\"setplayer.php?stop=no\" title=\"No\">No</a>");
}
elseif($_GET["play"] == "yes") {
header('Location: setplayer.php?stop=no');
}
elseif($_GET["stop"] == "yes") {
setcookie($cookie_name, "stop_radio", time() + (30*24*60*60) );
header('Location: player.php');
}
elseif($_GET["stop"] == "no") {
$value = "stop_radio";
setcookie($cookie_name, "stop_radio", time() - 3600 );
header('Location: player.php');
}
else {
header('Location: player.php');
}
?>
Moved by Invent (Forum Moderator) from Designing & Development: Please post in the correct forum next time, thanks :).