Secure page only allow those who had logged in to log in.

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
fuyenhou
Forum Newbie
Posts: 9
Joined: Tue Jun 22, 2004 4:54 am
Location: Malaysia
Contact:

Secure page only allow those who had logged in to log in.

Post by fuyenhou »

Code: Select all

<?php
session_start(); 
if (isset($_SESSION['logged'])) { 


<HTML>
<HEAD>
	
</head>
<body>


[b]Interface coding[/b]

</body>
</html>


} else {
[b]another error interface[/b]

}
?>
I am developing a secure page only allow member to log in...
I am wondering is this way of programming works? I don;t think works.. normally the document I read./ I found that pppl doing those interface coding by adding echo..those related information in the html code

What can I do.. if I don;t want it...
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

I'm sorry I didnt follow that at all.. could you rephrase what your trying to say? :P
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

I prefer to do something along the lines of:

Code: Select all

<?php
session_start();
if(empty($_SESSION['loggedin'])){
    header("Location: /accessdenied.php");
    exit;
}
//secure page stuff goes here
fuyenhou
Forum Newbie
Posts: 9
Joined: Tue Jun 22, 2004 4:54 am
Location: Malaysia
Contact:

Post by fuyenhou »

OKie... I would like to develop a secure web site... that only allow those member who had login in order to login to the web site
For example.. http://www.hotmail.com after user login into the web site, only they can able to login into http://www.hotmail.com/home (something like that)
The page I am focus is on http://www.hotmail.com/home User are unable direct login into http://www.hotmail.com/home it is a must for them to login from http://www.hotmail.com right?
So.. http://www.hotmail.com/home is that possible to code by this way?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

I agree with mark a redirect is probably the best way to go....
fuyenhou
Forum Newbie
Posts: 9
Joined: Tue Jun 22, 2004 4:54 am
Location: Malaysia
Contact:

Post by fuyenhou »

Yeah .. I make it thanks for help
Post Reply