News:

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

Main Menu

SMF 2.0.8 Login

Started by zmc, August 25, 2014, 10:16:28 AM

Previous topic - Next topic

zmc

Hi,

Sorry, I speak a little english. My SMF Forum installed: ~/forum/*.*

I would like login page the ~/index.php


<?php
if ($login === true) {
header ( 'location: http://localhost/forum/index.php' );
} else {
if (
$_POST['login']) {
if (
$_POST['username'] & $_POST['password']) {// if the user data is correct from the SMF mysql db
header( 'location: http://localhost/forum/index.php' );
} else {
// if not correct user data
print 'error';
}
} else {}
print
'Login form: <form method="post"><input type="text" name="username"><input type="password" name="password"><input type="submit" name="login"></form>';
}
?>


Please help me & write a code this simple login form.

Thanks! Have a nice days!

Arantor

I don't quite understand what you want to do.

But it seems to me you want ssi_login(), as per SSI Readme and How do I integrate SMF into my PHP coded website? and How to use the SMF user system outside of SMF
Holder of controversial views, all of which my own.


zmc

#2
It works! My forum is private forum. See only registered users after login. Not see guests.

hxxp:localhost/forum/Settings.php [nonactive]


<?php

$ssi_guest_access = true;


hxxp:localhost/index.php [nonactive]


<?php

require_once(
"forum/SSI.php");
if ($context['user']['is_logged']) {
header ( 'location: http://localhost/forum' );
} else {
print '<form method="post" name="login">';
}

?>


How to change the login form page is redirect to hxxp:localhost/index.php [nonactive] (login form)

I would like, If not login all hxxp:localhost/forum/* [nonactive] pages redirect to hxxp:localhost/index.php [nonactive] the login form.

zmc

Please help me!

Guests are not see the forum. I would like see the guests are only all-time login page: hxxp:localhost/index.php [nonactive] (login form)
Registered users are see the forum after login. hxxp:localhost/index.php [nonactive] (login form) -> hxxp:localhost/forum/index.php [nonactive] (main page of SMF forum)

I would like the guests are all time see the login page hxxp:localhost/index.php [nonactive] (login form).

Very sorry my bad english.

Hj Ahmad Rasyid Hj Ismail

Admin > Config > Feature. Untick allow guest to browse.

zmc

Quote from: ahrasis on August 26, 2014, 05:16:06 AM
Admin > Config > Feature. Untick allow guest to browse.

Yes, it's ok, it is my settings. I would like guests (not login users) are:

hxxp:localhost/forum/index.php [nonactive] -> hxxp:localhost/index.php [nonactive] (login form)
hxxp:localhost/forum/index.php?action=help [nonactive] -> hxxp:localhost/index.php [nonactive] (login form)
hxxp:localhost/forum/index.php?action=search [nonactive] -> hxxp:localhost/index.php [nonactive] (login form)
hxxp:localhost/forum/index.php?action=login [nonactive] -> hxxp:localhost/index.php [nonactive] (login form)
hxxp:localhost/forum/index.php?action=register [nonactive] -> hxxp:localhost/index.php [nonactive] (login form)
hxxp:localhost/forum/index.php?action=credits [nonactive] -> hxxp:localhost/index.php [nonactive] (login form)
hxxp:localhost/forum/index.php?wap2 [nonactive] -> hxxp:localhost/index.php [nonactive] (login form)
hxxp:localhost/forum/index.php?action=reminder [nonactive] -> hxxp:localhost/index.php [nonactive] (login form)
hxxp:localhost/forum/* [nonactive] -> hxxp:localhost/index.php [nonactive] (login form)

I would like private forum. Not registering, only invite.

Hj Ahmad Rasyid Hj Ismail

Then disable registration as well. Admin > Members > Registration > Settings. Select Registration Disabled in the dropdown. This will totally disable registration while you configure a mod to enable invitation. You can find it at the mod page. This one can be useful: http://custom.simplemachines.org/mods/index.php?mod=2567

zmc

Quote from: ahrasis on August 26, 2014, 06:05:48 AM
Then disable registration as well. Admin > Members > Registration > Settings. Select Registration Disabled in the dropdown.

Ok, but the redirectings are how to? All $_SESSION [ 'login' ] is FALSE then hxxp:localhost/forum/* [nonactive] forwarding to hxxp:localhost/index.php [nonactive] (login form this).

Hj Ahmad Rasyid Hj Ismail

Quote from: ahrasis on August 26, 2014, 05:16:06 AM
Admin > Config > Feature. Untick allow guest to browse.
This already cover all that. That's a basic SMF settings. All menu link will only display login form.

Plus, I am not sure why the moderator is merging your topics. It kinda confusing now as I am not dealing with your coding or anything.

As for SSI, that is something I am not very familiar with. Wait for Arantor or others to reply.

Advertisement: