1
ninja
my album -p image upload problem
  • 2003/12/4 17:13

  • ninja

  • Just popping in

  • Posts: 70

  • Since: 2003/5/27


i just installed myalbum -p and i was able to upload 1 pix for the first time. However, I tried again and i got this error msg:


RROR: Could not query the database.
Error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ' res_y= WHERE lid=2' at line 1

2
CBlue
Re: my album -p image upload problem

You will have to fix that error in your MySQL database by bringing up the table that has that error in it.

Or...you can have a look at the page that has that error in it and fix it then reupload it to your album-p module folder.

3
ninja
Re: my album -p image upload problem
  • 2003/12/4 17:28

  • ninja

  • Just popping in

  • Posts: 70

  • Since: 2003/5/27


i checked the database and it was ok.

how do i come about fixing the problem on the page that has error ?
thank you.

4
CBlue
Re: my album -p image upload problem

First, I don't use the album-p module, I use xoopsgallery...but if you take a look into your modules/album-p folder you should be able to find some kind of file that says submit (it will be a php file). Look for that file and bring it up in a text editor. Then look for the words that your error says is wrong.

If you can understand some php, you should be able to see what needs to be changed. If you can't, then pm a copy of the script to me and I'll look at it to see if I can find the problem.

If you can't find the right file to edit, I'll download the module myself and try to find it for you. Just let me know.

5
ninja
Re: my album -p image upload problem
  • 2003/12/4 18:45

  • ninja

  • Just popping in

  • Posts: 70

  • Since: 2003/5/27


here is the code for submit.php

Quote:

// GIJ all check done.

include("header.php");
include_once(XOOPS_ROOT_PATH."/class/xoopstree.php");
include_once(XOOPS_ROOT_PATH."/class/module.errorhandler.php");
include_once(XOOPS_ROOT_PATH."/class/uploader.php");

$myts =& MyTextSanitizer::getInstance();
$eh = new ErrorHandler;
$mytree = new XoopsTree($table_cat,"cid","pid");

// reject Guest
if( ! $xoopsUser ) {
redirect_header(XOOPS_URL."/user.php",2,_ALBM_MUSTREGFIRST) ;
exit();
}


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

$submitter = $xoopsUser->uid();

// Check if Title exist
if( $_POST["title"] == "" ) {
// $eh->show("1001");
$_POST['title'] = 'no title' ;
}

// Check if Description exist
if( $_POST['desc_text']=="") {
// $eh->show("1008");
$_POST['desc_text'] = "" ;
}

$cid = isset( $_POST['cid'] ) ? $_POST['cid'] : 0 ;
$newid = $xoopsDB->genId( $table_photos."_lid_seq" ) ;

// Check if upload file name specified
$field = $_POST["xoops_upload_file"][0] ;
if( empty( $field ) || $field == "" ) {
$eh->show( "7000" ) ;
}
$field = $_POST['xoops_upload_file'][0] ;

// Check if file uploaded
if( $_FILES[$field]['tmp_name'] == "" || ! is_readable( $_FILES[$field]['tmp_name'] ) ) {
redirect_header( 'submit.php' , 2 , _ALBM_FILEERROR ) ;
exit ;
}

if( $myalbum_useimagick ) $uploader = new XoopsMediaUploader( $photos_dir , $array_allowed_mimetypes , $myalbum_fsize ) ;
else $uploader = new XoopsMediaUploader( $photos_dir , $array_allowed_mimetypes , $myalbum_fsize , $myalbum_width , $myalbum_height ) ;

