]> git.mjollnir.org Git - moodle.git/commitdiff
Some robustness
authormoodler <moodler>
Mon, 20 Jan 2003 07:13:02 +0000 (07:13 +0000)
committermoodler <moodler>
Mon, 20 Jan 2003 07:13:02 +0000 (07:13 +0000)
lib/weblib.php
login/index_form.html
login/signup.php
login/signup_form.php

index 7970cdff5ef3b96f9e4e4a0f27e169427eaff164..3a476cc51c2c2f86bf9e1fac5bdb9e05fe111c03 100644 (file)
@@ -189,6 +189,8 @@ function data_submitted($url="") {
 /// checks the referer against the given url (it uses 
 /// the current page if none was specified.
 
+    global $CFG;
+
     if (empty($_POST)) {
         return false;
 
index 927bb5255795f1e77fd1bc3355fe6d1cced6bdfb..429b485b07e26d3e1e029e05e430dc752b8797bc 100644 (file)
@@ -81,8 +81,8 @@
                  <P><? print_string("loginsteps", "", "signup.php") ?></P>\r
                  </FONT>\r
                  <CENTER>\r
-                 <FORM NAME="form4" ACTION="signup.php" METHOD=post>\r
-                 <INPUT type="submit" NAME="Submit" VALUE="<? print_string("startsignup") ?>">\r
+                 <FORM NAME="form4" ACTION="signup.php" METHOD=get>\r
+                 <INPUT type="submit" VALUE="<? print_string("startsignup") ?>">\r
                  </FORM>\r
                  </CENTER>\r
           <?     break;\r
index bd477d0f4ed7a39c88dd01713e6ff13c3703324d..b1777a7dd5244b30bcce62f3279fc9af89d01603 100644 (file)
@@ -15,6 +15,8 @@
             $user->firstaccess = time();
             $user->secret = random_string(15);
 
+            $db->debug = true;
+
                        if (! ($user->id = insert_record("user", $user)) ) {
                 error("Could not add your record to the database!");
             }
                }
        }
 
-    if ($err) {
-        $focus = 'form.' . array_shift(array_flip(get_object_vars($err)));
+    if (!empty($err)) {
+        $focus = "form.".array_shift(array_flip(get_object_vars($err)));
+    } else {
+        $focus = "";
     }
 
     if (empty($user->country) and !empty($CFG->country)) {
index f37d41f0e293fe48a54f3cc70a373bbcce2b75d9..392af11b5f750879f5350e296cb1ff1bcfb735ca 100644 (file)
@@ -9,13 +9,13 @@
 <tr valign=top>
        <td><P><? print_string("username") ?>:</td>
        <td><input type="text" name="username" size=12 value="<? p($user->username) ?>">
-       <? formerr($err->username) ?>
+       <? if (!empty($err->username)) { formerr($err->username); } ?>
        </td>
 </tr>
 <tr valign=top>
        <td><P><? print_string("password") ?>:</td>
        <td><input type="password" name="password" size=12 value="<? p($user->password) ?>">
-       <? formerr($err->password) ?>
+       <? if (!empty($err->password)) { formerr($err->password); } ?>
        </td>
 </tr>
 <tr valign=top>
 <tr valign=top>
        <td><P><? print_string("email") ?>:</td>
        <td><input type="text" name="email" size=25 value="<? p($user->email) ?>">
-       <? formerr($err->email) ?>
+       <? if (!empty($err->email)) { formerr($err->email); } ?>
        </td>
 </tr>
 <tr valign=top>
        <td><P><? print_string("firstname") ?>:</td>
        <td><input type="text" name="firstname" size=25 value="<? p($user->firstname) ?>">
-       <? formerr($err->firstname) ?>
+       <? if (!empty($err->firstname)) { formerr($err->firstname);} ?>
        </td>
 </tr>
 <tr valign=top>
        <td><P><? print_string("lastname") ?>:</td>
        <td><input type="text" name="lastname" size=25 value="<? p($user->lastname) ?>">
-       <? formerr($err->lastname) ?>
+       <? if (!empty($err->lastname)) { formerr($err->lastname);} ?>
        </td>
 </tr>
 <tr valign=top>
        <td><P><? print_string("idnumber") ?>:</td>
        <td><input type="text" name="idnumber" size=25 value="<? p($user->idnumber) ?>"> (<? print_string("optional") ?>)
-       <? formerr($err->idnumber) ?>
+       <? if (!empty($err->idnumber)) { formerr($err->idnumber);} ?>
        </td>
 </tr>
 <tr valign=top>
        <td><P><? print_string("phone") ?>:</td>
        <td><input type="text" name="phone" size=25 value="<? p($user->phone) ?>"> (<? print_string("optional") ?>)
-       <? formerr($err->phone) ?>
+       <? if (!empty($err->phone)) { formerr($err->phone);} ?>
        </td>
 </tr>
 <tr valign=top>
        <td><P><? print_string("city") ?>:</td>
        <td><input type="text" name="city" size=25 value="<? p($user->city) ?>">
-       <? formerr($err->city) ?>
+       <? if (!empty($err->city)) { formerr($err->city);} ?>
        </td>
 </tr>
 <tr valign=top>
        <td><P><? print_string("country") ?>:</td>
        <td><? choose_from_menu ($COUNTRIES, "country", $user->country, get_string("selectacountry"), "", "") ?>
-       <? formerr($err->country) ?>
+       <? if (!empty($err->country)) { formerr($err->country);} ?>
        </td>
 </tr>
 <tr>