PHP hulp gevraagd

Gestart doorJosnl10 reacties40 weergaven

11 berichten · pagina 1 van 1

Josnl

Lid · Topicstarter

Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Heey o2xs!biggrin
Ik zit met een klein probleempje met mn loginsysteem, hij werkt namelijk niet meer...

[COLOR= #0000BB]<?php[/COLOR]     
        [URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR]
 ?>
<!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=utf-8" />
<title>Inloggen</title>
</head>

<body>
[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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]inloggen[/COLOR][COLOR= #007700]])){[/COLOR]
?>
<form action="" method="post">
   <table border="0">
      <tr>
         <td><input type="text" name="naam" value="Gebruikersnaam" size="20px"></td>
      </tr>
      <tr>
         <td><input type="password" name="pass" value="Wachtwoord" size="20px"></td>
      </tr>
      <tr>
         <td><input type="submit" name="inloggen" value="Inloggen"></td>
      </tr>
   </table>
</form>

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

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

[COLOR= #FF8000]//Kijken of de ingevulde gebruikersnaam hoort bij het ingevulde wachtwoord[/COLOR]
[COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM leden WHERE gebrnaam = "[/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]naam[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]" 
AND wachtwoord = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/sha1"]sha1[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$wachtwoord[/COLOR][COLOR= #007700])).[/COLOR][COLOR= #DD0000]""[/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]$query[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]){[/COLOR]

    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De ingevulde gegevens zijn niet correct, probeer het nog eens![/COLOR][COLOR= #007700];
        
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR] 

      [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]ingelogd[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]];[/COLOR]

    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Succesvol ingelogd![/COLOR][COLOR= #007700];[/COLOR]

        [URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]Location: indexx.php[/COLOR][COLOR= #007700]);
    
}
}[/COLOR]

?>
<br /><br />
Wachtwoord vergeten? Klik <a href="passvergeten.php">hier</a>!

</body>
</html>


Wie ziet de fout?

Degene die hem voor 00:00 oplost krijgt 0.1 toegestuurd!yummie
Alvast bedankt,

Josshiny
PS: Het ligt niet aan de connectie met de database, want het registreren werkt wel!bloos
0
Berichten
1.544
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Wat werkt niet?
Leg effe iets duidelijker uit yummie
0
Josnl

Lid · Topicstarter

Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Het inloggen, als ik de juiste gegevens in heb gevuld en ik druk op inloggen krijg ik te zien dat de ingevulde gegevens niet correct zijn.

PS: Het is zelf gescript dus als er iets ander moet, of er kan iets verbeterd worden graag even melden.biggrin
0
Berichten
1.544
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Mag ik de registratie pagina zien?
0
Josnl

Lid · Topicstarter

Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ja, ik plaats hem wel even.

<!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=utf-8" />
<title>Registreren</title>
</head>

<body>

<div style="line-height:10px; color: #F30; font-family: Verdana, Geneva, sans-serif; font-size: 13px;">

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

[COLOR= #FF8000]//Configuratiebestand includen[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]config.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]

    [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]gebrnaam[/COLOR][COLOR= #007700]]))
    {[/COLOR]
        
        [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]<li>Je hebt geen gebruikersnaam ingevuld!</li><br />[/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]wachtwoord[/COLOR][COLOR= #007700]]))
    {[/COLOR]
        
        [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]<li>Je hebt geen (geldig) wachtwoord ingevuld</li><br />[/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]voornaam[/COLOR][COLOR= #007700]]))
    {[/COLOR]
        
        [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]<li>Je hebt geen voornaam ingevuld!</li><br />[/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]achternaam[/COLOR][COLOR= #007700]]))
    {[/COLOR]
        
        [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]<li>Je hebt geen achternaam ingevuld</li><br />[/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]telnr[/COLOR][COLOR= #007700]]))
    {[/COLOR]
        
        [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]<li>Je hebt geen telefoonnummer ingevuld!</li><br />[/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]<li>Je hebt geen (geldig) email-adres ingevuld</li><br />[/COLOR][COLOR= #007700];
        
    }[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #007700]{[/COLOR] 

[COLOR= #0000BB]$pass_md5[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$wachtwoord[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/sha1"]sha1[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$pass_md5[/COLOR][COLOR= #007700]);[/COLOR]
    
        [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO `leden` (       gebrnaam,
                                               wachtwoord,
                                               voornaam,
                                               tussenv,
                                               achternaam,
                                               telnr,
                                               email)
      
                       VALUES
                      (
                       "[/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]gebrnaam[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]",
                       "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$wachtwoord[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]",
                       "[/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]voornaam[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]",
                       "[/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]tussenv[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]",
                       "[/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]achternaam[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]",
                       "[/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]telnr[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]",
                       "[/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][COLOR= #DD0000]"
                      )"[/COLOR][COLOR= #007700]);[/COLOR]
        
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<font color="#006600";>Succesvol geregistreerd</font>[/COLOR][COLOR= #007700];
    
    }
}[/COLOR]
?>

<!-- Registratieformulier -->
<form action="" method="post">
   <table border="0">
      <tr>
         <td><input type="text" name="gebrnaam" maxlength="16" value="Gebruikersnaam" size="25px"></td>
      </tr>
      <tr>
         <td><input type="password" name="wachtwoord" value="Wachtwoord" size="25px"></td>
      </tr>
            <tr>
         <td><input type="text" name="voornaam" value="Voornaam" size="25px"></td>
      </tr>
            <tr>
         <td><input type="text" name="tussenv" value="Tussenvoegsel" size="25px"></td>
      </tr>
            <tr>
         <td><input type="text" name="achternaam" value="Achternaam" size="25px"></td>
      </tr>
            <tr>
         <td><input type="text" name="telnr" value="Telefoonnummer" size="25px"></td>
      </tr>
            <tr>
         <td><input type="text" name="email" value="E-mailadres" size="25px"></td>
      </tr>
      <tr>
         <td><input type="submit" name="registreren" value="Registreren"></td>
      </tr>

   </table>
</form>


</body>
</html>
0
Berichten
1.168
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Echo eens $wachtwoord (met sha1), en kijk of dit klopt.
0
Josnl

Lid · Topicstarter

Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Je weet wel dat het wachtwoord eerst md5 gecodeerd wordt, en die md5 code wordt dan weer sha1 gecodeerd, dus die komt dan in de db.
0
Berichten
2.517
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
doe dit eens?

[COLOR= #0000BB]<?php[/COLOR]     
        [URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR]
 ?>
<!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=utf-8" />
<title>Inloggen</title>
</head>

<body>
[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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]inloggen[/COLOR][COLOR= #007700]])){[/COLOR]
?>
<form action="" method="post">
   <table border="0">
      <tr>
         <td><input type="text" name="naam" value="Gebruikersnaam" size="20px"></td>
      </tr>
      <tr>
         <td><input type="password" name="pass" value="Wachtwoord" size="20px"></td>
      </tr>
      <tr>
         <td><input type="submit" name="inloggen" value="Inloggen"></td>
      </tr>
   </table>
</form>

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]config.php[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$wachtwoord[/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]wachtwoord[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT * FROM `leden` WHERE `gebrnaam`="[/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]naam[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]" AND `wachtwoord`="[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$wachtwoord[/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]$sql[/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]$res[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
            {[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je gebruikersnaam of wachtwoord zijn niet juist, "[/COLOR][COLOR= #007700];
                
            }[/COLOR]
            [URL="http://www.php.net/else"]else[/URL]
            [COLOR= #007700]{[/COLOR]
                [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]ingelogd[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]];[/COLOR]
                                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je bent succesvol ingelogd[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]Location: indexx.php[/COLOR][COLOR= #007700]);
                     
            }
        }
    }[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #007700]{[/COLOR]

?>
<br /><br />
Wachtwoord vergeten? Klik <a href="passvergeten.php">hier</a>!

</body>
</html>
0
Josnl

Lid · Topicstarter

Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Zal het zo even proberenwink
0
Berichten
2.517
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
is goed hopen maar dat het gaat lukken wink
0
Josnl

Lid · Topicstarter

Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Helaas, het werkt niet.nooo
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