Jump to content

Please help Im sorry!


blake87

Recommended Posts

My name is Ryan Blake a university student who is into web design,I am currently have problems with a php file which I purchased foy my web site, it would seem as the web hosts don't know the problem, and the creator cant solve the problem,I have saw this script working on other web sites,but it just will not work for mine,  when I debug my site I get some notices which are

Notice: Undefined variable: file in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 21

Notice: Undefined variable: desc in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 21

Notice: Undefined variable: catid in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 21

Notice: Undefined variable: title in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 21

Notice: Undefined variable: accid in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 21

Notice: Undefined variable: usertype in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 62

Notice: Undefined variable: option in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 70

Notice: Undefined variable: rows in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 70

Notice: Use of undefined constant submit - assumed 'submit' in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 71

Notice: Undefined index: submit in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 71

 

I have not yet learned PHP, I will be at university next year, and I will start this summer to get a head start, but as it stands right now, it is essential I fix this problem for my site, if required I can give the script to anyone who maybe aware of what the problem is.

Link to comment
Share on other sites

If you would like to post some of the code (probably up to and including line 21) that would help a lot in dealing with the problem.

 

Be sure to remove any sensitive information first like email addresses and any login details for MySQL or such if present.

Link to comment
Share on other sites

Thanks for the reply

 


defined('_VALID_MOS') or die('Direct Access to this location is not allowed.');
require_once( $mainframe->getPath( 'front_html' ) );
require_once( $mainframe->getPath( 'class' ) );
switch( $task ) {
case 'view':
view($id);
break;

case 'upload':
if ($my->id==""){
header("Location:index.php?option=com_login");
}
upload($file,$desc,$catid,$title,$accid);
break;


 

I hope this helps

Link to comment
Share on other sites

OK is that from "achtube.php"?

 

I'm presuming that the upload() call at the end is whats generating the error. Add this immediately before that line:

  echo 'file: '.$file.'<br />';
  echo 'desc: '.$desc.'<br />';
  echo 'catid: '.$catid.'<br />';
  echo 'title: '.$title.'<br />';
  echo 'accid: '.$accid.'<br />';

 

Also, can you show the part of code that starts like this:

 

function upload(...

 

I'd like to see what parameters are required and how they're being set.

Link to comment
Share on other sites

Yes you are correct how did you know?

 

 

 

function upload($file,$desc,$catid,$title,$accid){

global $database;

$database->setQuery( "SELECT * FROM #__achtube_config");

$database->loadObject($row);

if ($database -> getErrorNum()) {

echo $database -> stderr();

return false;

}

global $mosConfig_absolute_path,$mosConfig_live_site,$database,$my;

$query = "SELECT d.name as name, d.id as id from #__groups as d";

$database->setQuery($query);

$accs = $database->loadObjectList();

$myacc[] = mosHTML::makeOption( -1, "Select Access Level");

foreach($accs as $obj){

$myacc[] = mosHTML::makeOption( $obj->id, $obj->name);

}

$lists['accs'] = mosHTML::selectList( $myacc, 'accid', 'class="inputbox" size="1" ', 'value', 'text');

$query = "SELECT s.name as name, s.id as id from #__categories as s WHERE s.section = $row->secid AND s.published = 1 AND s.access <= '$usertype' ORDER BY s.ordering";

$database->setQuery($query);

$cats = $database->loadObjectList();

$mycat[] = mosHTML::makeOption( -1, "Select Category");

foreach($cats as $obj){

$mycat[] = mosHTML::makeOption( $obj->id, $obj->name);

}

$lists['cats'] = mosHTML::selectList( $mycat, 'catid', 'class="inputbox" size="1" ', 'value', 'text');

HTML_achtube::upload($option, $rows[0], $lists);

if($_POST[submit]!=""){

global $database;

$vid = new stdClass;

if ($title==""){

$hata = "Please provide a video title";

}

 

 

I am not sure if this to too much or to little code let me know, thanks in advance

Link to comment
Share on other sites

Did you add those "echo" lines and try the script? It's just a method of debugging to show the contents of the variables to see exactly what is being passed to the upload() function.

 

I have to go out very soon so someone will have to take over.

 

If you can post what the echo statements give you that would help.

Link to comment
Share on other sites

Permissions?

 

You mean restrictions in the distribution licence that came with the scripts?

 

If that is the case I believe those restrictions are in place to stop people messing around with the scripts on a permanent basis. I think in this case where the alterations will be removed afterwards this will be OK as it's just to try and figure out what is going wrong.

 

NowI may be completely wrong on this bit but I *think* PHP was set up differently for whoever wrote it to the environment you're using the scripts in. Maybe your environment is more strict, I'm not sure but I reckon one of the moderators would know for sure. PHP settings isn't something I'm too familiar with.

Link to comment
Share on other sites

I added that code now, I just uninstalled the program then injected the code before it is installed on the web server I now get the following

[code]


Notice: Undefined variable: file in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 29
file:

Notice: Undefined variable: desc in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 30
desc:

Notice: Undefined variable: catid in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 31
catid:

Notice: Undefined variable: title in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 32
title:

Notice: Undefined variable: accid in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 33
accid:

Notice: Undefined variable: file in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 35

Notice: Undefined variable: desc in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 35

Notice: Undefined variable: catid in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 35

Notice: Undefined variable: title in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 35

Notice: Undefined variable: accid in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 35

Notice: Undefined variable: usertype in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 69

Notice: Undefined variable: option in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 77

Notice: Undefined variable: rows in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 77

Notice: Use of undefined constant submit - assumed 'submit' in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 78

Notice: Undefined index: submit in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 78

 

I put the code as followed:

 


case 'view':
	view($id);
	break;

case 'upload':
	if ($my->id==""){
		header("Location:index.php?option=com_login");
		}
	upload($file,$desc,$catid,$title,$accid);
	break;

default:
	if ($my->id==""){
		header("Location:index.php?option=com_login");
		}

  echo 'file: '.$file.'<br />';
  echo 'desc: '.$desc.'<br />';
  echo 'catid: '.$catid.'<br />';
  echo 'title: '.$title.'<br />';
  echo 'accid: '.$accid.'<br />';

	upload($file,$desc,$catid,$title,$accid);
	break;
}

[/code]

Link to comment
Share on other sites

Notice: Undefined variable: desc in /home/gamezspa/public_html/components/com_achtube/achtube.php on line 21

I would say that the warning messages are because you're trying to call a variable that hasn't been set yet.

Sometimes you want something to happen only if a variable is set, such as echoing the variable.

most people would simply put:

echo $desc;

but on some servers it throws up warnings if $desc isn't set.

You can sort it by using isset() or adding this line to the top of every page:

error_reporting(E_ALL ^ E_NOTICE);

That's a simple method for removing those errors, but I'd probably weed out where they're coming from and add some isset() statements.

Link to comment
Share on other sites

Ok, I put the simple method of removing the errors I had, they are now gone, my problem now is that files are not uploading to the server, is this web hosting related, they offer FFMPEG, but I don't know why this will not work for me.

Link to comment
Share on other sites

  echo 'file: '.$file.'<br />';
  echo 'desc: '.$desc.'<br />';
  echo 'catid: '.$catid.'<br />';
  echo 'title: '.$title.'<br />';
  echo 'accid: '.$accid.'<br />';

that part is just trying to echo the variables, which is giving you the warnings, because it can't find them.

 

It seems to me that you should have a form of some kind which submits the data?

Link to comment
Share on other sites


function upload($file,$desc,$catid,$title,$accid){
global $database;
$database->setQuery( "SELECT * FROM #__achtube_config");
$database->loadObject($row);
if ($database -> getErrorNum()) {
echo $database -> stderr();
return false;
}
global $mosConfig_absolute_path,$mosConfig_live_site,$database,$my;
$query = "SELECT d.name as name, d.id as id from #__groups as d";
$database->setQuery($query);
$accs = $database->loadObjectList();
$myacc[] = mosHTML::makeOption( -1, "Select Access Level");
foreach($accs as $obj){
$myacc[] = mosHTML::makeOption( $obj->id, $obj->name);
}
$lists['accs'] = mosHTML::selectList( $myacc, 'accid', 'class="inputbox" size="1" ', 'value', 'text');
$query = "SELECT s.name as name, s.id as id from #__categories as s WHERE s.section = $row->secid AND s.published = 1 AND s.access <= '$usertype' ORDER BY s.ordering";
$database->setQuery($query);
$cats = $database->loadObjectList();
$mycat[] = mosHTML::makeOption( -1, "Select Category");
foreach($cats as $obj){
$mycat[] = mosHTML::makeOption( $obj->id, $obj->name);
}
$lists['cats'] = mosHTML::selectList( $mycat, 'catid', 'class="inputbox" size="1" ', 'value', 'text');
HTML_achtube::upload($option, $rows[0], $lists);
if($_POST[submit]!=""){
global $database;
$vid = new stdClass;
if ($title==""){
$hata = "Please provide a video title";
}
if ($desc==""){
$hata = "Please provide video description";
}
if ($catid=="-1"){
$hata = "Please select a category";
}
if ($file==""){
$hata = "Please select a video file for upload";
}
if ($hata!=""){
mosRedirect("index.php?option=com_achtube&task=upload", $hata);
}
$vhost = $_FILES['file']['name'];
$vhos = strrpos($vhost,".");
$vex = strtolower(substr($vhost,$vhos+1,strlen($vhost)-$vhos));
$vsize = round($_FILES['file']['size']/(1024*1024));
if ($vex!="mpg" && $vex!="avi" && $vex!="mpeg" && $vex!="wmv" && $vex!="rm" && $vex!="dat"){
$hata = "Invalid video format";
}
if ($space > $row_acht['maxvideo']){
$hata = "Video size is too big. Upload limit is : ".$row_acht['maxvideo']." Mb.";
}
$vid->title = $title;
$vid->fulltext = $desc;
$vid->created_by = $my->id;
$vid->created_by_alias = $my->name;
$vid->catid = $catid;
$vid->state = "1";
$vid->sectionid = "1";
$vid->created = date( 'Y-m-d H:i:s' );
$vid->publish_up = date( 'Y-m-d H:i:s' );
$vid->access = $accid;
$vid->metakey = $title." , ".$desc;
$vid->metadesc = $title." , ".$desc;
if (!$database->insertObject( '#__content', $vid, 'id' )) {
echo $database->stderr();
return false;
}
$videono = mysql_insert_id();
$videoname = $videono.".".$vex;
if(isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])){
$videonhost = $mosConfig_absolute_path.$row->videodir."/".$videoname;
if(move_uploaded_file($_FILES['file']['tmp_name'], $videonhost)){
$flvmaker = $row->ffmpegdir;
if($row->htype=="1"){
$flvmaker = $mosConfig_absolute_path.$row->ffmpegdir;
}
exec ($flvmaker." -i ".$videonhost." -acodec ".$row->acodec." -ab ".$row->abit." -ar ".$row->arate." -b ".$row->vbit." -r ".$row->frate." -s ".$row->flvsize." ".$mosConfig_absolute_path.$row->flvdir."/".$videono.".flv");
exec ($flvmaker." -an -y -t 0:5:0.001 -i ".$mosConfig_absolute_path.$row->flvdir."/".$videono.".flv -f image2 ".$mosConfig_absolute_path.$row->jpgdir."/".$videono.".jpg");
$ssim = $mosConfig_absolute_path.$row->jpgdir."/".$videono.".jpg";
$simg = imagecreatefromjpeg($ssim);
$ddim = $mosConfig_absolute_path.$row->tmbdir."/".$videono.".jpg";
$dimg = imagecreatetruecolor($row->tmbl, $row->tmbw);
imagecopyresized($dimg, $simg, 0, 0, 0, 0, $row->tmbl, $row->tmbw, $row->flvl, $row->flvw);
imagejpeg($dimg, $ddim, $row->imgq);
//update
global $database;
$id = $videono;
$vid->ordering = $videono;
$vid->introtext = '<p><a href="'.$mosConfig_live_site.'/index.php?option=com_achtube&task=view&id='.$videono.'&Itemid=1&"><img src="'.$mosConfig_live_site.$row->tmbdir.'/'.$videono.'.jpg" border="0" title="'.$title.'" /></a></p><hr />';
$vid->attribs = $vex;
$vid->images = "com_achtube/intros/".$videono.".jpg";
if (!$database->updateObject( '#__content', $vid, 'id' )) {
echo $database->stderr();
return false;
}
if ($row->auto_publish == "1"){
global $database;
$vidf = new stdClass;
$vidf->content_id = $videono;
$vidf->ordering = $videono;
if (!$database->insertObject( '#__content_frontpage', $vidf, 'id' )) {
echo $database->stderr();
return false;
}
}
}
}
header("Location:index.php");
}

 

hope this helps

Link to comment
Share on other sites

try replacing this:

if ($title==""){
$hata = "Please provide a video title";
}
if ($desc==""){
$hata = "Please provide video description";
}
if ($catid=="-1"){
$hata = "Please select a category";
}
if ($file==""){
$hata = "Please select a video file for upload";
}
if ($hata!=""){
mosRedirect("index.php?option=com_achtube&task=upload", $hata);
}

 

with this:

if ($title=="" || !isset($title)){
$hata = "Please provide a video title";
}
if ($desc==""|| !isset($desc)){
$hata = "Please provide video description";
}
if ($catid=="-1"|| !isset($catid)){
$hata = "Please select a category";
}
if ($file==""|| !isset($file)){
$hata = "Please select a video file for upload";
}
if ($hata!="")){
mosRedirect("index.php?option=com_achtube&task=upload", $hata);
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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