Jump to content

Recommended Posts

Posted

hello mates today i will be teaching you how to make simple login system with php

ok lets start with login.php

 

code :

 

<?php

$username = $_POST['user'];
$password = $_POST['pass'];

if ($username == "Admin" && $password == "l33t")
{
header( 'Location: http://www.yoursite.com/Admin.html' ) ;
}
else
{
echo "wrong password or username";
}
?>

 

so now when you are going to login it will redirect you to a page in your site called admin.html or any other page you want all you have to do is change admin.html with the page name..

note :

the page must be uploaded in the same directory of the login.php file...

 

login.html code :

 

<html>
<head>
<title>Login Page!!</title>
</head>
<body>
<form action="login.php" method="POST">
Username: <input type="text" name="user"><br>
password: <input type="password" name="pass">
<input type="submit" value="Login">
</form>
</body>
</html>

 

now you can make any other page so when you login it will redirect you to i will just make simple one using codes from my previous html tutorials..

 

<html>
<head>
<title>admin page.</title>
<body>
</body>
</head>
</html>

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...