
peipst9lker
Members-
Posts
81 -
Joined
-
Last visited
Never
Everything posted by peipst9lker
-
A simple question about e-mail confirmation and how to secure it
peipst9lker replied to bugzy's topic in PHP Coding Help
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. -
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.
-
Can someone please explain MySQL_real_escape_string
peipst9lker replied to MjM8082's topic in PHP Coding Help
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)."'"; -
Why are recursive functions horrible? Used properly they're extremely powerful!
-
Yep go back to school Have you checked the output ? Take care that SimpleXML can't handle XML with namespaces!
-
How to check if a variable has a number on it?
peipst9lker replied to bugzy's topic in PHP Coding Help
Probably overkill but yeah... function containsInteger($input) { return (boolean)preg_match("/[0-9]/", $input); } -
1. Use $_POST['searchtype'] instead of $HTTP_POST_VARS['searchtype']; 2. Your mysq_pconnect() has wrong syntax check here for right syntax.
-
CURL Login lssue, Account Required inside....
peipst9lker replied to RobertoNumber's topic in PHP Coding Help
Go and change your password Mr.RobertoNumber -
Eclipse with PHP Development Tools (I'm using Linux)
-
Edit: Nevermind, I was blind
-
Or mktime() + date().
-
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; }
-
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.
-
Keep in mind any user can modify POST and GET data easily.
-
Keep in mind that AJAX is just 7 years old (developed 2005)
-
cyberRobot, you're just removing decimal places, TS needs to convert datatypes before calculating.
-
How can I retrieve data quickly from RSS without hammering?
peipst9lker replied to Berre's topic in PHP Coding Help
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) -
Use typecasting $var = ($row['TC'] / (int)$row['DS']); For the future please put code in tags! (remove the spaces in the brackets)
-
I totally agree on that, provides a much better control.
-
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
-
What is your actual goal? This is the Coding Help forum
-
Question Concerning Special Chars in PHP/MySQL(i) Queries
peipst9lker replied to Mko's topic in PHP Coding Help
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. -
Edit: PLease provide the code from EvaluateHands! Please put code in [php ] tags! (You can find a php-button in the editor)
-
No? You can handle that in 1 query, which will have to be executed whenever a sms is sent.