diff options
author | James Atkinson <thefinn@users.sourceforge.net> | 2001-03-19 01:35:04 +0000 |
---|---|---|
committer | James Atkinson <thefinn@users.sourceforge.net> | 2001-03-19 01:35:04 +0000 |
commit | 9eff7725089a105db853f2aed81370a3abee8d69 (patch) | |
tree | a69713414736ed22eeb8651f46781d9a7dd52d36 | |
parent | 40f1f172a81232e910e09981116e58f45bb6b344 (diff) | |
download | forums-9eff7725089a105db853f2aed81370a3abee8d69.tar forums-9eff7725089a105db853f2aed81370a3abee8d69.tar.gz forums-9eff7725089a105db853f2aed81370a3abee8d69.tar.bz2 forums-9eff7725089a105db853f2aed81370a3abee8d69.tar.xz forums-9eff7725089a105db853f2aed81370a3abee8d69.zip |
User registration works.
git-svn-id: file:///svn/phpbb/trunk@106 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r-- | phpBB/common.php | 2 | ||||
-rw-r--r-- | phpBB/config.php | 6 | ||||
-rw-r--r-- | phpBB/db/mysql_schema.sql | 4 | ||||
-rw-r--r-- | phpBB/functions/auth.php | 229 | ||||
-rw-r--r-- | phpBB/functions/error.php | 109 | ||||
-rw-r--r-- | phpBB/functions/functions.php | 160 | ||||
-rw-r--r-- | phpBB/includes/constants.php | 2 | ||||
-rw-r--r-- | phpBB/includes/page_header.php | 17 | ||||
-rw-r--r-- | phpBB/includes/template.inc | 25 | ||||
-rwxr-xr-x | phpBB/language/lang_english.php | 39 | ||||
-rw-r--r-- | phpBB/login.php | 40 | ||||
-rw-r--r-- | phpBB/profile.php | 235 | ||||
-rwxr-xr-x | phpBB/templates/Default/agreement.tpl | 33 | ||||
-rwxr-xr-x | phpBB/templates/Default/profile_add_body.tpl | 123 |
14 files changed, 822 insertions, 202 deletions
diff --git a/phpBB/common.php b/phpBB/common.php index d8348fb50d..96ef85220d 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -63,6 +63,8 @@ else $email_sig = stripslashes($config[0]["email_sig"]); $email_from = $config[0]["email_from"]; $default_lang = $config[0]["default_lang"]; + $require_activation = $config[0]["require_activation"]; + $sys_timezone = $config[0]["system_timezone"]; $sys_lang = $default_lang; } diff --git a/phpBB/config.php b/phpBB/config.php index 067141b3da..733e65986d 100644 --- a/phpBB/config.php +++ b/phpBB/config.php @@ -29,9 +29,9 @@ $session_cookie_time = 3600; // DB connection config $dbms = "mysql"; $dbhost = "localhost"; -$dbname = "phpbb2"; -$dbuser = "phpbb2"; -$dbpasswd = "bbphp2bb"; +$dbname = ""; +$dbuser = ""; +$dbpasswd = ""; // Date format (needs to go into DB) $date_format = "M d Y h:i:s a"; // American datesformat diff --git a/phpBB/db/mysql_schema.sql b/phpBB/db/mysql_schema.sql index 289dbfb01c..e3a2dfb89d 100644 --- a/phpBB/db/mysql_schema.sql +++ b/phpBB/db/mysql_schema.sql @@ -46,6 +46,7 @@ CREATE TABLE phpbb_config ( allow_bbcode tinyint(3), allow_sig tinyint(3), allow_namechange tinyint(3), + require_activation tinyint(3), selected int(2) DEFAULT '0' NOT NULL, posts_per_page int(10), hot_threshold int(10), @@ -54,6 +55,7 @@ CREATE TABLE phpbb_config ( override_themes tinyint(3), email_sig varchar(255), email_from varchar(100), + system_timezone varchar(4), default_lang varchar(255), PRIMARY KEY (config_id), UNIQUE selected (selected) @@ -298,6 +300,8 @@ CREATE TABLE phpbb_users ( user_rank int(10) DEFAULT '0', user_level int(10) DEFAULT '1', user_lang varchar(255), + user_timezone varchar(4), + user_active tinyint(3), user_actkey varchar(32), user_newpasswd varchar(32), user_notify tinyint(3), diff --git a/phpBB/functions/auth.php b/phpBB/functions/auth.php index 6f355e2316..9de568bcc9 100644 --- a/phpBB/functions/auth.php +++ b/phpBB/functions/auth.php @@ -33,88 +33,91 @@ */ function auth($type, $db, $id = "", $user_ip = "") { - global $userdata; - switch($type) - { - case 'ip ban': - $sql = "DELETE FROM ".BANLIST_TABLE." - WHERE (ban_end < ". mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y")).") - AND (ban_end > 0)"; - $db->sql_query($sql); - $sql = "SELECT ban_ip FROM ".BANLIST_TABLE; - if($result = $db->sql_query($sql)) - { - if($totalrows = $db->sql_numrows($result)) - { - $iprow = $db->sql_fetchrowset($result); - for($x = 0; $x < $totalrows; $x++) - { - $ip = $iprow[$x]["ban_ip"]; - if($ip[strlen($ip) - 1] == ".") - { - $db_ip = explode(".", $ip); - $this_ip = explode(".", $user_ip); - - for($x = 0; $x < count($db_ip) - 1; $x++) - { - $my_ip .= $this_ip[$x] . "."; - } - - if($my_ip == $ip) - { - return(FALSE); - } - } - else - { - if($ipuser == $ip) - { - return(FALSE); - } - } - } - return(TRUE); - } - else - { - return(TRUE); - } - } - return(TRUE); - break; - case 'username ban': - $sql = "DELETE FROM ".BANLIST_TABLE." - WHERE (ban_end < ". mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y")).") - AND (ban_end > 0)"; - $db->sql_query($sql); - $sql = "SELECT ban_userid FROM ".BANLIST_TABLE." WHERE ban_userid = '$user_id'"; - if($result = $db->sql_query($sql)) - { - if($db->sql_numrows($result)) - { - return(FALSE); - } - else - { - return(TRUE); - } - } - else - { - return(TRUE); - } - break; - case 'login': - global $password; - if($userdata["user_password"] != md5($password)) - { - return(FALSE); - } - else - { - return(TRUE); - } - } + global $userdata; + switch($type) + { + case 'ip ban': + $sql = "DELETE FROM ".BANLIST_TABLE." + WHERE (ban_end < ". mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y")).") + AND (ban_end > 0)"; + $db->sql_query($sql); + $sql = "SELECT ban_ip FROM ".BANLIST_TABLE; + if($result = $db->sql_query($sql)) + { + if($totalrows = $db->sql_numrows($result)) + { + $iprow = $db->sql_fetchrowset($result); + for($x = 0; $x < $totalrows; $x++) + { + $ip = $iprow[$x]["ban_ip"]; + if($ip[strlen($ip) - 1] == ".") + { + $db_ip = explode(".", $ip); + $this_ip = explode(".", $user_ip); + + for($x = 0; $x < count($db_ip) - 1; $x++) + { + $my_ip .= $this_ip[$x] . "."; + } + if($my_ip == $ip) + { + return(FALSE); + } + } + else + { + if($ipuser == $ip) + { + return(FALSE); + } + } + } + return(TRUE); + } + else + { + return(TRUE); + } + } + return(TRUE); + break; + case 'username ban': + $sql = "DELETE FROM ".BANLIST_TABLE." + WHERE (ban_end < ". mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y")).") + AND (ban_end > 0)"; + $db->sql_query($sql); + $sql = "SELECT ban_userid FROM ".BANLIST_TABLE." WHERE ban_userid = '$user_id'"; + if($result = $db->sql_query($sql)) + { + if($db->sql_numrows($result)) + { + return(FALSE); + } + else + { + return(TRUE); + } + } + else + { + return(TRUE); + } + break; + case 'login': + global $password; + if($userdata["user_password"] != md5($password)) + { + return(FALSE); + } + else if($userdata["user_active"] == 0) + { + return(FALSE); + } + else + { + return(TRUE); + } + } } @@ -124,41 +127,41 @@ function auth($type, $db, $id = "", $user_ip = "") function get_userdata_from_id($userid, $db) { - $sql = "SELECT * FROM ".USERS_TABLE." WHERE user_id = $userid"; - if(!$result = $db->sql_query($sql)) - { - $userdata = array("error" => "1"); - return ($userdata); - } - if($db->sql_numrows($result)) - { - $myrow = $db->sql_fetchrowset($result); - return($myrow[0]); - } - else - { - $userdata = array("error" => "1"); - return ($userdata); - } + $sql = "SELECT * FROM ".USERS_TABLE." WHERE user_id = $userid"; + if(!$result = $db->sql_query($sql)) + { + $userdata = array("error" => "1"); + return ($userdata); + } + if($db->sql_numrows($result)) + { + $myrow = $db->sql_fetchrowset($result); + return($myrow[0]); + } + else + { + $userdata = array("error" => "1"); + return ($userdata); + } } function get_userdata($username, $db) { - $sql = "SELECT * FROM ".USERS_TABLE." WHERE username = '$username' AND user_level != ".DELETED; - if(!$result = $db->sql_query($sql)) - { - $userdata = array("error" => "1"); - } + $sql = "SELECT * FROM ".USERS_TABLE." WHERE username = '$username' AND user_level != ".DELETED; + if(!$result = $db->sql_query($sql)) + { + $userdata = array("error" => "1"); + } - if($db->sql_numrows($result)) - { - $myrow = $db->sql_fetchrowset($result); - return($myrow[0]); - } - else - { - $userdata = array("error" => "1"); - return ($userdata); - } + if($db->sql_numrows($result)) + { + $myrow = $db->sql_fetchrowset($result); + return($myrow[0]); + } + else + { + $userdata = array("error" => "1"); + return ($userdata); + } } ?> diff --git a/phpBB/functions/error.php b/phpBB/functions/error.php index 14f9e14073..d8027e1fad 100644 --- a/phpBB/functions/error.php +++ b/phpBB/functions/error.php @@ -24,64 +24,63 @@ function error_die($db, $error_code = "", $error_msg = "") { - global $template, $phpEx, $default_lang; - - if(!$template->get("overall_header")) - { - if(!empty($default_lang)) - { - include('language/lang_'.$default_lang.'.'.$phpEx); - } - else - { - include('language/lang_english.'.$phpEx); - } - include('includes/page_header.'.$phpEx); - } - if(!$error_msg) - { - switch($error_code) + global $template, $phpEx, $default_lang; + if(!defined("HEADER_INC")) + { + if(!empty($default_lang)) + { + include('language/lang_'.$default_lang.'.'.$phpEx); + } + else + { + include('language/lang_english.'.$phpEx); + } + include('includes/page_header.'.$phpEx); + } + if(!$error_msg) + { + switch($error_code) + { + case GENERAL_ERROR: + if(!$error_msg) + { + $error_msg = "An Error Occured"; + } + break; + case SQL_CONNECT: + $db_error = $db->sql_error(); + $error_msg = "Error: phpBB could not connect to the database. Reason: " . $db_error["message"]; + break; + case BANNED: + $error_msg = "You have been banned from this forum."; + break; + case QUERY_ERROR: + $db_error = $db->sql_error(); + $error_msg = "Error: phpBB could not query the database. Reason: " . $db_error["message"]; + break; + case SESSION_CREATE: + $error_msg = "Error creating session. Could not log you in. Please go back and try again."; + break; + case NO_POSTS: + $error_msg = "There are no posts in this forum. Click on the 'Post New Topic' link on this page to post one."; + break; + case LOGIN_FAILED: + $error_msg = "Login Failed. You have specified an incorrect/inactive username or invalid password, please go back and try again."; + break; + } + } + if(DEBUG) { - case GENERAL_ERROR: - if(!$error_msg) - { - $error_msg = "An Error Occured"; - } - break; - case SQL_CONNECT: - $db_error = $db->sql_error(); - $error_msg = "Error: phpBB could not connect to the database. Reason: " . $db_error["message"]; - break; - case BANNED: - $error_msg = "You have been banned from this forum."; - break; - case QUERY_ERROR: - $db_error = $db->sql_error(); - $error_msg = "Error: phpBB could not query the database. Reason: " . $db_error["message"]; - break; - case SESSION_CREATE: - $error_msg = "Error creating session. Could not log you in. Please go back and try again."; - break; - case NO_POSTS: - $error_msg = "There are no posts in this forum. Click on the 'Post New Topic' link on this page to post one."; - break; - case LOGIN_FAILED: - $error_msg = "Login Failed. You have specified an incorrect username or password, please go back and try again."; - break; + //$error_msg .= "<br>Line number: ".__LINE__."<br>In File: ".__FILE__; } - } - if(DEBUG) - { - //$error_msg .= "<br>Line number: ".__LINE__."<br>In File: ".__FILE__; - } - $template->set_file(array("error_body" => "error_body.tpl")); - $template->set_var(array("ERROR_MESSAGE" => $error_msg)); - $template->pparse("output", "error_body"); - include('includes/page_tail.'.$phpEx); - exit(); + $template->set_filenames(array("error_body" => "error_body.tpl")); + $template->assign_vars(array("ERROR_MESSAGE" => $error_msg)); + $template->pparse("error_body"); + include('includes/page_tail.'.$phpEx); + exit(); } - - + + ?> diff --git a/phpBB/functions/functions.php b/phpBB/functions/functions.php index 53e3cd8114..0e5341d2e6 100644 --- a/phpBB/functions/functions.php +++ b/phpBB/functions/functions.php @@ -117,4 +117,162 @@ function make_jumpbox($db) return($boxstring); } -?> +function language_select($default, $name="language", $dirname="language/") +{ + global $phpEx; + $dir = opendir($dirname); + $lang_select = "<select name=\"$name\">\n"; + while ($file = readdir($dir)) + { + if (ereg("^lang_", $file)) + { + $file = str_replace("lang_", "", $file); + $file = str_replace(".$phpEx", "", $file); + $file == $default ? $selected = " SELECTED" : $selected = ""; + $lang_select .= " <option$selected>$file\n"; + } + } + $lang_select .= "</select>\n"; + closedir($dir); + return $lang_select; +} + +function theme_select($default, $db) +{ + $sql = "SELECT theme_id, theme_name FROM ".THEMES_TABLE." ORDER BY theme_name"; + if($result = $db->sql_query($sql)) + { + $num = $db->sql_numrows($result); + $rowset = $db->sql_fetchrowset($result); + $theme_select = "<select name=\"theme\">\n"; + for($i = 0; $i < $num; $i++) + { + if((stripslashes($rowset[$i]["theme_name"]) == $default) || ($rowset[$i]["theme_id"] == $default)) + { + $selected = " SELECTED"; + } + else + { + $selected = ""; + } + $theme_select .= "\t<option value=\"".$rowset[$i]["theme_id"]."\"$selected>".stripslashes($rowset[$i]["theme_name"])."</option>\n"; + } + $theme_select .= "</select>\n"; + } + else + { + $theme_select = "<select name=\"theme\"><option value=\"-1\">Error in theme_select</option></select>"; + } + return($theme_select); +} + +function tz_select($default) +{ + global $board_tz; + if(!isset($default)) + { + $default == $board_tz; + } + $tz_select = "<select name=\"timezone\">"; + $tz_array = array( + "-12" => "(GMT -12:00 hours) Eniwetok, Kwajalein", + "-11" => "(GMT -11:00 hours) Midway Island, Samoa", + "-10" => "(GMT -10:00 hours) Hawaii", + "-9" => "(GMT -9:00 hours) Alaska", + "-8" => "(GMT -8:00 hours) Pacific Time (US & Canada)", + "-7" => "(GMT -7:00 hours) Mountain Time (US & Canada)", + "-6" => "(GMT -6:00 hours) Central Time (US & Canada), Mexico City", + "-5" => "(GMT -5:00 hours) Eastern Time (US & Canada), Bogota, Lima, Quito", + "-4" => "(GMT -4:00 hours) Atlantic Time (Canada), Caracas, La Paz", + "-3.5" => "(GMT -3:30 hours) Newfoundland", + "-3" => "(GMT -3:00 hours) Brazil, Buenos Aires, Georgetown", + "-2" => "(GMT -2:00 hours) Mid-Atlantic", + "-1" => "(GMT -1:00 hours) Azores, Cape Verde Islands", + "0" => "(GMT) Western Europe Time, London, Lisbon, Casablanca, Monrovia", + "+1" => "(GMT +1:00 hours) CET(Central Europe Time), Brussels, Copenhagen, Madrid, Paris", + "+2" => "(GMT +2:00 hours) EET(Eastern Europe Time), Kaliningrad, South Africa", + "+3" => "(GMT +3:00 hours) Baghdad, Kuwait, Riyadh, Moscow, St. Petersburg, Volgograd, Nairobi", + "+3.5" => "(GMT +3:30 hours) Tehran", + "+4" => "(GMT +4:00 hours) Abu Dhabi, Muscat, Baku, Tbilisi", + "+4.5" => "(GMT +4:30 hours) Kabul", + "+5" => "(GMT +5:00 hours) Ekaterinburg, Islamabad, Karachi, Tashkent", + "+5.5" => "(GMT +5:30 hours) Bombay, Calcutta, Madras, New Delhi", + "+6" => "(GMT +6:00 hours) Almaty, Dhaka, Colombo", + "+7" => "(GMT +7:00 hours) Bangkok, Hanoi, Jakarta", + "+8" => "(GMT +8:00 hours) Beijing, Perth, Singapore, Hong Kong, Chongqing, Urumqi, Taipei", + "+9" => "(GMT +9:00 hours) Tokyo, Seoul, Osaka, Sapporo, Yakutsk", + "+9.5" => "(GMT +9:30 hours) Adelaide, Darwin", + "+10" => "(GMT +10:00 hours) EAST(East Australian Standard), Guam, Papua New Guinea, Vladivostok", + "+11" => "(GMT +11:00 hours) Magadan, Solomon Islands, New Caledonia", + "+12" => "(GMT +12:00 hours) Auckland, Wellington, Fiji, Kamchatka, Marshall Island"); + + while(list($offset, $zone) = each($tz_array)) + { + if($offset == $default) + { + $selected = " SELECTED"; + } + else + { + $selected = ""; + } + $tz_select .= "\t<option value=\"$offset\"$selected>$zone</option>\n"; + } + $tz_select .= "</select>\n"; + return($tz_select); +} + +function validate_username(&$username, $db) +{ + $username = trim($username); + $username = strip_tags($username); + $username = htmlspecialchars($username); + if(empty($username)) + { + return(FALSE); + } + + $valid_name = TRUE; + $sql = "SELECT LOWER(username) FROM ".USERS_TABLE." WHERE username = '$username'"; + if($result = $db->sql_query($sql)) + { + if( ($numrows = $db->sql_numrows($result) ) > 0) + { + $valid_name = FALSE; + } + } + + $sql = "SELECT disallow_username FROM ".DISALLOW_TABLE." WHERE disallow_username = '$username'"; + if($result = $db->sql_query($sql)) + { + if(($numrows = $db->sql_numrows($result)) > 0) + { + $valid_name = FALSE; + } + } + + return($valid_name); +} +function generate_activation_key() +{ + $chars = array( + "a","A","b","B","c","C","d","D","e","E","f","F","g","G","h","H","i","I","j","J", + "k","K","l","L","m","M","n","N","o","O","p","P","q","Q","r","R","s","S","t","T", + "u","U","v","V","w","W","x","X","y","Y","z","Z","1","2","3","4","5","6","7","8", + "9","0" + ); + $max_elements = count($chars) - 1; + srand((double)microtime()*1000000); + $act_key = $chars[rand(0,$max_elements)]; + $act_key .= $chars[rand(0,$max_elements)]; + $act_key .= $chars[rand(0,$max_elements)]; + $act_key .= $chars[rand(0,$max_elements)]; + $act_key .= $chars[rand(0,$max_elements)]; + $act_key .= $chars[rand(0,$max_elements)]; + $act_key .= $chars[rand(0,$max_elements)]; + $act_key .= $chars[rand(0,$max_elements)]; + $act_key_md = md5($act_key); + + return($act_key_md); +} +?>
\ No newline at end of file diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index c4cddbf6c2..1d3feb4c3b 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -70,7 +70,7 @@ define(POST_FORUM_URL, 'f'); define(POST_USERS_URL, 'u'); define('BANLIST_TABLE', $table_prefix.'banlist'); -define('CATEGORIES_TABLE', $table_prefix.'categories'); +define('CATEGORIES_TABLE', $table_prefix.'catagories'); define('CONFIG_TABLE', $table_prefix.'config'); define('DISALLOW_TABLE', $table_prefix.'disallow'); define('FORUM_ACCESS_TABLE', $table_prefix.'forum_access'); diff --git a/phpBB/includes/page_header.php b/phpBB/includes/page_header.php index d108ce0916..35841cb682 100644 --- a/phpBB/includes/page_header.php +++ b/phpBB/includes/page_header.php @@ -22,6 +22,8 @@ * ***************************************************************************/ +DEFINE(HEADER_INC, TRUE); + // Parse and show the overall header. $template->set_filenames(array("overall_header" => "overall_header.tpl", "overall_footer" => "overall_footer.tpl")); @@ -131,6 +133,21 @@ switch($pagetype) "L_POSTNEWIN" => $l_postnewin)); $template->pparse("header"); break; + case 'register': + if(!isset($agreed)) + { + if(!isset($coppa)) + { + $coppa = FALSE; + } + $template->set_filenames(array("body" => "agreement.tpl")); + $template->assign_vars(array("COPPA" => $coppa)); + } + else + { + $template->set_filenames(array("body" => "profile_add_body.tpl")); + } + break; } ?> diff --git a/phpBB/includes/template.inc b/phpBB/includes/template.inc index 1255937aeb..fd25a0cbfb 100644 --- a/phpBB/includes/template.inc +++ b/phpBB/includes/template.inc @@ -1,7 +1,26 @@ <?php - -// (insert phpBB file header here) - +/*************************************************************************** + * template.inc + * ------------------- + * begin : Saturday, Feb 13, 2001 + * copyright : (C) 2001 The phpBB Group + * email : support@phpbb.com + * + * $Id$ + * + * + ***************************************************************************/ + +/*************************************************************************** + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * + ***************************************************************************/ + /** * Template class. By Nathan Codding of the phpBB group. * The interface was originally inspired by PHPLib templates, diff --git a/phpBB/language/lang_english.php b/phpBB/language/lang_english.php index d2166a5727..51ee9ad399 100755 --- a/phpBB/language/lang_english.php +++ b/phpBB/language/lang_english.php @@ -98,6 +98,8 @@ $l_nonewposts = "No New $l_posts $l_sincelast"; $l_indextitle = "Forum Index"; // Members and profile +$l_reginfo = "Registration Information"; +$l_profileinfo = "Profile Information (this information will be publicly viewable)"; $l_profile = "Profile"; $l_register = "Register"; $l_onlyreq = "Only requried if being changed"; @@ -191,9 +193,12 @@ $l_version = "Version"; // Auth // Register +$l_accountinactive = "Your account has been created. However, this forum requires account activation, an activation key has been sent to the email address you provided. Pease check your email for further information."; +$l_coppa = "Your account has been created, however in complance with the COPPA act you must print out this page and have you parent or guardian email it to: <br>$l_mailingaddress<br>Or fax it to: <br> $l_faxinfo<br> Once this information has been recived your account will be activated by the administrator and you will recive and email notification."; +$l_acountadded = "Thank you for registering with $sitename. Your account has been successfully created."; +$l_nowactive = "Your account is now been activated. You may login and post with this account. Thank you for using $sitename forums."; $l_notfilledin = "Error - you did not fill in all the required fields."; -$l_invalidname = "The username you chose \"$username\" has been taken."; -$l_disallowname = "The username you chose, \"$username\" has been disallowed by the administrator."; +$l_invalidname = "The username you chose \"$username\" has been taken or has been disallowed by the administrator."; $l_welcomesubj = "Welcome to $sitename Forums"; $l_welcomemail = @@ -217,10 +222,36 @@ Thank you for registering. $email_sig "; + +$l_welcomeemailactivate = +" +$l_welcomesubj, + +Please keep this email for your records. + + +Your account information is as follows: + +---------------------------- +Username: $username +Password: $password +---------------------------- + +Your account is currently INACTIVE. You cannot use it until you visit the following link: +http://$SERVER_NAME$PHP_SELF?mode=activate&act_key=$act_key + +Please do not forget your password as it has been encrypted in our database and we cannot retrieve it for you. +However, should you forget your password we provide an easy to use script to generate and email a new, random, password. + +Thank you for registering. + +$email_sig +"; + $l_beenadded = "You have been added to the database."; $l_thankregister= "Thank you for registering!"; $l_useruniq = "Must be unique. No two users can have the same Username."; -$l_storecookie = "Store my username in a cookie for 1 year."; +$l_storecookie = "Store my username in a cookie for 1 year"; // Prefs $l_prefupdated = "$l_preferences updated. $l_click <a href=\"index.$phpEx\">$l_here</a> $l_returnindex"; @@ -235,7 +266,7 @@ $l_boardtheme = "Board Theme"; $l_boardlang = "Board Language"; $l_nothemes = "No Themes In database"; $l_saveprefs = "Save $l_preferences"; - +$l_timezone = "Timezone"; // Search $l_searchterms = "Keywords"; $l_searchany = "Search for ANY of the terms (Default)"; diff --git a/phpBB/login.php b/phpBB/login.php index 8d35255036..bb59dd5acc 100644 --- a/phpBB/login.php +++ b/phpBB/login.php @@ -28,30 +28,30 @@ if($submit) { $userdata = get_userdata($username, $db); if($userdata["error"]) - { - error_die($db, LOGIN_FAILED); - } + { + error_die($db, LOGIN_FAILED); + } else - { - if(!auth("login", $db)) - { - error_die($db, LOGIN_FAILED); - } - else - { - $sessid = new_session($userdata[user_id], $user_ip, $session_cookie_time, $db); - set_session_cookie($sessid, $session_cookie_time, $session_cookie, "", "", 0); - header("Location: index.$phpEx"); - } - } + { + if(!auth("login", $db)) + { + error_die($db, LOGIN_FAILED); + } + else + { + $sessid = new_session($userdata[user_id], $user_ip, $session_cookie_time, $db); + set_session_cookie($sessid, $session_cookie_time, $session_cookie, "", "", 0); + header("Location: index.$phpEx"); + } + } } else if($logout) { - if($user_logged_in) - { - end_user_session($userdata["user_id"], $db); - } - header("Location: index.$phpEx"); + if($user_logged_in) + { + end_user_session($userdata["user_id"], $db); + } + header("Location: index.$phpEx"); } ?> diff --git a/phpBB/profile.php b/phpBB/profile.php index b4278d1182..2b49c57ac2 100644 --- a/phpBB/profile.php +++ b/phpBB/profile.php @@ -1,6 +1,6 @@ <?php /*************************************************************************** - * + * profile.php * ------------------- * begin : Saturday, Feb 13, 2001 * copyright : (C) 2001 The phpBB Group @@ -22,6 +22,237 @@ * ***************************************************************************/ +include('extension.inc'); +include('common.'.$phpEx); +switch($mode) +{ + case 'viewprofile': + + + break; + case 'editprofile': + + break; + case 'register': -?> + $pagetype = "register"; + $page_title = "$l_register"; + include('includes/page_header.'.$phpEx); + + if(!isset($agreed)) + { + $template->pparse("body"); + include('includes/page_tail.'.$phpEx); + } + else + { + if(isset($submit)) + { + $error = FALSE; + if(empty($username) || empty($password) || empty($password_confirm) || empty($email)) + { + $error = TRUE; + $error_msg = $l_notfilledin; + } + if(isset($username) && (!validate_username($username, $db))) + { + $error = TRUE; + if(isset($error_msg)) + { + $error_msg .= "<br>"; + } + $error_msg .= $l_invalidname; + } + if(isset($password) && ($password != $password_confirm)) + { + $error = TRUE; + if(isset($error_msg)) + { + $error_msg .= "<br>"; + } + $error_msg .= $l_mismatch; + } + } + + if(isset($submit) && !$error) + { + $md_pass = md5($password); + $sql = "INSERT INTO ".USERS_TABLE." ( + username, + user_regdate, + user_password, + user_email, + user_icq, + user_website, + user_occ, + user_from, + user_intrest, + user_sig, + user_viewemail, + user_theme, + user_aim, + user_yim, + user_msnm, + user_attachsig, + user_desmile, + user_html, + user_bbcode, + user_timezone, + user_lang, + user_active, + user_actkey) + VALUES ( + '".addslashes($username)."', + '".time()."', + '$md_pass', + '$email', + '$icq', + '".addslashes($website)."', + '".addslashes($occ)."', + '".addslashes($from)."', + '".addslashes($intrest)."', + '".addslashes($sig)."', + '$viewemail', + '$theme', + '".addslashes($aim)."', + '".addslashes($yim)."', + '".addslashes($msn)."', + '$alwayssig', + '$alwayssmile', + '$alwayshtml', + '$alwaysbbcode', + '$timezone', + '$lang', + "; + if($require_activation || $coppa) + { + $act_key = generate_activation_key(); + $sql .= "0, '$act_key')"; + } + else + { + $sql .= "1, '')"; + } + if($result = $db->sql_query($sql)) + { + if($require_activation) + { + $msg = $l_accountinactive; + $email_msg = $l_welcomeemailactivate; + } + else if($coppa) + { + $msg = $l_coppa; + } + else + { + $msg = $l_accountadded; + $email_msg = $l_welcomeemail; + } + mail($email, $l_welcomesubj, $email_msg, "From: $email_from\r\n"); + error_die($db, GENERAL_ERROR, $msg); + } + + } + if($error) + { + $template->set_filenames(array("reg_header" => "error_body.tpl")); + $template->assign_vars(array("ERROR_MESSAGE" => $error_msg)); + $template->pparse("reg_header"); + } + if(!isset($coppa)) + { + $coppa = FALSE; + } + $template->assign_vars(array("COPPA" => $coppa, + "L_SUBMIT" => $l_submit, + "USERNAME" => $username, + "EMAIL" => $email, + "YIM" => $yim, + "ICQ" => $icq, + "MSN" => $msn, + "AIM" => $aim, + "OCC" => $occ, + "INTERESTS" => $interests, + "FROM" => $from, + "WEBSITE" => $website, + "SIG" => $sig, + "VIEWEMAIL_YES" => ($viewemail) ? "CHECKED" : "", + "VIEWEMAIL_NO" => (!$viewemail) ? "CHECKED" : "", + "STOREUSERNAME_YES" => (!isset($storeusername) || $storeusername == 1) ? "CHECKED" : "", + "STOREUSERNAME_NO" => (isset($storeusername) && $storeusername == 0) ? "CHECKED" : "", + "ALWAYSSIG_YES" => ($alwayssig) ? "CHECKED" : "", + "ALWAYSSIG_NO" => (!$alwayssig) ? "CHECKED" : "", + "ALWAYSBBCODE_YES" => ($alwaysbbcode) ? "CHECKED" : "", + "ALWAYSBBCODE_NO" => (!$alwaysbbcode) ? "CHECKED" : "", + "ALWAYSHTML_YES" => ($alwayshtml) ? "CHECKED" : "", + "ALWAYSHTML_NO" => (!$alwayshtml) ? "CHECKED" : "", + "ALWAYSSMILE_YES" => ($alwayssmile) ? "CHECKED" : "", + "ALWAYSSMILE_NO" => (!$alwayssmile) ? "CHECKED" : "", + "LANGUAGE_SELECT" => language_select($default_lang, "lang"), + "THEME_SELECT" => theme_select($theme, $db), + "TIMEZONE_SELECT" => tz_select($timezone), + "L_ICQNUMBER" => $l_icqnumber, + "L_STORECOOKIE" => $l_storecookie, + "L_MESSENGER" => $l_messenger, + "L_YAHOO" => $l_yahoo, + "L_WEBSITE" => $l_website, + "L_AIM" => $l_aim, + "L_FROM" => $l_from, + "L_OCC" => $l_occupation, + "L_ALWAYSSMILE" => $l_alwayssmile, + "L_BOARDLANG" => $l_boardlang, + "L_BOARDTHEME" => $l_boardtheme, + "L_TIMEZONE" => $l_timezone, + "L_YES" => $l_yes, + "L_NO" => $l_no, + "L_INTERESTS" => $l_interests, + "L_USERUNIQ" => $l_useruniq, + "L_ALWAYSBBCODE" => $l_alwaysbbcode, + "L_ALWAYSHTML" => $l_alwayshtml, + "L_ALWAYSSIG" => $l_alwayssig, + "L_SIGNATURE" => $l_signature, + "L_SIGEXPLAIN" => $l_sigexplain, + "L_PREFERENCES" => $l_preferences, + "L_PUBLICMAIL" => $l_publicmail, + "L_ITEMSREQ" => $l_itemsreq, + "MODE" => $mode, + "L_REGINFO" => $l_reginfo, + "L_PROFILEINFO" => $l_profileinfo, + "L_CONFIRM" => $l_confirm, + "L_EMAILADDRESS" => $l_emailaddress)); + $template->pparse("body"); + include('includes/page_tail.'.$phpEx); + } + break; + case 'activate': + $sql = "SELECT user_id FROM ".USERS_TABLE." WHERE user_actkey = '$act_key'"; + if($result = $db->sql_query($sql)) + { + if($num = $db->sql_numrows($result)) + { + $rowset = $db->sql_fetchrowset($result); + $sql_update = "UPDATE ".USERS_TABLE." SET user_active = 1, user_actkey = '' WHERE user_id = ".$rowset[0]["user_id"]; + if($result = $db->sql_query($sql_update)) + { + error_die($db, GENERAL_ERROR, $l_nowactive); + } + else + { + error_die($db, QUERY_ERROR); + } + } + else + { + error_die($db, GENERAL_ERROR, $l_wrongactiv); + } + } + else + { + error_die($db, QUERY_ERROR); + } + break; +} + +?>
\ No newline at end of file diff --git a/phpBB/templates/Default/agreement.tpl b/phpBB/templates/Default/agreement.tpl new file mode 100755 index 0000000000..99ba618abe --- /dev/null +++ b/phpBB/templates/Default/agreement.tpl @@ -0,0 +1,33 @@ +<tr> + <td> + <table border="0" align="center" width="100%" bgcolor="#000000" cellpadding="0" cellspacing="1"> + <tr> + <td> + <table border="0" width="100%" cellpadding="0" cellspacing="1"> + <tr class="tableheader"> + <td width="100%" align="center"><b>{SITENAME} Forums Registration Agreement<b></td> + </tr> + <tr class="tablebody" bgcolor="#CCCCCC"> + <td width="100%" style="{padding: 5px; font-size: 10pt;}"> + Registration to this forum is free! We do insist that you abide by the rules and policies detailed below. + If you agree to the terms, please press the Agree button at the end of the page. + <br> + Although the administrators and moderators of phpBB.com will attempt to keep all objectionable messages off this forum, + it is impossible for us to review all messages. All messages express the views of the author, the owners of phpBB.com + will be held responsible for the content of any message.<br> + <br> + By clicking the Agree button, you warrant that you will not post any messages that are obscene, vulgar, sexually-orientated, + hateful, threatening, or otherwise violative of any laws.<br> + <br> + The owners of phpBB.com and the moderators of this forum have the right to remove, edit, move or close any thread for any reason.<br> + <br> + <div align="center" style="{font-weight: bold;}"><a href="profile.{PHPEX}?mode=register&agreed=true">I Agree to these terms (and am over 13 years of age)</a> + <a href="profile.{PHPEX}?mode=register&agreed=true&coppa=true">I Agree to these terms (and am <b>under</b> 13 years of age)</a> + <a href="index.{PHPEX}">I do not agree to these terms</a></div> + </td> + </table> + </td> + </tr> + </table> + </td> +</tr> diff --git a/phpBB/templates/Default/profile_add_body.tpl b/phpBB/templates/Default/profile_add_body.tpl new file mode 100755 index 0000000000..0364294344 --- /dev/null +++ b/phpBB/templates/Default/profile_add_body.tpl @@ -0,0 +1,123 @@ +<tr> + <td><form action="profile.{PHPEX}" method="POST"> + <table border="0" align="center" width="100%" bgcolor="#000000" cellpadding="0" cellspacing="1"> + <tr> + <td> + <table border="0" width="100%" cellpadding="3" cellspacing="1"> + <tr class="tableheader"> + <td colspan="2"><b>{L_REGINFO}</b> ({L_ITEMSREQ})</td> + </tr> + <tr class="tablebody"> + <td bgcolor="#DDDDDD"><b>{L_USERNAME}: *</b><br>{L_USERUNIQ}</td> + <td bgcolor="#CCCCCC"><input type="text" name="username" size="35" maxlenght="40" value="{USERNAME}"></td> + </tr> + <tr class="tablebody"> + <td bgcolor="#DDDDDD"><b>{L_PASSWORD}: *</b></td> + <td bgcolor="#CCCCCC"><input type="password" name="password" size="35" maxlenght="100" value="{PASSWORD}"></td> + </tr> + <tr class="tablebody"> + <td bgcolor="#DDDDDD"><b>{L_CONFIRM} {L_PASSWORD}: *</b></td> + <td bgcolor="#CCCCCC"><input type="password" name="password_confirm" size="35" maxlenght="100" value="{PASSWORD_CONFIRM}"></td> + </tr> + <tr class="tablebody"> + <td bgcolor="#DDDDDD"><b>{L_EMAILADDRESS}: *</b></td> + <td bgcolor="#CCCCCC"><input type="text" name="email" size="35" maxlength="255" value="{EMAIL}"></td> + </tr> + <tr class="tableheader"> + <td colspan="2"><b><b>{L_PROFILEINFO}</b></td> + </tr> + <tr class="tablebody"> + <td bgcolor="#DDDDDD"><b>{L_ICQNUMBER}:</b></td> + <td bgcolor="#CCCCCC"><input type="text" name="icq" size="10" maxlength="15" value="{ICQ}"></td> + </tr> + <tr class="tablebody"> + <td bgcolor="#DDDDDD"><b>{L_AIM}:</b></td> + <td bgcolor="#CCCCCC"><input type="text" name="aim" size="20" maxlength="255" value="{AIM}"></td> + </tr> + <tr class="tablebody"> + <td bgcolor="#DDDDDD"><b>{L_MESSENGER}:</b></td> + <td bgcolor="#CCCCCC"><input type="text" name="msn" size="20" maxlength="255" value="{ICQ}"></td> + </tr> + <tr class="tablebody"> + <td bgcolor="#DDDDDD"><b>{L_YAHOO}:</b></td> + <td bgcolor="#CCCCCC"><input type="text" name="yim" size="20" maxlength="255" value="{YIM}"></td> + </tr> + <tr class="tablebody"> + <td bgcolor="#DDDDDD"><b>{L_WEBSITE}:</b></td> + <td bgcolor="#CCCCCC"><input type="text" name="website" size="35" maxlength="255" value="{WEBSITE}"></td> + </tr> + <tr class="tablebody"> + <td bgcolor="#DDDDDD"><b>{L_FROM}:</b></td> + <td bgcolor="#CCCCCC"><input type="text" name="from" size="35" maxlength="100" value="{FROM}"></td> + </tr> + <tr class="tablebody"> + <td bgcolor="#DDDDDD"><b>{L_OCC}:</b></td> + <td bgcolor="#CCCCCC"><input type="text" name="occ" size="35" maxlength="100" value="{OCC}"></td> + </tr> + <tr class="tablebody"> + <td bgcolor="#DDDDDD"><b>{L_INTERESTS}:</b></td> + <td bgcolor="#CCCCCC"><input type="text" name="interests" size="35" maxlength="150" value="{OCC}"></td> + </tr> + <tr class="tablebody"> + <td bgcolor="#DDDDDD"><b>{L_SIGNATURE}:</b><br><font style="{font-size: 8pt;}">{L_SIGEXPLAIN}</font></td> + <td bgcolor="#CCCCCC"><textarea name="sig" rows="6" cols="45">{SIG}</textarea></td> + </tr> + <tr class="tableheader"> + <td colspan="2"><b>{L_PREFERENCES}</b></td> + </tr> + <tr class="tablebody"> + <td bgcolor="#DDDDDD"><b>{L_PUBLICMAIL}:</b></td> + <td bgcolor="#CCCCCC"><input type="radio" name="viewemail" value="1" {VIEWEMAIL_YES}> {L_YES} + <input type="radio" name="viewemail" value="0" {VIEWEMAIL_NO}> {L_NO}</td> + </tr> + <tr class="tablebody"> + <td bgcolor="#DDDDDD"><b>{L_STORECOOKIE}:</b></td> + <td bgcolor="#CCCCCC"><input type="radio" name="storeusername" value="1" {STOREUSERNAME_YES}> {L_YES} + <input type="radio" name="storeusername" value="0" {STOREUSERNAME_NO}> {L_NO}</td> + </tr> + <tr class="tablebody"> + <td bgcolor="#DDDDDD"><b>{L_ALWAYSSIG}:</b></td> + <td bgcolor="#CCCCCC"><input type="radio" name="alwayssig" value="1" {ALWAYSSIG_YES}> {L_YES} + <input type="radio" name="alwayssig" value="0" {ALWAYSSIG_NO}> {L_NO}</td> + </tr> + <tr class="tablebody"> + <td bgcolor="#DDDDDD"><b>{L_ALWAYSBBCODE}:</b></td> + <td bgcolor="#CCCCCC"><input type="radio" name="alwaysbbcode" value="1" {ALWAYSBBCODE_YES}> {L_YES} + <input type="radio" name="alwaysbbcode" value="0" {ALWAYSBBCODE_NO}> {L_NO}</td> + </tr> + <tr class="tablebody"> + <td bgcolor="#DDDDDD"><b>{L_ALWAYSHTML}:</b></td> + <td bgcolor="#CCCCCC"><input type="radio" name="alwayshtml" value="1" {ALWAYSHTML_YES}> {L_YES} + <input type="radio" name="alwayshtml" value="0" {ALWAYSHTML_NO}> {L_NO}</td> + </tr> + <tr class="tablebody"> + <td bgcolor="#DDDDDD"><b>{L_ALWAYSSMILE}:</b></td> + <td bgcolor="#CCCCCC"><input type="radio" name="alwayssmile" value="1" {ALWAYSSMILE_YES}> {L_YES} + <input type="radio" name="alwayssmile" value="0" {ALWAYSSMILE_NO}> {L_NO}</td> + </tr> + <tr class="tablebody"> + <td bgcolor="#DDDDDD"><b>{L_BOARDLANG}:</b></td> + <td bgcolor="#CCCCCC">{LANGUAGE_SELECT}</td> + </tr> + <tr class="tablebody"> + <td bgcolor="#DDDDDD"><b>{L_BOARDTHEME}:</b></td> + <td bgcolor="#CCCCCC">{THEME_SELECT}</td> + </tr> + <tr class="tablebody"> + <td bgcolor="#DDDDDD"><b>{L_TIMEZONE}:</b></td> + <td bgcolor="#CCCCCC">{TIMEZONE_SELECT}</td> + </tr> + <tr class="tableheader"> + <td align="center" colspan="2"> + <input type="hidden" name="mode" value="{MODE}"> + <input type="hidden" name="agreed" value="true"> + <input type="hidden" name="coppa" value="{COPPA}"> + <input type="submit" name="submit" value="{L_SUBMIT}"> + </tr> + </table> + </td> + </tr> +</table> +</form> +</td> +</tr> |