Total Pageviews

Friday, December 16, 2011

phtml configuration in dreamweaver

Follow kvn_krishna on Twitter






C:\Program Files\Macromedia\Dreamweaver 8\Configuration\Extensions.txt 

find "PHP,PHP3,PHP4...."

then we have to add phtml Extensions.txt

PHP,PHP3,PHP4,PHP5,TPL,PHTML:PHP Files





then  add to the following file:MMDocumentTypes.xml



C:\Program Files\Macromedia\Dreamweaver 8\Configuration\DocumentTypes\MMDocumentTypes.xml

<documenttype id="PHP_MySQL" servermodel="PHP MySQL" internaltype="Dynamic" winfileextension="php,php3,php4,php5,phtml" macfileextension="php,php3,php4,php5,phtml" file="Default.php" writebyteordermark="false">

Friday, December 9, 2011

page count in java script and hide the block

Follow kvn_krishna on Twitter


 <script type="text/javascript" language="javascript">

function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}


function SetCookie (name, value)
{
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain)) +((secure == true) ? "; secure" : "");

}

function DeleteCookie (name)
{
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var expDays = 1;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*3600*24*15));

function amt()
{
var count = GetCookie('count')
if(count == null)
{
SetCookie('count','1')
return 1
}

else
{
var newcount = parseInt(count) + 1;
DeleteCookie('count')
SetCookie('count',newcount,exp)
return count
}
}

function getCookieVal(offset)
{
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
// End -->
</script>
<!-- STEP TWO: <span class="IL_AD" id="IL_AD12">Copy this</span> code <span class="IL_AD" id="IL_AD2">into the</span> BODY of your HTML document -->
<body>
<script LANGUAGE="JavaScript">
<!-- Begin
var kr=amt();
if (kr<2)
{
document.write('<img src="krishna.jpg" width="584" height="354">');
}
else if(kr>15){
DeleteCookie('count');
}
else
{
document.write("times up");
document.write("You are here for <b>" + kr + " times.");
}

// End -->
</script>

Monday, November 21, 2011

Tuesday, August 30, 2011

Dissable charactor on text box by javascript ,only allowing numbers at the text box

Follow kvn_krishna on Twitter





Its is used to disabled the charactor key pressing on javascript.
java script function
<--------------------------
 function isnumky(evt)
      {
         var char1 = (evt.which) ? evt.which : event.keycode
         if (char1 > 31 && (char1 < 48 || char1 > 57))
            return false;

         return true;
      }
 ---------------------------------------->
html  form
<input name="textfield" type="text" onkeypress="return isnumky(evnt)" size="50" />






Sunday, August 21, 2011

date of birth to age calculate by using java script regular expresion

Follow kvn_krishna on Twitter
<script type="text/javascript">
function CalculateAge(birthday) {
var re=/^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d+$/;
if (birthday.value != '') {
if(re.test(birthday.value ))
{
birthdayDate = new Date(birthday.value);
dateNow = new Date();
var years = dateNow.getFullYear() - birthdayDate.getFullYear();
var months=dateNow.getMonth()-birthdayDate.getMonth();
var days=dateNow.getDate()-birthdayDate.getDate();
if (isNaN(years)) {
document.getElementById('lblAge').innerHTML = '';
document.getElementById('lblError').innerHTML = 'Input date is incorrect!';
return false;
}
else {
document.getElementById('lblError').innerHTML = '';
document.getElementById('lblAge').innerHTML = years +' Years ' +months +' months '+days +' days';
}
}
else
{
document.getElementById('lblError').innerHTML = 'Date must be mm/dd/yyyy format';
return false;
}
}
}
</script>
</head>
<body>
<form id="form1" method="post">
<div>
Date of Birth :<input id="txtAge" onBlur="CalculateAge(this)" />(mm/dd/yyyy)
<span style="color: Red">
<Label ID="lblError" ></Label></span>
<br />
Age&nbsp;&nbsp;&nbsp; : <span id="lblAge"></span>
</div>
</form>

Wednesday, August 10, 2011

water mark in php ..... restrict image file upload

Follow kvn_krishna on Twitter
 

water mark creation with image upload

move_uploaded_file($_FILES["fileToUpload"]["tmp_name"],"userimage/".$_FILES["fileToUpload"]["name"]);
//WaterMarkImages("images/".$_FILES["fileToUpload"]["name"]);
if ((($_FILES["fileToUpload"]["type"] == "image/gif")
|| ($_FILES["fileToUpload"]["type"] == "image/jpeg")
|| ($_FILES["fileToUpload"]["type"] == "image/jpg")
|| ($_FILES["fileToUpload"]["type"] == "image/pjpeg")
|| ($_FILES["fileToUpload"]["type"] == "image/png"))
&& ($_FILES["fileToUpload"]["size"] < 200000))
{
function WaterMarkImages($location)
{
$wm=imagecreatefromgif("image4.gif");
$wm_height=imagesy($wm);
$wm_width=imagesx($wm);
$image=imagecreatetruecolor($wm_width,$wm_height);
$image=imagecreatefromjpeg($location);
$size=getimagesize($location);
$x_pos=$size[0]-$wm-width-90;
$y_pos=$size[1]-$wm-width-800;
imagecopymerge($image,$wm,$x_pos,$y_pos,0,0,$wm_width,$wm_height,100);
imagejpeg($image,$location);
imagedestroy($image);
imagedestroy($wm);
}
call_user_func('WaterMarkImages', "userimage/".$_FILES["fileToUpload"]["name"]);
}
if ((($_FILES["fileToUpload1"]["type"] == "image/gif")
|| ($_FILES["fileToUpload1"]["type"] == "image/jpeg")
|| ($_FILES["fileToUpload1"]["type"] == "image/jpg")
|| ($_FILES["fileToUpload1"]["type"] == "image/pjpeg")
|| ($_FILES["fileToUpload1"]["type"] == "image/png"))
&& ($_FILES["fileToUpload1"]["size"] < 200000))
{
move_uploaded_file($_FILES["fileToUpload1"]["tmp_name"],"jadhagamimage/".$_FILES["fileToUpload1"]["name"]);

//WaterMarkImages1("images1/".$_FILES["fileToUpload1"]["name"]);

function WaterMarkImages1($location)
{
$wm=imagecreatefromgif("image4.gif");
$wm_height=imagesy($wm);
$wm_width=imagesx($wm);
$image=imagecreatetruecolor($wm_width,$wm_height);
$image=imagecreatefromjpeg($location);
$size=getimagesize($location);
$x_pos=$size[0]-$wm-width-90;
$y_pos=$size[1]-$wm-width-800;
imagecopymerge($image,$wm,$x_pos,$y_pos,0,0,$wm_width,$wm_height,100);
imagejpeg($image,$location);
imagedestroy($image);
imagedestroy($wm);
}
call_user_func('WaterMarkImages1', "jadhagamimage/".$_FILES["fileToUpload1"]["name"]);
$sql=("insert into table(fields,image field,,) values ('fields','".$_FILES["fileToUpload"]["name"]."','".$_FILES["fileToUpload1"]["name"]."')");
$n=mysql_query($sql);
header("location:home.");
}
}

