Fix database date: 0000-00-00 -> NULL
This commit is contained in:
+5
-2
@@ -119,8 +119,8 @@
|
||||
$phone = "";
|
||||
$online = 0;
|
||||
$enable = 1;
|
||||
$start = "0000-00-00";
|
||||
$end = "0000-00-00";
|
||||
$start = NULL;
|
||||
$end = NULL;
|
||||
|
||||
$req = $bdd->prepare('INSERT INTO user (user_id, user_pass, user_mail, user_phone, user_online, user_enable, user_start_date, user_end_date)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)');
|
||||
@@ -154,6 +154,9 @@
|
||||
if ($field === 'user_pass') {
|
||||
$value = hashPass($value);
|
||||
}
|
||||
else if (($field === 'user_start_date' || $field === 'user_end_date') && $value === '') {
|
||||
$value = NULL;
|
||||
}
|
||||
|
||||
// /!\ SQL injection: field was checked with in_array function
|
||||
$req_string = 'UPDATE user SET ' . $field . ' = ? WHERE user_id = ?';
|
||||
|
||||
Reference in New Issue
Block a user