Jump to content
MakeWebGames

Smokey

Members
  • Posts

    137
  • Joined

  • Last visited

Everything posted by Smokey

  1. I'm wondering if a shared server is just too small for the amount of activity, which is anywhere from 3 to 14 in the last minute, usually 15 - 30 on within 15 min and around 130 - 150 daily, it seems when it hits closer to 30 online within the last 15 min it starts throwing a max_user_connections error. Even worse it seems when I have either Arrowchat or Dave Macaulay's Ajax Chat running. I bought the Arrowchat because my last host said Dave's chat was not closing connections properly, as did the host I'm using now - Bluehost, when I asked them to raise my max user connections limit - which they didn't. But to my understanding the mysql connections should not be persistent therefore close automatically anyway. From the database: max. concurrent connections - 757, I don't see a max user connections setting. So, I'm a bit stumped. Is this really a code issue or do I need a VPS server?
  2. There wasn't anything wrong with the code I posted, all those asterisks aren't in there which would for sure break your code :P Also I'm glad people are getting some use out of it, it seems to be pretty successful in my game.
  3. I wasnt trying to have an attitude. I was just stating it like it is :P I dont see how it would help inflation considering its just money not changing hands from the mugs. Granted an option to take a percentage from the money if the user wishes it to be direct deposited is a good idea, that would take a little money out. Also the reason I didnt use regular bank deposits is because i have a cap on the bank, and I didnt feel like all the fuss of going through securing the cap.
  4. They are not "safe" from mugging, just market sales. I for one do not think it's fair for a person to buy an item and turn around and mug their money back before the seller can come online and bank. So they should get their item AND all their money back just because that person isn't online? Doesn't seem fair to me. It's here if you want to use it, if not, don't..simple.
  5. This simple little add-on will allow your users to sell items on the item market and not have to worry about their profit being mugged off them before they can come online to bank their money. Instead it will go into a "Merchant account" temporarily until they withdraw it. SQL UPDATE users ADD merchant INT(11) NOT NULL DEFAULT '0'; (If your game uses large amounts of money you may want to use BIGINT) in the top of itemmarket.php place this where you want it: if($_GET['action'] == merch) { if($ir['merchant'] > 0) { $merch=$ir['merchant']; print "<table width='80%' border=0 cellpadding=7><tr><td bgcolor=#00BC47 align=center>You have withdrawn your ".money_formatter($ir['merchant'])." from your merchant account.<br></td></tr></table><br>"; $db->query("UPDATE users SET money=money+$merch, merchant=0 WHERE userid=".$ir['userid'].""); } else { print "<table width='80%' border=0 cellpadding=7><tr><td bgcolor=#FF0000 align=center>You do not have any money in your merchant account!<br></td></tr></table><br>"; } } elseif($ir['merchant'] > 0) { print "<a href='itemmarket.php?action=merch'><table width='80%' border=0 cellpadding=7><tr><td bgcolor=#00BC47 align=center>You have ".money_formatter($ir['merchant'])." in your merchant account, you may withdraw it at any time.<br></td></tr></table></a><br>"; }   in itemmarket.php find: $db->query("UPDATE `users` SET `$curr` = `$curr` + {$r['imPRICE']} WHERE `userid` = {$r['imADDER']}");   replace with: if($curr == 'money') { $db->query("UPDATE `users` SET `merchant` = `merchant` + {$r['imPRICE']} WHERE `userid` = {$r['imADDER']}"); }else{ $db->query("UPDATE `users` SET `$curr` = `$curr` + {$r['imPRICE']} WHERE `userid` = {$r['imADDER']}"); }
  6. This is a popular feature in my game as well, and i am working on a system that will let them upload 5 name images that they may switch between at any time through preferences.
  7. In most cases I would agree, but with it being staff_courses i wouldnt want anyone but admins to have access to it anyway, possibly secs. though I would do it more like... if($ir['user_level'] != 2 && $ir['user_level'] != 3) { print "<center><h2>RESTRICTED ACCESS</h2><a href='index.php'>Return to Game</a>"; $h->endpage(); exit; }   Which is much more specific in which user levels can gain access. (the die() function cuts off the bottom of my pages so i have to use the endpage() function.)
  8. I use the appsgeyser app for my game, and it works much better than the mobile browser, I use Daves chat system which wont work correctly on a mobile browser, well not on my phone anyway which is a Mytouch 4G Slide, but with the appgeyser app it works fine, and it isnt "squashed up" :P
  9. appsgeyser.com is another place you can create an android app, which really its just an app linked to your full site not an actual independent app, but it has no adds like andromo.com
  10. Yea sorry for the confusion, the interest uses timestamps but the contract doesnt, i could have converted that too but i spent enough time with this mod and was ready to move on to something else :P
  11. First, I did not write this mod, although I enhanced it quite a bit, this was a mod called Ians Investment Mod I got here at the free mods section on MWG found here: http://makewebgames.io/showthread.php/30432-mccode-v2-Ian-s-Investments?highlight=ians It was originally made with 2 levels of upgrading, i changed it to 10 levels, the way interest is made has been changed drastically, its now based upon interest level and length of investment and does not gain daily but at the end of the investment. I added an early withdrawal system that will charge 15% of the investment to pull out early. I secured it in several places, you can only upgrade each level when you have invested a certain total amount, each time you invest it is added to the total. The price goes up considerably each time you upgrade as well, taking money and points/crystals to do so. I eliminated the use for crons except for the user contract you must buy every 3 months. I eliminated alot of code though more could be eliminated with a few variables. It is based on timestamps instead of crons and counts down the days, hours minutes and seconds (not live) for the investment time, the only cron is a single day cron for the contract time. There is a cap of 2.5b which can be changed easily as can most other things. Investment lengths were 7 and 14 days. 30, 60 and 90 days I added. Here is a list of investments percentages per level per length. I wrote this up as a guide so i figured someone may want it to go along with the mod. If anyone uses this mod i would appreciate some feedback :) (* amount gained from a capped investment of 2.5b) Level 1: 7 Days - 0.21% *5.25m 14 Days - 0.42% *10.5m 30 Days - 0.91% *22.75m 60 Days - 1.82% *45.5m 90 Days - 2.73% *68.25m Level 2: 7 Days - 0.42% *10.5m 14 Days - 0.85% *21.25m 30 Days - 1.82% *45.5m 60 Days - 3.64% *91m 90 Days - 5.45% *136.25m Level 3: 7 Days - 0.64% *16m 14 Days - 1.27% *31.75m 30 Days - 2.73% *68.25m 60 Days - 5.45% *136.25m 90 Days - 8.18% *204.5m Level 4: 7 Days - 0.85% *21.25m 14 Days - 1.70% *42.5m 30 Days - 3.64% *91m 60 Days - 7.27% *181.75m 90 Days - 10.91% *272.75m Level 5: 7 Days - 1.06% *26.5m 14 Days - 2.12% *53.m 30 Days - 4.55% *113.75m 60 Days - 9.09% *227.25m 90 Days - 13.64% *341m Level 6: 7 Days - 1.27% *31.75m 14 Days - 2.55% *63.75m 30 Days - 5.45% *136.25m 60 Days - 10.91% *272.75m 90 Days - 16.36% *409m Level 7: 7 Days - 1.48% *37m 14 Days - 2.97% *74.25m 30 Days - 6.36% *159m 60 Days - 12.73% *318.25m 90 Days - 19.09% *477.25m Level 8: 7 Days - 1.70% *42.5m 14 Days - 3.39% *84.75m 30 Days - 7.27% *181.75m 60 Days - 14.55% *363.75m 90 Days - 21.82% *545.5m Level 9: 7 Days - 1.91% *47.75m 14 Days - 3.82% *95.5m 30 Days - 8.18% *204.5m 60 Days - 16.36% *409m 90 Days - 24.55% *613.75m Level 10: 7 Days - 2.12% *53m 14 Days - 4.24% *106m 30 Days - 9.09% *227.25m 60 Days - 18.18% *454.5m 90 Days - 27.27% *681.75m Investment Level Upgrade Cost: Level 1 - Free Level 2 - $10,000,000 and 50 points Level 3 - $40,000,000 and 100 points Level 4 - $90,000,000 and 150 points Level 5 - $160,000,000 and 200 points Level 6 - $250,000,000 and 250 points Level 7 - $360,000,000 and 300 points Level 8 - $490,000,000 and 350 points Level 9 - $640,000,000 and 400 points Level 10 - $810,000,000 and 450 points Now for the mod :P SQL's ALTER TABLE `users` ADD `userCONTRACT` INT(11) NOT NULL DEFAULT '0', ADD `userSTART` INT(11) NOT NULL DEFAULT '0', ADD `userDAYS` INT(11) NOT NULL DEFAULT '0', ADD `userLENGTH` INT(11) NOT NULL DEFAULT '0', ADD `userBANKAMMT` BIGINT(64) NOT NULL DEFAULT '0', ADD `userTOTALAMMT` BIGINT(64) NOT NULL DEFAULT '0', ADD `investlevel` INT(11) NOT NULL DEFAULT '1'; investment.php <?php include "globals.php"; switch($_GET['action']) { case 'investhome': invest_home(); break; case 'buyinvest': buy_invest(); break; case 'buyinvestsub': buyinvest_sub(); break; case 'invest': invest(); break; case 'getinvest': get_invest(); break; case 'earlyinvest': early_invest(); break; case 'earlyinvestsub': early_invest_sub(); break; case 'levelupgrade': level_upgrade(); break; case 'levelupgradesub': levelupgrade_sub(); break; default: index(); break; } function index() { global $db,$ir,$c,$h,$userid,$set; $newlvl = ($ir['investlevel']+1); echo "<h2 />Welcome to ".$set['game_name']." Investments.<br>How may we help you?</h2><hr>"; if($ir['userCONTRACT'] == 0) { echo "<h5>You may sign a contract that entitles you to our interest facilities.<br>Once under contract you may invest any amount of money for a certain period of time, you will then gain interest based on that period.<br>You may also upgrade your contract if you wish to gain additional interest.</h5>"; echo " <form action = 'investment.php?action=buyinvest' method = 'post' /> <input type = 'submit' STYLE='color: black; background-color: #D6D6C7;' value = 'Sign Contract' name = 'buyinvest' /> </form> "; } if($ir['userBANKAMMT'] > 0) { echo " <form action = 'investment.php?action=investhome' method = 'post' /> <input type = 'submit' STYLE='color: black; background-color: #D6D6C7;' value = 'View Investment' name = 'investhome' /> </form> "; } elseif($ir['userBANKAMMT'] == 0 AND $ir['userCONTRACT'] > 0) { echo " <form action = 'investment.php?action=investhome' method = 'post' /> <input type = 'submit' STYLE='color: black; background-color: #D6D6C7;' value = 'Start Investment' name = 'investhome' /> </form> "; } if($ir['userCONTRACT'] > 0 AND $ir['userBANKAMMT'] == 0 AND $ir['investlevel'] < 10) { echo " <form action = 'investment.php?action=levelupgrade' method = 'post' /> <input type = 'submit' STYLE='color: black; background-color: #D6D6C7;' value = 'Upgrade to Level $newlvl' name = '$newlvl' /> </form>"; } else { echo " "; } } function buy_invest() { global $db,$ir,$c,$h,$userid; $contract = money_formatter($ir['level'] * 200); if($ir['userCONTRACT'] > 0) { die ("You already have a contract with us. Your contract will last for {$ir['userCONTRACT']} more days. <a href='investment.php'>Go Back</a>"); } else { print "Welcome to Mayhem Investments ".$ir['username'].".<br>Would you like to sign a contract with us for ".$contract."?<hr width='60%'> <table><tr> <td> <form action = 'investment.php?action=buyinvestsub' method = 'post' /> <input type = 'submit' STYLE='color: black; background-color: #D6D6C7;' value = 'Yes' /> </form> </td><td> <form action = 'investment.php' method = 'post' /> <input type = 'submit' STYLE='color: black; background-color: #D6D6C7;' value = 'No' /> </form></td></tr></table><hr width='60%'>"; echo "<br><br><a href='index.php'>Home</a>"; $h->endpage(); exit; } } function buyinvest_sub() { global $db,$ir,$c,$h,$userid; $contract = ($ir['level'] * 200); if($ir['money'] < $contract) { $contract = money_formatter($contract); echo "You don't have enough money to sign a contract. You need ".$contract.".<br><br><a href='index.php'>Home</a>"; $h->endpage(); exit; } elseif($ir['userCONTRACT'] > 0) { die("You already have a contract with us. Your current contract still has {$ir['userCONTRACT']} days on it."); } else { print "Congratulations. You have signed a contract with us for 60 days. After the 60 days, you will have to sign another contract to start an investment. <br><br><a href='investment.php'>Go Back</a>"; $db->query(sprintf("UPDATE `users` SET `money` = `money` - '%d', `userCONTRACT` = '%d' WHERE `userid` = ('%u')", $contract, 60, $userid)); $h->endpage(); exit; } } function invest_home() { global $db,$ir,$c,$h,$userid,$set; $tDiff = $ir['userDAYS'] - time(); $days = floor($tDiff / 86400); $hours = ($tDiff / 3600) % 24; $mins = ($tDiff / 60) % 60; $secs = ($tDiff) % 60; if($ir['userCONTRACT'] == 0) { echo "You need to sign a contract first. To sign a contract, you may do that<a href='investment.php?action=buyinvest' />Here</a>.<br><br><a href='index.php'>Home</a>"; $h->endpage(); exit; } elseif($tDiff > 0) { $invlevel = ($ir['investlevel']*3/11)*($ir['userLENGTH']/9); $invlevel2 = number_format($invlevel, 2); $totinvest = "".$ir['userBANKAMMT']/100*$invlevel2.""; $totalinvest = "".money_formatter($ir['userBANKAMMT']+$totinvest).""; $total = "".$ir['userBANKAMMT']+$totinvest.""; $started = date('F j',$ir['userSTART']); $started1 = date('g:i:s a',$ir['userSTART']); $started3 = date('F j',$ir['userDAYS']); $started4 = date('g:i:s a',$ir['userDAYS']); $tDiff = $ir['userDAYS'] - time(); $days = floor($tDiff / 86400); $hours = ($tDiff / 3600) % 24; $mins = ($tDiff / 60) % 60; $secs = ($tDiff) % 60; $info = "You have ".$days." days, ".$hours." hours, ".$mins." minutes and ".$secs." seconds left on this investment."; if($ir['investlevel'] == 10) { $curlevel = "<font color=darkgreen><i>You have a fully upgraded investment level of 10! </i></font><br> You have a total investment length of ".$ir['userLENGTH']." days.<br>This gives you an interest rate of <font color=darkgreen>".$invlevel2."%.</font>"; } else { $curlevel = "Your investment level is ".$ir['investlevel'].".<br> You have a total investment length of ".$ir['userLENGTH']." days.<br>This gives you an interest rate of <font color=darkgreen>".$invlevel2."%</font>."; } print "".$curlevel."<br><br>You will receive <font color=darkgreen>".money_formatter($totinvest)."</font> interest for the <font color=darkgreen>".money_formatter($ir['userBANKAMMT'])."</font> invested in your portfolio. <br> You will gain a total of <font color=darkgreen>".money_formatter($total)."</font> for this investment.<br><br> Your investment began on ".$started." at ".$started1."<br>Your investment will mature on ".$started3." at ".$started4.".<br>At this time you may withdraw your investment and start another if you wish.<br><br><font color=firebrick>".$info."</font><hr> <br><form action = 'investment.php?action=earlyinvest' method = 'post' /> <input type = 'submit' STYLE='color: black; background-color: #D6D6C7;' value = 'Withdraw Early' /> </form><small><i>(There is a confirmation)</i></small><br><br><a href='index.php'>Go Home</a>"; $h->endpage(); exit; } elseif($tDiff < 0 && $ir['userBANKAMMT'] > 0) { $invlevel = ($ir['investlevel']/8*3)*($ir['userLENGTH']/10+2); $invlevel2 = number_format($invlevel, 2); $totinvest = "".$ir['userBANKAMMT']/100*$invlevel2.""; $totalinvest = "".money_formatter($ir['userBANKAMMT']+$totinvest).""; $total = "".$ir['userBANKAMMT']+$totinvest.""; echo "Your investment has been completed. Please collect your ".money_formatter($total).". <form action = 'investment.php?action=getinvest' method = 'post' /> <input type = 'submit' STYLE='color: black; background-color: #D6D6C7; value = 'Withdraw ".money_formatter($total)."' name = 'getinvest' /> </form>"; } elseif($ir['userBANKAMMT'] == 0) { if($ir['money'] > 2500000000) { $money = "2500000000"; } else { $money = $ir['money']; } echo "<table width='100%' style='background-color:#CCCCCC; border:2px solid #7D7764;'><th colspan='1'>Invest with ".$set['game_name']." Investments</th><tr><td align='center' style='background-color:#CCCCCC;'><br> You can invest large amounts of cash with our investment firm. <br><img src='images/vault.png' /><br>This is a low risk investment guaranteed to earn a profit.<br>Once you invest your money it is kept here until it has matured. Early withdrawal will cause you to incurr a 15% penalty. You can upgrade your investment level which will giving you varying increases in interest. <br>Please select how much and long you wish to invest. <form action='investment.php?action=invest' method='post'> <br>Amount to Invest:<br> <input type='text' STYLE='color: black; background-color: #D6D6C7;' maxlength='10' name='invest' value='$money' /><br> Length of Investment:<br> <select name='timetoinvest' STYLE='color: black; background-color: #D6D6C7;' type='dropdown'> <option value='1'>7 Days</option> <option value='2'>14 Days</option> <option value='3'>30 Days</option> <option value='4'>60 Days</option> <option value='5'>90 Days</option> </select> <center><br> <input type='submit' STYLE='color: black; background-color: #D6D6C7;' value='Start Investment' /></center></form></td> </tr> </table>"; } } function invest() { global $db,$ir,$c,$userid,$h; $_POST['invest']=abs((int) $_POST['invest']); if($ir['userDAYS'] > 0) { echo "You already have an investment!<hr><br><a href='investment.php'>Check Investment</a>"; $h->endpage(); exit; } elseif($_POST['invest'] > '2500000000') { echo "We're sorry, you are only allowed a maximum investment of $2,500,000,000.<hr><br><a href='investment.php'>Back</a>"; $h->endpage(); exit; } elseif($_POST['invest'] > $ir['money']) { echo "You do not have enough money to invest this ammount.<hr><br><a href='investment.php'>Back</a>."; $h->endpage(); exit; } elseif($_POST['invest'] < 100) { echo "You must invest at least $100!<hr><br><a href='investment.php'>Back</a>."; $h->endpage(); exit; } else { if($_POST['timetoinvest'] == 1) { $investtime = "7"; $timeuni = "".(time() + 604800).""; } if($_POST['timetoinvest'] == 2) { $investtime = "14"; $timeuni = "".(time() + 1209600).""; } if($_POST['timetoinvest'] == 3) { $investtime = "30"; $timeuni = "".(time() + 2592000).""; } if($_POST['timetoinvest'] == 4) { $investtime = "60"; $timeuni = "".(time() + 5184000).""; } if($_POST['timetoinvest'] == 5) { $investtime = "90"; $timeuni = "".(time() + 7776000).""; } $invlevel = ($ir['investlevel']/5*3)*($ir['userLENGTH']/11); $invlevel2 = number_format($invlevel, 2); $totinvest = "".$ir['userBANKAMMT']/100*$invlevel2.""; $total = "".$ir['userBANKAMMT']+$totinvest.""; $gain=$_POST['invest']; $start = "86400*$investtime"; $db->query(sprintf("UPDATE `users` SET `money` = `money` - '%d', `userBANKAMMT` = '%d', `userTOTALAMMT` = `userTOTALAMMT` + '%d', `userSTART` = unix_timestamp(), `userLENGTH` = '%d', `userDAYS` = '%d' WHERE `userid` = ('%u')", $_POST['invest'], $gain, $gain, $investtime,$timeuni, $userid)); echo "Thank you for your investment of ".money_formatter($_POST['invest']).". <br>After ".$investtime." days, you may collect your money.<hr><br> <a href='investment.php'>Back</a>"; $h->endpage(); exit; } } function early_invest() { global $db,$ir,$c,$h,$userid; $earlybank = "".($ir['userBANKAMMT']/100*85).""; $tDiff = $ir['userDAYS'] - time(); $days = floor($tDiff / 86400); $hours = ($tDiff / 3600) % 24; $mins = ($tDiff / 60) % 60; $secs = ($tDiff) % 60; if($ir['userCONTRACT'] == 0) { echo "You need to sign a contract with us before you can withdraw any money. Click <a href='investment.php?action=buyinvest'>here</a> to sign a contract.<br><br><a href='investment.php'>Back</a>"; $h->endpage(); exit; } elseif($tDiff < 1 AND $ir['userBANKAMMT'] > 0) { echo "You have an investment that has already finished but not yet claimed.<br><br><a href='investment.php'>Back</a>"; $h->endpage(); exit; } elseif($tDiff < 1 AND $ir['userBANKAMMT'] == 0) { echo "You do not have an investment, how can you finish it early?<br><br><a href='investment.php'>Back</a>"; $h->endpage(); exit; } else { print "You may withdraw your investment early. Be aware you are assessed a 15% penalty for early withdrawal. ".money_formatter($earlybank)." will be returned to you. <hr> <table><tr><td> <form action = 'investment.php?action=earlyinvestsub' method = 'post' /> <input type = 'submit' STYLE='color: black; background-color: #D6D6C7;' value = 'Withdraw' /> </form> </td><td> <form action = 'investment.php' method = 'post' /> <input type = 'submit' STYLE='color: black; background-color: #D6D6C7;' value = 'No Thanks' /> </form></td></tr></table>"; } } function early_invest_sub() { global $db,$ir,$c,$h,$userid; $earlybank = "".($ir['userBANKAMMT']/100*85).""; $tDiff = $ir['userDAYS'] - time(); $days = floor($tDiff / 86400); $hours = ($tDiff / 3600) % 24; $mins = ($tDiff / 60) % 60; $secs = ($tDiff) % 60; if($ir['userCONTRACT'] == 0) { echo "You need to sign a contract with us before you can withdraw any money. Click <a href='investment.php?action=buyinvest'>here</a> to sign a contract.<br><br><a href='investment.php'>Back</a>"; $h->endpage(); exit; } elseif($tDiff < 1 AND $ir['userBANKAMMT'] > 0) { echo "You have an investment that has already finished but not yet claimed.<hr><br><a href='investment.php'>Back</a>"; $h->endpage(); exit; } elseif($tDiff < 1 AND $ir['userBANKAMMT'] == 0) { echo "You do not have an investment, how can you finish it early?<hr><br><a href='investment.php'>Back</a>"; $h->endpage(); exit; } else { print "You have withdrawn your ".money_formatter($earlybank).". <hr><br><a href='investment.php'>Back</a>"; $db->query(sprintf("UPDATE `users` SET `money` = `money` + '%d', `userTOTALAMMT` = `userTOTALAMMT` - '%d', `userBANKAMMT` = '%d', `userSTART` = '%d', `userLENGTH` = '%d', `userDAYS` = '%d' WHERE `userid` = ('%u')", $earlybank,$ir['userBANKAMMT'], 0, 0, 0, 0, $userid)); } } function get_invest() { global $db,$ir,$c,$h,$userid; $tDiff = $ir['userDAYS'] - time(); $days = floor($tDiff / 86400); $hours = ($tDiff / 3600) % 24; $mins = ($tDiff / 60) % 60; $secs = ($tDiff) % 60; $invlevel = ($ir['investlevel']/5*3)*($ir['userLENGTH']/11+2); $invlevel2 = number_format($invlevel, 2); $totinvest = "".$ir['userBANKAMMT']/100*$invlevel2.""; $totalinvest = "".money_formatter($ir['userBANKAMMT']+$totinvest).""; $total = "".$ir['userBANKAMMT']+$totinvest.""; if($ir['userCONTRACT'] == 0) { echo "You need to sign a contract before you can collect your money. Go<a href='investment.php?action=buyinvest'>HERE</a> to sign a new contract."; $h->endpage(); exit; } if($ir['userBANKAMMT'] == 0) { echo "You do not have a current investment.<br><br><a href='investment.php'>Back</a>"; $h->endpage(); exit; } if($tDiff > 0) { echo "You invesment has not matured yet, check back later.<br><br><a href='investment.php'>Back</a>."; $h->endpage(); exit; } else { print "Thank you for collecting your investment. You have collected ".money_formatter($total).". Where would you like to deposit it? <table><tr><td> <form action = 'bank.php' method = 'post' /> <input type = 'submit' STYLE='color: black; background-color: #D6D6C7;' value = 'The Bank' name = 'depositbank' /> </form></td><td> <form action = 'index.php' method = 'post' /> <input type = 'submit' STYLE='color: black; background-color: #D6D6C7;' value = 'Go Home' name = 'gohome' /> </form><td></tr>"; print "</table>"; $db->query(sprintf("UPDATE `users` SET `money` = `money` + '%d', `userBANKAMMT` = '%d', `userSTART` = '%d', `userLENGTH` = '%d', `userDAYS` = '%d' WHERE `userid` = ('%u')", $total, 0, 0, 0, 0, $userid)); } } function level_upgrade() { global $db,$ir,$c,$h,$userid; $upgradepp = ($ir['investlevel'] * 50); $upgrade2 = ($ir['investlevel'] * 20000000 * $ir['investlevel']/2); $newlvl = ($ir['investlevel']+1); if($ir['userCONTRACT'] == 0) { echo "You need to sign a contract with us before you can upgrade. Click<a href='investment.php?action=buyinvest'>HERE</a> to sign a contract."; $h->endpage(); exit; } elseif($ir['userBANKAMMT'] > 0) { echo "You have an investment currently running, you cannot upgrade until it has matured."; $h->endpage(); exit; } elseif($ir['investlevel'] == 10) { echo "You are already at Level 10. You can't upgrade any more.<a href='investment.php'>Back</a>"; $h->endpage(); exit; } else { print "Welcome to the Investment Upgrades.<br><br> You are currently at Level ".$ir['investlevel'].". It will cost you <font color=darkgreen>".money_formatter($upgrade2)."</font> and <font color=darkgreen>".$upgradepp."</font> points to upgrade to Level ".$newlvl.". <br>Would you like to proceed? <table><tr><td> <form action = 'investment.php?action=levelupgradesub' method = 'post' /> <input type = 'submit' STYLE='color: black; background-color: #D6D6C7;' value = 'Upgrade' /> </form> </td><td> <form action = 'investment.php' method = 'post' /> <input type = 'submit' STYLE='color: black; background-color: #D6D6C7;' value = 'No Thanks' /> </form></td></tr></table>"; } } function levelupgrade_sub() { global $db,$ir,$c,$h,$userid; $upgradepp = ($ir['investlevel'] * 50); $upgrade2 = ($ir['investlevel'] * 20000000 * $ir['investlevel']/2); $newlvl = ($ir['investlevel']+1); if($ir['investlevel'] == 1) { $upgrade3 = 2500000; } if($ir['investlevel'] == 2) { $upgrade3 = 25000000; } if($ir['investlevel'] == 3) { $upgrade3 = 850000000; } if($ir['investlevel'] == 4) { $upgrade3 = 3225000000; } if($ir['investlevel'] == 5) { $upgrade3 = 1300000000; } if($ir['investlevel'] == 6) { $upgrade3 = 4750000000; } if($ir['investlevel'] == 7) { $upgrade3 = 10500000000; } if($ir['investlevel'] == 8) { $upgrade3 = 25000000000; } if($ir['investlevel'] == 9) { $upgrade3 = 75000000000; } $upgrade4 = $upgrade3 - $ir['userTOTALAMMT']; if($ir['userTOTALAMMT'] < $upgrade3) { echo "You have not invested enough with us to upgrade, you have invested a total of ".money_formatter($ir['userTOTALAMMT']).".<br>You need to invest ".money_formatter($upgrade3)." total before you can upgrade.<br> You must invest ".money_formatter($upgrade4)." more."; $h->endpage(); exit; } if($ir['userCONTRACT'] == 0) { echo "You need to sign a contract with us before you can upgrade. <br><br>Click<a href='investment.php?action=buyinvest'>HERE</a> to sign a contract."; $h->endpage(); exit; } elseif($ir['userDAYS'] > 0) { echo "You have to wait for your current investment to finish before you can upgrade your investment level.<br><br><a href='investment.php'>Back</a>"; $h->endpage(); exit; } elseif($ir['investlevel'] == 10) { echo "You are already upgraded to maximum interest.<br><br><a href='investment.php'>Back</a>"; $h->endpage(); exit; } elseif($ir['money'] < $upgrade2) { echo "You don't have enough money to upgrade to Level ".$newlvl.".<br><br><a href='investment.php'>Back</a>"; $h->endpage(); exit; } else { print "Congratulations, you have upgraded to Level ".$newlvl.". <br><br> <a href='investment.php'>Back</a>"; $sql = sprintf("UPDATE `users` SET `money` = `money` - '%d', `crystals` = `crystals` - '%d', `investlevel` = '%d' WHERE `userid` = ('%u')", $upgrade2, $upgradepp, $newlvl, $userid); $db->query($sql); } } $h->endpage(); exit; ?> day cron for the contract $db->query("UPDATE users SET userCONTRACT = userCONTRACT - 1 WHERE userCONTRACT > 0"); Add this link where you want it located <a href='investment.php'>Investments</a>
  12. I see what you're saying, to be honest it confuses me.   $q=$db->query("SELECT * FROM polls WHERE active='0' ORDER BY id desc"); if ( ! $db->num_rows($q) ) { die("<b>There are no finished polls right now</b>"); } while ($r=$db->fetch_row($q)) { echo "<table width='80%' style='border:3px solid #A39B83;' align='center' cellspacing='0' cellpadding='5'><tr style='background-color:#B8B8B8;'> <th width='45%'>Choice</th> <th width='10%'>Votes</th> <th width='15%'>Bar</th> <th width='10%'>Percentage</th> </tr> <tr style='background-color:#CCCCCC;'> <th colspan='4'><font color='firebrick'>{$r['question']}</font></th> </tr>"; for ( $i=1; $i <= 10; $i++) { if ( $r['choice'.$i]) { $k='choice'.$i; $ke='voted'.$i; if ( $r['votes'] != 0) { $perc=number_format($r[$ke]/$r['votes']*100, 2); } else { $perc=0; } echo "<tr style='background-color:#CCCCCC;'> <td align='left'>{$r[$k]}</td> <td align='left'>{$r[$ke]}</td> <td align='left'><img src='bargreen.gif' alt='Bar' width='$perc' height='10' /></td> <td align='right'>$perc%</td></tr>"; } } echo "<tr style='background-color:#CCCCCC;'><th colspan='4'>Total Votes: {$r['votes']}</th></tr> <tr style='background-color:#B8B8B8;'><th colspan='4'>Outcome: ".$r['choice'.$r['winner']]."</th></tr> </table><br />"; }
  13. no, if it were a problem with that file it would still be entered into the 'winner' field in the database, which it is not. The polling.php isnt going to show a result that isnt there.
  14. I know there are lots of little things like this "unfinished" with mccodes..but yea, when you end a poll, the winning answer does not show. Now i pinpointed why, but i am not sure how to go about it. When you end the poll it should tally up the winner but it doesnt, here is the query to end the poll.   $db->query("UPDATE `polls` SET `active` = '0' WHERE `id` = {$_POST['poll']}");   What it SHOULD do is look in these fields 'vote1,vote2,vote3,vote4,vote5,vote6,vote7,vote8,vote9,vote10' and determine which had the greatest number of votes, then it should alter the 'winner' field in that query and put in a 1,2,3,4,5,6,7,8,9 or 10 depending on which of the vote fields is highest. Here is the whole endpoll function:   function endpoll() { global $ir, $c,$userid, $db; $_POST['poll'] = ( isset($_POST['poll'])&&is_numeric($_POST['poll']) )?abs(intval($_POST['poll'])):''; if ( empty($_POST['poll']) ) { echo " Choose a poll to close <br /> <form action='staff_polls.php?action=endpoll' method='post'> "; $q = $db->query("SELECT `id`,`question` FROM `polls` WHERE `active` = '1'"); while ( $r = $db->fetch_row($q) ) { echo ' <input type="radio" name="poll" value="'.$r['id'].'" /> Poll ID '.$r['id'].' - '.$r['question'].' <br /> '; } echo ' <input type="submit" value="Close Selected Poll" /> </form> '; } else { $q = $db->query('SELECT `id` FROM `polls` WHERE `id` = '.$_POST['poll']); if ( $db->num_rows($q) == 0 ) { echo 'Invalid poll.<br />> <a href="staff_polls.php?action=endpoll">Go Back</a>'; die($h->endpage()); } $db->query("UPDATE `polls` SET `active` = '0' WHERE `id` = {$_POST['poll']}"); echo 'Poll closed.<br />> <a href="staff.php">Go Home</a>'; die($h->endpage()); } }   Any help would be appreciated.
  15. It's from Torn City
  16. I am looking for someone that can make some professional advertisement banners, six in all of varying sizes. Contact me through mail here to discuss details and pricing.
  17. Hmm, well...where to begin... I have hosting through Peter, which I have no problems with really, though the server (all of w3theory not just my site) has went down a couple of times, but never for long except one instance, in which clients were given a couple months free hosting to make up for it, kudos for that. It was an exceptional move on your part and is appreciated. Now that being said, I also bought a layout from Peter for $200, which I was not totally satisfied with, it was a plain bare bones layout definitely not worth what I paid for it, not even half what I paid if you ask me. Now i do have to admit it is my OWN fault because I did accept the layout as it was shown to me, BUT it was a rushed job, done in one night ( i was talking to him as he made it in a couple of hours) and could have been much better. Being a new game owner I did not realize just how dull it was going to look once installed. Also I was in a hurry to get it done as I had waited a week before it was started, again, my own fault for not taking the time and paying more attention. When I expressed my concerns about it once it was installed and i could see it for what it was worth, I was pretty much told "thats what you asked for so thats what you're going to get", BUT Peter did install it for me, and then came to my site to fix several errors that the layout caused. Also with this layout, things i add have to have a lot more work done on them due to the layout. Like tables, there is no table class so all tables have to be constructed in line from scratch, also the endpage(); function must be used on every single file or the bottom of the content box will get cut off. As you can see I'm pretty much on a fence, but i guess i would have to say i WOULD buy another one (and will once my 2nd project is ready for it) because I'm sure this was an isolated event, BUT i will make sure its exactly what i want in detail beforehand. Ok, I have to add this, Peter is the man! My site was "hacked" I use the term loosely as someone somehow changed my cpanel login details and put up a hacker suspension page, and Peter got out of bed and fixed it at 4 am, not many hosts would do that and I applaud him for it. Again, Peter, you are the man.
  18. Down towards the bottom you should see $_POST['REF'] four times, i changed the REF's to lower case and my referrals started working, idk if this is the same issue but it worked for me.
  19. Yea i guess i didnt think of that, it would be easy to use these exploits against sites if that info was readily available.
  20. I'm curious as to how it helps? Unless you can tell me what this system detected? Seeing "Possible exploit detected" with no further information doesnt help much :P
  21. No its not that i wont be buying from Peter again, i have hosting through him and have no problems with it, except it seems to be down at the moment, I just meant next time I'll make sure I explain in detail exactly what i want as we had some confusion with the layout i bought.
  22. No i put the exit in, the layout i paid $200 for (wont do that again) from w3theory (Peter) will cut off the bottom of the page if i dont exit.
  23. indeed, it was an easy thing to look over and even easier to rectify, it gave the the base i needed and i can now stop slamming my head into the desk :P
  24. Well you learn something everyday, i did not know this, i havent been coding very long at all :P I took out the whitespace and viola, it worked, though it is showing their level as 0 but a little work and im sure i can figure that out, thanks Octarine, i appreciate the help :) Edit, the level part was because it wasnt retrieving level from the usertable, easy fix, thanks alot, and mixmaster that worked just the same as Octarines, thank you too
  25. I must be putting this together wrong. <?php include "globals.php"; $sql = 'SELECT COUNT(refID) FROM referals WHERE refREFER = ' . $userid; $rs = mysql_query($sql); $referals = array_shift(mysql_fetch_row($rs)); mysql_free_result($rs); $sql = <<<SQL SELECT userid, username FROM users LEFT JOIN referals ON refREFED = userid WHERE refREFER = $userid ORDER BY level DESC, username SQL; echo ' <table border="1"> <tr> <th>ID</th> <th>Name</th> <th>Level</th> </tr> '; $rs = mysql_query($sql); WHILE ($row = mysql_fetch_row($rs)) { list($id, $name, $level) = $row; $name = htmlentities($name, ENT_QUOTES, 'utf-8'); $level = number_format($level); echo <<<HTML <tr> <td>$id</td> <td>$name</td> <td>$level</td> </tr> HTML; } mysql_free_result($rs); echo '<br style="clear:both;" /></table>'; $h->endpage(); exit; ?>   It works until i get down to the HTML part, i get an unexpected $end error, if i change the HTML part to a regular echo the file will work...but it will only show $id, $name, $level instead of their actual info like it isnt being defined.
×
×
  • Create New...