Monday, June 13, 2011

fetch multiple contents with time out using curl with php mutitreading

Follow kvn_krishna on Twitter


this prgm used to fetch  the contents from other servers .... wil set the sleeping time and and will see the time taken and how to fetch ,,, by using curl with php mutitreading
<style type="text/css">
<!--
.style2 {color: #FF0000; font-style:oblique; font-size:24px;}
-->
</style>

<?php
function addHandle(&$curlHandle,$url)
{
$cURL = curl_init();
curl_setopt($cURL, CURLOPT_URL, $url);
curl_setopt($cURL, CURLOPT_HEADER, 0);
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, 1);
curl_multi_add_handle($curlHandle,$cURL);
return $cURL;
}
//execute the handle until the flag passed to function is greater then 0
function ExecHandle(&$curlHandle)
{
$flag=null;
do {
    curl_multi_exec($curlHandle,$flag);//fetch pages in parallel
} while ($flag > 0);
}


$list[1] = "http://www.google.co.in/";
$list[2] = "http://in.yahoo.com/?p=in";
$list[3] = "http://www.rediff.com/";
$list[4] = "http://www.bing.com/";
$curlHandle = curl_multi_init();

for ($i = 1;$i <= 4; $i++)
 $curl[$i] = addHandle($curlHandle,$list[$i]);
ExecHandle($curlHandle);
for ($i = 1;$i <= 4; $i++)
{
// set the sleeping time on 2 seconds
 usleep(2000000);
 {
 // get the content from other servers
 $text[$i] =  curl_multi_getcontent ($curl[$i]);
 echo $text[$i];
  }
 
 echo "<span class='style2'>$i time out".date("h:i:s")."</span>";
}
for ($i = 1;$i <= 4; $i++)//remove the handles
  curl_multi_remove_handle($curlHandle,$curl[$i]);
curl_multi_close($curlHandle);

