Jump to content
MakeWebGames

Can't solve Parse error: syntax error, unexpected T_VARIABLE error??


Recommended Posts

Hello, so i've just installed this mod on my site to allow users to use a donator pack and get given the items/bonus associated with it. However when the "use" function on the pack it links to this script. however i get the following error:

Parse error: syntax error, unexpected T_VARIABLE in /home/a3629762/public_html/dpuse.php on line 5

Can someone help me please, i can't seem to correct the code to remove the error.

Here's the link to the original modification posting:

http://makewebgames.io/showthread.php/31728-mccode-v2-Donator-Packs-To-Items

here's the script "dpuse.php"

 

<?php

include "global_func.php";
*
$_GET[iD] = abs((int) $_GET[iD]);
*
if(!$_GET[iD]) { echo '<h2>Oops</h2>Invalid use of file'; }
*
else
*
{
*
$i=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_id={$_GET[iD]} AND iv.inv_userid=$userid");
*
}
*
if(!$db->num_rows($i)) { print "<h2>Oops</h2>Invalid item ID"; }
*
else
*
{
*
$r=$db->fetch_row($i);
if($r[itmid] == 8)
*
{
*
*
$db->query("UPDATE users SET donatordays=donatordays+30 WHERE userid=$userid");
*
$db->query("UPDATE users SET money=money+0 WHERE userid=$userid");
*
$db->query("UPDATE users SET crystals=crystals+0 WHERE userid=$userid");
$db->query("UPDATE userstats SET IQ=IQ+120 WHERE userid=$userid");
*
*
*
echo '<h2>Donator Pack</h2>You have used your donator pack!';
*
}
*
item_remove($userid, $r['inv_itemid'], 1);
*
}
$h->endpage();
*
?>
Link to comment
Share on other sites

The code you copied from some site has asterisks in it. Maybe its supposed to, but i never seen that in php before.

Does this work?

<?php
include "global_func.php";
$_GET[iD] = abs((int) $_GET[iD]);
if(!$_GET[iD]) { echo '<h2>Oops</h2>Invalid use of file'; }
else
{
  $i=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_id={$_GET[iD]} AND iv.inv_userid=$userid");
}
if(!$db->num_rows($i)) { print "<h2>Oops</h2>Invalid item ID"; }
else
{
  $r=$db->fetch_row($i);
  if($r[itmid] == 8)
  {
     $db->query("UPDATE users SET donatordays=donatordays+30 WHERE userid=$userid");
     $db->query("UPDATE users SET money=money+0 WHERE userid=$userid");
     $db->query("UPDATE users SET crystals=crystals+0 WHERE userid=$userid");
     $db->query("UPDATE userstats SET IQ=IQ+120 WHERE userid=$userid");
     echo '<h2>Donator Pack</h2>You have used your donator pack!';
  }
  item_remove($userid, $r['inv_itemid'], 1);
}
$h->endpage();
?>
Link to comment
Share on other sites

haha good one

$db->query("UPDATE users SET money=money+0 WHERE userid=$userid");

$db->query("UPDATE users SET crystals=crystals+0 WHERE userid=$userid");

Those are the type of things that usually keep me up all night trying to figure out what the developer wanted to do.

I think it's supposed to be +1, but still not very optimal to use two queries to update the same table.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...