logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: Cannot Authenticate users on a Frame based php page
Author
pralagar



Joined: 25 Dec 2006
Posts: 2

PostPosted: Mon 25 Dec '06 11:55    Post subject: Cannot Authenticate users on a Frame based php page Reply with quote

Hi Everyone,

I am a beginner in PHP. I am now trying to have a login page. After inputting user name and password, it should take me to a welcome page that enables frames. Can you suggest me... I am in a very big urgency on the same[/b]
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Mon 25 Dec '06 18:18    Post subject: Reply with quote

You need to start a session on every single page with a session name.

Code:

session_name("mysession");
session_start();



Than you have to save the login data into the session.

If you have more questions, please ask again.
Back to top
pralagar



Joined: 25 Dec 2006
Posts: 2

PostPosted: Wed 27 Dec '06 11:12    Post subject: Thanks a lot for the start Reply with quote

Hi!

When you say, use the below mentioned code, all I need to do is use this code as line one and two.

does this code mean, there is a new session starting every page. If yes, I wouldnt need that, because, the requirement is to start a session and that session should understand the user(userid). When they click on a link of a button, they should be verified whether there is a session running for the user. If not, should redirect the user to login page.

You Help would be much appreciated for the successful completion of my assignement.

Once again Thanks a lot, James....
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Wed 27 Dec '06 11:49    Post subject: Reply with quote

Hello!
No, that does not mean that it start a new session. It only means that php resuse the the session you gave the name.

Code:

<?php
if($_SESSION['userid']!=""){
//ok
}
else
{
//do login redirect
}


the login page could be
Code:

<?php
// db action or ...
//asking if user log in is ok

if($login==ok){
$_SESSION['userid']=$userid_from_db;
}
else
{
//login formular
}
?>


Hope that snippet helps!
Back to top


Reply to topic   Topic: Cannot Authenticate users on a Frame based php page View previous topic :: View next topic
Post new topic   Forum Index -> Other Software