Inlogsysteem

Gestart doorJoeri41 reacties69 weergaven

42 berichten · pagina 2 van 3

Joeri

Lid · Topicstarter

Berichten
5.737
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ja.
Hoezo kan jij in de test database redfaceMaar ik zal wel een andere naam zetten smile
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Iedereen kan in de test database
0
Joeri

Lid · Topicstarter

Berichten
5.737
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Oh ok. dat wist ik dus niet.
Maar ik heb een nieuwe database en daarin gezet
Maar heb nu nog een probleempje.
Ik heb dus een error als je iets niet ingevuld hebt maar dan komt het nog steeds in de database.
alleen lijkt het van niet.

Dit is het registreer script op dit moment

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]connection.php[/COLOR][COLOR= #007700];[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]POST[/COLOR][COLOR= #007700])
{[/COLOR]
    [COLOR= #0000BB]$user[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]];[/COLOR]
    [COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pass[/COLOR][COLOR= #007700]];[/COLOR] 
    [COLOR= #0000BB]$email[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]];[/COLOR]
    [COLOR= #FF8000]// het formulier IS ingevuld[/COLOR]
    [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"
    INSERT INTO
        users
            (
                username,
                password,
                email,
                enabled,
                lastlogin
            )
    VALUES
        (
            "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$user[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]",
            "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]",
            "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$email[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]",
            1,
            NOW()
        )
    "[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]




[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]])) {[/COLOR] 
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je hebt geen inlognaam ingevuld, <a href=""[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]PHP_SELF[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"?actie=registreren">Probeer nogmaals</a>."[/COLOR][COLOR= #007700]; 
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pass[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je hebt geen wachtwoord ingevuld, <a href=""[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]PHP_SELF[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"?actie=registreren">Probeer nogmaals</a>."[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je hebt geen (geldig) e-mail adres ingevuld, <a href=""[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]PHP_SELF[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"?actie=registreren">Probeer nogmaals</a>."[/COLOR][COLOR= #007700]; 



 
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[COLOR= #FF8000]// als alle velden zijn ingevuld [/COLOR]
[COLOR= #007700]}[/COLOR]

[URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR] [COLOR= #DD0000] [/COLOR] [COLOR= #007700]);

}[/COLOR]


    ?>

Welkom op de registratie-pagina.<br/>
Hier kunt u zich registreren. <br /><br />

<form action="#" method="post">
    Naam: <input name="name" maxlength="30" type="text" /><br />
    Wachtwoord: <input type="password" name="pass" maxlength="16" /><br />
    Email: <input type="text" maxlength="50" name="email" />
    <br/><br/><input type="submit" value="Registreer!" />
</form>


Ik wil dus dat hij niet alleen een error geeft maar ok daadwerkelijk de aanmelding blokkeert.
Ik heb geen idee hoe het moet en al een paar scripts doorgezocht maar nergens iets kunnen vinden

ennuh lol @ mensen die als piet oid aanmelden
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Wat is je code?
0
Joeri

Lid · Topicstarter

Berichten
5.737
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Luukvdo schreef:
Wat is je code?
Lees me edit wink was al aan het typen biggrin
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]connection.php[/COLOR][COLOR= #007700];[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]POST[/COLOR][COLOR= #007700])
{[/COLOR]
    [COLOR= #0000BB]$user[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]];[/COLOR]
    [COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pass[/COLOR][COLOR= #007700]];[/COLOR] 
    [COLOR= #0000BB]$email[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]];[/COLOR]
    [COLOR= #FF8000]// het formulier IS ingevuld[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]]))
    {[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je hebt geen inlognaam ingevuld, <a href=""[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]PHP_SELF[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"?actie=registreren">Probeer nogmaals</a>."[/COLOR][COLOR= #007700]; 
    }[/COLOR]
    [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pass[/COLOR][COLOR= #007700]]))
    {[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je hebt geen wachtwoord ingevuld, <a href=""[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]PHP_SELF[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"?actie=registreren">Probeer nogmaals</a>."[/COLOR][COLOR= #007700];
    }[/COLOR]
    [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]))
    {[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je hebt geen (geldig) e-mail adres ingevuld, <a href=""[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]PHP_SELF[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"?actie=registreren">Probeer nogmaals</a>."[/COLOR][COLOR= #007700]; 
    }[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #007700]{[/COLOR]
        [COLOR= #FF8000]// als alle velden zijn ingevuld [/COLOR]
        [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"
        INSERT INTO
            users
                (
                    username,
                    password,
                    email,
                    enabled,
                    lastlogin
                )
        VALUES
            (
                "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$user[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]",
                "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]",
                "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$email[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]",
                1,
                NOW()
            )
        "[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
        [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]Je bent succesvol geregistreerd =D[/COLOR][COLOR= #007700]);
    }
}[/COLOR]


    ?>

Welkom op de registratie-pagina.<br/>
Hier kunt u zich registreren. <br /><br />

<form action="#" method="post">
    Naam: <input name="name" maxlength="30" type="text" /><br />
    Wachtwoord: <input type="password" name="pass" maxlength="16" /><br />
    Email: <input type="text" maxlength="50" name="email" />
    <br/><br/><input type="submit" value="Registreer!" />
</form>
0
Joeri

Lid · Topicstarter

Berichten
5.737
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Bedankt het werkt winkMaar om even een vraagje te hebben om er zelf nog slimmer van te worden ook
eigenlijk moeset ik dus dat andere bovenaan zetten?
Maarja het werkt nu weer ik update me post wel als weer iets niet klopt smileOhja

Bedankt biggrin
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ja, dat moest inderdaad.

Is goed wink
0
Joeri

Lid · Topicstarter

Berichten
5.737
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nou het is weer zover biggrinIk heb nu dus registreer.php even laten liggen hier werk ik later nog aan verder maar eerst login.php omdat ik ook wil dat je in kan loggen

Nu het probleem
Na login.php aangepast te hebben naar me eigen wensen (vantevoren werkte het al helemaal niet) heb ik dit

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR] [COLOR= #DD0000]connection.php[/COLOR] [COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR] [COLOR= #DD0000]action[/COLOR][COLOR= #007700]]) && ([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]action[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]"login"[/COLOR][COLOR= #007700])){[/COLOR]


  [COLOR= #FF8000]// het formulier IS ingevuld[/COLOR]
  [COLOR= #0000BB]$name[/COLOR]  [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR] [COLOR= #DD0000]name[/COLOR] [COLOR= #007700]];[/COLOR]
  [COLOR= #0000BB]$pass[/COLOR]   [COLOR= #007700]=[/COLOR]  [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR] [COLOR= #DD0000]pass[/COLOR][COLOR= #007700]];[/COLOR]

  [COLOR= #0000BB]$QUERY[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT * FROM users WHERE name = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$name[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]" AND pass = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]" AND enable = 1"[/COLOR][COLOR= #007700];[/COLOR]
  [COLOR= #0000BB]$EXEC[/COLOR] [COLOR= #007700]=[/COLOR] mysqli_query[COLOR= #007700]([/COLOR] [COLOR= #0000BB]$QUERY[/COLOR] [COLOR= #007700]);[/COLOR]
  
  [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR]mysqli_num_rows[COLOR= #007700]() <[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]){[/COLOR]

      [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR] [COLOR= #DD0000]Login niet geldig![/COLOR] [COLOR= #007700]);

   }[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]

      [COLOR= #FF8000]// login is geldig[/COLOR]
      [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$name[/COLOR][COLOR= #007700];[/COLOR]
      [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pass[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$pass[/COLOR][COLOR= #007700];
     
  }

}[/COLOR]

?> 


<form name="form1" action="login.php?action=login" method="post"> 
Naam: <br/><input type="text" name="name" maxlength="30"> <br/> 
Wachtwoord: <br/><input type="password" name="pass" maxlength="16"> <br/>
<input type="submit" value="Login!"> <br/>
</form> <br/>
  <a href="./includes/registreren.php" title="Registreer!">Nog niet aangemeld? Registreer hier!</a>


Maar als je dus op login klikt wil ik eigenlijk dat je naar ingelogd.php word doorverwezen.

Iemand een idee?

Joeri
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]connection.php[/COLOR][COLOR= #007700];[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]action[/COLOR][COLOR= #007700]]) && ([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]action[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]login[/COLOR][COLOR= #007700]))
{[/COLOR]
    [COLOR= #FF8000]// het formulier IS ingevuld[/COLOR]
    [COLOR= #0000BB]$name[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]];[/COLOR]
    [COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pass[/COLOR][COLOR= #007700]];[/COLOR]
    
    [COLOR= #0000BB]$QUERY[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT * FROM users WHERE name = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$name[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]" AND pass = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]" AND enable = 1"[/COLOR][COLOR= #007700];[/COLOR]
    [COLOR= #0000BB]$EXEC[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR] [COLOR= #0000BB]$QUERY[/COLOR] [COLOR= #007700]);[/COLOR]
  
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$EXEC[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])
    {[/COLOR]
        [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]Login niet geldig![/COLOR][COLOR= #007700]);
    }[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #007700]{[/COLOR]
        [COLOR= #FF8000]// login is geldig[/COLOR]
        [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$name[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pass[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$pass[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]Location: ingelogd.php[/COLOR][COLOR= #007700]);
    }
}[/COLOR]
?> 


<form name="form1" action="login.php?action=login" method="post"> 
Naam: <br/><input type="text" name="name" maxlength="30"> <br/> 
Wachtwoord: <br/><input type="password" name="pass" maxlength="16"> <br/>
<input type="submit" value="Login!"> <br/>
</form> <br/>
  <a href="./includes/registreren.php" title="Registreer!">Nog niet aangemeld? Registreer hier!</a>
0
Joeri

Lid · Topicstarter

Berichten
5.737
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nee, ook dit werkt niet..
Ik ben al wel erachter waar de fout zit.

<form name="form1" action="login.php?action=login" method="post"> 
Naam: <br/><input type="text" name="name" maxlength="30"> <br/> 
Wachtwoord: <br/><input type="password" name="pass" maxlength="16"> <br/>
<input type="submit" value="Login!"> <br/>
</form> <br/>
  <a href="./includes/registreren.php" title="Registreer!">Nog niet aangemeld? Registreer hier!</a>


Action = login.php?action=login.
Ik heb dit veranderd in een andere pagina maar daarop blijkt dat ik niet ingelogd ben omdat je de onderste tekst alleen ziet (als het goed is) als je ingelogd bent.
Ik druk op de knop en krijg te zien :

U bent niet ingelogd

Mischien ligt de fout aan het script op deze pagina :

[COLOR= #0000BB]<?php[/COLOR]



[URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]user[/COLOR][COLOR= #007700]]))[/COLOR] [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR] [COLOR= #DD0000]U bent niet ingelogd![/COLOR] [COLOR= #007700]);[/COLOR]

[COLOR= #0000BB]$user[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]user[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pass[/COLOR][COLOR= #007700]];[/COLOR]


[COLOR= #0000BB]$QUERY[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT username, password FROM users WHERE username = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$user[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]" AND password = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #0000BB]$EXEC[/COLOR] [COLOR= #007700]=[/COLOR] mysqli_query[COLOR= #007700]([/COLOR] [COLOR= #0000BB]$QUERY[/COLOR] [COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR]mysqli_num_rows[COLOR= #007700]() <[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]){[/COLOR]
   
    [URL="http://www.php.net/unset"]unset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pass[/COLOR][COLOR= #007700]]);[/COLOR]
   [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR] [COLOR= #DD0000]U bent niet ingelogd![/COLOR][COLOR= #007700]);
}[/COLOR]

?> 

Ben je ingelogd?


Of dat hij toch niet inlogd.
Iemand enig idee?

Update.
Naar wat testen en kijken in de database blijkt dat hij gewoon helemaal niet inlogd. dan ligt het fout dus toch bij het script van inloggen..
Hier nogmaals het script

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]connection.php[/COLOR][COLOR= #007700];[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]action[/COLOR][COLOR= #007700]]) && ([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]action[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]login[/COLOR][COLOR= #007700]))
{[/COLOR]
    [COLOR= #FF8000]// het formulier IS ingevuld[/COLOR]
    [COLOR= #0000BB]$name[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]];[/COLOR]
    [COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pass[/COLOR][COLOR= #007700]];[/COLOR]
    
    [COLOR= #0000BB]$QUERY[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT * FROM users WHERE name = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$name[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]" AND pass = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]" AND enable = 1"[/COLOR][COLOR= #007700];[/COLOR]
    [COLOR= #0000BB]$EXEC[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR] [COLOR= #0000BB]$QUERY[/COLOR] [COLOR= #007700]);[/COLOR]
  
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$EXEC[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])
    {[/COLOR]
        [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]Login niet geldig![/COLOR][COLOR= #007700]);
    }[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #007700]{[/COLOR]
        [COLOR= #FF8000]// login is geldig[/COLOR]
        [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$name[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pass[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$pass[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]Location: ingelogd.php[/COLOR][COLOR= #007700]);
    }
}[/COLOR]
?> 


<form name="form1" action="ingelogd.php" method="post"> 
Naam: <br/><input type="text" name="name" maxlength="30"> <br/> 
Wachtwoord: <br/><input type="password" name="pass" maxlength="16"> <br/>
<input type="submit" value="Login!"> <br/>
</form> <br/>
  <a href="./includes/registreren.php" title="Registreer!">Nog niet aangemeld? Registreer hier!</a>


Nogmaals : alvast bedankt smile
0
Berichten
10.409
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
je start volgensmij nergens een session
zet dit boven aan je pagina
dus word het

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR]
[COLOR= #FF8000]//
//
//
//rest van je code
//
//
//[/COLOR]
?>
0
Joeri

Lid · Topicstarter

Berichten
5.737
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nog steeds werkt het niet.
Ik heb het nu namelijk bovenaan in header.php gezet meteen onder de head tag (omdat dat het eerste stukje php heeft wat word geladen ergens)

Geen idee waar het aan kan liggen.

(als je een stukje script nodig hebt zeg het maar)
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Je moet het niet onder de head tag zetten, je moet het boven alle HTML zetten dus ook de HTML tag zelf
0
Joeri

Lid · Topicstarter

Berichten
5.737
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Gedaan nu.
het enige wat veranderd is dat de layout nu volledig rechts staat en inloggen werkt nog niet..
dit is me code :

<php session_start();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <meta name="Weblife.nl" content="Weblife" />
        <title>Weblife</title>
    <link href="style.css" rel="stylesheet" type="text/css"/>
</head>

<body>

<div id = "container">
             <div id = "header">
                <div id = "title">Weblife</div><div id = "slogan">Jou tweede leven</div>
            </div>
            
                    <div id= "menu">
                        <div id="navigatie">
                               [COLOR= #0000BB]<?php[/COLOR] 
  
 [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"menu.php"[/COLOR][COLOR= #007700]);[/COLOR]  ?>                         </div>    
                    </div>
                            <div id = "subheader"></div>

                                <div id = "main">
                                    <div id = "maintop">


Mischien ligt het aan me ingelogd.php daar staat dit in :

[COLOR= #0000BB]<?php[/COLOR]



[URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]user[/COLOR][COLOR= #007700]]))[/COLOR] [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR] [COLOR= #DD0000]U bent niet ingelogd![/COLOR] [COLOR= #007700]);[/COLOR]

[COLOR= #0000BB]$user[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]user[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pass[/COLOR][COLOR= #007700]];[/COLOR]


[COLOR= #0000BB]$QUERY[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT username, password FROM users WHERE username = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$user[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]" AND password = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #0000BB]$EXEC[/COLOR] [COLOR= #007700]=[/COLOR] mysqli_query[COLOR= #007700]([/COLOR] [COLOR= #0000BB]$QUERY[/COLOR] [COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR]mysqli_num_rows[COLOR= #007700]() <[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]){[/COLOR]
   
    [URL="http://www.php.net/unset"]unset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pass[/COLOR][COLOR= #007700]]);[/COLOR]
   [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR] [COLOR= #DD0000]U bent niet ingelogd![/COLOR][COLOR= #007700]);
}[/COLOR]

 [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"header.php"[/COLOR][COLOR= #007700]);[/COLOR] 
 ?>  


Ben je ingelogd?
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren