![]() |
Login Script
Can anybody point me in the direction of a tutorial that shows you how to make a good, secure login script? All the ones I seem to find have people commenting that they are insecure for one reason or another so I would like to see how to do it properly :)
|
I have a lot of experience with PHP/MySQL logins. I'll try to write a tutorial for you later.
|
That would be great, thanks a lot :D
|
I'd be tempted to construct my login SQL like so:
Code:
$szUsername = 'Wildhoney'; |
Surely that way is less secure than the usual SQL statement as you'll be transmitting the password as clear text, whereas usually you'd md5 it in PHP and send it encrypted.
You're also repeating $szUsername in your sprintf arguments, tut tut :P Seriously though, I don't understand how that method is more secure than the standard approach (assuming you filter and escape data correctly, of course)? Just seems like more work for the same outcome. |
lol see what I mean :p
I just want a nice tutorial I can use that will show me how to do a secure login with no problems :D lol. |
Anybody lol? :D
|
If you wanted to be really secure then you'd MD5 the password before you sent it to the server using Javascript. Apologies for confusing you JMZ, but I think Daz said he was writing you a little guide :) !
|
Hi Jmz, as a general rule, for a secure application you should always filter input and escape output (you'll hear that tip again and again). Basically, that means that if you're expecting a string from a form, ensure the data you get really is a string. If you're outputting data to a database, make sure you escape it first using mysql_escape_string(). Following these two rules will make your application a lot more secure.
So let's say that you are expecting szUsername and szPassword from $_POST, you could filter these using the built in filter functions: PHP Code:
PHP Code:
|
Hi Jmz,
Unfortunately I couldn't write a tutorial but you can try this script: http://www.talkphp.com/showthread.php?p=3536 |
Quote:
But anyways, does the fieldname have to the same as the ones used in the array $aFilterOptions ?? So if you have PHP Code:
HTML Code:
<form action="ble.php" method="POST"> |
| All times are GMT. The time now is 12:41 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0