Jump to content
MakeWebGames

item.php


GregFest

Recommended Posts

when you edit items it dont show the the armor number or the weapons damage only comes up blank how to fix

I don't understand what you're saying here. Edit through the staff panel? If yes, please show the relevant code for the edit item function.

Edited by Dominion
Link to comment
Share on other sites

Are you not one of the new members of staff....do you not know the code in question or have access to the code??

If not the "new" start is starting off as well as their CB & Dabs other attempts.

Yes you can say i am one of the new members of staff, I am here to help and assist people as much as i possibly can.

And when i read the post on my mobile device "MWG posts On a mobile, Shows up small for some reason" i didn't quite get the meaning of the question.

But having read it on a Laptop i now know what he means, And if he could post the staff item function i would gladly fix it to how he wants. :)

Link to comment
Share on other sites

Working off of v2.03 (no idea what's changed in Redux) as it's also a bug in 2.03.

Find:

$d = $db->query("SELECT `itmsellprice`,`itmbuyprice`,`itmbuyable`,`itmtype`,`itmdesc`,`itmname` FROM `items` WHERE `itmid` = {$_POST['item']}");

in your edit item form function.

Replace with:

$d = $db->query("SELECT `itmsellprice`, `itmbuyprice`, `itmbuyable`, `itmtype`, `itmdesc`, `itmname`, `weapon`, `armor` FROM `items` WHERE `itmid` = {$_POST['item']}");
Edited by Djkanna
Added the Redux note.
Link to comment
Share on other sites

Yes you can say i am one of the new members of staff, I am here to help and assist people as much as i possibly can.

And when i read the post on my mobile device "MWG posts On a mobile, Shows up small for some reason" i didn't quite get the meaning of the question.

But having read it on a Laptop i now know what he means, And if he could post the staff item function i would gladly fix it to how he wants. :)

So your staff who doesnt not have access to the code. Laughable.

Link to comment
Share on other sites

It is as good as any.

Someone has asked for assistance with the code and you cannot help unless they post the code. Sorry but you dont see the stupidity in that?

But as your here and have probably logged in more times since being taken on than CB & Dabs have ever then well done!

You know ... I know you have been here for some time ... and most of the time i respect what you have to say. However, it seems that lately every post that I see you make, you are all about negativity and shooting everyone down for their ideas or requests with help. Now I know everyone has the right to post what they wish (within the rules, of course) but damnit man ... if you can't be nice or maybe offer some help, then why even bother posting at all. Is there some kind of reward for the number of posts you make?

And yes ... I'm well aware of the irony of making a neagative post about negativity.

Link to comment
Share on other sites

Well that would be the difference between you and I.

I do not see it as acceptable. You do.

So mccodes staff both old and new (not forum mods thats community work) do not bother even answering q's about their product. Obviously some do not know the code nor have access to it themselves.

Does that not strike you as a bit odd? So what exactly are they doing?? I do not see CB, Dabs, Paul or anyone else that is a mccodes member of staff answering q's on their product. This new member is not capable of answering as he does not have access to the code by no fault of his own.

Its not a direct attack on this person directly but against mccodes themselves. Yeah they will take your lic money. Release new, and I use the term new very lightly perhaps slightly re-programmed, engines but will not support it.

They are working on a new version of the engine which most likely they will answer a few q's initially and then disappear again once more.

Was this topic the place for this. Perhaps not but has a member of staff answered the q no. Once again down to the community to resolve their mess.

Link to comment
Share on other sites

