Jump to content
MakeWebGames

Recommended Posts

Posted

My itemsend just will not work i have uploaded the file several times and still no luck, The problem is that the item receiver gets the event but not the item.

Any ideas ?

Posted

Re: Itemsend

 

$rm=mysql_fetch_array($m);
//are we sending it all

$_GET['qty']=abs((INT) $_GET['qty']);

if($_GET['qty'] == $r['inv_qty'])
{
//just give them possession of the item
mysql_query("UPDATE inventory SET inv_userid={$_GET['user']} WHERE inv_id={$_GET['ID']} LIMIT 1",$c);

}
else
{
//create seperate
mysql_query("INSERT INTO inventory VALUES ('','{$r['inv_itemid']}',{$_GET['user']},{$_GET['qty']},0);",$c);
mysql_query("UPDATE inventory SET inv_qty=inv_qty-{$_GET['qty']} WHERE inv_id={$_GET['ID']} LIMIT 1;",$c);
}
print "You sent {$_GET['qty']} {$r['itmname']}(s) to {$rm['username']}";
event_add($_GET['user'],"You received {$_GET['qty']} {$r['itmname']}(s) from [url='viewuser.php?u=$userid']{$ir['username']}[/url]",$c,'transfer');
mysql_query("INSERT INTO itemxferlogs VALUES('',$userid,{$_GET['user']},{$r['itmid']},{$_GET['qty']},unix_timestamp(),'{$ir['lastip']}','{$rm['lastip']}')",$c);
}
}
}
}
else if($_GET['ID'])
{
$id=mysql_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",$c);
if(mysql_num_rows($id)==0)
{
print "Invalid item ID";
}
else if ($_GET['ID']==0)
{
die("Nono");
}
else
{
$r=mysql_fetch_array($id);
Posted

Re: Itemsend

this should be your whole itemsend.php for v1

<?php
/*-----------------------------------------------------
-- Fallen-Lands v1.0 BETA
-- A product of DBS-entertainment
-- Copyright held 2005 by Dabomstew
-- INDEX.php
-----------------------------------------------------*/
session_start();
require "global_func.php";
if($_SESSION['loggedin']==0) { header("Location: login.php");exit; }
$userid=$_SESSION['userid'];
require "header.php";
$h = new headers;
$h->startheaders();
include "mysql.php";
global $c;
$is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error());
$ir=mysql_fetch_array($is);
check_level();
$fm=money_formatter($ir['money']);
$cm=money_formatter($ir['crystals'],'');
$lv=date('F j, Y, g:i a',$ir['laston']);
$h->userdata($ir,$lv,$fm,$cm);
$h->menuarea();
//itemsend
if($_GET['qty'] && $_GET['user'])
{
$id=mysql_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",$c);
if(mysql_num_rows($id)==0)
{
print "Invalid item ID";
}
else
{
$r=mysql_fetch_array($id);
$m=mysql_query("SELECT * FROM users WHERE userid={$_GET['user']} LIMIT 1",$c);
if($_GET['qty'] > $r['inv_qty'])
{
print "You are trying to send more than you have!";
}
else if( $_GET['qty'] <= 0)
{
print "You know, I'm not dumb, j00 cheating hacker.";
}
else if(mysql_num_rows($m) == 0)
{
print "You are trying to send to an invalid user!";
}
else
{
$rm=mysql_fetch_array($m);
//are we sending it all
if($_GET['qty'] == $r['inv_qty'])
{
//just give them possession of the item
mysql_query("UPDATE inventory SET inv_userid={$_GET['user']} WHERE inv_id={$_GET['ID']} LIMIT 1",$c);

}
else
{
//create seperate
mysql_query("INSERT INTO inventory VALUES ('','{$r['inv_itemid']}',{$_GET['user']},{$_GET['qty']});",$c);
mysql_query("UPDATE inventory SET inv_qty=inv_qty-{$_GET['qty']} WHERE inv_id={$_GET['ID']} LIMIT 1;",$c);
}
print "You sent {$_GET['qty']} {$r['itmname']}(s) to {$rm['username']}";
event_add($_GET['user'],"You received {$_GET['qty']} {$r['itmname']}(s) from [url='viewuser.php?u=$userid']{$ir['username']}[/url]",$c);
mysql_query("INSERT INTO itemxferlogs VALUES('',$userid,{$_GET['user']},{$r['itmid']},{$_GET['qty']},unix_timestamp())",$c);
}
}
}
else if($_GET['ID'])
{
$id=mysql_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",$c);
if(mysql_num_rows($id)==0)
{
print "Invalid item ID";
}
else
{
$r=mysql_fetch_array($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]

<form action='itemsend.php' method='get'>
<input type='hidden' name='ID' value='{$_GET['ID']}' />User ID: <input type='text' name='user' value='' />

Quantity: <input type='text' name='qty' value='' />

<input type='submit' value='Send Items (no prompt so be sure!' /></form>";
}
}
else
{
print "Invalid use of file.";
}
$h->endpage();
?>

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