As the title says this is extremely simple, not secure and is just 5 minutes worth of code. Didn't take long at all, just thought I'd share it.
- Can't leave it blank
- Must enter right username and password
- Tweak it all you like.
PHP Code:
<html>
<head>
<title>Form</title>
</head>
<center>
<body>
<?php
/*
Snippit Made By BreShiE
SF Coders
*/
// Tells If The Button Is Pressed
If (isset($_POST["button"])){
//Username and Password variables
$user = "breshie";
$pass = "yourpass";
// Checks To See If The Text Boxes Are Empty
If ($_POST["text"] == "" || $_POST["pass"] == ""){
echo '<script>alert("Please enter something into the text boxes!")</script>';
}else{
// Checks to see if it's the right details or not
If ($_POST["text"] == $user && $_POST["pass"] == $pass){
echo 'Correct User!!';
}else{
echo 'Incorrect!';
}
}
}
?>
<form action="first.php" method="POST">
Username:
<br /><input type="text" name="text">
<br />
<br />
Password:
<br />
<input type="password" name="pass">
<br />
<input type="submit" name="button" value"Click Me">
</form>
</body>
</html>
http://xblforums.net/work
Please tell me this doesn't store in a text file.
Could you define the $user & $password within a separate file located off server, or encrypted?
Thats s nice script great work
(12-01-2011, 03:34 PM)D3xus Wrote: [ -> ]Could you define the $user & $password within a separate file located off server, or encrypted?
Yes, just simply put the code into a seperate file, then on the index, at the very top of the PHP code, type: "require('yourfilehere.php')" then it should work. Try it out.
(12-02-2011, 09:32 AM)BreShiE Wrote: [ -> ]Yes, just simply put the code into a seperate file, then on the index, at the very top of the PHP code, type: "require('yourfilehere.php')" then it should work. Try it out.
Sounds sweet.
But what if I wanted to encrypt the file in a MD5 or some other encryption method, but still let it be readable by my site?
(12-02-2011, 10:09 AM)D3xus Wrote: [ -> ]Sounds sweet.
But what if I wanted to encrypt the file in a MD5 or some other encryption method, but still let it be readable by my site?
I would take a look at
Code Eclipse.
@Breshie, I know that this is basic, but you should at least use MD5.
This isn't intended for someone to actually use it as a login script, actually I insist that you don't. It's just there for an example of a page, not actually meant to do anything.
(12-03-2011, 10:53 AM)BreShiE Wrote: [ -> ]This isn't intended for someone to actually use it as a login script, actually I insist that you don't. It's just there for an example of a page, not actually meant to do anything.
I might go with Code Eclipse; thanks for your help
(12-03-2011, 06:25 PM)D3xus Wrote: [ -> ]I might go with Code Eclipse; thanks for your help
No problem, I personally use it for some of my projects.