include "settings.php"; include "classes.inc"; adminaccess(); setvar("msg,category,vtitle,adcategory,vscript,videoid"); $videoid=intval($videoid); $err=new FormatMessage(); #delete ad if(isset($_GET["delvideoid"])) { $delvideoid=$_GET["delvideoid"]; $delvideo=mysqli_query($db,"delete from videolinks where videoid=".$delvideoid); alertmsg("Video link successfully deleted","videolinks"); } #new ad file if(isset($_POST["uploadfile"])) { if(empty($vtitle)) $err->add("Video Title Required."); if(empty($vscript)) $err->add("Video Preview Script Required."); if(empty($category)) $err->add("Select a Category."); if($err->isempty) { $width=0;$height=0; if(preg_match("/width=[\"]?(.*?)[\" ]/s",$vscript,$dime)) $width=$dime[1]+0; if(preg_match("/height=[\"]?(.*?)[\" ]/s",$vscript,$dime)) $height=$dime[1]+0; //resize video dimensions $maxvideowidth=305; $ratio=$width/$maxvideowidth; $height=round($height/$ratio,0); $width=$maxvideowidth; $vscript=preg_replace("/width=[\"]?(.*?)[\" ]/s","width=\"$width\"",$vscript); $vscript=preg_replace("/height=[\"]?(.*?)[\" ]/s","height=\"$height\"",$vscript); if($videoid<=0) { $newad=mysqli_query($db,"insert into videolinks(videotitle,videolink,videocategory) values('".addslashes($vtitle)."','".addslashes($vscript)."','$category');"); $newadid=mysqli_insert_id($db); alertmsg("Video Link Added","manage_videolinks?videoid=$newadid"); } else { $setlink=mysqli_query($db,"update videolinks set videotitle='".addslashes($vtitle)."',videolink='".addslashes($vscript)."',videocategory='$category' where videoid=$videoid"); alertmsg("Video Link Updated.",""); } } } include "header.php"; if(!isset($_POST["uploadfile"]) && $videoid>0) { $getdat=mysqli_query($db,"select * from videolinks where videoid=$videoid"); $dat=mysqli_fetch_object($getdat); $vtitle=stripslashes($dat->videotitle); $vscript=stripslashes($dat->videolink); $category=$dat->videocategory; } ?>