Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. No as you would delete your own record. Most likely you read this information from a database and if you include the uid in the select you can easily spit it out.
  2. You code is not 100% plus I see some vulnerabilities read http://www.scanit.be/uploads/php-file-upload.pdf to avoid future problems
  3. http://www.electrictoolbox.com/php-echo-commas-vs-concatenation/ I have done some searching on the web and it greatly differs some say it's faster others say it's slower Sources: http://hungred.com/useful-information/php-micro-optimization-tips/ http://www.phpbench.com/ http://www.simplemachines.org/community/index.php?topic=47171.0
  4. I second that. You don't want to bother your client (or future maintainers) with half-baked code. Use well-tested and fully documented components or leave it all together.
  5. I suddenly come to think about something how about the following setup: 1. Client: An IFrame that loads the XML file and applies an XSLT template 2. A stored XML file only known to A and B Now everytime a user submits it modifies the XML file (append node). Both clients refresh the IFrame at regular intervals. I wonder what other downsides this could have besides privacy/security? Would there be any gain performance wise? Because this would be the equivalent of multiple databases instead of many people searching (query) through one database each session would have it's own "database"
  6. Makes you wonder why those boys at php.net go through all the trouble?!
  7. I'm guessing you would mean: <a href="delete.php?uid=1" class="delete-button">Delete Record</a> <!-- OR --> <form action="delete.php" method="POST"> <div> <button id="uid" name="uid" type="submit" value="1">Delete Record</button> </div> </form>
  8. Experimenting is good but not if you have a client waiting then you should be using a sure thing like Zend_Mail
  9. Well I surely want to see him try Who knows he may be the next Linus Torvalds
  10. PHP has special classes called DateTime and DateInterval: function my_date_diff($format, $start_date, $end_date) { try { $d1 = new DateTime($start_date); $d2 = new DateTime($end_date); return $d2->diff($d1)->format($format);// in case-of success } catch (Exception $e) { return false; // in case-of failure } }
  11. echo '<option>',$row['City'],', ',$row['State'],'</option>', "\n"; Notice the , instead of . which is faster then concatenating the string I second o3d altough I still use single-quotes for my normal strings and double-quotes whenever variables are involved to make it better readable (thus not really a performance issue but more a readability issue)
  12. $result = mysql_query('SELECT path, etc FROM table WHERE id=1 LIMIT 1'); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { func_name($row['path'], $row['etc']); }
  13. From which sources is this table updated? And how? If all these different sources use your API just different components then you can abstract a method that will invalidate/update the cache file something like: abstract class MySource { final public function store($data) { $this->_store($data); $this->_update(); } private function _update() { /* invalidate/update cache */ } abstract protected function _store($data); }
  14. class MyScanner { public function addPorts() { if (func_num_args() === 2) { $range = range(func_get_arg(0), func_get_arg(1)); $this->_addPorts($range); } else { $this->_addPorts(func_get_arg(0)); } return $this; } private function _addPorts($array) { $array = (array) $array; $this->ports = array_merge($this->ports, $array); } } //Use as: print_r($scanner->addPorts(1, 5)->addPorts(80)->getPorts());
  15. easy enough DELETE FROM table WHERE table.field = $fieldvalue AND table.user_id = $uid Mind the bold text
  16. Route all your request through your item_details.php file so that: http://www.domain.com/item_details-language_en-currency_USD-iid_600.html Is rewritten to: http://www.domain.com/item_details.php/item_details-language_en-currency_USD-iid_600.html Then add additional lines to the start of your item_details.php so that it reads something similar to: if ('images' === substr($_SERVER['PATH_INFO'], 0, 6)) { $image = 'images' . DIRECTORY_SEPARATOR . basename($_SERVER['PATH_INFO']); if (!file_exists($image)) { header('HTTP/1.0 404 Not Found'); exit(0); } echo file_get_contents($image); exit(0); } Take a look at http://php.net/manual/en/reserved.variables.server.php for more information regarding PATH_INFO
  17. Do you want to perform a remote-logoff on a certain user? If so then you may be more interested in session_set_save_handler and create a session's table which will hold all session data. sessions (id (PK), username (ID), lifetime, modified, data) Deleting a record with a specified username now remotely logs off a user
  18. Depends do you have a header file or something? If you have such file then you can use the <base> option otherwise I would take a look at .htaccess to rewrite your image paths from relative to absolute.
  19. That's because you use relative paths like images/my-image.png which leads to the absolute path http://www.domain.com/item_details/language_en/currency_USD/images/my-image.png You can solve this by using either <base> or writing absolute paths instead of relative: function get_image($image_filename) { return HTTP_BASE_PATH . $image_filename; } use as: <img src="<?php get_image('images/my-image.png'); ?>" ...
  20. if(is_array($color_exploded)) { is obsolete as explode only returns something different then an array when: echo "<option value='" . $color_val . "' selected>" . $color . "</option>"; //add some ' I would replace that with: echo '<option value="',$color_val,'"',(($color_val === $chosen_color)?' selected="selected"':''),'>',$color,'</option>';
  21. function str_and(array $array) { $last_value = array_pop($array); return implode(', ', $array) . ' and ' . $last_value; }
  22. This secret knowledge sangoku is referring to is the query: UPDATE products SET quantity = quantity + 5 WHERE sn = 1 Depending on your sort of input there may be better methods
  23. 1. Invest in a proffesional looking website 2. Invest in making your website usable and accessible and valid!! 3. Read up on SEO, SEM, SEA, .. make sure to fully understand SEO Handy SEO document freely distributed by Google http://static.googleusercontent.com/external_content/untrusted_dlcp/www.google.com/nl//webmasters/docs/search-engine-optimization-starter-guide.pdf Learn to use the tools made available by popular search engines (webmaster, analytics, ..) Use Google Analytics to setup Goals and Funnels to see your website progress 4. Learn about writing good copy to lead to a call-to-action These are a few good starters
  24. How do you wish to test your website? If you want to test how many requests your server can currently process then you might be interested in Apache Bench http://httpd.apache.org/docs/2.0/programs/ab.html If you are interested in testing if all appropriate elements are in place you might be interested in Selenium http://seleniumhq.org/ So in what particular testing are you interested?
  25. A quick Google search turned up: http://www.devshed.com/c/a/PHP/Invoice-Management-in-a-PHP-Invoicing-System/3/
×
×
  • 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.