Advertisement:

login box using ssi.php

Aloittaja sprange3, maaliskuu 24, 2014, 01:24:05 IP

« edellinen - seuraava »

sprange3

I posted this in the support board, but I think it actually belongs here instead. Sorry about that.

I am looking for the correct way to add a login box to an external php site.
after calling the ssi.php file, I added the following code:
<?php ssi_login(); ?>
<?php ssi_welcome(); ?>
<?php ssi_logout(); ?>
. The login works correctly, however I would like the logout link and welcome message to only appear once the user is logged in. On login, the user should be redirected to the forum (as it is currently), on logout, the user should remain on the current page. What is the correct way to code this? Thank you.

riou

You would want something like


<?php if ($context['user']['is_guest']) { ssi_login(); } else { ssi_logout(); } ?>



It will need to be expanded and that to fit in, but that is the base to it, you can pair the welcome with the log out side as well if wanted

For where they go on logout you would use something like this:

<?php $_SESSION['logout_url']='http://yoursite.com'.$_SERVER['PHP_SELF']; ?>

Advertisement: