# Need help with Flash PHP login

**URL:** <https://forum.kirupa.com/t/need-help-with-flash-php-login/26229>\
**Category:** Uncategorized\
**Created:** [July 21, 2003, 5:37am UTC](https://forum.kirupa.com/t/need-help-with-flash-php-login/26229 "2003-07-21T05:37:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![emeX](https://avatars.discourse-cdn.com/v4/letter/e/a4c791/32.png) [@emeX](https://forum.kirupa.com/u/emeX)\
**Post date:** [July 21, 2003, 5:37am UTC](https://forum.kirupa.com/t/need-help-with-flash-php-login/26229/1 "2003-07-21T05:37:20Z")

</div>

i am trying to make a PHPBB login in flash i cant seem to get the loadvars thing right… could someone help me out… i want one dynamic box to display status and information and one input box to type in the user and pass… No enter button thought just a on (keyPress “\<Enter\>”) for the input box so when u press enter it verifies the user and pass…

## heres the login php file

\<?php  
/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

- 

```
                           login.php

```

- 

```
                       -------------------

```

- begin : Saturday, Feb 13, 2001
- copyright : © 2001 The phpBB Group
- email : [support@phpbb.com](mailto:support@phpbb.com)
- 
- $Id: login.php,v 1.47.2.12 2003/05/06 20:18:42 acydburn Exp $
- 
- 

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/

/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
\*

- 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.
- 

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/

//  
// Allow people to reach login page if  
// board is shut down  
//  
define(“IN\_LOGIN”, true);

define(‘IN\_PHPBB’, true);  
$phpbb\_root\_path = ‘./’;  
include($phpbb\_root\_path . ‘extension.inc’);  
include($phpbb\_root\_path . ‘common.’.$phpEx);

//  
// Set page ID for session management  
//  
$userdata = session\_pagestart($user\_ip, PAGE\_LOGIN);  
init\_userprefs($userdata);  
//  
// End session management  
//

// session id check  
if (!empty($HTTP\_POST\_VARS[‘sid’]) || !empty($HTTP\_GET\_VARS[‘sid’]))  
{  
$sid = (!empty($HTTP\_POST\_VARS[‘sid’])) ? $HTTP\_POST\_VARS[‘sid’] : $HTTP\_GET\_VARS[‘sid’];  
}  
else  
{  
$sid = ‘’;  
}

if( isset($HTTP\_POST\_VARS[‘login’]) || isset($HTTP\_GET\_VARS[‘login’]) || isset($HTTP\_POST\_VARS[‘logout’]) || isset($HTTP\_GET\_VARS[‘logout’]) )  
{  
if( ( isset($HTTP\_POST\_VARS[‘login’]) || isset($HTTP\_GET\_VARS[‘login’]) ) && !$userdata[‘session\_logged\_in’] )  
{  
$username = isset($HTTP\_POST\_VARS[‘username’]) ? trim(htmlspecialchars($HTTP\_POST\_VARS[‘username’])) : ‘’;  
$username = substr(str\_replace("’", “’”, $username), 0, 25);  
$password = isset($HTTP\_POST\_VARS[‘password’]) ? $HTTP\_POST\_VARS[‘password’] : ‘’;

```
	$sql = "SELECT user_id, username, user_password, user_active, user_level
		FROM " . USERS_TABLE . "
		WHERE username = '" . str_replace("\'", "''", $username) . "'";
	if ( !($result = $db-&gt;sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Error in obtaining userdata', '', __LINE__ , __FILE__ , $sql);
	}

	if( $row = $db-&gt;sql_fetchrow($result) )
	{
		if( $row['user_level'] != ADMIN && $board_config['board_disable'] )
		{
			redirect(append_sid("index.$phpEx", true));
		}
		else
		{
			if( md5($password) == $row['user_password'] && $row['user_active'] )
			{
				$autologin = ( isset($HTTP_POST_VARS['autologin']) ) ? TRUE : 0;

				$session_id = session_begin($row['user_id'], $user_ip, PAGE_INDEX, FALSE, $autologin);

				if( $session_id )
				{
					$url = ( !empty($HTTP_POST_VARS['redirect']) ) ? $HTTP_POST_VARS['redirect'] : "index.$phpEx";
					redirect(append_sid($url, true));
				}
				else
				{
					message_die(CRITICAL_ERROR, "Couldn't start session : login", "", __LINE__ , __FILE__ );
				}
			}
			else
			{
				$redirect = ( !empty($HTTP_POST_VARS['redirect']) ) ? $HTTP_POST_VARS['redirect'] : '';
				$redirect = str_replace('?', '&', $redirect);

				$template-&gt;assign_vars(array(
					'META' =&gt; "&lt;meta http-equiv=\"refresh\" content=\"3;url=login.$phpEx?redirect=$redirect\"&gt;")
				);

				$message = $lang['Error_login'] . '&lt;br /&gt;&lt;br /&gt;' . sprintf($lang['Click_return_login'], "&lt;a href=\"login.$phpEx?redirect=$redirect\"&gt;", '&lt;/a&gt;') . '&lt;br /&gt;&lt;br /&gt;' . sprintf($lang['Click_return_index'], '&lt;a href="' . append_sid("index.$phpEx") . '"&gt;', '&lt;/a&gt;');

				message_die(GENERAL_MESSAGE, $message);
			}
		}
	}
	else
	{
		$redirect = ( !empty($HTTP_POST_VARS['redirect']) ) ? $HTTP_POST_VARS['redirect'] : "";
		$redirect = str_replace("?", "&", $redirect);

		$template-&gt;assign_vars(array(
			'META' =&gt; "&lt;meta http-equiv=\"refresh\" content=\"3;url=login.$phpEx?redirect=$redirect\"&gt;")
		);

		$message = $lang['Error_login'] . '&lt;br /&gt;&lt;br /&gt;' . sprintf($lang['Click_return_login'], "&lt;a href=\"login.$phpEx?redirect=$redirect\"&gt;", '&lt;/a&gt;') . '&lt;br /&gt;&lt;br /&gt;' . sprintf($lang['Click_return_index'], '&lt;a href="' . append_sid("index.$phpEx") . '"&gt;', '&lt;/a&gt;');

		message_die(GENERAL_MESSAGE, $message);
	}
}
else if( ( isset($HTTP_GET_VARS['logout']) || isset($HTTP_POST_VARS['logout']) ) && $userdata['session_logged_in'] )
{
	if( $userdata['session_logged_in'] )
	{
		session_end($userdata['session_id'], $userdata['user_id']);
	}

	if (!empty($HTTP_POST_VARS['redirect']) || !empty($HTTP_GET_VARS['redirect']))
	{
		$url = (!empty($HTTP_POST_VARS['redirect'])) ? $HTTP_POST_VARS['redirect'] : $HTTP_GET_VARS['redirect'];
		redirect(append_sid($url, true));
	}
	else
	{
		redirect(append_sid("index.$phpEx", true));
	}
}
else
{
	$url = ( !empty($HTTP_POST_VARS['redirect']) ) ? $HTTP_POST_VARS['redirect'] : "index.$phpEx";
	redirect(append_sid($url, true));
}

```

}  
else  
{  
//  
// Do a full login page dohickey if  
// user not already logged in  
//  
if( !$userdata[‘session\_logged\_in’] )  
{  
$page\_title = $lang[‘Login’];  
include($phpbb\_root\_path . ‘includes/page\_header.’.$phpEx);

```
	$template-&gt;set_filenames(array(
		'body' =&gt; 'login_body.tpl')
	);

	if( isset($HTTP_POST_VARS['redirect']) || isset($HTTP_GET_VARS['redirect']) )
	{
		$forward_to = $HTTP_SERVER_VARS['QUERY_STRING'];

		if( preg_match("/^redirect=([a-z0-9\.#\/\?&=\+\-_]+)/si", $forward_to, $forward_matches) )
		{
			$forward_to = ( !empty($forward_matches[3]) ) ? $forward_matches[3] : $forward_matches[1];
			$forward_match = explode('&', $forward_to);

			if(count($forward_match) &gt; 1)
			{
				$forward_page = '';

				for($i = 1; $i &lt; count($forward_match); $i++)
				{
					if( !ereg("sid=", $forward_match[$i]) )
					{
						if( $forward_page != '' )
						{
							$forward_page .= '&';
						}
						$forward_page .= $forward_match[$i];
					}
				}
				$forward_page = $forward_match[0] . '?' . $forward_page;
			}
			else
			{
				$forward_page = $forward_match[0];
			}
		}
	}
	else
	{
		$forward_page = '';
	}

	$username = ( $userdata['user_id'] != ANONYMOUS ) ? $userdata['username'] : '';

	$s_hidden_fields = '&lt;input type="hidden" name="redirect" value="' . $forward_page . '" /&gt;';

	make_jumpbox('viewforum.'.$phpEx, $forum_id);
	$template-&gt;assign_vars(array(
		'USERNAME' =&gt; $username,

		'L_ENTER_PASSWORD' =&gt; $lang['Enter_password'],
		'L_SEND_PASSWORD' =&gt; $lang['Forgotten_password'],

		'U_SEND_PASSWORD' =&gt; append_sid("profile.$phpEx?mode=sendpassword"),

		'S_HIDDEN_FIELDS' =&gt; $s_hidden_fields)
	);

	$template-&gt;pparse('body');

	include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}
else
{
	redirect(append_sid("index.$phpEx", true));
}

```

}

## ?\>

sorry for the long post…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 23, 2003, 10:34am UTC](https://forum.kirupa.com/t/need-help-with-flash-php-login/26229/2 "2003-07-23T10:34:43Z")

</div>

Youd better shorten that post a bit if you want a reply 🙂
