[PHPLIB-DEV] cvs commit From: ssilk (phplib-dev <email protected>)
Date: 03/24/00

From: ssilk
Date: Sat Mar 25 02:56:15 2000
Modified files:
      php-lib/php/auth_sql.inc

Log message:
Changes to separate the text from the program to replace it easier.

Index: php-lib/php/auth_sql.inc
diff -u php-lib/php/auth_sql.inc:1.3 php-lib/php/auth_sql.inc:1.4
--- php-lib/php/auth_sql.inc:1.3 Mon Jan 17 17:16:16 2000
+++ php-lib/php/auth_sql.inc Sat Mar 25 02:55:45 2000
@@ -5,7 +5,7 @@
  * Copyright (c) 1998,1999 NetUSE GmbH
  * Boris Erdmann, Kristian Koehntopp
  *
- * $Id: auth_sql.inc,v 1.3 2000/01/17 16:16:16 sylvan Exp $
+ * $Id: auth_sql.inc,v 1.4 2000/03/25 01:55:45 ssilk Exp $
  *
  */
 
@@ -53,6 +53,7 @@
   ## customize.
   function auth_loginform() {
     global $sess, $auth, $_PHPLIB, $PHP_SELF;
+ $this->translate_error();
 
     include($_PHPLIB["libdir"] . "loginform.ihtml");
   }
@@ -68,7 +69,7 @@
     if (isset($mode) && $mode == "reg") {
       $this->mode = "reg";
       $this->auth["uname"] = $username;
- $this->auth["error"] = "Please fill in the required registration information. Thank you.";
+ $this->auth["error"] = "fill"; # Please fill in the required registration information. Thank you.";
       return false;
     }
 
@@ -98,7 +99,7 @@
       }
     }
     if ($uid == false)
- $this->auth["error"] = "Either your username or password are invalid.<br>Please try again.";
+ $this->auth["error"] = "invalid"; # Either your username or password are invalid.<br>Please try again.";
     else
       SetCookie("auth_username", $username, pow(2, 31)-1, "/");
 
@@ -120,6 +121,7 @@
   ## add columns to that table and this form.
   function auth_registerform() {
     global $sess, $auth, $_PHPLIB, $PHP_SELF;
+ $this->translate_error();
 
     include("registerform.ihtml");
   }
@@ -135,13 +137,13 @@
 
     if (isset($mode) && $mode == "log") {
       $this->mode = "log";
- $this->auth["error"] = "Please enter your username and password. Thank you.";
+ $this->auth["error"] = "invalid"; # Please enter your username and password. Thank you.";
       return false;
     }
 
     ## Check the passwords for validity.
     if ($pass1 != $pass2) {
- $this->auth["error"] = "Password and repeated password do not match. Please try again.";
+ $this->auth["error"] = "nomatch"; # Password and repeated password do not match. Please try again.";
       return false;
     }
     
@@ -160,7 +162,7 @@
 
       ## If user is present and password does not match,
       ## complain and fail.
- $this->auth["error"] = "This username is already taken. Please choose a different one.";
+ $this->auth["error"] = "uname_exists"; # This username is already taken. Please choose a different one.";
       return false;
     }
 
@@ -184,5 +186,22 @@
     ## into $auth->auth["perm"].
     return $uid;
   }
+
+ function translate_error () {
+ switch ($this->auth["error"]) {
+ case 'fill':
+ $this->auth["error"]="Please fill in the required registration information. Thank you.";
+ break;
+ case 'invalid':
+ $this->auth["error"]="Either your username or password are invalid.<br>Please try again.";
+ break;
+ case 'nomatch':
+ $this->auth["error"]="Password and repeated password do not match. Please try again.";
+ break;
+ case 'uname_exists':
+ $this->auth["error"]="This username is already taken. Please choose a different one.";
+ }
+ }
+
 }
 ?>

-
PHPLIB Developers Mailing List. Send messages to <phplib-dev <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-dev-request <email protected>> in
the body, not the subject, of your message.