From 37208cd23ad5fec2b2bc7912e0b9f4a9d6ef7a9b Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 20 Jan 2003 07:13:02 +0000 Subject: [PATCH] Some robustness --- lib/weblib.php | 2 ++ login/index_form.html | 4 ++-- login/signup.php | 8 ++++++-- login/signup_form.php | 18 +++++++++--------- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index 7970cdff5e..3a476cc51c 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -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; diff --git a/login/index_form.html b/login/index_form.html index 927bb52557..429b485b07 100644 --- a/login/index_form.html +++ b/login/index_form.html @@ -81,8 +81,8 @@

-
- "> + + ">
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!"); } @@ -33,8 +35,10 @@ } } - 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)) { diff --git a/login/signup_form.php b/login/signup_form.php index f37d41f0e2..392af11b5f 100644 --- a/login/signup_form.php +++ b/login/signup_form.php @@ -9,13 +9,13 @@

: - username) ?> + username)) { formerr($err->username); } ?>

: - password) ?> + password)) { formerr($err->password); } ?> @@ -24,43 +24,43 @@

: - email) ?> + email)) { formerr($err->email); } ?>

: - firstname) ?> + firstname)) { formerr($err->firstname);} ?>

: - lastname) ?> + lastname)) { formerr($err->lastname);} ?>

: () - idnumber) ?> + idnumber)) { formerr($err->idnumber);} ?>

: () - phone) ?> + phone)) { formerr($err->phone);} ?>

: - city) ?> + city)) { formerr($err->city);} ?>

: country, get_string("selectacountry"), "", "") ?> - country) ?> + country)) { formerr($err->country);} ?> -- 2.39.5