Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. The below does not work due to prevent SQLi foreach($_POST['station_id'] as $stationID => $value) { $insertStatement .= "INSERT into table (`song`, `station`) VALUES ('" . $_POST['song_id'] . "','$stationID');\n"; /*The semicolon inside is IMPORTANT.. the \n is just to put them on separate lines if you feel like looking at them */ } $insertThem = mysql_query($insertStatement); ID1 | song_id | station_id ID2 | song_id | station_id ID3 | song_id | station_id It's sufficient to write song_id (PK) | station_id (PK) As I doubt a station would have the same song twice even if so it shouldn't be documented in this table.
  2. I think of it as a school assignment
  3. Whatever you do don't believe him it will take you atleast 3-4 days to fully understand how osCommerce works especially because of it's great application design (*ahum*) depending on your familiarity with PHP you can deduct or add days which basically means that choosing osCommerce six days before the end will screw you over stick to what you have. It's better to mess 6 days with something you know to get it to work then to mess with something you know barely and stress is a slowing down factor. You can lean a great lesson out of this and that is to ALWAYS start with your high-risk, high-value components of your application you can identify these quite easily: If I didn't implement this am I then screwed? If the answer is yes you should put it on top and start or experiment on this first and make sure it WORKS.
  4. Not if you are writing C++
  5. Point them to the .frm file An easier method is: foreach ($t_array as $val){ list($order_of_verse, $book_name, $chapter, $verse, $text) = explode("\t",$val); echo "<p><strong>$book_name $chapter : $verse</strong></p>$text\n"; } I doubt I will ever see/go to that place altough I helped numerous of people. Christianity has a well-known history for burning, abusing, murdering and prosecuting without trial anyone related or in favour of Mathematics (to which we owe the Pentagram's dark background) or Technology (computers are tools of Evil apparently). None of this has any offensive meaning I just want to point out that it is anything but a ticket.
  6. What type of server would i need, who would you suggest? (all data transfer will be text) If you are looking to host a community website you may be looking at servers. In this case you may want to contact a hosting company to discuss your needs and which solution fits your problem best. Altough you should do fine in the first year with one server. What type of programs need to be running on this server? You don't need to worry about this as hosting companies know their craft and they will take care of it. What should i have as the core language for this system? Really depends PHP is a good choice Facebook runs on it. They recently release HipHop of which you can benefit once the website and the number of visitors becomes really large. Is there a pre made program set up that is already available for this type of site or would i need to hire someone? I still can't really figure out what you actually want to build my current impression leans towards Twitter What type of set up would i need if i would want to make my site secure, i would like to be credible. A secure database ... go figure. This is a really broad topic and I strongly advice to use a framework of some sort that is well-tested and uses tried-and-true methods. What should i do for trauma management. ie attacks breakages and what not. Trauma Management???
  7. 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.
  8. You code is not 100% plus I see some vulnerabilities read http://www.scanit.be/uploads/php-file-upload.pdf to avoid future problems
  9. 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
  10. 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.
  11. 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"
  12. Makes you wonder why those boys at php.net go through all the trouble?!
  13. 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>
  14. Experimenting is good but not if you have a client waiting then you should be using a sure thing like Zend_Mail
  15. Well I surely want to see him try Who knows he may be the next Linus Torvalds
  16. 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 } }
  17. 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)
  18. $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']); }
  19. 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); }
  20. 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());
  21. easy enough DELETE FROM table WHERE table.field = $fieldvalue AND table.user_id = $uid Mind the bold text
  22. 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
  23. 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
  24. 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.
×
×
  • 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.