Jump to content

[SOLVED] HTTP error and Parse Error - I get HTTP, friend gets Parse :S


MasterACE14

Recommended Posts

Afternoon Everyone,

 

I have just finished making a script, which basically updates a users account depending on what button they pressed on the previous page, everything looks fine to me, but when I click a button, I get a big HTTP error page, but the strange thing is, when my friend press's a button, he gets a parse error.

 

here is my friends parse error:

Parse error: syntax error, unexpected T_ELSEIF in /home/ace/public_html/conflictingforces/lib/ability_result.php on line 86

 

here is my script(neccesary parts only):

<?php

strikeops_price = addslashes($_POST["strikeopsprice"]);
$defenceops_price = addslashes($_POST["defenceopsprice"]);
$covertops_price = addslashes($_POST["covertopsprice"]);

$strikeops_amount = addslashes($_POST["strikeopsamount"]);
$defenceops_amount = addslashes($_POST["defenceopsamount"]);
$covertops_amount = addslashes($_POST["covertopsamount"]);


// if its a strike ops upgrade do this
if( isset($strikeops_price) ) {

if($player_money >= $strikeops_price) 
{
  
  // run the queries for you - update your money
  $sql = "UPDATE `cf_users` SET `money` = money-'$strikeops_price' WHERE `id`='" . $player_accountid . "' LIMIT 1";
  $rs = mysql_query($sql) or die('Query:<br />' . $sql . '<br /><br />Error:<br />' . mysql_error());

  // run the queries for you - update your strike ops
  $sqll = "UPDATE `cf_users` SET `level_strikeops` = level_strikeops+1 WHERE `id`='" . $player_accountid . "' LIMIT 1";
  $rss = mysql_query($sqll) or die('Query:<br />' . $sqll . '<br /><br />Error:<br />' . mysql_error());  
  
  // run the queries for you - update your strike ops price/amount
  $sqlll = "UPDATE `cf_users` SET `amount_strikeops` = amount_strikeops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
  $rsss = mysql_query($sqlll) or die('Query:<br />' . $sqlll . '<br /><br />Error:<br />' . mysql_error());    
  
  // run the queries for you - update your strike ops price/amount
  $sqllll = "UPDATE `cf_users` SET `price_strikeops` = price_strikeops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
  $rssss = mysql_query($sqllll) or die('Query:<br />' . $sqllll . '<br /><br />Error:<br />' . mysql_error()); 
  
}

else {

echo("<center>You do not have enough money</center>");

}

};


// if its a defence ops upgrade do this
elseif( isset($defenceops_price) ) {

if($player_money >= $defenceops_price) 
{

  // run the queries for you - update your money
  $sqlx = "UPDATE `cf_users` SET `money` = money-'$defenceops_price' WHERE `id`='" . $player_accountid . "' LIMIT 1";
  $rsx = mysql_query($sqlx) or die('Query:<br />' . $sqlx . '<br /><br />Error:<br />' . mysql_error());

  // run the queries for you - update your strike ops
  $sqlxx = "UPDATE `cf_users` SET `level_defenceops` = level_defenceops+1 WHERE `id`='" . $player_accountid . "' LIMIT 1";
  $rsxx = mysql_query($sqlxx) or die('Query:<br />' . $sqlxx . '<br /><br />Error:<br />' . mysql_error());  
  
  // run the queries for you - update your strike ops price/amount
  $sqlxxx = "UPDATE `cf_users` SET `amount_defenceops` = amount_defenceops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
  $rsxxx = mysql_query($sqlxxx) or die('Query:<br />' . $sqlxxx . '<br /><br />Error:<br />' . mysql_error());  
  
  // run the queries for you - update your strike ops price/amount
  $sqlxxxx = "UPDATE `cf_users` SET `price_defenceops` = price_defenceops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
  $rsxxxx = mysql_query($sqlxxxx) or die('Query:<br />' . $sqlxxxx . '<br /><br />Error:<br />' . mysql_error()); 

}

else {

echo("<center>You do not have enough money</center>");

}

};


