Jump to content
MakeWebGames

Recommended Posts

Posted

hi im wondering, i have tried but had no luck... couldnt get the item inventory id to show to confirm...

but anyways...

could someone please create a itemuse.php file where you have to confirm to use the item, with like a

YES! use the item (if you want to use that item)

or a

NO! changed my mind (if you didnt want to you the item)

hopefully you understand what i mean, and hopefully someone will make it for us all :)

Thanks, Nicholas.

Posted

itemuse.php

replace:

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

 

with:

$_GET['ID'] = ( isset($_GET['ID']) AND ctype_digit($_GET['ID']) ) ? $_GET['ID'] : '' ;
$_POST['id'] = ( isset($_POST['id']) AND ctype_digit($_POST['id']) ) ? $_POST['id'] : '' ;
 if ( !empty($_POST['id']) ) {
$itm = $db->fetch_row($db->query("SELECT `itmname` FROM `items` WHERE `itmid`={$_POST['ID']}"));
echo '
Do you want to continue and use [b]'.$itm.'[/b]?
<form action="" method="post">
<table width="75%" border="0" cellpadding="1" cellspacing="1" align="center">
	<tr>
<td><form action="?ID='.$_GET['ID'].'" method="post"><input type="submit" value="continue"></form></td>
	</tr>
</table>


> [url="inventory.php"]Go Back[/url]
';
 } else {

--

find:

$h->endpage();

 

replace with:

 }
$h->endpage();

 

NOTE: coded from scratch and untested

Posted
$_GET['ID'] = ( isset($_GET['ID']) AND ctype_digit($_GET['ID']) ) ? $_GET['ID'] : '' ;

$_POST['id'] = ( isset($_POST['id']) AND ctype_digit($_POST['id']) ) ? $_POST['id'] : '' ;

if ( !empty($_POST['id']) ) {

$itm = $db->fetch_row($db->query("SELECT `itmname` FROM `items` WHERE `itmid`={$_POST['ID']}"));

echo '

Do you want to continue and use '.$itm.'?

<form action="" method="post">

<table width="75%" border="0" cellpadding="1" cellspacing="1" align="center">

<tr>

<td><form action="?ID='.$_GET['ID'].'" method="post"><input type="submit" value="continue"></form></td>

</tr>

</table>

 

> Go Back

';

} else {

i got this to work by creating a new page called confirmuse.php with the above query and form and then changed the forms action to :

 

<form action="itemuse?ID='.$_GET['ID'].'" method="post">

 

theres an extra <form action="" method="post"> stuck in his origional post( make sure you remove that) maybe that was causing you a problem nicholas.

if you use this method change your href in inventory.php for the "useitem" to confirmuse.php

 

 

wrx

Posted

You will need to call the inventory and match the inv_itemid to the items table itmid or your going to be using the wrong item.

Use the left join query thats already in your itemuse file or write another.

Posted

Call this confirm.php or whatever you wish should do the job.

 

<?php
include "globals.php";
$_GET['ID'] = ( isset($_GET['ID']) AND ctype_digit($_GET['ID']) ) ? $_GET['ID'] : '' ;

if (isset($_GET['ID']) ) {
$itm=$db->fetch_row($db->query(sprintf("SELECT iv.`inv_itemid`,`inv_userid`,i.`itmid`,`itmtype`,`itmname`,it.`itmtypeid` 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=%u AND iv.inv_userid=%d", $_GET['ID'], $_SESSION['userid'])));

echo '
Do you want to continue and use [b]'.$itm['itmname'].'[/b]?
<table width="75%" border="0" cellpadding="1" cellspacing="1" align="center">
<tr>
<td><form action="itemuse.php?ID='.$_GET['ID'].'" method="post" name="ID"><input type="submit" value="continue"></form></td>
</tr>
</table>


> [url="inventory.php"]Go Back[/url]
';
}
?>
  • 1 month later...
Posted

Well I didnt really like the idea of making another file just for this so I decided to rob the idea from the delete user method. Unsure if there would be an issue but this is it, Seems to work ok.

 

Find

 

 

if($r['effect1_on'])
{
 $einfo=unserialize($r['effect1']);
 if($einfo['inc_type']=="percent")
 {

 

 

Add above

 

 

switch ($_GET['step'])
{
  default:
     echo "<h3>Items</h3>
     Are you sure you want to use the item {$r['itmname']}?
     <form action='itemuse.php?ID={$_GET['ID']}&step=2' method='post'>
     <input type='submit' value='Confirm' /></form>";
  break;
  case 2:

 

 

Then add a } at the bottom of the script.

Job done.

Posted

good idea, but cba to do it as ive already set up my game to change links in preferences for the

confirm link or just normal click "USE" link to use the item without the confirm bit.

if thats understandable lol.

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