From e2860cee0216bfeb8e7cadd31b63f52ef9a5b1bb Mon Sep 17 00:00:00 2001 From: MallocNull Date: Wed, 20 Aug 2014 19:03:43 -0500 Subject: [PATCH] good tidings to zion what is a zion --- bot/bot/Autonomous.cs | 1 + bot/bot/Bot.cs | 2 +- bot/bot/bot.csproj | 1 + www/admin.php | 109 ++++++++++++++++++++++++++++++++++++++ www/auto.php | 119 ++++++++++++------------------------------ www/config.php | 2 +- www/header.php | 2 +- www/index.php | 5 ++ www/resp.php | 4 +- 9 files changed, 155 insertions(+), 90 deletions(-) create mode 100644 www/admin.php diff --git a/bot/bot/Autonomous.cs b/bot/bot/Autonomous.cs index e1391ce..8151660 100644 --- a/bot/bot/Autonomous.cs +++ b/bot/bot/Autonomous.cs @@ -6,5 +6,6 @@ using System.Threading.Tasks; namespace bot { class Autonomous { + } } diff --git a/bot/bot/Bot.cs b/bot/bot/Bot.cs index 93898ca..a5240ee 100644 --- a/bot/bot/Bot.cs +++ b/bot/bot/Bot.cs @@ -36,7 +36,7 @@ namespace bot { public static void loadResponseList() { responseList = new List(); var tmp = _G.spawnNewConnection(); - var r = Query.Reader("SELECT * FROM `responses` WHERE", tmp); + var r = Query.Reader("SELECT * FROM `responses`", tmp); while(r.Read()) { if(!r.GetBoolean("independent")) responseList.Add(new Response( diff --git a/bot/bot/bot.csproj b/bot/bot/bot.csproj index 9da499f..a1d17b5 100644 --- a/bot/bot/bot.csproj +++ b/bot/bot/bot.csproj @@ -71,6 +71,7 @@ + diff --git a/www/admin.php b/www/admin.php new file mode 100644 index 0000000..d9a6034 --- /dev/null +++ b/www/admin.php @@ -0,0 +1,109 @@ +accountaccess == false) + header("Location: index.php?err=You do not have permission to access account data!"); + +if($_GET['del']) { + mysql_query("DELETE FROM `admin` WHERE `id`=".$_GET['del']); + header("Location: admin.php"); +} + +if($_POST["editId"]) { + // TODO update this + if(trim($_POST["password"])) + mysql_query("UPDATE `admin` SET `username`='". mysql_real_escape_string($_POST['username']) ."', `password`='". hash('sha256',$_POST['password']) ."', `accountaccess`=". (($_POST['access'])?"1":"0") ." WHERE `id`=". $_POST['editId']) or die(mysql_error()); + else + mysql_query("UPDATE `admin` SET `username`='". mysql_real_escape_string($_POST['username']) ."', `accountaccess`=". (($_POST['access'])?"1":"0") ." WHERE `id`=". $_POST['editId']) or die(mysql_error()); + header("Location: admin.php"); +} + +if($_POST["username"] && !$_POST["editId"]) { + mysql_query("INSERT INTO `admin` (`username`,`password`,`accountaccess`) VALUES ('". mysql_real_escape_string($_POST['username']) ."','". hash('sha256',$_POST['password']) ."',". (($_POST['access'])?"1":"0") .")") or die(mysql_error()); + header("Location: admin.php"); +} + +include("header.php"); +?> + +
+
+ + Admin Account List +

New Admin Account

+
+ + + + +   + + + ". $acc->username ." + + + ". (($acc->accountaccess)?"Has access to admin accounts":"Does not have access to admin accounts") ." + + + "; + } + ?> +
+ + Create New Account +
+

+ Username: + +

+

+ Password: + +

+

+ Has access to admin accounts? + +

+

+ +      + +

+
+ + Edit Account +
+

+ Username: + +

+

+ Password: + + (leave blank if not changing) +

+

+ Has access to admin accounts? + accountaccess) { ?> checked="checked" /> +

+

+ + +      + +

+
+ +
+
+ \ No newline at end of file diff --git a/www/auto.php b/www/auto.php index 8d2f0a2..cb4628c 100644 --- a/www/auto.php +++ b/www/auto.php @@ -28,12 +28,12 @@ if($_POST["resptype"] && !$_POST["editId"]) { include("header.php"); ?> \ No newline at end of file diff --git a/www/resp.php b/www/resp.php index 290b782..3acdc35 100644 --- a/www/resp.php +++ b/www/resp.php @@ -43,7 +43,7 @@ if($_POST["editId"]) { if(isset($_POST["op".$i])) $c .= $_POST["op".$i] .";"; } - mysql_query("UPDATE `responses` SET `conditions`='". mysql_real_escape_string($c) ."', `respid`=". $_POST['resptype'] .", `parameters`='". mysql_real_escape_string($_POST['parameters']) ."', `cooldown`=". (($_POST['cdd']==0)?-1:$_POST['cooldown']) .", `independent`=". $_POST['indie'] ." WHERE `id`=". $_POST['editId']) or die(mysql_error()); + mysql_query("UPDATE `responses` SET `conditions`='". mysql_real_escape_string($c) ."', `respid`=". $_POST['resptype'] .", `parameters`='". mysql_real_escape_string($_POST['parameters']) ."', `cooldown`=". (($_POST['cdd']==0)?-1:$_POST['cooldown']) .", `independent`=". (($_POST['indie'])?"1":"0") ." WHERE `id`=". $_POST['editId']) or die(mysql_error()); mysql_query("UPDATE `updater` SET `responses`=1 WHERE `id`=1"); header("Location: resp.php"); } @@ -56,7 +56,7 @@ if($_POST["resptype"] && !$_POST["editId"]) { if(isset($_POST["op".$i])) $c .= $_POST["op".$i] .";"; } - mysql_query("INSERT INTO `responses` (`conditions`,`respid`,`parameters`,`cooldown`,`independent`) VALUES ('". mysql_real_escape_string($c) ."',". $_POST['resptype'] .",'". mysql_real_escape_string($_POST['parameters']) ."',". (($_POST['ccd']==0)?-1:$_POST['cooldown']) .",". $_POST['indie'] .")") or die(mysql_error()); + mysql_query("INSERT INTO `responses` (`conditions`,`respid`,`parameters`,`cooldown`,`independent`) VALUES ('". mysql_real_escape_string($c) ."',". $_POST['resptype'] .",'". mysql_real_escape_string($_POST['parameters']) ."',". (($_POST['ccd']==0)?-1:$_POST['cooldown']) .",". (($_POST['indie'])?"1":"0") .")") or die(mysql_error()); mysql_query("UPDATE `updater` SET `responses`=1 WHERE `id`=1"); header("Location: resp.php"); }