Fout in PHP

Gestart doorRubenmaxie8 reacties36 weergaven

9 berichten · pagina 1 van 1

Rubenmaxie

Lid · Topicstarter

Berichten
592
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Heey,

Er zit weer een fout in me membersyteem... frown
Ik krijg iedere keer als ik wil aanmelden de volgende melding:
"De wachtwoorden moeten hetzelfde zijn.".

Wie weet hoe ik dit kan oplossen, of wat ik fout doe?

De code:

[COLOR= #0000BB]<?php
$dbhost[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"localhost"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$dbuser[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"Ruben0_data"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$dbpass[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$database[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"Ruben0_data"[/COLOR][COLOR= #007700];[/COLOR]

[URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$dbhost[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$dbuser[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$dbpass[/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/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$database[/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]

[COLOR= #0000BB]$user[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]user[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pass[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$email[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]);[/COLOR]

[URL="http://www.php.net/if"]if[/URL][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]""[/COLOR][COLOR= #007700])
{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je moet alle velden invullen."[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700];
}[/COLOR]

[COLOR= #0000BB]$que[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT * FROM members WHERE email = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$res[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$que[/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/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$res[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])
{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je emailadres bestaat al."[/COLOR][COLOR= #007700];
}[/COLOR]

[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700]!=[/COLOR] [COLOR= #0000BB]$hpass[/COLOR][COLOR= #007700])
{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"De wachtwoorden moeten hetzelfde zijn."[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700];
}[/COLOR]

[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$pass[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]5[/COLOR][COLOR= #007700])
{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Uw wachtwoord moet op zijn minst 5 tekens lang zijn."[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700];
}[/COLOR]

    [COLOR= #0000BB]$que[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"INSERT INTO members(user, pass, email) 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]")"[/COLOR][COLOR= #007700];[/COLOR]
    [COLOR= #0000BB]$res[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$que[/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]
    
    [COLOR= #0000BB]$onderwerp[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"Klikfestijn, succesvol aangemeld"[/COLOR][COLOR= #007700];[/COLOR]    
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"U bent succesvol aangemeld."[/COLOR][COLOR= #007700];[/COLOR]
    
    [URL="http://www.php.net/mail"]mail[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$onderwerp[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    
    [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"registered.php"[/COLOR][COLOR= #007700]);[/COLOR]
?>
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
$hpass decladeer je nergens?
0
Rubenmaxie

Lid · Topicstarter

Berichten
592
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Oh, thnx alweer, hé! wink
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
en dit:

if($user == "" || $pass == "" || $email == "")


kan ook zo:

if((empty($user)) || (empty($pass)) || (empty($email))
0
Tim

Lid

Berichten
712
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
@Pchooligan:

Doe het dan wel goed

if(empty($user) || empty($pass) || empty($email))
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
What`s the difference wat betreft werking van het script?

Ik ben gewend om het op mijn manier te doen en die werkt ook
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
empty() geeft ook true terug als hij 0 is he, dat wil je niet altijd als je controleert offie leeg is of niet.
0
Berichten
6.201
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Doe dan:

[COLOR= #0000BB]<?[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/trim"]trim[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$user[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #DD0000]""[/COLOR] [COLOR= #007700]||[/COLOR] [URL="http://www.php.net/trim"]trim[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$pass[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #DD0000]""[/COLOR] [COLOR= #007700]||[/COLOR] [URL="http://www.php.net/trim"]trim[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700])
{[/COLOR]

     [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je hebt niet alles ingevuld ofzeau"[/COLOR][COLOR= #007700];

}[/COLOR]
?>


dan kan je ook geen spatie meer invullen..
0
Rubenmaxie

Lid · Topicstarter

Berichten
592
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
@Kjeld, misschien dat dat wel van pas kan komen. smile
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