...

View Full Version : Quick Code Help



jaydeesmith8
05-17-2011, 04:24 AM
Hi All,

I have a site where the admin area has a backside PHP / SQL language and is supposed to upload a product image from the applet embedded into the page, but the page opens to a SYNTAX ERROR and I can not tell if the applet would work to add to the SQL DB TABLE for the product image until I get the page working.

Can one of you smart people help me out as it might take you two seconds to review and correct this page code and me a year!!

The SYNTAX ERROR I get is:

Parse error: syntax error, unexpected '{' in /home/xxxxxxx/public_html/admin/modules/catalog/base_add_pic.php on line 37 and line 37 in the code below begins with:

if(isset($_POST['action']){


Thanks in advance,
JD

Here is the page code if anyone can check to see if the page will encounter more and more syntax errors:


<?php

define ('DIRSEP', DIRECTORY_SEPARATOR);

include realpath(dirname(__FILE__) . DIRSEP . '..' . DIRSEP . '..' . DIRSEP) . DIRSEP . "includes" . DIRSEP . "nav" . DIRSEP . "header2.php";

if (isset($_POST['base_id'])){
$base_id =$_GET['base_id'];
$dir = '../../../'.$config['products_dir'];
}else{
$e->setError("No Base ID POSTED");
}

//check if base_id is valid from GET

$sql = "SELECT * FROM pr_base_info WHERE base_id = '$base_id'";

$count=$db->numRowsQ($sql);

$result=$db->query($sql);

if($count == 1){

$clean_id=$base_id;
$short_desc=$result['short_desc'];
//find any associated pics
$sql = "SELECT * FROM pr_base_pics where base_id = '$base_id'";
$count=$db->numRowsQ($sql);
if ($count>=1){
$pic_result=$db->query($sql);
}
} else {

$e->setError("Sub group Id value is invalid");
}

if(isset($_POST['action']){
if($POST['action']== 'delete'){

if (isset($POST['pic_name'])){
$pic_name = $POST['pic_name'].'.jpg';

if(file_exists($dir.$pic_name)){
unlink($dir.$main);
}

$delete_sql = "DELETE * FROM pr_base_pics WHERE pic_name = '$pic_name'";

$db->query($delete_sql);

$e->setError("$subgroup_name has been deleted...please wait.");

?>

<script type="text/javascript" language="javascript">

setTimeout('window.top.location.reload();parent.parent.GB_hide();', 1000);

</script>

<center>

<br /><br />

<?php $e->showErrors();?>

</center>

<?php

}else{
$e->setError("no pic name given to delete!");
}

}elseif($POST['action']== 'add'){

}else{
$e->setError("Bad Action Posted");
}
}else{

?>

<center><span class="title">Delete <?php echo $subgroup_name ?>?</span><br />

<?php $e->showErrors(); ?>

<form method="post" action="">

<table border='0' cellpadding='4'>

<tr>

<td><?php echo "WARNING deleting this item will delete any assocaited pictures and it's extended items" ?></td>

<td><input type="submit" value="Delete <?php echo $short_desc ?>" /><input type="hidden" name="action" value="delete" /></td>

<td><input type="button" value="Cancel Deletion" onclick="parent.parent.GB_hide();" /></td>

</tr>

</table>
}
</form>

<applet id="jumpLoaderApplet" name="jumpLoaderApplet"
code="jmaster.jumploader.app.JumpLoaderApplet.class"
archive="<?php echo $config['admin_url'] ?>modules/catalog/mediautil_z.jar,sanselan_z.jar,jumploader_z.jar"
width="715"
height="500"
mayscript>
<param name="uc_sendImageMetadata" value="true"/>
<param name="uc_imageEditorEnabled" value="true"/>
<param name="uc_useLosslessJpegTransformations" value="true"/>
<param name="uc_uploadUrl" value="<?php echo $config['admin_url'] ?>modules/catalog/partitionedUploadHandler.php"/>
<param name="uc_uploadScaledImages" value="true"/>
<param name="uc_scaledInstanceNames" value="small,medium,large"/>
<param name="uc_scaledInstanceDimensions" value="100x100,200x200,400x400"/>
<param name="uc_scaledInstanceQualityFactors" value="900,800,700"/>
<param name="uc_scaledInstanceQualityFactors" value="900,800,700"/>
<param name="ac_fireUploaderFileAdded" value="true"/>
<param name="ac_fireUploaderFileStatusChanged" value="true"/>
<param name="uc_fileNamePattern" value="^.+\.(?i)((jpg)|(jpe)|(jpeg)|(gif)|(png)|(tif)|(tiff))$"/>
<param name="vc_fileNamePattern" value="^.+\.(?i)((jpg)|(jpe)|(jpeg)|(gif)|(png)|(tif)|(tiff))$"/>
<param name="vc_disableLocalFileSystem" value="false"/>
<param name="vc_mainViewFileTreeViewVisible" value="true"/>
<param name="vc_mainViewFileListViewVisible" value="true"/>
<param name="uc_imageRotateEnabled" value="true"/>
<param name="uc_scaledInstancePreserveMetadata" value="true"/>
<param name="uc_deleteTempFilesOnRemove" value="true"/>
</applet>
<script>

<?php

}

include realpath(dirname(__FILE__) . DIRSEP . '..' . DIRSEP . '..' . DIRSEP) . DIRSEP . "includes" . DIRSEP . "nav" . DIRSEP . "footer2.php";

?>

shadowmaniac
05-17-2011, 04:48 AM
if(isset($_POST['action'])){

You missed a closing bracket

jaydeesmith8
05-17-2011, 07:17 AM
Dang it... I looked at all the brackets!! How did I miss that?

Thanks greatly... That works.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum