bytes Posted March 9, 2010 Share Posted March 9, 2010 I completed my login script consist of two php. Index.php <html> <body> <form id="form1" name="form1" method="post" action="login.php"> <div align="center"> <p>Username : <input type="text" name="username" /> </p> <p>Password : <input type="text" name="password" /> </p> <p> <input name="Submit" type="submit" id="Submit" value="Login" /> </p> </div> </form> </body> </html> Login.php <?php $user = "admin"; $pass = "admin"; if ($_POST['username'] == $user and $_POST['password'] == $pass) { echo 'Successfully login.'; } else { echo 'Invalid username/password.'; } ?> I want to make a login script that use session and after I login it will shows me the control panel. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/194637-making-a-login-script-with-a-session/ Share on other sites More sharing options...
aeroswat Posted March 9, 2010 Share Posted March 9, 2010 I completed my login script consist of two php. Index.php <html> <body> <form id="form1" name="form1" method="post" action="login.php"> <div align="center"> <p>Username : <input type="text" name="username" /> </p> <p>Password : <input type="text" name="password" /> </p> <p> <input name="Submit" type="submit" id="Submit" value="Login" /> </p> </div> </form> </body> </html> Login.php <?php $user = "admin"; $pass = "admin"; if ($_POST['username'] == $user and $_POST['password'] == $pass) { echo 'Successfully login.'; } else { echo 'Invalid username/password.'; } ?> I want to make a login script that use session and after I login it will shows me the control panel. Thanks There are many of these pre-made scripts out there. I would advise using one of those instead of re-inventing the wheel unless your circumstances necessitate doing something different. Basically you will need a database to hold a username and password. You will want a way to encode the password. You can look into the md5 function for this. You will also need to learn how to use sessions. Or you can do a simple google search for php login script and find one you like Quote Link to comment https://forums.phpfreaks.com/topic/194637-making-a-login-script-with-a-session/#findComment-1023657 Share on other sites More sharing options...
PFMaBiSmAd Posted March 9, 2010 Share Posted March 9, 2010 Someone just posted a basic log in script using a session - http://www.phpfreaks.com/forums/index.php/topic,290377.msg1376236.html#msg1376236 Quote Link to comment https://forums.phpfreaks.com/topic/194637-making-a-login-script-with-a-session/#findComment-1023666 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.