to give the link
am 10.09.2007 12:32:23 von blessonin
hai all,
I am very new to this php language.I want to create a
webpage with php ,in the first page there is two text boxes are there
one for username and other for password so when ever then user should
give the correct username and password,how should i give link to the
next page in php.plese help me..
Re: to give the link
am 10.09.2007 12:56:59 von Erwin Moller
blessonin@gmail.com wrote:
> hai all,
> I am very new to this php language.I want to create a
> webpage with php ,in the first page there is two text boxes are there
> one for username and other for password so when ever then user should
> give the correct username and password,how should i give link to the
> next page in php.plese help me..
>
Hi,
This is typically done with sessions.
So you should start with making sure you understand the working of sessions.
A good place to start is www.php.net:
http://nl3.php.net/manual/en/ref.session.php
Pay attention to session_start() and start with making a simple page
that only tries to read/write sessionvars and try to retrieve them on
another page.
Also, great for debugging:
echo "
";
print_r($_SESSION);
echo "
";
(Replace $_SESSION with $_POST or $_GET or $_COOKIE to print out those
superglobals, also very handy when developing and debugging.)
Regards,
Erwin Moller
Re: to give the link
am 10.09.2007 14:59:58 von shimmyshack
On Sep 10, 11:32 am, blesso...@gmail.com wrote:
> hai all,
> I am very new to this php language.I want to create a
> webpage with php ,in the first page there is two text boxes are there
> one for username and other for password so when ever then user should
> give the correct username and password,how should i give link to the
> next page in php.plese help me..
the very simplest way to do this is to have one page with the form
--http://server.com/login.html
--protected.php
$user = 'me';
$pass = 'hello_world';
if( $_POST['username']!=$user || $_POST['password']!=$pass )
{
header( 'http://server.com/login.html' );
exit();
}
else
{
//place your protected page here
}
?>
of course then you would go firther and do what Wewin suggests and use
sessions and pasword encryption and so on....