Working off of v2.03 (no idea what's changed in Redux) as it's also a bug in 2.03.

Find:

$d = $db->query("SELECT `itmsellprice`,`itmbuyprice`,`itmbuyable`,`itmtype`,`itmdesc`,`itmname` FROM `items` WHERE `itmid` = {$_POST['item']}");

in your edit item form function.

Replace with:

$d = $db->query("SELECT `itmsellprice`, `itmbuyprice`, `itmbuyable`, `itmtype`, `itmdesc`, `itmname`, `weapon`, `armor` FROM `items` WHERE `itmid` = {$_POST['item']}");

I tried this and still not showing up

Link to comment
Share on other sites

function edit_item_begin() {
global $db,$ir,$c,$h,$userid;
     if ( in_array($ir['user_level'],array(0,1,4,5,6,8)) ) {
  echo 'You cannot access this area.<br />> <a href="'.gen_url('main',true,true).'">Goto Main</a>';
  die($h->endpage());
     }
  echo "
<h3>Editing Item</h3>
You can edit any aspect of this item.<br />
<form action='".gen_url('items',true,true)."&action=edititemform' method='post'>
Item: ".item_dropdown($c,'item')."
<br />
<input type='submit' value='Edit Item' />
</form>
  ";
}
function edit_item_form() {
global $db,$ir,$c,$h;
     if ( in_array($ir['user_level'],array(0,1,4,5,6,8)) ) {
  echo 'You cannot access this area.<br />> <a href="'.gen_url('main',true,true).'">Goto Main</a>';
  die($h->endpage());
     }
	$_POST['item'] = ( isset($_POST['item'])&&is_numeric($_POST['item']) )?abs(intval($_POST['item'])):'';
      if ( empty($_POST['item']) ) {
  echo 'Invalid Item.<br />> <a href="'.gen_url('main',true,true).'">Goto Main</a>';
  die($h->endpage());
      }
$d = $db->query("SELECT`itmsellprice`,`itmbuyprice`,`itmbuyable`,`itmtype`,`itmdesc`,`itmname`,`effect1_on`,`effect1`,`effect2_on`,`effect2`,`effect3_on`,`effect3`,`weapon`,`armor` FROM `items` WHERE `itmid` = {$_POST['item']}");
      if ( $db->num_rows($d) == 0 ) {
  echo 'Item doesn\'t seem to exist.<br />> <a href="'.gen_url('items',true,true).'&action=edititem">Go Back</a>';
  die($h->endpage());
      }
$itemi = $db->fetch_row($d);
	$itmname = ( isset($_POST['itmname'])&&preg_match("/^[a-z0-9_]+([\\s]{1}[a-z0-9_]|[a-z0-9_])+$/i", $_POST['itmname']) )?strip_tags($db->escape($_POST['itmname'])):'';
	$itmdesc = ( isset($_POST['itmdesc']) )?strip_tags($db->escape($_POST['itmdesc'])):'';
	$weapon = ( isset($_POST['weapon'])&&is_numeric($_POST['weapon']) )?abs(intval($_POST['weapon'])):'';
	$armor = ( isset($_POST['armor'])&&is_numeric($_POST['armor']) )?abs(intval($_POST['armor'])):'';
  echo "
<h3>Editing Item</h3>
<form action='".gen_url('items',true,true)."&action=edititemsub' method='post'>
<input type='hidden' name='itmid' value='{$_POST['item']}' />
Item Name: <input type='text' name='itmname' value='{$itemi['itmname']}' />
<br />
Item Desc.: <input type='text' name='itmdesc' value='{$itemi['itmdesc']}' />
<br />
Item Type: ".itemtype_dropdown($c,'itmtype',$itemi['itmtype'])."
<br />
Item Buyable: <input type='checkbox' name='itmbuyable'
  ";
  echo ( $itemi['itmbuyable'] )?"checked='checked'":'';
  echo "
/>
<br />
Item Price: <input type='text' name='itmbuyprice' value='{$itemi['itmbuyprice']}' />
<br />
Item Sell Value: <input type='text' name='itmsellprice' value='{$itemi['itmsellprice']}' />
<hr />
<b>Usage Form</b>
<hr />
  ";
$stats = array(
	"energy" => "Energy",
	"will" => "Will",
	"brave" => "Brave",
	"hp" => "Health",
	"strength" => "Strength",
	"agility" => "Agility",
	"guard" => "Guard",
	"labour" => "Labour",
	"IQ" => "IQ",
	"hospital" => "Hospital Time",
	"jail" => "Jail Time",
	"main" => "{$set['main_currency']}",
	"second" => "{$set['second_currency']}",
	"cdays" => "Education Days Left",
	"bankmoney" => "Bank ".$_POST[$set['main_currency']],
	"cybermoney" => "Cyber ".$_POST[$set['main_currency']],
	"crimexp" => "Crime XP"
);
         for ( $i = 1; $i <= 3; $i++ ) {
 if ( $itemi["effect".$i] ) {
	$efx=unserialize($itemi["effect".$i]);
 } else {
	$efx=array("inc_amount" => 0);
 }
	$switch1 = ($itemi['effect'.$i.'_on'] > 0) ? " checked='checked'" : "";
	$switch2 = ($itemi['effect'.$i.'_on'] > 0) ? "" : " checked='checked'";
  echo "
<b><u>Effect {$i}</u></b>
<br />
On? <input type='radio' name='effect{$i}on' value='1'$switch1 /> Yes <input type='radio' name='effect{$i}on' value='0'$switch2 /> No
<br />
Stat: <select name='effect{$i}stat' type='dropdown'>
  ";
         foreach ( $stats as $k => $v ) {
  echo ( $k == $efx['stat'] )?'<option value="'.$k.'" selected="selected">'.$v.'</option>':'<option value="'.$k.'">'.$v.'</option>';
         }
	$str = ( $efx['dir'] == "neg" )?'<option value="pos">Increase</option><option value="neg" selected="selected">Decrease</option>':'<option value="pos" selected="selected">Increase</option><option value="neg">Decrease</option>';
	$str2 = ( $efx['inc_type'] == "percent" )?'<option value="figure">Value</option><option value="percent" selected="selected">Percent</option>':'<option value="figure" selected="selected">Value</option><option value="percent">Percent</option>';

 echo "
</select>
Direction: <select name='effect{$i}dir' type='dropdown'> {$str} </select>
<br />
Amount: <input type='text' name='effect{$i}amount' value='{$efx['inc_amount']}' /> <select name='effect{$i}type' type='dropdown'>{$str2}</select>
<hr />
  ";
         }

  echo "
<b>Combat Usage</b>
<br />
Weapon Power: <input type='text' name='weapon' value='{$weapon['weapon']}' />
<br />
Armor Defense: <input type='text' name='armor' value='{$armor['armor']}' />
<hr />
<input type='submit' value='Edit Item' />
</form>
  ";
}
function edit_item_sub() {
global $db,$ir,$c,$h,$userid;
     if ( in_array($ir['user_level'],array(0,1,4,5,6,8)) ) {
  echo 'You cannot access this area.<br />> <a href="'.gen_url('main',true,true).'">Goto Main</a>';
  die($h->endpage());
     }
	$itmname = ( isset($_POST['itmname'])&&preg_match("/^[a-z0-9_]+([\\s]{1}[a-z0-9_]|[a-z0-9_])+$/i", $_POST['itmname']) )?strip_tags($db->escape($_POST['itmname'])):'';
	$itmdesc = ( isset($_POST['itmdesc']) )?strip_tags($db->escape($_POST['itmdesc'])):'';
	$weapon = ( isset($_POST['weapon'])&&is_numeric($_POST['weapon']) )?abs(intval($_POST['weapon'])):0;
	$armor = ( isset($_POST['armor'])&&is_numeric($_POST['armor']) )?abs(intval($_POST['armor'])):0;
	$_POST['itmtype'] = ( isset($_POST['itmtype'])&&is_numeric($_POST['itmtype']) )?abs(intval($_POST['itmtype'])):'';
	$_POST['itmbuyprice'] = ( isset($_POST['itmbuyprice'])&&is_numeric($_POST['itmbuyprice']) )?abs(intval($_POST['itmbuyprice'])):'';
	$_POST['itmsellprice'] = ( isset($_POST['itmsellprice'])&&is_numeric($_POST['itmsellprice']) )?abs(intval($_POST['itmsellprice'])):'';
	$_POST['itmid'] = ( isset($_POST['itmid'])&&is_numeric($_POST['itmid']) )?abs(intval($_POST['itmid'])):'';
         if ( empty($itmname) OR empty($itmdesc) OR empty($_POST['itmtype'])  OR empty($_POST['itmbuyprice']) OR empty($_POST['itmsellprice']) OR empty($_POST['itmid']) ) {
  echo 'You missed one or more of the fields. Please go back and try again.<br />> <a href="'.gen_url('items',true,true).'&action=edititem">Go Back</a>';
  die($h->endpage());
         }
$q = $db->query('SELECT `itmid` FROM `items` WHERE `itmid` = '.$_POST['itmid']);
      if ( $db->num_rows($q) == 0 ) {
  echo 'Invalid item.<br />> <a href="'.gen_url('items',true,true).'&action=edititem">Go Back</a>';
  die($h->endpage());
      }
	$itmbuy = ( $_POST['itmbuyable'] == 'on' )?1:0;
	$_POST['effect1stat'] = ( isset($_POST['effect1stat']) && in_array($_POST['effect1stat'],array('energy','will','brave','hp','strength','agility','guard','labour','IQ','hospital','jail','main','second','cdays','bankmoney','cybermoney','crimexp')) )?$_POST['effect1stat']:'energy';
	$_POST['effect2stat'] = ( isset($_POST['effect2stat']) && in_array($_POST['effect2stat'],array('energy','will','brave','hp','strength','agility','guard','labour','IQ','hospital','jail','main','second','cdays','bankmoney','cybermoney','crimexp')) )?$_POST['effect2stat']:'energy';
	$_POST['effect3stat'] = ( isset($_POST['effect3stat']) && in_array($_POST['effect3stat'],array('energy','will','brave','hp','strength','agility','guard','labour','IQ','hospital','jail','main','second','cdays','bankmoney','cybermoney','crimexp')) )?$_POST['effect3stat']:'energy';
	$_POST['effect1dir'] = ( isset($_POST['effect1dir']) && in_array($_POST['effect1dir'],array('pos','neg')) )?$_POST['effect1dir']:'pos';
	$_POST['effect2dir'] = ( isset($_POST['effect2dir']) && in_array($_POST['effect2dir'],array('pos','neg')) )?$_POST['effect2dir']:'pos';
	$_POST['effect3dir'] = ( isset($_POST['effect3dir']) && in_array($_POST['effect3dir'],array('pos','neg')) )?$_POST['effect3dir']:'pos';
	$_POST['effect1type'] = ( isset($_POST['effect1type']) && in_array($_POST['effect1type'],array('figure','percent')) )?$_POST['effect1type']:'figure';
	$_POST['effect2type'] = ( isset($_POST['effect2type']) && in_array($_POST['effect2type'],array('figure','percent')) )?$_POST['effect2type']:'figure';
	$_POST['effect3type'] = ( isset($_POST['effect3type']) && in_array($_POST['effect3type'],array('figure','percent')) )?$_POST['effect3type']:'figure';
	$_POST['effect1amount'] = ( isset($_POST['effect1amount'])&&is_numeric($_POST['effect1amount']) )?abs(intval($_POST['effect1amount'])):0;
	$_POST['effect2amount'] = ( isset($_POST['effect2amount'])&&is_numeric($_POST['effect2amount']) )?abs(intval($_POST['effect2amount'])):0;
	$_POST['effect3amount'] = ( isset($_POST['effect3amount'])&&is_numeric($_POST['effect3amount']) )?abs(intval($_POST['effect3amount'])):0;
	$_POST['effect1on'] = ( isset($_POST['effect1on']) && in_array($_POST['effect1on'],array('1','0')))?$_POST['effect1on']:0;
	$_POST['effect2on'] = ( isset($_POST['effect2on']) && in_array($_POST['effect2on'],array('1','0')))?$_POST['effect2on']:0;
	$_POST['effect3on'] = ( isset($_POST['effect3on']) && in_array($_POST['effect3on'],array('1','0')))?$_POST['effect3on']:0;
	$efx1 = $db->escape(serialize(array("stat" => $_POST['effect1stat'], "dir" => $_POST['effect1dir'], "inc_type" => $_POST['effect1type'], "inc_amount" => abs((int) $_POST['effect1amount']))));
	$efx2 = $db->escape(serialize(array("stat" => $_POST['effect2stat'], "dir" => $_POST['effect2dir'], "inc_type" => $_POST['effect2type'], "inc_amount" => abs((int) $_POST['effect2amount']))));
	$efx3 = $db->escape(serialize(array("stat" => $_POST['effect3stat'], "dir" => $_POST['effect3dir'], "inc_type" => $_POST['effect3type'], "inc_amount" => abs((int) $_POST['effect3amount']))));
$db->query('UPDATE `items` SET `itmtype` = '.$_POST['itmtype'].',`itmname` = "'.$itmname.'",`itmdesc` = "'.$itmdesc.'",`itmbuyprice` = '.$_POST['itmbuyprice'].',`itmsellprice` = '.$_POST['itmsellprice'].',`itmbuyable` = '.$itmbuy.',`effect1_on` = "'.$_POST['effect1on'].'",`effect1` = "'.$efx1.'",`effect2_on` = "'.$_POST['effect2on'].'",`effect2` = "'.$efx2.'",`effect3_on` = "'.$_POST['effect3on'].'",`effect3` = "'.$efx3.'",`weapon` = '. $weapon.',`armor` = '.$armor.' WHERE `itmid` = '.$_POST['itmid']);
	stafflog_add("Edited item {$_POST['itmname']}");
  echo 'The '.$_POST['itmname'].' Item was edited successfully.<br />> <a href="'.gen_url('main',true,true).'">Goto Main</a>';
  die($h->endpage());
}
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...