diff --git a/README.md b/README.md index 49b3675..a71f845 100644 --- a/README.md +++ b/README.md @@ -29,4 +29,4 @@ https://twitter.com/stetto98 ##License Released under the MIT License - http://opensource.org/licenses/mit-license.php -Current MySQLCommands version is A_0.1.1 +Current MySQLCommands version is A_0.1 diff --git a/config.php b/config.php index 01a43e7..6abe722 100644 --- a/config.php +++ b/config.php @@ -7,17 +7,15 @@ $dbpass = '12345'; //Your DB Password. $dbname = 'minecraft'; //Your DB Name. - $debug = 'false'; //Debug mode, set to 'true' to activate. - +$updatechecking = 'true'; //Should the Script search for Updates automatically /* Do not edit down here if you don't know what you are doing! */ if($debug != 'true') { error_reporting(0); } - /* Update Variables | DO NOT EDIT THESE OR YOU WOULD NOT BE ABLE TO CHECK FOR UPDATES! */ -$version = "A_0.1.1"; +$version = "A_0.1.2"; diff --git a/execute.php b/execute.php index 2766cac..ea7ac17 100644 --- a/execute.php +++ b/execute.php @@ -21,13 +21,10 @@ function MessageHandler($message,$type) { echo "Success: $success"; } } - if(!empty($_POST['command'])) { -require_once("./config.php"); - +require("./config.php"); if($debug != 'true') { $con = mysql_connect($dbhost,$dbname,$dbpass); - if(!$con) { $error = "Couldn't connect to database."; MessageHandler($error,0); @@ -35,11 +32,8 @@ function MessageHandler($message,$type) { } else { $con = mysql_connect($dbhost,$dbname,$dbpass) or die("Couldn't connect to database. Error:".mysql_error()); } - mysql_select_db($dbname) or die("Cannot select defined database. Error:".mysql_error()); - $command = $_POST['command']; - $command_count = strlen($command); if($command_count > "255") { $error = "Your Message contains too many characters. Maximum is 255 and you used $command_count of them."; @@ -47,28 +41,22 @@ function MessageHandler($message,$type) { } $check1 = strpos($command, '"'); $check2 = strpos($command, "'"); - if($check1 !== false or $check2 !== false) { $error = "Your Message contains not allowed characters."; MessageHandler($error,0); } - $insert = mysql_query("INSERT INTO `MySQLCommands` (`command`) VALUES('$command')") or die("MYSQL INSERT COMMAND QUERY ERROR: " . mysql_error()); $success = "Command '$command' successfully scheduled."; MessageHandler($success,1); } elseif(!empty($_GET['delete'])) { - require_once("./config.php"); - + require("./config.php"); $con = mysql_connect($dbhost,$dbname,$dbpass); - if(!$con) { $error = "Couldn't connect to database."; MessageHandler($error,0); } mysql_select_db($dbname) or die("Cannot select defined database. Error:".mysql_error()); - $id = $_GET['delete']; - $delete = mysql_query("DELETE FROM `MySQLCommands` WHERE `id` = '$id'"); if(!$delete) { $error = "There was an error while performing the request."; @@ -81,4 +69,3 @@ function MessageHandler($message,$type) { $error = "Command not defined."; MessageHandler($error,0); } -?> diff --git a/index.php b/index.php index 58dfba1..8a23913 100644 --- a/index.php +++ b/index.php @@ -23,12 +23,13 @@ MySQL Commands • Web UI - + +
-MySQL Commands Console +

MySQL Commands Console

@@ -38,7 +39,7 @@ !

-

Send your command to the Minecraft Server. Characters ' and " will be removed.


+

Send your command to the Minecraft Server. Characters ' and " will be removed.


@@ -46,31 +47,25 @@ connect_error) { + die("Couldn't connect to database. Error:".$conn->connect_error); } -} else { - $con = mysql_connect($dbhost,$dbname,$dbpass) or die("Couldn't connect to database. Error:".mysql_error()); -} -mysql_select_db($dbname) or die("Cannot select defined database. Error:".mysql_error()); -$select = mysql_query("SELECT * FROM `MySQLCommands` ORDER BY `id` ASC"); +$select = 'SELECT * FROM `MySQLCommands` ORDER BY `id` ASC'; +$rs=$con->query($select); -$count = mysql_num_rows($select); +$count = $rs->num_rows; if($count >= 1) { echo "
"; echo ""; -while($row = mysql_fetch_array($select)) { +while($row = mysqli_fetch_array($rs)) { echo ""; } echo "
#CommandAction
".$row['id']."".$row['command']."
"; diff --git a/update.php b/update.php index eb6ed7e..db6341e 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@ GitHub"; header("Location: ./index.php?error=$fail_1"); } +} ?>