Jump to content

Mancent

Members
  • Posts

    147
  • Joined

  • Last visited

Everything posted by Mancent

  1. I have a form that a user can post a website link. I want to do a search for safe sites like youtube or google or facebook or twitter. so they submit something like this https://www.youtube.com/watch?v=qRuJ7zeyPLg I want to do a if statement that says if in post string has youtube.com it is safe else check some other safe site code until it knows its not tested or verified as being safe yet. I was thinking something like this but I am not sure if that would be correct or not or If I was on the wrong track if(preg_match("/youtube.com/",strtolower($_POST['req-domain']]))) { do something. }
  2. Well this works but I have to set safe sites up to display and be able to use scripts. This is only a traffic system to get traffic. so scripts do not need to be used. But I want to let some scripts pass. like google and youtube <?php include "connect.php"; ?> <style type="text/css"> #progressBar { position : fixed; top:0px; right:0px; width:100%; height:50px; background:#000; z-index:999999999999998; overflow:hidden; } #status8husyhdyts { position : fixed; top:0px; right:0px; width:100%; height:50px; color:#FFFFFF; font-size:24px; z-index:9999999999999999; overflow:hidden; } </style> <script type="text/javascript"> <!-- if (top.location!= self.location) { top.location = self.location.href } //--> </script> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-50245319-1', 'nettys.co'); ga('send', 'pageview'); </script> <script type="text/javascript"> window.alert = function() {}; window.onbeforeunload = function() {}; // or simply alert = function() {}; var prevent_bust = 0 window.onbeforeunload = function() { prevent_bust++ } setInterval(function() { if (prevent_bust > 0) { prevent_bust -= 2 window.top.location = 'http://www.nettys.co/traffic.php' } }, 1) </script> <progress id="progressBar" value="0" max="100"></progress> <span id="status8husyhdyts"></span> <script type="text/javascript" language="javascript"> function progressBarSim(al) { var bar = document.getElementById('progressBar'); var status = document.getElementById('status8husyhdyts'); status.innerHTML = "Please Wait While Loading Each Page "+al+"%"; bar.value = al; al++; var sim = setTimeout("progressBarSim("+al+")",250); if(al == 100){ status.innerHTML = "Please Wait While Loading Each Page 100%"; bar.value = 100; clearTimeout(sim); window.location.href = "traffic.php"; } } var amountLoaded = 0; progressBarSim(amountLoaded); </script> <?php $sql = "SELECT * FROM Traffic ORDER BY RAND() LIMIT 1 "; $querys = mysql_query($sql) or trigger_error("Query Failed: " . mysql_error()); if (mysql_num_rows($querys) == 1) { $rows = mysql_fetch_assoc($querys); $domain = $rows['domain']; $html = file_get_contents($domain); $h = explode('>', $html); foreach($h as $k => $v){ $v = trim($v);//clean it up a bit if(preg_match('/^(<script[.*]*)/ius', $v)){//my regex here might be questionable $counter = $k;//match opening tag and start counter for backtrace }elseif(preg_match('/([.*]*<\/script$)/ius', $v)){//but it gets the job done $script_length = $k - $counter; $counter = 0; for($i = $script_length; $i >= 0; $i--){ $h[$k-$i] = '';//backtrace and clear everything in between } } } for($i = 0; $i <= count($h); $i++){ if($h[$i] != ''){ $ht[$i] = $h[$i];//clean out the blanks so when we implode it works right. } } $html = implode('>', $ht);//all scripts stripped. echo $html; } else { echo "we have a error some how!"; } ?>
  3. Ok I been trying to make a traffic generator website but I ran into a problem with javascript And this page is the page that is giving me the problem https://gananciasexpress.com/rrodriguez/5.html when the loader is ready to load a new site this page send a alert message or some type of message trying to get the user to stay on his page, and no mater what button you click it redirects them to his page again. I do not want to disable javascript I just want to control the call.. I thought I could just create a function for that call I thought it would be window.onbeforeunload so I created a function for that w window.onbeforeunload = function() {}; but I just can not stop it from taking control. Can any of you help me with this This is what code I am working with trying to solve this. <?php include "connect.php"; ?> <style type="text/css"> #progressBar { position : fixed; top:0px; right:0px; width:100%; height:50px; background:#000; z-index:999999999999998; overflow:hidden; } #status { position : fixed; top:0px; right:0px; width:100%; height:50px; color:#FFFFFF; font-size:24px; z-index:9999999999999999; overflow:hidden; } </style> <script type="text/javascript"> <!-- if (top.location!= self.location) { top.location = self.location.href } //--> </script> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-50245319-1', 'nettys.co'); ga('send', 'pageview'); </script> <script type="text/javascript"> window.alert = function() {}; window.onbeforeunload = function() {}; // or simply alert = function() {}; var prevent_bust = 0 window.onbeforeunload = function() { prevent_bust++ } setInterval(function() { if (prevent_bust > 0) { prevent_bust -= 2 window.top.location = 'http://www.nettys.co/traffic.php' } }, 1) </script> <?php $sql = "SELECT * FROM Traffic ORDER BY RAND() LIMIT 1 "; $querys = mysql_query($sql) or trigger_error("Query Failed: " . mysql_error()); if (mysql_num_rows($querys) == 1) { $rows = mysql_fetch_assoc($querys); $domain = $rows['domain']; $variableee = readfile($domain); echo $variableee; } else { echo "we have a error some how!"; } ?> <progress id="progressBar" value="0" max="100"></progress> <span id="status"></span> <script type="text/javascript" language="javascript"> function progressBarSim(al) { var bar = document.getElementById('progressBar'); var status = document.getElementById('status'); status.innerHTML = "Please Wait While Loading Each Page "+al+"%"; bar.value = al; al++; var sim = setTimeout("progressBarSim("+al+")",250); if(al == 100){ status.innerHTML = "Please Wait While Loading Each Page 100%"; bar.value = 100; clearTimeout(sim); window.location.href = "traffic.php"; } } var amountLoaded = 0; progressBarSim(amountLoaded); </script> And you can test the site at http://nettys.co/traffic.php
  4. Thank you man you just made my day al lot simpler.
  5. Really that's all.. So you can also just echo $array['id'] or any of the other fields in the array That's cool if that's true.
  6. Ok thank you. So how do I convert a array into fields in php example: Im going to search for it on the web. but any example would be awesome.
  7. Ok I have the following fields set up in my sql table Id Name Pic email and the array looks like this Array ( [id] => 100001957015772 [name] => Robert Puckett [picture] => Array ( [data] => Array ( [height] => 0 [is_silhouette] => [url] => https://fbcdn-profile-a.akamaihd.net/hprofile-ak-frc1/t1.0-1/c8.0.50.50/p50x50/10251949_622143917860836_1398143136845301890_s.jpg [width] => 0 ) ) [email] => clarity-understanding@hotmail.com ) I want to store that array in to MySQL table named user_info but I do not know how! Can you guys help me and teach me how to learn arrays?
  8. I have that already this is my tests urls http://192.168.0.8/getfile.php?uid=1&mid=1&at=33c1a0d7a97493820ff4dadc42430841&security=1&f_stat=1&path=sounds/foldername/output&getfile=c6f46d45bc02173543156c552764c939.mp3 http://192.168.0.8/getfile.php?uid=1&mid=1&at=33c1a0d7a97493820ff4dadc42430841&security=1&f_stat=1&path=videos/foldername/output&getfile=c6f46d45bc02173543156c552764c939.mp4 http://192.168.0.8/getfile.php?uid=1&mid=1&at=33c1a0d7a97493820ff4dadc42430841&security=1&f_stat=1&path=images/foldername&getfile=photo-thumb-98147.jpg images work just fine with no problems what so ever on all browsers and ipad android devices I have in the house. even on the smart tv web browser. and the mp3 work perfect also.. for streaming and force download works as well for all files. but when it comes to streaming the mp4 its always getting a broken play button on chrome PC, Ipad Iphone BUt works with Firefox PC Explorer PC and the Android devices Smart Tv its strange. so I got tired of messing with it and just did a copy move temp file for each user but when it comes to mp4 it only works on some, so my solve was to move the file as a temp file in a temp folder on the webroot then read from there and it works on all devices again.
  9. ok this is tricky for me. but what isn't.. Ok I copied a file from j drive and moved it to a tempfolder on the webroot. and it is named like this 'user_'.$uid.'_'.$at.'_'.$filename so it looks more like this. user_1_33c1a0d7a97493820ff4dadc42430841_5526d9ff57503f7aa219ed112413c5f0.mp4 now what I want to do is strip the name for later I want to find only this part of the file name user_1 it will change for each user user_2 and when they login I once I get the php script to find that part of the filename. I want to delete all the files that are in the temp folder of that user if any is there. and also I want to delete the files when they are not login. or when they logout. and I would like to make a date timer also that lets the files stay in the temp folder for as long as they user is login, but if they are logout or inactive the files are removed also.. if(preg_match("/user_1/",$tempuserfile)) { I was thinking this might work but am not sure. } the reason why I am doing this is because I do not want users to be able to go to the webroot page and just get any file they want from http://192.168.0.8/filetemp/1.mp4 http://192.168.0.8/filetemp/2.mp4 http://192.168.0.8/filetemp/3.mp4 and so on.. they would have to know the users ID and that's easy it counts from 1 to what ever but they also have to know the users accesstoken for $at and they would also have to know the filename md5 code to get the files for the user that is viewing that file. and if an when or once that user is no longer viewing that file it deletes it. so its only there a very sort time. these are the only files that are public and I want to make it as secure as I can.
  10. I had to do this to make it work. Still need to add more to it,, for the different file ext. <?PHP require_once "core/connect.php"; $root_path = '../protected/accounts'; if(isset($_GET["uid"])) { if(empty($_GET["uid"])) { //RETURN TO HEADER return; } else { //DO A SELECT MYSQL TO CHECK IF USER ID IS REAL $uid = $_GET["uid"]; $sql = "SELECT * FROM accounts WHERE id = '".$uid."' LIMIT 1"; $query = mysql_query($sql) or trigger_error("Query Failed: " . mysql_error()); /* Get the users SEC */ if (mysql_num_rows($query) == 1) { $row = mysql_fetch_assoc($query); $usecurity= $row['security']; } else { return; } } } else { //RETURN TO HEADER return; } if(isset($_GET["mid"])) { if(empty($_GET["mid"])) { //RETURN TO HEADER return; } else { //DO A SELECT MYSQL TO CHECK IF USER ID IS REAL $mid = $_GET["mid"]; $sql = "SELECT * FROM accounts WHERE id = '".$mid."' LIMIT 1"; $query = mysql_query($sql) or trigger_error("Query Failed: " . mysql_error()); /* GET MY ACCESS TOKEN */ if (mysql_num_rows($query) == 1) { $row = mysql_fetch_assoc($query); $maccesstoken= $row['accesstoken']; } else { return; } } } else { //RETURN TO HEADER return; } if(isset($_GET["at"])) { if(empty($_GET["at"])) { //RETURN TO HEADER return; } else { //DO A SELECT MYSQL TO CHECK IF USER ACCESS_TOKEN IS REAL $at = $_GET["at"]; if($maccesstoken == $at) { //ALL IS GOOD RUN MORE CODE } else { return; } } } else { //RETURN TO HEADER return; } if(isset($_GET["security"])) { if(empty($_GET["security"]) && $_GET["security"]== "" ) { //RETURN TO HEADER return; } else { //DO A SELECT MYSQL TO CHECK IF USER SECURITY IS SET TO PUBLIC FOR UID $security = $_GET["security"]; if($usecurity == $security) { //ALL IS GOOD RUN MORE CODE if($security == 0) { if($uid == $mid) { //everything is ok becasue i am my self and i have my access_token } else { return; } } } else { return; } } } else { //RETURN TO HEADER return; } if(isset($_GET["f_stat"])) { if(empty($_GET["f_stat"])) { //RETURN TO HEADER return; } else { //DO A SELECT MYSQL TO CHECK IF USER UID IS FRIENDS WITH MID $f_stat = $_GET["f_stat"]; $sql = "SELECT * FROM accounts_friends WHERE uid = '".$mid."' AND mid = '".$uid."' AND status = '1' LIMIT 1"; $query = mysql_query($sql) or trigger_error("Query Failed: " . mysql_error()); if (mysql_num_rows($query) == 1) { $row = mysql_fetch_assoc($query); //ALL IS GOOD THEY ARE FRIENDS } else { //THEY ARE NOT FRIENDS YET return; } } } else { //RETURN TO HEADER return; } if(isset($_GET["path"])) { if(empty($_GET["path"])) { //RETURN TO HEADER return; } else { //DO A SELECT MYSQL TO CHECK PATH FOR USER ID $path = $_GET["path"]; } } else { //RETURN TO HEADER return; } if(isset($_GET["getfile"])) { if(empty($_GET["getfile"])) { //RETURN TO HEADER return; } else { //DO A SELECT MYSQL TO CHECK FILENAME FOR USER ID $getfile = $_GET["getfile"]; } } else { //RETURN TO HEADER return; } if(isset($_GET["thumb"])) { if(empty($_GET["thumb"])) { //RETURN TO HEADER return; } else { $thumb = $_GET["thumb"]; $mypath = $root_path.'/'.$uid.'/'.$path.'/'.$thumb.'/'.$getfile.''; if (file_exists($mypath)) { //header('Content-Type: video/mp4'); //readfile($mypath,true); } else { //RETURN TO HEADER } } } else { $mypath = $root_path.'/'.$uid.'/'.$path.'/'.$getfile.''; if (file_exists($mypath)) { $fileinfo = new finfo(FILEINFO_MIME); $mime_type = $fileinfo->file($mypath); // The function above also returns the charset, if you don't want that: // $mime_type = reset(explode(";", $mime_type)); header("Content-type: $mime_type"); $ext = pathinfo($mypath, PATHINFO_EXTENSION); if($ext == "jpg") { readfile($mypath,true); return; } if($ext == "mp3") { readfile($mypath,true); return; } if(preg_match("/chrome/",strtolower($_SERVER['HTTP_USER_AGENT'])) || preg_match("/safari/",strtolower($_SERVER['HTTP_USER_AGENT'])))//AND IPHONE IPAD AND ANY OTHER ONES THAT NEED IT { $filetemp = "filetemp"; if(!file_exists($filetemp)) { mkdir($filetemp,0777); chmod($filetemp,0777); //echo "Creating root and uid and folder"; } // Let's make sure the file exists and is writable first. if (is_writable($getfile)) { if (!$handle = fopen($getfile, 'a')) { echo "Cannot open file ($getfile)"; exit; } // Write to our opened file. if (fwrite($handle, "") === FALSE) { echo "Cannot write to file ($getfile)"; exit; } echo "Success: Added File Name $getfile To Temp Directory."; fclose($handle); } else { echo "The file $getfile is not writable"; exit(); } copy($mypath,$filetemp.'/'.$uid);//Ok so every user can have a temp file that will get over wrote each time they switch videos if they are using thier phones or ipads or some other device that can not use the getfile corny header('location: filetemp/'.$uid.''); } else { //echo $_SERVER['HTTP_USER_AGENT']; //return; if($ext == "mp4") { readfile($mypath,true); return; } echo $ext; } } else { //RETURN TO HEADER } } //http://192.168.0.8/getfile.php?uid=1&mid=1&at=33c1a0d7a97493820ff4dadc42430841&security=1&f_stat=1&path=sounds/foldername/output&getfile=c6f46d45bc02173543156c552764c939.mp3 //http://192.168.0.8/getfile.php?uid=1&mid=1&at=33c1a0d7a97493820ff4dadc42430841&security=1&f_stat=1&path=videos/foldername/output&getfile=c6f46d45bc02173543156c552764c939.mp4 //http://192.168.0.8/getfile.php?uid=1&mid=1&at=33c1a0d7a97493820ff4dadc42430841&security=1&f_stat=1&path=images/foldername&getfile=photo-thumb-98147.jpg ?>
  11. I might just go a different direction with it,, I want to store the files on the external drive,, and I was thinking I might just make a temp webroot folder that will get the file and copy it to the temp folder on the site so its local when being read, but the rest of the time its dormant. but I do not know if that is a bad idea or not, can php copy from j drive c drive temp folder? then update database to read from temp table where uid and foldername filename..
  12. my webroot is on my C drive and I have a J drive that is 3 terabyte external hard drive, that I am using to store all the files. so the getfile.php is in my root directory of the webhost C:\1.8.1xampp\htdocs\wiistream\src\getfile.php and that reads backwards to J:\protected\accounts\$uid\$foldertype\$user_custom_foldername\output\$filename.$ext $foldertype is either { images videos sounds apps docs } depending on the ext of the file that is getting uploaded decides the folder type and location. the $uid is the users ID the $user_custom_foldername is what ever the users writes as long as its is chars and no more then 30 chars long then it strips the spaces so the fodlder name can be My Adobe Software The database stores the name as is to read later but when it is makd the system saves the folder as myadobesoftware output is only for converted files its not there unless the file is a video or a sound file I use ffmpeg to convert all sound files to mp3 and to oga for different browsers supports and also video files so if the user uploads a mkv or a avi or a flv the system converts it to mp4 and to ogv the $filename sotres the real file name in database but then md5 it to a random string and the $ext gets added. the getfile.php is working reading from j drive on my PC. and on my network with my other PCs but it will not work on my Ipad or phone. I even tried putting all the files in the root directory of the webhost to see if the getfile.php still had the same problem.. and it dose.
  13. on chrome if I set the file to get it directly no going though the getfile.php the headers read out says this Request URL:http://192.168.0.8/c6f46d45bc02173543156c552764c939.mp4 Request Method:GET Status Code:206 Partial Content Request Headersview source Accept:*/* Accept-Encoding:identity;q=1, *;q=0 Accept-Language:en-US,en;q=0.8 Connection:keep-alive Host:192.168.0.8 Range:bytes=0- Referer:http://192.168.0.8/video.php User-Agent:Mozilla/5.0 (Linux; U; Android 4.0.2; en-us; Galaxy Nexus Build/ICL53F) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 Response Headersview source Accept-Ranges:bytes Connection:Keep-Alive Content-Length:484663 Content-Range:bytes 0-484662/484663 Content-Type:video/mp4 Date:Sat, 01 Mar 2014 21:02:50 GMT ETag:"76537-4f37aa22d8475" Keep-Alive:timeout=5, max=99 Last-Modified:Fri, 28 Feb 2014 17:18:59 GMT Server:Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7 now as I use the getfile.php script the header reads out says this and it will not work on chrome for some reason. Request URL:http://192.168.0.8/getfile.php?uid=1&mid=1&at=33c1a0d7a97493820ff4dadc42430841&security=1&f_stat=1&path=videos/foldername/output&getfile=c6f46d45bc02173543156c552764c939.mp4 Request Method:GET Status Code:206 Partial Content Request Headersview source Accept:*/* Accept-Encoding:identity;q=1, *;q=0 Accept-Language:en-US,en;q=0.8 Cache-Control:max-age=0 Connection:keep-alive Host:192.168.0.8 Range:bytes=0- Referer:http://192.168.0.8/video.php User-Agent:Mozilla/5.0 (Linux; U; Android 4.0.2; en-us; Galaxy Nexus Build/ICL53F) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 Query String Parametersview sourceview URL encoded uid:1 mid:1 at:33c1a0d7a97493820ff4dadc42430841 security:1 f_stat:1 path:videos/foldername/output getfile:c6f46d45bc02173543156c552764c939.mp4 Response Headersview source Accept-Ranges:0-42176997 Connection:Keep-Alive Content-Length:42176997 Content-Range:bytes 0-42176996/42176997 Content-Type:video/mp4; charset=binary Date:Sat, 01 Mar 2014 21:05:57 GMT Keep-Alive:timeout=5, max=99 Server:Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7 X-Powered-By:PHP/5.4.7
  14. <?PHP require_once "core/connect.php"; $root_path = 'protected/accounts'; if(isset($_GET["uid"])) { if(empty($_GET["uid"])) { //RETURN TO HEADER return; } else { //DO A SELECT MYSQL TO CHECK IF USER ID IS REAL $uid = $_GET["uid"]; $sql = "SELECT * FROM accounts WHERE id = '".$uid."' LIMIT 1"; $query = mysql_query($sql) or trigger_error("Query Failed: " . mysql_error()); /* Get the users SEC */ if (mysql_num_rows($query) == 1) { $row = mysql_fetch_assoc($query); $usecurity= $row['security']; } else { return; } } } else { //RETURN TO HEADER return; } if(isset($_GET["mid"])) { if(empty($_GET["mid"])) { //RETURN TO HEADER return; } else { //DO A SELECT MYSQL TO CHECK IF USER ID IS REAL $mid = $_GET["mid"]; $sql = "SELECT * FROM accounts WHERE id = '".$mid."' LIMIT 1"; $query = mysql_query($sql) or trigger_error("Query Failed: " . mysql_error()); /* GET MY ACCESS TOKEN */ if (mysql_num_rows($query) == 1) { $row = mysql_fetch_assoc($query); $maccesstoken= $row['accesstoken']; } else { return; } } } else { //RETURN TO HEADER return; } if(isset($_GET["at"])) { if(empty($_GET["at"])) { //RETURN TO HEADER return; } else { //DO A SELECT MYSQL TO CHECK IF USER ACCESS_TOKEN IS REAL $at = $_GET["at"]; if($maccesstoken == $at) { //ALL IS GOOD RUN MORE CODE } else { return; } } } else { //RETURN TO HEADER return; } if(isset($_GET["security"])) { if(empty($_GET["security"]) && $_GET["security"]== "" ) { //RETURN TO HEADER return; } else { //DO A SELECT MYSQL TO CHECK IF USER SECURITY IS SET TO PUBLIC FOR UID $security = $_GET["security"]; if($usecurity == $security) { //ALL IS GOOD RUN MORE CODE if($security == 0) { if($uid == $mid) { //everything is ok becasue i am my self and i have my access_token } else { return; } } } else { return; } } } else { //RETURN TO HEADER return; } if(isset($_GET["f_stat"])) { if(empty($_GET["f_stat"])) { //RETURN TO HEADER return; } else { //DO A SELECT MYSQL TO CHECK IF USER UID IS FRIENDS WITH MID $f_stat = $_GET["f_stat"]; $sql = "SELECT * FROM accounts_friends WHERE uid = '".$mid."' AND mid = '".$uid."' AND status = '1' LIMIT 1"; $query = mysql_query($sql) or trigger_error("Query Failed: " . mysql_error()); if (mysql_num_rows($query) == 1) { $row = mysql_fetch_assoc($query); //ALL IS GOOD THEY ARE FRIENDS } else { //THEY ARE NOT FRIENDS YET return; } } } else { //RETURN TO HEADER return; } if(isset($_GET["path"])) { if(empty($_GET["path"])) { //RETURN TO HEADER return; } else { //DO A SELECT MYSQL TO CHECK PATH FOR USER ID $path = $_GET["path"]; } } else { //RETURN TO HEADER return; } if(isset($_GET["getfile"])) { if(empty($_GET["getfile"])) { //RETURN TO HEADER return; } else { //DO A SELECT MYSQL TO CHECK FILENAME FOR USER ID $getfile = $_GET["getfile"]; } } else { //RETURN TO HEADER return; } if(isset($_GET["thumb"])) { if(empty($_GET["thumb"])) { //RETURN TO HEADER return; } else { $thumb = $_GET["thumb"]; $mypath = $root_path.'/'.$uid.'/'.$path.'/'.$thumb.'/'.$getfile.''; if (file_exists($mypath)) { header('Content-Type: video/mp4'); readfile($mypath,true); } else { //RETURN TO HEADER } } } else { $mypath = $root_path.'/'.$uid.'/'.$path.'/'.$getfile.''; if (file_exists($mypath)) { if (is_file($mypath)) { $fileinfo = new finfo(FILEINFO_MIME); $mime_type = $fileinfo->file($mypath); // The function above also returns the charset, if you don't want that: $mime_type = reset(explode(";", $mime_type)); header("Content-type: $mime_type"); //this $mime_type is not set any where and i do not know how to get it if (isset($_SERVER['HTTP_RANGE'])) { // do it for any device that supports byte-ranges not only iPhone rangeDownload($mypath); } else { header("Content-Length: ".filesize($mypath)); readfile($mypath); } } else { echo "Nothing some error"; } //$etag = md5(serialize(fstat($mypath))); //fclose($mypath); //header('Etag: '.$etag); //header('Content-Type: video/mp4'); // readfile($mypath,true); //$ext = pathinfo($mypath, PATHINFO_EXTENSION); } else { //RETURN TO HEADER } } function rangeDownload($file) { $fp = @fopen($file, 'rb'); $size = filesize($file); // File size $length = $size; // Content length $start = 0; // Start byte $end = $size - 1; // End byte // Now that we've gotten so far without errors we send the accept range header /* At the moment we only support single ranges. * Multiple ranges requires some more work to ensure it works correctly * and comply with the spesifications: http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.2 * * Multirange support annouces itself with: * header('Accept-Ranges: bytes'); * * Multirange content must be sent with multipart/byteranges mediatype, * (mediatype = mimetype) * as well as a boundry header to indicate the various chunks of data. */ header("Accept-Ranges: 0-$length"); // header('Accept-Ranges: bytes'); // multipart/byteranges // http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.2 if (isset($_SERVER['HTTP_RANGE'])) { $c_start = $start; $c_end = $end; // Extract the range string list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2); // Make sure the client hasn't sent us a multibyte range if (strpos($range, ',') !== false) { // (?) Shoud this be issued here, or should the first // range be used? Or should the header be ignored and // we output the whole content? header('HTTP/1.1 416 Requested Range Not Satisfiable'); header("Content-Range: bytes $start-$end/$size"); // (?) Echo some info to the client? exit; } // If the range starts with an '-' we start from the beginning // If not, we forward the file pointer // And make sure to get the end byte if spesified if ($range0 == '-') { // The n-number of the last bytes is requested $c_start = $size - substr($range, 1); } else { $range = explode('-', $range); $c_start = $range[0]; $c_end = (isset($range[1]) && is_numeric($range[1])) ? $range[1] : $size; } /* Check the range and make sure it's treated according to the specs. * http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html */ // End bytes can not be larger than $end. $c_end = ($c_end > $end) ? $end : $c_end; // Validate the requested range and return an error if it's not correct. if ($c_start > $c_end || $c_start > $size - 1 || $c_end >= $size) { header('HTTP/1.1 416 Requested Range Not Satisfiable'); header("Content-Range: bytes $start-$end/$size"); // (?) Echo some info to the client? exit; } $start = $c_start; $end = $c_end; $length = $end - $start + 1; // Calculate new content length fseek($fp, $start); header('HTTP/1.1 206 Partial Content'); } // Notify the client the byte range we'll be outputting header("Content-Range: bytes $start-$end/$size"); header("Content-Length: $length"); // Start buffered download $buffer = 1024 * 8; while(!feof($fp) && ($p = ftell($fp)) <= $end) { if ($p + $buffer > $end) { // In case we're only outputtin a chunk, make sure we don't // read past the length $buffer = $end - $p + 1; } set_time_limit(0); // Reset time limit for big files echo fread($fp, $buffer); flush(); // Free up memory. Otherwise large files will trigger PHP's memory limit. } fclose($fp); } ?> //http://192.168.0.8/getfile.php?uid=1&mid=1&at=33c1a0d7a97493820ff4dadc42430841&security=1&f_stat=1&path=videos/foldername/output&getfile=c6f46d45bc02173543156c552764c939.mp4 ?> using this code now nothing is working not explore or firefox or chrome or sfarai nor the ipad its trick tricky lol..
  15. I need help learning how I can debug the headers being called.On the Pc this is working just fine with quicktime installed for sarfari, But on my iphone Ipad the getfile.php readfile($path); will not work I always get a broken play button. <?PHP require_once "core/connect.php"; $root_path = 'protected/accounts'; if(isset($_GET["uid"])) { if(empty($_GET["uid"])) { //RETURN TO HEADER return; } else { //DO A SELECT MYSQL TO CHECK IF USER ID IS REAL $uid = $_GET["uid"]; $sql = "SELECT * FROM accounts WHERE id = '".$uid."' LIMIT 1"; $query = mysql_query($sql) or trigger_error("Query Failed: " . mysql_error()); /* Get the users SEC */ if (mysql_num_rows($query) == 1) { $row = mysql_fetch_assoc($query); $usecurity= $row['security']; } else { return; } } } else { //RETURN TO HEADER return; } if(isset($_GET["mid"])) { if(empty($_GET["mid"])) { //RETURN TO HEADER return; } else { //DO A SELECT MYSQL TO CHECK IF USER ID IS REAL $mid = $_GET["mid"]; $sql = "SELECT * FROM accounts WHERE id = '".$mid."' LIMIT 1"; $query = mysql_query($sql) or trigger_error("Query Failed: " . mysql_error()); /* GET MY ACCESS TOKEN */ if (mysql_num_rows($query) == 1) { $row = mysql_fetch_assoc($query); $maccesstoken= $row['accesstoken']; } else { return; } } } else { //RETURN TO HEADER return; } if(isset($_GET["at"])) { if(empty($_GET["at"])) { //RETURN TO HEADER return; } else { //DO A SELECT MYSQL TO CHECK IF USER ACCESS_TOKEN IS REAL $at = $_GET["at"]; if($maccesstoken == $at) { //ALL IS GOOD RUN MORE CODE } else { return; } } } else { //RETURN TO HEADER return; } if(isset($_GET["security"])) { if(empty($_GET["security"]) && $_GET["security"]== "" ) { //RETURN TO HEADER return; } else { //DO A SELECT MYSQL TO CHECK IF USER SECURITY IS SET TO PUBLIC FOR UID $security = $_GET["security"]; if($usecurity == $security) { //ALL IS GOOD RUN MORE CODE if($security == 0) { if($uid == $mid) { //everything is ok becasue i am my self and i have my access_token } else { return; } } } else { return; } } } else { //RETURN TO HEADER return; } if(isset($_GET["f_stat"])) { if(empty($_GET["f_stat"])) { //RETURN TO HEADER return; } else { //DO A SELECT MYSQL TO CHECK IF USER UID IS FRIENDS WITH MID $f_stat = $_GET["f_stat"]; $sql = "SELECT * FROM accounts_friends WHERE uid = '".$mid."' AND mid = '".$uid."' AND status = '1' LIMIT 1"; $query = mysql_query($sql) or trigger_error("Query Failed: " . mysql_error()); if (mysql_num_rows($query) == 1) { $row = mysql_fetch_assoc($query); //ALL IS GOOD THEY ARE FRIENDS } else { //THEY ARE NOT FRIENDS YET return; } } } else { //RETURN TO HEADER return; } if(isset($_GET["path"])) { if(empty($_GET["path"])) { //RETURN TO HEADER return; } else { //DO A SELECT MYSQL TO CHECK PATH FOR USER ID $path = $_GET["path"]; } } else { //RETURN TO HEADER return; } if(isset($_GET["getfile"])) { if(empty($_GET["getfile"])) { //RETURN TO HEADER return; } else { //DO A SELECT MYSQL TO CHECK FILENAME FOR USER ID $getfile = $_GET["getfile"]; } } else { //RETURN TO HEADER return; } if(isset($_GET["thumb"])) { if(empty($_GET["thumb"])) { //RETURN TO HEADER return; } else { $thumb = $_GET["thumb"]; $mypath = $root_path.'/'.$uid.'/'.$path.'/'.$thumb.'/'.$getfile.''; if (file_exists($mypath)) { header('Content-Type: video/mp4'); readfile($mypath,true); } else { //RETURN TO HEADER } } } else { $mypath = $root_path.'/'.$uid.'/'.$path.'/'.$getfile.''; if (file_exists($mypath)) { header('Content-Type: video/mp4'); readfile($mypath,true); //$ext = pathinfo($mypath, PATHINFO_EXTENSION); } else { //RETURN TO HEADER } } I been doing searching about this problem and I see some have the same problem and I found this article but nothing I do works http://mobiforge.com/design-development/content-delivery-mobile-devices
  16. there is nothing wrong with it at all,, the problem I was having was I didn't have quicktime installed on my pc.. Im a windows user and safari is a mac browser, so quicktime was required to play videos as html5 in a windows safari browser on windows.
  17. anyone know the trick for safari.. If I make a just a basic page <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <?php header("Content-Type: video/mp4"); ?> </head> <body> </body> </html> and I go to it in safari browser it wants to download a file.. any ideas how to work around that?
  18. Ok this works for explore and chrome and firefox but not Safari ill do some searching to see what is needed for Safari so it works with that also
  19. Ok so I have to just get the file type and then tell each type the correct header to call. so cool thank you for the help.
  20. Ok I am storing the files behind the web in a file system. and I am using a getfile.php to read the file. I pass some checks so only the user can get the file unless they have friends and the string looks like this http://192.168.0.8/getfile.php?uid=1&mid=1&at=33c1a0d7a97493820ff4dadc42430841&security=1&f_stat=1&path=/videos/foldername/output/&getfile=7f7c351ee977c765aa8cd5c7020bc38f.mp4 No when I go to that page it is reading the file as text not as a mp4 I thought that the html5 video el would know its a mp4 from the http link provided <video src="getfile.php?uid=1&mid=1&at=33c1a0d7a97493820ff4dadc42430841&security=1&f_stat=1&path=/videos/foldername/output/&getfile=c6f46d45bc02173543156c552764c939.mp4" controls></video> but is not working what can I do to make it work the files are stored here C:\1.8.1xampp\htdocs\wiistream\protected\accounts\1\videos\foldername\output and the webhost is stored here C:\1.8.1xampp\htdocs\wiistream\src\index.php
  21. this right here <ul id="source_videos"> <button type="text" data-filename="<?php echo $file; ?>" data-fkey="<?php echo hash('crc32', time() . $file, false); ?>"> </button> </ul> works just fine when the user click on the button, but I am trying to make it so it is auto no click is needed. and that's running this line right here $(document).ready(function(){ $('#source_videos button').click(function(){ convertVideo($(this)); }); }); so I thought it would be easy enough to just make it auto by using the ready function not the click $(document).ready(function(){ $('#source_videos button').ready(function(){ convertVideo($(this)); }); }); but doing that I always get a error. in the convertVideo function error message.
  22. Ok this is what I got so far, if I set this to $(document).ready(function(){ $('#source_videos button').ready(function(){ convertVideo($(this)); }); }); I thought it would just be as if it was the same as the click, but its not and it always fails. I am trying to make the page function automatically with no click at all, but just if the page is called, it then starts to convert the file. can any one help with this? <?php require 'config.php'; require 'functions.php'; $uid = "1000"; ?> <script src="http://code.jquery.c...in.js"></script> <script src="./js/jquery.percentageloader-0.1.js"></script> <script src="./js/jquery.timer.js"></script> <?php foreach(_source_files() as $file) { $ext = pathinfo($file, PATHINFO_EXTENSION); }?> <script>jsNS = {'base_url' : '<?php echo BASE_URL; ?>', 'post_url' : '<?php echo POST_URL.'?uid='.$uid.'&ext='.$ext.''; ?>'}</script> <script> (function($){ var fkey, topLoader, startstopTimer, startstopCurrent = 0;; var fkeys=[]; // Padding function function pad(number, length) { var str = '' + number; while (str.length < length) {str = '0' + str;} return str; } // Initialize the progress loader $(function(){ topLoader = $("#progress").percentageLoader({ width : 150, height : 150, controllable : false, value : '00:00:00', progress : 0, onProgressUpdate : function(val) { topLoader.setValue(Math.round(val * 100.0)); } }); }); function convertVideo(el){ var filename = el.data('filename'); fkey = el.data('fkey'); var params = $('#ffmpeg_params').val(); fkeys.push(fkey); $.ajax(jsNS.post_url, { type : 'POST', dataType : 'json', async : false, data : { 'filename' : filename, 'fkey' : fkey, 'type' : 'convert', 'params' : params }, success : function(data){ startPolling(data); }, error : function(){ alert('Request failed!'); } }); } function pollStatus(fkey){ var statusData; $.ajax(jsNS.post_url, { type : 'POST', dataType : 'json', async : false, data : { 'fkey' : fkey, 'type' : 'status' }, success : function(data){ statusData = data; }, error : function(){ alert('Polling failed!'); statusData = false; } }); return statusData; } function startPolling(data){ var currentTime, totalTime, hrCurrentTime, hrTotalTime, statData, intPoll, timer, count; count = 0; currentTime = data.time_encoded; totalTime = data.time_total; timer = $.timer(function() { var min = parseInt(startstopCurrent/6000); var sec = parseInt(startstopCurrent/100)-(min*60); var micro = pad(startstopCurrent-(sec*100)-(min*6000),2); var output = "00"; if(min > 0) {output = pad(min,2);} topLoader.setValue(output+":"+pad(sec,2)+":"+micro); startstopCurrent+=7; }, 70, true); timer.play(); intPoll = setInterval(function(){ if( currentTime < totalTime ) { statData = pollStatus(fkey, currentTime); //console.log(statData); if( !statData ){ alert('Bad data!'); //console.log(statData); clearInterval(intPoll); return false; } currentTime = statData.time_encoded; totalTime = statData.time_total; hrCurrentTime = statData.time_encoded_min; hrTotalTime = statData.time_total_min; topLoader.setProgress(currentTime / totalTime); } else { timer.stop(); clearInterval(intPoll); //lets clean up the data delete the old file and move the new file to location then update the database $.post("../../rfi.php", { name:"Donald Duck", city:"Duckburg" }, function(data,status){ //alert("Data: " + data + "\nStatus: " + status); alert('Finished!'); }); } },1000); } $(document).ready(function(){ $('#source_videos button').click(function(){ convertVideo($(this)); }); }); })(jQuery); </script> <div id="progress"></div> <ul id="source_videos"> <button type="text" data-filename="<?php echo $file; ?>" data-fkey="<?php echo hash('crc32', time() . $file, false); ?>"> </button> </ul> <?php if(($ext == "wav") || ($ext == "mpeg") || ($ext == "mp3")) { ?> <textarea cols="120" rows="3" id="ffmpeg_params" style="visibility:hidden">-acodec mp3 -ac 2 -ab 128 </textarea> <?php } else if(($ext == "avi") || ($ext == "flv") || ($ext == "mkv") || ($ext == "wmv") || ($ext == "mov") || ($ext == "mp4") || ($ext == "3gp")) { ?> <textarea cols="120" rows="3" id="ffmpeg_params" style="visibility:hidden">-acodec libvo_aacenc -ac 2 -ab 128 -ar 22050 -s 900x500 -vcodec libx264 -fpre "<?php echo BASE_PATH; ?>ffmpeg\presets\libx264-ipod640.ffpreset" -b 600k -f mp4 -threads 0</textarea> <?php } ?> <!-- Makes mp4 video nice qulity -acodec libvo_aacenc -ac 2 -ab 128 -ar 22050 -s 900x500 -vcodec libx264 -fpre "ffmpeg\presets\libx264-ipod640.ffpreset" -b 600k -f mp4 -threads 0 Makes mp3 audio nice qulity -acodec mp3 -ac 2 -ab 128 todo find ogg for oprea browser support command line for oga audio and ogv video. -->
  23. you could echo <meta property="og:title" content="<?php echo $_GET['$title']; ?>"/>
  24. do you also have the popupbox.htm created? so your sending a var un the address bar. http://somewebsite.com/index.php?mVar=1 everything pop up just fine on PC I and my IPHONE
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.