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

jesper@dh-data.dk

Link to comment
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'];

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.