include login page in index ,but how???

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
NAT
Forum Newbie
Posts: 24
Joined: Tue Mar 21, 2006 3:13 am

include login page in index ,but how???

Post by NAT »

Hi,

I am trying to include the login page in index.php . But when i login it opens in new page outside index.php. My login system is devided in two pages login.php en cheklogin.php. In login.php the code is only a form and tables, and takes the information from cheklogin.php so its like this:

Code: Select all

<form method="post" action="../testpage/cheklogin.php"> 
<p><STRONG>Name:</STRONG><br> 
<input type="text" name="name" size="25" maxlength="25"></p> 
<p><strong>Password:</strong><br> 
<input type="password" name="password" size="25" maxlength="25"></p> 
<p><input type="submit" name="submit" value="Login"></p> 
</form>

And in the cheklogin.php i have whole bunch information code, that needs to make connection with DB, session information.

Now my question is, how can i make login.php included inside the index.php? So that they work inside the index.php

Do i have to put some headers information on top of index.php?

i add it only this line in index.php where login.php must be included:

<?
include("login.php");
?>

But this is not enoughf, wat do i have to do so that login.php takes the information from cheklogin.php and includes inside index.php?

Thuse any have ideea how to do this? :?

Thanks in advance,

NAT
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

I don't understand what information you're taking from cheklogin.php. However, I'd do it like this:

1. Include checklogin to determine whether or not the user is being logged in or is logged in, etc.
2. Print out page
3. Print out login form if not logged in.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

NAT, you post is a little confusing. It sounds like you have a login form that is in the login.php page. It sounds like your index.php page wants to include the login.php page. Then it sounds like you have the cheklogin.php that is processing the login. What else is it you want to do?
NAT
Forum Newbie
Posts: 24
Joined: Tue Mar 21, 2006 3:13 am

Post by NAT »

Everah, i think i woul the way Ambush Commander explaind. Like i sayt i have deviede the login system in 2 pages.

Login.php = only a form

Chekloginphp = its whole information, connecting wiht DB, startsession, selecting field, and md5 ecryption, so actualy evrythink thuse cheklogin.php.



I want to give a try like Ambush Commander explaind.

1) So first i have to include cheklogin.php from the top of index.php

Code: Select all

<?
include("cheklogin.php");
?>
2) What page do i have to print out?

3)Do i ahve print out twice the same page? :?

second and third partd i dontunderstand.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

NAT wrote:Login.php = only a form

Chekloginphp = its whole information, connecting wiht DB, startsession, selecting field, and md5 ecryption, so actualy evrythink thuse cheklogin.php.

I want to give a try like Ambush Commander explaind.

1) So first i have to include cheklogin.php from the top of index.php

Code: Select all

<?
include("cheklogin.php");
?>
2) What page do i have to print out?

3)Do i ahve print out twice the same page? :?

second and third partd i dontunderstand.
2) Print out the page the user needs to see. If it is a form, show the form. Otherwise show what they should see.
3) Not unless the user needs to see the same page twice.
Post Reply