Adding are_you_sure()

This commit is contained in:
Pavel Shevaev 2023-06-30 15:23:11 +03:00
parent 4f56388218
commit d7d06bbc30
1 changed files with 12 additions and 0 deletions

View File

@ -1132,3 +1132,15 @@ if(!function_exists('str_ends_with'))
return $needle === "" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false); 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();
}
}