From e71014efcd1e204e4f51d87c74d43fbf1b13b8a5 Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Sat, 15 Jul 2023 17:10:02 -0500 Subject: [PATCH] Added the user who created the link into the database --- result.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/result.php b/result.php index 89638f2..4373f8f 100644 --- a/result.php +++ b/result.php @@ -1,4 +1,5 @@ count() != 0) { exit; } -$rand_num = rand(0,99999999); -$statement = $session->prepare('INSERT INTO data (id, url, shortlink, is_geo, radius, latitude, longitude, when_created) VALUES (?,?,?,?,?,?,?,toTimestamp(now())) USING TTL 20'); +$statement = $session->prepare('INSERT INTO data (id, url, shortlink, is_geo, radius, latitude, longitude, user, when_created) VALUES (now(),?,?,?,?,?,?,?,toTimestamp(now())) USING TTL ?;'); if ($is_geo == 1) { - $options = array($rand_num,$url,$shortlink,boolval($is_geo),intval($radius), $latitude, $longitude); + $options = array($url,$shortlink,boolval($is_geo),intval($radius), $latitude, $longitude, $_SESSION['user'], intval($ttl)); } else { - $options = array($rand_num,$url,$shortlink,boolval($is_geo),null,null,null); + $options = array($url,$shortlink,boolval($is_geo),null,null,null,$_SESSION['user'],intval($ttl)); } $result = $session->execute($statement,array('arguments' => $options));