WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
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 Resources
Web Development Content
Internet Security Software
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
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

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 : 15408
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  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
Multiple Select box, Select multiple Items from Menu.List box
Categories : PHP, HTML and PHP, Beginner Guides
If you want to create select buttons featuring current date this example will show you how...
Categories : Date Time, HTML and PHP, PHP
Directory TreeView - File Manager & Explorer - FTP - Utility - PHP/HTML -
Categories : PHP, Directories, FTP, Filesystem, HTML and PHP
Rich Editor (RE) is a cross-browser WYSIWYG html editor
Categories : Content Management, Editors and IDEs, PHP, Complete Programs
Automatic generation of HTML code for a table. OO interface. Can define colspan, rowspan, table style, cell style, and data style. Simple, but effective.
Categories : PHP, PHP Classes, HTML, HTML and PHP
Website colour changer
Categories : PHP, HTML and PHP, Date Time
Creates three SELECT form fields: Month, Day, and Year. You give it a string which will be used to make the name for the three fields, and a number of seconds to use as the default date. If you give it blank for this value, the current date is used.
Categories : HTML and PHP, PHP, Date Time
How to pass an array from one PHP Script to another via an HTML form
Categories : PHP, HTML and PHP, Arrays
A quick way set data from a form to a function or other places where you can lose scope.
Categories : PHP, HTML and PHP, Variables
a function that builds an HTML select list from any mysql table.
Categories : PHP, MySQL, HTML and PHP
This script contains 2 functions: 1 to create html select object based on your own customer date format entry- "M d Y h:i.... etc". The second function processes the select object on submit back to unix time.
Categories : PHP, Calendar, Date Time, HTML and PHP
Message of the Day - Random Message (Needs MySQL!)
Categories : Databases, HTML and PHP, PHP, MySQL
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
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
 Mark Jansen wrote :535
There are some Dutch words inside

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