Legaci Posted June 19, 2013 Posted June 19, 2013 <?php include "globals.php"; echo "<center>"; if($_GET['action']) { if(!in_array($_GET['action'], array('remove','add'))) { echo "Invalid action!<br/> <hr width='750px'>><a href='display.php'>Back</a><hr width='750px'>"; $h->endpage(); exit(); } } $_GET['XID'] = isset($_GET['XID']); switch($_GET['action']) { case 'remove' : remove(); break; case 'add' : add(); break; default : display(); break; } function display() { global $ir, $h, $db, $query; echo "<center><h1>Display Case</h1>"; $_GET['XID'] = abs(intval($_GET['XID'])); if(!$_GET['XID']) { echo "Invalid ID <hr width='750px'>><a href='display.php'>Back</a><hr width='750px'>"; $h->endpage(); exit(); } else { $query = array(); $db->query("SELECT `display_case` FROM `users` WHERE `userid` = '".mysql_real_escape_string($_GET['XID'])."' AND `display_case` = 'yes'"); if(!$db->num_rows($plys)) { echo "Sorry, This user does not have a display case! <hr width='750px'>><a href='display.php'>Back</a><hr width='750px'>"; $h->endpage(); exit(); } else { if($_GET['ID'] == $ir['userid']) { echo "<b>><a href='display.php?action=add'>Add items</a> | ><a href='display.php?action=remove'>Remove items</a></b><hr width = '750px'/>"; } $py = array(); $py = $db->fetch_row($plys); $query = array(); $db->query("SELECT * FROM `player_display_items` pdi LEFT JOIN `inventory` i ON pdi.pdi_itemid = i.inv_id WHERE pdi.pdi_playerid = '".mysql_real_escape_string($_GET['ID'])."' ORDER BY i.inv_id ASC"); echo "<table width = '100%' cellspacing='1'><tr>"; if(!$db->num_rows($thishop)) { echo "<tr><td align = 'center'>This person does not have any items in their display case.</td></tr></table>"; } else { $ts = array(); $num = 0; while($ts = $db->fetch_row($thishop)) { $num++; echo "<td align = 'center'><b>",htmlentities($ts['item_name']),"</b> (x ".number_format($ts['pdi_qty']).") <a href='iinfo.php?ID=".$ts['item_id']."'><img src='images/items/".$ts['item_picture']."' border='1'></a></td>"; if($num == 3) { echo "</tr><tr>"; $num=0; } } echo "</table>"; } } } } function add() { echo "<center><h1>Add items to your display</h1><hr />"; global $ir,$h, $db, $m, $user, $itemid, $qty, $userid, $myshop, $mine, $listem, $le, $_POST, $alin, $ai; $query = array(); $db->query("SELECT `display_case` FROM `users` WHERE `userid` = '".mysql_real_escape_string($ir['userid'])."' AND `display_case` = 'yes'"); if(!$db->num_rows($myshop)) { echo "<table>Error, You dont own a display case to add items to!<br/> <hr width='750px'>><a href=\"javascript:history.back();\">Back</a><hr width='750px'></table>"; $h->endpage(); exit(); } if(!$_POST['add']) { $query = array(); $db->query("SELECT * FROM `inventory` mi LEFT JOIN `items` i ON mi.inv_itemid = i.itmid WHERE mi.inv_userid = '".$ir['userid']."'"); $listem = array(); $listem = $db->query($q_ry); $le = array(); echo "<table width = '750px' class = 'rounded'><tr><td align = 'center'> <table width = '100%'><tr bgcolor = #999999 style = 'font-weight:800;'><td>Item</td><td>Qty</td><td>Add</td> </tr>"; $num=0; while($le = $db->fetch_row($listem)) { echo "<form action = 'display.php?action=add' method = 'post'> <tr bgcolor = $color> <td align = 'left'>".htmlentities($le['itmname'])."</td> <td align = 'left'>".number_format($le['inv_qty'])."</td> <td align = 'right'><input type = 'text' name = 'qty' value = ''> <input type = 'hidden' name = 'item' value = '".$le['inv_id']."'> <input type = 'submit' name = 'add' value = 'Add'></td></tr></form>"; } echo "</table></td></tr></table>"; } else { $_POST['inv_id'] = abs(intval($_POST['inv_id'])); $_POST['inv_qty'] = abs(intval($_POST['inv_qty'])); if(!$_POST['item'] || !$_POST['qty']) { echo "<table>Error, Please go back and fill the form in correctly!<br/> <hr width='750px'>><a href='display.php?action=add'>Back</a><hr width='750px'></table>"; $h->endpage(); exit(); } $query = array(); /* Do some more filtering and sanitation on inputs, please - sniko */ $mine = $db->query("SELECT `inv_itemid` FROM `inventory` WHERE (`inv_itemid`= '". $_POST['item'] ."') AND (`inv_userid` = '". $userid ."'"); $mine = array(); $mine = $db->query($q_ry); if(!$db->num_rows($mine)) { echo "<table>Error, Invalid item!<br/> <hr width='750px'>><a href='display.php?action=add'>Back</a><hr></table>"; $h->endpage(); exit(); } $m = array(); $m = $db->fetch_row($mine); if($_POST['qty'] > $m['inv_qty']) { echo "<table>Error, you dont have that many!<br/> <hr width='750px'>><a href='display.php?action=add'>Back</a><hr width='750px'></table>"; $h->endpage(); exit(); } if($_POST['item'] && $_POST['qty'] && $_POST['add'] != 'Confirm') { echo "<table>Are you sure you wish to add ".number_format($_POST['qty'])." <b>".htmlentities($m['itmname'])."(s)</b> to your display?<br/> <form action = 'display.php?action=add' method = 'post'> <input type = 'hidden' name = 'item' value = '".$_POST['item']."'> <input type = 'hidden' name = 'qty' value = '".$_POST['qty']."'> <input type = 'submit' name = 'add' value = 'Confirm'> </form></table>"; } else { if($_POST['item'] && $_POST['qty'] && $_POST['add'] == 'Confirm') { $query = array(); $db->query("SELECT * FROM `player_display_items` WHERE `pdi_itemid` = '".($ir['item_id'])."' AND `pdi_playerid` = '".($ir['userid'])."'"); if(!$db->num_rows($alin)) { $query = array(); $db->query("INSERT INTO `player_display_items` VALUES ('NULL', '".($ir['userid'])."', '".($ir['item_id'])."', '".($_POST['qty'])."')"); } else { $query = array(); $db->query("UPDATE `player_display_items` SET `pdi_qty` = `pdi_qty` + '".mysql_real_escape_string($_POST['qty'])."' WHERE `pdi_id` = '".mysql_real_escape_string($ai['pdi_id'])."'"); } $itemid = 1; //id of the item here $qty = 1; //amount to remove item_remove($userid, $itemid, $qty); echo "Items added successfully! <hr width='750px'>><a href='display.php?action=add'>Okay</a><hr width='750px'>"; $h->endpage(); exit(); } } } } function remove() { echo "<center><main>Remove items from your display</main><hr width = '750px'>"; global $ir,$h ; $query = array(); $db->query("SELECT `display_case` FROM `users_extra` WHERE `playerid` = '".mysql_real_escape_string($ir['userid'])."' AND `display_case` = 'yes'"); $myshop = array(); $myshop = $db->query($q_ry); if(!$db->num_rows($myshop)) { echo "Error, You dont own a display case to add items to!<br/> <hr width='750px'>><a href=\"javascript:history.back();\">Back</a><hr width='750px'>"; $h->endpage(); exit(); } $query = array(); $db->query("SELECT * FROM `player_display_items` pdi LEFT JOIN `items` i ON pdi.pdi_itemid = i.inv_id WHERE pdi.pdi_playerid = '".mysql_real_escape_string($ir['userid'])."'"); $instock = array(); $instock = $db->query($q_ry); echo "<table width = '750px' class = 'rounded'>"; if(!$db->num_rows($instock)) { echo "<tr><td align = 'center'>You dont have any items to remove.</td></tr></table>"; } else { if(!$_POST['remove']) { echo "<tr bgcolor = #999999 style = 'font-weight:800;'> <td align = 'left'>Item</td> <td align = 'left'>Qty</td> <td align = 'left'>Remove</td> </tr>"; $num = 0; $is = array(); while($is = $db->fetch_row($instock)) { $num++; $odd="#D8D8D8"; $even="#e3e3e3"; if ($num % 2) { $color="$even"; } else { $color="$odd"; } echo "<form action = 'display.php?action=remove' method = 'post'> <tr bgcolor = $color><td align = 'left'>",htmlentities($is['item_name']),"</td> <td align = 'left'>".$is['pdi_qty']."</td> <td align = 'center'> <input type = 'hidden' name = 'item' value = '".$is['pdi_id']."'> <input type = 'submit' name = 'remove' value = 'Remove'></td></tr></form>"; } } else { $_POST['item'] = abs(intval($_POST['item'])); if(!$_POST['item']) { echo "Error, Invalid item to remove!<br/> <hr width='750px'>><a href='index.php'>Back</a><hr width='750px'>"; $h->endpage(); exit(); } else { $query = array(); $db->query("SELECT * FROM `player_display_items` WHERE `pdi_playerid` = '".mysql_real_escape_string($ir['userid'])."' AND `pdi_id` = '".mysql_real_escape_string($_POST['item'])."'"); $myitem = array(); $myitem = $db->query($q_ry); if(!$db->num_rows($myitem)) { echo "Error, Invalid item to remove!<br/> <hr width='750px'>><a href='index.php'>Back</a><hr width='750px'>"; $h->endpage(); exit(); } else { $mi = array(); $mi = $db->fetch_row($myitem); item_add($ir['userid'], $mi['pdi_itemid'], $mi['pdi_qty']); $query = array(); $db->query("DELETE FROM `player_display_items` WHERE `pdi_id` = '".mysql_real_escape_string($_POST['item'])."'"); $db->query($q_ry); echo "Your item(s) were returned to you, You may now do as you wish with them."; } } } echo "</table>"; } } echo "<hr width='750px'>><a href='index.php'>Back</a><hr width='750px'>"; $h->endpage(); ?> Quote
Guest Posted June 19, 2013 Posted June 19, 2013 You paste 347 lines with no explanation of anything? Really? Quote
jcvenom Posted June 19, 2013 Posted June 19, 2013 Try this function add() { echo "<center><main>Add items to your display</main><hr width = '750px'>"; global $pl; $q_ry = array(); $q_ry = "SELECT `display_case` FROM `members_extra` WHERE `playerid` = '".mysql_real_escape_string($_SESSION['playerid'])."' AND `display_case` = 'yes'"; $myshop = array(); $myshop = mysql_query($q_ry); if(!mysql_num_rows($myshop)) { echo "Error, You dont own a display case to add items to! <hr width='750px'>><a href=\"javascript<b></b>:history.back();\">Back</a><hr width='750px'>"; include ('./includes/style_bottom.php'); exit(); } if(!$_POST['add']) { $q_ry = array(); $q_ry = "SELECT * FROM `members_items` mi LEFT JOIN `items` i ON mi.it_itemid = i.item_id WHERE mi.it_playerid = '".mysql_real_escape_string($_SESSION['playerid'])."'"; $listem = array(); $listem = mysql_query($q_ry); $le = array(); echo "<table width = '750px' class = 'rounded'><tr><td align = 'center'> <table width = '100%'><tr bgcolor = #999999 style = 'font-weight:800;'><td>Item</td><td>Qty</td><td>Add</td> </tr>"; $num=0; while($le = mysql_fetch_array($listem)) { $num++; $odd="#D8D8D8"; $even="#e3e3e3"; if ($num % 2) { $color="$even"; } else { $color="$odd"; } echo "<form action = 'display.php?action=add' method = 'post'> <tr bgcolor = $color> <td align = 'left'>".htmlentities($le['item_name'])."</td> <td align = 'left'>".number_format($le['it_qty'])."</td> <td align = 'right'><input type = 'text' name = 'qty' value = ''> <input type = 'hidden' name = 'item' value = '".$le['it_ID']."'> <input type = 'submit' name = 'add' value = 'Add'></td></tr></form>"; } echo "</table></td></tr></table>"; } else { $_POST['item'] = abs(intval($_POST['item'])); $_POST['qty'] = abs(intval($_POST['qty'])); if(!$_POST['item'] || !$_POST['qty']) { echo "Error, Please go back and fill the form in correctly! <hr width='750px'>><a href=\"javascript<b></b>:history.go(-1);\">Back</a><hr width='750px'>"; include ('./includes/style_bottom.php'); exit(); } $q_ry = array(); $q_ry = "SELECT * FROM `members_items` mi LEFT JOIN `items` i ON mi.it_itemid = i.item_id WHERE mi.it_ID = '".mysql_real_escape_string($_POST['item'])."' AND mi.it_playerid = '".mysql_real_escape_string($_SESSION['playerid'])."'"; $mine = array(); $mine = mysql_query($q_ry); if(!mysql_num_rows($mine)) { echo "Error, Invalid item! <hr width='750px'>><a href=\"javascript<b></b>:history.go(-1);\">Back</a><hr width='750px'>"; include ('./includes/style_bottom.php'); exit(); } $m = array(); $m = mysql_fetch_array($mine); if($_POST['qty'] > $m['it_qty']) { echo "Error, you dont have that many! <hr width='750px'>><a href=\"javascript<b></b>:history.go(-1);\">Back</a><hr width='750px'>"; include ('./includes/style_bottom.php'); exit(); } if($_POST['item'] && $_POST['qty'] && $_POST['add'] != 'Confirm') { echo "Are you sure you wish to add ".number_format($_POST['qty'])." <b>".htmlentities($m['item_name'])."(s)</b> to your display? <form action = 'display.php?action=add' method = 'post'> <input type = 'hidden' name = 'item' value = '".$_POST['item']."'> <input type = 'hidden' name = 'qty' value = '".$_POST['qty']."'> <input type = 'submit' name = 'add' value = 'Confirm'> </form>"; } else { if($_POST['item'] && $_POST['qty'] && $_POST['add'] == 'Confirm') { $q_ry = array(); $q_ry = "SELECT * FROM `player_display_items` WHERE `pdi_itemid` = '".mysql_real_escape_string($m['item_id'])."' AND `pdi_playerid` = '".mysql_real_escape_string($_SESSION['playerid'])."'"; $alin = array(); $alin = mysql_query($q_ry); if(!mysql_num_rows($alin)) { $q_ry = array(); $q_ry = "INSERT INTO `player_display_items` VALUES ('NULL', '".mysql_real_escape_string($_SESSION['playerid'])."', '".mysql_real_escape_string($m['item_id'])."', '".mysql_real_escape_string($_POST['qty'])."')"; mysql_query($q_ry); } else { $ai = array(); $ai = mysql_fetch_array($alin); $q_ry = array(); $q_ry = "UPDATE `player_display_items` SET `pdi_qty` = `pdi_qty` + '".mysql_real_escape_string($_POST['qty'])."' WHERE `pdi_id` = '".mysql_real_escape_string($ai['pdi_id'])."'"; mysql_query($q_ry); } i_remove($_SESSION['playerid'], $m['item_id'], $_POST['qty']); echo "Items added successfully! <hr width='750px'>><a href='display.php?action=add'>Okay</a><hr width='750px'>"; include ('./includes/style_bottom.php'); exit(); } } } } - - - Updated - - - by the way why are you trying to convert ruthlesscity to mccodes it wont work Quote
Legaci Posted June 19, 2013 Author Posted June 19, 2013 ian sorry my code isnt working i have converted this fill as much as i can with much difficulty all i get is santax errors QUERY ERROR: Query was empty Query was Quote
jcvenom Posted June 19, 2013 Posted June 19, 2013 ian sorry my code isnt working i have converted this fill as much as i can with much difficulty all i get is santax errors QUERY ERROR: Query was empty Query was i will see if i can convert it Quote
Guest Posted June 19, 2013 Posted June 19, 2013 If what venom says is true then start from scratch, converting mods takes more time in most cases than just rewriting it. Quote
jcvenom Posted June 19, 2013 Posted June 19, 2013 If what venom says is true then start from scratch, converting mods takes more time in most cases than just rewriting it. correct you code is completely messed up and you can type include "globals"; on top of the function as its not the start of the code so of course you will have errors you need to look at the full mod and convert it there Quote
jcvenom Posted June 19, 2013 Posted June 19, 2013 i just looked at your game you just copied some codes from the ruthless engine and pasted them, hmm i could help you would like help Quote
Dominion Posted June 19, 2013 Posted June 19, 2013 So... is this a free modification for ruthlesscity or part of the engine (the *paid* engine unless I'm mistaken)? Quote
jcvenom Posted June 19, 2013 Posted June 19, 2013 (edited) So... is this a free modification for ruthlesscity or part of the engine (the *paid* engine unless I'm mistaken)? its part of the engine - - - Updated - - - i dont think you paid for it because.. 1>Your trying to convert it to mccodes 2>Some links dont redirect which means you have the buggy version because i also have a copy of that (easy to fix) 3>If i ask icecoldcola will he confirm Edited June 19, 2013 by jcvenom Quote
Legaci Posted June 19, 2013 Author Posted June 19, 2013 Martin is a friend of mine and yes i bought the scripts ill code my own version and try that thanks for the advice Quote
jcvenom Posted June 19, 2013 Posted June 19, 2013 Martin is a friend of mine and yes i bought the scripts ill code my own version and try that thanks for the advice np but if you need any help converting message me Quote
KyleMassacre Posted June 19, 2013 Posted June 19, 2013 If what venom says is true then start from scratch, converting mods takes more time in most cases than just rewriting it. I would also agree here as well besides the fact its using mres on EVERYTHING its part of the engine i dont think you paid for it because.. 1>Your trying to convert it to mccodes 2>Some links dont redirect which means you have the buggy version because i also have a copy of that (easy to fix) 3>If i ask icecoldcola will he confirm 1. Point being??? 2. What's the licensing associated with this because I think some licenses allow for modifications to the script and sometimes when that's done it technically isn't part of that engine anymore. 3. Kind of along the lines of point #2 I really don't see anything wrong with him converting source code to another engine regardless of how he got but I also don't condone using illegal scripts and that's a pet peeve of mine. Is it illegal to convert scripts over from one engine to another? That depends I guess, but he has it, likes it, and wants to use it so in my opinion its cool. But like I said before rewrite it completely cause then it becomes your interpretation and therefor becomes yours. I could be wrong with some legalities here so they are my opinion and interpretation so I'm not going to sit here and argue those. Back to the topic: Is there anyway you can get us the exact error cause it will make troubleshooting a tab bit easier cause all you have stated was that the query was empty? Do you happen to know what query its referring to? Quote
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.