Nicholas Posted February 24, 2010 Share Posted February 24, 2010 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. Quote Link to comment Share on other sites More sharing options...
Zero-Affect Posted February 24, 2010 Share Posted February 24, 2010 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 Quote Link to comment Share on other sites More sharing options...
Nicholas Posted February 25, 2010 Author Share Posted February 25, 2010 couldnt get it to work :( but thanks for trying :) Quote Link to comment Share on other sites More sharing options...
wrx Posted February 25, 2010 Share Posted February 25, 2010 $_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 Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted February 25, 2010 Share Posted February 25, 2010 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. Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted February 25, 2010 Share Posted February 25, 2010 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] '; } ?> Quote Link to comment Share on other sites More sharing options...
Nicholas Posted February 26, 2010 Author Share Posted February 26, 2010 cheers that works. :) Quote Link to comment Share on other sites More sharing options...
Zero-Affect Posted February 26, 2010 Share Posted February 26, 2010 ah ty rpmb Quote Link to comment Share on other sites More sharing options...
chaoswar4u Posted April 18, 2010 Share Posted April 18, 2010 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. Quote Link to comment Share on other sites More sharing options...
Nicholas Posted April 18, 2010 Author Share Posted April 18, 2010 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.