Jump to content

batstanggt

Members
  • Posts

    129
  • Joined

  • Last visited

    Never

Everything posted by batstanggt

  1. batstanggt

    Media Players

    Hey Im not sure if this is the right place to post this. What i want to do is have a multimedia open in a new window inside a "flash" player such as JW Player or Flowplayer. I have no idea how to go about doing this right now so any help would be great. The media is stored on a server and the location to the files are stored in a mysql database so i need to integrate that element as well instead of hardcoding the location of the files. Also do these files need to be saved as .flv files in order to play? Any help, tips or recomendations would be great!
  2. So I cant connect to my server through any FTP client which in doing some reading leads me to beleive that my ip address has been blocked by trying to many incorrect logins? As i mentioned though it is a home server and I dont think I set anything up like that myself so unless debian/linux has that as a default setting....Anyways thanks for teh help so far but im still stuck. -SB
  3. The server is my own homer server. And I checked and all the aforementioned boxes etc. are ticked. Any other suggestions? -SB
  4. Hey guys I have an upload script that works fine (so far) but once I go back into my Dreamweaver and try to upload a page to my server it says that it cannot connect to the server and that I have the wrong password (absolutely do not). I know this because I uninstalled and re-installed dreamweaver because I thought thats where the problem was but it appears be caused by uploading files through internet explorer while testing my script. What would cause this? Any Ideas how to fix it? I googled the heck outta the topic and its way to specific of an experience so im hope you guys could help me out. Thanks. -SB
  5. OK i give in. Im not doing the blob thing anymore can anyone maybe explain or point me in the direction of the method neil suggested ? -SB
  6. Well this is a particular question regarding the suhosin settings i see people crying all the time on forums about not staying on topic etc. Sorry. But if anyone else is interested in actually answer one of my 4 questions it qould fantastaic . -SB
  7. Hey guys so Ive been messing with a number of .ini files (im sure this isnt a good thing) because Ive been trying to write a script that uploads files as big as 1GB and in doing so Ive edited the my suhosin.ini because in looking at my php_info() it said that all my pot max, get max, request etc were all undesirably low. Anyways I edited the file and then restarted apache but the changes that I made in suhosin.ini arent being displayed when i go to my php_info(). Cant anyone tell me if I missed a step and how do I get the server to recognize the changes as I believe it is these settings that are buggering up my upload script. -SB
  8. Hey neil thanks for responding...I do indeed want to store the files in LONGBLOB format inside my mysql database. I have done so quite happily with the exact script on other sites for uppload pictures and as i mentioned it works on some videos as large as 18mb (perhaps larger i just dont have a video between 18 and 24mb). I checked my phpinfo() and my suhosin limits were all undesirably low so modified them n restarted apache but its not detecting the changes when i reload phpinfo(). Thoughts? -SB
  9. Hey thanks for the reply. First question whats an envrionment variable? Second, I am hosting this on a homemade LAMP server. Heres the code. upload.php $db_host = 'localhost'; // don't forget to change $db_user = 'root'; $db_pwd = 'dbpass'; $database = 'dbname'; $table = 'videos'; // use the same name as SQL table $password = '123'; // simple upload restriction, // to disallow uploading to everyone if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can't connect to database"); if (!mysql_select_db($database)) die("Can't select database"); // This function makes usage of // $_GET, $_POST, etc... variables // completly safe in SQL queries function sql_safe($s){ if (get_magic_quotes_gpc()) $s = stripslashes($s); return mysql_real_escape_string($s);} // If user pressed submit in one of the forms if ($_SERVER['REQUEST_METHOD'] == 'POST'){ // cleaning title field $title = trim(sql_safe($_POST['title'])); if ($title == '') // if title is not set $title = '(empty title)'; // use (empty title) string if ($_POST['password'] != $password)// cheking passwors $msg = 'Error: wrong upload password'; else { if (isset($_FILES['movie'])) { list(, , $mtype, ) = getimagesize($_FILES['movie']['tmp_name']); // Get file type. // We use @ to omit errors { $data = file_get_contents($_FILES['movie']['tmp_name']); $data = mysql_real_escape_string($data); // Preparing data to be used in MySQL query mysql_query("INSERT INTO {$table} SET title='$title', movie='$data'"); $msg = 'Success: Video uploaded'; } } elseif (isset($_GET['title'])) // isset(..title) needed $msg = 'Error: file not loaded'; // to make sure we've using // upload form, not form // for deletion if (isset($_POST['del'])) // If used selected some video to delete { // in 'uploaded videos form' $id = intval($_POST['del']); mysql_query("DELETE FROM {$table} WHERE id=$id"); $msg = 'Video deleted'; } } } elseif (isset($_GET['show'])){ $id = intval($_GET['show']); $result = mysql_query("SELECT id, UNIX_TIMESTAMP(movie_time), movie FROM {$table} WHERE id=$id LIMIT 1"); if (mysql_num_rows($result) == 0) die('no video'); list($ext, $movie_time, $data) = mysql_fetch_row($result); $send_304 = false; if (php_sapi_name() == 'apache') { // if our web server is apache // we get check HTTP // If-Modified-Since header // and do not send image // if there is a cached version $ar = apache_request_headers(); if (isset($ar['If-Modified-Since']) && // If-Modified-Since should exists ($ar['If-Modified-Since'] != '') && // not empty (strtotime($ar['If-Modified-Since']) >= $movie_time)) // and grater than $send_304 = true; // image_time } if ($send_304) { // Sending 304 response to browser // "Browser, your cached version of image is OK // we're not sending anything new to you" header('Last-Modified: '.gmdate('D, d M Y H:i:s', $ts).' GMT', true, 304); exit(); // bye-bye } // outputing Last-Modified header header('Last-Modified: '.gmdate('D, d M Y H:i:s', $movie_time).' GMT', true, 200); // Set expiration time +1 year // We do not have any photo re-uploading // so, browser may cache this photo for quite a long time header('Expires: '.gmdate('D, d M Y H:i:s', $movie_time + 86400*365).' GMT', true, 200); // outputing HTTP headers header('Content-Length: '.strlen($data)); header("Content-type: video/mpeg"); // outputing book echo $data; exit(); } ?> <head> <title>MySQL Blob video Gallery Example</title> <link rel="stylesheet" type="text/css" href="test.css"/> </head> <html> <body> <?php if (isset($msg)) // this is special section for // outputing message { ?> <p style="font-weight: bold;"><?=$msg?><br><a href="<?=$_SERVER['PHP_SELF']?>">reload page</a><!-- I've added reloading link, because refreshing POST queries is not good idea --></p> <?php } ?> <h1>Videos</h1> <h2>Uploaded Videos:</h2> <form action="<? $_SERVER['PHP_SELF'] ?>" method="post"> <!-- This form is used for video deletion --> <?php $result = mysql_query("SELECT id, movie_time, title FROM {$table} ORDER BY id DESC"); if (mysql_num_rows($result) == 0) // table is empty echo '<ul><li>No Videos Loaded</li></ul>'; else{ echo '<ul>'; while(list($id, $movie_time, $title) = mysql_fetch_row($result)) { // outputing list echo "<li><input type='radio' name='del' value='{$id}'>"; echo "<a href='{$_SERVER['PHP_SELF']}?show={$id}'>{$title}</a> – "; echo "<small>{$movie_time}</small></li>"; } echo '</ul>'; echo '<label for="password">Password:</label><br>'; echo '<input type="password" name="password" id="password"><br><br>'; echo '<input type="submit" value="Delete selected">'; } ?> <html> <body> </form><h2>Upload New Video:</h2><form action="<? $_SERVER['PHP_SELF'] ?>" method="POST" enctype="multipart/form-data"> <INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="100000000"> <label for="title">Title:</label><br><input type="text" name="title" id="title" size="64"><br> <br> <label for="movie">Video:</label><br><input type="file" name="movie" id="movie"><br> <br> <label for="password">Password:</label><br><input type="password" name="password" id="password"><br> <br><input type="submit" value="upload"></form> </body> </html> -SB
  10. When I upload files larger than appx 18M it says that the file was uploaded but it isnt. Is there snippet of code that i could put in the script to show me the upload error ? Or does anyone know what could be causing this. My php.ini settings are as follows max upload size = 50M max post size = 100M execution time = 2400 input time = 2400 I thought initially maybe it was timing out so i increased the input and the execution time value. But its still doing the same thing. -SB
  11. OK so I think i restarted mysql and so now I cant connect to my databases or my phpmyadmin which is why my site is not working now. Does anyone know how to fix this so i can get back to banging my head against the wall with my upload script thanks guys. -SB
  12. I accidently restarted MySql and now none of my scripts will connect to the database and I can t even access my phpmyadmin either. I was able to find all my data on the hard drive so its not gone, and I also found config files that confirm that I am using the right login info but in the case of my script and phpmyadmin the pages just refresh and dont actually log me in. Please help this is a major setback. -SB
  13. So now since ive beebn screwing around with the pho.ini etc none of my site works. I would really appreciate some help or im screwed since now the whole site is effed. -SB
  14. Anybody have any insight? -SB
  15. Sorry for the delay guys... the error Fatal error: Out of memory (allocated 524288) (tried to allocate 804524032 bytes) in /var/www/movieupload.php on line 36. the script movieupload.php <?php ini_set("display_errors", "1");error_reporting(-1); $db_host = 'localhost'; // don't forget to change $db_user = 'root'; $db_pwd = 'dbpwd'; $database = 'dbname'; $table = 'movies'; // use the same name as SQL table $password = '123'; // simple upload restriction, // to disallow uploading to everyone if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can't connect to database"); if (!mysql_select_db($database)) die("Can't select database"); // This function makes usage of // $_GET, $_POST, etc... variables // completly safe in SQL queries function sql_safe($s){ if (get_magic_quotes_gpc()) $s = stripslashes($s); return mysql_real_escape_string($s);} // If user pressed submit in one of the forms if ($_SERVER['REQUEST_METHOD'] == 'POST'){ // cleaning title field $title = trim(sql_safe($_POST['title'])); if ($title == '') // if title is not set $title = '(empty title)'; // use (empty title) string if ($_POST['password'] != $password)// cheking passwors $msg = 'Error: wrong upload password'; else { if (isset($_FILES['movie'])) { @list(, , $mtype, ) = getimagesize($_FILES['movie']['tmp_name']); // Get file type. // We use @ to omit errors { $data = file_get_contents($_FILES['movie']['tmp_name']); $data = mysql_real_escape_string($data); // Preparing data to be used in MySQL query mysql_query("INSERT INTO {$table} SET title='$title', movie='$data'"); $msg = 'Success: movie uploaded'; } } elseif (isset($_GET['title'])) // isset(..title) needed $msg = 'Error: file not loaded'; // to make sure we've using // upload form, not form // for deletion if (isset($_POST['del'])) // If used selected some photo to delete { // in 'uploaded images form' $id = intval($_POST['del']); mysql_query("DELETE FROM {$table} WHERE id=$id"); $msg = 'Movie deleted'; } } } elseif (isset($_GET['show'])){ $id = intval($_GET['show']); $result = mysql_query("SELECT id, UNIX_TIMESTAMP(movie_time), movie FROM {$table} WHERE id=$id LIMIT 1"); if (mysql_num_rows($result) == 0) die('no song'); list($ext, $movie_time, $data) = mysql_fetch_row($result); $send_304 = false; if (php_sapi_name() == 'apache') { // if our web server is apache // we get check HTTP // If-Modified-Since header // and do not send image // if there is a cached version $ar = apache_request_headers(); if (isset($ar['If-Modified-Since']) && // If-Modified-Since should exists ($ar['If-Modified-Since'] != '') && // not empty (strtotime($ar['If-Modified-Since']) >= $movie_time)) // and grater than $send_304 = true; // movie_time } if ($send_304) { // Sending 304 response to browser // "Browser, your cached version of image is OK // we're not sending anything new to you" header('Last-Modified: '.gmdate('D, d M Y H:i:s', $ts).' GMT', true, 304); exit(); // bye-bye } // outputing Last-Modified header header('Last-Modified: '.gmdate('D, d M Y H:i:s', $movie_time).' GMT', true, 200); // Set expiration time +1 year // We do not have any photo re-uploading // so, browser may cache this photo for quite a long time header('Expires: '.gmdate('D, d M Y H:i:s', $movie_time + 86400*365).' GMT', true, 200); // outputing HTTP headers header('Content-Length: '.strlen($data)); header("Content-type: video/mpeg"); // outputing book echo $data; exit(); } ?> <head> <title>MySQL Blob Image Gallery Example</title> <link rel="stylesheet" type="text/css" href="test.css"/> </head> <html> <body> <?php if (isset($msg)) // this is special section for // outputing message { ?> <p style="font-weight: bold;"><?=$msg?><br><a href="<?=$_SERVER['PHP_SELF']?>">reload page</a><!-- I've added reloading link, because refreshing POST queries is not good idea --></p> <?php } ?> <h1>Movies</h1> <h2>Uploaded Movies:</h2> <form action="<? $_SERVER['PHP_SELF'] ?>" method="post"> <!-- This form is used for image deletion --> <?php $result = mysql_query("SELECT id, movie_time, title FROM {$table} ORDER BY id DESC"); if (mysql_num_rows($result) == 0) // table is empty echo '<ul><li>No Movies Loaded</li></ul>'; else{ echo '<ul>'; while(list($id, $movie_time, $title) = mysql_fetch_row($result)) { // outputing list echo "<li><input type='radio' name='del' value='{$id}'>"; echo "<a href='{$_SERVER['PHP_SELF']}?show={$id}'>{$title}</a> – "; echo "<small>{$movie_time}</small></li>"; } echo '</ul>'; echo '<label for="password">Password:</label><br>'; echo '<input type="password" name="password" id="password"><br><br>'; echo '<input type="submit" value="Delete selected">'; } ?> <html> <body> </form><h2>Upload New Movie:</h2><form action="<? $_SERVER['PHP_SELF'] ?>" method="POST" enctype="multipart/form-data"> <INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="1000000000"> <label for="title">Title:</label><br><input type="text" name="title" id="title" size="64"><br> <br> <label for="movie">Movie:</label><br><input type="file" name="movie" id="movie"><br> <br> <label for="password">Password:</label><br><input type="password" name="password" id="password"><br> <br><input type="submit" value="upload"></form> </body> </html> Thanks guys. -SB
  16. Hey Im not anywhere that I can access the code but as soon as I get home I will certainly post it. Thank you. Now I had been doing some of my own troubleshooting and noticed that there is a setting in Apache called LimitRequestBody and apparently this is as a default set to 512KB or 524288 bytes (possibly hence my Fatal error: Out of memory (allocated 524288) (tried to allocate 804524032 bytes) error. Now how does one configure apache ? I keep reading about directives but i dont know what these are, how to use them or even what they do really. Any insight would be great, and if anyone could check back later Ill have the code posted and I much appreciate your help in advance. -SB
  17. Im also wondering based on my previous post if this could be a hardware issue...The site for testing purposes in being hosted on a crappy home made server (old desktop pc) ....so Im thinking could the "server" just not have enough RAM or something to upload a file as big as 800MB to it ? -SB
  18. OK new developments...When I upload a video under a mb it works when I upload a video 11mb it works then i try a 24 mb video and it doesnt work even though it says the file uploaded successfully..and the 800mb just gives me that anoying out memory error..does this info help at all? -SB
  19. OK this is really effing irritating me what the heck is causing the error to say that that i have .5mb (512kb) allocated when i have 1000MB allocated. This script worked on smaller files about 3mb and so the possibility of 512kb being set as the memory limit is assinine. Someone pleasse help! -SB
  20. Annnnd the current error message is ...... Fatal error: Out of memory (allocated 524288) (tried to allocate 804524032 bytes) in /var/www/newmymovies.php on line 36 -SB
  21. PFM yes. I am instering an 800MB file into a database or at least attempting to although it seems based upon your comment about max packet size thats probably not going to happen. The phpinfo() is giving me 800M which is what its supposed to be as I set it that way myself. I have already restarted the apache2 server and so I dont think that can be the cause of my problems and I dont know where to find or what an .htaccess file is? But in the minimal amount of reading Ive done it sounds like that pertains more to scripts that are uploading files to the directory or file system. "You will either need to increase the max memory size(tried this afgter reading an article abiout how the max memory size in php needs to be double what youre trying to upload), don't attempt to read the file into memory at all (dont understand how to do this further explaination would be great), or read the file in chunks using fopen/fread (understand what this means just dont know how to go about doing it lol) ." -SB
  22. OH and I did try running phpinfo() and all my changes are displayed... -SB
  23. Hey thanks for the quick responses. Premiso I already changed those settings to 800 and 900 with the post size being larger. PFM I changed the settings from 800MB to 800M and still the same deal. I have also reset the apache server after each modification so thats not the problem. Im curious why when I upped the max mem size the error reported less memory was allocated to handle the file than when the max mem size was 150? I apologize PFM I dont think I entirely understand your question. But I will try to answer best I can. I think I do need it in a Variable because I am inserting it into a mysql database. This script worked on smaller files as well so the script itself I dont think is the issue perhaps as much as the php.ini settings etc. I could be waaaaay off though too I know a fraction of a fraction of what many of you do. Thanks guys. -SB
  24. I have a script which is uploading very large files into blobs (<=800MB). Now i had the max memory size in the php.ini set to 150MB and while uploading it would stop and tell me that that I exhausted all the bytes (157xxxxx can remember the exact figure but im pretty sure it equalled 150MB). Any ways I experimentally set the max memory size to 800MB just to see if that would help and now its telling me Fatal error: Out of memory (allocated 524288) (tried to allocate 804524032 bytes)? What is the meaning of this and how can one rectify the issue? Any info would be tremendous! -SB
×
×
  • 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.