Content Management Php

// Beginning php
// Saving the page header in the variable $head.
$head = <<


Achtergrondmuziek
ENDH;// End of page header
// Saving the page footer in the variable $tail.
$tail = <<

ENDT;// End of page footer
// Set up variables that will be saved in the cookies
// Define unique cookie prefix
$ID = "Jubal-achtergrondmuziek";
// Cookie lifetime in seconds (in this example, three days)
$cookie_life = 365*24*3600;
// Name of cookie that holds the user's preference
$n_pref = $ID . "_Preference";
// this part creates a random background music with title
// makes sure the random number really is random
mt_srand ((double) microtime() * 1000000);
// creates a random number
$number = mt_rand (1, 25);
if ($number == (1)) {
$midifile=("/multimedia/midifiles/change_the_world.mid");
$midititle="Change the world";
$timervalue=256;
}
if ($number == (2)){
$midifile=("/multimedia/midifiles/iwillal.mid");
$midititle="I will always love you";
$timervalue=256;
}
if ($number == (3)){
$midifile=("/multimedia/midifiles/layla.mid");
$midititle="Layla";
$timervalue=322;
}
if ($number == (4)){
$midifile=("/multimedia/midifiles/tearsihe.mid");
$midititle="Tears in heaven";
$timervalue=284;
}
if ($number == (5)){
$midifile=("/multimedia/midifiles/when-you-believe.mid");
$midititle="When you believe";
$timervalue=273;
}
if ($number == (6)){
$midifile=("/multimedia/midifiles/white_ro.mid");
$midititle="White Rose";
$timervalue=356;
}
if ($number == (7)){
$midifile=("/multimedia/midifiles/wonderfu.mid");
$midititle="Wonderful World";
$timervalue=247;
}
if ($number == (8)){
$midifile=("/multimedia/midifiles/1492.mid");
$midititle="1492";
$timervalue=312;
}
if ($number == (9)){
$midifile=("/multimedia/midifiles/bestfrnd.mid");
$midititle="You're my best friend";
$timervalue=191;
}
if ($number == (10)){
$midifile=("/multimedia/midifiles/bohemian.mid");
$midititle="Bohemian Rhapsody";
$timervalue=350;
}
if ($number == (11)){
$midifile=("/multimedia/midifiles/the_empire_strikes_back.mid");
$midititle="The empire strikes back";
$timervalue=225;
}
if ($number == (12)){
$midifile=("/multimedia/midifiles/indysong.mid");
$midititle="Indiana Jones";
$timervalue=330;
}
if ($number == (13)){
$midifile=("/multimedia/midifiles/5thbeethoven.mid");
$midititle="5de Beethoven";
$timervalue=555;
}
if ($number == (14)){
$midifile=("/multimedia/midifiles/cats_memory.mid");
$midititle="Cats Memory";
$timervalue=240000;
}
if ($number == (15)){
$midifile=("/multimedia/midifiles/d_queen.mid");
$midititle="Dancing Queen";
$timervalue=250;
}
if ($number == (16)){
$midifile=("/multimedia/midifiles/don't_cry_for_me_argentina.mid");
$midititle="Don't cry for me Argentina";
$timervalue=362;
}
if ($number == (17)){
$midifile=("/multimedia/midifiles/fernando.mid");
$midititle="Fernando";
$timervalue=275;
}
if ($number == (18)){
$midifile=("/multimedia/midifiles/mammamia.mid");
$midititle="Mammamia";
$timervalue=233;
}
if ($number == (19)){
$midifile=("/multimedia/midifiles/msaigong.mid");
$midititle="Miss Saigon";
$timervalue=552;
}
if ($number == (20)){
$midifile=("/multimedia/midifiles/phantom.mid");
$midititle="the Phantom of the Opera";
$timervalue=270;
}
if ($number == (21)){
$midifile=("/multimedia/midifiles/summerlovegrease.mid");
$midititle="Summerlove Grease";
$timervalue=220;
}
if ($number == (22)){
$midifile=("/multimedia/midifiles/waterloo.mid");
$midititle="Waterloo";
$timervalue=190;
}
if ($number == (23)){
$midifile=("/multimedia/midifiles/whatsup.mid");
$midititle="What's up";
$timervalue=325;
}
if ($number == (24)){
$midifile=("/multimedia/midifiles/bitdust2.mid");
$midititle="Another one bites the Dust";
$timervalue=192;
}
if ($number == (25)){
$midifile=("/multimedia/midifiles/i_would_do_anything_for_love.mid");
$midititle="I would do anything for love";
$timervalue=145;
}
// when a form is used to come to this page
if( isset($preference)) {
if ($preference == "on") {
$$n_pref = "on";
Setcookie($n_pref,"on",time()+$cookie_life);
}
else {
$$n_pref = "off";
Setcookie($n_pref,"off",time()+$cookie_life);
}
}
echo $head;
// making sure a new music is loaded when the current one has finised
if ($$n_pref =="on") {
echo "";
}
echo "";
echo "alink=#000080 bgcolor=#FFFFFF background=/images/linker-menu-achtergrond.gif>";
echo "
border=0 src=images/logo-online.gif valign=top align=top>
";
// when music is chosen on
if ($$n_pref =="on") {
echo "";
echo "Achtergrondmuziek: ";
echo $midititle;
echo "
";
?>



}
// when music is chosen off
else
{
?>



echo "(Momenteel heeft u geen achtergrondmuziek aan staan)

";
}
echo "
";
echo $tail;
?>