Jump to content
MakeWebGames

Staff Panel Changes


gpo26
 Share

Recommended Posts

When I use the staff panel to change some items, add some items, etc. I come across this error a lot:

"You missed one or more of the required fields. Please go back and try again."

Even after filling in or changing all of the fields given. Any help would be appreciated.

Link to comment
Share on other sites

which file is this for ?

I believe he is talking about the staff_items file.

It's not the best of solutions but what I did to by pass this was to enter them via phpMyAdmin. Then use the edit items to fix/add to the items once that was done ... basically the effects.

Edited by newttster
Link to comment
Share on other sites

Thats okies in the staff_items.php

look for these line..

usually you will get the error message if a POST isnt being sent to the INSERT or UPDATE

example

 

if(!isset($_POST['itmname']) || !isset($_POST['itmdesc']) || !isset($_POST['itmtype'])  || !isset($_POST['itmbuyprice']) || !isset($_POST['itmsellprice']))
{
print "You missed one or more of the fields. Please go back and try again.<br />
<a href='admin.php?action=newitem'>> Back</a>";
$h->endpage();
exit;
}
Link to comment
Share on other sites

I think this is the part. I wasn't going to post over 1000 lines. lol

 

function new_item_submit()
{
   global $db, $ir, $c, $h;
   if ($ir['user_level'] != 2)
   {
       echo 'You cannot access this area.<br />> <a href="'
               . gen_url('main', true, true) . '">Goto Main</a>';
       die($h->endpage());
   }
   staff_csrf_stdverify('staff_newitem',
           gen_url('items', true, true) . '&action=newitem');
   $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'])) : '';
   if (empty($itmname) OR empty($itmdesc) OR empty($_POST['itmtype'])
           OR empty($_POST['itmbuyprice']) OR empty($_POST['itmsellprice']))
   {
       echo 'You missed one or more of the fields. Please go back and try again.<br />> <a href="'
               . gen_url('items', true, true)
               . '&action=newitem">Go Back</a>';
       die($h->endpage());
   }
Link to comment
Share on other sites

$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'])) : '';

With:

$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'])) : '';

See more

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.

 Share

×
×
  • Create New...