probleem met registreer form
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
include("config.php");
if($_SERVER['REQUEST_METHOD'] == "POST") {
$username = $_POST['user'];
$password = md5($_POST['pass']);
$password2 = md5($_POST['pass2']);
$email = $_POST['email'];
$email2 = $_POST['email'];
if($password == $password2) {
if($email == $email2) {
$insert = 'INSERT into users(username, password, email) VALUES("'.$username.'", "'.$password.'", "'.$email.'")';
mysql_query($insert);
mysql_close();
} else {
echo "You didn't enter matching emails";
}
} else {
echo "You didn't enter matching passwords";
}
} else {
?>
<!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>Register</title>
</head>
<body>
<form method="post" action"register.php">
<table width="200" border="0">
<tr>
<td>Username:</td>
<td><input type="text" name="user" /></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="pass" /></td>
</tr>
<tr>
<td>Repeat Password:</td>
<td><input type="password" name="pass2" /></td>
</tr>
<tr>
<td>Email</td>
<td><input type="email" name="email" /></td>
</tr>
<tr>
<td>Repeat email</td>
<td><input type="email" name="email2" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" value="Register" /></td>
</table>
</form>
</body>
</html>
<?php
}
?>
include("config.php");
if($_SERVER['REQUEST_METHOD'] == "POST") {
$username = $_POST['user'];
$password = md5($_POST['pass']);
$password2 = md5($_POST['pass2']);
$email = $_POST['email'];
$email2 = $_POST['email'];
if($password == $password2) {
if($email == $email2) {
$insert = 'INSERT into users(username, password, email) VALUES("'.$username.'", "'.$password.'", "'.$email.'")';
mysql_query($insert);
mysql_close();
} else {
echo "You didn't enter matching emails";
}
} else {
echo "You didn't enter matching passwords";
}
} else {
?>
<!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>Register</title>
</head>
<body>
<form method="post" action"register.php">
<table width="200" border="0">
<tr>
<td>Username:</td>
<td><input type="text" name="user" /></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="pass" /></td>
</tr>
<tr>
<td>Repeat Password:</td>
<td><input type="password" name="pass2" /></td>
</tr>
<tr>
<td>Email</td>
<td><input type="email" name="email" /></td>
</tr>
<tr>
<td>Repeat email</td>
<td><input type="email" name="email2" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" value="Register" /></td>
</table>
</form>
</body>
</html>
<?php
}
?>
Als ik op register klikt, werkt de pagina plots niet meer
Quote:
Deze webpagina is niet beschikbaar
De webpagina op http://localhost/cms/register.php is mogelijk tijdelijk uitgeschakeld of permanent verplaatst naar een nieuw webadres.
Hier zijn enkele suggesties:
Reload this web page later.
Fout 101 (net::ERR_CONNECTION_RESET): De verbinding is opnieuw ingesteld.
De webpagina op http://localhost/cms/register.php is mogelijk tijdelijk uitgeschakeld of permanent verplaatst naar een nieuw webadres.
Hier zijn enkele suggesties:
Reload this web page later.
Fout 101 (net::ERR_CONNECTION_RESET): De verbinding is opnieuw ingesteld.
Wie kan mij helpen?
Gewijzigd op 28/07/2011 22:52:29 door B a s
moet daar niet een = achter action staan?
En je draait je eigen server op localhost hoop ik?
ja
Ik zie dat SQL-injection mogelijk is.
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
include("config.php");
if($_SERVER['REQUEST_METHOD'] == "POST") {
$username = $_POST['user'];
$password = md5($_POST['pass']);
$password2 = md5($_POST['pass2']);
$email = $_POST['email'];
$email2 = $_POST['email2'];
$result = mysql_query("SELECT username FROM users WHERE username = '$username'");
if(mysql_num_rows($result) !== 0){
echo "That username is already in use!";
} else {
if($password == $password2) {
if($email == $email2) {
$insert = 'INSERT into users(username, password, email) VALUES("'.$username.'", "'.$password.'", "'.$email.'")';
mysql_query($insert);
mysql_close();
echo "You are now registered!";
} else {
echo "Your emails don't match";
}
} else {
echo "Your passwords did not match";
}
}
} else {
?>
include("config.php");
if($_SERVER['REQUEST_METHOD'] == "POST") {
$username = $_POST['user'];
$password = md5($_POST['pass']);
$password2 = md5($_POST['pass2']);
$email = $_POST['email'];
$email2 = $_POST['email2'];
$result = mysql_query("SELECT username FROM users WHERE username = '$username'");
if(mysql_num_rows($result) !== 0){
echo "That username is already in use!";
} else {
if($password == $password2) {
if($email == $email2) {
$insert = 'INSERT into users(username, password, email) VALUES("'.$username.'", "'.$password.'", "'.$email.'")';
mysql_query($insert);
mysql_close();
echo "You are now registered!";
} else {
echo "Your emails don't match";
}
} else {
echo "Your passwords did not match";
}
}
} else {
?>
<!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>Register</title>
</head>
<body>
<form method="post" action="register.php">
<table width="200" border="0">
<tr>
<td>Username:</td>
<td><input type="text" name="user" /></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="pass" /></td>
</tr>
<tr>
<td>Repeat Password:</td>
<td><input type="password" name="pass2" /></td>
</tr>
<tr>
<td>Email</td>
<td><input type="email" name="email" /></td>
</tr>
<tr>
<td>Repeat email</td>
<td><input type="email" name="email2" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" value="Register" /></td>
</table>
</form>
</body>
</html>
het rare nu is :p als ik iets fout ingeef, geeft hij pagina weer, maar als ik ongebruikte naam, zelfde emails, zelfde wachtwoorden ingeef, kan hij weer de pagina niet laden..
en - Aar -, ik ben nog niet zo goed in php, geen idee hoe ik dit kan voorkomen,
ik probeer gewoon met php te werken
Gewijzigd op 28/07/2011 23:12:37 door Stefan iemand
Bijv:
Deze webpagina is niet beschikbaar
De webpagina op http://localhost/cms/register.php is mogelijk tijdelijk uitgeschakeld of permanent verplaatst naar een nieuw webadres.
Hier zijn enkele suggesties:
Reload this web page later.
Fout 101 (net::ERR_CONNECTION_RESET): De verbinding is opnieuw ingesteld.