added WGN iauth.php script
[iauth.git] / iauth.php
index 267e871ad5fea0125176be4b91be806e4b26290e..28fb5ff2d522b0ed14741b5153867a735a316c09 100644 (file)
--- a/iauth.php
+++ b/iauth.php
@@ -1,6 +1,7 @@
 #!/usr/bin/php
 <?php
-/* Written by David Herrmann.
+/* Written by David Herrmann,
+ *  improved by Philipp Kreil.
  * Dedicated to the Public Domain.
  */
 /* PHP IAuth verifier.
@@ -68,7 +69,8 @@
  *     echo "+wogsfr 131071 fake.host.net account:124653295"
  * The last parameter "mode" can have as many spaces as you want.
  */
-
+error_reporting(0);
 /* These constants are defined to access $argv more easily. */
 define("ARG_REMOTEIP", $argv[1]);
 define("ARG_REMOTEPORT", $argv[2]);
@@ -105,7 +107,8 @@ function iauth_return($class = NULL, $ident = NULL, $host = NULL, $ip = NULL, $m
 }
 
 /* This rejects the client. */
-function iauth_reject() {
+function iauth_reject($reason = NULL) {
+    if($reason != NULL && strlen($reason) != 0) echo"error ".$reason." %";
     exit(0);
 }
 
@@ -130,6 +133,9 @@ function iauth_reject() {
 /* iauth_reject(); */
 
 /* our real implementation */
+if (is_readable('iauth-wgn.php')) {
+    require('iauth-wgn.php');
+}
 iauth_return();
 
 ?>