// if its a covert ops upgrade do this
elseif( isset($covertops_price) ) {

if($player_money >= $covertops_price) 
{

  // run the queries for you - update your money
  $sqly = "UPDATE `cf_users` SET `money` = money-'$covertops_price' WHERE `id`='" . $player_accountid . "' LIMIT 1";
  $rsy = mysql_query($sqly) or die('Query:<br />' . $sqly . '<br /><br />Error:<br />' . mysql_error());

  // run the queries for you - update your strike ops
  $sqlyy = "UPDATE `cf_users` SET `level_covertops` = level_covertops+1 WHERE `id`='" . $player_accountid . "' LIMIT 1";
  $rsyy = mysql_query($sqlyy) or die('Query:<br />' . $sqlyy . '<br /><br />Error:<br />' . mysql_error());  
  
  // run the queries for you - update your strike ops price/amount
  $sqlyyy = "UPDATE `cf_users` SET `amount_covertops` = amount_covertops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
  $rsyyy = mysql_query($sqlyyy) or die('Query:<br />' . $sqlyyy . '<br /><br />Error:<br />' . mysql_error());  

  // run the queries for you - update your strike ops price/amount
  $sqlyyyy = "UPDATE `cf_users` SET `price_covertops` = price_covertops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
  $rsyyyy = mysql_query($sqlyyyy) or die('Query:<br />' . $sqlyyyy . '<br /><br />Error:<br />' . mysql_error());   
  
}

else {

echo("<center>You do not have enough money</center>");

}

};


// if the user came to the page via the URL or any other way then upgrading display this
else {

echo("<center>You did not train anything</center>");

};

?>

 

Any help is greatly appreciated  :)

 

Regards ACE

Link to comment
Share on other sites

here is line 86:

elseif( isset($defenceops_price) ) {

 

and here is the error:

ERROR

The requested URL could not be retrieved

 

While trying to process the request:

 

POST http://www.crikeygames.com.au/conflictingforces/index.php?page=ability_result HTTP/1.1

Host: www.crikeygames.com.au

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7

Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 300

Connection: close

Referer: http://www.crikeygames.com.au/conflictingforces/index.php?page=ability

Cookie: admin=QUNFOjgzYmRlMTE5OThlNGMwNzc0YTZhMmMyZThhODA2ZmExOg%3D%3D; phpbb2mysql_data=a%3A2%3A%7Bs%3A11%3A%22autologinid%22%3Bs%3A0%3A%22%22%3Bs%3A6%3A%22userid%22%3Bi%3A-1%3B%7D; lang=english; user=MjpBQ0U6ODNiZGUxMTk5OGU0YzA3NzRhNmEyYzJlOGE4MDZmYTE6MTA6OjA6MDowOjA6OjQwOTY%3D; PHPSESSID=0f435c8d7f8c37a31904da664ae2cdb8; turbosid=f39fa683a219cb9a2e41a6093e221b46; dkgame=3+ACE+d11cfbf3ee13c52b62c06a2d60d9094f+0

 

The following error was encountered:

 

    * Invalid Request

 

Some aspect of the HTTP Request is invalid. Possible problems:

 

    * Missing or unknown request method

    * Missing URL

    * Missing HTTP Identifier (HTTP/1.0)

    * Request is too large

    * Content-Length missing for POST or PUT requests

    * Illegal character in hostname; underscores are not allowed

 

Your cache administrator is webmaster.

Generated Sat, 27 Oct 2007 02:12:40 GMT by localhost (squid/2.5.STABLE9-NT-CVS)

Link to comment
Share on other sites

Your first IF statement

 

if( isset($strikeops_price) ) {

 

is closed out after

 

else {

echo("<center>You do not have enough money</center>");

}

};

 

You do not need the ending semi-colon to close out the IF brace.

 

Then (after that IF has been thoroughly traversed...) you continue on with an ELSEIF, which isn't going to work without being inside a parent IF statement...

 

That's what I see so far...

 

PhREEEk

Link to comment
Share on other sites

Use tabs to make your coding more resourceful to you.

 

if($thing == 'jim'){

if($harold != $thing){
echo "Harold doesn't like " . $thing;
}else {
echo "Harold loves " . $thing;
}
}else {

if($greg != $thing){
echo "Greg doesn't like " . $thing;
}else {
echo "Greg loves " . $thing;
}
}

Link to comment
Share on other sites

Since I don't have all of the support files and your MySQL table available, I cannot test this on my end. So, here's a code adjustment, please test it on your end.

 

PhREEEk

 

<?php

strikeops_price = addslashes($_POST["strikeopsprice"]);
$defenceops_price = addslashes($_POST["defenceopsprice"]);
$covertops_price = addslashes($_POST["covertopsprice"]);

$strikeops_amount = addslashes($_POST["strikeopsamount"]);
$defenceops_amount = addslashes($_POST["defenceopsamount"]);
$covertops_amount = addslashes($_POST["covertopsamount"]);


// if its a strike ops upgrade do this
if( isset($strikeops_price) ) {
if($player_money >= $strikeops_price) 
{
	// run the queries for you - update your money
	$sql = "UPDATE `cf_users` SET `money` = money-'$strikeops_price' WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rs = mysql_query($sql) or die('Query:<br />' . $sql . '<br /><br />Error:<br />' . mysql_error());

	// run the queries for you - update your strike ops
	$sqll = "UPDATE `cf_users` SET `level_strikeops` = level_strikeops+1 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rss = mysql_query($sqll) or die('Query:<br />' . $sqll . '<br /><br />Error:<br />' . mysql_error());  
  
	// run the queries for you - update your strike ops price/amount
	$sqlll = "UPDATE `cf_users` SET `amount_strikeops` = amount_strikeops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsss = mysql_query($sqlll) or die('Query:<br />' . $sqlll . '<br /><br />Error:<br />' . mysql_error());    
  
	// run the queries for you - update your strike ops price/amount
	$sqllll = "UPDATE `cf_users` SET `price_strikeops` = price_strikeops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rssss = mysql_query($sqllll) or die('Query:<br />' . $sqllll . '<br /><br />Error:<br />' . mysql_error()); 
  
} else {

	echo "<center>You do not have enough money</center>";

}

} elseif ( isset($defenceops_price) ) {

// if its a defence ops upgrade do this
if($player_money >= $defenceops_price) 
{

	// run the queries for you - update your money
	$sqlx = "UPDATE `cf_users` SET `money` = money-'$defenceops_price' WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsx = mysql_query($sqlx) or die('Query:<br />' . $sqlx . '<br /><br />Error:<br />' . mysql_error());

	// run the queries for you - update your strike ops
	$sqlxx = "UPDATE `cf_users` SET `level_defenceops` = level_defenceops+1 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsxx = mysql_query($sqlxx) or die('Query:<br />' . $sqlxx . '<br /><br />Error:<br />' . mysql_error());  
  
	// run the queries for you - update your strike ops price/amount
	$sqlxxx = "UPDATE `cf_users` SET `amount_defenceops` = amount_defenceops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsxxx = mysql_query($sqlxxx) or die('Query:<br />' . $sqlxxx . '<br /><br />Error:<br />' . mysql_error());  
  
	// run the queries for you - update your strike ops price/amount
	$sqlxxxx = "UPDATE `cf_users` SET `price_defenceops` = price_defenceops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsxxxx = mysql_query($sqlxxxx) or die('Query:<br />' . $sqlxxxx . '<br /><br />Error:<br />' . mysql_error()); 

} else {

	echo "<center>You do not have enough money</center>";

}

} elseif( isset($covertops_price) ) {

// if its a covert ops upgrade do this
if($player_money >= $covertops_price) 
{

	// run the queries for you - update your money
	$sqly = "UPDATE `cf_users` SET `money` = money-'$covertops_price' WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsy = mysql_query($sqly) or die('Query:<br />' . $sqly . '<br /><br />Error:<br />' . mysql_error());

	// run the queries for you - update your strike ops
	$sqlyy = "UPDATE `cf_users` SET `level_covertops` = level_covertops+1 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsyy = mysql_query($sqlyy) or die('Query:<br />' . $sqlyy . '<br /><br />Error:<br />' . mysql_error());  
  
	// run the queries for you - update your strike ops price/amount
	$sqlyyy = "UPDATE `cf_users` SET `amount_covertops` = amount_covertops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsyyy = mysql_query($sqlyyy) or die('Query:<br />' . $sqlyyy . '<br /><br />Error:<br />' . mysql_error());  

	// run the queries for you - update your strike ops price/amount
	$sqlyyyy = "UPDATE `cf_users` SET `price_covertops` = price_covertops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsyyyy = mysql_query($sqlyyyy) or die('Query:<br />' . $sqlyyyy . '<br /><br />Error:<br />' . mysql_error());   
  
} else {

	echo "<center>You do not have enough money</center>";

}

} else {

// if the user came to the page via the URL or any other way then upgrading display this
echo "<center>You did not train anything</center>";

}
?>

Link to comment
Share on other sites

Is it possible to have your friend try it? I'm more interested in seeing if the parsing error is cleared up.

 

I don't know what's going on with your HTTP error, but it appears your server is not even attempting to run the script. It can't even get that far... so let me know what your friend says...

 

PhREEEk

Link to comment
Share on other sites

my friend said the HTTP error is cookie related, so I deleted my cookies, and now it is partly working. It did a couple or the queries, but not all of them, and it didn't echo anything.

 

here's the current code(full code this time):

<?php 

/* includes */
include_once '/home/ace/public_html/conflictingforces/functions.php';

player_session();

/**********************/
// Player Select Variables //
/**********************/

// User Information
$player_rank = player_table("rank");
$player_accountid = player_table("id");
$player_username = player_table("username");
$player_email = player_table("email");
$player_race = player_race();

// Military Effectiveness
$player_strikeaction = player_table("strikeaction");
$player_defenceaction = player_table("defenceaction");
$player_covertaction = player_table("covertaction");

// General Statistics
$player_money = player_table("money");
$player_level = player_table("level");
$player_currentexp = player_table("currentexp");
$player_neededexp = player_table("neededexp");
$player_skilllevel = player_table("skilllevel");
$player_skillpoints = player_table("skillpoints");
$player_strength = player_table("strength");
$player_agility = player_table("agility");
$player_intelligence = player_table("intelligence");


/* --- Ability Result coding --- */

// connect to the database
$rs = mysql_connect( "localhost", "ace_ACE", "*****" );
$rs = mysql_select_db( "ace_cf", $rs);

echo "<div id = \"base\">";

$strikeops_price = addslashes($_POST["strikeopsprice"]);
$defenceops_price = addslashes($_POST["defenceopsprice"]);
$covertops_price = addslashes($_POST["covertopsprice"]);

$strikeops_amount = addslashes($_POST["strikeopsamount"]);
$defenceops_amount = addslashes($_POST["defenceopsamount"]);
$covertops_amount = addslashes($_POST["covertopsamount"]);


// if its a strike ops upgrade do this
if( isset($strikeops_price) ) {
if($player_money >= $strikeops_price) 
{
	// run the queries for you - update your money
	$sql = "UPDATE `cf_users` SET `money` = money-'$strikeops_price' WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rs = mysql_query($sql) or die('Query:<br />' . $sql . '<br /><br />Error:<br />' . mysql_error());

	// run the queries for you - update your strike ops
	$sqll = "UPDATE `cf_users` SET `level_strikeops` = level_strikeops+1 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rss = mysql_query($sqll) or die('Query:<br />' . $sqll . '<br /><br />Error:<br />' . mysql_error());

  // run the queries for you - update your strike ops price/amount
  $sqlllll = "UPDATE `cf_users` SET `strikeaction` = strikeaction+amount_strikeops WHERE `id`='" . $player_accountid . "' LIMIT 1";
  $rsssss = mysql_query($sqlllll) or die('Query:<br />' . $sqlllll . '<br /><br />Error:<br />' . mysql_error());    		
  
	// run the queries for you - update your strike ops price/amount
	$sqlll = "UPDATE `cf_users` SET `amount_strikeops` = amount_strikeops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsss = mysql_query($sqlll) or die('Query:<br />' . $sqlll . '<br /><br />Error:<br />' . mysql_error());    
  
	// run the queries for you - update your strike ops price/amount
	$sqllll = "UPDATE `cf_users` SET `price_strikeops` = price_strikeops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rssss = mysql_query($sqllll) or die('Query:<br />' . $sqllll . '<br /><br />Error:<br />' . mysql_error()); 
  
} else {

	echo "<center>You do not have enough money</center>";

}

} elseif ( isset($defenceops_price) ) {

// if its a defence ops upgrade do this
if($player_money >= $defenceops_price) 
{

	// run the queries for you - update your money
	$sqlx = "UPDATE `cf_users` SET `money` = money-'$defenceops_price' WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsx = mysql_query($sqlx) or die('Query:<br />' . $sqlx . '<br /><br />Error:<br />' . mysql_error());

	// run the queries for you - update your strike ops
	$sqlxx = "UPDATE `cf_users` SET `level_defenceops` = level_defenceops+1 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsxx = mysql_query($sqlxx) or die('Query:<br />' . $sqlxx . '<br /><br />Error:<br />' . mysql_error());  

    // run the queries for you - update your strike ops price/amount
  $sqlxxxxx = "UPDATE `cf_users` SET `defenceaction` = defenceaction+amount_defenceops WHERE `id`='" . $player_accountid . "' LIMIT 1";
  $rsxxxxx = mysql_query($sqlxxxxx) or die('Query:<br />' . $sqlxxxxx . '<br /><br />Error:<br />' . mysql_error());  
  
	// run the queries for you - update your strike ops price/amount
	$sqlxxx = "UPDATE `cf_users` SET `amount_defenceops` = amount_defenceops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsxxx = mysql_query($sqlxxx) or die('Query:<br />' . $sqlxxx . '<br /><br />Error:<br />' . mysql_error());  
  
	// run the queries for you - update your strike ops price/amount
	$sqlxxxx = "UPDATE `cf_users` SET `price_defenceops` = price_defenceops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsxxxx = mysql_query($sqlxxxx) or die('Query:<br />' . $sqlxxxx . '<br /><br />Error:<br />' . mysql_error()); 

} else {

	echo "<center>You do not have enough money</center>";

}

} elseif( isset($covertops_price) ) {

// if its a covert ops upgrade do this
if($player_money >= $covertops_price) 
{

	// run the queries for you - update your money
	$sqly = "UPDATE `cf_users` SET `money` = money-'$covertops_price' WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsy = mysql_query($sqly) or die('Query:<br />' . $sqly . '<br /><br />Error:<br />' . mysql_error());

	// run the queries for you - update your strike ops
	$sqlyy = "UPDATE `cf_users` SET `level_covertops` = level_covertops+1 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsyy = mysql_query($sqlyy) or die('Query:<br />' . $sqlyy . '<br /><br />Error:<br />' . mysql_error());  

    // run the queries for you - update your strike ops price/amount
  $sqlyyyyy = "UPDATE `cf_users` SET `covertaction` = covertaction+amount_covertops WHERE `id`='" . $player_accountid . "' LIMIT 1";
  $rsyyyyy = mysql_query($sqlyyyyy) or die('Query:<br />' . $sqlyyyyy . '<br /><br />Error:<br />' . mysql_error());   
  
	// run the queries for you - update your strike ops price/amount
	$sqlyyy = "UPDATE `cf_users` SET `amount_covertops` = amount_covertops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsyyy = mysql_query($sqlyyy) or die('Query:<br />' . $sqlyyy . '<br /><br />Error:<br />' . mysql_error());  

	// run the queries for you - update your strike ops price/amount
	$sqlyyyy = "UPDATE `cf_users` SET `price_covertops` = price_covertops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsyyyy = mysql_query($sqlyyyy) or die('Query:<br />' . $sqlyyyy . '<br /><br />Error:<br />' . mysql_error());   
  
} else {

	echo "<center>You do not have enough money</center>";

}

} else {

// if the user came to the page via the URL or any other way then upgrading display this
echo "<center>You did not train anything</center>";

}

echo "</div>";

?>

Link to comment
Share on other sites

Based on the structure, it should only update one IF statement. Here is your structure (without the stuff):

 

if {
  do this
} else {
  do this instead
} elseif {
  do this if this condition was true, and the IF above was false
  } else {
    do this if this condition was false, AND the IF above was false
  }
}

 

