Help - Search - Members - Calendar
Full Version: Login System Without Registration Form
Zymic Webmaster Forums > Web Design & Development > Server Side Scripting > PHP
Loff
Hello all webmasters out there,


First of all, I'd like to say, I'm very new to this language. Therefore, I seek help here and hopefully someone can help me. What I'm looking for, is a login system without user registration. I'd tried to search (I probably suck at it), and I only find login scripts that has user registration. I want to have just a login form, which will lead to a panel where you can edit some of the content on the webside. It will only be for a few users which I will add manually myself. This might be a little too much for a fresh guy like me, but if anyone can lead me on track with some tutorials or/and finished scripts, I'd be very pleased.



Best regards,
Aleksander
SECRET
Well, this is the source of Login.html:

CODE
<html>
<head>
<title>Login</title>
</head>
<body>
<form method="POST" action="login.php">
<h1>Login</h1>
Name: <input type="text" name="name" size="20"><br>
Password: <input type="password" name="password" size="20"><br>
<input type="submit">
</form>
</body>
</html>


Login.php:
CODE

<?
if($name == "(name you want)" && $password == "(password you want)"){
setcookie("user",$name);
header("Location: Home.php?user=$name");
}(optional)elseif($name == "(name you want)" && $password == "(password you want)"){
setcookie("user",$name);
header("Location: Home.php?user=$name");
}else{
echo "Name or Password is wrong!";
}
?>


Home.php:
CODE

<?
if(!$user){
echo "Login First!";
}
else{
echo "login success!";
echo"Click <a href=\"Logout.php\">here</a> to logout";
}
?>


Logout.php:

CODE

<?php
setcookie("user", "", time()-3600);
?>


Sorry, I don't Guarantee 100% if this code is successful sad.gif

swordz
Just use a user system with registration, then remove the registration code...

swordz
uncled1023
I would have to agree with swordz. All the registration does is adds the user to the database. Take that page out, and your all set.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.