# Flash PHP Login Help

**URL:** <https://forum.kirupa.com/t/flash-php-login-help/26273>\
**Category:** Uncategorized\
**Created:** [July 21, 2003, 5:20pm UTC](https://forum.kirupa.com/t/flash-php-login-help/26273 "2003-07-21T17:20:56Z")\
**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:20pm UTC](https://forum.kirupa.com/t/flash-php-login-help/26273/1 "2003-07-21T17:20:56Z")

</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 though just a on (keyPress “”) for the input box so when u press enter it verifies the user and pass…

could someone make me an example or some code, i need it to work with this login script.

## heres the login php file

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

* * *

- 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-\>sql\_query($sql)) )  
{  
message\_die(GENERAL\_ERROR, ‘Error in obtaining userdata’, ‘’, **LINE** , **FILE** , $sql);  
}

if( $row = $db-\>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-\>assign\_vars(array(  
‘META’ =\> “”)  
);

$message = $lang[‘Error\_login’] . ’

’ . sprintf($lang[‘Click\_return\_login’], “”, ‘’) . ’

’ . sprintf($lang[‘Click\_return\_index’], ’  
message\_die(GENERAL\_MESSAGE, $message);  
}  
}  
}  
else  
{  
$redirect = ( !empty($HTTP\_POST\_VARS[‘redirect’]) ) ? $HTTP\_POST\_VARS[‘redirect’] : “”;  
$redirect = str\_replace("?", “&”, $redirect);

$template-\>assign\_vars(array(  
‘META’ =\> “”)  
);

$message = $lang[‘Error\_login’] . ’

’ . sprintf($lang[‘Click\_return\_login’], “”, ‘’) . ’

’ . sprintf($lang[‘Click\_return\_index’], ’  
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-\>set\_filenames(array(  
‘body’ =\> ‘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) \> 1)  
{  
$forward\_page = ‘’;

for($i = 1; $i \< 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 = ‘’;

make\_jumpbox(‘viewforum.’.$phpEx, $forum\_id);  
$template-\>assign\_vars(array(  
‘USERNAME’ =\> $username,

‘L\_ENTER\_PASSWORD’ =\> $lang[‘Enter\_password’],  
‘L\_SEND\_PASSWORD’ =\> $lang[‘Forgotten\_password’],

‘U\_SEND\_PASSWORD’ =\> append\_sid(“profile.$phpEx?mode=sendpassword”),

‘S\_HIDDEN\_FIELDS’ =\> $s\_hidden\_fields)  
);

$template-\>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 21, 2003, 8:04pm UTC](https://forum.kirupa.com/t/flash-php-login-help/26273/2 "2003-07-21T20:04:44Z")

</div>

I guess no one knows how to do this???:hair:
