Jump to content

peipst9lker

Members
  • Posts

    81
  • Joined

  • Last visited

    Never

Everything posted by peipst9lker

  1. Just use a random token which is saved in a database and only valid for like 24hours or something. Why would you use an encryption (sha1) ? There are no sensitive data inside which need to be encrypted. This confirmation code is only to proof that the email recievant is valid.
  2. You can use mktime() and date() to get the last monday and then convert it into datetime format. Here's a little snippet for datetime conversion, the rest is for you because I don't have much time right now. function strToDateTime($input) { return preg_replace('/^(\d{2}).(\d{2}).(\d{4}) (\d{2})\d{2})\d{2})$/', '$3-$2-$1 $4:$5:$6', $input); } Edit: Forgot to mention, you can use > and < operators in datetime where-clauses.
  3. The function escapes characters like ' and " to prevent MySQL Injections which is a sort of attack to gain access to your database without permission. $query = "SELECT * FROM table WHERE name = '".mysql_real_escape_string($userinput)."'";
  4. Why are recursive functions horrible? Used properly they're extremely powerful!
  5. Yep go back to school Have you checked the output ? Take care that SimpleXML can't handle XML with namespaces!
  6. Probably overkill but yeah... function containsInteger($input) { return (boolean)preg_match("/[0-9]/", $input); }
  7. 1. Use $_POST['searchtype'] instead of $HTTP_POST_VARS['searchtype']; 2. Your mysq_pconnect() has wrong syntax check here for right syntax.
  8. Eclipse with PHP Development Tools (I'm using Linux)
  9. Replace $fruits with your array. $totals = array(); foreach ($fruits as $fruit) foreach ($fruit as $type => $val) { if (isset($totals[$type])) $totals[$type] += (int)$val; else $totals[$type] = (int)$val; }
  10. 1. In your delete_post page you have to initialize $post_id, place above query execution. $post_id = (int)$_GET['post_id']; 2. Check with mysql_error() or any other method like mysql_affected_rows() to validate query execution.
  11. Keep in mind any user can modify POST and GET data easily.
  12. Keep in mind that AJAX is just 7 years old (developed 2005)
  13. cyberRobot, you're just removing decimal places, TS needs to convert datatypes before calculating.
  14. Check if your RSS provider has something like a checksum or hash value of the newest RSS. If so you can use it to check for changed else you have to download the RSS over and over again. I guess you're not getting banned for this (except you download it 100 times a second)
  15. Use typecasting $var = ($row['TC'] / (int)$row['DS']); For the future please put code in tags! (remove the spaces in the brackets)
  16. I totally agree on that, provides a much better control.
  17. Table resources: id, name, amount Table bookings: id, resource_id, amount_booked, booking_date, etc. Example: You have a resource with id 1, name is Camera XY, amount is 30. Someone already created a booking of resource_id = 1 and amount_booked = 10. Execute a query which sums up amount_booked from table bookings where resource_id = 1 and you're done
  18. What is your actual goal? This is the Coding Help forum
  19. Any kind of escape or string character e.g ', ",\ needs to be filtered. I see no problem with the characters you delivered. Maximum protection would be prepared statements as Drongo_III already mentioned.
  20. Edit: PLease provide the code from EvaluateHands! Please put code in [php ] tags! (You can find a php-button in the editor)
  21. No? You can handle that in 1 query, which will have to be executed whenever a sms is sent.
×
×
  • 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.