[GER] Updater GUI shareV 1.3
Aus Meinen SpeedCoding video '[GER] | SpeedCoding - Updater (1/2) | Unbemerkt'
index.php:
Code:
index.php Für Abfrage URL: (z.B. http://meinedomain.de/plugins/index.php)
Code:
Und noch die Updater.java klasse. (für spigot) (für generell: #folgt)
Code:
<?php
$con = mysqli_connect("host","user","password","db");
if (!isset($_GET['id'])){
die("ID IS MISSING");
}
$id = $_GET['id'];
$erg = mysqli_query($con,"SELECT * FROM `resourcen` WHERE `id`='$id'");
if (!$erg) die("FEHLER!");
$row = mysqli_fetch_array($erg);
if (isset($_GET['info'])){
if ($_GET['info'] == "dl"){
echo $row['UPDATE_URL'];
}else if ($_GET['info'] == "msg"){
echo $row['UPDATE_TEXT'];
}
}else {
echo $row['version'];
}
?>
index.php Für Abfrage URL: (z.B. http://meinedomain.de/plugins/index.php)
Code:
<?php
$token = "YOURTOKEN"; //in Settings zu finden
$con = mysqli_connect("127.0.0.1","xxunbemerktxx","FKam6pWWN839wy3M","xxunbemerktxx");
if (!isset($_GET['token'])){
die("0");
}
$getToken = $_GET['token'];
if (isset($_GET['createdb'])){
if ($getToken != $token) die();
$erg = mysqli_query($con,"CREATE TABLE IF NOT EXISTS resourcen(id int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, version varchar(255), name varchar(255), UPDATE_URL VARCHAR(255),UPDATE_TEXT TEXT NOT NULL DEFAULT 'none')");
if (!$erg){
die("ERR");
}else{
die("OK");
}
}else if (isset($_GET['update'],$_GET['URL'],$_GET['version'],$_GET['name'],$_GET['msg'])) {
if ($getToken != $token) die();
$id = $_GET['update'];
$url = $_GET['URL'];
$version = $_GET['version'];
$name = $_GET['name'];
$msg = $_GET['msg'];
$erg = mysqli_query($con,"UPDATE `resourcen` SET `name`='$name', `version`='$version', `UPDATE_URL`='$url', `UPDATE_TEXT`='$msg' WHERE `id`='$id'");
if (!$erg){
die("ERR");
}else{
die("OK");
}
}else if(isset($_GET['create'],$_GET['URL'],$_GET['version'])){
if ($getToken != $token) die();
$name = $_GET['create'];
$name = mysqli_real_escape_string($con,$name);
$url = $_GET['URL'];
$url = mysqli_real_escape_string($con,$url);
$version = $_GET['version'];
$version = mysqli_real_escape_string($con,$version);
$erg = mysqli_query($con,"INSERT INTO `resourcen`(`name`,`version`,`UPDATE_URL`) VALUES ('$name','$version','$url')");
if (!$erg){
die("ERR");
}else{
die("OK");
}
}else if(isset($_GET['id'], $_GET['setting'])) {
if ($getToken != $token) die();
$id = $_GET['id'];
$setting = $_GET['setting'];
$erg = mysqli_query($con,"SELECT * FROM `resourcen` WHERE `id`='$id'");
if (!$erg){
die("ERR");
}
$row = mysqli_fetch_array($erg,MYSQLI_ASSOC);
die($row[$setting]);
}else if(isset($_GET['id'])) {
if ($getToken != $token) die();
$id = $_GET['id'];
$erg = mysqli_query($con,"SELECT * FROM `resourcen` WHERE `id`='$id'");
echo(mysqli_num_rows($erg));
die();
}else if(isset($_GET['name'])) {
if ($getToken != $token) die();
$name = $_GET['name'];
$erg = mysqli_query($con,"SELECT * FROM `resourcen` WHERE `name`='$name'");
die(mysqli_num_rows($erg));
}else if (isset($_GET['list'])){
if ($getToken != $token) die();
$erg = mysqli_query($con,"SELECT * FROM `resourcen`");
while ($zeile = mysqli_fetch_array( $erg, MYSQLI_ASSOC))
{
echo($zeile['id']." - ".$zeile['name']." - ".$zeile['version']."\n");
}
die();
}else{
if ($getToken == $token){
die("OK");
}else{
die();
}
}
?>
Und noch die Updater.java klasse. (für spigot) (für generell: #folgt)