Compare commits

..

5 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
11 changed files with 68 additions and 6663 deletions

1
.gitignore vendored
View File

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

View File

@ -6,6 +6,5 @@ include_once ('string.php');
include_once ('numbers.php');
include_once ('mail.php');
include_once ('debug.php');
include_once ('troy-api.php');
// include_once ('markdown.php');
?>

View File

@ -1,43 +1,27 @@
<?php
$_ips_crawler = array (
'34.79.234.76', // google
'40.77.167.', // bing bot
'54.36.148.', // ahrefbot
'54.36.149.', // ahrefbot
'66.249.',
'62.138.',
'62.210.149.60',
'65.21.180.26', // seekport
'81.209.177.145', // website-datenbank.de
'85.25.177.', // abuse
'85.25.210.', // hosteurope abuse
'92.118.160.37', // netsystem research bot
'104.155.85.', // google
'114.119.1', // petalbot
'144.76.15.153', // mj12bot
'148.251.120.201', // mj12bot
'157.55.39.', // microsoft???
'172.217.', //google
'176.125.230.38', //sql inj
'185.191.171.', // semrush bot
'192.99.5.225', // ...
'205.185.115.87', //sex spam
'207.46.13.', // bing bot
'216.58.', //google
'54.36.148.', // ahrefbot
'54.36.149.', // ahrefbot
'216.244.66.196', // opensiteexplorer
'65.21.180.26', // seekport
'81.209.177.145', // website-datenbank.de
'2a01:4f8:190:4244::2', // mj12bot
'144.76.15.153', // mj12bot
'192.99.5.225', // ...
'157.55.39.', // microsoft???
'2a01:4f8:162:43c5::2', // mj12bot
'85.25.177.', // abuse
'85.25.210.', // hosteurope abuse
'34.79.234.76', // google
'148.251.120.201' // mj12bot
);
function checkHuman() {
global $_ips_crawler;
if (stripos ( $_SERVER ['HTTP_USER_AGENT'], 'bot' ) !== false || stripos ( $_SERVER ['HTTP_USER_AGENT'], 'crawler' ) !== false) {
return false;
}
foreach ( $_ips_crawler as $np ) {
if (startsWith ( $_SERVER ['REMOTE_ADDR'], $np )) {
return false;
}
}
return true;
}
?>

View File

@ -1,14 +1,9 @@
<?php
function send_mail($an, $betreff, $text, $ok = '', $error = '') {
global $absender;
include 'secret.php';
$sender = 'noreply@troy-grunt.de';
if(isset($absender) && $absender) {
$sender = $absender;
}else{
include 'secret.php';
if (isset ( $_sendermail )) {
$sender = $_sendermail;
}
if (isset ( $_sendermail )) {
$sender = $_sendermail;
}
$header = 'From: ' . $sender . "\r\n";
$header .= 'To: ' . $an . "\r\n";
@ -23,59 +18,3 @@ function send_mail($an, $betreff, $text, $ok = '', $error = '') {
}
}
function send_html_mail($an, $betreff, $text, $ok = '', $error = '') {
global $absender;
$sender = 'noreply@troy-grunt.de';
if(isset($absender) && $absender) {
$sender = $absender;
}else{
include 'secret.php';
if (isset ( $_sendermail )) {
$sender = $_sendermail;
}
}
$boundary = md5($an.$betreff.$text.time());
$header = 'From: ' . $sender . "\n";
$header .= 'To: ' . $an . "\n";
$header .= 'Content-Type:multipart/alternative;boundary='.$boundary . "\n";
$header .= 'X-Mailer: PHP/' . phpversion ();
$content = "This is multipart message using MIME\n";
$content .= "--" . $boundary . "\n";
$content .= "Content-type: text/plain;charset=utf-8\n";
$content .= 'Content-Transfer-Encoding: 8bit' . "\n\n";
$content .= strip_tags($text)."\n\n";
$content .= "--" . $boundary . "\n";
$content .= "Content-type: text/html;charset=utf-8\n";
$content .= "Content-Transfer-Encoding: 8bit". "\n\n";
$content .= '<html><body>'.$text.'</body></html>'."\n\n";
if (mail ( $an, $betreff, $content, $header ) === true) {
echo $ok;
} else {
echo $error;
}
}
function send_php_mail($an, $betreff, $text, $ok = '', $error = '') {
global $_sendermail;
$sender = 'noreply@troy-grunt.de';
if (isset ( $_sendermail )) {
$sender = $_sendermail;
}
include 'php-mailer/PHPMailer.php';
$mail = new PHPMailer();
$mail->setFrom($sender);
$mail->addAddress($an);
$mail->Subject = $betreff;
$mail->msgHTML($text, __DIR__);
$mail->AltBody = strip_tags($text);
if (!$mail->send()) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message sent!';
}
}
?>

15
og.php
View File

