Jump to content
MakeWebGames

Quick Fix, I've been up late--Anyone see the prob?


Recommended Posts

Posted

My race = 4 and the Item Race = 4.

But when I try to use it tells me I'm not the right race. i've had this working b4 and i'm not sure wth it isnt working now > <

 

<?php
include "globals.php";
global $ir;
$_GET['ID'] = abs((int) $_GET['ID']);
//Food
if(!$_GET['ID'])
{
print "Invalid use of file";
}

else if($ir['race'] != $_GET['item_race'])
{
print "You aren't the right race to equip this item";
$h->endpage();
exit;
}

else
{
$i=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_id={$_GET['ID']} AND iv.inv_userid=$userid");
if(mysql_num_rows($i) == 0)
{
print "Invalid item ID";
}



else
{
$r=$db->fetch_row($i);
if(!$r['effect1_on'] && !$r['effect2_on'] && !$r['effect3_on'])
{
 die("Sorry, this item cannot be used as it has no effect.");
}
if($r['effect1_on'])
{
 $einfo=unserialize($r['effect1']);
Guest georgelink
Posted

hum, i can't find a problem, you should get someone to test it live for you

Posted

Your gonna want to do some de-bugging by yourself but firstly lets improve the script abit

The bit of code checking that the item is for the correct class is this...

else if($ir['race'] != $_GET['item_race'])
{
print "You aren't the right race to equip this item";
$h->endpage();
exit;
}

But in the script you never check if $_GET['item_race'] is actually set? So add above this code

else if(!isset($_GET['item_race']))
{
print "Script Error, Please go back and click the link again.";
$h->endpage();
exit;
}

If when you try and equip and item now and it comes up with the error i put in the code above you then know it's because your not setting $_GET['item_race'] correctly.

You may also want to add this in just for some extra security

$_GET['item_race'] = abs((int) $_GET['item_race']);

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