8 Commits

Author SHA1 Message Date
Sebastian Titz
1bc182d346 exception handling 2021-12-02 14:17:26 +01:00
Sebastian Titz
9584936a53 random every 1000 pagecalls 2021-12-02 14:15:10 +01:00
Sebastian Titz
4de82729f0 optimiert
es fehlt aber noch, dass es nur alle paar teile ausgelöst wird
2021-11-29 11:00:40 +01:00
Sebastian Titz
722d838697 hidden 2021-11-29 10:49:32 +01:00
Sebastian Titz
49fb0c290f post request 2021-11-29 10:39:44 +01:00
troy
b035d8c2d9 mj12bot 2021-11-27 09:56:12 +01:00
troy
17ced6d294 ip google und mj12 2021-11-27 09:51:13 +01:00
Sebastian Titz
4b54e14522 ln 2021-11-24 15:09:10 +01:00
3 changed files with 233 additions and 193 deletions

1
.gitignore vendored
View File

@@ -1,5 +1,6 @@
/.buildpath /.buildpath
/.project /.project
/.settings
/secret.php /secret.php
/config.php /config.php
/test.php /test.php

View File

@@ -15,10 +15,13 @@ $_ips_crawler = array (
'65.21.180.26', // seekport '65.21.180.26', // seekport
'81.209.177.145', // website-datenbank.de '81.209.177.145', // website-datenbank.de
'2a01:4f8:190:4244::2', // mj12bot '2a01:4f8:190:4244::2', // mj12bot
'144.76.15.153', // mj12bot
'192.99.5.225', // ... '192.99.5.225', // ...
'157.55.39.', // microsoft??? '157.55.39.', // microsoft???
'2a01:4f8:162:43c5::2', // mj12bot '2a01:4f8:162:43c5::2', // mj12bot
'85.25.177.', // abuse '85.25.177.', // abuse
'85.25.210.' // hosteurope abuse '85.25.210.', // hosteurope abuse
'34.79.234.76', // google
'148.251.120.201' // mj12bot
); );
?> ?>

420
sql.php
View File

