All pastes #298431 Raw Edit

Anonymous

public php v1 · immutable
#298431 ·published 2006-12-31 22:50 UTC
rendered paste body
<?php$get_restock = @mysql_query( "SELECT * FROM `events` WHERE `name`='restock'" );$count_restock = @mysql_num_rows( $get_restock );$restock = @mysql_fetch_array( $get_restock );$get_shops = @mysql_query( "SELECT * FROM `shops`" );$get_items = @mysql_query( "SELECT * FROM `items`" );if ( $count_restock == 0 ){	$update = @mysql_query( "INSERT INTO `events` (`name`, `message`) VALUES ('restock', '" . time() . "')" );}if ( ( time() - $restock['message'] ) > 900 ){	$update = @mysql_query( "UPDATE `events` SET `message`='" . time() . "' WHERE `id`='{$restock['id']}'" );	//delete the old items	while ( $shops = @mysql_fetch_array( $get_shops, MYSQL_ASSOC ) )	{		$delete = @mysql_query( "DELETE FROM `user_items` WHERE `place`='shop_{$shops['id']}'" );	}		while ( $items = @mysql_fetch_array( $get_items, MYSQL_ASSOC ) )	{		$random = mt_rand( 1, $items['rarity'] );				if ( $random == 1 )		{			$make = @mysql_query( "INSERT INTO `user_items` (`name`, `place`) VALUES ('{$items['name']}', '{$items['place']}')" );		}	}}?>