unexpected T_VARIABLE & T_LNUMBER

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Niels B

Niels B

04/08/2010 18:28:04
Quote Anchor link
Ok, ik heb niet zoveel verstand van PHP, maar ik heb dus een "klikken voor adoptables" systeem proberen maken voor mn aodptable site. Dus als je bv. 1000 adoptable's hebt geklikt krijg je een speciale "promo" adoptable. Dit is mn code (volledige levelup.php)
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
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
<?php

// **********************************************************************
// Rusnak PHP Adoptables Script
// Copyright 2009 Brandon Rusnak
// For help and support: http://www.rusnakweb.com/forum/
//
// Redistribution prohibited without written permission
// **********************************************************************

// Wake the sleeping giant

// **********************************************************************
// Basic Configuration Info
// **********************************************************************


include("inc/functions.php");
include("inc/config.php");
include("lang/lang.php");

$themeurl = grabanysetting("themeurl");

// **********************************************************************
// Define our top links by calling getlinks()
// **********************************************************************


$links = getlinks();

// **********************************************************************
// Define our ads by calling getads()
// **********************************************************************


$ads = getads("any");

// **********************************************************************
// Grab any dynamic article content from the content table
// **********************************************************************


$pagecontent = getsitecontent("index");
$article_title = $pagecontent[title];
$article_content = $pagecontent[content];
$article_content = nl2br($article_content);

// **********************************************************************
// Grab any settings that we will need for the current page from the DB
// **********************************************************************


$browsertitle = grabanysetting("browsertitle");
$sitename = grabanysetting("sitename");
$slogan = grabanysetting("slogan");

// **********************************************************************
// Check and see if the user is logged in to the site
// **********************************************************************


$loginstatus = logincheck();
$isloggedin = $loginstatus[loginstatus];
$loggedinname = $loginstatus[username];

// **********************************************************************
// End Prepwork - Output the page to the user
// **********************************************************************


$id = $_GET["id"];
$id = preg_replace("/[^a-zA-Z0-9s]/", "", $id);
$id = secure($id);

if($id == "" or !is_numeric($id)){

// If the ID is blank or non-numeric, then it is invalid...

$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;

}

