quecoder wrote:is it secure !? what about it's logic !? do I miss something that may cause me headaches at future ?
I suggest using session_start() only after the login is successful. You should avoid handing out valid session identifiers to non-users.
To avoid potential notices, I suggest that you change:
if(isset($_POST) && $_POST['submit'] == 'submit')
to:
if(isset($_POST['submit'], $_POST['username'], $_POST['password']) && $_POST['submit'] == 'submit')
After you have added a column for the salt as dagon suggested, select the hashed password and the salt where the username matches, rather than all (you may also want to add LIMIT 1 to the SQL statement). You would then compute the hashed password using the given password and the salt, and then compare the result with the hashed password retrieved.
For the hash function, you can use [man]sha1/man or one of those in the SHA-2 family of hash functions if the hash extension is available. The use of MD5 is okay, but SHA-1 is better and is also pretty much guaranteed to be available.
Also, after sending a location header, use [man]exit[/man]. Note that the URL of a location header should be an absolute URL, not a relative URL as you have used.
sohguanh wrote:Is it more secure to use Java Applet over the traditional HTML page tags ?
Having no experience with Java applets, I cannot provide an authoritative opinion. However, my guess is that it will provide you with a greater degree of control, and this can be used to make an exploit more difficult. Nonetheless, either way you can still end up with something secure, or insecure, as the case may be.
sohguanh wrote:Hmmm... care to share what your countries banking sites login page is using which technology ?
Same as yours :p