Jump to content

son.of.the.morning

Members
  • Posts

    292
  • Joined

  • Last visited

    Never

Posts posted by son.of.the.morning

  1. Now this one is a bit of a shit head. I am using a really comprehensive class i found on on the web for upload / re-size / crop but i want to be able to override it's error handling and i am not good enough to start modifying the code in the class with out fucking it up.

     

    Firstly i will show you how i have invoked the class.

    					if( isset($_FILES['image'] ) ) {
    
    								//Class includes
    								include("../scrips/php/cms/database.insert.class.php");
    								include ("../scrips/php/cms/img.upload.resize.crop.class.php.php");
    
    
    								//----------|Start: upload, resize & save
    								$your_image = new _image; 
    
    								//----------| Upload orginal image
    								$your_image->uploadTo = 'uploads/';
    								$upload = $your_image->upload($_FILES['image']);
    
    
    								//----------| Resize and upload small thumbnail
    								$your_image->newPath = 'thums/';
    								$your_image->newWidth = 50;
    								$your_image->newHeight = 50;
    								$resized = $your_image->resize();
    
    
    
    								//----------| Resize and upload medium thumbnail
    								$your_image->newPath = 'thums2/';
    								$your_image->newWidth = 100;
    								$your_image->newHeight = 100;
    								$resized = $your_image->resize();
    								//----------| Getting the image name to insert into the database futher on in the code
    								$name = $resized;
    								$img_str = explode("/",$name);
    								$final_img_name = $img_str['1'];
    
    								echo "Article has been added!";
    
    								//----------------|end
    
    								//----------------| Start database insert (class manipulation)
    								$table = "blog_posts"; 
    								$title = "'".$_POST['ArticleTitle']."',"; 
    								$img = "'".$final_img_name."',"; 
    								$post = "'".$_POST['ArticleBody']."',"; 
    								$aurthor_id = "'1',";
    								$category_id = "'".$_POST['Category']."',";
    								$date_posted = "NOW()";
    
    
    								$values = array("$title","$img","$post","$aurthor_id","$category_id","$date_posted");
    								$fields = array('title,','img,','post,','aurthor_id,','category_id,','date_posted'); 
    								$obj= new DatabaseInsert;
    								$obj->DatabaseConnectionRequire();
    								$obj->ArticleInsert($values,$fields,$table);
    								//----------------|end
    						}
    
    

     

    As you can see it's fairly basic. What i want to do is before it runs this script and starts including/invoking the class etc, i want to be able to check to see if there is a value been posted from a FILE FORM OBJECT and if there is to proceed with this script, alternatively i want it to execute another code which will handle it in regards to the concept of my page. A simple javascript alert with be ok providing it reloaded the page to it's default state. If any one can help me here i would appreciate it a lot. Thanks

     

  2. What's the best string function to use if i want to split a string up affter a specific character?

     

    In this case i have a var with "uploads/thisImage.jpg"    i want to split this so i can create a new var value of "thisImage.jpg"

  3. Alright guys, i have been looking for a simple script for this online to try get my head around it. I need a script thats is going to take an image and save the orginal file along with two modified files (small and medium thumbnail). I really cant get my head around the ones i have already seen so i was wondering if anyone had any advice or a link they can post me to that can help me.

  4. No this is the problem the logic is in order of which i want it to be becuase of other functionality within the document. This is why i have to result in finding an alt solution.

     

    This is the peice of code i need to modify in order to solve this issue. I would prefer a simple echo with jquery/ajax to make a live area.

    if(isset($_POST['val'])) {
                            include("../scrips/php/cms/delete.multiple.itmes.php");
                            $table = "blog_posts";
    					if(isset($_POST['SelectedItems'])) {
    
    						$ids = $_POST['SelectedItems'];
    						$obj= new MultipleDelete;
                           		$obj->delete($ids,$table);
    						echo "<script type='text/javascript'>
                                   		 $('#CommentBox').fadeIn(2000);
                                  	  </script>";
                            	
    
    					}
    
    

  5. Alright guys, I have a bit of a problem here. I am deleting records using isset($_POST) on the current page but when it submits the records i deleted are still visible. I was thinking of echoing some jquery/ajax to re-load the div that displays the records. Has anyone ever done this before?

     

    I dont want the entire page to re-load just that specific area.

  6. I didnt want to post the code becuase there is quite a lot of it but here it is anyway

     

    <?php

    if(isset($_GET['id'])) {

    $DeleteId = $_GET['id'];

    mysql_query("DELETE FROM blog_posts WHERE ID=$DeleteId") or die (mysql_error());

    echo "Record #".$DeleteId." had been sucessfully deleted.";

    } ?>

     

     

    <?php 
    				$rowNum = "0";
    				while($record_rows = mysql_fetch_array($records_returned)){
    					if(++$rowNum % 2 == 1 ) {
    			?>
                    <form action="" method="post" name="DeleteSelected">
                    <div class="Record">
                    	<div class="Thumbnail"><img src="../img/articles/thums/<?php echo $record_rows['img_url']; ?>" class="RecordThumbnail"/></div>
                        <div class="RecordContent">
                        	<div class="PostTitle"><strong><?php echo $record_rows['title']; ?></strong></div>
                            <div class="CheckItem">
                            	Select: <input name="DeleteItem<?php echo $record_rows['id']; ?>" type="checkbox" value="<?php echo $record_rows['id']; ?>" />
                            </div>
                            <div class="PostSnipit"><?php echo substr($record_rows['post'], 0,50)."..."; ?></div>
                        	<div class="SelectOptions">
                            <div class="DeleteRecord" name="sub">Delete Article</div>
                            <div id="VeiwRecord">Hide Details</div><div id="DeleteConfirm">Are you sure you would like to delete this record?   <a href="?id=<?php echo $record_rows['id']; ?>" class="BlankLink"><input name="SingleRecordDelete" type="button" value="Yes." class="DeleteBtn" /></a>   <input name="" type="button" value="No." class="DeleteBtn" id="HideDeleteOptions" /></div>
                            <div id="ViewMoreHidden">
    						<div class="MoreText"><?php echo substr($record_rows['post'], 0,250)."..."; ?></div>
                                <div class="PostedOn"><i><?php echo "Posted on: ".$record_rows['date_posted']; ?></i></div>
                            </div>
                        </div>
                        </div>
                    </div>
                    <?php } else {?>
    

     

     

  7. Yea i know this, i am just tring to create the primary functions in. The other part of the code is a while loop that creats a list of records, each row containing a button that says delete with the url as...

     

    <a href"?id=<?php ehco $rows['id'] ?>">delete</a>
    

     

    it them returns the url and then i GET the var ID from the url using the code i showed on the previous post. Sorry i havnt explained my self very well here

  8. Sorry i forgot to add it in.

     

    				if(isset($_GET['id'])) {
    					$DeleteId = $_GET['id'];
    					mysql_query("DELETE FROM blog_posts WHERE ID=$DeleteId") or die (mysql_error());
    					echo "Record #".$DeleteId." had been sucessfully deleted.";
    				}
    
    

  9. I am delete records using $_POST on the current page using isset() function. The records are deleting and the isset function is working but the corresponding record still appears in the list of records until the page is reloaded again.

  10. i have a while loop that builds up a table of records, each row has a button that needs to have an action to delete that specific record. I can think of the obvious way around this and add a form around each row and set the button to type="submit". However there is a problem i have the entire table of records wrapped within in a form object for other functionalities.

     

    Does anyone have a solution for this problem?

  11. Alright guys i really need a bit of help here. I have two hidden divs and two buttons i want each button to slideToggle() a hidden div but when one div has been have visible i want the other div to disapear again. Any idears?

     

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