Jump to content

batstanggt

Members
  • Posts

    129
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

batstanggt's Achievements

Member

Member (2/5)

0

Reputation

  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
×
×
  • 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.