Fix the duration set error
This commit is contained in:
parent
3fbeb06948
commit
06de0eb561
2 changed files with 3 additions and 4 deletions
|
@ -29,7 +29,6 @@ if (empty($_POST)) {
|
|||
</div>
|
||||
<?php
|
||||
} else {
|
||||
|
||||
$length = 6;
|
||||
$token = bin2hex(random_bytes($length));
|
||||
if (isset($_POST['fsize']) && is_numeric($_POST['fsize'])) {
|
||||
|
@ -42,7 +41,7 @@ if (empty($_POST)) {
|
|||
} else {
|
||||
$text = '';
|
||||
}
|
||||
if (isset($_POST['fduration']) && in_array($_POST['fduration'], DataBase::OPTIONS_DURATION)) {
|
||||
if (isset($_POST['fduration']) && key_exists($_POST['fduration'], DataBase::OPTIONS_DURATION)) {
|
||||
$duration = $_POST['fduration'];
|
||||
} else {
|
||||
$duration = DataBase::DEFAULT_DURATION;
|
||||
|
|
4
db.php
4
db.php
|
@ -198,10 +198,10 @@ class DataBase
|
|||
}
|
||||
if (!isset($duration)) {
|
||||
$duration = self::DEFAULT_DURATION;
|
||||
} elseif (!in_array($duration, self::OPTIONS_DURATION)) {
|
||||
} elseif (!key_exists($duration, self::OPTIONS_DURATION)) {
|
||||
$duration = self::DEFAULT_DURATION;
|
||||
}
|
||||
$duration = date('Y-m-d H:i:s', strtotime($duration));
|
||||
$duration = date('Y-m-d H:i:s', strtotime(self::OPTIONS_DURATION[$duration]));
|
||||
$stmt = $this->db->prepare("
|
||||
INSERT INTO clouds(code, text, size, delete_t)
|
||||
VALUES (:code, :text, :size, :duration);
|
||||
|
|
Loading…
Reference in a new issue