?>

hit multiple times on the target address using CURL in php multi treading .....

Follow kvn_krishna on Twitter

 this program used to hit the target ftp/http/https........hit  at multiple times... will getta response from multiple times.....i hope  this is example useful for u.... 

example:-

<?php
error_reporting(0);
  // create the multi curl handle
  $mh = curl_multi_init();
  $handles = array();

  for($i=0;$i<5;$i++)
  {
    // create a new single curl handle
    $ch = curl_init();
 
    // setting several options like url, timeout, returntransfer
    // simulate multithreading by calling the wait.php script and sleeping for $rand seconds
    curl_setopt($ch, CURLOPT_URL, "http://www.example.com/IPtest/Timeout.asmx/HelloWorld");
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch , CURLOPT_POSTFIELDS,"test='($i+1)'&value='ram'");
    curl_setopt($ch, CURLOPT_TIMEOUT, 30);
 
    // add this handle to the multi handle
    curl_multi_add_handle($mh,$ch);
 
    // put the handles in an array to loop this later on
    $handles[] = $ch;
  }

  // execute the multi handle
  $running=null;
  do
  {
    curl_multi_exec($mh,$running);
    // added a usleep for 0.25 seconds to reduce load
    usleep (250000);
  } while ($running > 0);

  // get the content of the urls (if there is any)
  for($i=0;$i<count($handles);$i++)
  {
    // get the content of the handle
    $output=curl_multi_getcontent($handles[$i]);
 
    // remove the handle from the multi handle
    curl_multi_remove_handle($mh,$handles[$i]);
//echo the output to the screen multiple times
echo $output."<br>";

  }

  // echo the output to the screen
// echo $output;

  // close the multi curl handle to free system resources
  curl_multi_close($mh);


?>

Friday, June 10, 2011

example code paypal integration with php

Follow kvn_krishna on Twitter
sample code paypal integration with php
these credit gose to  Dan Lawson....

payment gate way integration ..... create test account in paypal....

Follow kvn_krishna on Twitter
Here i just discus about how to integrate payment gateway in php.... before that we have needed to know the checking process.... that followed blow  
step 1. u go to register your account in papal sandbox  
after creation of your account you go to configure ur  account in ur account what kind u want....

after that you need ipn ... so you should follow this steps 

step1.


step2.


this is a sample...... you should your needed path url in ipn header url.....

Monday, June 6, 2011

mutiple email sending seperation usring comma


<?php
if(isset($_REQUEST['submit']))
{
//$toadd = $_REQUEST['to'];
//define the receiver of the email
$to = $_REQUEST['to'];
$array = explode(",", $to);
//define the subject of the email
$subject = $_REQUEST['subject'];
//define the message to be sent. Each line should be separated with \n
$message = $_REQUEST['textarea'];
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: it.siddarth@gmail.com\r\nReply-To:  it.siddarth@gmail.com";
//send the email
if($to!="")
{
  foreach ($array as $k => $v)
   {
    // echo $v."</br>";
    $mail_sent = @mail( $v, $subject, $message, $headers );
     }
   echo "You have referred the following your friends email ids $to ";
   }
 else
   {
  echo "check ur refferal email_ids";
    }
}
?>
<form id="form_id" method="post" action="mutiplemails.php" >
  <p>Invite Friends Here :
    <input type="text" id="emailq" name="to" />
    <input type="submit" name="submit" value="Invite" />
 subject:
      <input name="subject" type="text"  />
content:
        <textarea name="textarea" rows="5" > </textarea></p>
</form>

Friday, May 27, 2011

java script basic learning..


in javascript

if u want to check the empty value in text box?

u should have form name and text box name

select function name from form event like onsubmit= return function_name();

syntx

function function_name()
{
var txtbx=document.form_name.textbox_name;                   ///

if(txtbx.value=="" || txtbx.value==null )
{
 alert("text box is empty");
return false;
}

}

<form name="form_name"  onsubmit="return function_name()">
<input type="text" name="txtbx">
</form>

Thursday, May 12, 2011

Php video upload problem

How To Config the file in php.ini


In PHP unable to upload video file more then 2MB...

How to increase the upload file size ?

---------------------------------

find the line in php.ini file
replace the following lines 

find:-

upload_max_filesize = 2M 

Replace:-

php_value upload_max_filesize = 500M

-------------------------------------

find:-

post_max_size = 8M

Replace:-

php_value post_max_size = 500M

--------------------------------------
increase your file size however you want.....

Tuesday, April 19, 2011

sending multiple emails in php