else{

// We have what appears to be a valid adoptable ID, so we pull the adoptable's information from the database...

$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE aid='$id'";
$result = mysql_query($query);
$num = mysql_numrows($result);

$query2 = "SELECT * FROM ".$prefix."users WHERE username='$loginstatus[username]'";
$result2 = mysql_query($query2);
$num2 = mysql_numrows($result2);

$query3 = "SELECT * FROM ".$prefix."users WHERE username='$loginstatus[username]'";
$result2 = mysql_query($query3);
$num2 = mysql_numrows($result3);

$query4 = "SELECT * FROM ".$prefix."users WHERE username='$loginstatus[username]'";
$result2 = mysql_query($query4);
$num2 = mysql_numrows($result4);


//Loop out code

$i=0;
while ($i < 1) {

$aid=@mysql_result($result,$i,"aid");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$currentlevel=@mysql_result($result,$i,"currentlevel");
$usealternates=@mysql_result($result,$i,"usealternates");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$owner=@mysql_result($result,$i,"owner");
$totalcoins=@mysql_result($result2,$i,"coins");
$totaleventkliks=@mysql_result($result,$i,"eventkliks");
$i++;
}


if($aid == $id){

// The adoptable does exist, so now we need to see if we can vote...
// We need to get the date today and the user's IP address (if is guest we use this)


$date = date('Y-m-d');

$ip = $_SERVER['REMOTE_ADDR'];
$ip = preg_replace("/[^a-zA-Z0-9@._-]/", "", $ip);
$ip = secure($ip);

$num = 0;

if($isloggedin == "yes"){

// If we are logged in, we check if a user with our username voted for this adoptable today...

$query = "SELECT * FROM ".$prefix."vote_voters WHERE adoptableid='$id' and username = '$loggedinname' and date = '$date'";

}

else{

$query = "SELECT * FROM ".$prefix."vote_voters WHERE adoptableid='$id' and ip = '$ip' and date = '$date'";


}
// End the is logged in check else statement


// Check what the number for the query is...


$result = mysql_query($query);
$num = mysql_numrows($result);

   if($num == 0){

   // The number of results is still zero, so we did not vote on this adoptable yet today...
  
   // Now we see if the adoptable is frozen by its owner.  If it is, we do not level...


   if($isfrozen == "yes"){

   $article_title = $lang_isfrozen_title;
   $article_content = $lang_isfrozen_explain;

   }

   else{

   // Adoptable is NOT frozen, so I think we can actually proceed with the leveling up of this adoptable...
   $random = rand(1, 10);
        $willekeurig = rand(1, 2);

  
   $neweventkliks = $totaleventkliks + 1;
   $newclicks = $totalclicks + 1;
   $newcoins = $totalcoins + $random; // Add 1 click to the current click total of this adoptable...
   $totaleventkliksnodig = 1000 - $totaleventkliks
   // Actually insert our click information into the database...


   $query4 = "UPDATE ".$prefix."users SET eventkliks='".$neweventkliks."' WHERE username='".$loginstatus[username]."'";
   mysql_query($query2);


   $query2 = "UPDATE ".$prefix."users SET coins='".$newcoins."' WHERE username='".$loginstatus[username]."'";
   mysql_query($query2);

   $query = "UPDATE ".$prefix."owned_adoptables SET totalclicks='".$newclicks."' WHERE aid='".$id."'";
   mysql_query($query);

   // Now we need to update our vote_voters table with the user's vote...

   mysql_query("INSERT INTO ".$prefix."vote_voters VALUES ('$date', '$loggedinname', '$ip','$id')");

   // Now we need to see if we actually level this adoptable up...
   // See if another level actually exists...


   $nextlevelexists = getnextlevelexists($type, $currentlevel);

   if($nextlevelexists == "true"){

   // A higher level does exist, so we see if it is time to level up

   $nextlevel = $currentlevel + 1;

   $query = "SELECT * FROM ".$prefix."levels WHERE adoptiename='$type' and thisislevel='$nextlevel'";
   $result = mysql_query($query);
   $num = mysql_numrows($result);

   //Loop out code
  
        $i=0;
   while ($i < 1) {

   $requiredclicks=@mysql_result($result,$i,"requiredclicks");  // The number of clicks required for the next level

   $i++;
   }
  

   // Check if the number of clicks we have now is greater than or equal to the required clicks to level up...

   if($newclicks >= $requiredclicks and $requiredclicks != 0 and $requiredclicks != ""){

   // We need to level this adoptable up...

  

   $query = "UPDATE ".$prefix."owned_adoptables SET currentlevel='".$nextlevel."' WHERE aid='".$id."'";
   mysql_query($query);

   // Now we check if we are enabling alternate images...
  
   $parentid = converttypetoparentid($type); // Get the ID of the parent type adoptable
   $altstatus = getaltstatus($parentid, $id, $nextlevel); // Check if we are using alternate images or not...

   if($altstatus == "yes"){

   // We are enabling alternate images for this adoptable...

   $query = "UPDATE ".$prefix."owned_adoptables SET usealternates='yes' WHERE aid='".$id."'";
   mysql_query($query);


   }


   // Now we can see if the adoptable's owner gets a reward...
   // The reward function will take care of sending out any reward that exists...


   $rewardstatus = reward($id, $type, $nextlevel, $owner);

  

   }
// End the if statement if we are leveling the adoptable up


  
   }

   // Show a thank you message along with the adoptable's information to the user...
if($willekeurig == 2) {
  $melding = '<center><br><span style="font-size: large">GEFELICITEERD!</span><br> <img src="http://pokepets.webege.com/adoptables/afbeeldingen/normalepokemonsprites/146.gif" <br><br> Je hebt een Moltres gewonnen! <br> Klik hier om je Moltres te adopteeren.</center> ';
  mysql_query("INSERT INTO ".$prefix."owned_adoptables VALUES ('', 'Moltres', 'Moltres','$loggedinname','1','1', 'rand()', 'http://www.pokepets.webege.com/adoptables/afbeeldingen/Normaal/146.gif','no','notfortrade','no',')");  
}

else {
  $melding = 'Sorry, probeer het nog eens.';
}

// Klikken voor adoptable...
if($totaleventkliks == 1000) {
  $eventkliksmelding = '<center><br><span style="font-size: large">GEFELICITEERD!</span><br> Je hebt genoeg adoptables geklikt voor een ...! <br> Klik hier om je .... te adopteeren.</center> ';  
}

else {
  $eventkliksmelding = 'Je hebt al $totaleventkliks adoptables geklikt, je moet nog $totaleventkliksnodig adoptables klikken om een ... te krijgen.';
}



  
$image = getcurrentimage($id); // Get the current image of the adoptable...

   $article_title = $lang_gave."".$name." 1 ".$lang_unit;
   $article_content = "<center><img src='".$image."'><br>".$lang_gave."".$name." 1 ".$lang_unit.".
<br><b>Voor het trainen van deze Pokemon kreeg je $"
.$random." PokéDollar!<br> Je hebt nu $".$newcoins." PokéDollar.</b><br>$eventkliksmelding
<br><img src='http://pokepets.webege.com/adoptables/slotmachine/"
.$willekeurig.".jpg'> <br>
"
.$melding." </center>
<br>"
.$lang_levelup_encourage;

   }
// Adoptable is not frozen, end isfrozen else check
  


  

   }
   else{

   // We already voted on this adoptable today, so show an error...

      if($isloggedin == "yes"){

      $article_title = $lang_alreadyleveled_title;
      $article_content = $lang_member_alreadyleveled;

      }

      else{

      $article_title = $lang_alreadyleveled_title;;
      $article_content = $lang_guest_alreadyleveled;


      }

   }


}

else{

// Adoptable is invalid, show an error...

$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;

}



}
// End the ID is not blank and is numeric else check


