djnuller Posted October 11, 2011 Share Posted October 11, 2011 Hello everybody! I am trying to make a forum for my class and I will do it from scratch I am from Denmark so my english could be a little wrong! Sorry! The problem is when i try to login, I allways get the error that I had defined to do.. But only if both password and username dosn't exist... Before i post the code i will give you a translation: Brugernavn = Username kodeord = password brugerid = userid My register.php file works fine! But I will post them both: This is the register form: http://pastebin.com/h6fgHSFB And here are the code for my login.php, the strange thing is, that i do not get any kind of error dont even mysql errors, that i had hope on so i could fix it! http://pastebin.com/Vc8Gt9SY Hope you guys would like to help me! Best Regards Jesper Jensen from denmark jesper@dh-data.dk Quote Link to comment Share on other sites More sharing options...
MasterACE14 Posted October 12, 2011 Share Posted October 12, 2011 need to check whether the variables exist, rather than if they're equal to true or false. if($_SESSION['brugerid']) { // should be if(isset($_SESSION['brugerid'])) { if (!$_POST['submit']) { // should be if (!isset($_POST['submit'])) { $bruger = mss($_POST['brugernavn']); $kode = $_POST['kodeord']; if ($bruger && $kode) { // should be if (isset($bruger) && isset($kode)) { $bruger = mss($_POST['brugernavn']); $kode = $_POST['kodeord']; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.