Password problem

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
mettlehead
Forum Newbie
Posts: 15
Joined: Fri Oct 11, 2002 11:03 am
Location: Canada

Password problem

Post by mettlehead »

I am building a very simple password example. I have 2 text field in my html form, username and password. On submit I call password.php. When I am in there all I thought I had to do was this:

<?
if($username=="me" && $password=="you") {
echo "your in";
}
else {
echo "You have not entered a valid username/password. Remember, they are case sensitive.";
}
?>

it doesn't seem to work though, any ideas? I alo need to know how to call a html page in php, like mypage.html.
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

just use

Code: Select all

include("path/page.html");
after you have loged in.

do u use a html form to login? if so check the username and password fields names.
if you use a form, try this:

Code: Select all

$username = $_POST&#1111;'username'];
$password = $_POST&#1111;'password'];
<? 
if($username=="me" && $password=="you") &#123; 
echo "your in"; 
&#125; 
else &#123; 
echo "You have not entered a valid username/password. Remember, they are case sensitive."; 
&#125; 
?>
don't use ASP style tags, always use <?php ?>....
mettlehead
Forum Newbie
Posts: 15
Joined: Fri Oct 11, 2002 11:03 am
Location: Canada

Great

Post by mettlehead »

Thanks, it works no. 1 Million thanks. :)
Post Reply