im new in php and im trying to make a little website using my own scripts but its really hard. but i try to do my best... so my question its i was searching and searching and i didn't found a solution to add video YouTube to my website, not that all i need a function to add video like . INSERT link into my database and show video in my personal page is it possible ? if yes please reply for me because i really want this script .. for making my website more Professional.
this is exemple what i need :
- Code: Select all
<?php
// array of youtube videos
$video = array('o0jCbDPKFVo');
// make sure "v" parameter is sanitized
@$v = preg_replace("/[^A-Za-z0-9\-\_]/","",$_GET["v"]);
//check if parameter "v" is empty and is yours video
if(!empty($v) && in_array($v,$video)){
echo('<center><object width="480" height="250"><param name="movie" value="http://www.youtube.com/v/'.$v.'&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'.$v.'&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="370" height="190"></embed></object></center>');
}else{
foreach($video as $v){
echo('<a href="videos.php?v='.$v.'"><img style="border:1px solid #000;margin:4px;"width="80" height="80" alt="" src="http://i1.ytimg.com/vi/'.$v.'/default.jpg"/></a>');
}
}
?>
but i want to change this :
$video = array('o0jCbDPKFVo');
to this for insert $youtube link to database but its not working :
$video = array('$youtube');
thanks for all who will reply for me..
my best reguard : Free Syrian Man


