* */ $no_cookie=1; $bn_action="register"; require ("init.inc"); # Include mail template # --------------------- if (empty($bn_mail_template) ) { include ("$bn_dir_default/mail_template.$ext"); } else { include "$bn_dir/$bn_mail_template"; } # Execute before_access program # ----------------------------- if ($bn_before_access) { include "$bn_dir/$bn_before_access"; } display_header ("User registration", $header_footer); if ($site == "agora") { msgForm (msg(107, "Please, Choose a site in order to register"), "$main_page", ""); exit; } # gets all registered/restricted forums in this site # -------------------------------------------------- $forums = $db->listForums ($site); # A dirty way to list only forums which are registered or restricted !!! # ---------------------------------------------------------------------- if (is_array ($forums) ) { reset ($forums); while (list($name) = each ($forums) ) { if (($forums[$name]["type"] == "pub") || ($forums[$name]["type"] == "priv") ) { unset ($forums[$name]); } } } # If Creation form have been submitted # ------------------------------------ if (isset($go)) { $go=0; # Check for a valid email # ----------------------- if (!validate_email ($useraddress)) { msgForm (msg (47, "invalid email address"), "$WA_SELF", "back"); exit; } # Check for required fields # ------------------------- include "$tmpl_dir/admin/user_fields.$ext"; if (is_array ($bn_bind_var)) { while (list($field, $required) = each($bn_bind_var)) { if ($required && !$$field) { $mess = "$field : " . msg(5); msgForm ("$mess", "$WA_SELF", "back"); exit; } } } # Check that userid is valid (no spaces in it) # -------------------------------------------- $userid = trim($userid); // remove spaces at beginning and end if (ereg (" ", $userid) ) { msgForm (msg (108, "The user id must not contains spaces"), "$WA_SELF", "back"); display_footer($header_footer); exit; } # Check if users already exists # ----------------------------- $u = $db->getUser($site, $userid); if (is_array($u)) { msgForm (msg(109, "Sorry, this user: $userid has already be picked for this site, please choose another one"), "$WA_SELF", "back"); display_footer($header_footer); exit; } # ------------------------------------------------------------------- # Create user privileges (user->forums relation) for each forum # ------------------------------------------------------------------- # initialize default values # -------------------------- $uf_fields["unixdate"] = $now; $uf_fields["userid"] = $userid; $uf_fields["lastlogin"] = 0; $uf_fields["lastpost"] = 0; $uf_fields["listpriv"] = 1; $uf_fields["readpriv"] = 1; $uf_fields["writepriv"] = 1; $uf_fields["modpriv"] = 0; # For each registered/restricted forum in this site # ------------------------------------------------- if (is_array ($forums) && is_array($subscribeforums)) { reset ($forums); while (list($name) = each ($forums) ) { $forum = $forums[$name]["bn_name"]; if ($subscribeforums[$name] == 1) { # if user has subscribed to this forum # ------------------------------------ $uf_fields["bn_name"]=$forum; # set state to pending for a restricted forum, active for a registered one $uf_fields["state"] = ($forums[$name]["type"] == "rest") ? "P" : "1"; # insert into userforum # --------------------- $ret = $db->InsertPrivs ($site, $forum, $userid, $uf_fields); if ($ret < 0) { msgForm (msg(110, "Sorry, could not insert user $userid into database, try again or contact the site administrator"), "$WA_SELF?site=$site", "back"); exit; } } } } # generate a random password # -------------------------- $password = $auth->genPassword(); # insert this user in users table # ------------------------------- for (reset ($bn_var); $form_field=current($bn_var); next($bn_var)) { $$field=stripSlashes($$form_field); $u_fields[$form_field]=$$field; } $u_fields["password"] = md5($password); $u_fields["userpriv"] = "user"; $u_fields["lastlogin"] = 0; $ret = $db->insertUser ($site, $u_fields); if ($ret < 0) { msgForm (msg(110, "Sorry, could not insert user $userid into database, try again or contact the site administrator"), "$WA_SELF?site=$site", "back"); exit; } # Gets forum list for which the user want to register # --------------------------------------------------- while (is_array($subscribeforums) && list($name) = each ($subscribeforums) ) { $registered_forums .= " [ $name ] " . $forums[$name]["bn_title"]; if ($forums[$name]["type"] == "rest") { $registered_forums .= "\t [*]\n"; } else { $registered_forums .= "\n"; } $moderators[] = $forums[$name]["owneraddress"]; } # send mail back to the user and to moderators # -------------------------------------------- include "$inc_dir/mail.$ext"; mail_profile ($userid, $password, $u_fields, $moderators); # Now display the confirmation then exit # -------------------------------------- msgForm (msg(111, "The user '$userid' has been reserved
You should be receiving an email shortly with your password. Thanks for registering."), "$main_page?site=$site"); display_footer($header_footer); exit; } // End $go # ------------------------------------------- # Initialize default values then display FORM # ------------------------------------------- $userid = (isset($userid)) ? $userid : ""; $username = (isset($username)) ? $username : ""; $useraddress = (isset($useraddress)) ? $useraddress : ""; $homepage = (isset($homepage)) ? $homepage : ""; $details = (isset($details)) ? $details : ""; ?>
If you have questions, please refer to the help below form."); ?>
Enter user information
Login (user id):
User name:
E-mail Address:
Home page URL:
Notes:
Your email address is kept strictly confidential. Is it ok to email you from time to time?
0 ) { reset ($forums); echo "
"; caption ("Choose the forums that you want to subscribe to"); echo ""; while (list($name) = each ($forums) ) { print ("", $forums[$name]["bn_title"], $forum_types[$type]); } print "
 ForumAccess
"); checkBox ("subscribeforums[${name}]", "1", "1"); $type = $forums[$name]["type"]; printf ("%s%s
"; } ?>

Form Help

login Required
This is the User ID that you will enter when logging on to the system.
It is typically an abbreviation (i.e. jdoe) or a nickname.
This name should not contain any spaces.
User Name Required
Enter your full name here in first, last name order.
E-mail Address Required
Enter your E-mail address.
This is the address at which you will receive the confirmation, so a valid email address is required.
Once your registration will be confirmed, the password will be sent back to you by email.
Home page URL
Enter the full URL of your home page if you have one. Don't forget the http://
Notes
Optional field for your personal notes (address, ICQ, phone, etc.) These notes will not be accessable to anyone but the administrator.
0 ) { print "
Forum(s) Required
Check the forum(s) which you wish to access
"; } } echo ""; display_footer($header_footer); ?>