inlog systeem
(probeem is ik kan alleen met de laatste accaunt inloggen dus de accaunt die het laatste is aangemaakt de andere doen het dan weer niet)
hier komen de codetjes
volgorde is login7.php » check.php » check2.php
********** login7.php *************
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
print("
<form name=\"form1\" method=\"post\" action=\"check.php\">
<div align=\"center\">
<table width=\"28%\" border=\"0\">
<tr>
<td width=\"128\">Gebruikersnaam</td>
<td width=\"795\"><input name=\"user\" type=\"text\" id=\"user\"></td>
</tr>
<tr>
<td>Wachtwoord</td>
<td><input name=\"pass\" type=\"text\" id=\"pass\"></td>
</tr>
</table>
<br>
<input type=\"submit\" name=\"Submit\" value=\"Login\">
</div>
</form>
<div align=\"center\"><a href=\"register.php\">Nog geen account meld je dan aan</a><br>
</div>
");
?>
print("
<form name=\"form1\" method=\"post\" action=\"check.php\">
<div align=\"center\">
<table width=\"28%\" border=\"0\">
<tr>
<td width=\"128\">Gebruikersnaam</td>
<td width=\"795\"><input name=\"user\" type=\"text\" id=\"user\"></td>
</tr>
<tr>
<td>Wachtwoord</td>
<td><input name=\"pass\" type=\"text\" id=\"pass\"></td>
</tr>
</table>
<br>
<input type=\"submit\" name=\"Submit\" value=\"Login\">
</div>
</form>
<div align=\"center\"><a href=\"register.php\">Nog geen account meld je dan aan</a><br>
</div>
");
?>
******** check.php ******
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
include("connect.php");
$s = "SELECT * FROM users"; //maak de var $s aan.
$r = mysql_query($s); //maak de var $r aan.
while ($rij = mysql_fetch_array ($r) ){
if(($user == "$rij[user]")){
$usercheck = "ja";
}else{
print("<meta http-equiv=\"refresh\" content=\"0;URL=verkeerd.php\">");
}
if(($usercheck == "ja")){
print("<meta http-equiv=\"refresh\" content=\"0;URL=check2.php?pass=$pass\">");
}else{
print("foutje");
}
}
?>
include("connect.php");
$s = "SELECT * FROM users"; //maak de var $s aan.
$r = mysql_query($s); //maak de var $r aan.
while ($rij = mysql_fetch_array ($r) ){
if(($user == "$rij[user]")){
$usercheck = "ja";
}else{
print("<meta http-equiv=\"refresh\" content=\"0;URL=verkeerd.php\">");
}
if(($usercheck == "ja")){
print("<meta http-equiv=\"refresh\" content=\"0;URL=check2.php?pass=$pass\">");
}else{
print("foutje");
}
}
?>
*********** check2.php ********
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
include("connect.php");
$s = "SELECT * FROM users"; //maak de var $s aan.
$r = mysql_query($s); //maak de var $r aan.
while ($rij = mysql_fetch_array ($r) ){
$pass2 = md5("$pass");
if(($pass2 == "$rij[pass]")){
$passcheck = "ja";
}else{
print("<meta http-equiv=\"refresh\" content=\"0;URL=verkeerd2.php\">");
}
if(($passcheck == "ja")){
print("<meta http-equiv=\"refresh\" content=\"0;URL=inglogd.php\">");
}else{
print("foutje_");
}
}
?>
include("connect.php");
$s = "SELECT * FROM users"; //maak de var $s aan.
$r = mysql_query($s); //maak de var $r aan.
while ($rij = mysql_fetch_array ($r) ){
$pass2 = md5("$pass");
if(($pass2 == "$rij[pass]")){
$passcheck = "ja";
}else{
print("<meta http-equiv=\"refresh\" content=\"0;URL=verkeerd2.php\">");
}
if(($passcheck == "ja")){
print("<meta http-equiv=\"refresh\" content=\"0;URL=inglogd.php\">");
}else{
print("foutje_");
}
}
?>
Code (php)
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
<?
$sql = "SELECT pass FROM users WHERE naam = '" . $_POST['user'] . "'");
if ($row = mysql_fetch_array($sql)) {
if ($row['pass'] != $_POST['pass']) {
// pass wrong
} else {
// pass juist
}
}
?>
$sql = "SELECT pass FROM users WHERE naam = '" . $_POST['user'] . "'");
if ($row = mysql_fetch_array($sql)) {
if ($row['pass'] != $_POST['pass']) {
// pass wrong
} else {
// pass juist
}
}
?>
en je wachtwoord input veld, zou ik op 'password' ipv op 'tekst' zetten...
Edit: Typo
Gewijzigd op 28/09/2004 17:56:00 door Alfred -
Code (php)
maar ik krijg error:
Parse error: parse error, unexpected ')' in c:\appserv\www\basjo\check.php on line 3
is dit niet fout: WHERE naam = ?????