blake87 Posted July 2, 2007 Share Posted July 2, 2007 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 https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/ Share on other sites More sharing options...
Yesideez Posted July 2, 2007 Share Posted July 2, 2007 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 https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287871 Share on other sites More sharing options...
blake87 Posted July 2, 2007 Author Share Posted July 2, 2007 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 https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287874 Share on other sites More sharing options...
Yesideez Posted July 2, 2007 Share Posted July 2, 2007 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 https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287880 Share on other sites More sharing options...
blake87 Posted July 2, 2007 Author Share Posted July 2, 2007 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 https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287884 Share on other sites More sharing options...
Yesideez Posted July 2, 2007 Share Posted July 2, 2007 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 https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287887 Share on other sites More sharing options...
blake87 Posted July 2, 2007 Author Share Posted July 2, 2007 The permissions will not allow me to add the code, I will do my best to add the echo statements ASAP, thanks again Link to comment https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287890 Share on other sites More sharing options...
Yesideez Posted July 2, 2007 Share Posted July 2, 2007 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 https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287892 Share on other sites More sharing options...
blake87 Posted July 2, 2007 Author Share Posted July 2, 2007 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 https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287896 Share on other sites More sharing options...
Dragen Posted July 2, 2007 Share Posted July 2, 2007 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 https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287898 Share on other sites More sharing options...
blake87 Posted July 2, 2007 Author Share Posted July 2, 2007 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 https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287906 Share on other sites More sharing options...
sushant_d84 Posted July 2, 2007 Share Posted July 2, 2007 Initiallise All u r variables first Link to comment https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287909 Share on other sites More sharing options...
Dragen Posted July 2, 2007 Share Posted July 2, 2007 where are you getting the variables from: $file $desc $catid $title $accid $usertype $option $rows Link to comment https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287912 Share on other sites More sharing options...
blake87 Posted July 2, 2007 Author Share Posted July 2, 2007 I think it may be these: file: desc: catid: title: accid: Link to comment https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287914 Share on other sites More sharing options...
Dragen Posted July 2, 2007 Share Posted July 2, 2007 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 https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287916 Share on other sites More sharing options...
blake87 Posted July 2, 2007 Author Share Posted July 2, 2007 I am not sure, when I submit on the front end, nothing happens Link to comment https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287919 Share on other sites More sharing options...
Dragen Posted July 2, 2007 Share Posted July 2, 2007 Could you post the form you submit with please? Link to comment https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287921 Share on other sites More sharing options...
blake87 Posted July 2, 2007 Author Share Posted July 2, 2007 http://www.gamezspace.net/index.php?option=com_achtube&Itemid=67 the form is there if this helps Link to comment https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287927 Share on other sites More sharing options...
Dragen Posted July 2, 2007 Share Posted July 2, 2007 I need to register to view the page and I don't really want to sign-up to yet another forum Can't you just post some of the code for the form? Link to comment https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287930 Share on other sites More sharing options...
blake87 Posted July 2, 2007 Author Share Posted July 2, 2007 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 https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287931 Share on other sites More sharing options...
Dragen Posted July 2, 2007 Share Posted July 2, 2007 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 https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287933 Share on other sites More sharing options...
blake87 Posted July 2, 2007 Author Share Posted July 2, 2007 I got an error at this line now if ($hata!="")){ Any ideas My mistake I know a bit about programming and it I got two braces when it should be one if ($hata!=""){ instead of if ($hata!="")){ Link to comment https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287944 Share on other sites More sharing options...
Dragen Posted July 2, 2007 Share Posted July 2, 2007 ah yeah, sorry my mistake there. Do you still recieve problems uploading files? Link to comment https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287957 Share on other sites More sharing options...
blake87 Posted July 2, 2007 Author Share Posted July 2, 2007 Yes it does stil not allow me to upload Link to comment https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287980 Share on other sites More sharing options...
Dragen Posted July 2, 2007 Share Posted July 2, 2007 are you using the form which you gave me the link to? if so could you please copy and paste the code that makes up the form? the <form action="someaction" method="post"> part. Link to comment https://forums.phpfreaks.com/topic/58059-please-help-im-sorry/#findComment-287981 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.