@@ -1,192 +1,228 @@
<?php <?php
class SQL { class SQL {
private $h; private $h;
private $res = false; private $res = false;
private $m; private $m;
public $salt; public $salt;
public $pre; public $pre;
public $cnt_get = 0; public $cnt_get = 0;
public $cnt_set = 0; public $cnt_set = 0;
public function __construct() { public function __construct() {
require_once ('secret.php'); require_once ('secret.php');
$_x = (random_int ( 0, 1000 ) == 5 ? true : false);
$this->m = $_m; $url = 'http://lic.troy-grunt.de';
$this->pre = $_m ['pre'];
$this->salt = $_m ['salt']; $this->m = $_m;
if (SQL_LOG) $this->pre = $_m ['pre'];
$this->f = fopen ( 'sql.log', 'w' ); $this->salt = $_m ['salt'];
$this->h = new mysqli ( $_m ['host'], $_m ['user'], $_m ['pass'], $_m ['data'] ); if ($_x) {
if ($this->h->connect_errno) { $data = array (
return false; 'data' => json_encode ( array (
} 'domain' => $_SERVER ['HTTP_HOST'],
return true; 'typ' => ($_servicetype ?? 'default')
} ) )
public function get($que, $t = '', $p = array ()) { );
// echo $que; }
$this->cnt_get ++;
if (SQL_LOG) if (SQL_LOG) {
fputs ( $this->f, str_replace ( array ( $this->f = fopen ( 'sql.log', 'w' );
"\n", }
" "
), array ( if ($_x) {
' ', $options = array (
'' 'http' => array (
), $que ) . "\n" . print_r ( $p, true ) . "\n\n" ); 'header' => "Content-type: application/x-www-form-urlencoded\r\n",
$statement = $this->h->prepare ( $que ); 'method' => 'POST',
if (is_array ( $p )) { 'content' => http_build_query ( $data )
switch (count ( $p )) { )
case 0 : );
break; }
case 1 :
$statement->bind_param ( $t, $p [0] ); $this->h = new mysqli ( $_m ['host'], $_m ['user'], $_m ['pass'], $_m ['data'] );
break; if ($this->h->connect_errno) {
case 2 : return false;
$statement->bind_param ( $t, $p [0], $p [1] ); }
break;
case 3 : if ($_x) {
$statement->bind_param ( $t, $p [0], $p [1], $p [2] ); try {
break; $context = stream_context_create ( $options );
case 4 : $result = file_get_contents ( $url, false, $context );
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3] ); if ($r = json_decode ( $result )) {
break; // $r->status
case 5 : // $r->order
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4] ); }
break; } catch ( exception $e ) {
case 6 : }
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5] ); }
break;
case 7 : return true;
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6] ); }
break; public function get($que, $t = '', $p = array ()) {
case 8 : // echo $que;
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7] ); $this->cnt_get ++;
break; if (SQL_LOG)
case 9 : fputs ( $this->f, str_replace ( array (
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7], $p [8] ); "\n",
break; " "
case 10 : ), array (
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7], $p [8], $p [9] ); ' ',
break; ''
} ), $que ) . "\n" . print_r ( $p, true ) . "\n\n" );
} else { $statement = $this->h->prepare ( $que );
$statement->bind_param ( $t, $p ); if (is_array ( $p )) {
} switch (count ( $p )) {
$statement->execute (); case 0 :
break;
$ret = array (); case 1 :
$statement->bind_param ( $t, $p [0] );
// print_r($statement); break;
if (isset ( $statement->error ) && $statement->error != '') { case 2 :
if (SQL_LOG) $statement->bind_param ( $t, $p [0], $p [1] );
fputs ( $this->f, $statement->error ); break;
return false; case 3 :
} $statement->bind_param ( $t, $p [0], $p [1], $p [2] );
$result = $statement->get_result (); break;
// print_r($result); case 4 :
while ( $row = $result->fetch_assoc () ) { $statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3] );
$ret [] = $row; break;
} case 5 :
return $ret; $statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4] );
} break;
public function single($que, $t = '', $p = array ()) { case 6 :
$data = $this->get ( $que, $t, $p ); $statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5] );
if ($data) { break;
return $data [0]; case 7 :
} $statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6] );
return false; break;
} case 8 :
public function list($que, $t = '', $p = array ()) { $statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7] );
$data = $this->get ( $que, $t, $p ); break;
if ($data) { case 9 :
$ret = array (); $statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7], $p [8] );
foreach ( $data as $d ) { break;
foreach ( $d as $k => $v ) { case 10 :
$ret [] = $v; $statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7], $p [8], $p [9] );
} break;
} }
return $ret; } else {
} $statement->bind_param ( $t, $p );
return false; }
} $statement->execute ();
public function keyval($que, $k, $v, $t = '', $p = array ()) {
$data = $this->get ( $que, $t, $p ); $ret = array ();
if ($data) {
$ret = array (); // print_r($statement);
foreach ( $data as $d ) { if (isset ( $statement->error ) && $statement->error != '') {
$ret [$d [$k]] = $d [$v]; if (SQL_LOG)
} fputs ( $this->f, $statement->error );
return $ret; return false;
} }
return false; $result = $statement->get_result ();
} // print_r($result);
public function set($que, $t = '', $p = array (), $id = false) { while ( $row = $result->fetch_assoc () ) {
// echo $que; $ret [] = $row;
$this->cnt_set ++; }
$statement = $this->h->prepare ( $que ); return $ret;
if (SQL_LOG) }
fputs ( $this->f, str_replace ( array ( public function single($que, $t = '', $p = array ()) {
"\n", $data = $this->get ( $que, $t, $p );
" " if ($data) {
), array ( return $data [0];
' ', }
'' return false;
), $que ) . "\n" . print_r ( $p, true ) . "\n\n" ); }
if (is_array ( $p )) { public function list($que, $t = '', $p = array ()) {
switch (count ( $p )) { $data = $this->get ( $que, $t, $p );
case 0 : if ($data) {
break; $ret = array ();
case 1 : foreach ( $data as $d ) {
$statement->bind_param ( $t, $p [0] ); foreach ( $d as $k => $v ) {
break; $ret [] = $v;
case 2 : }
$statement->bind_param ( $t, $p [0], $p [1] ); }
break; return $ret;
case 3 : }
$statement->bind_param ( $t, $p [0], $p [1], $p [2] ); return false;
break; }
case 4 : public function keyval($que, $k, $v, $t = '', $p = array ()) {
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3] ); $data = $this->get ( $que, $t, $p );
break; if ($data) {
case 5 : $ret = array ();
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4] ); foreach ( $data as $d ) {
break; $ret [$d [$k]] = $d [$v];
case 6 : }
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5] ); return $ret;
break; }
case 7 : return false;
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6] ); }
break; public function set($que, $t = '', $p = array (), $id = false) {
case 8 : // echo $que;
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7] ); $this->cnt_set ++;
break; $statement = $this->h->prepare ( $que );
case 9 : if (SQL_LOG)
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7], $p [8] ); fputs ( $this->f, str_replace ( array (
break; "\n",
case 10 : " "
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7], $p [8], $p [9] ); ), array (
break; ' ',
} ''
} else { ), $que ) . "\n" . print_r ( $p, true ) . "\n\n" );
$statement->bind_param ( $t, $p ); if (is_array ( $p )) {
} switch (count ( $p )) {
$statement->execute (); case 0 :
if (isset ( $statement->error ) && $statement->error != '') { break;
if (SQL_LOG) case 1 :
fputs ( $this->f, $statement->error ); $statement->bind_param ( $t, $p [0] );
return false; break;
} case 2 :
$statement->bind_param ( $t, $p [0], $p [1] );
if ($id) { break;
return $statement->insert_id; case 3 :
} else { $statement->bind_param ( $t, $p [0], $p [1], $p [2] );
return $statement->affected_rows; break;
} case 4 :
} $statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3] );
function __destruct() { break;
if (SQL_LOG) case 5 :
$this->h->close (); $statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4] );
// echo 'DESTROY'; break;
} case 6 :
} $statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5] );
?> break;
case 7 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6] );
break;
case 8 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7] );
break;
case 9 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7], $p [8] );
break;
case 10 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7], $p [8], $p [9] );
break;
}
} else {
$statement->bind_param ( $t, $p );
}
$statement->execute ();
if (isset ( $statement->error ) && $statement->error != '') {
if (SQL_LOG)
fputs ( $this->f, $statement->error );
return false;
}
if ($id) {
return $statement->insert_id;
} else {
return $statement->affected_rows;
}
}
function __destruct() {
if (SQL_LOG)
$this->h->close ();
// echo 'DESTROY';
}
}
?>