Jump to content

Recommended Posts

Hello again. 

I am trying to create a login form for users.  I'm not looking for something that will be of the highest security.  Basically, if User1 wants to login, I would want User1 to get redirected to User1's own directory.  I haven't tried putting code together, because I'm having problems finding what I should use here.  But, I can type out what I mean, it may make it easier to gain some assistance.

[code]if (user == 'user1' && pass == 'pass1');
openurl ("./user1/index.php');

elseif (user == 'user2' && pass == 'pass2');
openurl ("./user2/index.php');

else
openurl ("loginfailed.php');[/code]

Is there even a string that would call a URL to open, such as "openurl ("./user1/index.php');"?

Also, is there a string that I could include on all pages of a said directory, that would check to see if the user is logged in, if not direct them to the login page?

I see a lot about this, but it's worded in ways I am having problems understanding how to associate it in my own page.
Link to comment
https://forums.phpfreaks.com/topic/14121-user-login-redirection/
Share on other sites

In my login script I just made it so if the login information was correct it just included a page of the members area and then I started their session. Then if they didn't have the right information it printed "Wrong username or password."

[code]

if (user == 'user1' && pass == 'pass1'){
include 'user1/index.php';

} else {
        print "Wrong login information";
}[/code]

Sorry if I made a mistake. I am kinda in a hurry. Try something like that.
Link to comment
https://forums.phpfreaks.com/topic/14121-user-login-redirection/#findComment-55387
Share on other sites

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.