Fout in systeem - PHP

Gestart doorMextijs4 reacties20 weergaven

5 berichten · pagina 1 van 1

Mextijs

Lid · Topicstarter

Berichten
787
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hallo.

Ik was eventjes bezig met een admin paneeltje voor mijn toekomstige website.
Bij de pagina "admin toevoegen" stuitte ik op een probleem, als je alle velden invult en ook de wachtwoorden hetzelfde hebt, blijft hij zeggen "De wachtwoorden komen niet overeen.".

Ik kon het probleem zelf niet achterhalen.
Het kan het simpelste zijn waar ik altijd overheen kijk .. Maar ja.

Code staat hier onder.
Spoiler tonen
[COLOR= #0000BB]<?php[/COLOR]
 [URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR]

 [COLOR= #0000BB]$submit[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bevestig[/COLOR][COLOR= #007700]];[/COLOR]

 [COLOR= #0000BB]$gebruikersnaam[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strip_tags"]strip_tags[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]]);[/COLOR]

 [COLOR= #0000BB]$wachtwoord[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strip_tags"]strip_tags[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]]);[/COLOR]
 [COLOR= #0000BB]$wachtwoordherhalen[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strip_tags"]strip_tags[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoordherhalen[/COLOR][COLOR= #007700]]));[/COLOR]

 [COLOR= #0000BB]$email[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strip_tags"]strip_tags[/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]$submit[/COLOR][COLOR= #007700])
 {[/COLOR]
   [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruikersnaam[/COLOR][COLOR= #007700]&&[/COLOR][COLOR= #0000BB]$wachtwoord[/COLOR][COLOR= #007700]&&[/COLOR][COLOR= #0000BB]$wachtwoordherhalen[/COLOR][COLOR= #007700]&&[/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700])
       {[/COLOR]
        [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](([/COLOR][COLOR= #0000BB]$wachtwoord[/COLOR][COLOR= #007700])==([/COLOR][COLOR= #0000BB]$wachtwoordherhalen[/COLOR][COLOR= #007700]))
            {[/COLOR]
                   [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruikersnaam[/COLOR][COLOR= #007700])>[/COLOR][COLOR= #0000BB]20[/COLOR][COLOR= #007700]||[/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruikersnaam[/COLOR][COLOR= #007700])<[/COLOR][COLOR= #0000BB]6[/COLOR][COLOR= #007700])
                        {[/COLOR]
                   [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"De gebruikersnaam moet tussen de 6 en 20 karakters bevatten.<p />"[/COLOR][COLOR= #007700];
                        }[/COLOR]
                        [URL="http://www.php.net/else"]else[/URL]

                              [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Registratie succesvol.<p />"[/COLOR][COLOR= #007700];


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

             [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"De wachtwoorden komen niet overeen. <p />"[/COLOR][COLOR= #007700];

       }[/COLOR]

   
   [URL="http://www.php.net/else"]else[/URL]
       [COLOR= #007700]{[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Het invullen van alle velden is verplicht! <p />"[/COLOR][COLOR= #007700];
       }

  

 }[/COLOR]





 [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]])  {[/COLOR]

    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<b>Gebruiker toevoegen:</b><p />
    <form action=gebruiker_toevoegen.php method=post>
          <table>
          <tr>
          <td><b>Gebruikersnaam</b></td>
          <td><input type=text name=gebruikersnaam /></td>
          </tr>
          <tr>
          <td><b>Wachtwoord</b></td>
          <td><input type=password name=wachtwoord /></td>
          </tr>
          <tr>
          <td><b>Wachtwoord herhalen</b></td>
          <td><input type=password name=wachtwoordherhalen /></td>
          </tr>
          <tr>
          <td><b>Email adres</b></td>
          <td><input type=text name=email /></td>
          </tr>

          </table><p />
          <input type=submit name=bevestig value=Bevestigen />

    </form>
    "[/COLOR][COLOR= #007700];
 }[/COLOR]

 [URL="http://www.php.net/else"]else[/URL]
     [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"U moet inloggen om toegang tot deze pagina te krijgen."[/COLOR][COLOR= #007700]);[/COLOR]



?>
0
Berichten
3.788
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Van wachtwoordherhalen maak je al een md5, en van het gewone wachtwoord niet, pas dit aan en het werkt!

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

 [COLOR= #0000BB]$submit[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bevestig[/COLOR][COLOR= #007700]];[/COLOR]

 [COLOR= #0000BB]$gebruikersnaam[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strip_tags"]strip_tags[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]]);[/COLOR]

 [COLOR= #0000BB]$wachtwoord[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strip_tags"]strip_tags[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]]));[/COLOR]
 [COLOR= #0000BB]$wachtwoordherhalen[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strip_tags"]strip_tags[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoordherhalen[/COLOR][COLOR= #007700]]));[/COLOR]

 [COLOR= #0000BB]$email[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strip_tags"]strip_tags[/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]$submit[/COLOR][COLOR= #007700])
 {[/COLOR]
   [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruikersnaam[/COLOR][COLOR= #007700]&&[/COLOR][COLOR= #0000BB]$wachtwoord[/COLOR][COLOR= #007700]&&[/COLOR][COLOR= #0000BB]$wachtwoordherhalen[/COLOR][COLOR= #007700]&&[/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700])
       {[/COLOR]
        [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](([/COLOR][COLOR= #0000BB]$wachtwoord[/COLOR][COLOR= #007700])==([/COLOR][COLOR= #0000BB]$wachtwoordherhalen[/COLOR][COLOR= #007700]))
            {[/COLOR]
                   [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruikersnaam[/COLOR][COLOR= #007700])>[/COLOR][COLOR= #0000BB]20[/COLOR][COLOR= #007700]||[/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruikersnaam[/COLOR][COLOR= #007700])<[/COLOR][COLOR= #0000BB]6[/COLOR][COLOR= #007700])
                        {[/COLOR]
                   [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"De gebruikersnaam moet tussen de 6 en 20 karakters bevatten.<p />"[/COLOR][COLOR= #007700];
                        }[/COLOR]
                        [URL="http://www.php.net/else"]else[/URL]

                              [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Registratie succesvol.<p />"[/COLOR][COLOR= #007700];


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

             [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"De wachtwoorden komen niet overeen. <p />"[/COLOR][COLOR= #007700];

       }[/COLOR]

  
   [URL="http://www.php.net/else"]else[/URL]
       [COLOR= #007700]{[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Het invullen van alle velden is verplicht! <p />"[/COLOR][COLOR= #007700];
       }

  

 }[/COLOR]





 [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]])  {[/COLOR]

    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<b>Gebruiker toevoegen:</b><p />
    <form action=gebruiker_toevoegen.php method=post>
          <table>
          <tr>
          <td><b>Gebruikersnaam</b></td>
          <td><input type=text name=gebruikersnaam /></td>
          </tr>
          <tr>
          <td><b>Wachtwoord</b></td>
          <td><input type=password name=wachtwoord /></td>
          </tr>
          <tr>
          <td><b>Wachtwoord herhalen</b></td>
          <td><input type=password name=wachtwoordherhalen /></td>
          </tr>
          <tr>
          <td><b>Email adres</b></td>
          <td><input type=text name=email /></td>
          </tr>

          </table><p />
          <input type=submit name=bevestig value=Bevestigen />

    </form>
    "[/COLOR][COLOR= #007700];
 }[/COLOR]

 [URL="http://www.php.net/else"]else[/URL]
     [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"U moet inloggen om toegang tot deze pagina te krijgen."[/COLOR][COLOR= #007700]);[/COLOR]



?>
0
Mextijs

Lid · Topicstarter

Berichten
787
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Haha, zoals ik al had gezegd .. Het kan het simpelste zijn waar ik overheen kijk.
Bedankt Eleky! smile
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Misschien moet je in de if de isset() functie gebruiken
0
Mextijs

Lid · Topicstarter

Berichten
787
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Het was al opgelost ..
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