Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include "includes/db_connect.php";
- include "includes/functions.php";
- logincheck();
- $username=$_SESSION['username'];
- $query=mysql_query("SELECT * FROM users WHERE username='$username' LIMIT 1");
- $info = mysql_fetch_object($query);
- $query1=mysql_query("SELECT * FROM users WHERE username='$username' LIMIT 1");
- $fetch2 = mysql_fetch_object($query1);
- $fetch=mysql_query("SECLET * FROM users WHERE username='$username'");
- $date = gmdate('Y-m-d h:i:s');
- if (strip_tags($_POST['sellcreditssubmit']) && strip_tags($_POST['sellcreditsamount']) && strip_tags($_POST['sellcreditsprice'])){
- $sellcreditsamount = strip_tags($_POST['sellcreditsamount']);
- $sellcreditsprice = strip_tags($_POST['sellcreditsprice']);
- if($info->points < $sellcreditsamount){
- echo "<table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0><tr><td class=notice align=center><center><font color=red>You havent got enough credits!</td></tr></table><br>";
- }elseif($sellcreditsamount < "1"){
- echo "<table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0><tr><td class=notice align=center><center><font color=red>You cannot sell less than one credit!</td></tr></table><br>";
- }elseif($sellcreditsprice < "1"){
- echo "<table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0><tr><td class=notice align=center><center><font color=red>You cannot sell credits for less than £1!</td></tr></table><br>";
- }elseif($info->points >= $sellcreditsamount){
- $newcredits=$info->points - $sellcreditsamount;
- mysql_query("UPDATE users SET points='$newcredits' WHERE username='$username'");
- mysql_query("INSERT INTO `blackmarket` ( `id` , `username` , `amount` , `cost` , `type` , `date` )
- VALUES ('', '$username', '$sellcreditsamount', '$sellcreditsprice', 'credits', '$date')");
- echo "<table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0><tr><td class=notice align=center><center><font color=green>Credits have been added!</td></tr></table><br>";
- }}
- //////////////////////////////////////////////////
- $buysellcredits=strip_tags($_GET['option']);
- $buy=strip_tags($_GET['buy']);
- $remove=strip_tags($_GET['remove']);
- if ($buy){
- $buycredits=mysql_fetch_object(mysql_query("SELECT * FROM blackmarket WHERE id= '$buy'"));
- if($buycredits->username == $username){
- echo"<table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0><tr><td class=notice align=center><center><font color=red>You cannot buy your own credits!</td></tr></table><br>"; }
- elseif($buycredits->cost-1 >= $fetch2->money){
- echo"<table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0><tr><td class=notice align=center><center><font color=red>You dont have enough money to buy those!</td></tr></table><br>";
- }elseif($buycredits->username != $username && $buycredits->cost <= $fetch2->money){
- $buyercreditsamount=$buycredits->amount;
- $buyernewcredits=$fetch2->points + $buyercreditsamount;
- mysql_query("UPDATE users SET points='$buyernewcredits' WHERE username='$username'");
- $buyercreditscost=$buycredits->cost;
- $buyernewmoney=$fetch2->money - $buyercreditscost;
- mysql_query("UPDATE users SET money='$buyernewmoney' WHERE username='$username'");
- $creditsseller=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$buycredits->username'"));
- $sellercreditscost=$buycredits->cost;
- $sellernewmoney=$creditsseller->money+$buycredits->cost;
- mysql_query("UPDATE users SET money='$sellernewmoney' WHERE username='$buycredits->username'");
- mysql_query("DELETE FROM blackmarket WHERE id='$buy'");
- mysql_query("INSERT INTO `blackmarket_logs` ( `id` , `seller` , `buyer` , `amount` , `type` , `price` , `date` )
- VALUES ('', '$buycredits->username', '$username', '$buycredits->amount', 'Credits', '$buycredits->cost', '$date')");
- echo"<table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0><tr><td class=notice align=center><center><font color=green>You successfully brought those credits!</td></tr></table><br>";
- }}
- if($remove){
- $removecredits=mysql_fetch_object(mysql_query("SELECT * FROM blackmarket WHERE id= '$remove'"));
- $fetchcreditsowner=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username= '$removecredits->username'"));
- if($removecredits->username == $username){
- mysql_query("DELETE FROM blackmarket WHERE id='$remove' AND username='$removecredits->username'");
- $pluscredits=$removecredits->amount;
- $newcredits=$fetch2->points+$pluscredits;
- mysql_query("UPDATE users SET points='$newcredits' WHERE username='$removecredits->username'");
- echo"<table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0><tr><td class=notice align=center><center><font color=green>You successfully removed your credits!</td></tr></table><br>";
- }elseif($info->userlevel == "3"){
- mysql_query("DELETE FROM blackmarket WHERE id='$remove' AND username='$removecredits->username'");
- $pluscredits=$removecredits->amount;
- $newcredits=$fetchcreditsowner->points+$pluscredits;
- mysql_query("UPDATE users SET points='$newcredits' WHERE username='$removecredits->username'");
- mysql_query("INSERT INTO `inbox` (`id`, `subject`, `to`, `from`, `message`, `date`, `read`) VALUES ('', 'Blackmarket', '$removecredits->username', 'MH Staff', 'Your credits have been removed from the blackmarket by a member of staff. This may be because of several different reasons, usually it is because you have set the price as an un-reasonable amount.', '$date', '0');") or die (mysql_error());
- echo"<table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0><tr><td class=notice align=center><center><font color=green>You successfully removed those credits! The owner has been notified.</td></tr></table><br>";
- }else{ echo"<table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0><tr><td class=notice align=center><center><font color=red>You cannot remove those!</td></tr></table><br>"; }}
- //////////////////////////////////////////////////
- if($removecredits->username == $username){ $buyremoveimage = "<a href=?remove=$coolshow->id><img src='http://icons.iconarchive.com/icons/fatcow/farm-fresh/24/cross-icon.png'></a>"; }else{ $buyremoveimage ="<a href=?buy=$coolshow->id><img src='http://icons.iconarchive.com/icons/fatcow/farm-fresh/24/cart-icon.png'></a>"; }
- ?>
- <?
- if ($site->gupdate == "1"){
- echo "<link href='style.css' rel='stylesheet' type='text/css'><center><div class='update'>$site->gupdatetext</div></center>
- <br>";
- }
- ?>
- <html>
- <head>
- <link href="style.css" rel="stylesheet" type="text/css">
- <script type="text/javascript" src="js/jquery.js"></script>
- <script type="text/javascript" src="js/jquery.tooltip.js"></script>
- <script type="text/javascript">
- $(document).ready(function(){
- tooltip('hover', 'class');
- });
- function checkAll(theElement) {
- var theForm = theElement.form, z = 0;
- for(z=0; z<theForm.length;z++){
- if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
- theForm[z].checked = theElement.checked;
- }
- }
- }
- </script>
- <script type="text/javascript">
- $(document).ready(function(){
- if("bullet" == "bullet"){
- $("#bullet_type1").attr("title", "<b>You have:</b> 60,000");
- $("#bullet_type2").attr("title", "<b>You have:</b> 7,627");
- tooltip("bullet_type1", "id");
- tooltip("bullet_type2", "id");
- }
- });
- $(function() {
- $('.item_popup').nyroModal({
- callbacks :{afterShowCont: function (){
- tooltip("hover", "class");
- }}
- });
- tooltip('item_popup', 'class');
- });
- $(document).ready(function(){
- $('.user_link').nyroModal({
- callbacks :{afterShowCont: function (){
- tooltip("hover", "class");
- }}
- });
- tooltip('user_link', 'class');
- });
- $(document).ready(function(){
- setTimer("timer1", 122635, {
- 0: function()
- {
- window.location.href=window.location.href;
- }});
- });
- $(document).ready(function(){
- setTimer("timer2", 130708, {
- 0: function()
- {
- window.location.href=window.location.href;
- }});
- });
- $(document).ready(function(){
- setTimer("timer3", 130770, {
- 0: function()
- {
- window.location.href=window.location.href;
- }});
- });
- $(document).ready(function(){
- setTimer("timer4", 144538, {
- 0: function()
- {
- window.location.href=window.location.href;
- }});
- });
- $(document).ready(function(){
- setTimer("timer5", 147722, {
- 0: function()
- {
- window.location.href=window.location.href;
- }});
- });
- $(document).ready(function(){
- setTimer("timer6", 172168, {
- 0: function()
- {
- window.location.href=window.location.href;
- }});
- });
- $(document).ready(function(){
- setTimer("timer7", 172619, {
- 0: function()
- {
- window.location.href=window.location.href;
- }});
- });
- $(document).ready(function(){
- setTimer("timer8", 172800, {
- 0: function()
- {
- window.location.href=window.location.href;
- }});
- });
- </script>
- <style type="text/css">
- #tooltip {
- position: absolute;
- z-index: 3000;
- border: 1px solid #333333;
- background-color: #222222;
- color: #FFFFFF;
- font: 11px Verdana, Arial, Helvetica, sans-serif;
- padding: 5px;
- opacity: 0.85;
- max-width: 310px;
- }
- #tooltip h3, #tooltip div { margin: 0; }
- #tooltip h3 {
- color: #FFFFFF;
- font-size: 12px;
- font-weight: normal;
- }
- .pagenumbers {
- background-color: #222222;
- padding: 4px 0;
- }
- .bar_cont {
- display: inline-block;
- vertical-align:middle;
- }
- .bar {
- position: relative;
- width: 150px;
- line-height: 11px;
- border: 1px solid #000;
- color: #000000;
- background: url('images/crimebg/red.jpg');
- background-repeat: repeat-x;
- }
- .rg {
- position: relative;
- height: 11px;
- background-image: url('images/crimebg/green.jpg');
- background-repeat: repeat-x;
- z-index: 2;
- }
- .textinput{
- background-color: #222222;
- color: #999999;
- font: 11px Verdana, Arial, Helvetica, sans-serif;
- height: 22px;
- width: 150px;
- border: 1px solid #333333;
- }
- .menubox {
- text-align: left;
- margin-left: 5px;
- margin-right: 5px;
- margin-bottom: 5px;
- border: 1px solid #333333;
- background-color: #111111;
- padding: 5px 5px 5px 5px;
- }
- .menubox a {
- color: #CCCCCC;
- text-decoration: none;
- display: block;
- width: 50px;
- }
- .menubox .unselected_link {
- border: 1px solid #505050;
- cursor: pointer;
- margin: 6px;
- padding: 5px 0px 5px 0px;
- vertical-align: middle;
- color: #cccccc;
- background: url(images/subhead.png) repeat-x;
- font: 11px Tahoma, Verdana, Arial, Helvetica, sans-serif;
- }
- .menubox .selected_link {
- border: 1px solid #505050;
- cursor: pointer;
- margin: 6px;
- padding: 5px 0px 5px 0px;
- vertical-align: middle;
- color: #cccccc;
- background: url(images/selected_box.png) repeat-x;
- font: 11px Tahoma, Verdana, Arial, Helvetica, sans-serif;
- }
- .img {
- border: 1px solid #000000; }
- </style>
- </head>
- <body>
- <center><table class='menubox' align='center' style='border-radius: 20px; border: 0px;'>
- <tr>
- <td align='center'>
- <div style='float:left;'><a href='blackmarket.php' class='selected_link' style='width: 120px;'><u>Credits</u></a></div>
- <div style='float:left;'><a href='blackmarket_bullets.php' class='unselected_link' style='width: 120px;'><u>Bullets</u></a></div>
- </td>
- </tr>
- </table></center><br><br>
- <div id=overDiv style="position:absolute; visibility:hidden; z-index:1000;"></div>
- <form name="form" method="post" action="">
- <table border="0" width="650" align="center" cellpadding="0" cellspacing="0" class="table">
- <tr class="header">
- <td colspan="5" align="center">Black Market</td>
- </tr>
- <tr>
- <td width="150" class='subhead' align="center">Username</td>
- <td width="150" class='subhead' align="center">Offer</td>
- <td width="150" class='subhead' align="center">Cost</td>
- <td width="50" class='subhead' align="center"> </td>
- <td width="50" class='subhead' align="center"> </td>
- </tr>
- <?
- $whatpage=$_GET['page'];
- $getTopics = mysql_query("SELECT * FROM `blackmarket`");
- $totalTopics = mysql_num_rows($getTopics);
- $topics_per_page = 15;
- $offset = (int)$_GET['page'] * $topics_per_page;
- $pages = ceil($totalTopics / $topics_per_page);
- for ($i=0;$i<$pages;$i++)
- {
- $n = $i+1;
- if ($_GET['page'] == $i)
- {
- $page .= "<b style='padding:4px; background-color: #173478; border-radius:20px; border-radius:20px;'>$n</b> ";
- }
- else
- {
- $page .= "<a href='blackmarket.php?page=$i' style='padding:4px; background-color: #111111; border-radius:20px; text-decoration: none;'>$n</a> ";
- }}
- $queryshow=mysql_query("SELECT * FROM blackmarket ORDER BY id DESC LIMIT $offset, $topics_per_page");
- $num=mysql_num_rows($queryshow);
- while($coolshow = mysql_fetch_object($queryshow)){
- echo "
- <tr><td align=center height='40'><a href=profile.php?viewuser=$coolshow->username><b>$coolshow->username</b></a></td>
- <td align=center height='40'><b>".makecomma($coolshow->amount)." Credits</b></td>
- <td align=center height='40'><b>£".makecomma($coolshow->cost)."</b></td>
- <td align=center height='40'><a href=?buy=$coolshow->id><img src='images/acc.png'></a></td>
- <td align=center height='40'><a href=?remove=$coolshow->id><img src='images/del.png'></a></td>
- </td>
- </tr>";
- }
- if ($num == "0"){
- echo"<tr><td height='40' colspan=10 align=center>There are no current offers on the black market!</td></tr>";
- }
- ?>
- <tr><td colspan='6' align='center' class='pagenumbers'>
- <? echo "$page"; ?>
- </td></tr>
- </table>
- </form>
- <br />
- <form method="post" action="">
- <div align=center><table width="250" align="center" cellpadding="0" cellspacing="0" bordercolor="" class="table" border='0'>
- <tr>
- <td class='header' colspan='4'><div align='center'>Add Offer</td>
- </tr>
- <tr><td> </td></tr>
- <tr>
- <td align=right> Credits: </td>
- <td><input name='sellcreditsamount' type='text' class=textinput size='30' style='height:20' onkeyup="this.value=this.value.replace(/[^0-9]/g, '');" autocomplete="off"></td>
- </tr>
- <tr><td> </td></tr>
- <tr>
- <td align=right> Amount: </td>
- <td><input name='sellcreditsprice' type='text' class=textinput size='30' style='height:20' onkeyup="this.value=this.value.replace(/[^0-9]/g, '');" autocomplete="off"></td>
- </tr>
- <tr><td> </td></tr>
- <tr>
- <td align=center colspan=3><input type="submit" name="sellcreditssubmit" value="Add" class="button"></td>
- </tr></table>
- </form>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement