Most of profile and registration done

git-svn-id: file:///svn/phpbb/trunk@171 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
James Atkinson 2001-04-18 06:26:01 +00:00
parent 55ef5ae794
commit 3b5a1b549a
5 changed files with 170 additions and 71 deletions

View file

@ -81,6 +81,7 @@ define(PAGE_PROFILE, -4);
define(PAGE_VIEWONLINE, -6); define(PAGE_VIEWONLINE, -6);
define(PAGE_VIEWMEMBERS, -7); define(PAGE_VIEWMEMBERS, -7);
define(PAGE_FAQ, -8); define(PAGE_FAQ, -8);
define(PAGE_POSTING, -9);
define('BANLIST_TABLE', $table_prefix.'banlist'); define('BANLIST_TABLE', $table_prefix.'banlist');
define('CATEGORIES_TABLE', $table_prefix.'categories'); define('CATEGORIES_TABLE', $table_prefix.'categories');

View file

@ -22,7 +22,8 @@
* *
***************************************************************************/ ***************************************************************************/
DEFINE(HEADER_INC, TRUE); define(HEADER_INC, TRUE);
// Parse and show the overall header. // Parse and show the overall header.
$template->set_filenames(array("overall_header" => "overall_header.tpl", $template->set_filenames(array("overall_header" => "overall_header.tpl",
@ -30,7 +31,7 @@ $template->set_filenames(array("overall_header" => "overall_header.tpl",
if($userdata['session_logged_in']) if($userdata['session_logged_in'])
{ {
$logged_in_status = "You are logged in as <b>".$userdata["username"]."</b>."; $logged_in_status = "You are logged in as <b>".$userdata["username"]."</b>.";
$logged_in_status .= " [<A HREF=\"login.php?submit=logout\">Logout</A>]"; $logged_in_status .= " [<A HREF=\"login.php?submit=logout\">Logout</A>]";
} }
else else
@ -168,6 +169,9 @@ switch($pagetype)
$template->set_filenames(array("body" => "profile_add_body.tpl")); $template->set_filenames(array("body" => "profile_add_body.tpl"));
} }
break; break;
case 'profile':
$template->set_filenames(array("body" => "profile_view_body.tpl"));
break;
} }
?> ?>

View file

@ -127,6 +127,9 @@ $l_userdisallowed= "The $l_username you picked has been disallowed by the admini
$l_infoupdated = "Your Information has been updated"; $l_infoupdated = "Your Information has been updated";
$l_publicmail = "Allow other users to view my $l_emailaddress"; $l_publicmail = "Allow other users to view my $l_emailaddress";
$l_itemsreq = "Items marked with a * are required"; $l_itemsreq = "Items marked with a * are required";
$l_nouserid = "You must supply a user ID number in order to view profile data.";
$l_viewingprofile = "Viewing profile of ";
$l_hidden = "hidden";
// Viewforum // Viewforum
$l_viewforum = "View Forum"; $l_viewforum = "View Forum";

View file

@ -24,6 +24,16 @@
include('extension.inc'); include('extension.inc');
include('common.'.$phpEx); include('common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_POSTING, $session_length);
init_userprefs($userdata);
//
// End session management
//
if($submit && !$preview) if($submit && !$preview)
{ {
switch($mode) switch($mode)

View file

@ -37,7 +37,83 @@ init_userprefs($userdata);
switch($mode) switch($mode)
{ {
case 'viewprofile': case 'viewprofile':
$pagetype = "profile";
$page_title = "$l_profile";
include('includes/page_header.'.$phpEx);
if(!$HTTP_GET_VARS[POST_USERS_URL])
{
if(DEBUG)
{
error_die(GENERAL_ERROR, "You must supply the user ID number of the user you want to view", __LINE__, __FILE__);
}
else
{
error_die(GENERAL_ERROR, $l_nouserid);
}
}
$profiledata = get_userdata_from_id($HTTP_GET_VARS[POST_USERS_URL], $db);
// Calculate the number of days this user has been a member ($memberdays)
// Then calculate their posts per day
$regdate = strtotime($profiledata['user_regdate']);
$memberdays = (time() - $regdate) / (24*60*60);
$posts_per_day = $profiledata['user_posts'] / $memberdays;
// Get the users percentage of total posts
if($profiledata['user_posts'] != 0)
{
$total_posts = get_db_stat("postcount", $db);
$percentage = ($profiledata['user_posts'] / $total_posts) * 100;
}
else
{
$percentage = 0;
}
if($profiledata['user_viewemail'])
{
// Replace the @ with 'at'. Some anti-spam mesures.
$email_addy = str_replace("@", " at ", $profiledata['user_email']);
$email = "<a href=\"mailto:$email_addy\">$email_addy</a>";
}
else
{
$email = $l_hidden;
}
$template->assign_vars(array("L_VIEWINGPROFILE" => $l_viewingprofile,
"USERNAME" => stripslashes($profiledata['username']),
"L_USERNAME" => $l_username,
"L_VIEWPOSTUSER" => $l_viewpostuser,
"L_JOINED" => $l_joined,
"JOINED" => $profiledata['user_regdate'],
"POSTS_PER_DAY" => $posts_per_day,
"L_PERDAY" => $l_perday,
"POSTS" => $profiledata['user_posts'],
"PERCENTAGE" => $percentage . "%",
"L_OFTOTAL" => $l_oftotal,
"L_EMAILADDRESS" => $l_emailaddress,
"EMAIL" => $email,
"L_ICQNUMBER" => $l_icqnumber,
"ICQ" => $profiledata['user_icq'],
"L_AIM" => $l_aim,
"AIM" => $profiledata['user_aim'],
"L_MESSENGER" => $l_messenger,
"MSN" => $profiledata['user_msnm'],
"L_YAHOO" => $l_yahoo,
"YIM" => $profiledata['user_yim'],
"L_WEBSITE" => $l_website,
"WEBSITE" => "<a href=\"".$profiledata['user_website']."\" target=\"_blank\">".$profiledata['user_website']."</a>",
"L_FROM" => $l_from,
"FROM" => stripslashes($profiledata['user_from']),
"L_OCC" => $l_occupation,
"OCC" => stripslashes($profiledata['user_occ']),
"L_INTERESTS" => $l_interests,
"INTERESTS" => stripslashes($profiledata['user_intrest'])));
$template->pparse("body");
include('includes/page_tail.'.$phpEx);
break; break;
case 'editprofile': case 'editprofile':
@ -98,7 +174,7 @@ switch($mode)
} }
else else
{ {
error_die(SQL_QUERY, "Couldn't obtained next user_id information.", __LINE__, __FILE__); error_die(SQL_QUERY, "Couldn't obtained next user_id information.", __LINE__, __FILE__);
} }
$md_pass = md5($password); $md_pass = md5($password);
@ -137,7 +213,7 @@ switch($mode)
'".addslashes($website)."', '".addslashes($website)."',
'".addslashes($occ)."', '".addslashes($occ)."',
'".addslashes($from)."', '".addslashes($from)."',
'".addslashes($intrest)."', '".addslashes($interests)."',
'".addslashes($sig)."', '".addslashes($sig)."',
'$viewemail', '$viewemail',
'$theme', '$theme',
@ -181,7 +257,12 @@ switch($mode)
{ {
mail($email, $l_welcomesubj, $email_msg, "From: $email_from\r\n"); mail($email, $l_welcomesubj, $email_msg, "From: $email_from\r\n");
} }
error_die(GENERAL_ERROR, $msg);
$template->set_filenames(array("reg_header" => "error_body.tpl"));
$template->assign_vars(array("ERROR_MESSAGE" => $msg));
$template->pparse("reg_header");
include('includes/page_tail.'.$phpEx);
exit();
} }
else else
{ {