HITMAN 17 Posted October 11, 2008 Share Posted October 11, 2008 Guys i need an auction cron fix as at the moment the auction is going into -1 day This is the cron at the moment <?php include "config.php"; global $_CONFIG; if($_GET['code'] != $_CONFIG['code']) { die(""); } define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; $db=new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c=$db->connection_id; $db->query("update auctions set time=time-1",$c); $query = mysql_query("SELECT * FROM auctions WHERE time=0 OR time<0") or die(mysql_error()); while($soc = mysql_fetch_assoc($query)) { $time=$win['time']; $item=$win['itemname']; $winner=$win['bidder']; $owner=$win['owner']; $iname=mysql_result($db->query("SELECT itmname FROM items WHERE itmid={$item}", $c), 0, 0); if($win['bids']>0) { $db->query("insert into inventory VALUES('',$item,$winner,1)",$c) or die(mysql_error()); event_add($winner,"You won the auction of the {$iname} for \${$win['current']}",$c); event_add($owner, "Your {$iname} sold succesfully on the auction market with {$win['bids']} bids. You have been paid \${$win['current']}", $c); $db->query("update users set money=money+{$win['current']},auctionquota=auctionquota-1 where userid=$owner", $c); } if($win['bids']==0) { event_add($win['owner'],"Your auction has ended with no bidders. Your {$iname} has been returned to your inventory.",$c); $winner=$win['owner']; $db->query("insert into inventory VALUES('',$item,$winner,1)",$c) or die(mysql_error()); } } $db->query("delete from auctions where time=0", $c); ?> Quote Link to comment Share on other sites More sharing options...
Uriah Posted October 11, 2008 Share Posted October 11, 2008 Re: [Mcodes V2]Auction Cron Fix[Needed] should $db->query("delete from auctions where time=0", $c); be $db->query("DELETE FROM 'auctions' WHERE 'time' <0", $c); or $db->query("DELETE FROM 'auctions' WHERE time ==0", $c); Keep in mind I am a total noob and I am probably way wrong!!! Quote Link to comment Share on other sites More sharing options...
~Spooky~ Posted October 11, 2008 Share Posted October 11, 2008 Re: [Mcodes V2]Auction Cron Fix[Needed] <?php /*----------------------------------------------------- -- Psychotic Insanity -- A product of iMatters Game and Web Design -- Copyright held 2008 by ~Spooky~ -- E-mail: sexysalemchickgamer[AT]hotmail[DOT]com -----------------------------------------------------*/ include "config.php"; if($_GET['code'] != $_CONFIG['code']) { die(""); } require "mysql.php"; mysql_query("UPDATE auctions SET time=time-1 WHERE time>0",$c); $qqq=mysql_query("SELECT * FROM auctions WHERE time=0",$c); while($win=mysql_fetch_array($qqq)) { $time=$win['time']; $item=$win['itemname']; $winner=$win['bidder']; $owner=$win['owner']; $iname=mysql_result(mysql_query("SELECT itmname FROM items WHERE itmid={$item}", $c), 0, 0); if($win['bids']>0) { mysql_query("insert into inventory VALUES('',$item,$winner,1)",$c) or die(mysql_error()); mysql_query("INSERT INTO events VALUES('',$winner,UNIX_TIMESTAMP(),0,'You won the auction of the {$iname} for \${$win['current']}')",$c) or die(mysql_error()); mysql_query("INSERT INTO events VALUES('',$owner,UNIX_TIMESTAMP(),0,'Your {$iname} sold succesfully on the auction market with {$win['bids']} bids. You have been paid \${$win['current']}')",$c) or die(mysql_error()); mysql_query("UPDATE users SET new_events=new_events+1 WHERE owner={$userid}", $c); mysql_query("UPDATE users SET new_events=new_events+1 WHERE winner={$userid}", $c); mysql_query("update users set money=money+{$win['current']},auctionquota=auctionquota-1 where userid=$owner", $c); } if($win['bids']==0) { $owner=$win['owner']; mysql_query("INSERT INTO events VALUES('',$owner,UNIX_TIMESTAMP(),0,'Your auction has ended with no bidders. Your {$iname} has been returned to your inventory.')",$c) or die(mysql_error()); $winner=$win['owner']; mysql_query("insert into inventory VALUES('',$item,$winner,1)",$c) or die(mysql_error()); } } mysql_query("DELETE FROM auctions WHERE time=0", $c); print "Done!"; ?> Try that code. Works on my game. May need to edit little I do run both V1 and V2 games. If you add the mysql to your V2 it be just fine. Quote Link to comment Share on other sites More sharing options...
HITMAN 17 Posted October 12, 2008 Author Share Posted October 12, 2008 Re: [Mcodes V2]Auction Cron Fix[Needed] nice one mate this does work that you very much Quote Link to comment Share on other sites More sharing options...
MyGunWars Posted October 13, 2008 Share Posted October 13, 2008 Re: [Mcodes V2]Auction Cron Fix[Needed] Nice I will see if it works :-D Quote Link to comment Share on other sites More sharing options...
Zero-Affect Posted October 26, 2008 Share Posted October 26, 2008 Re: [Mcodes V2]Auction Cron Fix[Needed] should $db->query("delete from auctions where time=0", $c); be $db->query("DELETE FROM 'auctions' WHERE 'time' <0", $c); or $db->query("DELETE FROM 'auctions' WHERE time ==0", $c); Keep in mind I am a total noob and I am probably way wrong!!! $db->query('DELETE FROM `auctions` WHERE `time` <= 0'); i would use that Quote Link to comment Share on other sites More sharing options...
_Ricky_ Posted November 24, 2008 Share Posted November 24, 2008 Re: [Mcodes V2]Auction Cron Fix[Needed] i used what zero said to use, the cron now works......but it doesnt give neither the person that bidded or the seller no cash or item....all it does is delete it Quote Link to comment Share on other sites More sharing options...
Zero-Affect Posted November 24, 2008 Share Posted November 24, 2008 Re: [Mcodes V2]Auction Cron Fix[Needed] i used what zero said to use, the cron now works......but it doesnt give neither the person that bidded or the seller no cash or item....all it does is delete it well i was correcting the delete query... but yeah mine would work Quote Link to comment Share on other sites More sharing options...
_Ricky_ Posted November 24, 2008 Share Posted November 24, 2008 Re: [Mcodes V2]Auction Cron Fix[Needed] well its nothing to do with what you said to add, if you enter the code as is it runs a negitive...do it your way and it deletes it but dont give anyone the item or the cash Quote Link to comment Share on other sites More sharing options...
_Ricky_ Posted November 24, 2008 Share Posted November 24, 2008 Re: [Mcodes V2]Auction Cron Fix[Needed] accually is said this wrong maybe...it gives the person the item but not the seller the cash and the events dont work Quote Link to comment Share on other sites More sharing options...
HITMAN 17 Posted December 1, 2008 Author Share Posted December 1, 2008 Re: [Mcodes V2]Auction Cron Fix[Needed] ok there is one other problem with this that the auction doesnt credit the person who was selling the item the money Quote Link to comment Share on other sites More sharing options...
AlabamaHit Posted December 1, 2008 Share Posted December 1, 2008 Re: [Mcodes V2]Auction Cron Fix[Needed] <?php include "config.php"; if($_GET['code'] != $_CONFIG['code']) { die(""); } require "mysql.php"; require "global_func.php"; $time = ("UPDATE auctions SET time = time - 1 WHERE time > 0"); mysql_query($time); $getit = sprintf("SELECT * FROM autctions WHERE time = '%d' ", (0)); $doit = mysql_query($getit); while ($win = mysql_fetch_arrya($doit) { $time=$win['time']; $item=$win['itemname']; $winner=$win['bidder']; $owner=$win['owner']; $iname=mysql_result(mysql_query("SELECT itmname FROM items WHERE itmid={$item}", $c), 0, 0); if($win['bids'] > 0) { item_add($winner,$item,1); //amazing how much easier item add is huh? event_add($winner, "You won the auction of the {$iname} for \${$win['current']}."); //another amazing feature event_add($owner, "Your {$iname} sold succesfully on the auction market with {$win['bids']} bids. You have been paid \${$win['current']}."); $do1 = ("UPDATE users SET new_events = new_events + 1 WHERE owner = ".$userid." "); $do2 = ("UPDATE users SET new_events = new_events + 1 WHERE winner = ".$userid." "); $do3 = ("UPDATE users SET money = money + ".$win['current'].", auctionquota = auctionquota - 1 WHERE userid = $owner"); mysql_query($do1); mysql_query($do2); mysql_query($do3); } if($win['bids'] == 0) { $owner = $win['owner']; event_add($owner, "Your auction has ended with no bidders. Your {$iname} has been returned to your inventory."); item_add($owner,$item,1); } } $delete = ("DELETE FROM auctions WHERE time <= 0"); mysql_query($delete); print "Done!"; ?> Quote Link to comment Share on other sites More sharing options...
HITMAN 17 Posted December 1, 2008 Author Share Posted December 1, 2008 Re: [Mcodes V2]Auction Cron Fix[Needed] oo cheers ill try now Quote Link to comment Share on other sites More sharing options...
AlabamaHit Posted December 1, 2008 Share Posted December 1, 2008 Re: [Mcodes V2]Auction Cron Fix[Needed] [code] <?php include "config.php"; global $_CONFIG; if($_GET['code'] != $_CONFIG['code']) { die(""); } define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; require "global_func.php"; $db=new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c=$db->connection_id; $set=array(); $settq=$db->query("SELECT * FROM settings"); while($r=$db->fetch_row($settq)) { $set[$r['conf_name']]=$r['conf_value']; } $time = ("UPDATE auctions SET time = time - 1 WHERE time > 0"); mysql_query($time); $getit = sprintf("SELECT * FROM autctions WHERE time = '%d' ", (0)); $doit = mysql_query($getit); while ($win = mysql_fetch_arrya($doit) { $time=$win['time']; $item=$win['itemname']; $winner=$win['bidder']; $owner=$win['owner']; $iname=mysql_result(mysql_query("SELECT itmname FROM items WHERE itmid={$item}", $c), 0, 0); if($win['bids'] > 0) { item_add($winner,$item,1); //amazing how much easier item add is huh? event_add($winner, "You won the auction of the {$iname} for \${$win['current']}."); //another amazing feature event_add($owner, "Your {$iname} sold succesfully on the auction market with {$win['bids']} bids. You have been paid \${$win['current']}."); $do1 = ("UPDATE users SET new_events = new_events + 1 WHERE owner = ".$userid." "); $do2 = ("UPDATE users SET new_events = new_events + 1 WHERE winner = ".$userid." "); $do3 = ("UPDATE users SET money = money + ".$win['current'].", auctionquota = auctionquota - 1 WHERE userid = $owner"); mysql_query($do1); mysql_query($do2); mysql_query($do3); } if($win['bids'] == 0) { $owner = $win['owner']; event_add($owner, "Your auction has ended with no bidders. Your {$iname} has been returned to your inventory."); item_add($owner,$item,1); } } $delete = ("DELETE FROM auctions WHERE time <= 0"); mysql_query($delete); print "Done!"; ?> if that dont work, I don't have any idea.... [/code] Quote Link to comment Share on other sites More sharing options...
HITMAN 17 Posted December 1, 2008 Author Share Posted December 1, 2008 Re: [Mcodes V2]Auction Cron Fix[Needed] it dont work maybe someone elser can help Quote Link to comment Share on other sites More sharing options...
HITMAN 17 Posted December 1, 2008 Author Share Posted December 1, 2008 Re: [Mcodes V2]Auction Cron Fix[Needed] ok guys i really tried for a few hours fixing it but i can fix it can someone please have an attempt and i have looked around the forum whats going on Quote Link to comment Share on other sites More sharing options...
Ishraq Posted October 3, 2009 Share Posted October 3, 2009 This works 1000% <?php include "config.php"; global $_CONFIG; if($_GET['code'] != $_CONFIG['code']) { die(""); } define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; $db=new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c=$db->connection_id; $db->query("update auctions set time=time-1",$c); $qqq=$db->query("select * from auctions where time=0",$c); while($win=$db->fetch_row($qqq)) { $time=$win['time']; $item=$win['itemname']; $winner=$win['bidder']; $owner=$win['owner']; $iname=$db->result( $db->query("SELECT itmname FROM items WHERE itmid={$item}", $c), 0, 0); if($win['bids']>0) { $db->query("insert into inventory VALUES('',$item,$winner,1)",$c) or die(mysql_error()); event_add($winner,"You won the auction of the {$iname} for \${$win['current']}",$c); event_add($owner, "Your {$iname} sold succesfully on the auction market with {$win['bids']} bids. You have been paid \${$win['current']}", $c); $db->query("update users set money=money+{$win['current']},auctionquota=auctionquota-1 where userid=$owner", $c); } if($win['bids']==0) { event_add($win['owner'],"Your auction has ended with no bidders. Your {$iname} has been returned to your inventory.",$c); $winner=$win['owner']; $db->query("insert into inventory VALUES('',$item,$winner,1)",$c) or die(mysql_error()); } } $delete = ("DELETE FROM auctions WHERE time <= 0"); mysql_query($delete); ?> 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.