Hi. This is driving me mad now.
My website is a rpg (still in creation) In the code is a inventory page where items are stored for each user.
I have a php file itemsend.php which is used to send an item from the inventory to another user. Ive been trying to intergrate this so there is a lightbox style (prettyPopin) window for the itemsend.php rather than clicking through so everything is done on the inventory page.
However. Here is the problem. Clicking through to the itemsend.php page from the inventory page and the form works fine. Load into the lightbox window and it doesnt.
<?php
include "globals.php";
//itemsend
$_GET['ID'] = abs((int) $_GET['ID']);
$_GET['qty'] = abs((int) $_GET['qty']);
if($_GET['qty'] && $_GET['user'])
{
$id=$db->query("SELECT iv.*,it.* FROM inventory iv LEFT JOIN items it ON iv.inv_itemid=it.itmid WHERE iv.inv_id={$_GET['ID']} AND iv.inv_userid=$userid LIMIT 1");
if($db->num_rows($id)==0)
{
print "Invalid item ID";
}
else
{
$r=$db->fetch_row($id);
$m=$db->query("SELECT * FROM users WHERE userid={$_GET['user']} LIMIT 1");
if($_GET['qty'] > $r['inv_qty'])
{
print "You are trying to send more than you have!";
}
else if( $_GET['qty'] <= 0)
{
print "You cant do that";
}
else if($db->num_rows($m) == 0)
{
print "You are trying to send to an invalid user!";
}
else
{
$rm=$db->fetch_row($m);
//are we sending it all
item_remove($userid, $r['inv_itemid'], $_GET['qty']);
item_add($_GET['user'], $r['inv_itemid'], $_GET['qty']);
print "You sent {$_GET['qty']} {$r['itmname']}(s) to {$rm['username']}";
event_add($_GET['user'],"You received {$_GET['qty']} {$r['itmname']}(s) from <a href='viewuser.php?u=$userid'>{$ir['username']}</a>",$c);
$db->query("INSERT INTO itemxferlogs VALUES('',$userid,{$_GET['user']},{$r['itmid']},{$_GET['qty']},unix_timestamp(), '{$ir['lastip']}', '{$rm['lastip']}')");
}
}
}
else if($_GET['ID'])
{
$id=$db->query("SELECT iv.*,it.* FROM inventory iv LEFT JOIN items it ON iv.inv_itemid=it.itmid WHERE iv.inv_id={$_GET['ID']} AND iv.inv_userid=$userid LIMIT 1");
if($db->num_rows($id)==0)
{
print "Invalid item ID";
}
else
{
$r=$db->fetch_row($id);
print "<b>Enter who you want to send {$r['itmname']} to and how many you want to send. You have {$r['inv_qty']} to send.</b><br />
<form action='itemsend.php' method='get'>
<input type='hidden' name='ID' value='{$_GET['ID']}' />User ID: <input type='text' name='user' value='' /><br />
Quantity: <input type='text' name='qty' value='' /><br />
<input type='submit' value='Send Item' class='btn'/></form>";
}
}
else
{
print "Invalid use of file.";
}
$h->endpage();
?></em>
When using in the lightbox the very last print "invalid use of file" is displayed on submit.
placing a print_f($_GET); above that displays
Array
(
[ID] => 0
[viewtopic] => 0
[viewforum] => 0
[qty] => 0
)
So. Nothing is getting submitted when using the lightbox but works fine when used standalone.
Any ideas??