And so on... so I'm kind of assuming you want ALL of those conditions verified and reacted to. If so, you need to drop the ELSEIF's and simply use IF on each section by itself (and a ELSE for failure in each section).

 

Are we getting closer?

 

PhREEEk

Link to comment
Share on other sites

yeah, I just realised that as well, I've just made the 3 elseif's into plain if's and made a if( isset() for the $_POST's, now I'm getting one of my echo's displayed.

 

You did not train anything

 

I'm wondering if maybe I should be using a different function then isset. I just can't remember what those other functions are that I use to use  :-\ so common, yet I forget lol

 

here's the latest code:

<?php 
error_reporting(E_ALL);
/* includes */
include_once '/home/ace/public_html/conflictingforces/functions.php';

player_session();

/**********************/
// Player Select Variables //
/**********************/

// User Information
$player_rank = player_table("rank");
$player_accountid = player_table("id");
$player_username = player_table("username");
$player_email = player_table("email");
$player_race = player_race();

// Military Effectiveness
$player_strikeaction = player_table("strikeaction");
$player_defenceaction = player_table("defenceaction");
$player_covertaction = player_table("covertaction");

// General Statistics
$player_money = player_table("money");
$player_level = player_table("level");
$player_currentexp = player_table("currentexp");
$player_neededexp = player_table("neededexp");
$player_skilllevel = player_table("skilllevel");
$player_skillpoints = player_table("skillpoints");
$player_strength = player_table("strength");
$player_agility = player_table("agility");
$player_intelligence = player_table("intelligence");


