From 1697d37943186f9e37fd83b76b7bd7eae8463dcf Mon Sep 17 00:00:00 2001 From: pezcurrel Date: Thu, 7 May 2020 14:57:17 +0200 Subject: [PATCH] ... --- web/mustard/tools/addsuperadmin.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 web/mustard/tools/addsuperadmin.php diff --git a/web/mustard/tools/addsuperadmin.php b/web/mustard/tools/addsuperadmin.php new file mode 100755 index 0000000..6245a7b --- /dev/null +++ b/web/mustard/tools/addsuperadmin.php @@ -0,0 +1,29 @@ +#!/bin/php + '.N,1); + +$iniarr=parse_ini_file('../sec/mastostartadmin.ini') + or mexit('Impossibile aprire il file di configurazione.'.N,1); +$link=mysqli_connect($iniarr['db_host'],$iniarr['db_admin_name'],$iniarr['db_admin_password'],$iniarr['db_name'],$iniarr['db_port'],$iniarr['db_socket']) + or mexit('Impossibile connettersi al database: '.mysqli_connect_error().' ['.mysqli_connect_errno().']'.N,1); +mysqli_set_charset($link,'utf8mb4'); + +mysqli_query($link,"INSERT INTO Admins (ID, Username, Email, Password, Level) VALUES (NULL, '".myesc($link,$argv[1])."', '".myesc($link,$argv[2])."', '".myesc($link,password_hash($argv[3],PASSWORD_DEFAULT))."', 'super')") + or mexit(mysqli_error($link).N,2); + +mysqli_close($link); + +exit(0); + +?>