Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Quick Code Help

  1. #1
    New to the CF scene
    Join Date
    May 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Quick Code Help

    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:

    Code:
    <?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";
    
    ?>

  • #2
    Regular Coder
    Join Date
    Apr 2005
    Location
    Ohio
    Posts
    254
    Thanks
    1
    Thanked 63 Times in 63 Posts
    PHP Code:
    if(isset($_POST['action'])){ 
    You missed a closing bracket

  • #3
    New to the CF scene
    Join Date
    May 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks

    Dang it... I looked at all the brackets!! How did I miss that?

    Thanks greatly... That works.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •