first commit
This commit is contained in:
parent
137573be5d
commit
07055b55de
2 changed files with 35 additions and 23 deletions
|
@ -33,45 +33,51 @@ $insql = "INSERT INTO $table (date,name,players,maxplayers,map,game,version,time
|
||||||
}
|
}
|
||||||
|
|
||||||
mysqli_close($con);
|
mysqli_close($con);
|
||||||
//exit ;
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// REGEX TIME
|
// REGEX TIME let's go :)
|
||||||
|
|
||||||
|
// time server
|
||||||
$regtimsev = "/[0-9]{1,2}[:][0-9]{1,2}/";
|
$regtimsev = "/[0-9]{1,2}[:][0-9]{1,2}/";
|
||||||
$result = preg_grep($regtimsev, explode(",", $InfoGT));
|
$result = preg_grep($regtimsev, explode(",", $InfoGT));
|
||||||
$timeserver = $result[8];
|
foreach ($result as $key => $val) {
|
||||||
|
$timeserver = $val;
|
||||||
|
}
|
||||||
|
|
||||||
$regtimeacd = "/([0-9][.][0-9]{1})/";
|
// speedtime dayz
|
||||||
$result = preg_grep($regtimeacd, explode(",", $InfoGT));
|
$regtimeacc = "/etm[0-9]{1,2}[.][0-9]{1}/";
|
||||||
$timespeed = $result[5];
|
$result = preg_grep($regtimeacc, explode(",", $InfoGT));
|
||||||
|
foreach ($result as $key => $val) { $timespeed = trim($val,"entm.0"); }
|
||||||
|
|
||||||
$regtimeacn = "/([0-9][.][0-9]{1})/";
|
// speedtime night
|
||||||
|
$regtimeacn = "/entm[0-9]{1,2}[.][0-9]{1}/";
|
||||||
$result = preg_grep($regtimeacn, explode(",", $InfoGT));
|
$result = preg_grep($regtimeacn, explode(",", $InfoGT));
|
||||||
$timespeedn = $result[6];
|
foreach ($result as $key => $val) { $timespeedn = trim($val,"entm.0"); }
|
||||||
|
|
||||||
// HIVE
|
// HIVE
|
||||||
$reghive = '/[^,]...(Hive)/';
|
$reghive = '/[^,]...(Hive)/';
|
||||||
$result = preg_grep($reghive, explode(",", $InfoGT));
|
$result = preg_grep($reghive, explode(",", $InfoGT));
|
||||||
$hive = $result[2];
|
foreach ($result as $key => $val) { $hive = $val; }
|
||||||
|
|
||||||
// battleye check
|
// battleye
|
||||||
$regbattle = "/(battleye)/";
|
$regbattle = "/(battleye)/";
|
||||||
$result = preg_grep($regbattle, explode(",", $InfoGT));
|
$result = preg_grep($regbattle, explode(",", $InfoGT));
|
||||||
$battleye = $result[0];
|
foreach ($result as $key => $val) { $battleye = $val; }
|
||||||
|
|
||||||
|
// mod
|
||||||
|
$regmod = "/(mod)/";
|
||||||
|
$result = preg_grep($regmod, explode(",", $InfoGT));
|
||||||
|
foreach ($result as $key => $val) { $mods = $val; }
|
||||||
|
|
||||||
// DEBUG
|
|
||||||
$timespeed="2";
|
|
||||||
$timespeedn="4";
|
|
||||||
|
|
||||||
// SQL insert Query.
|
// SQL insert Query.
|
||||||
$insql = "INSERT INTO $table (date,name,players,maxplayers,map,game,version,timeserver,timespeed,timespeedn,mods,battleye,hive,connect,secure,ping) VALUES ('$date','$HostName','$PLayers','$MaxPlayers','$Map','$Game','$Version','$timeserver','$timespeed','$timespeedn','$mods','$battleye','$hive','$urlserv','$Secure','$ping')";
|
$insql = "INSERT INTO $table (date,name,players,maxplayers,map,game,version,timeserver,timespeed,timespeedn,mods,battleye,hive,connect,secure,ping) VALUES ('$date','$HostName','$PLayers','$MaxPlayers','$Map','$Game','$Version','$timeserver','$timespeed','$timespeedn','$mods','$battleye','$hive','$urlserv','$Secure','$ping')";
|
||||||
|
|
||||||
// Check if errors with SQL query
|
// Check if errors with SQL query
|
||||||
if (mysqli_query($con, $insql)) {
|
if (mysqli_query($con, $insql)) {
|
||||||
// echo "New record created successfully";
|
// DEBUG
|
||||||
} else {
|
// echo "New record created successfully"; echo $insql;
|
||||||
echo "Error: " . $insql . "<br>" . mysqli_error($con);
|
} else { echo "Error: " . $insql . "<br>" . mysqli_error($con); }
|
||||||
}
|
|
||||||
|
|
||||||
mysqli_close($con);
|
mysqli_close($con);
|
||||||
}
|
}
|
||||||
|
|
12
consql.php
12
consql.php
|
@ -4,13 +4,19 @@
|
||||||
// Create Database first ;)
|
// Create Database first ;)
|
||||||
|
|
||||||
|
|
||||||
|
$servdb = "localhost";
|
||||||
|
$userdb = "dayz";
|
||||||
|
$pdb = "dayz32";
|
||||||
|
$dbname = "dayzstat";
|
||||||
|
$table = "StatServer_5";
|
||||||
|
|
||||||
|
/*
|
||||||
$servdb = "localhost";
|
$servdb = "localhost";
|
||||||
$userdb = "user";
|
$userdb = "user";
|
||||||
$pdb = "pass";
|
$pdb = "pass";
|
||||||
$dbname = "database";
|
$dbname = "database";
|
||||||
$table = "StatServer_5";
|
$table = "StatServer_1";
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
$StatServer = $table;
|
$StatServer = $table;
|
||||||
$con = new mysqli($servdb, $userdb, $pdb, $dbname);
|
$con = new mysqli($servdb, $userdb, $pdb, $dbname);
|
||||||
|
|
Loading…
Reference in a new issue