GET Methode
Nu wil ik het volgende, dat is dat mijn script uit de link de naam haalt, die word geplaats zoals dit:
http://mijnsitehier.nl/index.php?brute=[naamhier]
alleen nu werkt het niet, dit is wat ik heb.
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
$brute = $_GET['brute'];
If(empty($brute)) {
Echo "You need to fill in a name";
} Else if(strlen($brute) > 13) {
Echo "A name can only be 13 characters or less";
} else {
$brute = strip_tags($brute);
preg_match('/"(.*?)"/',$brute,$brute);
preg_match('/\'(.*?)\'/',$brute,$brute);
$data = file_get_contents("http://".$brute.".mybrute.com/cellule");
//hier staat de rest van me script dat wel werkt.
}
?>
$brute = $_GET['brute'];
If(empty($brute)) {
Echo "You need to fill in a name";
} Else if(strlen($brute) > 13) {
Echo "A name can only be 13 characters or less";
} else {
$brute = strip_tags($brute);
preg_match('/"(.*?)"/',$brute,$brute);
preg_match('/\'(.*?)\'/',$brute,$brute);
$data = file_get_contents("http://".$brute.".mybrute.com/cellule");
//hier staat de rest van me script dat wel werkt.
}
?>
Gewijzigd op 01/01/1970 01:00:00 door Stefan
Parse error: syntax error, unexpected $end in /home/candan21/public_html/test/index.php on line 1
Je mist een }
Ark, ik heb all me { en }'s gechecked met notepad++ en alles was compleet.
Dit is géén vergelijking:
if($pupils = 1){
Wat wellicht fout gaat is
Quote:
if ($brute > 13)
Je bedoelt vast
Quote:
if (strlen($brute) > 13)
Krijg nog steeds hetzelfde foutje.
$brute = $_GET['brute'];
Is $brute true or false?
If(!$brute) {
In $brute staat dus een getal?
} Else if($brute > 13) {
Sorry, dat waren snelheids foutjes, het is nu goed, maar het werkt nog niet.
SanThe heeft indd een goed punt.
Je kan het beter op de volgende manier controleren.
Code (php)
/* Edit */
Foutje eruit gehaald.
Gewijzigd op 01/01/1970 01:00:00 door Mr.Ark
heb het volgende er nu voor:
Stuur die code van zo straks eens door aan een pm aan mij.
Oke, gedaan.
if(!isset($_GET['brute']){
// leeg en bestaat niet..
}else{
// doe je ding//
}
Parse error: syntax error, unexpected '{' in /home/candan21/public_html/test/index.php on line 1
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 //kleurtjes
if(!isset($_GET['brute']) {
Echo "You need to fill in a name.";
} else {
if(strlen($brute) > 13) {
Echo "A name can only be 13 characters or less.";
} else {
$brute = $_GET['brute'];
$brute = strip_tags($brute);
$brute = preg_replace('#\'#', '', $brute);
$brute = preg_replace('#\"#', '', $brute);
$data = file_get_contents("http://".$brute.".mybrute.com/cellule");
//rest..
}
}
?>
if(!isset($_GET['brute']) {
Echo "You need to fill in a name.";
} else {
if(strlen($brute) > 13) {
Echo "A name can only be 13 characters or less.";
} else {
$brute = $_GET['brute'];
$brute = strip_tags($brute);
$brute = preg_replace('#\'#', '', $brute);
$brute = preg_replace('#\"#', '', $brute);
$data = file_get_contents("http://".$brute.".mybrute.com/cellule");
//rest..
}
}
?>
moet worden:
if(!isset($_GET['brute'])) {
je sluit de voorwaarde van if niet af ;)
Gewijzigd op 01/01/1970 01:00:00 door Tamara
Parse error: syntax error, unexpected $end in /home/candan21/public_html/test/index.php on line 1
dit is de script tot nu toe:
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 //kleurtjes
if(!isset($_GET['brute'])) {
Echo "You need to fill in a name.";
} else {
}
$brute = $_GET['brute'];
$brute = strip_tags($brute);
$brute = preg_replace('#\'#', '', $brute);
$brute = preg_replace('#\"#', '', $brute);
if(strlen($brute) > 13) {
Echo "A name can only be 13 characters or less.";
} else {
$data = file_get_contents("http://".$brute.".mybrute.com/cellule");
//rest hier..
}
}
?>
if(!isset($_GET['brute'])) {
Echo "You need to fill in a name.";
} else {
}
$brute = $_GET['brute'];
$brute = strip_tags($brute);
$brute = preg_replace('#\'#', '', $brute);
$brute = preg_replace('#\"#', '', $brute);
if(strlen($brute) > 13) {
Echo "A name can only be 13 characters or less.";
} else {
$data = file_get_contents("http://".$brute.".mybrute.com/cellule");
//rest hier..
}
}
?>
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php //kleurtjes
if(!isset($_GET['brute'])) {
Echo "You need to fill in a name.";
} else {
$brute = $_GET['brute'];
$brute = strip_tags($brute);
$brute = preg_replace('#\'#', '', $brute);
$brute = preg_replace('#\"#', '', $brute);
if(strlen($brute) > 13)
{
Echo "A name can only be 13 characters or less.";
}
else
{
$data = file_get_contents("http://".$brute.".mybrute.com/cellule");
}
//rest hier..
}
?>
if(!isset($_GET['brute'])) {
Echo "You need to fill in a name.";
} else {
$brute = $_GET['brute'];
$brute = strip_tags($brute);
$brute = preg_replace('#\'#', '', $brute);
$brute = preg_replace('#\"#', '', $brute);
if(strlen($brute) > 13)
{
Echo "A name can only be 13 characters or less.";
}
else
{
$data = file_get_contents("http://".$brute.".mybrute.com/cellule");
}
//rest hier..
}
?>
SanThe schreef op 26.05.2009 14:13:
Alle ( en ) en { en } checken.
Oke, ik heb het geprobeerd zonder de andere code, en het werkte, toen de get en brute var geechoed, ze waren allebei goed.
dus nu zit ik met de vraag, waar zit mijn error?
Hier is de code;
en de error die ik krijg is:
Parse error: syntax error, unexpected $end in /home/candan21/public_html/test/index.php on line 1
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
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
<?php
if(!isset($_GET['brute'])) {
Echo "You need to fill in a name.";
} else {
$brute = $_GET['brute'];
$brute = strip_tags($brute);
$brute = preg_replace('#\'#', '', $brute);
$brute = preg_replace('#\"#', '', $brute);
if(strlen($brute) > 13)
{
Echo "A name can only be 13 characters or less.";
}
else
{
$data = file_get_contents("http://".$brute.".mybrute.com/cellule");
//lvl
$regex = "/Level(1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-9]|[0-9])/";
preg_match_all($regex, $data, $mydata);
$lvl = $mydata[0][0];
//name
$regex1 = "/<h1>(.*)<\/h1>/";
preg_match_all($regex1, $data, $mydata1);
$name = strip_tags($mydata1[0][0]);
// hp
$regex2 = "/<div class=\"life\">(.*)<\/div><\/div>/";
preg_match_all($regex2, $data, $mydata2);
$hp = strip_tags($mydata2[0][0]);
$hp = preg_replace('#health points#', '', $hp);
$hp = preg_replace('#:#', '', $hp);
$hp = preg_replace('#Strength#', '', $hp);
$hp = preg_replace('# #', '', $hp);
$hp = preg_replace('#Agility#', '', $hp);
$hp = preg_replace('#Speed#', '', $hp);
//Victories
$regex3 = "/<div class=\"value\" onmouseover=\"mt\.js\.Tip\.show\(this,'Number of victories in the Arena.',null\)\" onmouseout=\"mt\.js\.Tip\.hide\(\)\">(.*)<\/div>/";
preg_match_all($regex3, $data, $mydata3);
$victories = strip_tags($mydata3[0][0]);
//Pupils
$regex4 = "/<div class=\"value\" onmouseover=\"mt\.js\.Tip\.show\(this,'Number of Brutes who have been recruited. Click here to see your pupils.',null\)\" onmouseout=\"mt\.js\.Tip\.hide\(\)\"><a href=\"\/dojo\">1<\/a><\/div>/";
preg_match_all($regex4, $data, $mydata4);
$pupils = strip_tags($mydata4[0][0]);
//Strenght
$regex5 = "/<div class=\"caracBar\" onmouseover=\"mt\.js\.Tip\.show\(this,'Strength:(1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-9]|[0-9])',null\)\" onmouseout=\"mt\.js\.Tip\.hide\(\)\"><div class=\"legend\">Strength:<\/div><div class=\"bar\">/";
preg_match_all($regex5, $data, $mydata5);
$strength = $mydata5[0][0];
$strength = preg_replace('#<div class=\"caracBar\" onmouseover=\"mt\.js\.Tip\.show\(this,\'#', '', $strength);
$strength = preg_replace('#\',null\)\" onmouseout=\"mt\.js\.Tip\.hide\(\)\"><div class=\"legend\">Strength:<\/div><div class=\"bar\">#', '', $strength);
//Agility
$regex6 = "/<div class=\"caracBar\" onmouseover=\"mt\.js\.Tip\.show\(this,'Agility:(1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-9]|[0-9])',null\)\" onmouseout=\"mt\.js\.Tip\.hide\(\)\"><div class=\"legend\">Agility:<\/div><div class=\"bar\">/";
preg_match_all($regex6, $data, $mydata6);
$agil = $mydata6[0][0];
$agil = preg_replace('#<div class=\"caracBar\" onmouseover=\"mt\.js\.Tip\.show\(this,\'#', '', $agil);
$agil = preg_replace('#\',null\)\" onmouseout=\"mt\.js\.Tip\.hide\(\)\"><div class=\"legend\">Agility:<\/div><div class=\"bar\">#', '', $agil);
//Speed
$regex7 = "/<div class=\"caracBar\" onmouseover=\"mt\.js\.Tip\.show\(this,'Speed:(1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-9]|[0-9])',null\)\" onmouseout=\"mt\.js\.Tip\.hide\(\)\"><div class=\"legend\">Speed:<\/div><div class=\"bar\">/";
preg_match_all($regex7, $data, $mydata7);
$speed = $mydata7[0][0];
$speed = preg_replace('#<div class=\"caracBar\" onmouseover=\"mt\.js\.Tip\.show\(this,\'#', '', $speed);
$speed = preg_replace('#\',null\)\" onmouseout=\"mt\.js\.Tip\.hide\(\)\"><div class=\"legend\">Speed:<\/div><div class=\"bar\">#', '', $speed);
if($pupils == 1){
$puptxt = $pupils." Pupil";
} else if($pupils == 0){
$puptxt = "No Pupils";
} else {
$puptxt = $pupils." Pupils";
}
$my_img = imagecreatefrompng("background.PNG");
$text_colour = imagecolorallocate($my_img, 139, 119, 101);
imagestring($my_img, 4, 25, 20, $name, $text_colour);
imagestring($my_img, 4, 25, 35, $lvl, $text_colour);
imagestring($my_img, 4, 25, 50, $puptxt, $text_colour);
imagestring($my_img, 4, 25, 65, $strength, $text_colour);
imagestring($my_img, 4, 25, 80, $agil, $text_colour);
imagestring($my_img, 4, 25, 95, $speed, $text_colour);
imagestring($my_img, 4, 25, 110, $victories." Victories", $text_colour);
imagestring($my_img, 4, 25, 127, "http://".$brute.".mybrute.com/cellule", $text_colour);
imagesetthickness($my_img, 5);
header("Content-type: image/png");
imagepng($my_img);
imagecolordeallocate($text_color);
imagedestroy($my_img);
}
}
?>
if(!isset($_GET['brute'])) {
Echo "You need to fill in a name.";
} else {
$brute = $_GET['brute'];
$brute = strip_tags($brute);
$brute = preg_replace('#\'#', '', $brute);
$brute = preg_replace('#\"#', '', $brute);
if(strlen($brute) > 13)
{
Echo "A name can only be 13 characters or less.";
}
else
{
$data = file_get_contents("http://".$brute.".mybrute.com/cellule");
//lvl
$regex = "/Level(1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-9]|[0-9])/";
preg_match_all($regex, $data, $mydata);
$lvl = $mydata[0][0];
//name
$regex1 = "/<h1>(.*)<\/h1>/";
preg_match_all($regex1, $data, $mydata1);
$name = strip_tags($mydata1[0][0]);
// hp
$regex2 = "/<div class=\"life\">(.*)<\/div><\/div>/";
preg_match_all($regex2, $data, $mydata2);
$hp = strip_tags($mydata2[0][0]);
$hp = preg_replace('#health points#', '', $hp);
$hp = preg_replace('#:#', '', $hp);
$hp = preg_replace('#Strength#', '', $hp);
$hp = preg_replace('# #', '', $hp);
$hp = preg_replace('#Agility#', '', $hp);
$hp = preg_replace('#Speed#', '', $hp);
//Victories
$regex3 = "/<div class=\"value\" onmouseover=\"mt\.js\.Tip\.show\(this,'Number of victories in the Arena.',null\)\" onmouseout=\"mt\.js\.Tip\.hide\(\)\">(.*)<\/div>/";
preg_match_all($regex3, $data, $mydata3);
$victories = strip_tags($mydata3[0][0]);
//Pupils
$regex4 = "/<div class=\"value\" onmouseover=\"mt\.js\.Tip\.show\(this,'Number of Brutes who have been recruited. Click here to see your pupils.',null\)\" onmouseout=\"mt\.js\.Tip\.hide\(\)\"><a href=\"\/dojo\">1<\/a><\/div>/";
preg_match_all($regex4, $data, $mydata4);
$pupils = strip_tags($mydata4[0][0]);
//Strenght
$regex5 = "/<div class=\"caracBar\" onmouseover=\"mt\.js\.Tip\.show\(this,'Strength:(1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-9]|[0-9])',null\)\" onmouseout=\"mt\.js\.Tip\.hide\(\)\"><div class=\"legend\">Strength:<\/div><div class=\"bar\">/";
preg_match_all($regex5, $data, $mydata5);
$strength = $mydata5[0][0];
$strength = preg_replace('#<div class=\"caracBar\" onmouseover=\"mt\.js\.Tip\.show\(this,\'#', '', $strength);
$strength = preg_replace('#\',null\)\" onmouseout=\"mt\.js\.Tip\.hide\(\)\"><div class=\"legend\">Strength:<\/div><div class=\"bar\">#', '', $strength);
//Agility
$regex6 = "/<div class=\"caracBar\" onmouseover=\"mt\.js\.Tip\.show\(this,'Agility:(1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-9]|[0-9])',null\)\" onmouseout=\"mt\.js\.Tip\.hide\(\)\"><div class=\"legend\">Agility:<\/div><div class=\"bar\">/";
preg_match_all($regex6, $data, $mydata6);
$agil = $mydata6[0][0];
$agil = preg_replace('#<div class=\"caracBar\" onmouseover=\"mt\.js\.Tip\.show\(this,\'#', '', $agil);
$agil = preg_replace('#\',null\)\" onmouseout=\"mt\.js\.Tip\.hide\(\)\"><div class=\"legend\">Agility:<\/div><div class=\"bar\">#', '', $agil);
//Speed
$regex7 = "/<div class=\"caracBar\" onmouseover=\"mt\.js\.Tip\.show\(this,'Speed:(1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-9]|[0-9])',null\)\" onmouseout=\"mt\.js\.Tip\.hide\(\)\"><div class=\"legend\">Speed:<\/div><div class=\"bar\">/";
preg_match_all($regex7, $data, $mydata7);
$speed = $mydata7[0][0];
$speed = preg_replace('#<div class=\"caracBar\" onmouseover=\"mt\.js\.Tip\.show\(this,\'#', '', $speed);
$speed = preg_replace('#\',null\)\" onmouseout=\"mt\.js\.Tip\.hide\(\)\"><div class=\"legend\">Speed:<\/div><div class=\"bar\">#', '', $speed);
if($pupils == 1){
$puptxt = $pupils." Pupil";
} else if($pupils == 0){
$puptxt = "No Pupils";
} else {
$puptxt = $pupils." Pupils";
}
$my_img = imagecreatefrompng("background.PNG");
$text_colour = imagecolorallocate($my_img, 139, 119, 101);
imagestring($my_img, 4, 25, 20, $name, $text_colour);
imagestring($my_img, 4, 25, 35, $lvl, $text_colour);
imagestring($my_img, 4, 25, 50, $puptxt, $text_colour);
imagestring($my_img, 4, 25, 65, $strength, $text_colour);
imagestring($my_img, 4, 25, 80, $agil, $text_colour);
imagestring($my_img, 4, 25, 95, $speed, $text_colour);
imagestring($my_img, 4, 25, 110, $victories." Victories", $text_colour);
imagestring($my_img, 4, 25, 127, "http://".$brute.".mybrute.com/cellule", $text_colour);
imagesetthickness($my_img, 5);
header("Content-type: image/png");
imagepng($my_img);
imagecolordeallocate($text_color);
imagedestroy($my_img);
}
}
?>
Gewijzigd op 01/01/1970 01:00:00 door Stefan