orlox
April 16th, 2006, 10:02 PM
Hi, I'm trying to write a login form with php, but I can't get it to work. Right now I'm simply trying to make that the php script, after logging in doesn't write the login form. It doesn't check that the fields are valid, or do a real login at all. Basically, my script has this statement to handle that:
<?php
print_login(){...}
print_logged(){...}
if (empty ($action))
$action = 0;
swicth ($action)
{
case 0
print_login ();
break;
case 1
print_logged ();
break;
}
?>
where print_login() prints the login form, and print_logged() prints a "logged as username" instead. the login form that's printed is defined as this:
...
<form method="post" action="?action=1">
...
so that when the user submits the form, $action is equal to 1 and the script prints the corresponding "logged" page. But it simply wont work, because the $action variable remains as zero after submitting the form, and the script just prints the page with the login form...
Is there anything wrong with what I show here?
Or should it work like that, and maybe I have a problem elsewhere...?
<?php
print_login(){...}
print_logged(){...}
if (empty ($action))
$action = 0;
swicth ($action)
{
case 0
print_login ();
break;
case 1
print_logged ();
break;
}
?>
where print_login() prints the login form, and print_logged() prints a "logged as username" instead. the login form that's printed is defined as this:
...
<form method="post" action="?action=1">
...
so that when the user submits the form, $action is equal to 1 and the script prints the corresponding "logged" page. But it simply wont work, because the $action variable remains as zero after submitting the form, and the script just prints the page with the login form...
Is there anything wrong with what I show here?
Or should it work like that, and maybe I have a problem elsewhere...?