What's wrong??
VB http://dhost.info/reloadthedesign/webhulp.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
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<form method="post" acion=""<? $_SERVER['PHP_SELF'] ?>"">
<table>
<tr>
<td><font face=verdana size=1>Username:</font></td>
<td><input type="text" name="name" maxlength="15"></td>
</tr>
<tr>
<td><font face=verdana size=1>Email:</font></td>
<td><input type="text" name="mail"></td>
</tr>
<tr>
<td><font face=verdana size=1>Sex:</font></td>
<td><select name="sex"><option name="m">M</option><option name="v">V</option></select></td>
</tr>
<tr>
<td><font face=verdana size=1>Age:</font></td>
<td><input type="text" name="age" size="7" maxlength="3"></td>
</tr>
<tr>
<td><font face=verdana size=1>Rank</font></td>
<td><font face=verdana size=1>Member</font></td>
</tr>
<tr>
<td><font face=verdana size=1>Password:</font></td>
<td><input type="password" name="pass1"></td>
</tr>
<tr>
<td><font face=verdana size=1>Confirm:</font></td>
<td><input type="password" name="pass2"></td>
</tr>
<tr>
<td><font face=verdana size=1>By checking this, i have read, understand and accept the <a href="tos">TOS</a>:</font></td>
<td><input type="checkbox" name="agree" value="1"> <font face=verdana size=1>Agree</font></td>
</tr>
<tr>
<td><input type="submit" value="submit" name="submit"></td>
<td><input type="reset" value="reset"></td>
</tr>
</table>
</form>
<?php
if(isset($_REQUEST['submit'])){
#->Start request + delete html and strtolower and trim
$dead = "false";
$message = "<font face=verdana size=1>Pleas fill in all fields correctly:<br>";
$username = $_REQUEST['name'];
$mail = $_REQUEST['mail'];
$sex = $_REQUEST['sex'];
$age = $_REQUEST['age'];
$agree = $_REQUEST['agree'];
$pass1 = $_REQUEST['pass1'];
$pass2 = $_REQUEST['pass2'];
$ip = $_SERVER['REMOTE_ADDR'];
$username = strtolower(trim(strip_tags($username)));
$mail = trim(strip_tags($mail));
#->End request
$rank = 1;#1 member, 2co-admin, 3 admin, 4 banned.
#-->Begin check.
if($agree != "1") {
$dead = "true";
$message .= "You have not accepted the terms.<br>";
}
if(strlen($username) < 1) {
$dead = "true";
$message .= "Username (2-14)<br>";
}
if(strlen($username) >=15){
$dead = "true";
$message .= "Username (2-14)<br>";
}
if(strlen($mail) <= 5) {
$dead = "true";
$message .= "Email<br>";
}
if(!is_numeric($age)) {
$dead = "true";
$message .= "Enter a valid age in 8 format (<strike>eight</strike>)<br>";
}
if($age < 13) {
$dead = "true";
$message .= "Sorry, your to young try again later<br>";
}
if(strlen($pass1) < 6 or strlen($pass1) > 20 or $pass1 !== $pass2) {
$dead = "true";
$message .= "Password (6-20) or passwords does not match<br>";
}
#Create field named username
include('connect.inc.php');
$query = mysql_query("SELECT * FROM members WHERE username = '$username'");
$result = mysql_num_rows($query) or die(mysql_error());
if($result == 1){
$dead = "true";
$message .= "Sorry, $username is allready registred";
}
#-->End check.
#--->Start input in the DB.
if($dead == "false") { #there must be no errors found...
$pass1 = md5($pass1);
$query = "INSERT INTO members(username, pass1, pass2, mail, sex, age, ip, rank) VALUES ('$username', '$pass1', '$pass2', '$mail', '$sex', '$age' '$ip','$rank')";
if(mysql_query($query)) {
print "<font face=verdana size=1>Welcome " . $username . ", hope you having a great time on RTD.<br>Now your a member of the main site, maybe you want to register for the forum too? <br><a href=pages/forum/profile.php?mode=register>-Register on the forum</a><br><a href=index.php>-Home</a>";
}else{
mysql_error();
mysql_errno();
}
}
#--->End input in the DB.
#---->Error found
else{
print $message;
}
#---->End error found
}
# End code for register.
?>
<table>
<tr>
<td><font face=verdana size=1>Username:</font></td>
<td><input type="text" name="name" maxlength="15"></td>
</tr>
<tr>
<td><font face=verdana size=1>Email:</font></td>
<td><input type="text" name="mail"></td>
</tr>
<tr>
<td><font face=verdana size=1>Sex:</font></td>
<td><select name="sex"><option name="m">M</option><option name="v">V</option></select></td>
</tr>
<tr>
<td><font face=verdana size=1>Age:</font></td>
<td><input type="text" name="age" size="7" maxlength="3"></td>
</tr>
<tr>
<td><font face=verdana size=1>Rank</font></td>
<td><font face=verdana size=1>Member</font></td>
</tr>
<tr>
<td><font face=verdana size=1>Password:</font></td>
<td><input type="password" name="pass1"></td>
</tr>
<tr>
<td><font face=verdana size=1>Confirm:</font></td>
<td><input type="password" name="pass2"></td>
</tr>
<tr>
<td><font face=verdana size=1>By checking this, i have read, understand and accept the <a href="tos">TOS</a>:</font></td>
<td><input type="checkbox" name="agree" value="1"> <font face=verdana size=1>Agree</font></td>
</tr>
<tr>
<td><input type="submit" value="submit" name="submit"></td>
<td><input type="reset" value="reset"></td>
</tr>
</table>
</form>
<?php
if(isset($_REQUEST['submit'])){
#->Start request + delete html and strtolower and trim
$dead = "false";
$message = "<font face=verdana size=1>Pleas fill in all fields correctly:<br>";
$username = $_REQUEST['name'];
$mail = $_REQUEST['mail'];
$sex = $_REQUEST['sex'];
$age = $_REQUEST['age'];
$agree = $_REQUEST['agree'];
$pass1 = $_REQUEST['pass1'];
$pass2 = $_REQUEST['pass2'];
$ip = $_SERVER['REMOTE_ADDR'];
$username = strtolower(trim(strip_tags($username)));
$mail = trim(strip_tags($mail));
#->End request
$rank = 1;#1 member, 2co-admin, 3 admin, 4 banned.
#-->Begin check.
if($agree != "1") {
$dead = "true";
$message .= "You have not accepted the terms.<br>";
}
if(strlen($username) < 1) {
$dead = "true";
$message .= "Username (2-14)<br>";
}
if(strlen($username) >=15){
$dead = "true";
$message .= "Username (2-14)<br>";
}
if(strlen($mail) <= 5) {
$dead = "true";
$message .= "Email<br>";
}
if(!is_numeric($age)) {
$dead = "true";
$message .= "Enter a valid age in 8 format (<strike>eight</strike>)<br>";
}
if($age < 13) {
$dead = "true";
$message .= "Sorry, your to young try again later<br>";
}
if(strlen($pass1) < 6 or strlen($pass1) > 20 or $pass1 !== $pass2) {
$dead = "true";
$message .= "Password (6-20) or passwords does not match<br>";
}
#Create field named username
include('connect.inc.php');
$query = mysql_query("SELECT * FROM members WHERE username = '$username'");
$result = mysql_num_rows($query) or die(mysql_error());
if($result == 1){
$dead = "true";
$message .= "Sorry, $username is allready registred";
}
#-->End check.
#--->Start input in the DB.
if($dead == "false") { #there must be no errors found...
$pass1 = md5($pass1);
$query = "INSERT INTO members(username, pass1, pass2, mail, sex, age, ip, rank) VALUES ('$username', '$pass1', '$pass2', '$mail', '$sex', '$age' '$ip','$rank')";
if(mysql_query($query)) {
print "<font face=verdana size=1>Welcome " . $username . ", hope you having a great time on RTD.<br>Now your a member of the main site, maybe you want to register for the forum too? <br><a href=pages/forum/profile.php?mode=register>-Register on the forum</a><br><a href=index.php>-Home</a>";
}else{
mysql_error();
mysql_errno();
}
}
#--->End input in the DB.
#---->Error found
else{
print $message;
}
#---->End error found
}
# End code for register.
?>
? lees je eens in met betrekking tot Super globals... Dit soort manier van programmeren was 4 jaar geleden al slecht te noemen...
Wat moet het dan zijn if($_post['submit']){??
En het script doet het nog steeds niet....
$_REQUEST['bla'] vervangen door $_POST['bla']
werkt nog niet
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
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
<?php
if($_SERVER['REQUEST_METHOD'] == "POST")
{
include("data.inc.php");
$global_dbh = mysql_connect($hostname, $username, $password);
mysql_select_db($db, $global_dbh);
$tusername = $_POST[username];
$tpassword = $_POST[password];
$query = "SELECT password FROM users WHERE username = '$tusername'";
$result_id = mysql_query($query) or die(mysql_error($query));
$row = mysql_fetch_row($result_id);
$db_password = $row[2];
// ************************** Correcte login *******************
if($tusername != "" && $tpassword != "" && $tpassword == $db_password)
{
$_SESSION['login'] = "$tusername";
echo "U bent nu ingelogd! Welkom en voel u vrij om de site te bezoeken!";
}
// *************************** Foute login via loginscherm ************************
elseif($_POST[hidden] == 1)
{
echo "U hebt iets fout gedaan! Dit kunnen de redenen zijn!<br>
» Uw Gebruikersnaam en/of wachtwoord zijn verkeerd || In dit geval, klik <a href='forget.php'>hier</a><br>
» Uw Gebruikersnaam bestaat niet<br>
» U bent verbannen<br><br>
Is niets van dit waar, meld dit dan bij de admin";
}
}else{
?>
Nu kan u hier inloggen. Vul hieronder uw gegevens in!<br><br>
<form method="post" name="formulier" action="index.php?page=login">
<table border="0">
<tr><td> <font color="white" size="1" face="verdana"> Gebruikersnaam:</td><td><input name="username" type="text" size="18" maxlength="20"></td></tr>
<tr><td> <font color="white" size="1" face="verdana"> Wachtwoord:</td><td><input name="password" type="password" size="18" maxlength="20"></td></tr>
</table>
<input type="hidden" name="hidden" value="1">
<input type="submit" value="Inloggen"> || <input type="reset" value="Wis Velden">
<?php
}
?>
if($_SERVER['REQUEST_METHOD'] == "POST")
{
include("data.inc.php");
$global_dbh = mysql_connect($hostname, $username, $password);
mysql_select_db($db, $global_dbh);
$tusername = $_POST[username];
$tpassword = $_POST[password];
$query = "SELECT password FROM users WHERE username = '$tusername'";
$result_id = mysql_query($query) or die(mysql_error($query));
$row = mysql_fetch_row($result_id);
$db_password = $row[2];
// ************************** Correcte login *******************
if($tusername != "" && $tpassword != "" && $tpassword == $db_password)
{
$_SESSION['login'] = "$tusername";
echo "U bent nu ingelogd! Welkom en voel u vrij om de site te bezoeken!";
}
// *************************** Foute login via loginscherm ************************
elseif($_POST[hidden] == 1)
{
echo "U hebt iets fout gedaan! Dit kunnen de redenen zijn!<br>
» Uw Gebruikersnaam en/of wachtwoord zijn verkeerd || In dit geval, klik <a href='forget.php'>hier</a><br>
» Uw Gebruikersnaam bestaat niet<br>
» U bent verbannen<br><br>
Is niets van dit waar, meld dit dan bij de admin";
}
}else{
?>
Nu kan u hier inloggen. Vul hieronder uw gegevens in!<br><br>
<form method="post" name="formulier" action="index.php?page=login">
<table border="0">
<tr><td> <font color="white" size="1" face="verdana"> Gebruikersnaam:</td><td><input name="username" type="text" size="18" maxlength="20"></td></tr>
<tr><td> <font color="white" size="1" face="verdana"> Wachtwoord:</td><td><input name="password" type="password" size="18" maxlength="20"></td></tr>
</table>
<input type="hidden" name="hidden" value="1">
<input type="submit" value="Inloggen"> || <input type="reset" value="Wis Velden">
<?php
}
?>
Gewijzigd op 01/01/1970 01:00:00 door Fabian Tack
met die error_reporting stappelen de errors zich op
big-smoke:
E topic dief
met die error_reporting stappelen de errors zich op
met die error_reporting stappelen de errors zich op
Zie daar het probleem ;). Herschrijven die handel of opzoek gaan naar iets recenters.
Maar wrm werkt dat plots niet meer gistere werkte die dingen nog
Nah, het mijne is opgelost. Heb nog een session moeten bijmaken. en hij leesde sommige dingen niet goed!
Tch raar dat ze in een php boek van 2005 nog dat soort script gebruiken niet?