Jump to content

Recommended Posts

Hi.

 

 

Is ther a way to use one login form to login to multiple pages?

 

Here is my login form:

 

<form action="login.php" method="post" name="login">


   <!-- Show a simple login form -->
<input type="text" name="username" value="username">
<input type="password" name="password" value="password">
<input type="submit" value="login" name="login"> 

</form>

 

This logs me in to my main site.

But I also needs it to login to /forum/login.php at the same time.

 

Any easy way to do this?

 

 

 

King

Link to comment
https://forums.phpfreaks.com/topic/64505-one-form-multiple-logins/
Share on other sites

When you do this in PHP

 

<?php

session_start();

$_SESSION['userIsLoggedIn'] = true;

?>

 

That userIsLoggedIn value becomes available to you anywhere at anytime for a certain amount of time (so long as you use session_start()).

 

So as long as login.php makes a $_SESSION variable that as the same name, the site will maintain login "state" until you destroy that variable (or destroy the session).

Well.. I'm a newbie..  :)

 

Maybe it can...  :P I really dunno..  Can someone give me a little more info on how to do this? As I said I'm a newbie to this.

 

But here's alittle info from someone else who did this. But they wont give more info unless they get paid:

 

once they use the site login to login to the forum it will set a cookie and login them in straight away in furture

just edit the login page on the forum so the remember me box is already ticked

 

 

 

Thanx so far guys. I'm sure someone out here is able to help me solv this.

 

 

King

 

You've got one database, called "MySite" or whatever.  You connect to it using the usual methods (mysql_connect() or whatever).  Then you have tables inside that.

 

TABLE "users" -- contains user information, like id, last login time, etc.
userid
username
password
fullname
lastlogin

TABLE "forum" -- contains the main page of the forum listing the subforums (like PHP Help, MySQL Help, etc. on the main page of this site)
subforumid
subforumname

TABLE "forum_threads" -- contains the threads for the subforum
threadid
subforumid
treadtopic
threadstarted

TABLE "forum_posts" -- contains the posts
postid
threadid
postauthor
postcontent

 

Anyhow, that's not the best laid out schema for a forum, but they're all part of the same database.  If that's still confusing (it was to me when I first saw it), think of it like an Excel file.  In Excel, it's a single .xls file, but there are multiple workbooks inside that can influence each other.  The database is the file, the tables are the workbooks.

 

Once that is setup, their login is good for everything on the site using sessions.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.