$uploader->setPrefix( 'tmp_' ) ;
if( $uploader->fetchMedia( $field ) && $uploader->upload() ) {

$title = $myts->makeTboxData4Save( $_POST["title"] ) ;
$desc_text = $myts->makeTareaData4Save( $_POST["desc_text"] ) ;
$date = time() ;
$tmp_name = $uploader->getSavedFileName() ;
$ext = preg_replace( "/^.+\.([^.]+)$/sU" , "\\1" , $tmp_name ) ;

$sql = "INSERT INTO $table_photos (lid, cid, title, ext, submitter, status, date, hits, rating, votes, comments) VALUES ($newid, $cid, '$title', '$ext', $submitter, ".intval( ! $myalbum_needadmit )." , $date, 0, 0, 0, 0)";
$xoopsDB->query( $sql ) or $eh->show( "0013" ) ;
if( $newid == 0 ) {
$newid = $xoopsDB->getInsertId();
}

if( $myalbum_useimagick ) {
modifyPhotoByImagick( "$photos_dir/$tmp_name" , "$photos_dir/$newid.$ext" ) ;
} else {
rename( "$photos_dir/$tmp_name" , "$photos_dir/$newid.$ext" ) ;
}

$dim = GetImageSize( "$photos_dir/$newid.$ext" ) ;
$xoopsDB->query( "UPDATE $table_photos SET res_x={$dim[0]}, res_y={$dim[1]} WHERE lid=$newid") or $eh->show("0013");

if( ! createThumb( "$photos_dir/$newid.$ext" , $newid , $ext ) ) {
$xoopsDB->query( "DELETE FROM $table_photos WHERE lid=$newid" ) ;
redirect_header( 'submit.php' , 2 , _ALBM_FILEERROR ) ;
exit ;
}

$xoopsDB->query( "INSERT INTO $table_text (lid, description) VALUES ($newid, '$desc_text')") or $eh->show("0013");

// Update User's Posts (Should be modified when need admission.)
$xoopsDB->query( "UPDATE ".$xoopsDB->prefix('users')." SET posts = posts+$myalbum_addposts WHERE uid = $submitter" ) ;

redirect_header("index.php",2,_ALBM_RECEIVED."");
exit ;

} else {

include(XOOPS_ROOT_PATH."/header.php");

echo $uploader->getErrors();
@unlink( $uploader->getSavedDestination() ) ;

include(XOOPS_ROOT_PATH."/footer.php");
exit ;
}

} else {

// check Categories exist
$result = $xoopsDB->query( "SELECT count(cid) as count FROM $table_cat" ) ;
list( $count ) = $xoopsDB->fetchRow( $result ) ;
if( $count < 1 ) {
redirect_header(XOOPS_URL."/modules/myalbum",2,_ALBM_MUSTADDCATFIRST);
exit();
}

include(XOOPS_ROOT_PATH."/header.php");
OpenTable() ;
mainheader() ;

include_once( "../../class/xoopsformloader.php" ) ;
include_once( "../../include/xoopscodes.php" ) ;
$form = new XoopsThemeForm(_ALBM_PHOTOUPLOAD, "uploadphoto", "submit.php");
$pixels_text = "$myalbum_width x $myalbum_height" ;
if( $myalbum_useimagick ) $pixels_text .= " (auto resize)" ;
$pixels_label = new XoopsFormLabel( _ALBM_MAXPIXEL , $pixels_text ) ;
$size_label = new XoopsFormLabel( _ALBM_MAXSIZE , $myalbum_fsize ) ;
$form->setExtra( "enctype='multipart/form-data'" ) ;

$question_text = new XoopsFormText( _ALBM_PHOTOTITLE , "title" , 50 , 255 ) ;

if( isset( $_GET['cid'] ) ) $cid = $_GET['cid'] ;
else $cid = 0 ;

$cat = new XoopsFormSelect( _ALBM_PHOTOCAT , "cid" , $cid ) ;
$tree = $mytree->getChildTreeArray(0,"title") ;
foreach( $tree as $leaf ) {
$leaf['prefix'] = substr($leaf['prefix'], 0, -1);
$leaf['prefix'] = str_replace(".","--",$leaf['prefix']);
$cat->addOption( $leaf['cid'],$leaf['prefix'].$leaf['title'] ) ;
}
$desc_tarea = new XoopsFormDhtmlTextArea( _ALBM_PHOTODESC , "desc_text" , "" , 10 , 50 ) ;
$file_form = new XoopsFormFile( _ALBM_SELECTFILE , "photofile", $myalbum_fsize ) ;
$file_form->setExtra( "size='70'" ) ;

if( $myalbum_useimagick ) {
$rotate_radio = new XoopsFormRadio( _ALBM_RADIO_ROTATETITLE , 'rotate' , 'rot0' ) ;
$rotate_radio->addOption( 'rot0' , _ALBM_RADIO_ROTATE0." &nbsp; " ) ;
$rotate_radio->addOption( 'rot90' , "<img src='images/icon_rotate90.gif' alt='"._ALBM_RADIO_ROTATE90."' /> &nbsp; " ) ;
$rotate_radio->addOption( 'rot180' , "<img src='images/icon_rotate180.gif' alt='"._ALBM_RADIO_ROTATE180."' /> &nbsp; " ) ;
$rotate_radio->addOption( 'rot270' , "<img src='images/icon_rotate270.gif' alt='"._ALBM_RADIO_ROTATE270."' /> &nbsp; " ) ;
}

$op_hidden = new XoopsFormHidden( "op" , "submit" ) ;
$counter_hidden = new XoopsFormHidden( "fieldCounter" , 1 ) ;
$submit_button = new XoopsFormButton( "" , "submit" , _SUBMIT , "submit" ) ;
$form->addElement( $pixels_label ) ;
$form->addElement( $size_label ) ;
$form->addElement( $question_text ) ;
$form->addElement( $desc_tarea ) ;
$form->addElement( $cat ) ;
$form->addElement( $file_form ) ;
if( $myalbum_useimagick ) $form->addElement( $rotate_radio ) ;
$form->addElement( $counter_hidden ) ;
$form->addElement( $op_hidden ) ;
$form->addElement( $submit_button ) ;
$form->setRequired( $file_form ) ;
$form->display() ;
CloseTable() ;
include("footer.php");
}

?>

6
CBlue
Re: my album -p image upload problem

I can't see the line the that corresponds to your MySQL error. I will download the module and take a look at it to see if I can find the page that has the error on it for you.

Which version of myalbum-p did you install?

7
ninja
Re: my album -p image upload problem
  • 2003/12/4 19:44

  • ninja

  • Just popping in

  • Posts: 70

  • Since: 2003/5/27


I installed the previous version (v2.0)as well as the lastest version 2.5 and still facing the same problem.
the weird thing is that i installed the same script on a different website (but on the same server) and it's working just fine.

8
CBlue
Re: my album -p image upload problem

Can you try replacing the files of that module on your server with the same files from a backup of the module, without having to reinstall and see if that fixes the problem? It could be that a file got corrupted.

9
ninja
Re: my album -p image upload problem
  • 2003/12/4 22:34

  • ninja

  • Just popping in

  • Posts: 70

  • Since: 2003/5/27


i tried that, but didn't work :(

I also did a clean install, and this time i got a blank page with #644 appeared in the upper left corner



10
CBlue
Re: my album -p image upload problem

That sounds like a chmod problem.

Login

Who's Online

118 user(s) are online (88 user(s) are browsing Support Forums)


Members: 0


Guests: 118


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits