WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : background music script for random notes in a frame
Categories : PHP, Content Management, HTML and PHP Update Picture
Mark Jansen
Date : Feb 15th 2001
Grade : 3 of 5 (graded 6 times)
Viewed : 9798
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Mark Jansen
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<?php
// Beginning php

// Saving the page header in the variable $head.
$head = <<<ENDH
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Achtergrondmuziek</title>


ENDH;
// End of page header

// Saving the page footer in the variable $tail.
$tail = <<<ENDT
</body>
</html>
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 "<META HTTP-EQUIV=Refresh Content=";
echo $timervalue;
echo ";URL=http://www.jubal.vuurwerk.nl/bgmusic.php3>";
}
echo "</head>";
echo "<body topmargin=0 leftmargin=0 text=#ffffff link=#FE683A vlink=#000000
alink=#000080 bgcolor=#FFFFFF background=/images/linker-menu-achtergrond.gif>";
echo "<table border=0 cellpadding=0 cellspacing=0 width=115><tr><td width=100><img
border=0 src=images/logo-online.gif valign=top align=top></td></tr><tr><td><center>";


// when music is chosen on
if ($$n_pref =="on") {

echo "<EMBED SRC=";
echo $midifile;
echo " WIDTH=0 HEIGHT=0 AUTOSTART=TRUE>";
echo "<small><small>Achtergrondmuziek: </small><b>";
echo $midititle;
echo "</b>";

?>

<form action="<?php echo $PHP_SELF ?>" method="POST">
<input name="preference" type="hidden" value="off">
<input type=submit value="Muziek uit"></form>
<?php

}        

// when music is chosen off
else
{
?>

<form action="<?php echo $PHP_SELF ?>" method="POST">
<input name="preference" type="hidden" value="on">
<input type=submit value="Muziek aan"></form>
<?php
echo "<small><small>(Momenteel heeft u geen achtergrondmuziek aan staan)
<br></small></small>";
}

echo "</center></td><td width=15></td></tr></table>";
echo $tail;

?>



PHP3: Formmail. Just a cgi formmail, but than in PHP. It is easy to use!
Categories : HTML and PHP, Email, PHP, Perl, HTML and PHP
A simple class with some HTML output functions that would come in handy for consistent page layout etc.
Categories : PHP, PHP Classes, HTML and PHP, HTML, Navigation
a function that builds an HTML select list from any mysql table.
Categories : PHP, MySQL, HTML and PHP
Message of the Day - Random Message (Needs MySQL!)
Categories : Databases, HTML and PHP, PHP, MySQL
Check parameters validity. Paranoia was designed to check the validity of the parameters that a php page will receive after a form submission. It can be used to check the variables sent by POST or GET
Categories : Algorithms, HTML and PHP, PHP, Variables
Constantly refresh your PHP/HTML page data.
Categories : PHP, HTML and PHP, Sybase
Select with current month
Categories : PHP, HTML and PHP, Date Time, Arrays
PHP4 session helper HTML file.
Categories : PHP, Java Script, HTML and PHP, Sessions
A very simple way to build and do a hierarchical html categories browser without javascript , just using html php and mySql
Categories : HTML and PHP, Databases, Algorithms, PHP, MySQL
PageRank Display
Categories : Search Engines, HTML and PHP, PHP
PhpView 0.1 - simple php viewer, using temporary files and frames.
Categories : PHP, PHP Options and Info, Debugging, HTML and PHP
Automatically printing the contents of an sql table in MySQL.
Categories : MySQL, PHP, HTML and PHP, Databases
Dynamic Calender in PHP, Javascript and HTML.
Categories : PHP, Java Script, HTML and PHP, Calendar
function textwrap will wrap text to any desired width using <BR>\n as the default line break. Default wrap width is 80 columns.
Categories : Strings, HTML and PHP, PHP
Using select multiple with php3
Categories : HTML and PHP, PHP
 Mark Jansen wrote :535
There are some Dutch words inside

If that gives a problem, please mail me and I`ll translate them