peipst9lker
-
Posts
81 -
Joined
-
Last visited
Never
Posts posted by peipst9lker
-
-
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.
-
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!
-
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.
-
Go and change your password Mr.RobertoNumber
-
Eclipse with PHP Development Tools (I'm using Linux)
-
Edit: Nevermind, I was blind
-
-
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.
-
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)
-
$row['DS'] // type :float (with one decimal like 12.2)
$row['TC'] // type :float (with one decimal like 24.2)
what im exctaly try to do in the make the above calcualtion
$row['TC'] / $row['DS'] ( $row['DS'] need to be as intenger (without point,like 12)
and the resulte should be with two decimal like (2.32)
Use typecasting
$var = ($row['TC'] / (int)$row['DS']);
For the future please put code in
tags! (remove the spaces in the brackets)
-
I'd go for an individual record for each bookable item. If 30 booked out and 29 returned you then know exactly which one (serial number, spec etc)
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
-
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.
-
Obfuscation has nothing to do with compiling.
Read again bro
-
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.
A simple question about e-mail confirmation and how to secure it
in PHP Coding Help
Posted
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.