probleem met registreer form

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Stefan iemand

Stefan iemand

28/07/2011 22:46:23
Quote Anchor link
Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
<?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.


Wie kan mij helpen?
Gewijzigd op 28/07/2011 22:52:29 door B a s
 
PHP hulp

PHP hulp

24/04/2024 19:25:10
 
Hugo Maes

Hugo Maes

28/07/2011 22:52:36
Quote Anchor link
<form method="post" action"register.php">


moet daar niet een = achter action staan?
 
B a s
Beheerder

B a s

28/07/2011 22:53:03
Quote Anchor link
En je draait je eigen server op localhost hoop ik?
 
Stefan iemand

Stefan iemand

28/07/2011 23:00:13
Quote Anchor link
ja
 
- Ariën  -
Beheerder

- Ariën -

28/07/2011 23:02:51
Quote Anchor link
Ik zie dat SQL-injection mogelijk is.
 
Stefan iemand

Stefan iemand

28/07/2011 23:10:48
Quote Anchor link
Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
<?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 {
            
?>

<!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>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
<?php
}
?>




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
 
Sven b

Sven b

29/07/2011 08:53:23
Quote Anchor link
Hoe bedoel je hij kan de pagina niet laden? Wil je zeggen dat je een blanko pagina krijgt? Dat is immers goed mogelijk, omdat je niet binnen elke if en else statement een echo hebt staan. Nu hoef je dat niet perse te doen, maar dan zie je wel in welk block je code te recht komt.

Bijv:

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
if ($a === 1){
 echo 'Ik ben nu hier. 1 is gelijk aan de variabele a.';
}
else {
  echo 'Ik ben nu in de else block. Schijnbaar is de variabele a niet gelijk aan 1.';
}
 
Stefan iemand

Stefan iemand

29/07/2011 11:50:13
Quote Anchor link
Nee, ik de pagina laadt gewoon niet,

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.
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.