Jump to content

Sinikka

Members
  • Posts

    46
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Sinikka's Achievements

Member

Member (2/5)

0

Reputation

  1. Still looking for any suggestions on this if anyone has any.
  2. Ok I just managed to get it to insert more then one item into the trade but now it's duplicating the lot rather then just creating one. $getitems = mysql_query("SELECT * FROM usersitems2 WHERE owner = '$userid' AND game = '$game' ORDER BY item_id LIMIT 10"); while ($getitems2 = mysql_fetch_array($getitems)) { $get_item = fetch("SELECT * FROM items2 WHERE id = '$getitems2[item_id]' AND game = '$game'"); $tradeID = $getitems2[id]; $itemList .= "<option value=$getitems2[id]>$get_item[item_name]"; $tradelist .= " <TR BGCOLOR=\"$maincellColor\"> <TD WIDTH=35 HEIGHT=40> <CENTER><INPUT TYPE=checkbox NAME=trade_item[] id=$tradeID value=$get_item[id]></CENTER> </TD> <TD HEIGHT=40> <img src=$base_url/images/user_images/opg_$game/items/item_$get_item[id].gif height=40 width=40> <b>$get_item[item_name]</b><br> </TD> </TR> "; } $explodeTrade = explode(" ", $trade_item); $countTrade = count($explodeTrade) - 1; for ($a = 0; $a <= $countTrade;) if ($Submit == "Create Trade!") { $getitems = mysql_query("SELECT * FROM usersitems2 WHERE owner = '$userid' AND game = '$game'"); while ($getitems2 = mysql_fetch_array($getitems)) { $get_item = fetch("SELECT * FROM items2 WHERE id = '$getitems2[item_id]' AND game = '$game'"); $tradeID = $getitems2[id]; $endTime = $timestamp + $end_in; mysql_query("INSERT INTO trades2 (item_name1,item_name2,item_name3,item_name4,item_name5,item_name6,item_name7,item_name8, item_name9,item_name10,owner,end_time,date,wishlist,game) VALUES ('$trade_item[0]','$trade_item[1]','$trade_item[2]','$trade_item[3]','$trade_item[4]','$trade_item[4]', '$trade_item[6]','$trade_item[7]','$trade_item[8]','$trade_item[9]','$username','$endTime','$current_date','$wishlist','$game')"); mysql_query("DELETE FROM usersitems2 WHERE owner = '$userid' AND id = '$trade_item' AND game = '$game'"); } die(header(error("trade2.php?game=$game&page=search&search_by=my_trades","That item has been put into trade!"))); }
  3. I'm trying to setup a trade system to where multiple items (up to 10) can be inserted into the same trade. Currently, I have it pulling the items properly and processing the trade but it's adding each item selected into separate trades rather then combining them into one lot. The code isn't fully functional by any means at the moment, I'm more focused on trying to get the lots working properly before I continue with the code. This is the coding that pulls the items into the creation page for the checkboxes. $getitems = mysql_query("SELECT * FROM usersitems2 WHERE owner = '$userid' AND game = '$game' ORDER BY item_id LIMIT 10"); while ($getitems2 = mysql_fetch_array($getitems)) { $get_item = fetch("SELECT * FROM items2 WHERE id = '$getitems2[item_id]' AND game = '$game'"); $tradeID = $getitems2[id]; $tradelist .= " <TR BGCOLOR=\"$maincellColor\"> <TD WIDTH=35 HEIGHT=40> <CENTER><INPUT TYPE=checkbox NAME=trade_item[$tradeID] value=1></CENTER> </TD> <TD HEIGHT=40> <img src=$base_url/images/user_images/opg_$game/items/item_$get_item[id].gif height=40 width=40> <b>$get_item[item_name]</b><br> </TD> </TR> "; } And this is the processing code after they hit submit. $explodeTrade = explode(" ", $trade_item[$tradeID]); $countTrade = count($explodeTrade) - 1; for ($a = 0; $a <= $countTrade;) if ($Submit == "Create Trade!") { $getitems = mysql_query("SELECT * FROM usersitems2 WHERE owner = '$userid' AND game = '$game'"); while ($getitems2 = mysql_fetch_array($getitems)) { $get_item = fetch("SELECT * FROM items2 WHERE id = '$getitems2[item_id]' AND game = '$game'"); $tradeID = $getitems2[id]; $endTime = $timestamp + $end_in; if ($trade_item[$tradeID] == 1) { mysql_query("INSERT INTO trades2 (item_name1,owner,end_time,date,wishlist,game) VALUES ('$trade_item[$tradeID]','$username','$endTime','$current_date','$wishlist','$game')"); mysql_query("DELETE FROM usersitems2 WHERE owner = '$userid' AND id = 'Not added yet to avoid deleting items' AND game = '$game'"); } } die(header(error("trade2.php?game=$game&page=search&search_by=my_trades","That item has been put into trade!"))); }
  4. Neither is it randomizing, it seems to be picking the same item_id out of four different ones over and over.
  5. I just noticed that and another mistake I made in the original code. I've gotten it to pull up the item and remove it with inserting the record but it's also taking all of the items if you have more then one. if ($username) { $getRandomEventSteal = fetch("SELECT * FROM usersitems2 WHERE owner = '$userid' AND game = '$game'"); $getitemSteal = rand(1,5); if ($getitemSteal == "5") { $getPrize = explode(" ", $getRandomEventSteal[item_id]); $randPrize = rand(0, count($getPrize) - 1); $getPrize2 = $getPrize[$randPrize]; $find_item3 = fetch("SELECT * FROM items2 WHERE id = '$getPrize2'"); if ($find_item3[id]) { $randomEvent .= " <center><br><table width=300 border=1 cellpadding=4 cellspacing=0 bordercolor=#000000 bgcolor=#ffffff><tr><td> <img src=$base_url/images/user_images/opg_$game/items/item_$find_item3[id].gif width=90 height=90 hspace=10 align=left> <font color=#000000 size=3 face=verdana><b>X</b> appears and steals a $find_item3[item_name] from you!</font></td></tr></table></center> "; mysql_query("DELETE FROM usersitems2 WHERE item_id = '$find_item3[id]' AND owner = '$userid' AND game = '$game'"); mysql_query("INSERT INTO random_events2 (item_id,item_name,owner,owner_name,date,timestamp,game) VALUES ('$find_item3[id]','$find_item3[item_name]','$userid','$username','$datestamp','$timestamp','$game')"); } } }
  6. I'm trying to code in a random event that pulls a random item from a users inventory and removes it. Currently we have random events that add in items from a specific list of pre-set items but I want this to pull from the users inventory and not a pre-set list. I think the problem I'm having is getting it to pull the inventory and randomize but I can't see what I'm doing wrong. if ($username) { $getRandomEventSteal = fetch("SELECT * FROM useritems2 WHERE game = '$game'"); $getitemSteal = rand(1,5); if ($getitemSteal == "5") { $getPrize = $getRandomEventSteal[item_id]; $randPrize = rand(0,$getRandomEventSteal[item_id]); $getPrize2 = $getPrize[$randPrize]; $find_item3 = fetch("SELECT * FROM items2 WHERE id = '$getPrize2'"); if ($find_item3[id]) { $randomEvent .= " <center><br><table width=300 border=1 cellpadding=4 cellspacing=0 bordercolor=#000000 bgcolor=#ffffff><tr><td> <img src=$base_url/images/user_images/opg_$game/items/item_$find_item3[id].gif width=90 height=90 hspace=10 align=left> <font color=#000000 size=3 face=verdana><b>X</b> appears and steals a $getPrize2 from you!</font></td></tr></table></center> "; mysql_query("DELETE FROM usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','$find_item3[id]','$find_item3[parts]','$game')"); mysql_query("INSERT INTO random_events2 (item_id,item_name,owner,owner_name,date,timestamp,game) VALUES ('$find_item3[id]','$find_item3[item_name]','$userid','$username','$datestamp','$timestamp','$game')"); } } }
  7. No, I didn't not have that but when checking I found a snippet that I missed. I have this: if(!$pageon){ $pageon = 1; } But even with adding in what you've suggested it's not making a difference. At the top of your script did you have something like... if(isset($_GET['pageon'])) { $pageon = $_GET['pageon']; } ... to actually use the value that your persisting in the URL?
  8. I've tried that, it makes the url change to /usergallery.php?pageon=5 and leaves out the other info that is needed.
  9. What I'm trying to do is make the url reflect what a user inputs into the form. In this case it's to go to specific pages in a gallery. So for instance if I put 5 in the box and hit go I want the url to reflect that (/usergallery.php?game=1&user=sinikka&pageon=5). $totalpage = mysql_num_rows(mysql_query("SELECT * FROM usergallerys_items WHERE owner = '$find_owner[id]' AND game = '$game'")); $totalpage = ceil($totalpage / 40); if($pageon > $totalpage){ $pageon = $totalpage; } $lmin = $pageon * 40; $lmin -= 40; ?> <div align=center><a href=usergallery.php?game=<?echo($game)?>&user=<?echo($user)?>&pageon=<?echo($pageon!='$totalpage') ? $pageon-1 : '1';?>> < Previous</a> Page <?=$pageon;?> of <?=$totalpage;?> <a href=usergallery.php?game=<?echo($game)?>&user=<?echo($user)?>&pageon=<?echo($pageon!=$totalpage) ? $pageon+1 : '1';?>>Next ></a></center><br> <center><form action=usergallery.php?game=<?echo($game)?>&user=<?echo($user)?> method=post> <input type=text name="pageon" size="3" style="border: solid 1px #000000; font-size: 8pt; font-family: Verdana;"/> <input type="submit" value="Go" style="border: solid 1px #000000; font-size: 8pt; font-family: Verdana; background: #ffffff" /></form> </div><br> <? Code it needs, maybe not specifically this phase but similar. Goes after &user=<?echo($user)?> in the last cluster. &pageon=<?echo($pageon)?> When I try the above phrase it keeps the url properly but doesn't pull the page ever, it always leaves it on 1 no matter what number I input.
  10. I tested it with just one shop restocking only with the id added in and it still refreshes continually for a full minute. I'm at a complete loss with things to try.
  11. Thank you, I'll try adding in a query for each shop and see if that stops the continual updating. What do you mean by the shebang line?
  12. Ok, I contacted my hosting server and was told that the crons are setup properly and that the problem is with the script. I can't find anything within my script posted above that would continually refresh the stock.
  13. I have a cron setup through cronjobs to restock shops at certain times through out the day and the cron works correctly with one exception. For about a minute from the time the cron executes it seems to be refreshing continually when it's only supposed to refresh the stock one time. If anyone could possibly help me with why it's doing this I'd appreciate it very much. <?php #!/usr/bin/php $dbh=mysql_connect ("localhost", "DBNAME", "DBPW") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("DBNAME"); $findItems = mysql_query("SELECT * FROM shop_items2 WHERE game = '1'"); while ($getItems = mysql_fetch_array($findItems)) { $id = $getItems[id]; $getItems[max_stock] = round($getItems[max_stock] / 3); $rand[$id] = rand(0,$getItems[max_stock]); } foreach ($rand as $id => $val) { $sql2="UPDATE `shop_items2` SET cur_stock=ROUND((max_stock/3) * RAND() ) WHERE game = '1' "; mysql_query($sql2); } echo $sql2; ?>
  14. On our site we have a mail system where you can accept mails from people who are on your buddy list and the problem I'm having is I can't get it to allow mail from the buddies to go through. It's acting as though the two people aren't on each others list when they are. Any help or suggestions anyone has would be greatly appreciated. $userid is used throughout the coding to pull the individuals info and is defined in the global file. $rank is used throughout the coding to define what rank the person has on the site and is defined in the global file. $send_to = strtolower(ereg_replace(" ","",$send_to)); $findTo = fetch("SELECT id,display_name,premium,rank,username FROM members2 WHERE username = '$send_to' AND game = '$game'"); if (!$findTo[id]) { die(header(error("mail_send.php?game=$game&type=$type&id=$id", "The user you are trying to send this to does not exist."))); } $findTo2 = fetch("SELECT mail_settings FROM members_profiles2 WHERE username = '$findTo[username]' AND game = '$game'"); if (($findTo2[mail_settings] == 1) && ($rank <= 3)) { $findBud = fetch("SELECT id FROM buds2 WHERE bud_me = '$userid' AND bud_you = '$findTo[id]' AND game = '$game'"); if (!$findBud[id]) { die(header(error("mail_send.php?game=$game&type=$type&id=$id", "Sorry, that user only accepts messages from their buddies."))); } }
  15. What I'm trying to do is insert an item into the database if it doesn't exist but if it does exist I'm trying to get it to update the amount in stock. I have no problems getting it to insert if it doesn't exist but I can't get the existing stock to update. Here's the coding I'm working with. if ($findItem[id]) { $sql = mysql_query("SELECT * FROM admin_recieved WHERE item_id = '$findItem[id]' AND owner = '$findUser[id]'"); $result = mysql_num_rows($sql); if($result =="0") { $sql = mysql_query("INSERT INTO admin_recieved (item_id,item_name,owner,owner_name,admin_id,admin_name,stock,date,game) VALUES ('$findItem[id]','$findItem[item_name]','$findUser[id]','$findUser[display_name]','$userid','$username','$item_amount','$datestamp','$game')"); if($result != "0") { mysql_query("UPDATE admin_recieved SET stock = stock + $item_amount WHERE item_id = '$findItem[id]' AND owner = '$findUser[id]' AND game = '$game'"); } } }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.