News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Login Box Troubles

Started by brianjw, January 17, 2009, 03:30:45 PM

Previous topic - Next topic

brianjw

Hi Guys,

I am trying to put a login box on a php page outside of SMF. However, I am not wishing to do it with the ssi_login function.

I've got the code for the external page, here it is:

<?php
if ($context['user']['is_logged'])
        {
echo '<form>
<label>Hello, '
$context['user']['name'], '</label>
<font color="white" size="-1">Your current actions are limited on this website, '
$context['user']['name'], '</font>
<br class="spacer" />
</form>'
;
}
else
{
echo '
<form action="'
$scripturl'?action=login2" method="post" accept-charset="UTF-8" onsubmit="hashLoginPassword(this, \'625ca73a6555dbbe2979eabefe27518c\');">
<label>Members Login:</label>
<input type="text" name="user" id="username" />
<input type="password" name="passwrd" id="pass" />
<input type="image" src="images/login-btn.gif" class="login-btn" alt="Login" title="Login" />
<br class="spacer" />
</form>'
;

?>


And SSI.php and the globals are of course included at the top of the page:

<?php
require("/home/**/public_html/**/community/SSI.php");
// The Login System
global $context;
global 
$scripturl;
?>



Ok. That entire code looks 100% correct to me. Here is my issue:

The form logs into SMF like it should and it directs to the homepage of the forum...
  • How can I get it to login, but stay on the current page.

    When I go back to the external page logged in to SMF, it still shows the login box instead of the user info it should show. I go back to the forum to make sure I am still logged in and I am.

    This has me greatly confused.

    If I need to use SSI in order to do everything I want, then tell me how I can:

    1.) Make the login box look how it does with the HTML/php code:


    2.) Make the login box use the css that it needs to use:


    3.) Use the submit button, as an image instead of a button as seen in the code above.

    Thanks in advance, guys.
    - Brian

10dc

Nice info and tips bro :) Thanks :)
Forum Camfrog Persahabatan Indonesia : www.forum-pi.com  |  www.udin.web.id

brianjw

Quote from: udin_azza on January 17, 2009, 07:02:32 PM
Nice info and tips bro :) Thanks :)
Um... your welcome. But it was a support question lmao. ;)

brianjw


Rumbaar

It looks like you are happy to edit files, why not edit that login function at the SSI.php level to incorporate your design requirements?
// Shows a login box.
function ssi_login($redirect_to = '', $output_method = 'echo')
{
global $scripturl, $txt, $user_info, $context;

if ($redirect_to != '')
$_SESSION['login_url'] = $redirect_to;

if ($output_method != 'echo' || !$user_info['is_guest'])
return $user_info['is_guest'];

echo '
<form action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '">
<table border="0" cellspacing="1" cellpadding="0" class="ssi_table">
<tr>
<td align="right"><label for="user">', $txt['username'], ':</label>&nbsp;</td>
<td><input type="text" id="user" name="user" size="9" value="', $user_info['username'], '" /></td>
</tr><tr>
<td align="right"><label for="passwrd">', $txt['password'], ':</label>&nbsp;</td>
<td><input type="password" name="passwrd" id="passwrd" size="9" /></td>
</tr><tr>
<td><input type="hidden" name="cookielength" value="-1" /></td>
<td><input type="submit" value="', $txt['login'], '" /></td>
</tr>
</table>
</form>';
}
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

Advertisement: