Jump to content

adam291086

Members
  • Posts

    1,312
  • Joined

  • Last visited

    Never

Everything posted by adam291086

  1. Hello, I have this upload script that creates thumbnails. But i keep getting the following errors here is the full script <?php require_once 'Classes/ExtendedFileManager.php'; require_once('config.inc.php'); $file = $_FILES['upload']; $error = 0; $size = 0.45; if(!empty($file)) { $dir = $_POST['dir']; $target = "/home/rubberduckiee/webapps/editor/Xinha/plugins/ExtendedFileManager/files".$dir."/".basename($file['name']) ; $file_extension = strtolower(substr(strrchr($file['name'], "."), 1)); $max_size = $IMConfig['max_filesize_kb_image']; //This is our limit file type condition if(!in_array($file_extension, $IMConfig['allowed_image_extensions'])) { $message = "Please make sure you are uploading the correct file type"; if(is_file($file['tmp_name'])) { unlink($file['tmp_name']); } $error = 1; } else if (file_exists($target)) { $error = 1; $message = "File alread exists"; if(is_file($file['tmp_name'])) { unlink($file['tmp_name']); } } else if(!is_file($file['tmp_name'])) { $message = "Pease make sure you are uploading a file"; $error = 1; if(is_file($file['tmp_name'])) { unlink($file['tmp_name']); $error = 1; } } else if(!is_uploaded_file($file['tmp_name'])) { $message = "Pease make sure you are uploading a file"; $error = 1; if(is_file($file['tmp_name'])) { unlink($file['tmp_name']); } } else if($file['size']>($max_size*1024)) { $message = "File size is too large. Max size is 10Mb"; $error = 1; if(is_file($file['tmp_name'])) { unlink($file['tmp_name']); } } if ($error == 1) { header('Location: http://rubberduckiee.webfactional.com/file/error_upload/'.$message); } else if (in_array($file_extension, array("jpg","bmp","jpeg"))) { if (move_uploaded_file($file['tmp_name'], $target)) { // Get new dimensions list($width_orig, $height_orig) = getimagesize($target); if ($width_orig > $IMConfig['thumbnail_width']) { $width = $width_orig * $size; } else { $width = $width_orig; } if ($height_orig > $IMConfig['thumbnail_height']) { $height = $height * $size; } else { $height = $height_orig; } // Resample $image_p = imagecreatetruecolor($width, $height); $image = imagecreatefromjpeg($target); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); $pathToThumbs = "/home/rubberduckiee/webapps/editor/Xinha/plugins/ExtendedFileManager/files".$dir."/thumbnail/"; $fname = "thumbnail_".$file['name']; if (imagejpeg($image_p, "{$pathToThumbs}{$fname}")) { header('Location: http://rubberduckiee.webfactional.com/file/browse'); } else { $message = "file not uploaded"; header('Location: http://rubberduckiee.webfactional.com/file/error_upload/'.$message); unlink($target); } } } else { move_uploaded_file($file['tmp_name'], $target); header('Location: http://rubberduckiee.webfactional.com/file/browse'); } } ?>
  2. what is wrong with this <?php if ($_SERVER['HTTP_REFERER']) { if($_GET['id']) { $con = mysql_connect("","",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("rubberduckiee", $con); $result = mysql_query("SELECT * FROM email_content where id=".$_GET['id']); while($row = mysql_fetch_array($result)) { if($_GET['part'] == "body") { echo $row['email_content_body']; } elseif($_GET['part'] == "footer") { echo $row['email_content_footer']; } elseif ($_GET['part'] == "header") { echo $row['email_content_header']; } } } } ?> i am getting the error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/rubberduckiee/webapps/editor/email_editor.php on line 17
  3. Hello, I am creating an app for public use. I was after some advice on form security to prevent code injections and 100% secure. Also what are peoples thoughts on passing information through URL's. i.e www.example.com?id=1. Should this information be encrypted or just left?
  4. Hello, I need some advice. I am planning to make a email template system. This will allow a user to select a template, add in the content and send it to a group of users. I was planning to have a collection of templates that have code inside them to grab the content from the database depending on the users ID and content area. Is this the best way to do this?
  5. this is just a simple database with PHP interactions. You will need a simple HTML form submitting info Database table with all the prices PHP and MYSQL for taking the users info and querying it into a database. search for these different items on the internet, this will give you the basic knowledge to make your app. heres an example of forms and php http://www.tizag.com/phpT/forms.php
  6. ok, i was just trying to get some alternative suggestions. I know joomla but there is oftern some smaller open source CMS that are much better
  7. Its because you are going through the while loop using $query and your trying to re set $query in the while loop and therefore messing up the while loop.
  8. The main need is to have a selection of templates the user can select for their websites. A good WYSIWYG editor
  9. also try $query = mysql_query("SELECT * FROM `mp3links` WHERE `scraped` = '1'"); to $query = mysql_query("SELECT * FROM mp3links WHERE scraped = '1'");
  10. change $update = $row[sourcefile]; $update = $row['sourcefile']; thats one error but nothing to do with line 10, not sure whats causeing that error.
  11. check the file type once uploaded with an if statement or switch statement $_FILES['attachement']['type']
  12. google it heres one example http://www.tizag.com/phpT/fileupload.php
  13. try echoing out you variables to make sure they contain information
  14. i have created my own before but the open source ones seem to offer more power and flexibility
  15. Hello, I am after some advice with which CMS to use.
  16. Hello, i am using codeignighter frameword here is my class <?php class UserForm extends Controller { function index() { $this->load->helper(array('form', 'url')); $this->load->library('form_validation'); $this->form_validation->set_rules('username', 'Username', 'required'); $this->form_validation->set_rules('password', 'Password', 'required'); if ($this->form_validation->run() == FALSE) { $this->load->view('login'); } else { $query_username = $_POST['username']; // query username $query_password = $_POST['password']; // query password $query = $this->db->query("SELECT * FROM persons WHERE username='".$query_username."' AND password='".$query_password."'"); foreach ($query->result() as $row) { echo $row->username; } } } } ?> i am getting the error message and i dont know why?
  17. What file types can i use with and where can i get some font files? imageloadfont ( string $file )
  18. thanks, used corbins method
  19. yeah but how can i get the post data?
  20. i have my input names set to date1 date2 and i want to set up a little loop to get that data for example $number = 10; while($i<$number) { $date = $_POST['date'.$i.]; $1++ } i keep getting an internal server error why?
  21. <?php // load the image from the file specified: $im = imagecreatefrompng("image.png"); // if there's an error, stop processing the page: if(!$im) { die(""); } // define some colours to use with the image $yellow = imagecolorallocate($im, 255, 255, 0); $black = imagecolorallocate($im, 0, 0, 0); // get the width and the height of the image $width = imagesx($im); $height = imagesy($im); // draw a black rectangle across the bottom, say, 20 pixels of the image: imagefilledrectangle($im, 0, ($height-20) , $width, $height, $black); // now we want to write in the centre of the rectangle: $font = 4; // store the int ID of the system font we're using in $font $text = "vdhri.net"; // store the text we're going to write in $text // calculate the left position of the text: $leftTextPos = ( $width - imagefontwidth($font)*strlen($text) )/2; // finally, write the string: imagestring($im, $font, $leftTextPos, $height-18, $text, $yellow); // output the image // tell the browser what we're sending it header("Content-Type: image/png"); // output the image as a png imagepng($im); // tidy up imagedestroy($im); ?>
  22. I am looking at this tutorial http://discomoose.org/2005/10/19/write-text-on-to-an-existing-png-image-using-php/ but when i print out the image all i get is Why?
  23. They will be HTML or an Image. Which ever would be easiest
  24. Hello, I need some advice on the best way to solve the problem below. I have a simple form that a user can fill out and the information is added to a database. This i can do easily. But i want to have a button the user can click called "create image". This will prompt for the user to select a template. Once selected all the information from the database will be put into certain areas of that template. I then need to create a final jpeg of the template design with the database information into it.
×
×
  • 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.