to give the link

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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 wrote:
Quoted text here. Click to load it


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

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 "<pre>";
echo "</pre>";

(Replace $_SESSION with $_POST or $_GET or $_COOKIE to print out those  
superglobals, also very handy when developing and debugging.)

Erwin Moller

Re: to give the link

On Sep 10, 11:32 am, wrote:
Quoted text here. Click to load it

the very simplest way to do this is to have one page with the form

<form method="post" action="protected.php">
<input type="text" name="username"/>
<input type="password" name="password"/>

$user = 'me';
$pass = 'hello_world';

if( $_POST['username']!=$user || $_POST['password']!=$pass )
 header( ' ' );
 //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....

Site Timeline