Jump to content

Can't login with my script


djnuller

Recommended Posts

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! :D

http://pastebin.com/Vc8Gt9SY

 

Hope you guys would like to help me!

 

Best Regards

 

Jesper Jensen from denmark

[email protected]

Link to comment
https://forums.phpfreaks.com/topic/248926-cant-login-with-my-script/
Share on other sites

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'];

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.