Be a Supporter!

Php: Simple Password Protection

  • 720 Views
  • 12 Replies
New Topic Respond to this Topic
keifer121
keifer121
  • Member since: Aug. 31, 2005
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Php: Simple Password Protection 2006-11-11 06:26:43 Reply

Hi, i made a simple and easy to use password protection script,
it should be very easy to use and understand, theres 4 code blocks, the begining is set with the password and displays the form to enter the password, if the password is right it goes to the 2nd code block witch is your script or page or anything and the third code block is where the wrong password has been enterd displayed the 4th just ends the else statments and the other if statment.

The Code

<?
$rpassword = ""; //supply the real password here
if (!$_POST['password']){
?>
<form name="password protectioin" method="post" >
<div align="center">
<table width="228" border="1">
<tr>
<td>Password?:</td>
<td><input name="password" type="password" id="password" value="password"></td>
</tr>
</table>
<input type="submit" name="Submit" value="Submit">
</div>
</form>
<? }
if ($_POST['password']){
$password = $_POST['password'];
if($password==$rpassword){ ?>
Passwords Are Right
<? }
else{ ?>
Passwords are not right
<? }} ?>

NinoGrounds
NinoGrounds
  • Member since: Nov. 28, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to Php: Simple Password Protection 2006-11-11 06:44:01 Reply

Hey, dude, you could at least note encryptions. At least about md5 and sha1. Then about CRC32.

Then how to combine md5() and sha1().

Then about Mcrypt:
http://hr.php.net/manual/en/ref.mcrypt.php

and etc

Jordan
Jordan
  • Member since: Apr. 23, 2006
  • Offline.
Forum Stats
Member
Level 14
Blank Slate
Response to Php: Simple Password Protection 2006-11-11 08:04:41 Reply

At 11/11/06 06:44 AM, NinoGrounds wrote: Hey, dude, you could at least note encryptions. At least about md5 and sha1. Then about CRC32.

I wouldn't think that encryption would be needed in this case, unless other people had access to the .php file.

seel
seel
  • Member since: Jun. 27, 2005
  • Offline.
Forum Stats
Member
Level 21
Musician
Response to Php: Simple Password Protection 2006-11-11 08:32:06 Reply

At 11/11/06 08:04 AM, Jordan wrote:
At 11/11/06 06:44 AM, NinoGrounds wrote: Hey, dude, you could at least note encryptions. At least about md5 and sha1. Then about CRC32.
I wouldn't think that encryption would be needed in this case, unless other people had access to the .php file.

You have alot to learn young grasshopper.. :)

NinoGrounds
NinoGrounds
  • Member since: Nov. 28, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to Php: Simple Password Protection 2006-11-11 11:29:44 Reply

At 11/11/06 08:04 AM, Jordan wrote: I wouldn't think that encryption would be needed in this case, unless other people had access to the .php file.

What do you mean ...?

Storm
Storm
  • Member since: May. 19, 2006
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
Response to Php: Simple Password Protection 2006-11-11 11:42:20 Reply

At 11/11/06 06:44 AM, NinoGrounds wrote: Hey, dude, you could at least note encryptions. At least about md5 and sha1. Then about CRC32.

Not really, since this is 'simple password protection'.

Jordan
Jordan
  • Member since: Apr. 23, 2006
  • Offline.
Forum Stats
Member
Level 14
Blank Slate
Response to Php: Simple Password Protection 2006-11-11 12:17:20 Reply

At 11/11/06 11:29 AM, NinoGrounds wrote: What do you mean ...?

I mean that you don't need encryption for something this basic, and the reason you might want encryption is if other people have access to read the .php files.

seel
seel
  • Member since: Jun. 27, 2005
  • Offline.
Forum Stats
Member
Level 21
Musician
Response to Php: Simple Password Protection 2006-11-12 12:46:23 Reply

At 11/11/06 12:17 PM, Jordan wrote:
At 11/11/06 11:29 AM, NinoGrounds wrote: What do you mean ...?
I mean that you don't need encryption for something this basic, and the reason you might want encryption is if other people have access to read the .php files.

Lmao so you don't think newbs need to learn about encryption then?? Since they usualy start with stuff like this they should learn about encryptions and hashing so they don't make communities like newgrounds without encrypting passwords and stuff...

DannyIsOnFire
DannyIsOnFire
  • Member since: Apr. 14, 2005
  • Offline.
Forum Stats
Member
Level 21
Movie Buff
Response to Php: Simple Password Protection 2006-11-12 12:57:18 Reply

At 11/12/06 12:46 PM, seel wrote: Lmao so you don't think newbs need to learn about encryption then?? Since they usualy start with stuff like this they should learn about encryptions and hashing so they don't make communities like newgrounds without encrypting passwords and stuff...

I doubt they will create communities like newgrounds and not know how to encrypt.


|| Portfolio || Facebook || Twitter ||

BBS Signature
seel
seel
  • Member since: Jun. 27, 2005
  • Offline.
Forum Stats
Member
Level 21
Musician
Response to Php: Simple Password Protection 2006-11-12 13:01:24 Reply

At 11/12/06 12:57 PM, DannyIsOnFire wrote:
At 11/12/06 12:46 PM, seel wrote: Lmao so you don't think newbs need to learn about encryption then?? Since they usualy start with stuff like this they should learn about encryptions and hashing so they don't make communities like newgrounds without encrypting passwords and stuff...
I doubt they will create communities like newgrounds and not know how to encrypt.

No but it was a bizzare example, shizbitz. If you go to HTS alot you should know what i'm talking about..

Yes there are acctualy ppl who make security flaws like some of them there.
Jordan
Jordan
  • Member since: Apr. 23, 2006
  • Offline.
Forum Stats
Member
Level 14
Blank Slate
Response to Php: Simple Password Protection 2006-11-12 13:50:54 Reply

At 11/12/06 12:46 PM, seel wrote: Lmao so you don't think newbs need to learn about encryption then?? Since they usualy start with stuff like this they should learn about encryptions and hashing so they don't make communities like newgrounds without encrypting passwords and stuff...

Newgrounds don't encrypt passwords. Copy this into your address bar to see your password, unencrypted:
javascript:alert(document.cookie)

Or if you can't see it on there:
javascript:document.write(document.cookie)

Although i do recomend encryption, i use it...

authorblues
authorblues
  • Member since: Jun. 21, 2005
  • Offline.
Forum Stats
Member
Level 12
Blank Slate
Response to Php: Simple Password Protection 2006-11-12 14:13:02 Reply

At 11/11/06 06:44 AM, NinoGrounds wrote: Hey, dude, you could at least note encryptions. At least about md5 and sha1. Then about CRC32.

this is about the 100th time youve called CRC32 an encryption. md5 and sha1 are hashes (note: not encryptions), and crc32 is a CHECKSUM...


BBS Signature
NinoGrounds
NinoGrounds
  • Member since: Nov. 28, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to Php: Simple Password Protection 2006-11-13 14:22:02 Reply

At 11/12/06 01:50 PM, Jordan wrote: Although i do recomend encryption, i use it...

Me too. I combine md5 and sha1

At 11/12/06 02:13 PM, authorblues wrote: this is about the 100th time youve called CRC32 an encryption. md5 and sha1 are hashes (note: not encryptions), and crc32 is a CHECKSUM...

Yes, I know, my bad.