Jump to content

[SOLVED] A strange Error, not sure whether is MySQL Related, or PHP or Something else?


MasterACE14

Recommended Posts

I have a script that runs fine. Except for throws a strange error. I've checked through my file. Its not a custom error, and it doesn't look like a PHP error, and I'm not sure whether it might be a MySQL error. Its really strange.

 

I have 2 pages. The first one has some forms, and depending which form is filled out and submitted to the second page. That if(isset($_POST['whatever'])) will run.

 

When the first page, submits a form to the second page. The second page is suppose to redirect back to the first after updating the database with the new info.

 

However, it is updating the database how it should be. But isn't redirecting to the first page and is displaying this peculiar message:

Failed to attribute action.

 

here is the second page which displays this message after executing the required code ???:

<?php
  session_start();
  if (isset($_SESSION['id'])) {
      include('common.php');
      include('libvars.php');
      
      $sql = "SELECT * FROM `UserInfo` WHERE `id` = '$id'";
      if (!($result = $db->sql_query($sql))) {
          die('Failed to query database userinfo.');
      }
      if (mysql_num_rows($result) > 0) {
          $row = $db->sql_fetchrow($result);
          // a heap of variables below. don't worry, they are all set in my script
          $clanID = $row['clan'];
          $turns = $row['AT'];
          $magi = $row['magi_ava'];
          $banks = $row['magivault'];
      }

if (isset($_POST['prosp_amt'])) {
          $increment = ceil($_POST['prosp_amt']);
          if ($increment < 0) {
              $timez = time();
              $sql = "INSERT INTO `cheatlog` (`id`, `page`, `time`, `type`) VALUES ('$id', 'tech2 / Prosperity / $increment', '$timez', 'negative')";
              if (!($result = $db->sql_query($sql))) {
                  die('Failed to query database.');
              }
              $increment = 0;
          }
          $mod_prosp = $prosp_tech + $increment;
          $prosp_price = (-1 * ($prosp_tech - $mod_prosp)) * (((170000 * ($mod_prosp - 1) + 170000 * ($prosp_tech + (28 / 17))) / 2));
          if ($magi >= $prosp_price) {
              if ($magi > 0) {
                  if ($mod_prosp <= 100) {
                      $mod_prosp_amt = $prosp_amt + ($increment * $prosp_bon);
                      $prosp_tech_mod = $prosp_tech + $increment;
                      $sql = "UPDATE `UserInfo` SET `prosp_amt` = '$mod_prosp_amt', `prosp_tech` = '$prosp_tech_mod' WHERE `id` = '$id'";
                      if (!($result = $db->sql_query($sql, $id))) {
                          die('Failed to query database userinfo.');
                      }
                      $mod_magi = $magi - $prosp_price;
                      $sql = "UPDATE `UserInfo` SET `magi_ava` = '$mod_magi' WHERE `id` = '$id'";
                      if (!($result = $db->sql_query($sql, $id))) {
                          die('Failed to query database userinfo.');
                      }
                      
                      
                      $count++;
                      $done = "Your Realm Evolved Their Prosperity For " . number_format($prosp_price) . " Copper";
                  } else {
                      $done = "That Would Put You Above Your Realm's Evolutionary Capacity";
                  }
              } else {
                  $done = "Your%20Realm%20Is%20Delinquent!!";
              }
          } else {
              $done = "Your Realm Needs " . number_format($prosp_price) . " Copper In Order To Evolve To That Level";
          }
      }
      
      
      include('includes/powers.inc.php');
      
      
      header('Location: tech.php?str=' . $done . '!');
  } else {
      header('Location: index.php?str=You%20Are%20Not%20Logged%20In!%20Please%20try%20again.');
      exit;
  }
?>

 

-Edit: uhh is it just me, or is my code coming up all weird :S

 

Any help is greatly appreciated!  :)

 

Regards ACE

Archived

This topic is now archived and is closed to further replies.

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