include("../includes/common.htm");
if ($instruction) {
$msg="Instruction:
To get youtube link, copy the link from your youtube's page.
or copy link by clicking on share button.
";
}
if (!$fid) { print "You must login to edit video!"; exit; }
if (($fid) && ($status=='save') && ($videolink!='')) {
if ((!eregi("embed",$videolink)) && (eregi("youtu",$videolink))) {
$vstr=explode('/',$videolink);
foreach ($vstr as $name => $value) { if ($value!='') $vlink=$value; }
$vlink=preg_replace("/\&.*/","",$vlink);
$vlink=preg_replace("/watch\?v\=/","",$vlink);
if ($vlink!='') { $videolink="http://www.youtube.com/embed/" . $vlink; } else { $videolink=""; }
if (!eregi("embed",$videolink)) { $msg="Invalid youtube link
How do i get youtube link?"; }
else if ($admin) { print "parsed: $videolink
"; }
}
if (eregi("youtu",$videolink)) {
$qry="select * from lerage_video where pid='$fid' and MyVideo='$videolink'";
$rec=SelectQry($qry);
if (count($rec)==0) { $update="insert into lerage_video (pid,pjob,MyVideo,`date`,title,note) values ('$fid','$job','$videolink','$current_datetime','$title','$videonote')"; }
else if ($eid!='') { $update="update lerage_video set MyVideo='$videolink',title='$title',note='$videonote',`date`='$current_datetime' where pid='$fid' and id='$eid'";
}
$eid="";
/* update network */
if (count($rec)==0) {
$datecheck="select `date` from lerage_network where pid='$fid' and pjob='$job' and type='video' and `date` like '$current_date%' ";
$daterec=SelectQry($datecheck);
if (count($daterec)==0) {
$post="just uploaded new video";
$updatenetwork="insert into lerage_network (pid,pjob,MyPost,type,`date`) values ('$fid','$job','$post','video','$current_datetime')";
$updatenetworkrec = mysql_query("$updatenetwork");
}
}
//if ($admin) print "$update
";
$updaterec = mysql_query("$update") or $msg="Unable to update, contact admin.
";
//if ($admin) print mysql_error(). "
";
if ($updaterec!='') { $msg="Link successfully updated."; }
} else { $msg="This does not appear to be a youtube video: $videolink
At the moment, we can only post youtube video.
"; }
}
if (($eid) && ($status!='save')) {
$cqry="select pid,MyVideo,title,note from lerage_video where pid='$fid' and id='$eid'";
$crec=SelectQry($cqry);
}
if ($delid!="") {
$dqry="delete from lerage_video where pid='$fid' and id='$delid'";
$delrec = mysql_query("$dqry") or $msg="Unable to remove video, contact admin.
";
if ($delrec!='') { $msg="Video successfully removed."; }
$updatenetwork="delete from lerage_network where type='video' and objectid='$delid'";
$updatenetworkrec = mysql_query("$updatenetwork");
}
?>