Hulp nodig met de nieuwe versie van php.
Ik heb op mijn server de nieuwste versie van php maar mijn script is nog gescript in de oude versie van php. Is er iemand die mij wil helpen om dit script om te zetten naar de neiuwste versie van php?
groetjes,
pepijn
Als je je script netjes hebt opgebouwd zal het ook in de nieuwste versie van PHP werken. Heb je het al uitgetest?
Ja ik heb het al uitgetest maar op dit momend werkt mijn login en signup.php niet meer.
PS. Het gaat hier niet om een criminals maar om een wargame.
Maar heb je foutmeldingen?
Edit:
En we hebben op deze site een edit knopje
Webmakerij:
Veel verschil is er volgens mij niet.
Maar heb je foutmeldingen?
Maar heb je foutmeldingen?
Edit:
En we hebben op deze site een edit knopje
Nee ik heb helemaal geen fout meldingen maar er gebeurt gewoon niks. Echt heel raar.
Edit:
Sorry. Volgende keer zal ik het via edit doen
Geef eens een link
Verstuurt via pm
Plaats gewoon die link. Stel je niet aan, met het is nog niet af.
http://crimewar.gamecoll.com/game/
De site is nog lang niet af maar voor wie een kijkje wilt nemen....
En de source code van de signup.php 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
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<html>
<head>
<?
$title = "The Eternal Duel - Join now!";
include("style5.css");
?>
<?php
global $coderan;
?>
</head>
<?
include("header.php");
?>
<p>
<form action="signup.php?action=signup" method="post">
<table>
<tr>
<td>
E-mail Address:
</td>
<td>
<input type="text" name="email" size="30">
</td>
</tr>
<tr><td>
Username:
</td>
<td>
<input type="text" name="username" size="30">
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<input type="password" name="password" size="30">
</td>
</tr>
<tr>
<td>
Verify Password:
</td>
<td>
<input type="password" name="password2" size="30">
</td>
</tr>
<tr>
<td>
Gender:
</td>
<td>
<select name=gender><option value=Male>Male</option><option value=Female>Female</option></select>
</td>
</tr>
<tr>
<td>
Referral ID:
</td>
<td>
<? if (!$ref){ ?>
<input type="text" name="refferer" size="30">
<?} else {echo"<b>$ref</b><input type=hidden name=\"refferer\" value=\"$ref\">";}?>
</td>
</tr>
<tr>
<td>
<input type="submit" value="Submit">
</td>
<td>
<input type="reset" value="Reset">
</td>
</tr>
</table>
</form>
<?php
if($action == $_POST["signup"]){
?>
<?php
$ip = $REMOTE_ADDR;
$username = htmlspecialchars($username);
if (empty($username) || empty($password) || empty($password2) || empty($email)){
echo "<b>Error:</b> All fields were not completed<br>";
$fieldcom = no;
}else{
$fieldcom = yes;
}
if (!ereg("^[^@ ]+@[^@ ]+\.[^@ \.]+$",$email)){
echo "<b>Error:</b> Your email address is incorrect<br>";
$valcom = no;
}else{
$valcom = yes;
}
if($password == $password2){
$passcom = yes;
}else{
echo "<b>Error:</b> Passwords don't match<br>";
$passcom = no;
}
if($gender == "Male" || $gender == "Female"){
$gendercom = yes;
}else{
echo "<b>Error:</b> That gender isnt possible<br>";
$gendercom = no;
}
if(substr($username,0,1) == " "){
echo "<b>Error:</b> Your username cannot start with a space<br>";
$usercom1 = no;
}else{
$usercom1 = yes;
}
if((strlen($username) > 15) || (strlen($username) < 4)){
echo "<b>Error:</b> Your username is too short, or too long<br>";
$usercom = no;
}else{
$usercom = yes;
}
if((strlen($password) > 15) || (strlen($password) < 4)){
echo "<b>Error</b>: Your password is too short, or too long<br>";
$passcom2 = no;
}else{
$passcom2 = yes;
}
if((strlen($email) > 65) || (strlen($email) < 5)){
echo "<b>Error</b>: Your email address is too short, or too long<br>";
$emailcom = no;
}else{
$emailcom = yes;
}
$usercheck = mysql_query("select * from userdb where username='$username'");
if(@mysql_numrows($usercheck) > 0){
echo "<b>Error</b>: That username is already taken<br>";
$userun = no;
}else{
$userun = yes;
}
$emailcheck = mysql_query("select * from userdb where email = '$email'");
if(@mysql_numrows($emailcheck) > 0){
echo "<b>Error</b>: That email address is already taken<br>";
$emailun = no;
}else{
$emailun = yes;
}
$emailcheck = mysql_query("select * from bannedip where email='$email'");
if(@mysql_numrows($emailcheck) > 0){
echo "<b>Error</b>: You are banned!<br>";
$banned = yes;
}else{
$banned = no;
}
$ipbancheck = mysql_query("select * from bannedip where ipaddress='$ip'");
$ipmulti = mysql_query("select * from userdb where ipaddress='$ip'");
if( (@mysql_num_rows($ipbancheck) > 0) || (@mysql_num_rows($ipmulti) > 25) ){
echo "<b>Error</b>: Your IP is banned, or there are too many users on your ip.<br>";
$banned1 = yes;
}else{
$banned1 = no;
}
if(($valcom == 'yes') && ($fieldcom == 'yes') && ($passcom == 'yes') && ($gendercom == 'yes') && ($usercom1 == 'yes') && ($usercom == 'yes') && ($passcom2 == 'yes') && ($emailcom == 'yes') && ($userun == 'yes') && ($emailun == 'yes') && ($banned == 'no') && ($banned1 == 'no')){
$repl = htmlspecialchars($username);
$repl = eregi_replace("admin","loser",$repl);
echo "<br><b>Success:</b> Character $username created. You will be receiving an e-mail shortly containing a verification id. When you receive that, please log in <a href=index.php>here</a>. If you do not receive the email within 5 minutes, check your Junk Mail folders.";
$verifycode = rand(10000,90000);
$adduser = mysql_query("insert into userdb (id, username, email, password, ipaddress, energy, verifycode, verified, referrer, yco, xco, gender) VALUES ('','$repl','$email','$password','$ip','150','$verifycode','N','$refferer','0','0','$gender')");
if ($refferer > 0) {
$addref = mysql_query("update userdb set refs=refs+1 where id='$refferer'");
}
$message = "Your verification code is $verifycode. Have fun playing! Etthack.";
mail("$email", "The Eternal Duel", $message, "From: [email protected]"
."Reply-To: [email protected]"
."X-Mailer: PHP/" . phpversion()) or die("mysql_die");
}else{
echo "You were not signed up due to the errors above, please complete the signup form again.";
}
}
?><?
include("footer.php");
?>
<head>
<?
$title = "The Eternal Duel - Join now!";
include("style5.css");
?>
<?php
global $coderan;
?>
</head>
<?
include("header.php");
?>
<p>
<form action="signup.php?action=signup" method="post">
<table>
<tr>
<td>
E-mail Address:
</td>
<td>
<input type="text" name="email" size="30">
</td>
</tr>
<tr><td>
Username:
</td>
<td>
<input type="text" name="username" size="30">
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<input type="password" name="password" size="30">
</td>
</tr>
<tr>
<td>
Verify Password:
</td>
<td>
<input type="password" name="password2" size="30">
</td>
</tr>
<tr>
<td>
Gender:
</td>
<td>
<select name=gender><option value=Male>Male</option><option value=Female>Female</option></select>
</td>
</tr>
<tr>
<td>
Referral ID:
</td>
<td>
<? if (!$ref){ ?>
<input type="text" name="refferer" size="30">
<?} else {echo"<b>$ref</b><input type=hidden name=\"refferer\" value=\"$ref\">";}?>
</td>
</tr>
<tr>
<td>
<input type="submit" value="Submit">
</td>
<td>
<input type="reset" value="Reset">
</td>
</tr>
</table>
</form>
<?php
if($action == $_POST["signup"]){
?>
<?php
$ip = $REMOTE_ADDR;
$username = htmlspecialchars($username);
if (empty($username) || empty($password) || empty($password2) || empty($email)){
echo "<b>Error:</b> All fields were not completed<br>";
$fieldcom = no;
}else{
$fieldcom = yes;
}
if (!ereg("^[^@ ]+@[^@ ]+\.[^@ \.]+$",$email)){
echo "<b>Error:</b> Your email address is incorrect<br>";
$valcom = no;
}else{
$valcom = yes;
}
if($password == $password2){
$passcom = yes;
}else{
echo "<b>Error:</b> Passwords don't match<br>";
$passcom = no;
}
if($gender == "Male" || $gender == "Female"){
$gendercom = yes;
}else{
echo "<b>Error:</b> That gender isnt possible<br>";
$gendercom = no;
}
if(substr($username,0,1) == " "){
echo "<b>Error:</b> Your username cannot start with a space<br>";
$usercom1 = no;
}else{
$usercom1 = yes;
}
if((strlen($username) > 15) || (strlen($username) < 4)){
echo "<b>Error:</b> Your username is too short, or too long<br>";
$usercom = no;
}else{
$usercom = yes;
}
if((strlen($password) > 15) || (strlen($password) < 4)){
echo "<b>Error</b>: Your password is too short, or too long<br>";
$passcom2 = no;
}else{
$passcom2 = yes;
}
if((strlen($email) > 65) || (strlen($email) < 5)){
echo "<b>Error</b>: Your email address is too short, or too long<br>";
$emailcom = no;
}else{
$emailcom = yes;
}
$usercheck = mysql_query("select * from userdb where username='$username'");
if(@mysql_numrows($usercheck) > 0){
echo "<b>Error</b>: That username is already taken<br>";
$userun = no;
}else{
$userun = yes;
}
$emailcheck = mysql_query("select * from userdb where email = '$email'");
if(@mysql_numrows($emailcheck) > 0){
echo "<b>Error</b>: That email address is already taken<br>";
$emailun = no;
}else{
$emailun = yes;
}
$emailcheck = mysql_query("select * from bannedip where email='$email'");
if(@mysql_numrows($emailcheck) > 0){
echo "<b>Error</b>: You are banned!<br>";
$banned = yes;
}else{
$banned = no;
}
$ipbancheck = mysql_query("select * from bannedip where ipaddress='$ip'");
$ipmulti = mysql_query("select * from userdb where ipaddress='$ip'");
if( (@mysql_num_rows($ipbancheck) > 0) || (@mysql_num_rows($ipmulti) > 25) ){
echo "<b>Error</b>: Your IP is banned, or there are too many users on your ip.<br>";
$banned1 = yes;
}else{
$banned1 = no;
}
if(($valcom == 'yes') && ($fieldcom == 'yes') && ($passcom == 'yes') && ($gendercom == 'yes') && ($usercom1 == 'yes') && ($usercom == 'yes') && ($passcom2 == 'yes') && ($emailcom == 'yes') && ($userun == 'yes') && ($emailun == 'yes') && ($banned == 'no') && ($banned1 == 'no')){
$repl = htmlspecialchars($username);
$repl = eregi_replace("admin","loser",$repl);
echo "<br><b>Success:</b> Character $username created. You will be receiving an e-mail shortly containing a verification id. When you receive that, please log in <a href=index.php>here</a>. If you do not receive the email within 5 minutes, check your Junk Mail folders.";
$verifycode = rand(10000,90000);
$adduser = mysql_query("insert into userdb (id, username, email, password, ipaddress, energy, verifycode, verified, referrer, yco, xco, gender) VALUES ('','$repl','$email','$password','$ip','150','$verifycode','N','$refferer','0','0','$gender')");
if ($refferer > 0) {
$addref = mysql_query("update userdb set refs=refs+1 where id='$refferer'");
}
$message = "Your verification code is $verifycode. Have fun playing! Etthack.";
mail("$email", "The Eternal Duel", $message, "From: [email protected]"
."Reply-To: [email protected]"
."X-Mailer: PHP/" . phpversion()) or die("mysql_die");
}else{
echo "You were not signed up due to the errors above, please complete the signup form again.";
}
}
?><?
include("footer.php");
?>
Pas je script aan.
Code (php)
1
2
3
2
3
if (empty($username) || empty($password) || empty($password2) || empty($email)){
echo "<b>Error:</b> All fields were not completed<br>";
$fieldcom = no;
echo "<b>Error:</b> All fields were not completed<br>";
$fieldcom = no;
Word
Want het moet dit worden
empty($_POST['username']);
of met isset() dat mag ook
Ja ik weet hoe php moet alleen heb ik nog nooit gebruik gemaakt van $_POST. Maar wel bedankt vuur je hulp. Het gaat nu wel lukken.
Probeer eens exit();
if($_POST['!$email'] || $_POST['!$password'])
* Een variabele kan niet tussen enkele quotes
* waarschijnlijk weet je de naam en is het geen variabele.
* Wat doet dat !-teken daar?
Wordt zo iets denk ik
if(empty($_POST'email']) || empty($_POST['password']))
Gewijzigd op 01/01/1970 01:00:00 door Bo az
In het orgineel is het zo:
En ik dacht:
of anders zo:
Code (php)
1
2
3
2
3
$email = $_POST['email']
$res = mysql_query("SELECT * FROM userdb WHERE email = '$email'");
$res = mysql_query("SELECT * FROM userdb WHERE email = '$email'");
Maar deze werken bijde niet. Wat doe ik fout?
Code (php)
1
2
3
2
3
<?php
$res = mysql_query("SELECT * FROM userdb WHERE email = '".$_POST['email']."'");
?>
$res = mysql_query("SELECT * FROM userdb WHERE email = '".$_POST['email']."'");
?>
Code (php)
1
2
3
4
5
6
7
2
3
4
5
6
7
if(!$email || !$password){
error("field");
exit;
}
if($playerinfo[password] != $password){
error("password");
error("field");
exit;
}
if($playerinfo[password] != $password){
error("password");
Allen omdat er op de server de nieuwe versie van php draait werkt dit niet meer. Heeft iemand een idee hoe is dit moet oplossen?