Support Forums
[PHP] Very Basic Login Page - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: PHP The Hypertext Preprocessor (https://www.supportforums.net/forumdisplay.php?fid=21)
+---- Thread: [PHP] Very Basic Login Page (/showthread.php?tid=23536)

Pages: 1 2


[PHP] Very Basic Login Page - BreShiE - 12-01-2011

[Image: YzwzC.png]

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


RE: [PHP] Very Basic Login Page - SuhinderG - 12-01-2011

Please tell me this doesn't store in a text file.


RE: [PHP] Very Basic Login Page - D3xus - 12-01-2011

Could you define the $user & $password within a separate file located off server, or encrypted?


RE: [PHP] Very Basic Login Page - Closed Account - 12-01-2011

Thats s nice script great work Smile


RE: [PHP] Very Basic Login Page - BreShiE - 12-02-2011

(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. Big Grin


RE: [PHP] Very Basic Login Page - D3xus - 12-02-2011

(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. Big Grin
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?


RE: [PHP] Very Basic Login Page - ★Cooldude★ - 12-02-2011

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


RE: [PHP] Very Basic Login Page - BreShiE - 12-03-2011

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.


RE: [PHP] Very Basic Login Page - D3xus - 12-03-2011

(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 Big Grin


RE: [PHP] Very Basic Login Page - ★Cooldude★ - 12-04-2011

(12-03-2011, 06:25 PM)D3xus Wrote: I might go with Code Eclipse; thanks for your help Big Grin

No problem, I personally use it for some of my projects.