<php
if(isset($_REQUEST['submit']))
{
//$toadd = $_REQUEST['to'];
//define the receiver of the email
$to = $_REQUEST['to'];

$array = explode(",", $to);

foreach ($array as $k => $v)
{
    $ids= explode(",", $v);
    //echo "  ". $ids[0];
if($ids!="")
{

      if (!preg_match("/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/i", $ids[0]))
      {
      echo "<font color='red'>something is Invalid email id's </font>";
       }
     else{
      echo "<font color='green'> Valid Email id's </font>";
 }

}
}
//define the subject of the email
$subject = 'Test email';
//define the message to be sent. Each line should be separated with \n
$message = "Hello World!\n\nThis is my first mail.";
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: k.v.n.krishnakumar@gmail.com\r\nReply-To:  k.v.n.krishnakumar@gmail.com";
//send the email
$mail_sent = @mail( $ids[0], $subject, $message, $headers );
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed"
echo $mail_sent ? "You have referred the following your friend email id's:'  $ids[0]' " : "Referral sending failed to:'$to' this id";
}

?>


<form method="post" action="referfndmail.php">
Invite Friends Here : <input type="text" name="to" onBlur="AjaxFunction(this.value);"><div id="msg"></div>
<input type="submit" name="submit" value="Invite" />

<form>

Friday, April 15, 2011

ajax php email validation




check tis image to ajax php email validation

Ajax using php email validation


put this script on html head.....

div class='k'> Type input. Rule:type email formate only.
type ur email here << input type="text" onkeyup= prompt(this.value)" size="20" />
Prompt: /div>
the above is a html form.....save any name .htm or phpand php code is
$z=$_GET["q"];echo $z;if (!preg_match("/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/i", $z)){echo still Invalid email";}else{echo Valid Email";} ?>
the abvoe is the expresstion match via php save this file has filter.php

Tuesday, April 5, 2011

javascript code for view video

?php
$rk=mysql_query("select * from videoview order by id desc limit 2");
$kk=mysql_fetch_array($rk)

?>
script src='includes/swfobject.js' type='text/javascript'>
div id='flvplayer'>
script type='text/javascript'>

var so = new SWFObject('mpw_player.swf, 'swfplayer, "400", "327", "9", "#000000"); // Player loading
so.addVariable("flv","?php echo "uploads/". $kk['video']; ?>"); // File Name
so.addVariable("jpg","trusted.jpg"); // Preview photo
so.addVariable("autoplay","false"); // Autoplay, make true to autoplay
so.addParam("allowFullScreen","true"); // Allow fullscreen, disable with false
so.addVariable("backcolor","000000"); // Background color of controls in html color code
so.addVariable("frontcolor","ffffff"); // Foreground color of controls in html color code
so.write("flvplayer"); // This needs to be the name of the div id
/script>

javascript on video player (thanks to blog.deconcep, opensource.org )

