Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PHP] Very Basic Login Page
#1
[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
Reply
#2
Please tell me this doesn't store in a text file.
Reply
#3
Could you define the $user & $password within a separate file located off server, or encrypted?
[Image: QRCjW2pNdRK00.gif]
#Korra2018
Reply
#4
Thats s nice script great work Smile
Reply
#5
(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
Reply
#6
(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?
[Image: QRCjW2pNdRK00.gif]
#Korra2018
Reply
#7
(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.
[Image: cooldude.png]

(09-05-2011, 08:36 AM)Orgy Wrote: If you understand what you're doing, you aren't learning anything. ;)
Reply
#8
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.
Reply
#9
(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
[Image: QRCjW2pNdRK00.gif]
#Korra2018
Reply
#10
(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.
[Image: cooldude.png]

(09-05-2011, 08:36 AM)Orgy Wrote: If you understand what you're doing, you aren't learning anything. ;)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  PHP Framework List: An Ultimate Guide to 102 PHP Frameworks for Web Developers tk-hassan 0 773 07-27-2020, 11:26 PM
Last Post: tk-hassan
  [help] Improve login script Montana" 1 1,528 03-18-2013, 12:59 PM
Last Post: Haxalot
  Don't need to login Strafeness 5 1,777 01-21-2012, 08:28 AM
Last Post: AceInfinity
  PHP Video Tutorials (PHP For Beginners) Eleqtriq 4 3,262 10-10-2011, 01:00 PM
Last Post: Greyersting
  PHP error on page submit kaosjon 7 2,101 09-18-2011, 03:31 AM
Last Post: AceInfinity

Forum Jump:


Users browsing this thread: 1 Guest(s)