From 19fcee3670329bd0e61da0630b686f5125ae52e1 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Tue, 12 Mar 2024 16:16:03 +0300 Subject: [PATCH] if session is missing --- erp24/web/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erp24/web/index.php b/erp24/web/index.php index 8af96de..b2354ac 100644 --- a/erp24/web/index.php +++ b/erp24/web/index.php @@ -29,7 +29,7 @@ if ( unset($postJson["_csrf"]); $post = \yii\helpers\Json::encode($postJson); $app->db->createCommand( - 'INSERT INTO page_statistics (admin_id, url, post, created_at) VALUES ("' . $_SESSION['admin_id'] . '", "' + 'INSERT INTO page_statistics (admin_id, url, post, created_at) VALUES ("' . ($_SESSION['admin_id'] ?? -1) . '", "' . $url . '", :post, NOW())' )->bindParam(':post', $post, PDO::PARAM_STR)->execute(); } -- 2.39.5