I keep getting this error:
Parse error: parse error, unexpected $ in /usr/www/users/yoder/mr2test/scripts/giveaid.php on line 178
line 178 = ?>
what does this mean?more than likely you forgot a closing } somewhere.Maybe if you post your code, some one might be able to point out the exact problem. A 'Parse' Error means that php doesnt understand what is on that line. Because it is a ?>, as scoutt said, you have most likely missed a } or ; somewhere here is the code, it's long so i was nervous to post:
<?
require "./lib/Config.inc.php";
$reqset="Yes";
$usernumber=$_GET["usrid"];
$recipientplanet = $_POST["planetname"];
$moneysend = round($_POST["moneysend"]);
$powersend = round($_POST["powersend"]);
$populationsend = round($_POST["populationsend"]);
$probesend = round($_POST["probesend"]);
$soldiersend = round($_POST["soldiersend"]);
$scientistsend = round($_POST["scientistsend"]);
if($moneysend == "")
$moneysend = 0;
if($powersend == "")
$powersend = 0;
if($populationsend == "")
$populationsend = 0;
if($probesend == "")
$probesend = 0;
if($soldiersend == "")
$soldiersend = 0;
if($scientistsend == "")
$scientistsend = 0;
if($moneysend == 0 && $powersend ==0 && $populationsend == 0 && $probesend ==0 && $soldiersend ==0 && $scientistsend ==0 )
{
include "wonder.php";
exit();
}
connectDB();
$result = mysql_db_query($dbname,"Select * from $globalusertable where usrid='$usernumber';",$conn);
$rs=mysql_fetch_array($result);
$userid=$rs["UserNumber"];//this is the user number, a primary key.
$result = mysql_db_query($dbname,"Select * from $planettable where UserNumber='$userid';",$conn);
$rs=mysql_fetch_array($result);
$rulername=$rs["RulerName"];
$havemoney=$rs["Money"];
$havepower=$rs["Power"];
$havepopulation=$rs["Population"];
$personality=$rs["Personality"];
$galno = $rs["Plane"];
$sysno = $rs["Sphere"];
$checknewb = $rs["NewbieTime"];
$planetname=$rs["RealmName"];
$aidsgiven = $rs["DailyAidsGiven"];
$galaxy = $rs["Plane"];
$system = $rs["Sphere"];
if($checknewb > 0)
{
@mysql_close($conn);
$error="I'm sorry, $rulername, but you may not send $PDBNameaid until you have ended your period of Newbie Status.";
@mysql_close($conn);
include "aid.php";
exit();
}
//Check if sender has aids left to give
if ($aidsgiven >= _PDBAidDailyLimit_)
{
$error = "I'm sorry, $rulername, but all of your $PDBNameaid $PDBNamefleets have been sent out today. You may send them again tomorrow.";
@mysql_close($conn);
include "aid.php";
exit();
}
$moneycansend = round($money * _PDBAidMoneyLimit_);
$powercansend = round($power * _PDBAidPowerLimit_);
$populationcansend = round($population * _PDBAidPopLimit_);
$scientistcansend = round($numscientists * _PDBAidScientistsLimit_);
$soldiercansend = round($numsoldiers * _PDBAidSoldiersLimit_);
$probecansend = round($probes * _PDBAidProbesLimit_);
//Check if sender can send as much as they are trying yo
if ($moneysend > $moneycansend || $powersend > $powercansend || $populationsend > $populationcansend
|| $scientistsend > $scientistcansend || $soldiersend > $soldierscansend || $probesend > $probecansend)
{
$error = "I'm sorry, $rulername, but you do not have enough $PDBNameresources to send that much.";
@mysql_close($conn);
include "aid.php";
exit();
}
//Find the recipient
$result=mysql_query($dbname,"Select * from $planettable where RealmName='$recipientplanet';",$conn);
$getrs=mysql_fetch_array($result);
$recipientuserid = $getrs["UserNumber"];
$recipientgalaxy = $getrs2["Plane"];
$recipientsystem = $getrs3["Sphere"];
periodicUpdate($recipientuserid,$conn);
//Check if sender + recipient are in same system
if ($galaxy != $recipientgalaxy || $system != $recipientsystem)
{
$error = "You may only give $PDBNameaid to others in your own $PDBNameSystem.";
@mysql_close($conn);
include "aid.php";
exit();
}
//We've passed all the checks, now send the aid
if ($moneysend != 0 || $populationsend != 0 || $probesend != 0 or $powersend != 0)
{
//Take recources out of senders account
mysql_query($dbname,"UPDATE $planettable set money=money-$moneysend, population=population-$populationsend,
probes=probes-$probesend, power=power-$powersend
where UserNumber='$userid'",$conn);
//Add resources to recipients account
mysql_query($dbname,"UPDATE $planettable set money=money+$moneysend, population=population+$populationsend,
probes=probes+$probesend, power=power+$powersend
where UserNumber='$recipientuserid'",$conn);
}
if ($soldiersend != 0)
{
//Take recources out of senders account
mysql_query($dbname,"UPDATE $planetmilitary set Existing=Existing-$soldiersend
where UserNumber=$userid and UnitType=$soldiers",$conn);
//Add resources to recipients account
mysql_query($dbname,"UPDATE $planetmilitary set Existing=Existing+$soldiersend
where UserNumber=$recipientuserid and UnitType=$soldiers",$conn);
}
if ($scientistsend !=0)
{
//Take recources out of senders account
mysql_query($dbname,"UPDATE $planetmilitary set Existing=Existing-$scientistsend
where UserNumber=$userid and UnitType=$scientists",$conn);
//Add resources to recipients account
mysql_query($dbname,"UPDATE $planetmilitary set Existing=Existing+$scientistsend
where UserNumber=$recipientuserid and UnitType=$scientists");
}
//Now send the News and screen response
$moneysend1 = SetNumber($moneysend);
$powersend1 = SetNumber($powersend);
$populationsend1 = SetNumber($populationsend);
$probesend1 = SetNumber($probesend);
$soldiersend1 = SetNumber($soldiersend);
$scientistsend1 = SetNumber($scientistsend);
$sysnewstype=_SysNewsSystem_;
$planetaidnews="We have sent a $PDBNameaid $PDBNamefleet with $moneysend1 $PDBNamemoney, $powersend1 $PDBNamepower,
$populationsend1 $PDBNamepopulation,
$probesent1 $PDBNameprobes, $soldiersend1 $PDBNamesoldiers, and $scientistsend1 $PDBNamescientists to $recipientplanet.";
$recipientaidnews="A $PDBNameaid $PDBNamefleet has arrived from $planetname with $moneysend1 $PDBNamemoney,
$powersend1 $PDBNamepower, $populationsend1 $PDBNamepopulation,
$probesent1 $PDBNameprobes, $soldiersend1 $PDBNamesoldiers, and $scientistsend1 $PDBNamescientists.";
$sysaidnews="$planetname has sent a $PDBNameaid $PDBNamefleet to $recipientplanet.";
@mysql_db_query($dbname,"insert into $planetnews values('','$userid',NOW(),'$planetaidnews',1);",$conn);
@mysql_db_query($dbname,"insert into $planetnews values('','$recipientuserid',NOW(),'$recipientaidnews',1);",$conn);
@mysql_db_query($dbname,"Insert into $systemnews values('$galaxy','$system',NOW(),'$sysaidnews','$sysnewstype');",$conn);
$information = 'Congratulations, $rulername, our $PDBNameaid $PDBNamefleet has arrived at $recipientplanet with
$moneysend1 $PDBNameMoney, $populationsend1 $PDBNamePopulation, $probesend1 $PDBNameProbes, $powersend1 $PDBNamePower,
$soldiersend1 $PDBNameSoldiers and $scientistsend1 $PDBNameScientists.";
puNetworth($recipientuserid,$conn);
puNetworth($userid,$conn);
@mysql_close($conn);
include "aid.php";
//exit();
?>you can also upload files.
so on this line
$information = 'Congratulations,
you start with a single quote and end with a double quote. you have to use one or the other.
also you have a spot where you close the connectino twice.I see where it is closed once at the instruction:
@mysql_close($conn);
where is the second one?if($checknewb > 0)
{
@mysql_close($conn);
$error="I'm sorry, $rulername, but you may not send $PDBNameaid until you have ended your period of Newbie Status.";
@mysql_close($conn);
include "aid.php";
exit();
}
Parse error: parse error, unexpected $ in /usr/www/users/yoder/mr2test/scripts/giveaid.php on line 178
line 178 = ?>
what does this mean?more than likely you forgot a closing } somewhere.Maybe if you post your code, some one might be able to point out the exact problem. A 'Parse' Error means that php doesnt understand what is on that line. Because it is a ?>, as scoutt said, you have most likely missed a } or ; somewhere here is the code, it's long so i was nervous to post:
<?
require "./lib/Config.inc.php";
$reqset="Yes";
$usernumber=$_GET["usrid"];
$recipientplanet = $_POST["planetname"];
$moneysend = round($_POST["moneysend"]);
$powersend = round($_POST["powersend"]);
$populationsend = round($_POST["populationsend"]);
$probesend = round($_POST["probesend"]);
$soldiersend = round($_POST["soldiersend"]);
$scientistsend = round($_POST["scientistsend"]);
if($moneysend == "")
$moneysend = 0;
if($powersend == "")
$powersend = 0;
if($populationsend == "")
$populationsend = 0;
if($probesend == "")
$probesend = 0;
if($soldiersend == "")
$soldiersend = 0;
if($scientistsend == "")
$scientistsend = 0;
if($moneysend == 0 && $powersend ==0 && $populationsend == 0 && $probesend ==0 && $soldiersend ==0 && $scientistsend ==0 )
{
include "wonder.php";
exit();
}
connectDB();
$result = mysql_db_query($dbname,"Select * from $globalusertable where usrid='$usernumber';",$conn);
$rs=mysql_fetch_array($result);
$userid=$rs["UserNumber"];//this is the user number, a primary key.
$result = mysql_db_query($dbname,"Select * from $planettable where UserNumber='$userid';",$conn);
$rs=mysql_fetch_array($result);
$rulername=$rs["RulerName"];
$havemoney=$rs["Money"];
$havepower=$rs["Power"];
$havepopulation=$rs["Population"];
$personality=$rs["Personality"];
$galno = $rs["Plane"];
$sysno = $rs["Sphere"];
$checknewb = $rs["NewbieTime"];
$planetname=$rs["RealmName"];
$aidsgiven = $rs["DailyAidsGiven"];
$galaxy = $rs["Plane"];
$system = $rs["Sphere"];
if($checknewb > 0)
{
@mysql_close($conn);
$error="I'm sorry, $rulername, but you may not send $PDBNameaid until you have ended your period of Newbie Status.";
@mysql_close($conn);
include "aid.php";
exit();
}
//Check if sender has aids left to give
if ($aidsgiven >= _PDBAidDailyLimit_)
{
$error = "I'm sorry, $rulername, but all of your $PDBNameaid $PDBNamefleets have been sent out today. You may send them again tomorrow.";
@mysql_close($conn);
include "aid.php";
exit();
}
$moneycansend = round($money * _PDBAidMoneyLimit_);
$powercansend = round($power * _PDBAidPowerLimit_);
$populationcansend = round($population * _PDBAidPopLimit_);
$scientistcansend = round($numscientists * _PDBAidScientistsLimit_);
$soldiercansend = round($numsoldiers * _PDBAidSoldiersLimit_);
$probecansend = round($probes * _PDBAidProbesLimit_);
//Check if sender can send as much as they are trying yo
if ($moneysend > $moneycansend || $powersend > $powercansend || $populationsend > $populationcansend
|| $scientistsend > $scientistcansend || $soldiersend > $soldierscansend || $probesend > $probecansend)
{
$error = "I'm sorry, $rulername, but you do not have enough $PDBNameresources to send that much.";
@mysql_close($conn);
include "aid.php";
exit();
}
//Find the recipient
$result=mysql_query($dbname,"Select * from $planettable where RealmName='$recipientplanet';",$conn);
$getrs=mysql_fetch_array($result);
$recipientuserid = $getrs["UserNumber"];
$recipientgalaxy = $getrs2["Plane"];
$recipientsystem = $getrs3["Sphere"];
periodicUpdate($recipientuserid,$conn);
//Check if sender + recipient are in same system
if ($galaxy != $recipientgalaxy || $system != $recipientsystem)
{
$error = "You may only give $PDBNameaid to others in your own $PDBNameSystem.";
@mysql_close($conn);
include "aid.php";
exit();
}
//We've passed all the checks, now send the aid
if ($moneysend != 0 || $populationsend != 0 || $probesend != 0 or $powersend != 0)
{
//Take recources out of senders account
mysql_query($dbname,"UPDATE $planettable set money=money-$moneysend, population=population-$populationsend,
probes=probes-$probesend, power=power-$powersend
where UserNumber='$userid'",$conn);
//Add resources to recipients account
mysql_query($dbname,"UPDATE $planettable set money=money+$moneysend, population=population+$populationsend,
probes=probes+$probesend, power=power+$powersend
where UserNumber='$recipientuserid'",$conn);
}
if ($soldiersend != 0)
{
//Take recources out of senders account
mysql_query($dbname,"UPDATE $planetmilitary set Existing=Existing-$soldiersend
where UserNumber=$userid and UnitType=$soldiers",$conn);
//Add resources to recipients account
mysql_query($dbname,"UPDATE $planetmilitary set Existing=Existing+$soldiersend
where UserNumber=$recipientuserid and UnitType=$soldiers",$conn);
}
if ($scientistsend !=0)
{
//Take recources out of senders account
mysql_query($dbname,"UPDATE $planetmilitary set Existing=Existing-$scientistsend
where UserNumber=$userid and UnitType=$scientists",$conn);
//Add resources to recipients account
mysql_query($dbname,"UPDATE $planetmilitary set Existing=Existing+$scientistsend
where UserNumber=$recipientuserid and UnitType=$scientists");
}
//Now send the News and screen response
$moneysend1 = SetNumber($moneysend);
$powersend1 = SetNumber($powersend);
$populationsend1 = SetNumber($populationsend);
$probesend1 = SetNumber($probesend);
$soldiersend1 = SetNumber($soldiersend);
$scientistsend1 = SetNumber($scientistsend);
$sysnewstype=_SysNewsSystem_;
$planetaidnews="We have sent a $PDBNameaid $PDBNamefleet with $moneysend1 $PDBNamemoney, $powersend1 $PDBNamepower,
$populationsend1 $PDBNamepopulation,
$probesent1 $PDBNameprobes, $soldiersend1 $PDBNamesoldiers, and $scientistsend1 $PDBNamescientists to $recipientplanet.";
$recipientaidnews="A $PDBNameaid $PDBNamefleet has arrived from $planetname with $moneysend1 $PDBNamemoney,
$powersend1 $PDBNamepower, $populationsend1 $PDBNamepopulation,
$probesent1 $PDBNameprobes, $soldiersend1 $PDBNamesoldiers, and $scientistsend1 $PDBNamescientists.";
$sysaidnews="$planetname has sent a $PDBNameaid $PDBNamefleet to $recipientplanet.";
@mysql_db_query($dbname,"insert into $planetnews values('','$userid',NOW(),'$planetaidnews',1);",$conn);
@mysql_db_query($dbname,"insert into $planetnews values('','$recipientuserid',NOW(),'$recipientaidnews',1);",$conn);
@mysql_db_query($dbname,"Insert into $systemnews values('$galaxy','$system',NOW(),'$sysaidnews','$sysnewstype');",$conn);
$information = 'Congratulations, $rulername, our $PDBNameaid $PDBNamefleet has arrived at $recipientplanet with
$moneysend1 $PDBNameMoney, $populationsend1 $PDBNamePopulation, $probesend1 $PDBNameProbes, $powersend1 $PDBNamePower,
$soldiersend1 $PDBNameSoldiers and $scientistsend1 $PDBNameScientists.";
puNetworth($recipientuserid,$conn);
puNetworth($userid,$conn);
@mysql_close($conn);
include "aid.php";
//exit();
?>you can also upload files.
so on this line
$information = 'Congratulations,
you start with a single quote and end with a double quote. you have to use one or the other.
also you have a spot where you close the connectino twice.I see where it is closed once at the instruction:
@mysql_close($conn);
where is the second one?if($checknewb > 0)
{
@mysql_close($conn);
$error="I'm sorry, $rulername, but you may not send $PDBNameaid until you have ended your period of Newbie Status.";
@mysql_close($conn);
include "aid.php";
exit();
}