Advertisement
Somentus

Untitled

Jan 17th, 2014
3,163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if(isset($_POST['submit'])){
  2.     $error = array();
  3.     echo '1';
  4.     $resources = array("clay","brick","ore","tree","gold","oil","oven","iron","wood","vest","gas","pump","screw","shovel","engine","plastic","drill","saw","machine","gun","chips","phone","cam","alarm","comp","diamond","powder","bomb","glass");
  5.     echo '2';
  6.     foreach($resources as $rsc_raw){
  7.         echo '3';
  8.         $rsc_p = 'rsc_'.$rsc_raw;
  9.         if(isset($_POST[$rsc_p]) && !empty($_POST[$rsc_p])){
  10.             echo '4';
  11.             if(is_numeric($_POST[$rsc_p])){
  12.                 echo '5';
  13.                 $rsc = $_POST[$rsc_p];
  14.                 $rsc_add = mysql_query("UPDATE cost SET ".$rsc_raw."='$rsc' WHERE user_id='$_SESSION[user_id]' ") or die(mysql_error());
  15.                 echo '6';
  16.             }else{
  17.                 echo '7';
  18.                 $error[] = 'Please post a numeric value for .'.$rsc_raw;
  19.                 header('Location:prompt.php?x=5');
  20.             }
  21.         }
  22.     }
  23.        
  24.     if(isset($error) && !empty($error)){
  25.         $error_message = '<span class="error">';
  26.         foreach($error as $key => $values){
  27.             $error_message.= "$values";
  28.         }
  29.         $error_message.="</span><br/><br/>";
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement