kleine error
ik krijg deze php-error:
Notice: Undefined offset: 2
3 keer nog wel dit is mijn script:
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
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
<?
function getStats($name) {
// Create an array of skills
$skills = array('Overall', 'Attack', 'Defence', 'Strength', 'Hitpoints', 'Ranged', 'Prayer', 'Magic', 'Cooking', 'Woodcutting', 'Fletching', 'Fishing', 'Firemaking', 'Crafting', 'Smithing', 'Mining', 'Herblore', 'Agility', 'Thieving', 'Slayer', 'Farming', 'Runecraft', 'Hunter', 'Construction', 'Summoning', 'Duel Tournament', 'Bounty Hunters', 'Bounty Hunter Rogues', 'Fist of Guthix');
$hs = @file_get_contents('http://hiscore.runescape.com/index_lite.ws?player=' . $name);
$out = Array();
if (! $hs)
return null;
if (strpos($hs, '404 - Page not found'))
return null;
$stats = explode("\n", $hs);
// Loop through the skills
for($i = 0; $i<count($skills);$i++) {
// Explode each skill into 3 values - rank, level, exp
$stat = explode(',', $stats[$i]);
$out[$skills[$i]] = Array();
$out[$skills[$i]]['rank'] = $stat[0];
$out[$skills[$i]]['level'] = $stat[1];
$out[$skills[$i]]['xp'] = $stat[2];
}
return $out;
}
function combatLevel($attack, $defence, $strength, $hp, $prayer, $ranged, $magic, $summoning) {
$base = ($defence + $hp + floor($prayer / 2) + floor($summoning / 2)) * 0.25;
$melee = ($attack + $strength) * 0.325;
$ranger = floor($ranged * 1.5) * 0.325;
$mage = floor($magic * 1.5) * 0.325;
return $base + max($melee, $ranger, $mage);
}
include'include/config.php';
$result = mysql_query("SELECT id,username FROM `users`");
while($row = mysql_fetch_array( $result )) {
$out = getStats($row['username']);
if (!empty($out)){
$now = time();
$user = $row['id'];
$overallrank = $out['Overall']['rank'];
$overalllevel = $out['Overall']['level'];
$overallexp = $out['Overall']['xp'];
$attackrank = $out['Attack']['rank'];
$attacklevel = $out['Attack']['level'];
$attackexp = $out['Attack']['xp'];
$strengthrank = $out['Strength']['rank'];
$strengthlevel = $out['Strength']['level'];
$strengthexp = $out['Strength']['xp'];
$defencerank = $out['Defence']['rank'];
$defencelevel = $out['Defence']['level'];
$defenceexp = $out['Defence']['xp'];
$hitpointsrank = $out['Hitpoints']['rank'];
$hitpointslevel = $out['Hitpoints']['level'];
$hitpointsexp = $out['Hitpoints']['xp'];
$rangedrank = $out['Ranged']['rank'];
$rangedlevel = $out['Ranged']['level'];
$rangedexp = $out['Ranged']['xp'];
$prayerrank = $out['Prayer']['rank'];
$prayerlevel = $out['Prayer']['level'];
$prayerexp = $out['Prayer']['xp'];
$magicrank = $out['Magic']['rank'];
$magiclevel = $out['Magic']['level'];
$magicexp = $out['Magic']['xp'];
$cookingrank = $out['Cooking']['rank'];
$cookinglevel = $out['Cooking']['level'];
$cookingexp = $out['Cooking']['xp'];
$woodcuttingrank = $out['Woodcutting']['rank'];
$woodcuttinglevel = $out['Woodcutting']['level'];
$woodcuttingexp = $out['Woodcutting']['xp'];
$fletchingrank = $out['Fletching']['rank'];
$fletchinglevel = $out['Fletching']['level'];
$fletchingexp = $out['Fletching']['xp'];
$fishingrank = $out['Fishing']['rank'];
$fishinglevel = $out['Fishing']['level'];
$fishingexp = $out['Fishing']['xp'];
$firemakingrank = $out['Firemaking']['rank'];
$firemakinglevel = $out['Firemaking']['level'];
$firemakingexp = $out['Firemaking']['xp'];
$craftingrank = $out['Crafting']['rank'];
$craftinglevel = $out['Crafting']['level'];
$craftingexp = $out['Crafting']['xp'];
$smithingrank = $out['Smithing']['rank'];
$smithinglevel = $out['Smithing']['level'];
$smithingexp = $out['Smithing']['xp'];
$miningrank = $out['Mining']['rank'];
$mininglevel = $out['Mining']['level'];
$miningexp = $out['Mining']['xp'];
$herblorerank = $out['Herblore']['rank'];
$herblorelevel = $out['Herblore']['level'];
$herbloreexp = $out['Herblore']['xp'];
$agilityrank = $out['Agility']['rank'];
$agilitylevel = $out['Agility']['level'];
$agilityexp = $out['Agility']['xp'];
$thievingrank = $out['Thieving']['rank'];
$thievinglevel = $out['Thieving']['level'];
$thievingexp = $out['Thieving']['xp'];
$slayerrank = $out['Slayer']['rank'];
$slayerlevel = $out['Slayer']['level'];
$slayerexp = $out['Slayer']['xp'];
$farmingrank = $out['Farming']['rank'];
$farminglevel = $out['Farming']['level'];
$farmingexp = $out['Farming']['xp'];
$runecraftrank = $out['Runecraft']['rank'];
$runecraftlevel = $out['Runecraft']['level'];
$runecraftexp = $out['Runecraft']['xp'];
$hunterrank = $out['Hunter']['rank'];
$hunterlevel = $out['Hunter']['level'];
$hunterexp = $out['Hunter']['xp'];
$constructionrank = $out['Construction']['rank'];
$constructionlevel = $out['Construction']['level'];
$constructionexp = $out['Construction']['xp'];
$summoningrank = $out['Summoning']['rank'];
$summoninglevel = $out['Summoning']['level'];
$summoningexp = $out['Summoning']['xp'];
$combatlevel = combatLevel($attacklevel, $defencelevel, $strengthlevel, $hitpointslevel, $prayerlevel, $rangedlevel, $magiclevel, $summoninglevel);
}
}
?>
function getStats($name) {
// Create an array of skills
$skills = array('Overall', 'Attack', 'Defence', 'Strength', 'Hitpoints', 'Ranged', 'Prayer', 'Magic', 'Cooking', 'Woodcutting', 'Fletching', 'Fishing', 'Firemaking', 'Crafting', 'Smithing', 'Mining', 'Herblore', 'Agility', 'Thieving', 'Slayer', 'Farming', 'Runecraft', 'Hunter', 'Construction', 'Summoning', 'Duel Tournament', 'Bounty Hunters', 'Bounty Hunter Rogues', 'Fist of Guthix');
$hs = @file_get_contents('http://hiscore.runescape.com/index_lite.ws?player=' . $name);
$out = Array();
if (! $hs)
return null;
if (strpos($hs, '404 - Page not found'))
return null;
$stats = explode("\n", $hs);
// Loop through the skills
for($i = 0; $i<count($skills);$i++) {
// Explode each skill into 3 values - rank, level, exp
$stat = explode(',', $stats[$i]);
$out[$skills[$i]] = Array();
$out[$skills[$i]]['rank'] = $stat[0];
$out[$skills[$i]]['level'] = $stat[1];
$out[$skills[$i]]['xp'] = $stat[2];
}
return $out;
}
function combatLevel($attack, $defence, $strength, $hp, $prayer, $ranged, $magic, $summoning) {
$base = ($defence + $hp + floor($prayer / 2) + floor($summoning / 2)) * 0.25;
$melee = ($attack + $strength) * 0.325;
$ranger = floor($ranged * 1.5) * 0.325;
$mage = floor($magic * 1.5) * 0.325;
return $base + max($melee, $ranger, $mage);
}
include'include/config.php';
$result = mysql_query("SELECT id,username FROM `users`");
while($row = mysql_fetch_array( $result )) {
$out = getStats($row['username']);
if (!empty($out)){
$now = time();
$user = $row['id'];
$overallrank = $out['Overall']['rank'];
$overalllevel = $out['Overall']['level'];
$overallexp = $out['Overall']['xp'];
$attackrank = $out['Attack']['rank'];
$attacklevel = $out['Attack']['level'];
$attackexp = $out['Attack']['xp'];
$strengthrank = $out['Strength']['rank'];
$strengthlevel = $out['Strength']['level'];
$strengthexp = $out['Strength']['xp'];
$defencerank = $out['Defence']['rank'];
$defencelevel = $out['Defence']['level'];
$defenceexp = $out['Defence']['xp'];
$hitpointsrank = $out['Hitpoints']['rank'];
$hitpointslevel = $out['Hitpoints']['level'];
$hitpointsexp = $out['Hitpoints']['xp'];
$rangedrank = $out['Ranged']['rank'];
$rangedlevel = $out['Ranged']['level'];
$rangedexp = $out['Ranged']['xp'];
$prayerrank = $out['Prayer']['rank'];
$prayerlevel = $out['Prayer']['level'];
$prayerexp = $out['Prayer']['xp'];
$magicrank = $out['Magic']['rank'];
$magiclevel = $out['Magic']['level'];
$magicexp = $out['Magic']['xp'];
$cookingrank = $out['Cooking']['rank'];
$cookinglevel = $out['Cooking']['level'];
$cookingexp = $out['Cooking']['xp'];
$woodcuttingrank = $out['Woodcutting']['rank'];
$woodcuttinglevel = $out['Woodcutting']['level'];
$woodcuttingexp = $out['Woodcutting']['xp'];
$fletchingrank = $out['Fletching']['rank'];
$fletchinglevel = $out['Fletching']['level'];
$fletchingexp = $out['Fletching']['xp'];
$fishingrank = $out['Fishing']['rank'];
$fishinglevel = $out['Fishing']['level'];
$fishingexp = $out['Fishing']['xp'];
$firemakingrank = $out['Firemaking']['rank'];
$firemakinglevel = $out['Firemaking']['level'];
$firemakingexp = $out['Firemaking']['xp'];
$craftingrank = $out['Crafting']['rank'];
$craftinglevel = $out['Crafting']['level'];
$craftingexp = $out['Crafting']['xp'];
$smithingrank = $out['Smithing']['rank'];
$smithinglevel = $out['Smithing']['level'];
$smithingexp = $out['Smithing']['xp'];
$miningrank = $out['Mining']['rank'];
$mininglevel = $out['Mining']['level'];
$miningexp = $out['Mining']['xp'];
$herblorerank = $out['Herblore']['rank'];
$herblorelevel = $out['Herblore']['level'];
$herbloreexp = $out['Herblore']['xp'];
$agilityrank = $out['Agility']['rank'];
$agilitylevel = $out['Agility']['level'];
$agilityexp = $out['Agility']['xp'];
$thievingrank = $out['Thieving']['rank'];
$thievinglevel = $out['Thieving']['level'];
$thievingexp = $out['Thieving']['xp'];
$slayerrank = $out['Slayer']['rank'];
$slayerlevel = $out['Slayer']['level'];
$slayerexp = $out['Slayer']['xp'];
$farmingrank = $out['Farming']['rank'];
$farminglevel = $out['Farming']['level'];
$farmingexp = $out['Farming']['xp'];
$runecraftrank = $out['Runecraft']['rank'];
$runecraftlevel = $out['Runecraft']['level'];
$runecraftexp = $out['Runecraft']['xp'];
$hunterrank = $out['Hunter']['rank'];
$hunterlevel = $out['Hunter']['level'];
$hunterexp = $out['Hunter']['xp'];
$constructionrank = $out['Construction']['rank'];
$constructionlevel = $out['Construction']['level'];
$constructionexp = $out['Construction']['xp'];
$summoningrank = $out['Summoning']['rank'];
$summoninglevel = $out['Summoning']['level'];
$summoningexp = $out['Summoning']['xp'];
$combatlevel = combatLevel($attacklevel, $defencelevel, $strengthlevel, $hitpointslevel, $prayerlevel, $rangedlevel, $magiclevel, $summoninglevel);
}
}
?>
de fout zit hier dus ergens??
alvast bedankt.
sander
Gewijzigd op 07/06/2010 05:30:47 door Sander salemander
Ja, de meldingen geven aan dat $stat[2] niet bestaat. Controleer dus eens of die variabele wel de inhoud heeft die je verwacht...
* nu ga ik een domme vraag stellen maarja hoe controleer je dat isset functie of anders?? *
ik weet dat het beter kan maar zo goed ben ik nou ook weer niet php :(
ookal heb ik het 100 keer geprobeerd en geoefend.
jouw oplossing is beter.
had ik zelf ookal bedacht, maar hoe doe ik dat??
*uiteindelijk heb ik dus een tabel met de naam van het lid erin die moet van runescape highscore je lvls aflezen en combat lvl*
hopelijk weet iemand de fout te fixen of het script iets beter te maken.
* dit hoeft natuurlijk niet ik ben al lang blij als het werkt :)
Als $stat[2] niet gevuld is maar je de waarde wel nodig hebt, moet je misschien eens gaan kijken waarom hij niet gevuld is?
hij bestaat niet of kan hem niet vinden,dat had ik al gevonden :P
maar nu?? dat gedeelte weglaten?
Je moet de code direct nadat de variabel aangemaakt is neerzetten en anders moet je dat ook eens bij $stats doen en hier neerzetten.
$out[$skills[$i]]['xp'] = $stat[2]; naar:
$out[$skills[$i]]['xp'] = $stats[2];
met een s erachter krijg ik geen errors meer maar dan nooit die niks
ik denk dus dat erbij het uitlezen van de data iets foutgaat
als er dus een S achter plak krijg ik geen error meer alleen een blanco pagina.
toch alvast bedankt voor jullie hulp ik wardeer het zeer,en ik heb dit script niet zelf gemaakt....
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
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
<?php
function getStats($name) {
// Create an array of skills
$skills = array('Overall', 'Attack', 'Defence', 'Strength', 'Hitpoints', 'Ranged', 'Prayer', 'Magic', 'Cooking', 'Woodcutting', 'Fletching', 'Fishing', 'Firemaking', 'Crafting', 'Smithing', 'Mining', 'Herblore', 'Agility', 'Thieving', 'Slayer', 'Farming', 'Runecraft', 'Hunter', 'Construction', 'Summoning', 'Duel Tournament', 'Bounty Hunters', 'Bounty Hunter Rogues', 'Fist of Guthix');
$hs = @file_get_contents('http://hiscore.runescape.com/index_lite.ws?player=' . $name);
$out = Array();
if (! $hs)
return null;
if (strpos($hs, '404 - Page not found'))
return null;
$stats = explode("\n", $hs);
print_r($stats);
// Loop through the skills
for($i = 0; $i<count($skills);$i++) {
// Explode each skill into 3 values - rank, level, exp
$stat = explode(',', $stats[$i]);
print_r($stat);
$out[$skills[$i]] = Array();
$out[$skills[$i]]['rank'] = $stat[0];
$out[$skills[$i]]['level'] = $stat[1];
$out[$skills[$i]]['xp'] = $stat[2];
}
return $out;
}
function combatLevel($attack, $defence, $strength, $hp, $prayer, $ranged, $magic, $summoning) {
$base = ($defence + $hp + floor($prayer / 2) + floor($summoning / 2)) * 0.25;
$melee = ($attack + $strength) * 0.325;
$ranger = floor($ranged * 1.5) * 0.325;
$mage = floor($magic * 1.5) * 0.325;
return $base + max($melee, $ranger, $mage);
}
include'include/config.php';
$result = mysql_query("SELECT id,username FROM `users`");
while($row = mysql_fetch_array( $result )) {
$out = getStats($row['username']);
if (!empty($out)){
$now = time();
$user = $row['id'];
$overallrank = $out['Overall']['rank'];
$overalllevel = $out['Overall']['level'];
$overallexp = $out['Overall']['xp'];
$attackrank = $out['Attack']['rank'];
$attacklevel = $out['Attack']['level'];
$attackexp = $out['Attack']['xp'];
$strengthrank = $out['Strength']['rank'];
$strengthlevel = $out['Strength']['level'];
$strengthexp = $out['Strength']['xp'];
$defencerank = $out['Defence']['rank'];
$defencelevel = $out['Defence']['level'];
$defenceexp = $out['Defence']['xp'];
$hitpointsrank = $out['Hitpoints']['rank'];
$hitpointslevel = $out['Hitpoints']['level'];
$hitpointsexp = $out['Hitpoints']['xp'];
$rangedrank = $out['Ranged']['rank'];
$rangedlevel = $out['Ranged']['level'];
$rangedexp = $out['Ranged']['xp'];
$prayerrank = $out['Prayer']['rank'];
$prayerlevel = $out['Prayer']['level'];
$prayerexp = $out['Prayer']['xp'];
$magicrank = $out['Magic']['rank'];
$magiclevel = $out['Magic']['level'];
$magicexp = $out['Magic']['xp'];
$cookingrank = $out['Cooking']['rank'];
$cookinglevel = $out['Cooking']['level'];
$cookingexp = $out['Cooking']['xp'];
$woodcuttingrank = $out['Woodcutting']['rank'];
$woodcuttinglevel = $out['Woodcutting']['level'];
$woodcuttingexp = $out['Woodcutting']['xp'];
$fletchingrank = $out['Fletching']['rank'];
$fletchinglevel = $out['Fletching']['level'];
$fletchingexp = $out['Fletching']['xp'];
$fishingrank = $out['Fishing']['rank'];
$fishinglevel = $out['Fishing']['level'];
$fishingexp = $out['Fishing']['xp'];
$firemakingrank = $out['Firemaking']['rank'];
$firemakinglevel = $out['Firemaking']['level'];
$firemakingexp = $out['Firemaking']['xp'];
$craftingrank = $out['Crafting']['rank'];
$craftinglevel = $out['Crafting']['level'];
$craftingexp = $out['Crafting']['xp'];
$smithingrank = $out['Smithing']['rank'];
$smithinglevel = $out['Smithing']['level'];
$smithingexp = $out['Smithing']['xp'];
$miningrank = $out['Mining']['rank'];
$mininglevel = $out['Mining']['level'];
$miningexp = $out['Mining']['xp'];
$herblorerank = $out['Herblore']['rank'];
$herblorelevel = $out['Herblore']['level'];
$herbloreexp = $out['Herblore']['xp'];
$agilityrank = $out['Agility']['rank'];
$agilitylevel = $out['Agility']['level'];
$agilityexp = $out['Agility']['xp'];
$thievingrank = $out['Thieving']['rank'];
$thievinglevel = $out['Thieving']['level'];
$thievingexp = $out['Thieving']['xp'];
$slayerrank = $out['Slayer']['rank'];
$slayerlevel = $out['Slayer']['level'];
$slayerexp = $out['Slayer']['xp'];
$farmingrank = $out['Farming']['rank'];
$farminglevel = $out['Farming']['level'];
$farmingexp = $out['Farming']['xp'];
$runecraftrank = $out['Runecraft']['rank'];
$runecraftlevel = $out['Runecraft']['level'];
$runecraftexp = $out['Runecraft']['xp'];
$hunterrank = $out['Hunter']['rank'];
$hunterlevel = $out['Hunter']['level'];
$hunterexp = $out['Hunter']['xp'];
$constructionrank = $out['Construction']['rank'];
$constructionlevel = $out['Construction']['level'];
$constructionexp = $out['Construction']['xp'];
$summoningrank = $out['Summoning']['rank'];
$summoninglevel = $out['Summoning']['level'];
$summoningexp = $out['Summoning']['xp'];
$combatlevel = combatLevel($attacklevel, $defencelevel, $strengthlevel, $hitpointslevel, $prayerlevel, $rangedlevel, $magiclevel, $summoninglevel);
}
}
?>
function getStats($name) {
// Create an array of skills
$skills = array('Overall', 'Attack', 'Defence', 'Strength', 'Hitpoints', 'Ranged', 'Prayer', 'Magic', 'Cooking', 'Woodcutting', 'Fletching', 'Fishing', 'Firemaking', 'Crafting', 'Smithing', 'Mining', 'Herblore', 'Agility', 'Thieving', 'Slayer', 'Farming', 'Runecraft', 'Hunter', 'Construction', 'Summoning', 'Duel Tournament', 'Bounty Hunters', 'Bounty Hunter Rogues', 'Fist of Guthix');
$hs = @file_get_contents('http://hiscore.runescape.com/index_lite.ws?player=' . $name);
$out = Array();
if (! $hs)
return null;
if (strpos($hs, '404 - Page not found'))
return null;
$stats = explode("\n", $hs);
print_r($stats);
// Loop through the skills
for($i = 0; $i<count($skills);$i++) {
// Explode each skill into 3 values - rank, level, exp
$stat = explode(',', $stats[$i]);
print_r($stat);
$out[$skills[$i]] = Array();
$out[$skills[$i]]['rank'] = $stat[0];
$out[$skills[$i]]['level'] = $stat[1];
$out[$skills[$i]]['xp'] = $stat[2];
}
return $out;
}
function combatLevel($attack, $defence, $strength, $hp, $prayer, $ranged, $magic, $summoning) {
$base = ($defence + $hp + floor($prayer / 2) + floor($summoning / 2)) * 0.25;
$melee = ($attack + $strength) * 0.325;
$ranger = floor($ranged * 1.5) * 0.325;
$mage = floor($magic * 1.5) * 0.325;
return $base + max($melee, $ranger, $mage);
}
include'include/config.php';
$result = mysql_query("SELECT id,username FROM `users`");
while($row = mysql_fetch_array( $result )) {
$out = getStats($row['username']);
if (!empty($out)){
$now = time();
$user = $row['id'];
$overallrank = $out['Overall']['rank'];
$overalllevel = $out['Overall']['level'];
$overallexp = $out['Overall']['xp'];
$attackrank = $out['Attack']['rank'];
$attacklevel = $out['Attack']['level'];
$attackexp = $out['Attack']['xp'];
$strengthrank = $out['Strength']['rank'];
$strengthlevel = $out['Strength']['level'];
$strengthexp = $out['Strength']['xp'];
$defencerank = $out['Defence']['rank'];
$defencelevel = $out['Defence']['level'];
$defenceexp = $out['Defence']['xp'];
$hitpointsrank = $out['Hitpoints']['rank'];
$hitpointslevel = $out['Hitpoints']['level'];
$hitpointsexp = $out['Hitpoints']['xp'];
$rangedrank = $out['Ranged']['rank'];
$rangedlevel = $out['Ranged']['level'];
$rangedexp = $out['Ranged']['xp'];
$prayerrank = $out['Prayer']['rank'];
$prayerlevel = $out['Prayer']['level'];
$prayerexp = $out['Prayer']['xp'];
$magicrank = $out['Magic']['rank'];
$magiclevel = $out['Magic']['level'];
$magicexp = $out['Magic']['xp'];
$cookingrank = $out['Cooking']['rank'];
$cookinglevel = $out['Cooking']['level'];
$cookingexp = $out['Cooking']['xp'];
$woodcuttingrank = $out['Woodcutting']['rank'];
$woodcuttinglevel = $out['Woodcutting']['level'];
$woodcuttingexp = $out['Woodcutting']['xp'];
$fletchingrank = $out['Fletching']['rank'];
$fletchinglevel = $out['Fletching']['level'];
$fletchingexp = $out['Fletching']['xp'];
$fishingrank = $out['Fishing']['rank'];
$fishinglevel = $out['Fishing']['level'];
$fishingexp = $out['Fishing']['xp'];
$firemakingrank = $out['Firemaking']['rank'];
$firemakinglevel = $out['Firemaking']['level'];
$firemakingexp = $out['Firemaking']['xp'];
$craftingrank = $out['Crafting']['rank'];
$craftinglevel = $out['Crafting']['level'];
$craftingexp = $out['Crafting']['xp'];
$smithingrank = $out['Smithing']['rank'];
$smithinglevel = $out['Smithing']['level'];
$smithingexp = $out['Smithing']['xp'];
$miningrank = $out['Mining']['rank'];
$mininglevel = $out['Mining']['level'];
$miningexp = $out['Mining']['xp'];
$herblorerank = $out['Herblore']['rank'];
$herblorelevel = $out['Herblore']['level'];
$herbloreexp = $out['Herblore']['xp'];
$agilityrank = $out['Agility']['rank'];
$agilitylevel = $out['Agility']['level'];
$agilityexp = $out['Agility']['xp'];
$thievingrank = $out['Thieving']['rank'];
$thievinglevel = $out['Thieving']['level'];
$thievingexp = $out['Thieving']['xp'];
$slayerrank = $out['Slayer']['rank'];
$slayerlevel = $out['Slayer']['level'];
$slayerexp = $out['Slayer']['xp'];
$farmingrank = $out['Farming']['rank'];
$farminglevel = $out['Farming']['level'];
$farmingexp = $out['Farming']['xp'];
$runecraftrank = $out['Runecraft']['rank'];
$runecraftlevel = $out['Runecraft']['level'];
$runecraftexp = $out['Runecraft']['xp'];
$hunterrank = $out['Hunter']['rank'];
$hunterlevel = $out['Hunter']['level'];
$hunterexp = $out['Hunter']['xp'];
$constructionrank = $out['Construction']['rank'];
$constructionlevel = $out['Construction']['level'];
$constructionexp = $out['Construction']['xp'];
$summoningrank = $out['Summoning']['rank'];
$summoninglevel = $out['Summoning']['level'];
$summoningexp = $out['Summoning']['xp'];
$combatlevel = combatLevel($attacklevel, $defencelevel, $strengthlevel, $hitpointslevel, $prayerlevel, $rangedlevel, $magiclevel, $summoninglevel);
}
}
?>
wat bedoel je hiermee??
*
Je moet de code direct nadat de variabel aangemaakt is neerzetten en anders moet je dat ook eens bij $stats doen en hier neerzetten.*
dat snap ik niet kan je dat beter uitleggen alsjeblieft.
* sorry voor dump :P *
hij moet ook het combat lvl uitrekenen hoe doe ik dat erbij??
dan is die goed :)
Gewoon de functie van dit script overnemen en bij het oproepen van de functie zet je er de juiste waardes in.
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
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
<?php
function combatLevel($attack, $defence, $strength, $hp, $prayer, $ranged, $magic, $summoning) {
$base = ($defence + $hp + floor($prayer / 2) + floor($summoning / 2)) * 0.25;
$melee = ($attack + $strength) * 0.325;
$ranger = floor($ranged * 1.5) * 0.325;
$mage = floor($magic * 1.5) * 0.325;
}
$rsname = $_GET['rsname'];
$d = $_GET['d'];
if (empty($rsname)) {
echo "Geen gebruikersnaam ingevoerd";
}
else {
$url = "http://hiscore.runescape.com/index_lite.ws?player=".$rsname;
$ch = curl_init();
$timeout = 5;
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$score = curl_exec($ch);
curl_close($ch);
$uitslag = preg_split("`(\n|,)`", $score);
if ($uitslag[0] == 0) { echo "Gebruikersnaam <b>" . $rsname . "</b> staat niet in de RuneScape highscores."; }
else {
$levels = array(
'Attack',
'Defence',
'Strenght',
'Hitpoints',
'Range',
'Prayer',
'Magic',
'Summoning'
);
echo "Combat lvl van <b>" . $rsname . "</b>.";
echo "\n<br /><br />\n";
echo "<table width=\"700\" border=\"0\">\n";
if ($d == 0) {
}
$i = 0;
$ii = 0;
$iiii = 2;
while ($i <= 10):
if ($uitslag[$iii] == -1) { $uitslag[$iii] = " "; }
echo "<tr>";
if ($d ==0) { echo "<td>" . $uitslag[$iii] . "</td>\n"; }
echo "</tr>";
$i++;
$iii = $iii + 3;
$iiii = $iiii + 3;
endwhile;
echo "\n</table>";
$combatlevel = combatLevel($attack, $defence, $strength, $hitpoints, $prayer, $ranged, $magic, $summoning);
echo $combatlevel;
} }
?>
function combatLevel($attack, $defence, $strength, $hp, $prayer, $ranged, $magic, $summoning) {
$base = ($defence + $hp + floor($prayer / 2) + floor($summoning / 2)) * 0.25;
$melee = ($attack + $strength) * 0.325;
$ranger = floor($ranged * 1.5) * 0.325;
$mage = floor($magic * 1.5) * 0.325;
}
$rsname = $_GET['rsname'];
$d = $_GET['d'];
if (empty($rsname)) {
echo "Geen gebruikersnaam ingevoerd";
}
else {
$url = "http://hiscore.runescape.com/index_lite.ws?player=".$rsname;
$ch = curl_init();
$timeout = 5;
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$score = curl_exec($ch);
curl_close($ch);
$uitslag = preg_split("`(\n|,)`", $score);
if ($uitslag[0] == 0) { echo "Gebruikersnaam <b>" . $rsname . "</b> staat niet in de RuneScape highscores."; }
else {
$levels = array(
'Attack',
'Defence',
'Strenght',
'Hitpoints',
'Range',
'Prayer',
'Magic',
'Summoning'
);
echo "Combat lvl van <b>" . $rsname . "</b>.";
echo "\n<br /><br />\n";
echo "<table width=\"700\" border=\"0\">\n";
if ($d == 0) {
}
$i = 0;
$ii = 0;
$iiii = 2;
while ($i <= 10):
if ($uitslag[$iii] == -1) { $uitslag[$iii] = " "; }
echo "<tr>";
if ($d ==0) { echo "<td>" . $uitslag[$iii] . "</td>\n"; }
echo "</tr>";
$i++;
$iii = $iii + 3;
$iiii = $iiii + 3;
endwhile;
echo "\n</table>";
$combatlevel = combatLevel($attack, $defence, $strength, $hitpoints, $prayer, $ranged, $magic, $summoning);
echo $combatlevel;
} }
?>
maar wat doe ik nu weer fout :(
Gewijzigd op 06/06/2010 00:08:47 door sander salemander
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
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
<?php
function combatLevel($attack, $defence, $strength, $hp, $prayer, $ranged, $magic, $summoning) {
$base = ($defence + $hp + floor($prayer / 2) + floor($summoning / 2)) * 0.25;
$melee = ($attack + $strength) * 0.325;
$ranger = floor($ranged * 1.5) * 0.325;
$mage = floor($magic * 1.5) * 0.325;
return $base + max($melee, $ranger, $mage);
}
$rsname = $_GET['rsname'];
$a = $_GET['a'];
$b = $_GET['b'];
$c = $_GET['c'];
$d = $_GET['d'];
$e = $_GET['e'];
$stats = array();
if (empty($rsname)) {
echo "Geen gebruikersnaam ingevoerd";
}
else {
$url = "http://hiscore.runescape.com/index_lite.ws?player=".$rsname;
$ch = curl_init();
$timeout = 5;
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$score = curl_exec($ch);
curl_close($ch);
$uitslag = preg_split("`(\n|,)`", $score);
if ($uitslag[0] == 0) { echo "Gebruikersnaam <b>" . $rsname . "</b> staat niet in de RuneScape highscores."; }
else {
$skills = array(
'Overall',
'Attack',
'Defence',
'Strenght',
'Hitpoints',
'Range',
'Prayer',
'Magic',
'Cooking',
'Woodcutting',
'Fletching',
'Fishing',
'Firemaking',
'Crafting',
'Smithing',
'Mining',
'Herblore',
'Agility',
'Thieving',
'Slayer',
'Farming',
'Runecrafting',
'Hunter',
'Construction',
'Summoning'
);
echo "RuneScape Hiscores van <b>" . $rsname . "</b>.";
echo "\n<br /><br />\n";
echo "<table width=\"700\" border=\"0\">\n";
if ($a == 0) {
echo "<tr>";
if ($b == 0) { echo "<td><b>Skill</b></td>\n"; }
if ($c == 0) { echo "<td><b>Rank</b></td>\n"; }
if ($d == 0) { echo "<td><b>Level</b></td>\n"; }
if ($e == 0) { echo "<td><b>Exp</b></td>\n"; }
echo "</tr>";
}
$i = 0;
$ii = 0;
$iii = 1;
$iiii = 2;
while ($i <= 24):
$uitslag[$ii] = number_format($uitslag[$ii], 0, ',', ',');
$uitslag[$iiii] = number_format($uitslag[$iiii], 0, ',', ',');
if ($uitslag[$ii] == -1) { $uitslag[$ii] = " "; }
if ($uitslag[$iii] == -1) { $uitslag[$iii] = " "; }
if ($uitslag[$iiii] == -1) { $uitslag[$iiii] = "<i>Niet gevonden</i>\n"; }
echo "<tr>";
if ($b ==0) { echo "<td><b>" . $skills[$i] . "</b></td>\n"; }
if ($c ==0) { echo "<td>" . $uitslag[$ii] . "</td>\n"; }
if ($d ==0) { echo "<td>" . $uitslag[$iii] . "</td>\n"; }
if ($e ==0) { echo "<td>" . $uitslag[$iiii] . "</td>\n"; }
echo "</tr>";
$stats[$skills[$i]] = array($uitslag[$ii],$uitslag[$iii],$uitslag[$iiii]);
$i++;
$ii = $ii + 3;
$iii = $iii + 3;
$iiii = $iiii + 3;
endwhile;
echo "<tr><td><b>Combat</b></td><td> </td><td>".combatLevel($stats['Attack'][1], $stats['Defence'][1], $stats['Strenght'][1], $stats['Hitpoints'][1], $stats['Prayer'][1], $stats['Range'][1], $stats['Magic'][1], $stats['Summoning'][1])."</td><td> </td></tr>";
echo "\n</table>";
} }
?>
function combatLevel($attack, $defence, $strength, $hp, $prayer, $ranged, $magic, $summoning) {
$base = ($defence + $hp + floor($prayer / 2) + floor($summoning / 2)) * 0.25;
$melee = ($attack + $strength) * 0.325;
$ranger = floor($ranged * 1.5) * 0.325;
$mage = floor($magic * 1.5) * 0.325;
return $base + max($melee, $ranger, $mage);
}
$rsname = $_GET['rsname'];
$a = $_GET['a'];
$b = $_GET['b'];
$c = $_GET['c'];
$d = $_GET['d'];
$e = $_GET['e'];
$stats = array();
if (empty($rsname)) {
echo "Geen gebruikersnaam ingevoerd";
}
else {
$url = "http://hiscore.runescape.com/index_lite.ws?player=".$rsname;
$ch = curl_init();
$timeout = 5;
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$score = curl_exec($ch);
curl_close($ch);
$uitslag = preg_split("`(\n|,)`", $score);
if ($uitslag[0] == 0) { echo "Gebruikersnaam <b>" . $rsname . "</b> staat niet in de RuneScape highscores."; }
else {
$skills = array(
'Overall',
'Attack',
'Defence',
'Strenght',
'Hitpoints',
'Range',
'Prayer',
'Magic',
'Cooking',
'Woodcutting',
'Fletching',
'Fishing',
'Firemaking',
'Crafting',
'Smithing',
'Mining',
'Herblore',
'Agility',
'Thieving',
'Slayer',
'Farming',
'Runecrafting',
'Hunter',
'Construction',
'Summoning'
);
echo "RuneScape Hiscores van <b>" . $rsname . "</b>.";
echo "\n<br /><br />\n";
echo "<table width=\"700\" border=\"0\">\n";
if ($a == 0) {
echo "<tr>";
if ($b == 0) { echo "<td><b>Skill</b></td>\n"; }
if ($c == 0) { echo "<td><b>Rank</b></td>\n"; }
if ($d == 0) { echo "<td><b>Level</b></td>\n"; }
if ($e == 0) { echo "<td><b>Exp</b></td>\n"; }
echo "</tr>";
}
$i = 0;
$ii = 0;
$iii = 1;
$iiii = 2;
while ($i <= 24):
$uitslag[$ii] = number_format($uitslag[$ii], 0, ',', ',');
$uitslag[$iiii] = number_format($uitslag[$iiii], 0, ',', ',');
if ($uitslag[$ii] == -1) { $uitslag[$ii] = " "; }
if ($uitslag[$iii] == -1) { $uitslag[$iii] = " "; }
if ($uitslag[$iiii] == -1) { $uitslag[$iiii] = "<i>Niet gevonden</i>\n"; }
echo "<tr>";
if ($b ==0) { echo "<td><b>" . $skills[$i] . "</b></td>\n"; }
if ($c ==0) { echo "<td>" . $uitslag[$ii] . "</td>\n"; }
if ($d ==0) { echo "<td>" . $uitslag[$iii] . "</td>\n"; }
if ($e ==0) { echo "<td>" . $uitslag[$iiii] . "</td>\n"; }
echo "</tr>";
$stats[$skills[$i]] = array($uitslag[$ii],$uitslag[$iii],$uitslag[$iiii]);
$i++;
$ii = $ii + 3;
$iii = $iii + 3;
$iiii = $iiii + 3;
endwhile;
echo "<tr><td><b>Combat</b></td><td> </td><td>".combatLevel($stats['Attack'][1], $stats['Defence'][1], $stats['Strenght'][1], $stats['Hitpoints'][1], $stats['Prayer'][1], $stats['Range'][1], $stats['Magic'][1], $stats['Summoning'][1])."</td><td> </td></tr>";
echo "\n</table>";
} }
?>
voorbeeld van aanroepen:
index.php?rsname=zezima
maarja nu nog even kijken wat ik fout deed zodat ik er nog iets van leer :P en effe de nieuwe skill dungeoneering erbij zetten maar is zo gedaan:P
ty man
als de site klaar is laat ik hem hier wel rated XD