Jump to content

jamesxg1

Members
  • Posts

    1,133
  • Joined

  • Last visited

Everything posted by jamesxg1

  1. Slightly hard to read because there is no "[ PHP][/ PHP]" or "[ CODE][/ CODE]" tags surrounding the results but; Array ( [0] => Dundo Maroje.txt [1] => popis.txt ) Array ( [0]=> Dundo Maroje.txt [1] => popis.txt ) So if you were to put this in your logic it should put you on the right tracks. echo $file[0] . ' - ' . $file[1] . '<br />'; echo $files[0] . ' - ' . $files[1] . '<br />'; James.
  2. No, to my knowledge an array does not have a maximum limit. However, your hosting company will have a load time limit, so if your array is large breaking it down may exceed this limit, thus making the page exit. James.
  3. I think $_POST['filedel'] is the submit button, maybe? Could be wrong here tho... James
  4. echo '<pre>' . print_r($file, true) . '</pre>'; echo '<pre>' . print_r($files, true) . '</pre>'; Send the results of that back here and I'll see what I can do. James.
  5. My pleasure :-)! Happy coding! James.
  6. Well I figured that much since they're posting in a PHP forum. Thanks! Haha! My bad LOL! I must admit the logic is a little strange, the rendering time on this must be somewhat stunted by the complexity of a simple variable assignment process... LOL James.
  7. This is PHP, this is more than likely rendered through an MVC framework or CMS system to finalize the output. EG: <{assign var="title" value=$people->getShow()|cat:$people->getName()|escape}> assign var="title" // This would make a variable named title ($title) value=$people->getShow()|cat:$people->getName() // This would make the variable $title have the value $people->getShow()|cat:$people->getName() |escape // This would escape the string. Maybe try <{assign var="title" value=$people->getShow() | cat:$people->getName()|escape}> I'm not sure if it will work but it's worth a shot! James.
  8. <?php $words = explode(' ', $query); echo '<pre>' . print_r($words, true) . '</pre>'; ?> That should put you on the right track! James.
  9. Sorted and cleaned! <?php class Form { public $values = array(); public $errors = array(); public $num_errors; public function Form() { if(isset($_SESSION['value_array']) && isset($_SESSION['error_array'])) { $this->values = $_SESSION['value_array']; $this->errors = $_SESSION['error_array']; $this->num_errors = count($this->errors); unset($_SESSION['value_array']); unset($_SESSION['error_array']); } else { $this->num_errors = 0; } return true; } public function setValue($field, $value) { $this->values[$field] = $value; return true; } public function setError($field, $errmsg) { $this->errors[$field] = $errmsg; $this->num_errors = count($this->errors); return true; } public function value($field) { if(array_key_exists($field, $this->values)) { return htmlspecialchars(stripslashes($this->values[$field])); } else { return ""; } } public function error($field) { if(array_key_exists($field, $this->errors)) { return "<font size=\"2\" color=\"#ff0000\">" . $this->errors[$field] . "</font>"; } else { return ""; } } public function getErrorArray() { return $this->errors; } } ?> James.
  10. Please post the code that handles this input. James.
  11. Cleaner code! You will now be able to work with this file a-lot easier. <?php include_once dirname(__FILE__) . '/config/config.php'; $id = $_POST['id']; $active = $_POST['active']; $name = $_POST['name']; $menu_file = $_FILES['menu_file']; $i = 0; foreach($id as $key) { if(empty($active[$i])) { $active[$i] = 'off'; } $active_post = $active[$i]; $name_loop = $name[$i]; $file_name = $menu_file['name'][$i]; $file_type = $menu_file['type'][$i]; $file_size = $menu_file['size'][$i]; $file_error = $menu_file['error'][$i]; $file_temp = $menu_file['tmp_name'][$i]; if(!empty($file_name)) { if($file_type !== 'application/pdf') { header('Location: ' . dirname(__FILE__) . '/index.php?page=Menus&error=Incorrect_File_Type'); exit; } else { if($file_size > 5242880) { header('Location: ' . dirname(__FILE__) . '/index.php?page=Menus&error=Incorrect_File_Size'); exit; } else { $today = date('d-m-Y'); $uploaddir = '/home/penmillh/en/includes/menus/'; $upload_name = str_replace(' ', '', $name_loop) . $today . '.pdf'; $uploadfile = $uploaddir . $upload_name; if($file_error !== 'UPLOAD_ERR_OK') { header('Location: ' . dirname(__FILE__) . '/index.php?page=Menus&error=File_Upload_Error'); exit; } elseif($file_error === 'UPLOAD_ERR_OK') { move_uploaded_file($file_tmp, $uploadfile); // You may want to concider a LIMIT in this query? Also, escape them inputs!! $query = "UPDATE `menus` SET `active` = '" . $active . "', `menu` = '" . $name_loop . "', `location` = '" . $upload_name . "' WHERE `id` = '" . $value . "'"; $query = mysql_query($query) or die(mysql_error()); header('Location: ' . dirname(__FILE__) . '/index.php?page=Menus&error=File_Upload_Success'); exit; } } } } if(empty($file_name)) { // Again, you may want a LIMIT here? And you need to escape them inputs!! $query = "UPDATE `menus` SET `active` = '" . $active_post . "' WHERE `id` = '" . $key . "'"; $query = mysql_query($query) or die(mysql_error()); /* * header('Location: ' . dirname(__FILE__) . '/index.php?page=Menus&error=Menu_Change_Success'); */ } $i++; } ?> James. EDIT: Forgot to add the dirname(__FILE__) .
  12. Take a look at substr_replace James.
  13. $letters = array('l', 'o', 's'); $numbers = array('1', '0', '5'); $final = str_replace($letters, $numbers, $DIRTY_QUERY); Is this what you are looking for? James.
×
×
  • 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.