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
Can't figure out what the error is in my script.. Need help
Old 11-25-2007, 03:47 PM Can't figure out what the error is in my script.. Need help
goheadtry's Avatar
Webmaster Talker

Posts: 730
Name: John
Location: United States of America, California
Trades: 0
Earlier I made a post because of a parse error this post is not related because the other post was solved.

I am having trouble figuring out what is wrong with my script I can't figure it out because it does not give me an error. but the script does not work correctly
The paths I use are

/home/forbushj/ which is the root of my hosting account
/home/forbushj/public_html/ which is the root of my website
/home/forbushj/www/ which is the same as public_html
PHP Code:
<?php
if(count($_POST) <1){
//show the form
    
if(isset($_GET['error'])){
        if(
$_GET['error'] == "nofile"){
            
$if_error="Please choose a file to upload.";
        }elseif(
$_GET['error'] == "notvid"){
            
$if_error="The file you selected is not a video.";
        }elseif(
$_GET['error'] == "couldnotupload"){
            
$if_error="Your file could not be uploaded.";
        }elseif(
$_GET['error'] == "noconvert"){
            
$if_error="We're sorry, but your video could not be converted for some reason.";
        }
    }else{
        
$if_error="";
    }
    echo 
"";
}else{
//do the processing

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

if(
$_FILES['ufile']['name'] == ""){
    
header("location: {$_SERVER['PHP_SELF']}?error=nofile");
    exit();
}

if(!
is_video($_FILES['ufile']['name'])){
    
header("location: {$_SERVER['PHP_SELF']}?error=notvid");
    exit();
}

if(!
move_uploaded_file($_FILES['ufile']['tmp_name'],$_SERVER['DOCUMENT_ROOT']."/uploadvidd/".$_FILES['ufile']['name'])){
    
header("location: {$_SERVER['PHP_SELF']}?error=couldnotupload");
    exit();
}

$ffmpeg '/usr/bin/ffmpeg';//location of ffmpeg binary
$bitrate '32';//bitrate for audio options are 16,32,64
$ext '.flv';//Extension of output video files
$extb '.jpg';//Extension of image
$vidsize '320x240'//video size
$imgsize '150x100';//image size for menu
$force 'flv';//Force video format to
$sstime '00:00:35';//time to take screenshot
$samprate ='22050'// Sample rate choices are as follows 11025, 22050, 44100)
//Converts uploaded video with FFmpeg binary
if(!exec('$ffmpeg -i /home/forbushj/public_html/uploadvidd/'.$vidIN.' -ar $samprate -ab $bitrate -f flv -s $vidsize /home/forbushj/public_html/vidd/'.$vidout.'.$ext.') || !exec('$ffmpeg -i /home/forbushj/public_html/vidd/'.$vidout.''.$ext.' -s $imgsize -an -ss $sstime -an -r 1 -vframes 1 -y -f image2 /home/forbushj/public_html/pic/video/'.$vidout.'.$extb.')){
    
header("location: {$_SERVER['PHP_SELF']}?error=noconvert");
    exit();
}

//write to mysql
$linkID = @mysql_connect("localhost","dsf_sdf","jdfsdf") 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']);
if(
$query=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) . "')")){
    echo 
"Successfully uploaded and converted your file."
}
}
}
?> 
<!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>

</head>

<body>
<form action="http://www.technologyforever.com/zzupload.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
  <label>
  <input name="vidname" type="text" id="textfield" tabindex="1" />
  </label>
  vidname
  <p>
    <label>
    <input type="text" name="srcof" id="srcof" tabindex="2" />
    </label>
  srcof</p>
  <p>
    <label>
    <textarea name="viddes" id="viddes" cols="45" rows="5" tabindex="3"></textarea>
    </label>
    viddes</p>
  <p>
    <label>
    <input name="ufile" type="file" id="ufile" tabindex="4" />
    </label>
  ufile</p>
  <p>
    <input name="button" type="submit" id="button" tabindex="5" value="Submit" />
  </p>
</form>
</body>
</html>
__________________
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; 11-25-2007 at 03:53 PM..
goheadtry is offline
Reply With Quote
View Public Profile Visit goheadtry's homepage!
 
 
Register now for full access!
Old 11-25-2007, 05:55 PM Re: Can't figure out what the error is in my script.. Need help
Defies a Status

Posts: 1,606
Trades: 0
On a cpanel server
Quote:
/home/forbushj/www/ which is the same as public_html
is reserved for ???? stuff if I am not mistaken. Long ago I was told the system would copy anything that was needed in that folder to that folder.

Some server configs will not allow an http upload to the /home/forbushj/ directory if that is what you are trying to do. On those servers http must go to public
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 11-25-2007, 06:41 PM Re: Can't figure out what the error is in my script.. Need help
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
I'm not really sure of this, but if you use an if-statement like this
PHP Code:
if($query=mysql_query(...)) {
    
// [some code]

Wouldn't it always execute [some code], since $query will be set to a value no matter what the mysql_query function returns, and the operation of giving $query a value would return true? As I said, I'm not sure, but to me this seems more logical
PHP Code:
f(($query=mysql_query(...)) == true) {
    
// [some code]

Either way, I think it would help if you told us what is not working rather than the fact that it isn't.
lizciz is offline
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 11-25-2007, 09:02 PM Re: Can't figure out what the error is in my script.. Need help
goheadtry's Avatar
Webmaster Talker

Posts: 730
Name: John
Location: United States of America, California
Trades: 0
http://www.technologyforever.com/zzupload.php

thats what is not working.
__________________
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 11-26-2007, 01:52 AM Re: Can't figure out what the error is in my script.. Need help
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
What I ment was, where does the script fail? For example, does it give you an error saying a file couldn't be uploaded, that it's not a video file or that it couldn't be converted?

I tried to upload a video file in .avi format and I got the "not a video" error, maybe you should check up on your is_video() function.
lizciz is offline
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Reply     « Reply to Can't figure out what the error is in my script.. Need help
 

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.59626 seconds with 12 queries