/**
* SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
*
* SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*
*/
if(typeof deconcept=="undefined")
{var deconcept=new Object();}
if(typeof deconcept.util=="undefined")
{deconcept.util=new Object();}
if(typeof deconcept.SWFObjectUtil=="undefined")
{deconcept.SWFObjectUtil=new Object();}
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a)
{if(!document.getElementById)
{return;
}this.DETECT_KEY=_a?_a:"detectflash";
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
if(!window.opera&&document.all&&this.installedVer.major>7)
{deconcept.SWFObject.doPrepUnload=true;}
if(c){this.addParam("bgcolor",c);}
var q=_7?_7:"high";this.addParam("quality",q);
this.setAttribute("useExpressInstall",false);
this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);
this.setAttribute("redirectUrl","");
if(_9){this.setAttribute("redirectUrl",_9);}};
deconcept.SWFObject.prototype={useExpressInstall:function(_d)
{this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="";_19+="";var _1d=this.getParams();for(var key in _1d){_19+="";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="";}_19+="";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}
catch(e)
{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e)
{if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.majorfv.major){return true;}
if(this.minor
if(this.minor>fv.minor){return true;}
if(this.rev
if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b)
{return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--)
{_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function()
{__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};
window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}
if(!document.getElementById&&document.all)
{document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;

view the uploaded video in js also

?php
$con=mysql_connect('localhost','root','');
mysql_select_db('videodb',$con);

if(isset($_REQUEST['submit']))
{
$uploaddir = 'uploads/';
$uploadfile = $uploaddir.basename($_FILES['uploadedfile']['name']);
if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'],$uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
}
else {
echo "File uploading failed.\n";
}
mysql_query("insert into videoview (id,video,status) values ('','".$_FILES['uploadedfile']['name']."','y')");
}
?>

form enctype="multipart/form-data" action="upload1.php" method="POST">
input type="hidden" name="post_max_size" value="60531648" />
Choose a file to upload:
input type="submit" name="submit" value="Upload File" />
/form>

script src='includes/swfobject.js' type='text/javascript'>


?php
$rk=mysql_query("SELECT * FROM `videoview` order by id desc limit 1");
$kk=mysql_fetch_array($rk);

echo $kk['video'];
?>
div id='flvplayer'>
script type='text/javascript'>
var so = new SWFObject('mpw_player.swf', 'swfplayer', "400", "327", "9", "#000000"); // Player loading
so.addVariable("flv",""); // File Name
so.addVariable("jpg","trusted.jpg"); // Preview photo
so.addVariable("autoplay","false"); // Autoplay, make true to autoplay
so.addParam("allowFullScreen","true"); // Allow fullscreen, disable with false
so.addVariable("backcolor","000000"); // Background color of controls in html color code
so.addVariable("frontcolor","ffffff"); // Foreground color of controls in html color code
so.write("flvplayer"); // This needs to be the name of the div id
/script>

Tuesday, March 29, 2011

video file upload in php

its very easy to upload a video file use normal upload codngs

$uploaddir = 'uploads/';
$uploadfile = $uploaddir.basename($_FILES['uploadedfile']['name']);

if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'],$uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
}
else {
echo "File uploading failed.\n";
}


Choose a file to upload:


but not more then 2Mb... bcoz our upload_max_filesize is only 2mb

Friday, February 11, 2011

Zend PHP-5 LAUNCHING

Andigutmans

creator and developers


Rasmus Lerdorf is the fahter of php

After that - Zeev Suraski and Andi Gutmans,

two Israeli developers at the Technion IIT,

rewrote the parser in 1997 and formed the base of PHP 3, changing the language's name to the recursive initialism, PHP: Hypertext Preprocessor.


introduction


PHP was created by Danish/Greenlandic programmer
Rasmus Lerdorf in 1994.

-Initially created a set of Perl scripts he called
'Personal Home Page Tools‘
to maintain his personal homepage.
<--

What is PHP?


PHP stands for PHP: Hypertext Preprocessor
PHP is a server-side scripting language,
PHP scripts are executed on the server
PHP supports many databases like (MySQL, Informix, Oracle, Sybase, Solid, Postgre SQL, Generic ODBC, etc.)
PHP is an open source software
PHP is free to download and use

Monday, February 7, 2011

Facebook Dominates Small Business Social Media Use

Facebook Dominates Small Business Social Media Use

cookie in php

What is a Cookie:-
Cookies are small bits of information that can be stored on a client computer. Once a cookie is created, it will expire after a specified time period. All the information stored in a cookie exist until it expires or deleted by the user.
Why we need Cookies:-
Now-a-days most of the websites use cookies to store small amounts of information. Websites can read the values from the cookies and use the information as desired. The browser is capable of keeping track of the websites and their corresponding cookies and is capable of reading the information from relevant cookies. Some common use of cookies include:
User's aesthetic preference for a specific site.
User keys to link them with their personal data - as used by many Shopping Cart Applications.
Allowing a user to remain 'logged on' until he explicitly logs out or the browser window is closed.
create a cookie
Cookies can be set using the 'setcookie' function in PHP. This function takes three arguments - name of the variable, value of the variable and the expiry time period. The syntax to set a cookie using PHP is as given below:

Syntax:setcookie("variable","value","time");

variable - name of the cookie variable
value - value of the cookie variable
time - expiry time
Example: setcookie("Test",$kris,time()+3600);

Test - cookie variable name
$kris - value of the variable 'Test'
time()+3600 - denotes that the cookie will expire after an one hour
reset/destroy a cookie
There are several ways to destroy cookies. Cookies can be deleted either by the client or by the server. Clients can easily delete the cookies by locating the Cookies folder on their system and deleting them. The Server can delete the cookies in two ways:
Reset a cookie by specifying expiry time
Reset a cookie by specifying its name only
Reset a cookie using name:
Syntax:setcookie('cookiename');
Example:setcookie("test")
Reset/Destroy a cookie using expiry time:
The cookie can be set with an expiry time while creating the cookie using the 'setcookie' function. This is also a method used to destroy cookies.
Syntax:setcookie("variable","value","time")
variable - name of the cookie variable
value - value of the cookie variable
time - expiry time