Posts Tagged ‘sql’

PHP Write to SQL database

Tuesday, August 19th, 2008

<?php
//write_to_sql.php
//Written by David Kull 07042008
//———————-
// $host = “localhost”;
// $user = “”;
// $pass= “”;
// $table = “”;
// $database = “”;
//———————-require_once(“config.php”);

//stores the URLvariables into variables that php can use
$one =tiny_mce_marker

GET[‘MovieTitle’];
$two =tiny_mce_marker

GET[‘MovieFilename’];
$three=tiny_mce_marker

GET[‘MovieCatagory’];

// Connects to the database server
$dbcnx = @mysql_connect($host, $user, $pwd);
if (!$dbcnx) {
echo( “<P>Write to sql – Unable to connect to the database server {$host}.</P>” );
exit();
}

// Selects the database
if (! @mysql_select_db($database) ) {
echo( “<P>DK, Im Unable to find database : {$database}.”);
exit();
}

//this is the command used to write the record into the MySQL database
$query=”INSERT into {$table} (Title, FileName, Catagory) VALUES (‘{$one}’, ‘{$two}’, ‘{$three}’)”;

//executes the command
mysql_query($query) or die(“DK, Data not written: {$table} : {$one} : {$two} : {$three}.”);
echo(“The data {$one}, {$two}, {$three} has been inserted into table:{$table}! “);
?>

php read from sql database

Tuesday, August 19th, 2008

<?php
header(“Content-type: text/xml”);//read_from_sql.php
//Written by David Kull 07042008
//———————-
// $host = “localhost”;
// $user = “root”;
// $pwd= “”;
// $table = “tablemovie”;
// $database = “movies”;
//———————-

require_once(“config.php”); //php file the contains host, user, pwd, table, database

$one =tiny_mce_marker

GET[‘MovieTitle’];
$two =tiny_mce_marker

GET[‘MovieFilename’];
$three=tiny_mce_marker

GET[‘MovieCatagory’];
// Title, FileName, Catagory

$linkID = mysql_connect($host,$user,$pwd) or die(“DK, I Could not connect to {$host}.”);
mysql_select_db($database, $linkID) or die(“DK, I Could not find database : {$database}.”);

$query = “SELECT * FROM {$table} limit 500”;
$resultID = mysql_query($query, $linkID) or die(“Data not found. {$table} {$title} {$one} {$two} {$three}”);

$xml_output = “<Movies>\n”;

for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
$y = $x +1;
$row = mysql_fetch_assoc($resultID);
$xml_output .= “\t<entry>\n”;

$xml_output .= “\t\t<Title>” . $row[‘Title’] . “</Title>\n”;
$xml_output .= “\t\t<FileName>” . $row[‘FileName’] . “</FileName>\n”;
$xml_output .= “\t\t<Catagory>” . $row[‘Catagory’] . “</Catagory>\n”;

$xml_output .= “\t</entry>\n”;
}

$xml_output .= “</Movies>”;
echo $xml_output;

?>

php – delete title from sql database

Tuesday, August 19th, 2008

<?php
//delete_from_sql
//Written by David Kull 07042008
require_once(“config.php”); //php file the contains host, user, pwd, table, database

$one =tiny_mce_marker

GET[‘MovieTitle’];

$linkID = mysql_connect($host,$user,$pwd) or die(“DK, I Could not connect to {$host}.”);
mysql_select_db($database, $linkID) or die(“DK, I Could not find database : {$database}.”);

echo (“Deleting {$one}.”);
$query = “DELETE FROM {$table} WHERE Title = ‘{$one}'”;
$resultID = mysql_query($query, $linkID) or die(“Data not found. {$table} {$title} “);
?>

Sample Source code for the Media Server

Monday, August 11th, 2008
Features: 
  • Streaming video in mp2 and mp4 format
  • Streaming audio in mp3, wav formats
  • Web based player uses adobe flash version 9
  • Security controlled log in screen to determine what videos the user has access to.
  • Radio player, Live streaming Video player.
  • Sql database to catagorize content.
  • Themes for  background
  • Full screen video playback, and HD video playback.
  • Video on demand.
  • Flash Media Server for streaming audio an video content.
Media Server Version 12

Media Server Version 12

START of code:

 var LoggedIn:Boolean;
 var Administrator:Boolean;

 var Hostname:String ;
 if (Hostname == null) {Hostname = “dkwizard1.servegame.com”}

 var Statustext:String = “”
 var request2:URLRequest = new URLRequest()
 var url:String;
// var url:String = “http://”+Hostname+”/flash/status.php“;�
 var loader4:URLLoader = new URLLoader();   //Url Variable

// Security.allowDomain(“localhost, 64.173.224.224, dkwizard1.servegame.com, mobilemediacenter.servegame.com”);
// Security.allowDomain(“http://localhost“);
// Security.allowDomain(“http://64.173.224.224“);
// Security.allowDomain(“http://dkwizard1.servegame.com“);
// Security.allowDomain(“http://mobilemediacenter.servegame.com“);
// Security.allowDomain(“*”);
 LoggedInMenu();�
//Read From Database
ReadST();

function ReadST() {
 request2.url = “http://”+Hostname+”/flash/status.php“;
 loader4.load(request2);
}
//LoadComplete Status – Update statustext with results
function LoadComplete4(event:Event):void {
 Statustext = event.target.data;�
 //Statustext = “Serverrf:http://mobilemediacenter.servegame.com/flash/mediaserver10.swf:Server” //remove test
 var statusarray:Array = Statustext.split(“:”);   //Create the array that holds Movie Title, filename, catagory

  if (statusarray[1] != “”)
   {
   //Serverrf:http://mobilemediacenter.servegame.com/flash/mediaserver10.swf:Server
   //statusarray[1]= “mobilemediacenter.servegame.com/flash/mediacenter.html”;
   trace (“0″+statusarray[0]); �
   trace (“1″+statusarray[1]); �
   trace (“2″+statusarray[2]); �
   statusarray[2] = statusarray[2].slice (0,statusarray[2].lastIndexOf(“mediaserver/”)-1); //Strip off at flash
   trace (statusarray[2]); //   //mobilemediacenter.servegame.com
   trace(statusarray[2].slice(2,statusarray[2].length));
   statusarray[2] = statusarray[2].slice(2,statusarray[2].length)
   Hostname = statusarray[2];
   }
  else
   {Hostname = “mobilemediacenter.servegame.com”}
    // Could not find the hostname – Point to johns server
     HomeText.text += “\nStatus: ” + Statustext;
     HomeText.text += “\nHostname: ” + Hostname;
}
//Done Loading�
 loader4.addEventListener(Event.COMPLETE, LoadComplete4);   //when done loading, go to the LoadComplete function

 HomeText.text += “\nServer: ” + Hostname;
 LoggedInStatus();

// Display the ripple logo
 var request:URLRequest = new URLRequest(“http://dkwizard1.servegame.com/flash/DavidsRipple.swf“);
 var loader3:Loader = new Loader();
 loader3.load(request);
 loader3.x = 400; loader3.y = 20;   //Sets the location on the screen
 addChild(loader3);
// stop();�

Home.addEventListener(MouseEvent.MOUSE_UP, gohome);
MemberLogin.addEventListener(MouseEvent.MOUSE_UP, gologin);
Movies.addEventListener(MouseEvent.MOUSE_UP, gomovies);
LiveVideoBtn.addEventListener(MouseEvent.MOUSE_UP, gomovies);
MusicBtn.addEventListener(MouseEvent.MOUSE_UP, go2music);
Radio.addEventListener(MouseEvent.MOUSE_UP, gomovies);
AboutBtn.addEventListener(MouseEvent.MOUSE_UP, goabout);
Contact.addEventListener(MouseEvent.MOUSE_UP, gocontact);
Help.addEventListener(MouseEvent.MOUSE_UP, gohelp);
admin.addEventListener(MouseEvent.MOUSE_UP, goadmin);
//adobe.addEventListener(MouseEvent.MOUSE_UP, gomovies);   //Already Defined somewhere else to go to the website
//LoggedIn.addEventListener(MouseEvent.CLICK, updatemenu);   //about checkbox clicked�
function LoggedInStatus(){
 if (LoggedIn == true)
  {HomeText.text += “\nLogged in”}
 else �
  {HomeText.text += “\nLogged out”}
 HomeText.text += “\nAdministrator:” + Administrator;
}

function gohome(evt:Event):void { gotoAndStop(“Home”);   } // Jumps to the Home KeyFrame
function gologin(evt:Event):void { gotoAndStop(“Login”);  } // Jumps to the Login KeyFrame
function gomovies(evt:Event):void { gotoAndStop(“PlayVideo”); } // Jumps to the PlayVideo KeyFrame
function go2music(evt:Event):void { gotoAndStop(“Music”);  } // Jumps to the PlayMusic KeyFrame
function goabout(evt:Event):void { gotoAndStop(“About”);  } // Jumps to the About KeyFrame
function gocontact(evt:Event):void { gotoAndStop(“ContactUs”); } // Jumps to the ContactUs KeyFrame
function gohelp(evt:Event):void { gotoAndStop(“Help”);   } // Jumps to the Help KeyFrame
function goadmin(evt:Event):void { gotoAndStop(“Admin”);  } // Jumps to the Help KeyFrame

function updatemenu(event:Event):void {LoggedInMenu();}

function LoggedInMenu(){
 Movies.visible = LoggedIn;
 LiveVideoBtn.visible = LoggedIn;
 MusicBtn.visible = LoggedIn;
 Radio.visible = LoggedIn;
 admin.visible = Administrator;
}

My Latest Video
Weather forecast in San Bernardino
My Photos on Pond 5
Royalty-Free Stock Video at Pond5
Posts
Speedtest 2014 B
Speedtest.net Mini requires at least version 8 of Flash. Please update your client.
Speed Test
Recent Posts
    Sponsers
    Your IP Info
    Login