/* --- Ability Result coding --- */

// connect to the database
$rs = mysql_connect( "localhost", "ace_ACE", "*****" );
$rs = mysql_select_db( "ace_cf", $rs);

echo '<div id = "base">';

if( isset($_POST["strikeopsprice"]) && isset($_POST["strikeopsamount"] ) ) {
$strikeops_price = addslashes($_POST["strikeopsprice"]);
$strikeops_amount = addslashes($_POST["strikeopsamount"]);
}

if( isset($_POST["defenceopsprice"]) && isset($_POST["defenceopsamount"] ) ) {
$defenceops_price = addslashes($_POST["defenceopsprice"]);
$defenceops_amount = addslashes($_POST["defenceopsamount"]);
}

if( isset($_POST["covertopsprice"]) && isset($_POST["covertopsamount"] ) ) {
$covertops_price = addslashes($_POST["covertopsprice"]);
$covertops_amount = addslashes($_POST["covertopsamount"]);
}




// if its a strike ops upgrade do this
if( isset($strikeops_price) ) {
if($player_money >= $strikeops_price) 
{
	// run the queries for you - update your money
	$sql = "UPDATE `cf_users` SET `money` = money-'$strikeops_price' WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rs = mysql_query($sql) or die('Query:<br />' . $sql . '<br /><br />Error:<br />' . mysql_error());

	// run the queries for you - update your strike ops
	$sqll = "UPDATE `cf_users` SET `level_strikeops` = level_strikeops+1 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rss = mysql_query($sqll) or die('Query:<br />' . $sqll . '<br /><br />Error:<br />' . mysql_error());

  // run the queries for you - update your strike ops price/amount
  $sqlllll = "UPDATE `cf_users` SET `strikeaction` = strikeaction+amount_strikeops WHERE `id`='" . $player_accountid . "' LIMIT 1";
  $rsssss = mysql_query($sqlllll) or die('Query:<br />' . $sqlllll . '<br /><br />Error:<br />' . mysql_error());    		
  
	// run the queries for you - update your strike ops price/amount
	$sqlll = "UPDATE `cf_users` SET `amount_strikeops` = amount_strikeops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsss = mysql_query($sqlll) or die('Query:<br />' . $sqlll . '<br /><br />Error:<br />' . mysql_error());    
  
	// run the queries for you - update your strike ops price/amount
	$sqllll = "UPDATE `cf_users` SET `price_strikeops` = price_strikeops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rssss = mysql_query($sqllll) or die('Query:<br />' . $sqllll . '<br /><br />Error:<br />' . mysql_error()); 
  
} else {

	echo "<center>You do not have enough money</center>";

}

} if ( isset($defenceops_price) ) {

// if its a defence ops upgrade do this
if($player_money >= $defenceops_price) 
{

	// run the queries for you - update your money
	$sqlx = "UPDATE `cf_users` SET `money` = money-'$defenceops_price' WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsx = mysql_query($sqlx) or die('Query:<br />' . $sqlx . '<br /><br />Error:<br />' . mysql_error());

	// run the queries for you - update your strike ops
	$sqlxx = "UPDATE `cf_users` SET `level_defenceops` = level_defenceops+1 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsxx = mysql_query($sqlxx) or die('Query:<br />' . $sqlxx . '<br /><br />Error:<br />' . mysql_error());  

    // run the queries for you - update your strike ops price/amount
  $sqlxxxxx = "UPDATE `cf_users` SET `defenceaction` = defenceaction+amount_defenceops WHERE `id`='" . $player_accountid . "' LIMIT 1";
  $rsxxxxx = mysql_query($sqlxxxxx) or die('Query:<br />' . $sqlxxxxx . '<br /><br />Error:<br />' . mysql_error());  
  
	// run the queries for you - update your strike ops price/amount
	$sqlxxx = "UPDATE `cf_users` SET `amount_defenceops` = amount_defenceops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsxxx = mysql_query($sqlxxx) or die('Query:<br />' . $sqlxxx . '<br /><br />Error:<br />' . mysql_error());  
  
	// run the queries for you - update your strike ops price/amount
	$sqlxxxx = "UPDATE `cf_users` SET `price_defenceops` = price_defenceops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsxxxx = mysql_query($sqlxxxx) or die('Query:<br />' . $sqlxxxx . '<br /><br />Error:<br />' . mysql_error()); 

} else {

	echo "<center>You do not have enough money</center>";

}

} if( isset($covertops_price) ) {

// if its a covert ops upgrade do this
if($player_money >= $covertops_price) 
{

	// run the queries for you - update your money
	$sqly = "UPDATE `cf_users` SET `money` = money-'$covertops_price' WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsy = mysql_query($sqly) or die('Query:<br />' . $sqly . '<br /><br />Error:<br />' . mysql_error());

	// run the queries for you - update your strike ops
	$sqlyy = "UPDATE `cf_users` SET `level_covertops` = level_covertops+1 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsyy = mysql_query($sqlyy) or die('Query:<br />' . $sqlyy . '<br /><br />Error:<br />' . mysql_error());  

    // run the queries for you - update your strike ops price/amount
  $sqlyyyyy = "UPDATE `cf_users` SET `covertaction` = covertaction+amount_covertops WHERE `id`='" . $player_accountid . "' LIMIT 1";
  $rsyyyyy = mysql_query($sqlyyyyy) or die('Query:<br />' . $sqlyyyyy . '<br /><br />Error:<br />' . mysql_error());   
  
	// run the queries for you - update your strike ops price/amount
	$sqlyyy = "UPDATE `cf_users` SET `amount_covertops` = amount_covertops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsyyy = mysql_query($sqlyyy) or die('Query:<br />' . $sqlyyy . '<br /><br />Error:<br />' . mysql_error());  

	// run the queries for you - update your strike ops price/amount
	$sqlyyyy = "UPDATE `cf_users` SET `price_covertops` = price_covertops*2 WHERE `id`='" . $player_accountid . "' LIMIT 1";
	$rsyyyy = mysql_query($sqlyyyy) or die('Query:<br />' . $sqlyyyy . '<br /><br />Error:<br />' . mysql_error());   
  
} else {

	echo "<center>You do not have enough money</center>";

}

} else {

// if the user came to the page via the URL or any other way then upgrading display this
echo "<center>You did not train anything</center>";

}

echo '</div>';

?>

Link to comment
Share on other sites

hmm, I've changed all the isset's to !empty, and still get "You did not train anything". Although it is running the queries of the button I click.

 

the only thing is that this query doesn't work in each of them:

<?php
  // run the queries for you - update your strike ops price/amount
  $sqlllll = "UPDATE `cf_users` SET `strikeaction` = strikeaction+amount_strikeops WHERE `id`='" . $player_accountid . "' LIMIT 1";
  $rsssss = mysql_query($sqlllll) or die('Query:<br />' . $sqlllll . '<br /><br />Error:<br />' . mysql_error());  

Link to comment
Share on other sites

I've got it all working now, I removed the else, and put a echo in the if, that is within one of the main if's. And I removed a UPDATE which was on another page, which kept changing the value back to what it was orginally.

 

Thanks for your help PHP_PhREEEk , much appreciated  ;D

 

Regards ACE

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.