// **********************************************************************
// Begin Template Definition
// **********************************************************************

//Define our current theme

$file = $themeurl;

// Do the template changes and echo the ready template
$template = file_get_contents($file);

$template = replace(':ARTICLETITLE:',$article_title,$template);
$template = replace(':ARTICLECONTENT:',$article_content,$template);
$template = replace(':ARTICLEDATE:',$article_date,$template);

$template = replace(':BROWSERTITLE:',$browsertitle,$template);
$template = replace(':SITENAME:',$sitename,$template);

//Define our links
$template = replace(':LINKSBAR:',$links,$template);

//Get the content for the side bar...

$sidebar = getsidebar();
$template = replace(':SIDEFEED:',$sidebar,$template);

//Get the ad content...
$template = replace(':ADS:',$ads,$template);

//Get the slogan info
$template = replace(':SLOGAN:',$slogan,$template);


echo $template;

// **********************************************************************
// End Template Definition
// **********************************************************************




?>


Mn probleem is nu als dit als levelup.php gebruik krijg ik deze error;
Parse error: syntax error, unexpected T_LNUMBER in /home/a2850873/public_html/adoptables/levelup.php on line 266

Wat is er mis? Alvast bedankt ;)
EDIT: Dit krijg ik ook :S
Parse error: syntax error, unexpected T_VARIABLE in /home/a2850873/public_html/adoptables/levelup.php on line 174
Gewijzigd op 04/08/2010 18:42:06 door Niels B
 
PHP hulp

PHP hulp

28/12/2024 04:28:49
 
- SanThe -

- SanThe -

04/08/2010 18:51:08
Quote Anchor link
Graag alleen relevante code en geen compleet script.
 
Niels B

Niels B

04/08/2010 19:05:04
Quote Anchor link
Wat bedoel je :S, & ik moet de voledige code toch wel posten? Anders klopt de error niet meer.
 
Justin S

Justin S

04/08/2010 20:03:06
Quote Anchor link
Op regel 174 mist een puntkomma

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
;


Op 266 moet je dubbele quotes gebruiken, geen enkele omdat je een $var direct in de string zet.
Gewijzigd op 04/08/2010 20:05:07 door Justin S
 
Niels B

Niels B

05/08/2010 10:18:07
Quote Anchor link
Bedankt, voor je hulp.
Maar als ik op lijn 174 nog een puntkomma (op het einde) plaats blijf ik dezelfde error krijgen :S.
 
Obelix Idefix

Obelix Idefix

05/08/2010 11:18:10
Quote Anchor link
En als je de opmerking van Justin Streuper over regel 266 verwerkt?
 
Milo S

Milo S

05/08/2010 11:49:00
Quote Anchor link
Je moet kijken naar 170 daar mist hij puntkomma
 



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.