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

@ -1,26 +1,26 @@
<?php
/***************************************************************************
* includes.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
*
***************************************************************************/
/***************************************************************************
* includes.php
* -------------------
* 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.
*
*
***************************************************************************/
/***************************************************************************
*
* 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.
*
*
***************************************************************************/
// Constants
// Debug Level
@ -81,6 +81,7 @@ define(PAGE_PROFILE, -4);
define(PAGE_VIEWONLINE, -6);
define(PAGE_VIEWMEMBERS, -7);
define(PAGE_FAQ, -8);
define(PAGE_POSTING, -9);
define('BANLIST_TABLE', $table_prefix.'banlist');
define('CATEGORIES_TABLE', $table_prefix.'categories');

View file

@ -1,36 +1,37 @@
<?php
/***************************************************************************
/***************************************************************************
* page_header.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* -------------------
* 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.
*
*
***************************************************************************/
/***************************************************************************
*
* 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.
*
*
***************************************************************************/
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",
"overall_footer" => "overall_footer.tpl"));
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>]";
}
else
@ -73,39 +74,39 @@ $template->assign_vars(array("SITENAME" => $sitename,
$template->pparse("overall_header");
// Do a switch on page type, this way we only load the templates that we need at the time
switch($pagetype)
switch($pagetype)
{
case 'index':
$template->set_filenames(array("header" => "index_header.tpl",
"body" => "index_body.tpl",
"footer" => "index_footer.tpl"));
$template->assign_vars(array("TOTAL_POSTS" => $total_posts,
"TOTAL_USERS" => $total_users,
"NEWEST_USER" => $newest_user,
"NEWEST_UID" => $newest_uid,
"USERS_BROWSING" => $users_browsing));
$template->pparse("header");
break;
case 'viewforum':
$template->set_filenames(array("header" => "viewforum_header.tpl",
"body" => "viewforum_body.tpl",
"jumpbox" => "jumpbox.tpl",
"footer" => "viewforum_footer.tpl"));
$jumpbox = make_jumpbox($db);
$template->assign_vars(array("JUMPBOX_LIST" => $jumpbox,
"JUMPBOX_ACTION" => "viewforum.".$phpEx,
"SELECT_NAME" => POST_FORUM_URL));
$template->assign_var_from_handle("JUMPBOX", "jumpbox");
$template->assign_vars(array("FORUM_ID" => $forum_id,
"FORUM_NAME" => $forum_name,
"MODERATORS" => $forum_moderators));
$template->pparse("header");
break;
case 'viewtopic':
@ -117,9 +118,9 @@ switch($pagetype)
$template->assign_vars(array("JUMPBOX_LIST" => $jumpbox,
"JUMPBOX_ACTION" => "viewforum.".$phpEx,
"SELECT_NAME" => POST_FORUM_URL));
$template->assign_var_from_handle("JUMPBOX", "jumpbox");
$template->assign_vars(array("FORUM_ID" => $forum_id,
"FORUM_NAME" => $forum_name,
"TOPIC_ID" => $topic_id,
@ -144,7 +145,7 @@ switch($pagetype)
$template->assign_var_from_handle("JUMPBOX", "jumpbox");
$template->pparse("header");
break;
case 'newtopic':
$template->set_filenames(array("header" => "newtopic_header.tpl",
"body" => "posting_body.tpl"));
@ -161,13 +162,16 @@ switch($pagetype)
$coppa = FALSE;
}
$template->set_filenames(array("body" => "agreement.tpl"));
$template->assign_vars(array("COPPA" => $coppa));
$template->assign_vars(array("COPPA" => $coppa));
}
else
{
$template->set_filenames(array("body" => "profile_add_body.tpl"));
}
break;
case 'profile':
$template->set_filenames(array("body" => "profile_view_body.tpl"));
break;
}
?>

View file

@ -18,7 +18,7 @@
* (at your option) any later version.
*
***************************************************************************/
$l_forum = "Forum";
$l_forums = "Forums";
$l_topic = "Topic";
@ -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_publicmail = "Allow other users to view my $l_emailaddress";
$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
$l_viewforum = "View Forum";
@ -209,15 +212,15 @@ $l_mailingaddress =
";
$l_faxinfo = "
Mark Fax with:
Mark Fax with:
ATTN: James Atkinson<br>
RE: Forum Registration<br>
<br>
Fax Number: +1-604-742-1770<br>
";
$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 mail 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_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 mail 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_welcomesubj = "Welcome to $sitename Forums";
$l_welcomemail =
$l_welcomemail =
"
$l_welcomesubj,
@ -239,7 +242,7 @@ Thank you for registering.
$email_sig
";
$l_welcomeemailactivate =
$l_welcomeemailactivate =
"
$l_welcomesubj,
@ -335,12 +338,12 @@ $l_preview = "Preview Post";
$l_nopostlock = "You cannot post a reply to this topic, it has been locked.";
$l_topicreview = "Topic Review";
$l_notifysubj = "A reply to your topic has been posted.";
$l_notifybody = 'Dear $m[username]\r\nYou are receiving this Email because a message
you posted on $sitename forums has been replied to, and
$l_notifybody = 'Dear $m[username]\r\nYou are receiving this Email because a message
you posted on $sitename forums has been replied to, and
you selected to be notified on this event.
You may view the topic at:
http://$SERVER_NAME$url_phpbb/viewtopic.$phpEx?topic=$topic&forum=$forum
Or view the $sitename forum index at
@ -386,18 +389,18 @@ $l_wrongmail = "The email address you entered does not match the one stored in o
$l_passsubj = "$sitename Forums Password Change";
$l_pwdmessage = 'Dear $checkinfo[username],
You are receiving this email because you (or someone pretending to be you)
has requested a passwordchange on $sitename forums. If you believe you have
received this message in error simply delete it and your password will remain
You are receiving this email because you (or someone pretending to be you)
has requested a passwordchange on $sitename forums. If you believe you have
received this message in error simply delete it and your password will remain
the same.
Your new password as generated by the forums is: $newpw
In order for this change to take effect you must visit this page:
In order for this change to take effect you must visit this page:
http://$SERVER_NAME$PHP_SELF?actkey=$key
Once you have visited the page your password will be changed in our database,
Once you have visited the page your password will be changed in our database,
and you may login to the profile section and change it as desired.
Thank you for using $sitename Forums

View file

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

View file

@ -37,7 +37,83 @@ init_userprefs($userdata);
switch($mode)
{
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;
case 'editprofile':
@ -98,7 +174,7 @@ switch($mode)
}
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);
@ -137,7 +213,7 @@ switch($mode)
'".addslashes($website)."',
'".addslashes($occ)."',
'".addslashes($from)."',
'".addslashes($intrest)."',
'".addslashes($interests)."',
'".addslashes($sig)."',
'$viewemail',
'$theme',
@ -181,7 +257,12 @@ switch($mode)
{
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
{