Inlogsysteem?

Gestart doorAllard6 reacties32 weergaven

7 berichten · pagina 1 van 1

Allard

Lid · Topicstarter

Berichten
970
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Kan iemand me helpen? Ik ben bezig met een inlogsysteem maar het lukt niet.
Ik wil graag dat als je bijvoorbeeld als gebruikersnaam invult jantje en als password test .
Dat die gene dan naar zijn eigen pagina wordt doorgestuurd.

Kan iemand me helpen?


Ik heb nu deze code:

[COLOR= #0000BB]<?[/COLOR]
[COLOR= #FF8000]// Hier je gebruikers toevoegen //[/COLOR]
[COLOR= #0000BB]$gb[/COLOR][COLOR= #007700][]=[/COLOR][COLOR= #DD0000]"Jantje,test"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// gebruiker 1[/COLOR]
[COLOR= #0000BB]$gb[/COLOR][COLOR= #007700][]=[/COLOR][COLOR= #DD0000]"naam2,wachtwoord"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// gebruiker 2




// Hier onder niets meer wijzigen[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]submit[/COLOR][COLOR= #007700]]){[/COLOR]
[COLOR= #0000BB]$login[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/for"]for[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]<[/COLOR] [URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gb[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #0000BB]$i[/COLOR][COLOR= #007700]++)
{[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gb[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]]==[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]","[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]]){[/COLOR]
[COLOR= #0000BB]$login[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/break"]break[/URL][COLOR= #007700];
}

}[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$login[/COLOR][COLOR= #007700]){[/COLOR]
?>
<HTML>
<H1>GOED</H1>
hier de pagina die je ziet als je bent ingelogt

</HTML>

[COLOR= #0000BB]<?[/COLOR]
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
?>
<HTML>
<H1>FOUT</H1>


Hier de pagina die je ziet zodra het wachtwoord fout was



</HTML>
[COLOR= #0000BB]<?[/COLOR]
[COLOR= #007700]}
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
[COLOR= #FF8000]// het inlog schermpje[/COLOR]


[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<form method=POST>"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<input type=text name=naam value=naam><BR>"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<input type=password name=wachtwoord value=wachtwoord><BR>"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<input type=submit value=Login name=submit> "[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"</form>"[/COLOR][COLOR= #007700];
}[/COLOR]
?>
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Dit is echt gewoon zo onveilig...
Ga gewoon met mysql en sessies werken..
0
Berichten
592
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Je kan beter eerst met je HTML beginnen op orde te zetten...

Standaard HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="nl" lang="nl"> 
<head> 
<title>Sitenaam</title> 
<link rel="stylesheet" type="text/css" href="opmaak.css" />
</head>         
<body>

</body>
</html>


Dan zou ik daarnaa je contactformulier maken:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="nl" lang="nl"> 
<head> 
<title>Sitenaam</title> 
<link rel="stylesheet" type="text/css" href="opmaak.css" />
</head>         
<body>
<h1>Inloggen</h1>
<form action="login_check.php" method="POST">
<label for="name">Naam</label><br/>
<input type="text" name="name"/><br/>
<label for="name">Wachtwoord</label><br/>
<input type="password" name="name"/><br/><br/>
<input type="submit" name="submit" value="Inloggen"/>
</form>
</body>
</html>


login_check.php

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"config.php"[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]// Zet hier je database connectie in.

// Variabelen opstellen.[/COLOR]
[COLOR= #0000BB]$name[/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]name[/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= #FF8000]// Mysql opstellen.[/COLOR]
[COLOR= #0000BB]$que[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT * FROM leden WHERE name = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$name[/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= #FF8000]// Kijk of alles 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]$name[/COLOR][COLOR= #007700]) ||[/COLOR] [URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$pass[/COLOR][COLOR= #007700]))
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Alle velden moeten zijn ingevuld!"[/COLOR][COLOR= #007700];
}[/COLOR]

[COLOR= #FF8000]// Kijk of gebruikersnaam of wachtwoord wel bestaat.[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/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]"Gebruikersnaam en/of wachtwoord verkeerd ingevuld!"[/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]"U wordt succesvol ingelogd!"[/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #FF8000]// Verwijs naar beveiligde pagina.[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"safe.php"[/COLOR][COLOR= #007700]);
}[/COLOR]
?>
0
Allard

Lid · Topicstarter

Berichten
970
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
weet je het nou of niet
0
Berichten
592
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Als je nou eens naar me vorige bericht kijkt...
0
Allard

Lid · Topicstarter

Berichten
970
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nee sorry maar wel bedankt. Het is de bedoeling dat mensen een eigen profiel hebben en daarvoor moeten inloggen, in hun profiel

Beloning voor werkend script = 0.1 punt
0
Berichten
592
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik snap je niet helemaal, waarschijnlijk kan ik het wel voor je maken, maar dan moet je effe
PM sturen met wat je precies wilt...

Dus stuur maar PM als je interesse hebt. wink
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