Jump to content

cpd

Members
  • Posts

    883
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by cpd

  1. Have you confirmed POST data was sent with the request? To do this just dump the $_POST array e.g. var_dump($_POST);
  2. Instead of listing things you'd like to do why not describe the specific problem so we can assist in solving it. At the moment you've merely asked how to manipulate arrays but to what end? Moreover, get away from the MySQL library and start using MySQLi, if you want to know why just read the php docs.
  3. Friendly URLs aren't used for SEO, they're used to make it easier for the end user to navigate websites. If a URL is used at all its the domain name not the trailing information. The likes of wikipedia use them so users can go straight to a page as opposed to going through a search engine or their search feature. If you had to remember a long URL to find a page it wouldn't be as friendly. That's why I questioned why the the title is in the URL if it doesn't help locate the resource at all.
  4. You should be able to do this with a single SQL Query but unless we know you're database schema we can't help.
  5. You're still not making sense, not to me anyway. You're passing the element ID to the method and then attempting to add a class to the element. There is no array involved so I've no idea what you're referring to when you talk about "the array that the function usesssss"
  6. I don't always give bad, incomplete or pointless answer. My first post made a point, explained why and told you where to go and correct it (through google) because explaining every little details is silly on here when its been done a million other times by other people. My second post clearly indicates you're posts don't make sense which may be why you have little responses. Gizmola hasn't directly answered your question but instead gone on a tangent explaining in brief what mod_rewrite is for; this is what I told you to lookup in my first post.
  7. What's the point in having the title in the resource identifier at all if it works on the ID?
  8. Not only is it not object oriented its illogical. It doesn't make sense: "class func extends connect"? What on earth is that meant to mean? When creating inheritance hierarchies it should be logical and you should consider the question "Is class A a class B" E.g. Is a Car a Vehicle? "class Car extends Vehicle".
  9. <input type="reset" name="reset" value="Reset" />
  10. You can't redirect once you've sent content to the output buffer. You've sent <html>... etc and then attempt to redirect after that so it'll never work. Move the processing section above all html and use variables for errors. You can then test if the error variables are set and display the content wherever you want the errors to appear.
  11. Oh good lord that's not a good method. $types = array('Word','Excel','PDF'); // Construct SQL first $sql = "SELECT `doctype` FROM `documents` WHERE `doctype` IN ("; foreach($types as $type) $sql.= "'{$type}',"; $sql.= rtrim($sql, ",") . ")"; $sql.= " AND `id` = 100"; // Execute SQL $data = $db->get_row($sql); // Now do whatever you want with results. That said why would it return more than 1 row? Surely the ID should be primary or at least unique?
  12. You could, but it would be inefficient and likely a major security issue depending on who wrote the code stored in the database. You can go with Psycho's method or alternatively, and only if you have written the code not an end user, use the output control functions to have the code evaluated. http://php.net/manual/en/ref.outcontrol.php
  13. You need to add types to some of your link tags. Why have you defined two document ready methods? Use one (may even solve your issue)!
  14. You can't display a resource from a mysql_query(). To display the results you need to use the mysql_fetch_array() or other similar methods. This will retrieve the first row in the result set and move the pointer forward by 1, by default. Calling queries inside while loops which are cycling through result sets often means your carrying out the task in an efficient way as well. Look into JOINs to make it far more efficient. I'm a little stumped as to why you aren't getting anything back if the query is exactly the same which it appears to be. Final point, get away from the mysql functions and start using mysqli or PDO. Can't say it enough times.
  15. You can also use Javascript libraries to manipulate the images however you like. http://raphaeljs.com/
  16. You've not highlighted any problems your having. Just said what you want to do and you already seem to be on the right track to do it so what's the problem? You're current SQL statement can also generate ambiguity. Change it to a join like: SELECT * FROM `client` JOIN `statement` ON `statement`.`client_id` = `client`.`client_id` WHERE `client`.`username` = ':username'
  17. Then google and research AJAX. There are plenty of tutorials. Alternatively, use jQuery as it provides several easy to use implementations.
  18. On review I realised you can't do it any other way than I did, and as described above. I was thinking of ways to determine if the requested amount is divisible by the available notes but couldn't relate the requested amount to the amount of available notes. You can make it easier to work with by dividing the amounts by 10 but that's about it. I also looked into the bankers algorithm which describes what Physco has done and what I did.
  19. That's where I struck a problem and my friend came along . I realised if you were to hypothetically ask the machine for £80 but it has only 2 £50 notes it can't fulfil your request. I never accounted for this so its not a perfect solution. It assumes there is a reasonable amount of each note in the machine to make the requested amount.
  20. Ours have 5s and 10s . And just to defy Jessica completely, sorry, I went and did it myself for a bit of fun. Here's the test describing how it can be used and attached is an Eclipse archive. There's supposedly a more efficient method which would suit handling large quantities of notes. A friend was explaining if you divide all note values by 10 they become prime and from that you can begin to work out the lowest common factor of the requested amount and the available amount... I switched off to say the least. package com.dispenser.money; import java.util.Map; import java.util.TreeMap; import com.dispenser.money.AbstractMoneyDispenser.NotEnoughCashException; public class Test { public static void main(String[] args) { Map<MoneyType, Integer> startUpCash = new TreeMap<MoneyType, Integer>(); startUpCash.put(MoneyType.FIFTY, 3); startUpCash.put(MoneyType.TWENTY, 2); startUpCash.put(MoneyType.TEN, ; MoneyDispenser d = new MoneyDispenser(startUpCash); try { Wallet w = d.withdraw(170); System.out.println(w.toString()); System.out.println(d.toString()); } catch(NotEnoughCashException e) { e.printStackTrace(); } } } MoneyDispenser.zip
  21. If you want to log the IP address consider checking for a proxy as well and logging them together. Look up on google the most efficient method for getting both.
  22. If a human were to think of two numbers they would 1) end up being limited to their knowledge of primes; 2) patterns would begin to emerge therefore a weakness present in the encryption and 3) could leave human error when choosing the primes where one of the conditions described in the wiki article aren't met. Whilst the Rng isn't responsible for ensuring such criteria are met it still plays a part. The last sentence under the title "Importance of strong random number generation" sums up why its particularly important in public-key cryptography to have a strong Rng. Not sure if that quite answers your question but never the less.
  23. cpd

    Injection Help

    If you echo $imid you'll notice it equals 0 (zero). This is because '18 (apostrophe 18) cannot be evaluated to a number therefore intval() fails and returns 0. I assume you then attempt to query your database using 0. This is why I said you need to validate before using intval()
×
×
  • 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.