You must fill in all fields!
\n"; $reg_status == "failed"; return; } } } # make sure that the passwords match if ($_POST['passwd'] != $_POST['passwd2']) { $err = "Your passwords do not match. Please try again.
\n"; $reg_status == "failed"; return; } # make sure that age is >0 && <100 if ($_POST['age'] < 1 || $_POST['age'] > 100) { $err = "Your age must be between 1 and 100 (years).
\n"; $reg_status == "failed"; return; } $lnk = db_connect(); # make sure that the login does not already exist $res = db_query("SELECT id_users FROM users WHERE login = '{$_POST['login']}'"); if (db_num_rows($res)) { $err = "Login name '{$_POST['login']}' is already in use. Please select another.
\n"; $reg_status == "failed"; return; } $hashpwd = md5($_POST['passwd']); $qry = " INSERT INTO users (login, passwd, age, gender) VALUES ('{$_POST['login']}','$hashpwd', '{$_POST['age']}', '{$_POST['gender']}') "; db_query($qry); $reg_status = "ok_passed"; db_close($lnk); ?>