-
Posts
1,301 -
Joined
-
Last visited
Content Type
Forums
News
20th
EduGeek EDIT Conference
Blogs
Everything posted by Marci
-
Righty... so as it currently stands... error_reporting(E_ALL); ini_set("session.gc_maxlifetime","10800"); $allowable_ext = array('avi','mpg','mov','wmv'); $pieces = explode('.', $_FILES['userfile']['name']); $ext = $pieces[count($pieces) - 1]; if(!in_array($ext, $allowable_ext)) { echo "Invalid filetype - you may only upload files smaller than 100Mb which end in .mpg, .avi, .wmv or .mov.\n"; exit; } $uploaddir = '/UPLOADPATH/'; $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); $origname = basename($_FILES['userfile']['name']); $newname = substr($origname, 0, -4); $newfile = $uploaddir . $newname; $uf = escapeshellcmd($uploadfile); $nf = escapeshellcmd($newfile); if ((($_FILES['userfile']['type'] == "video/mpeg") || ($_FILES['userfile']['type'] == "video/msvideo") || ($_FILES['userfile']['type'] == "video/quicktime") || ($_FILES['userfile']['type'] == "video/x-ms-wmv")) && ($_FILES['userfile']['size'] < 104857600)) { echo ''; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.\n"; } else { echo "File upload was unsuccesful.\n"; } if (chmod($uploadfile, 0744)) { echo "CHMOD was succesful. \n"; } else { echo "CHMOD failed. File is executable. \n"; } $last_line = system('ffmpeg -i '.$uf.' '.$nf.'.flv', $retval); $last_line = system('cat '.$nf.'.flv | flvtool2 -U stdin '.$nf.'.flv', $retval); exec('rm '.$uf.''); echo 'Here is some more debugging info:'; print_r($_FILES); print ""; } else { echo "Invalid filetype - you may only upload files smaller than 100Mb which end in .mpg, .avi or .mov.\n"; } ?>
-
Heh - getting beyond me fella... show me in code I can copy and paste... But anyhoo, this'll be a closed system accessible only to teachers here that know the password... there's a step that CHMODs the uploaded file to prevent it being executable in the case of a php file being uploaded, but mimetype restricts phps from going up (hardly a concrete infallible method, but works for a restricted userbase)... The rest of the system is as follows at the mo. This scans folder and outputs an XML playlist... there's a separate one for each folder involved... and a separate folder for each subject area. $filter = ".flv"; $directory = "SUBJECT/"; //<< ie: Eng / Maths / Science etc... $site = "http://www.site.com/video/"; @$d = dir($directory); if ($d) { while($entry=$d->read()) { $ps = strpos(strtolower($entry), $filter); if (!($ps === false)) { $items[] = $entry; } } $d->close(); sort($items); } header("content-type:text/xml;charset=utf-8"); echo "\n"; echo " SUBJECT Media Playlist\n"; echo " http://www.site.com\n"; echo " \n"; foreach($items as $value) { $title = preg_replace('/.flv/', '', $value); $title = preg_replace('/_/', ' ', $title); print " \n"; print " " . $title . "\n"; print " " . $site . '/video/' . $directory . '/' . $value . "\n"; print " \n"; } echo " \n"; echo "\n"; ?> And embedding the mediaplayer and calling the playlist: Please enable Javascript to use our Media Player <br /> var so = new SWFObject('http://www.site.com/video/mediaplayer.swf','mpl','620','260','8');<br /> so.addParam('allowscriptaccess','always');<br /> so.addParam('allowfullscreen','true');<br /> so.addVariable('height','260');<br /> so.addVariable('width','620');<br /> so.addVariable('file','http://www.site.com/video/PLAYLIST.php'); // <<playlist.php = the code above<br /> so.addVariable('backcolor','0x000000');<br /> so.addVariable('frontcolor','0xffffff');<br /> so.addVariable('lightcolor','0xffffff');<br /> so.addVariable('displayheight','240');<br /> so.addVariable('displaywidth','350');<br /> so.addVariable('overstretch','fit');<br /> so.addVariable('showstop','true');<br /> so.addVariable('showdownload','false');<br /> so.addVariable('repeat','list');<br /> so.write('player');<br /> The player is from This site and the JW Player
-
Outputfilename sorted... ended up using substr()... error_reporting(E_ALL); ini_set("session.gc_maxlifetime","10800"); $uploaddir = '/home/horbury/public_html/beta/dynamic/push/incoming/'; $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); $origname = basename($_FILES['userfile']['name']); $newname = substr($origname, 0, -4); $newfile = $uploaddir . $newname; if ((($_FILES['userfile']['type'] == "video/mpeg") || ($_FILES['userfile']['type'] == "video/msvideo") || ($_FILES['userfile']['type'] == "video/quicktime") || ($_FILES['userfile']['type'] == "video/x-ms-wmv")) && ($_FILES['userfile']['size'] < 104857600)) { echo ''; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.\n"; } else { echo "File upload was unsuccesful.\n"; } if (chmod($uploadfile, 0744)) { echo "CHMOD was succesful. \n"; } else { echo "CHMOD failed. File is executable. \n"; } $last_line = system('ffmpeg -i '.$uploadfile.' '.$newfile.'.flv', $retval); $last_line = system('cat '.$newfile.'.flv | flvtool2 -U stdin '.$newfile.'.flv', $retval); exec('rm '.$uploadfile.''); echo 'Here is some more debugging info:'; print_r($_FILES); print ""; } else { echo "Invalid filetype - you may only upload files smaller than 100Mb ending in .mpg, .avi or .mov.\n"; } ?> Progress bar.... hmmm.... next job!
-
Ta muchly!! So, processupload.php now reads as follows: error_reporting(E_ALL); ini_set("session.gc_maxlifetime","10800"); $uploaddir = '/home/horbury/public_html/beta/dynamic/push/incoming/'; $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); if ((($_FILES['userfile']['type'] == "video/mpeg") || ($_FILES['userfile']['type'] == "video/msvideo") || ($_FILES['userfile']['type'] == "video/quicktime") || ($_FILES['userfile']['type'] == "video/x-ms-wmv")) && ($_FILES['userfile']['size'] < 104857600)) { echo ''; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.\n"; } else { echo "File upload was unsuccesful.\n"; } if (chmod($uploadfile, 0744)) { echo "CHMOD was succesful. \n"; } else { echo "CHMOD failed. File is executable. \n"; } $last_line = system('ffmpeg -i '.$uploadfile.' '.$uploadfile.'.flv', $retval); $last_line = system('cat '.$uploadfile.'.flv | flvtool2 -U stdin '.$uploadfile.'.flv', $retval); exec('rm '.$uploadfile.''); echo 'Here is some more debugging info:'; print_r($_FILES); print ""; } else { echo "Invalid filetype - you may only upload files smaller than 100Mb ending in .mpg, .avi or .mov.\n"; } ?> Am still working on the outputfilename issue... will let you know! I do have a further issue but that's unrelated - for some reason files over a certain size won't upload despite restrictions on the form and php being set to 100Mb, and max uploads and max posts being set to 100M in php.ini Will concentrate on that one later!
-
Wotcha folks - have been on a mini mission of late writing a media library for the school's website. Basically I got sick of callouts to install blah codec to play blah video etc, so decided to shunt everything over to FLV thru the browser. We're using a FreeBSD (with WHM / cPanel) server, and I've got Lame / ffMpeg / FLVTool2 running happily to convert files on the fly and add MetaData. I'm now trying to automate the process so that authorised users can upload their own videos, which the server will then convert and relocate. Now, my PHP skills are limited... I know how to do what I can already do, but beyond that I hit brick walls rapidly. I've got a working system in place already that scans directories for FLVs and builds playlists which then feed into JWPlayer so the whole streaming / playback side is fine. The issue now rests with getting the files on there and converted... in the past this has been done on my workstation and I've then ftp'd them up to the server, but I'm after an easier way. Here's what I've got at the moment... The Upload Form: </pre><form enctype="multipart/form-data" action="processupload.php" method="POST"> Send this file: < processupload.php: error_reporting(E_ALL); ini_set("session.gc_maxlifetime","10800"); $uploaddir = '/INCOMINGPATH/'; $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); echo ''; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.\n"; } else { echo "File upload was unsuccesful.\n"; } if (chmod($uploadfile, 0744)) { echo "CHMOD was succesful. \n"; } else { echo "CHMOD failed. File is executable. \n"; } $last_line = system('ffmpeg -i '.$uploadfile.' '.$uploadfile.'.flv', $retval); $last_line = system('cat '.$uploadfile.'.flv | flvtool2 -U stdin '.$uploadfile.'.flv', $retval); exec('rm '.$uploadfile.''); echo 'Here is some more debugging info:'; print_r($_FILES); print ""; ?> Now, here are my issues. 1 - I need it to limit the filetypes that can be uploaded to mpg, avi or mov... 2 - The filename of the flv file produced is currently originalfilename.originalextension.flv - I need to lose the original extension... Any assistance would be immensely appreciated!
-
"Cannot find ldap.h" is the error I receive... Now, investigation shows this to usually be caused by lack of openldap-devel on Linux boxes... however, there is no ldap devel in the FreeBSD Ports Tree that I can find... The instructions I'm going off are as follows: They're the only step-by-steps I could find for the recompile, and they're for Linux. So, replace rpm with equivalent port. Rest is as per the instructions... except for that darn lack of ldap-devel... See cPanel Forums (where I got little response). Searching for openldap in the wHm ports installer presents me with the following (no devel): Searching for Ports... Click on the path to the port to install it! Port: openldap-client-2.3.42 Path /usr/ports/net/openldap23-client Info: Open source LDAP client implementation Maint: [email protected] B-deps: libtool-1.5.26 R-deps: WWW: http://www.OpenLDAP.org/ Port: openldap-sasl-client-2.3.42 Path /usr/ports/net/openldap23-sasl-client Info: Open source LDAP client implementation with SASL2 support Maint: [email protected] B-deps: cyrus-sasl-2.1.22_1 libtool-1.5.26 R-deps: cyrus-sasl-2.1.22_1 WWW: http://www.OpenLDAP.org/ Port: openldap-server-2.3.42 Path /usr/ports/net/openldap23-server Info: Open source LDAP server implementation Maint: [email protected] B-deps: db44-4.4.20.4 libltdl-1.5.26 libtool-1.5.26 openldap-client-2.3.42 R-deps: db44-4.4.20.4 libltdl-1.5.26 openldap-client-2.3.42 WWW: http://www.OpenLDAP.org/ Port: openldap-client-2.4.10 Path /usr/ports/net/openldap24-client Info: Open source LDAP client implementation Maint: [email protected] B-deps: libtool-1.5.26 R-deps: WWW: http://www.OpenLDAP.org/ Port: openldap-sasl-client-2.4.10 Path /usr/ports/net/openldap24-sasl-client Info: Open source LDAP client implementation with SASL2 support Maint: [email protected] B-deps: cyrus-sasl-2.1.22_1 libtool-1.5.26 R-deps: cyrus-sasl-2.1.22_1 WWW: http://www.OpenLDAP.org/ Port: openldap-server-2.4.10 Path /usr/ports/net/openldap24-server Info: Open source LDAP server implementation Maint: [email protected] B-deps: db46-4.6.21.1 libltdl-1.5.26 libtool-1.5.26 openldap-client-2.4.10 R-deps: db46-4.6.21.1 libltdl-1.5.26 openldap-client-2.4.10 WWW: http://www.OpenLDAP.org/
-
Anyone here managed to succesfully set up Moodle LDAP authentication on a FreeBSD Server? Here's the outline... FreeBSD Server running cPanel / WHM 11, hosting several websites (both internal and external). Moodle currently uses manual authentication. We want to get it setup so that Moodle authenticates from our MS-AD database running on our Forest Root. Problem - what ports do I need to install before I can recompile PHP with LDAP? At the moment it just fails... Have found instructions for Linux rpms, but they're useless to me... Can find plenty of instructions for Windows-based servers, but again, useless to me...
-
Does the issue occur in safemode?
