Monday, July 26, 2010

How to embed flash swf in php??


<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="100%" height="161">
      <param name="movie" value="images/header.swf" />
      <param name="quality" value="high" />
      <embed src="images/header.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100%" height="161"></embed>
    </object>



Code for embedding flash movie files(swf) in php.

   1:  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="100%" height="161">


   2:        <param name="movie" value="images/header.swf" />


   3:        <param name="quality" value="high" />


   4:        <embed src="images/header.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100%" height="161"></embed>


   5:      </object>


Sunday, July 25, 2010

Database handling in php.

 

first open phpmyadmin and then create a new database named “test”( for the specific purpose of this example).

now create a table inside it named “counter” with a field “count” in it. ( integer,NULL,unsigned)

Now, create a file named server_auth.php in (root)/config folder. this folder you must remove all accessing permissions.

in server_auth.php

<?php 
$db_host = "localhost";
$db_user = "root";
$db_password = "";
$db_name = "test";
?>



 



create another file in your webroot named “ counter.php



<?php 
require($_SERVER["DOCUMENT_ROOT"]."/config/server_auth.php");
$connection = @mysql_connect($db_host,$db_user,$db_password) or die("error connecting the database!");
mysql_select_db($db_name, $connection);
$query = "SELECT * FROM counter";
$result = mysql_query($query, $connection) or die(mysql_error());
$views = mysql_result($result, 0, "count");
$views++;
$query = "UPDATE counter SET count = $views";
mysql_query($query, $connection) or die(mysql_error());
echo "This page has been viewed ".$views. " times.";
?>



ALL DONE! just open that counter.php in your browser and it will display a hit count!