Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 10-06-2007, 02:54 PM Problem with script
goheadtry's Avatar
Webmaster Talker

Posts: 726
Name: John
Location: United States of America, California
Trades: 0
I am having a problem with my php upload / video converter script it is deleting the video before the conversion has finished thus making the file delete before it is converted and making a zero kb file

how can I make it so the

exec commands run but wait for the first command to finish before running the second command and then when the second is finished run the third also how can I make some error catchers with an error number and a failure message
also make it read the possible extensions from a text file because that would make it easier.

can someone help me please.

also I was wondering how to make sure that all fields are completed.










PHP Code:
<?php 
$dsrptn 
'upload your videos to TechnologyForever.com'
$sect 'Videos';
$what 'Upload your videos';
include 
'head.php'?>

  
  <?php
//set where yzzou want to store files
//in this example we keep file in folder upload
//$HTTP_POST_FILES['ufile']['name']; = upload file name
//for example upload file name cartoon.gif . $path will be upload/cartoon.gif
$path"uploadvidd/".$HTTP_POST_FILES['ufile']['name'];
if(
$ufile !=none)
{
if (
file_exists($path)) {
$path"uploadvidd/1".$HTTP_POST_FILES['ufile']['name'];
}
if(
is_video($HTTP_POST_FILES['ufile']['tmp_name'])){

if(
copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
{
$input $_GET['input'];
list(
$usec$sec) = explode(' 'microtime());
$output str_replace('.''', (float)$usec + (float)$sec);
//exec('ffmpeg -i /home/forbushj/public_html/'.$path.'  -s 150x100 -an -ss 00:00:35 -an -r 1 -vframes 1 -y -f image2 /home/forbushj/public_html/pic/video/'.$output.'.jpg');
$ext ".flv";
exec('ffmpeg -i /home/forbushj/public_html/'.$path.' -ar 26000 -ab 50 -f flv -s 320x240 /home/forbushj/public_html/vidd/'.$output.'.flv');
exec('ffmpeg -i /home/forbushj/public_html/vidd/'.$output.''.$ext.' -s 150x100 -an -ss 00:00:35 -an -r 1 -vframes 1 -y -f image2 /home/forbushj/public_html/pic/video/'.$output.'.jpg');
exec('rm /home/forbushj/public_html/'.$path.'');
//passwords and users changed intentionally
 
$linkID = @mysql_connect("HOST","USERNAME","PASSWORD") or die("Could not connect to MySQL server");
      @
mysql_select_db("forbushj_onetest") or die("Could not select database");
 
      
// Retrieve the posted product information.
      
$titlev stripslashes($_POST['vidname']);
      
$descrv stripslashes($_POST['viddes']);
$srcv stripslashes($_POST['srcof']);
$result mysql_query("
  INSERT INTO video
  (
    title,
    descr,
    pic,
    locat,
    src
  )
  VALUES
  (
    '" 
mysql_real_escape_string($titlev) . "',
    '" 
mysql_real_escape_string($descrv) . "',
    '" 
mysql_real_escape_string($output) . ".jpg',
    '" 
mysql_real_escape_string($output) . ".flv',
    '" 
mysql_real_escape_string($srcv) . "'
    )
"
);


 } else {
 
     } 
    }
}
function 
is_video$f ){
$result trim exec ('file -bi ' escapeshellarg $f ) ) ) ;
$TYPE explode("/"$result);
if(
$TYPE[0] == "video"){
return 
TRUE;
}
else{
return 
FALSE;
}
}


?>
<table width="95%" height="431" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td width="10%"  colspan="3"><div align="center">
      <p>Your video should be upload if not please <a href="http://www.technologyforever.com/contact.html">contact us.</a></p>
      <p>&nbsp;</p>
      <p>Return to <a href="http://www.technologyforever.com/upload.php">video uploader</a></p>
      <p>Return to <a href="http://www.technologyforever.com/video1.html">video section</a></p>
      <p>Return to <a href="http://www.technologyforever.com">main page</a></p>
    </div></td>
</tr>
</table>
<?php include 'foot.php'?>
__________________
Free $1 gift card when you signup at
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Last edited by goheadtry; 10-06-2007 at 02:55 PM..
goheadtry is offline
Reply With Quote
View Public Profile Visit goheadtry's homepage!
 
 
Register now for full access!
Old 10-06-2007, 09:03 PM Re: Problem with script
coolkbk585's Avatar
Be good this Christmas!

Latest Blog Post:
KBlog has been deativated
Posts: 642
Name: Kyle
Location: Ada, MI
Trades: 0
Was it working before? If it was, then it's probably a problem with the tmp folder on your server.

If it wasn't, then I'll look over your code, but I'm not sure if I can get it :P
__________________
<?php if($Adsense_Revenue > 0): define('HAPPINES','100%'); else: define('HAPPINESS', '0%') endif; ?>
coolkbk585 is offline
Reply With Quote
View Public Profile Visit coolkbk585's homepage!
 
Old 10-06-2007, 09:11 PM Re: Problem with script
goheadtry's Avatar
Webmaster Talker

Posts: 726
Name: John
Location: United States of America, California
Trades: 0
It is because I need to have the exec commands run in a certain order and make sure one exec command is done before starting another so it doesn't delete the file before is done converting.

http://ffmpeg.mplayerhq.hu/ffmpeg-doc.html

here is the way the application on the server runs if someone needs it for reference
__________________
Free $1 gift card when you signup at
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

goheadtry is offline
Reply With Quote
View Public Profile Visit goheadtry's homepage!
 
Old 10-08-2007, 07:55 AM Re: Problem with script
solomongaby's Avatar
Webmaster Talker

Latest Blog Post:
How Do You Find Music Online ?
Posts: 522
Name: Gabe Solomon
Location: Romania
Trades: 1
have you tried putting the output argument maybe that will make the program wait for the comand to finish
Quote:
exec() executes the given command.
Parameters


command The command that will be executed.
output If the output argument is present, then the specified array will be filled with every line of output from the command. Trailing whitespace, such as \n, is not included in this array. Note that if the array already contains some elements, exec() will append to the end of the array. If you do not want the function to append elements, call unset() on the array before passing it to exec().
return_var If the return_var argument is present along with the output argument, then the return status of the executed command will be written to this variable.
or you could try to use

Quote:
passthru — Execute an external program and display raw output

Description

void passthru ( string $command [, int &$return_var] )
The passthru() function is similar to the exec() function in that it executes a command. This function should be used in place of exec() or system() when the output from the Unix command is binary data which needs to be passed directly back to the browser. A common use for this is to execute something like the pbmplus utilities that can output an image stream directly. By setting the Content-type to image/gif and then calling a pbmplus program to output a gif, you can create PHP scripts that output images directly.
Parameters


command The command that will be executed.
return_var If the return_var argument is present, the return status of the Unix command will be placed here.
__________________
If you like my posts ... TK is appreciated:)

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
solomongaby is offline
Reply With Quote
View Public Profile Visit solomongaby's homepage!
 
Reply     « Reply to Problem with script
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.14628 seconds with 12 queries