Don't do this without checking for magic quotes. Otherwise I wouldn't be able to add \" as a part of my data.
PHP Code:
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
Replace it with:
PHP Code:
if (ini_get('magic_quotes_gpc'))
{
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
}
This has to occur before the $encrypted_mypassword is set.
MD5 isn't secure no. But if you have instructions to do so, then you follow the instructions. Session's are easy, just go to PHP.net and search for session_start. They will have examples on usage, the only pitfall is the use of header('location') where SID has to be manually applied as it won't include transparent session identifiers if you have it enabled and cookies are not available.