News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Variables

Started by chris077, August 14, 2009, 09:30:44 PM

Previous topic - Next topic

chris077

I figured it out..

Arantor

First up, did you include SSI.php as the first thing on the page? That can prevent logins working as expected.

Secondly, you can actually have it redirect wherever you want after a successful login by adding this after the include of SSI.php:

$_SESSION['login_url'] = 'http://where-i-want-to-go-back-to.com/'

chris077

I did both of those, and it still shows up as im a guest.

The code you gave does not work but in SSI.php i edited ..


function ssi_login($redirect_to = 'http://**/index.php', $output_method = 'echo')

Arantor

You don't edit SSI.php.

Literally:

<?php
include('SSI.php');
$_SESSION['login_url'] = 'http://**/index.php';

ssi_login();


The redirect_to parameter is broken in SMF 2. It's a known bug. You therefore have to work around it as I've shown.

chris077

Quote from: Arantor on August 14, 2009, 10:15:25 PM
You don't edit SSI.php.

Literally:

<?php
include('SSI.php');
$_SESSION['login_url'] = 'http://**/index.php';

ssi_login();


The redirect_to parameter is broken in SMF 2. It's a known bug. You therefore have to work around it as I've shown.
it still redirects me to the forum..And shows as a guest when i go back to homepage.

Arantor


chris077


Arantor

It's a resurgence of a bug in SMF 2.

Basically when it gets into the ssi_login function it actually drops the value out of the session, so you get this.

The solution is to set the session variable as I have indicated, and simply display the login form yourself. ssi_login contains the form variables, just bring that outside into your code, then you can style it as you like, and it should work.

chris077

I dont really understand what you mean..


<?php
$_SESSION
['login_url'] = '**/index.php';
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">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">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="Login" /></td>
</tr>
</table>
</form>'
;
?>


Kays

You need to include SSI.php before you set the session.


<?php
require_once('server_path_to_SSI.php');
$_SESSION['login_url'] = '**/index.php';
echo 
'
<form action="'
$scripturl'?action=login2" method="post" accept-charset="'$context['character_set'], '">

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

chris077

I did I just didn't include it in my post. I'm still lost..

chris077

#11
I just moved all my files into the same directory as the forum so now it works. Thanks for trying to help though guys. I appreciate it!

Wait...now how do i reset the forum so it uses community.php instead of index.php..?

Arantor

If you really want to rename it, this is doable, though not entirely recommended for a variety of reasons.

Though if you did want to do so, this has been done before - it's documented in Tips & Tricks somewhere, with the replies documenting the caveats to doing it - you'd be best looking through there first and then opening a new topic since this is a different thing entirely.

chris077

Thanks...I got that done but another question..

How would I use register on my website? I tried adding the ssi_register mod onto the SSI.php but its for 1.1.10 so it doesn't display the text or the right forms for 2.0..

Any help?

Arantor

SSI Register needs updating for 2.0. I volunteered to take it though I haven't had chance to actually do this yet.

chris077

Is there any other way to do this?

Arantor

What exactly do you want to do?

If you want to use the registration form, you either have to direct to the forum, or wait for SSI Register to be updated to 2.0.

chris077

Can I not somehow get the form from the smf files?

Arantor

That's what SSI Register does. It drops the form into your own page.

What exactly are you trying to do with Register()?

Orstio

Quote from: chris077 on August 15, 2009, 01:41:32 AM
I just moved all my files into the same directory as the forum so now it works. Thanks for trying to help though guys. I appreciate it!

Wait...now how do i reset the forum so it uses community.php instead of index.php..?

Make sure subdomain independent cookies is enabled in SMF, and it won't matter which directory your file is in.

Advertisement: