Jump to content

jamesxg1

Members
  • Posts

    1,133
  • Joined

  • Last visited

Everything posted by jamesxg1

  1. Anyone have any ideas? I'm using my originial code now; <?php session_start(); include 'system/template/template.php'; include 'system/mysql/mysql.php'; include 'system/properties/property.php'; $mysql = new mysql(); $mysql->connect(); $property = new property(); if($property->landlord_loggedin()) { header('Location: login.php'); } $_SESSION['N_P_ID'] = 1; if(isset($_SESSION['N_P_ID']) && !empty($_SESSION['N_P_ID'])) { if(isset($_POST['videotitle']) && !empty($_POST['videotitle']) && isset($_FILES['videofile']) && !empty($_FILES['videofile'])) { $upload = $bad . '<form id="Upload" action="upload_video.php" enctype="multipart/form-data" method="post"> <h3>Upload a video of your property</h3> <label>Video Title</label> <input type="text" name="videotitle"><br /> <input type="file" name="videofile"> <label>Submit</label> <input type="submit" name="submit" value="Upload"><br /> <a href="landlord_account.php">Skip</a> </form>'; $extensions = array('mpg', 'avi', 'mpeg'); define ("MAX_SIZE","10240"); function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } if(isset($_FILES['videofile'])) { if(!isset($_POST['videotitle'])) { $bad = '<p class="bad">Please enter a video title.</p>'; $form = $upload; } $filename = stripslashes($_FILES['videofile']['name']); $extension = strtolower(getExtension($filename)); if(!in_array($extension, $extensions)) { $bad = '<p class="bad">Video is incorrect format, please make sure your video format is either mpg/mpeg or avi.</p>'; $form = $upload; } else { $size = filesize($_FILES['videofile']['tmp_name']); if($size > MAX_SIZE*1024) { $bad = '<p class="bad">Video too large.</p>'; $form = $upload; } $time = time(); $image_name = $time . '.' . $extension; $newname = "uploads/properties/landlord_files/videos/" . $image_name; if(move_uploaded_file($_FILES['videofile']['tmp_name'], $newname)) { if($property->add_video($time, 'flv', $_POST['videotitle'])) { $srcFile = 'uploads/properties/landlord_files/videos/' . $image_name; $destFile = 'uploads/properties/landlord_files/videos/' . $time . '.flv'; $ffmpegPath = "/usr/bin/ffmpeg"; $flvtool2Path = "/usr/bin/flvtool2"; $ffmpegObj = new ffmpeg_movie($srcFile); $srcWidth = makeMultipleTwo($ffmpegObj->getFrameWidth()); $srcHeight = makeMultipleTwo($ffmpegObj->getFrameHeight()); $srcFPS = $ffmpegObj->getFrameRate(); $srcAB = intval($ffmpegObj->getAudioBitRate()/1000); $srcAR = $ffmpegObj->getAudioSampleRate(); $img = $image_name; $ff_frame = $ffmpegObj->getFrame(1); if($ff_frame) { $gd_image = $ff_frame->toGDImage(); if($gd_image) { imagepng($gd_image, $img); imagedestroy($gd_image); $property->add_image($img, 'png', 'frame_shot'); } } exec($ffmpegPath . " -i " . $srcFile . " -ar " . $srcAR . " -ab " . $srcAB . " -f flv -s " . $srcWidth . "x" . $srcHeight . " " . $destFile . " | " . $flvtool2Path . " -U stdin " . $destFile); @unlink($newname); function makeMultipleTwo ($value) { $sType = gettype($value/2); if($sType == "integer") { return $value; } else { return ($value-1); } } $ref = 1; } else { @unlink($newname); $bad = '<p class="bad">Video upload failed.</p>'; $form = $upload; } } else { $bad = '<p class="bad">Video upload failed.</p>'; $form = $upload; } } } if($ref == 1) { header('Location: landlord_account.php?page=3'); } } else { $form = '<form id="Upload" action="upload_video.php" enctype="multipart/form-data" method="post"> <h3>Upload a video of your property</h3> <label>Video Title</label> <input type="text" name="videotitle"><br /> <input type="file" name="videofile"> <label>Submit</label> <input type="submit" name="submit" value="Upload"><br /> <a href="landlord_account.php">Skip</a> </form>'; } $template = new template(); $array = array('TITLE' => 'Upload A Video', 'CONTENT' => $form); $template->newTemplate($array, 'add_property'); } else { header('Location: landlord_account.php'); } ?> Still not working thoe, someone please help! Many thanks, James.
  2. I beleive so, how would I tell? The .txt file is still empty meaning that nothing has called the function to write anything to it. Many thanks, James.
  3. I have even changed the code to this to get some feedback; <?php session_start(); include 'system/template/template.php'; include 'system/mysql/mysql.php'; include 'system/properties/property.php'; $mysql = new mysql(); $mysql->connect(); $property = new property(); if($property->landlord_loggedin()) { header('Location: login.php'); } function save_log($string) { $myFile = "testFile.txt"; $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = $string . "\n"; fwrite($fh, $stringData); fclose($fh); } $_SESSION['N_P_ID'] = 1; if(isset($_SESSION['N_P_ID']) && !empty($_SESSION['N_P_ID'])) { if(isset($_POST['videotitle']) && !empty($_POST['videotitle']) && isset($_FILES['videofile']) && !empty($_FILES['videofile'])) { $upload = $bad . '<form id="Upload" action="upload_video.php" enctype="multipart/form-data" method="post"> <h3>Upload a video of your property</h3> <label>Video Title</label> <input type="text" name="videotitle"><br /> <input type="file" name="videofile"> <label>Submit</label> <input type="submit" name="submit" value="Upload"><br /> <a href="landlord_account.php">Skip</a> </form>'; save_log($upload); $extensions = array('mpg', 'avi', 'mpeg'); define ("MAX_SIZE","10240"); function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } if(isset($_FILES['videofile'])) { if(!isset($_POST['videotitle'])) { $bad = '<p class="bad">Please enter a video title.</p>'; $form = $upload; save_log($bad); } $filename = stripslashes($_FILES['videofile']['name']); save_log($filename); $extension = strtolower(getExtension($filename)); save_log($extension); if(!in_array($extension, $extensions)) { $bad = '<p class="bad">Video is incorrect format, please make sure your video format is either mpg/mpeg or avi.</p>'; $form = $upload; save_log($bad); } else { $size = filesize($_FILES['videofile']['tmp_name']); save_log($size); if($size > MAX_SIZE*1024) { $bad = '<p class="bad">Video too large.</p>'; $form = $upload; save_log($bad); } $time = time(); $image_name = $time . '.' . $extension; $newname = "uploads/properties/landlord_files/videos/" . $image_name; save_log($newname); save_log($image_name); save_log($time); if(move_uploaded_file($_FILES['videofile']['tmp_name'], $newname)) { if($property->add_video($time, 'flv', $_POST['videotitle'])) { $srcFile = 'uploads/properties/landlord_files/videos/' . $image_name; $destFile = 'uploads/properties/landlord_files/videos/' . $time . '.flv'; $ffmpegPath = "/usr/bin/ffmpeg"; $flvtool2Path = "/usr/bin/flvtool2"; save_log($destFile . ' ' . $srcFile); $ffmpegObj = new ffmpeg_movie($srcFile); $srcWidth = makeMultipleTwo($ffmpegObj->getFrameWidth()); $srcHeight = makeMultipleTwo($ffmpegObj->getFrameHeight()); $srcFPS = $ffmpegObj->getFrameRate(); $srcAB = intval($ffmpegObj->getAudioBitRate()/1000); $srcAR = $ffmpegObj->getAudioSampleRate(); $img = $image_name; $ff_frame = $ffmpegObj->getFrame(1); save_log($img); if($ff_frame) { $gd_image = $ff_frame->toGDImage(); if($gd_image) { imagepng($gd_image, $img); imagedestroy($gd_image); $property->add_image($img, 'png', 'frame_shot'); } } exec($ffmpegPath . " -i " . $srcFile . " -ar " . $srcAR . " -ab " . $srcAB . " -f flv -s " . $srcWidth . "x" . $srcHeight . " " . $destFile . " | " . $flvtool2Path . " -U stdin " . $destFile); @unlink($newname); function makeMultipleTwo ($value) { $sType = gettype($value/2); if($sType == "integer") { return $value; } else { return ($value-1); } } $ref = 1; } else { @unlink($newname); $bad = '<p class="bad">Video upload failed.</p>'; $form = $upload; save_log($bad); } } else { $bad = '<p class="bad">Video upload failed.</p>'; $form = $upload; save_log($bad); } } } if($ref == 1) { header('Location: landlord_account.php?page=3'); } } else { $form = '<form id="Upload" action="upload_video.php" enctype="multipart/form-data" method="post"> <h3>Upload a video of your property</h3> <label>Video Title</label> <input type="text" name="videotitle"><br /> <input type="file" name="videofile"> <label>Submit</label> <input type="submit" name="submit" value="Upload"><br /> <a href="landlord_account.php">Skip</a> </form>'; } $template = new template(); $array = array('TITLE' => 'Upload A Video', 'CONTENT' => $form); $template->newTemplate($array, 'add_property'); } else { header('Location: landlord_account.php'); } ?> And the text file is still completely empty, nothing is happening. Anyone have any ideas? Many thanks, James.
  4. Totally didn't notice that. Edited. I have done a debug, I have test all vars and functions except the exec as this is reported to be working already from my hosting company (as I asked them to test the exec function). All is still failing to do anything. The only error I have ever got from the script is Notice: A session had already been started - ignoring session_start() in /var/www/vhosts/yourhomely.co.uk/httpdocs/system/template/template.php on line 1 but this has nothing to do with why the upload is failing, right? Many thanks, James.
  5. Everything, nothing is uploading, nothing is converting. I have had no errors at all, I have also stripped the script and turned it into just a form and the processing script. Still nothing. Many thanks, James.
  6. I have just tested the function and it seems to be working ok? Many thanks, James.
  7. Hiya mate, Thanks for a prompt reply. Line 42 in whitespace, blank? Is that what the problem is, it being whitespace? Many thanks, James.
  8. Hiya peeps! I have built this code, can anyone see anything wrong with this because its not working at all all it does is refer back to its self; <?php session_start(); include 'system/template/template.php'; include 'system/mysql/mysql.php'; include 'system/properties/property.php'; $mysql = new mysql(); $mysql->connect(); $property = new property(); if($property->landlord_loggedin()) { header('Location: login.php'); } $_SESSION['N_P_ID'] = 1; if(isset($_SESSION['N_P_ID']) && !empty($_SESSION['N_P_ID'])) { if(isset($_POST['videotitle']) && !empty($_POST['videotitle']) && isset($_FILES['videofile']) && !empty($_FILES['videofile'])) { $upload = $bad . '<form id="Upload" action="upload_video.php" enctype="multipart/form-data" method="post"> <h3>Upload a video of your property</h3> <label>Video Title</label> <input type="text" name="videotitle"><br /> <input type="file" name="videofile"> <label>Submit</label> <input type="submit" name="submit" value="Upload"><br /> <a href="landlord_account.php">Skip</a> </form>'; $extensions = array('mpg', 'avi', 'mpeg'); define ("MAX_SIZE","10240"); function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } if(isset($_FILES['imageone'])) { if(!isset($_POST['videotitle'])) { $bad = '<p class="bad">Please enter a video title.</p>'; $form = $upload; } $filename = stripslashes($_FILES['videofile']['name']); $extension = strtolower(getExtension($filename)); if(!in_array($extension, $extensions)) { $bad = '<p class="bad">Video is incorrect format, please make sure your video format is either mpg/mpeg or avi.</p>'; $form = $upload; } else { $size = filesize($_FILES['videofile']['tmp_name']); if($size > MAX_SIZE*1024) { $bad = '<p class="bad">Video too large.</p>'; $form = $upload; } $time = time(); $image_name = $time . '.' . $extension; $newname = "uploads/properties/landlord_files/videos/" . $image_name; if(move_uploaded_file($_FILES['videofile']['tmp_name'], $newname)) { if($property->add_video($time, 'flv', $_POST['videotitle'])) { $srcFile = 'uploads/properties/landlord_files/videos/' . $image_name; $destFile = 'uploads/properties/landlord_files/videos/' . $time . '.flv'; $ffmpegPath = "/usr/bin/ffmpeg"; $flvtool2Path = "/usr/bin/flvtool2"; $ffmpegObj = new ffmpeg_movie($srcFile); $srcWidth = makeMultipleTwo($ffmpegObj->getFrameWidth()); $srcHeight = makeMultipleTwo($ffmpegObj->getFrameHeight()); $srcFPS = $ffmpegObj->getFrameRate(); $srcAB = intval($ffmpegObj->getAudioBitRate()/1000); $srcAR = $ffmpegObj->getAudioSampleRate(); $img = $image_name; $ff_frame = $ffmpegObj->getFrame(1); if($ff_frame) { $gd_image = $ff_frame->toGDImage(); if($gd_image) { imagepng($gd_image, $img); imagedestroy($gd_image); $property->add_image($img, 'png', 'frame_shot'); } } exec($ffmpegPath . " -i " . $srcFile . " -ar " . $srcAR . " -ab " . $srcAB . " -f flv -s " . $srcWidth . "x" . $srcHeight . " " . $destFile . " | " . $flvtool2Path . " -U stdin " . $destFile); @unlink($newname); function makeMultipleTwo ($value) { $sType = gettype($value/2); if($sType == "integer") { return $value; } else { return ($value-1); } } $ref = 1; } else { @unlink($newname); $bad = '<p class="bad">Video upload failed.</p>'; $form = $upload; } } else { $bad = '<p class="bad">Video upload failed.</p>'; $form = $upload; } } } if($ref == 1) { header('Location: landlord_account.php?page=3'); } } else { $form = '<form id="Upload" action="upload_video.php" enctype="multipart/form-data" method="post"> <h3>Upload a video of your property</h3> <label>Video Title</label> <input type="text" name="videotitle"><br /> <input type="file" name="videofile"> <label>Submit</label> <input type="submit" name="submit" value="Upload"><br /> <a href="landlord_account.php">Skip</a> </form>'; } $template = new template(); $array = array('TITLE' => 'Upload A Video', 'CONTENT' => $form); $template->newTemplate($array, 'add_property'); } else { header('Location: landlord_account.php'); } ?> Many thanks, James.
  9. Hiya peeps! I have this query; "SELECT `status` FROM `statuses` WHERE `owner` = '$this->profile_id' AND MAX(`id`) ORDER BY `id` DESC LIMIT 1" Is this correct? Because it seems to run fine, but doesn't return anything at all. Many thanks, James.
  10. Hiya! I need help! I have this script; <?php session_start(); include 'system/template/template.php'; include 'system/mysql/mysql.php'; include 'system/properties/property.php'; $mysql = new mysql(); $mysql->connect(); $property = new property(); if(!$property->landlord_loggedin()) { header('Location: login.php'); } if(isset($_SESSION['N_P_ID']) && !empty($_SESSION['N_P_ID'])) { if(isset($_POST['videotitle']) && !empty($_POST['videotitle']) && isset($_FILES['videofile']) && !empty($_FILES['videofile'])) { $upload = $bad . '<form id="Upload" action="upload_video.php" enctype="multipart/form-data" method="post"> <h3>Upload a video of your property</h3> <label>Video Title</label> <input type="text" name="videotitle"><br /> <input type="file" name="videofile"> <label>Submit</label> <input type="submit" name="submit" value="Upload"><br /> <a href="landlord_account.php">Skip</a> </form>'; $extensions = array('mpg', 'avi', 'mpeg'); define ("MAX_SIZE","10240"); function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } if(isset($_FILES['imageone'])) { if(!isset($_POST['videotitle'])) { $bad = '<p class="bad">Please enter a video title.</p>'; $form = $upload; } $filename = stripslashes($_FILES['videofile']['name']); $extension = strtolower(getExtension($filename)); if(!in_array($extension, $extensions)) { $bad = '<p class="bad">Video is incorrect format, please make sure your video format is either mpg/mpeg or avi.</p>'; $form = $upload; } else { $size = filesize($_FILES['videofile']['tmp_name']); if($size > MAX_SIZE*1024) { $bad = '<p class="bad">Video too large.</p>'; $form = $upload; } $time = time(); $image_name = $time . '.' . $extension; $newname = "uploads/properties/landlord_files/videos/" . $image_name; if(move_uploaded_file($_FILES['videofile']['tmp_name'], $newname)) { if($property->add_video($time, 'flv', $_POST['videotitle'])) { $srcFile = 'uploads/properties/landlord_files/videos/' . $image_name; $destFile = 'uploads/properties/landlord_files/videos/' . $time . '.flv'; $ffmpegPath = "/path/to/ffmpeg"; $flvtool2Path = "/path/to/flvtool2"; $ffmpegObj = new ffmpeg_movie($srcFile); $srcWidth = makeMultipleTwo($ffmpegObj->getFrameWidth()); $srcHeight = makeMultipleTwo($ffmpegObj->getFrameHeight()); $srcFPS = $ffmpegObj->getFrameRate(); $srcAB = intval($ffmpegObj->getAudioBitRate()/1000); $srcAR = $ffmpegObj->getAudioSampleRate(); $img = $image_name; $ff_frame = $ffmpegObj->getFrame(1); if($ff_frame) { $gd_image = $ff_frame->toGDImage(); if($gd_image) { imagepng($gd_image, $img); imagedestroy($gd_image); $property->add_image($img, 'png', 'frame_shot'); } } exec($ffmpegPath . " -i " . $srcFile . " -ar " . $srcAR . " -ab " . $srcAB . " -f flv -s " . $srcWidth . "x" . $srcHeight . " " . $destFile . " | " . $flvtool2Path . " -U stdin " . $destFile); @unlink($newname); function makeMultipleTwo ($value) { $sType = gettype($value/2); if($sType == "integer") { return $value; } else { return ($value-1); } } $ref = 1; } else { @unlink($newname); $bad = '<p class="bad">Video upload failed.</p>'; $form = $upload; } } else { $bad = '<p class="bad">Video upload failed.</p>'; $form = $upload; } } } if($ref == 1) { header('Location: landlord_account.php?page=3'); } } else { $form = '<form id="Upload" action="upload_video.php" enctype="multipart/form-data" method="post"> <h3>Upload a video of your property</h3> <label>Video Title</label> <input type="text" name="videotitle"><br /> <input type="file" name="videofile"> <label>Submit</label> <input type="submit" name="submit" value="Upload"><br /> <a href="landlord_account.php">Skip</a> </form>'; } $template = new template(); $array = array('TITLE' => 'Upload A Video', 'CONTENT' => $form); $template->newTemplate($array, 'add_property'); } else { header('Location: landlord_account.php'); } ?> When I click upload, nothing happens. I just get a blank template (from my template system). Is there something I'm doing wrong here? Many thanks, James.
  11. That's what I was affraid of. LOL! Is there any possible way be it js, ajax, jquery, flash ect that I could show the viewer the video regardless of his/her codecs? SORRY FOR THE BAD GRAMMER. Many thanks, James.
  12. That's what I was affraid of. LOL! Is there any possible way be it js, ajax, jquery, flash ect thatI could show the view the view regardless of his/her codecs? Many thanks, James.
  13. Yeah, that's basically all I'm looking for is the avi or mpg to play where I place it. Is this possible then? I don't have ffmpeg, is this a problem? Many thanks, James.
  14. Hiya! Is it possible to play an avi or mpg video file with php? If not is there any other recommeded scripts out there be it jquery, ajax, js ect that will do this? Many thanks, James.
  15. I'm sure in some way you have to use the extends but I'm not sure how LOL! Many thanks, James.
  16. Hiya peeps! I was wondering how I could use a function from one class in another EG. class_file_one.php class a { function a() { return true; } } class_file_two.php class b { function b() { if($this->a()) { return 'it works'; } } } The classes are in completely different pages. Many thanks, James.
  17. Thank you very much for your help wildteen88! Much appreciated! Many thanks, James.
  18. I think I have it working , just checking if this is full-proof LOL. function images() { $get_images = "SELECT * FROM `images` WHERE `pid` = '$this->pid'"; $run_get_images = mysql_query($get_images); if($run_get_images) { $image_num = mysql_num_rows($run_get_images); if($image_num >= 5) { while($image = mysql_fetch_assoc($run_get_images)) { $image_return .= '<div class="image"><a title="' . $image['caption'] . '" class="background_light border_medium" onmouseover="this.className=\'background_lightest border_light\'" onmouseout="this.className=\'background_light border_medium\'" href=""><img src="' . $image['name'] . '" alt="Image." width="94" height="94" /></a></div>'; } } elseif($image_num < 5) { $real_amount = 5; $needed = $real_amount - $image_num; for ($i = 1; $i <= $needed; $i++) { $image_return .= '<div class="image"><a title="No Image Uploaded." class="background_light border_medium" onmouseover="this.className=\'background_lightest border_light\'" onmouseout="this.className=\'background_light border_medium\'" href="#"><img src="noimage.jpg" alt="No Image Uploaded." width="94" height="94" /></a></div>'; } } return $image_return; } else { return false; } } Many thanks, James.
  19. Ok here's the code I have so far. function images() { $get_images = "SELECT * FROM `images` WHERE `pid` = '$this->pid'"; $run_get_images = mysql_query($get_images); if($run_get_images) { $image_num = mysql_num_rows($run_get_images); if($image_num >= 5) { while($image = mysql_fetch_assoc($run_get_images)) { $image_return .= '<div class="image"><a title="' . $image['caption'] . '" class="background_light border_medium" onmouseover="this.className=\'background_lightest border_light\'" onmouseout="this.className=\'background_light border_medium\'" href=""><img src="' . $image['name'] . '" alt="image" width="94" height="94" /></a></div>'; } } elseif($image_num < 5) { $real_amount = 5; $needed = $real_amount - $image_num; for($i=1; $i == $needed; $i++) { $image_return .= '<div class="image"><a title="' . $image['caption'] . '" class="background_light border_medium" onmouseover="this.className=\'background_lightest border_light\'" onmouseout="this.className=\'background_light border_medium\'" href="#"><img src="noimage.jpg" alt="image" width="94" height="94" /></a></div>'; } } return $image_return; } else { return false; } } I have for the for() wrong, as I am not familiar with that function. Many thanks, James.
  20. This is the code I use for each image that a customer has uploaded. $image_return .= '<div class="image"><a title="' . $image['caption'] . '" class="background_light border_medium" onmouseover="this.className=\'background_lightest border_light\'" onmouseout="this.className=\'background_light border_medium\'" href="#"><img src="' . $image['name'] . '" alt="image" width="94" height="94" /></a></div>'; And this for the any that they haven't (giving that they have uploaded less than 5 images). $image_return .= '<div class="image"><a title="' . $image['caption'] . '" class="background_light border_medium" onmouseover="this.className=\'background_lightest border_light\'" onmouseout="this.className=\'background_light border_medium\'" href="#"><img src="noimage.jpg" alt="image" width="94" height="94" /></a></div>'; Many thanks, James.
  21. Hiya peeps, I have a mysql database with a record of all the images a customer uploads on my site, these images are displayed on there account. I can get this to work but the problem I'm facing is I need a minimum of 5 images displayed so if they only upload 2 images for instance I need to detect that and add my "No Image Uploaded" image. But if they have uploaded 5 or more I need to just let them be displayed without adding the "No Image Uploaded" picture. Does anyone have any ideas as I'm very stuck! Many thanks James.
  22. Thanks mate, worked a charm. Many thanks, James.
  23. Hiya peeps, I have two rows titled `expiry_date` and `expiry_time` I need to find a way to add 24 hours onto the current time and then insert what date and time that would be. How would I go about this? Many thanks, James.
  24. Hiya peeps! I am using the glob function at the minute but it is returning the whole path of the files it finds, does anyone know how do I can stop this? Many thanks, James.
  25. Anyone have any ideas? Many thanks, James.
×
×
  • 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.