Jump to content

login script using php..no need database...


Recommended Posts

It is not safe.

I am not gonna make the script as its unsafe, i 1ce hd such a script.
Ill just give the script to u, wait

EDIT:
Here
I consider that you already have a directory login setup
and your domain is http://localhost
so your login pages are at http://localhost/login/
now
1. Create a directory users in the login directory.

2. Here is your register script

[b]Register.html[/b]
[code]
<html>
<head><title>Register</title></head>
<body>
<b>Register</b>
<br>
<form action="Register.php" method="post">
Username: <input type="text" name="un"><br>
Password: <input type="password" name="ps"><br>
Re-type Password: <input type="password" name="rps"><br>
<input type="submit" value="Register"><br>
</form>
</body>
</html>
[/code]

3. Here is register page
[b]Register.php[/b]
[code]
<html><head><title>Register</title></head>
<?php
$un=$_POST['un'];
$ps=$_POST['ps'];
$rps=$_POST['rps'];
if($ps==$rps)
{
echo("<font color=blue>Password matched! </font> you may continue!<br>");
if(file_exists("users/kaddu".$un."ismypass.bmp"))
{
echo("<font color=red>Sorry but the username already exits</font>");
exit();
}
else
{
$ps = sha1(md5($ps));
}
echo("<font color=blue>Adding your username and password to database</font>");
$users = "users/kaddu".$un."ismypass.bmp";
$ousers = fopen( $users, "a+" );
fwrite( $ousers, $ps );
fclose( $ousers );
}
}
else
{
echo("<font color=red>Password does not match </font> Please return and retype the password correctly!");
exit();
}
?>
</html>
[/code]

4. Now lets create a login script.
[b]Login.html[/b]
[code]
<html>
<head><title>Login</title></head>
<body>
<b>Login</b>
<br>
<form action="Login.php" method="post">
Username: <input type="text" name="un"><br>
Password: <input type="password" name="ps"><br>
<input type="submit" value="Login"><br>
</form>
</body>
[/code]

5. To login we need login.php
[b]Login.php[/b]
[code]
<html><head><title>Login</title></head>
<?php
$un=$_POST['un'];
$ps=$_POST['ps'];
if(file_exists("users/kaddu".$un."ismypass.bmp"))
{
$ps = sha1(md5($ps));
$users = "users/kaddu".$un."ismypass.bmp";
$ousers = fopen( $users, "a+" );
$size = filesize($users);
$ps2=fread( $ousers, $size );
fclose( $ousers );
if($ps==$ps2)
{
echo("You are now logged in");
}
else
{
echo("<font color=red>Wrong Password!</font>");
}
}
else
{
echo("<font color=red>Wrong Username!</font>");
}
?>
</html>
[/code]

Its not safe and you would have to code a lot even after you have done this to check weather someone is logged in or not, best thing to do is to use cookies after this
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.