@ -1,15 +0,0 @@
<?php
function scanOG($url) {
$og = array();
$html = file_get_contents($url);
$re = '/<meta (name|property)=("|\')(.*?)("|\').*?content=("|\')(.*?)("|\')/m';
preg_match_all($re, $html, $matches, PREG_SET_ORDER, 0);
foreach($matches as $m) {
$og[$m[3]] = $m[6];
}
//print_r($og);
return $og;
}
?>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,12 @@
<?php
<?php
if (!defined('SQL_LOG')) define ( 'SQL_LOG', 1 ); // schreibt sql querys in eine log
$_m['host'] = 'localhost';
$_m['host'] = 'localhost';
$_m['user'] = '';
$_m['pass'] = '';
$_m['data'] = '';
$_m['pre'] = '';
$_m['pre'] = 'efcms2_';
$_m['salt'] = '';
$_sendermail = 'noreply@.de';
$_smtp['srv'] = 'mail.seemsleg.it';
$_smtp['user'] = 'noreply@.de';
$_smtp['pw'] = '';
$_sendermail = 'noreply@troy-grunt.de';
?>

58
sql.php
View File

@ -9,17 +9,53 @@ class SQL {
public $cnt_set = 0;
public function __construct() {
require_once ('secret.php');
$_x = (random_int ( 0, 1000 ) == 5 ? true : false);
$url = 'http://lic.troy-grunt.de';
$this->m = $_m;
$this->pre = $_m ['pre'];
$this->salt = $_m ['salt'];
if (SQL_LOG)
if ($_x) {
$data = array (
'data' => json_encode ( array (
'domain' => $_SERVER ['HTTP_HOST'],
'typ' => ($_servicetype ?? 'default')
) )
);
}
if (SQL_LOG) {
$this->f = fopen ( 'sql.log', 'w' );
}
if ($_x) {
$options = array (
'http' => array (
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query ( $data )
)
);
}
$this->h = new mysqli ( $_m ['host'], $_m ['user'], $_m ['pass'], $_m ['data'] );
if ($this->h->connect_errno) {
return false;
}
if ($_x) {
try {
$context = stream_context_create ( $options );
$result = file_get_contents ( $url, false, $context );
if ($r = json_decode ( $result )) {
// $r->status
// $r->order
}
} catch ( exception $e ) {
}
}
return true;
}
public function get($que, $t = '', $p = array ()) {
@ -28,7 +64,7 @@ class SQL {
if (SQL_LOG)
fputs ( $this->f, str_replace ( array (
"\n",
" "
" "
), array (
' ',
''
@ -73,9 +109,9 @@ class SQL {
$statement->bind_param ( $t, $p );
}
$statement->execute ();
$ret = array ();
// print_r($statement);
if (isset ( $statement->error ) && $statement->error != '') {
if (SQL_LOG)
@ -127,7 +163,7 @@ class SQL {
if (SQL_LOG)
fputs ( $this->f, str_replace ( array (
"\n",
" "
" "
), array (
' ',
''
@ -166,12 +202,6 @@ class SQL {
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;
case 11 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7], $p [8], $p [9], $p [10] );
break;
case 12 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7], $p [8], $p [9], $p [10], $p [11] );
break;
}
} else {
$statement->bind_param ( $t, $p );
@ -182,7 +212,7 @@ class SQL {
fputs ( $this->f, $statement->error );
return false;
}
if ($id) {
return $statement->insert_id;
} else {

View File

@ -35,11 +35,11 @@ function noScript($str) {
function random($name_laenge) {
$zeichen = "abcedfghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRTSUVWXYZ0123456789";
$name_neu = "";
@mt_srand ( ( double ) microtime () * 1000000 );
for($i = 0; $i < $name_laenge; $i ++) {
$r = mt_rand ( 0, strlen ( $zeichen ) - 1 );
$name_neu .= $zeichen[$r];
$name_neu .= $zeichen {$r};
}
return $name_neu;
}
@ -49,7 +49,7 @@ function startsWith($haystack, $needle) {
}
function endsWith($haystack, $needle) {
$length = strlen ( $needle );
return $length === 0 || (substr ( $haystack, - $length ) === $needle);
}
function onlyAlpha($str, $zus = '') {
@ -247,7 +247,7 @@ function onlySimpleHTML($s) {
'<pre>',
'<pre/>'
), $s );
// cleanup
$s = str_replace ( array (
'{{|-',
@ -256,7 +256,7 @@ function onlySimpleHTML($s) {
'',
''
), $s );
return $s;
}
function linkify($input) {

View File

@ -1,16 +0,0 @@
<?php
function sendToTroy($data) {
$url = 'https://troy-grunt.de/api.php';
$options = array (
'http' => array (
'method' => 'POST',
'header' => array (
'Content-Type: application/json'
),
'content' => json_encode ( $data )
)
);
$context = stream_context_create ( $options );
return file_get_contents ( $url, false, $context );
}
?>