]> git.mxchange.org Git - mailer.git/commitdiff
Continued: server-0.2.1-FINAL/mxchange-org
authorRoland Häder <roland@mxchange.org>
Mon, 9 Sep 2024 18:58:31 +0000 (20:58 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 26 Dec 2024 03:06:22 +0000 (04:06 +0100)
- cleaned up code

guestbook/forbid.php
guestbook/index.php
guestbook/settings.php

index d40ff7ac92917670e0f165e93fdcc96f463fb489..fc29db1f78f96796a82cbf2f53c2c65f4a58ea2d 100644 (file)
@@ -19,73 +19,82 @@ require 'settings.php';
 include trap_core_path . 'core.inc.php';
 
 function ts_gfx($ts_random) {
-$rcode = hexdec(md5($_SERVER['HTTP_USER_AGENT'] . $_SERVER['SERVER_SOFTWARE'] . $_SERVER['HTTP_ACCEPT_CHARSET'] . sitekey . $ts_random . datekey . filemtime('settings.php')));
-$code = substr($rcode, 2, 6);
+       $rcode = hexdec(md5($_SERVER['HTTP_USER_AGENT'] . $_SERVER['SERVER_SOFTWARE'] . $_SERVER['HTTP_ACCEPT_CHARSET'] . sitekey . $ts_random . datekey . filemtime('settings.php')));
+       $code = substr($rcode, 2, 6);
 
-setCaptchaId($code);
+       setCaptchaId($code);
 
-$circles=5;
-$width=100;
-$height=40;
-$font=5;
+       $circles = 5;
+       $width   = 100;
+       $height  = 40;
+       $font    = 5;
 
-$fontwidth = ImageFontWidth($font) * strlen($code);
-$fontheight = ImageFontHeight($font);
+       $fontWidth  = ImageFontWidth($font) * strlen($code);
+       $fontHeight = ImageFontHeight($font);
 
-$max_lines = $fontheight / 4;
-if (random_lines == true)
-{
-       $lines = rand(1, $max_lines);
-}
- else
-{
-       $lines=2;
-}
-if ($lines > $max_lines) $lines = $max_lines;
-
-$im = @imagecreate ($width,$height);
-$background_color = imagecolorallocate ($im, rand(0,100),rand(0,100),rand(0,100));
-$text_color = imagecolorallocate ($im, rand(200,255),rand(200,255),rand(200,255)); // Random Text
-
-$r=0.01;$g=0.51;$b=0.87;
-for ($i=1;$i<=$circles;$i++) {
-       $value=rand(200, 255);
-       $randomcolor = imagecolorallocate ($im , $value*$r, $value*$g,$value*$b);
-       imagefilledellipse($im,rand(0,$width-10),rand(0,$height-3),
-       rand(20,70),rand(20,70),$randomcolor);
-}
+       $max_lines = $fontHeight / 4;
+
+       if (random_lines == true) {
+               $lines = rand(1, $max_lines);
+       } else {
+               $lines = 2;
+       }
+
+       if ($lines > $max_lines) {
+               $lines = $max_lines;
+       }
+
+       $im = @imagecreate ($width,$height);
+       $background_color = imagecolorallocate ($im, rand(0,100),rand(0,100),rand(0,100));
+       $text_color = imagecolorallocate ($im, rand(200,255),rand(200,255),rand(200,255)); // Random Text
 
-imagerectangle($im,0,0,$width-1,$height-1,$text_color);
+       $r = 0.01; $g = 0.51; $b = 0.87;
 
-$w_pos = rand(5, abs($width - $fontwidth));
-$h_pos = rand(5, abs($height - 1 - $fontheight));
-imagestring ($im, $font, $w_pos, $h_pos, $code, $text_color);
+       for ($i = 1;$i <= $circles; $i++) {
+               $value = rand(200, 255);
+               $randomcolor = imagecolorallocate ($im , $value*$r, $value*$g,$value*$b);
 
-$y2 = 0; $y = 0;
-for ($i=0;$i<$lines;$i++) {
-       while(abs($y2 - $y) < 2)
-       {
-               $y=rand($h_pos, ($h_pos + $fontheight));
+               imagefilledellipse(
+                       $im,
+                       rand(0, $width - 10),
+                       rand(0, $height - 3),
+                       rand(20, 70),
+                       rand(20, 70), $randomcolor
+               );
        }
-       $y2 = $y;
-       $randomcolor=imagecolorallocate($im, 0,0, rand(100, 255));
-       imageline($im, 0, $y, $width, $y, $randomcolor);
-}
 
-header ('Content-type: image/jpeg');
-imagejpeg ($im,'',80);
-ImageDestroy($im);
-die();
+       imagerectangle($im, 0, 0, $width - 1, $height - 1, $text_color);
+
+       $w_pos = rand(5, abs($width - $fontWidth));
+       $h_pos = rand(5, abs($height - 1 - $fontHeight));
+       imagestring($im, $font, $w_pos, $h_pos, $code, $text_color);
+
+       $y2 = 0; $y = 0;
+       for ($i = 0; $i < $lines; $i++) {
+               while (abs($y2 - $y) < 2) {
+                       $y = rand($h_pos, ($h_pos + $fontHeight));
+               }
+               $y2 = $y;
+               $randomcolor = imagecolorallocate($im, 0,0, rand(100, 255));
+               imageline($im, 0, $y, $width, $y, $randomcolor);
+       }
+
+       header('Content-type: image/jpeg');
+       imagejpeg($im,'',80);
+       ImageDestroy($im);
+       die();
 }
-$ts_random=rand();
-$pos= strpos($_SERVER['REQUEST_URI'], '?');
+
+$ts_random = rand();
+$pos = strpos($_SERVER['REQUEST_URI'], '?');
 $basename = basename(substr($_SERVER['REQUEST_URI'], 0, $pos));
-if($basename==basename(__FILE__))
-ts_gfx($_GET['ts_random']);
+if ($basename == basename(__FILE__)) {
+       ts_gfx($_GET['ts_random']);
+}
 
 $value = getCaptchaId();
-if($_POST['unbanme'] == $value ){
-    remove_blacklist(getip(), $_SERVER['HTTP_USER_AGENT']);
+if ($_POST['unbanme'] == $value ){
+       remove_blacklist(getip(), $_SERVER['HTTP_USER_AGENT']);
        header('Location: ../');
        exit;
 } else {
index fb6b2f8d77e9e63ad54256c467438c5483b099ad..9b5afabfcf960c32955fde7a0a6d7ccb3be3f3b4 100644 (file)
@@ -16,7 +16,7 @@
 * under the License.
 */
 include 'settings.php';
-include trap_core_path.'core.inc.php';
+include trap_core_path . 'core.inc.php';
 add_blacklist($_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI'], $_SERVER['SERVER_PROTOCOL'], $_SERVER['HTTP_REFERRER'], $_SERVER['HTTP_USER_AGENT']);
 header('Location: forbid.php');
 exit;
index 9964446d77bd1a6ad7d60371c9f873070322f9eb..7f3ad4dce875fbe6feba0fdc9aca237888b96005 100644 (file)
 * License for the specific language governing rights and limitations
 * under the License.
 */
+
 // Schreibrechte CHMOD 777
 error_reporting(0);
-$htaccess_file = dirname(dirname(__FILE__))."/.htaccess";
-if (!is_writeable($htaccess_file)) die("Cannot write ".$htaccess_file." !");
-$blacklist_file = dirname(dirname(__FILE__))."/blacklist.txt"; 
-if (!is_writeable($blacklist_file)) die("Cannot write ".$blacklist_file." !");
-$whitelist_file = dirname(dirname(__FILE__))."/whitelist.txt"; 
-if (!is_writeable($whitelist_file)) die("Cannot write ".$whitelist_file." !");
+$htaccess_file = dirname(dirname(__FILE__)) . '/.htaccess';
+
+if (!is_writeable($htaccess_file)) die('Cannot write ' . $htaccess_file . ' !');
+$blacklist_file = dirname(dirname(__FILE__)) . '/blacklist.txt'; 
+
+if (!is_writeable($blacklist_file)) die('Cannot write ' . $blacklist_file . ' !');
+$whitelist_file = dirname(dirname(__FILE__)) . '/whitelist.txt'; 
+
+if (!is_writeable($whitelist_file)) die('Cannot write ' . $whitelist_file . ' !');
 
 // Email fuer Benachrichtigungen
-$alert_email = "webmaster@mxchange.org"
+$alert_email = 'webmaster@mxchange.org'
 
 // Email senden wenn neue Sperre 
-$mail_on_add = true; 
+$mail_on_add = true;
 
 // Email senden wenn Sperre fuer jemand aufgehoben wurde ?
-$mail_on_remove = true; 
+$mail_on_remove = true;
 
-$trap_path = "guestbook/"; // path of the trap - must end with a "/"
+// path of the trap - must end with a "/"
+$trap_path = 'guestbook/';
 
 $sleep_min = 30; $sleep_max = 300;
 
-$captcha_file = dirname(dirname(__FILE__))."/".$trap_path."captcha.txt";
-if (!is_writeable($captcha_file)) die("Cannot write ".$captcha_file." !");
+$captcha_file = dirname(dirname(__FILE__)) . '/' . $trap_path . 'captcha.txt';
+if (!is_writeable($captcha_file)) {
+       die('Cannot write ' . $captcha_file . ' !');
+}
 
 // Bitte randomizen Sie diesen String etwas selber! ;-)
-define('sitekey', "spider-trap_yh34yh=3h3542u5y458=h34t73h=h24yhj2q4-h2");
+define('sitekey', 'spider-trap_yh34yh=3h3542u5y458=h34t73h=h24yhj2q4-h2');
 
 /*
  * Hier koennen Sie auch das deutsche Datumsformat nehmen, Uhrzeit nicht, da