Version 1.3.0

This commit is contained in:
Neo committed 2025-12-19 00:17:06 -08:00
1 parent 7ef3d1712a
commit f87d29ba65
290 files changed
+50206 -17930

No files matched your search

+208 -52
View File
@@ -2,15 +2,17 @@
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| Invision Power Board v1.3 Final
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| (c) 2001 - 2003 Invision Power Services
| http://www.invisionpower.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
| Web: http://www.invisionboard.com
| Time: Sun, 04 Jan 2004 00:30:16 GMT
| Release: 28e7bfb25f08ac72a789cb1b172fa185
| Email: matt@invisionpower.com
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Log in / log out module
@@ -30,13 +32,23 @@ class Login {
var $page_title = "";
var $nav = array();
var $login_html = "";
var $modules = "";
function Login() {
function Login()
{
global $ibforums, $DB, $std, $print;
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_login', $ibforums->lang_id);
$this->login_html = $std->load_template('skin_login');
if ( USE_MODULES == 1 )
{
require ROOT_PATH."modules/ipb_member_sync.php";
$this->modules = new ipb_member_sync();
}
// Are we enforcing log ins?
@@ -93,12 +105,36 @@ class Login {
function auto_login()
{
global $ibforums, $DB, $std, $print;
global $ibforums, $DB, $std, $print, $sess;
// Universal routine.
// If we have cookies / session created, simply return to the index screen
// If not, return to the log in form
$ibforums->member = $sess->authorise();
// If there isn't a member ID set, do a quick check ourselves.
// It's not that important to do the full session check as it'll
// occur when they next click a link.
if ( ! $ibforums->member['id'] )
{
$mid = intval($std->my_getcookie('member_id'));
$pid = $std->my_getcookie('pass_hash');
If ($mid and $pid)
{
$DB->query("SELECT * FROM ibf_members WHERE id=$mid AND password='$pid'");
if ( $member = $DB->fetch_row() )
{
$ibforums->member = $member;
$ibforums->session_id = "";
$std->my_setcookie('session_id', '0', -1 );
}
}
}
$true_words = $ibforums->lang['logged_in'];
$false_words = $ibforums->lang['not_logged_in'];
$method = 'no_show';
@@ -109,6 +145,18 @@ class Login {
$false_words = $ibforums->lang['reg_not_log_in'];
$method = 'show';
}
else if ($ibforums->input['fromemail'] == 1)
{
$true_words = $ibforums->lang['email_log_in'];
$false_words = $ibforums->lang['email_not_log_in'];
$method = 'show';
}
else if ($ibforums->input['frompass'] == 1)
{
$true_words = $ibforums->lang['pass_log_in'];
$false_words = $ibforums->lang['pass_not_log_in'];
$method = 'show';
}
if ($ibforums->member['id'])
{
@@ -118,7 +166,7 @@ class Login {
}
else
{
$std->boink_it($ibforums->base_url);
$std->boink_it($ibforums->vars['board_url'].'/index.'.$ibforums->vars['php_ext']);
}
}
else
@@ -146,11 +194,6 @@ class Login {
{
foreach( $HTTP_COOKIE_VARS as $cookie => $value)
{
if (preg_match( "/^(".$ibforums->vars['cookie_id']."fread.*$)/", $cookie, $match))
{
$std->my_setcookie( str_replace( $ibforums->vars['cookie_id'], "", $match[0] ) , '-1', -1 );
}
if (preg_match( "/^(".$ibforums->vars['cookie_id']."ibforum.*$)/i", $cookie, $match))
{
$std->my_setcookie( str_replace( $ibforums->vars['cookie_id'], "", $match[0] ) , '-', -1 );
@@ -163,6 +206,7 @@ class Login {
$std->my_setcookie('session_id', '-1');
$std->my_setcookie('topicsread', '-1');
$std->my_setcookie('anonlogin' , '-1');
$std->my_setcookie('forum_read', '-1');
$std->boink_it($ibforums->base_url);
exit();
@@ -185,19 +229,68 @@ class Login {
}
function markforum() {
function markforum()
{
global $ibforums, $DB, $std;
$ibforums->input['f'] = preg_replace( "/^(\d+)$/", "\\1", $ibforums->input['f'] );
$ibforums->input['f'] = intval($ibforums->input['f']);
if ($ibforums->input['f'] == "")
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files' ) );
}
$std->my_setcookie( "fread_".$ibforums->input['f'], time() );
$DB->query("SELECT id, name, subwrap, parent_id FROM ibf_forums WHERE id=".$ibforums->input['f']);
$std->boink_it($ibforums->base_url);
if ( ! $f = $DB->fetch_row() )
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files' ) );
}
//--------------------------------------
// Did we come in via the index?
//--------------------------------------
if ( $ibforums->input['i'] == 1 )
{
//--------------------------------------
// It's also a subforum, so grab all
// meh kiddies. "meh kiddies"? That's Rikki's
// bad influence. o_O
//--------------------------------------
$DB->query("SELECT id FROM ibf_forums WHERE parent_id={$ibforums->input['f']}");
while ( $r = $DB->fetch_row() )
{
$ibforums->forum_read[ $r['id'] ] = time();
}
}
//--------------------------------------
// Reset cookie (yum)
//--------------------------------------
$ibforums->forum_read[ $ibforums->input['f'] ] = time();
$std->hdl_forum_read_cookie('set');
//--------------------------------------
// Are we getting kicked back to the root forum (if sub forum) or index?
//--------------------------------------
if ( ($f['parent_id'] > 0) AND ($ibforums->input['i'] != 1) )
{
//--------------------------------------
// Its a sub forum, lets go redirect to parent forum
//--------------------------------------
$std->boink_it($ibforums->base_url."act=SF&f=".$f['parent_id']);
}
else
{
$std->boink_it($ibforums->base_url);
}
exit();
}
@@ -205,7 +298,8 @@ class Login {
function log_in_form($message="") {
function log_in_form($message="")
{
global $ibforums, $DB, $std, $print, $HTTP_REFERER;
//+--------------------------------------------
@@ -254,6 +348,18 @@ class Login {
$url = "";
//-------------------------------------------------
// More unicode..
//-------------------------------------------------
$len_u = $std->txt_stripslashes($HTTP_POST_VARS['UserName']);
$len_u = preg_replace("/&#([0-9]+);/", "-", $len_u );
$len_p = $std->txt_stripslashes($HTTP_POST_VARS['PassWord']);
$len_p = preg_replace("/&#([0-9]+);/", "-", $len_p );
//-------------------------------------------------
// Make sure the username and password were entered
//-------------------------------------------------
@@ -273,26 +379,26 @@ class Login {
// Check for input length
//-------------------------------------------------
if (strlen($ibforums->input['UserName']) > 32)
if (strlen($len_u) > 32)
{
$std->Error( array( LEVEL => 1, MSG => 'username_long' ) );
}
if (strlen($ibforums->input['PassWord']) > 32)
if (strlen($len_p) > 32)
{
$std->Error( array( LEVEL => 1, MSG => 'pass_too_long' ) );
}
$username = strtolower($ibforums->input['UserName']);
$username = strtolower(str_replace( '|', '|', $ibforums->input['UserName']) );
$password = md5( $ibforums->input['PassWord'] );
//-------------------------------------------------
// Attempt to get the user details
//-------------------------------------------------
$DB->query("SELECT id, name, mgroup, password, new_pass FROM ibf_members WHERE LOWER(name)='$username'");
$DB->query("SELECT id, name, mgroup, password, ip_address FROM ibf_members WHERE LOWER(name)='$username'");
if ($DB->get_num_rows())
if ( $DB->get_num_rows() )
{
$member = $DB->fetch_row();
@@ -314,11 +420,33 @@ class Login {
$std->my_setcookie("pass_hash" , $password, 1);
}
//------------------------------
// Update profile if IP addr missing
//------------------------------
if ($ibforums->input['s'])
if ( $member['ip_address'] == "" OR $member['ip_address'] == '127.0.0.1' )
{
$session_id = $ibforums->input['s'];
$DB->query("UPDATE ibf_members SET ip_address='{$ibforums->input['IP_ADDRESS']}' WHERE id={$member['id']}");
}
//------------------------------
// Create / Update session
//------------------------------
$poss_session_id = "";
if ( $cookie_id = $std->my_getcookie('session_id') )
{
$poss_session_id = $std->my_getcookie('session_id');
}
else if ( $ibforums->input['s'] )
{
$poss_session_id = $ibforums->input['s'];
}
if ($poss_session_id)
{
$session_id = $poss_session_id;
// Delete any old sessions with this users IP addy that doesn't match our
// session ID.
@@ -333,7 +461,7 @@ class Login {
'login_type' => $ibforums->input['Privacy'] ? 1 : 0
) );
$db_query = "UPDATE ibf_sessions SET $db_string WHERE id='".$ibforums->input['s']."'";
$db_query = "UPDATE ibf_sessions SET $db_string WHERE id='".$session_id."'";
}
else
{
@@ -350,7 +478,7 @@ class Login {
'running_time' => time(),
'member_group' => $member['mgroup'],
'ip_address' => substr($ibforums->input['IP_ADDRESS'], 0, 50),
'browser' => substr($HTTP_USER_AGENT, 0, 50),
'browser' => substr($std->clean_value($HTTP_USER_AGENT), 0, 50),
'login_type' => $ibforums->input['Privacy'] ? 1 : 0
) );
@@ -359,18 +487,6 @@ class Login {
$DB->query( $db_query );
//-----------------------------------
// If a bogus reset passy action occured,
// and we managed to log in, we'll assume
// that the user did nothing, so we remove
// this new pass setting.
//-----------------------------------
if ($member['new_pass'] != "")
{
$DB->query("UPDATE ibf_members SET new_pass='' WHERE id='".$member['id']."'");
}
$ibforums->member = $member;
$ibforums->session_id = $session_id;
@@ -392,17 +508,51 @@ class Login {
$std->my_setcookie( "anonlogin", 1 );
}
//-----------------------------------
// Clear out any passy change stuff
//-----------------------------------
$DB->query("DELETE FROM ibf_validating WHERE member_id={$ibforums->member['id']} AND lost_pass=1");
//-----------------------------------
// Redirect them to either the board
// index, or where they came from
//-----------------------------------
$std->my_setcookie("session_id", $ibforums->session_id, -1);
$this->logged_in = 1;
if ( USE_MODULES == 1 )
{
$this->modules->register_class(&$this);
$this->modules->on_login($member);
}
if ( $ibforums->input['return'] != "" )
{
$return = urldecode($ibforums->input['return']);
if ( preg_match( "#^http://#", $return ) )
{
$std->boink_it($return);
}
}
$print->redirect_screen( "{$ibforums->lang[thanks_for_login]} {$ibforums->member['name']}", $url );
}
else
{
$this->logged_in = 0;
if ( USE_MODULES == 1 )
{
$this->modules->register_class(&$this);
$this->modules->on_login($member);
}
$this->log_in_form( 'wrong_name' );
}
@@ -413,14 +563,10 @@ class Login {
function do_log_out() {
function do_log_out()
{
global $std, $ibforums, $DB, $print, $sess, $HTTP_COOKIE_VARS;
/*if(! $ibforums->member['id'])
{
$std->Error( array( LEVEL => 1, MSG => 'no_guests') );
}*/
// Update the DB
$DB->query("UPDATE ibf_sessions SET ".
@@ -441,20 +587,30 @@ class Login {
{
foreach( $HTTP_COOKIE_VARS as $cookie => $value )
{
if (preg_match( "/^(".$ibforums->vars['cookie_id']."fread.*$)/", $cookie, $match))
{
$std->my_setcookie( str_replace( $ibforums->vars['cookie_id'], "", $match[0] ) , '-1', -1 );
}
if (preg_match( "/^(".$ibforums->vars['cookie_id']."ibforum.*$)/i", $cookie, $match))
{
$std->my_setcookie( str_replace( $ibforums->vars['cookie_id'], "", $match[0] ) , '-', -1 );
if ( strlen( $match[1] ) > 0 )
{
$std->my_setcookie( str_replace( $ibforums->vars['cookie_id'], "", $match[1] ) , '-', -1 );
}
}
}
}
// Redirect...
$url = "";
if ( $ibforums->input['return'] != "" )
{
$return = urldecode($ibforums->input['return']);
if ( preg_match( "#^http://#", $return ) )
{
$std->boink_it($return);
}
}
$print->redirect_screen( $ibforums->lang['thanks_for_logout'], "" );
}