From d7d06bbc301b752cee066fb4ba14c3155e725f38 Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Fri, 30 Jun 2023 15:23:11 +0300 Subject: [PATCH] Adding are_you_sure() --- helpers.inc.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/helpers.inc.php b/helpers.inc.php index ff041e9..92af91e 100644 --- a/helpers.inc.php +++ b/helpers.inc.php @@ -1132,3 +1132,15 @@ if(!function_exists('str_ends_with')) return $needle === "" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false); } } + +function are_you_sure() +{ + echo "Are you sure you want to proceed?(type YES): "; + $resp = trim(fread(STDIN, 10)); + //var_dump($resp); + if($resp != "YES") + { + echo "exiting then\n"; + exit(); + } +}