function new_Director() { global $ir, $inf; if (!$_GET['confirm']) { echo ' <div class="generalinfo_txt"> <div><img src="images/info_left.jpg" alt="" /></div> <div class="info_mid"><h2 style="padding-top:10px;"> Change Director</h2></div> <div><img src="images/info_right.jpg" alt="" /></div> </div> <div class="generalinfo_simple"><br> <br><br> <form action="business_manage.php?p=new_Director&confirm=1" method="post"> <p align="center"> Select a member from the box below to whom you wish to make the new Director <br><br> Business member: <select name="member">'; $select_members = mysql_query(sprintf("SELECT * FROM businesses_members LEFT JOIN users ON (userid = bmembMember) WHERE (bmembBusiness = '%u') ORDER BY bmembId ASC", $inf['busId'])); while ($sm = mysql_fetch_assoc($select_members)) { echo '<option value="' . $sm['userid'] . '">' . stripslashes($sm['username']) . '</option>'; } echo '</select><br /><br /> <input type="submit" value="Change Director" /> </p> </form></div><div><img src="images/generalinfo_btm.jpg" alt="" /></div><br></div></div></div></div></div>'; } else { if ($ir['userid'] != $inf['busDirector']) { die('You need to be the Director to perform this action.'); } else { $select_members2 = mysql_query(sprintf("SELECT * FROM businesses_members WHERE (bmembMember = '%u')", $_POST['member'])); $sm2 = mysql_fetch_assoc($select_members2); mysql_query(sprintf("INSERT INTO businesses_members (bmembId, bmembMember, bmembBusiness, bmembMoney, bmembRank, bmembDays) VALUES ('NULL', '%u', '%d', 'NULL', 'NULL', '%d')", $inf['busDirector'], $inf['busId'], $inf['busDays'])); mysql_query(sprintf("UPDATE businesses SET busDirector = " . $_POST['member'] . ", busDays=" . $sm2['bmembDays'] . " WHERE busId = " . $inf['busId'] . "")); mysql_query(sprintf("DELETE FROM `businesses_members` WHERE `businesses_members`.`bmembMember` = " . $_POST['member'] . " LIMIT 1")); business_alert($inf['busId'], "The business has a new Director"); echo 'Director Has Been Changed !'; } } }
function donate_cash() { global $ir, $inf, $db; $_POST['cash'] = abs(@intval($_POST['cash'])); if ($_POST['cash'] > 0) { if ($_POST['cash'] > $ir['money']) { echo 'You do not have enough cash to donate this much to the Company.'; } else { $db->query(sprintf("UPDATE `users` SET `money` = `money` - '%d' WHERE `userid` = '%u'", $_POST['cash'], $ir['userid'])); $db->query(sprintf("UPDATE `businesses` SET `busCash` = `busCash` + '%d' WHERE `busId` = '%u'", $_POST['cash'], $inf['busId'])); echo 'You have donated $' . number_format($_POST['cash']) . ' to the Company.'; business_alert($inf['busId'], "" . $ir['username'] . " donated \$" . number_format($_POST['cash']) . " to the Company."); } } else { echo 'You missed one or more of the required fields.'; } }
function rob_business() { global $ir, $db, $h, $userid; $_GET['id'] = abs(@intval($_GET['id'])); if ($_GET['id']) { $fetch_business = $db->query(sprintf("SELECT * FROM `businesses` LEFT JOIN `businesses_classes` ON (`classId` = `busClass`) LEFT JOIN `users` ON (`userid` = `busDirector`) WHERE (`busId` = '%u')", $_GET['id'])); if (!$db->num_rows($fetch_business)) { echo 'You cannot rob a company that doesn\'t exist.'; } else { $r = $db->fetch_row($fetch_business); if ($ir['rob'] == 1) { echo 'You cannot attempt to rob a company more than once a day!'; $h->endpage(); exit; } if ($ir['userid'] == $r['busDirector']) { echo 'Why would you attempt to rob your own company?'; $h->endpage(); exit; } else { if ($ir['robskill'] <= $r['bussecurity']) { print "\n\n\n<h1><font color=red>BUSTED !! </font></h1> <br><br> \n\n<div id='mainOutput' style='text-align: center; color: white; width: 600px; border: 1px solid #222222; height: 70px;\nmargin: 0 auto 10px; clear: both; position: relative; left: -20px; padding: 8px'>\n\nWhile attempting to break into the business, greedy with plans of large bucks. You fail to notice the police car driving by. Just as you crack the lock and begin to head inside you are knocked over the head. You wake up in jail with a raging headache and the discovery YOU WERE CAUGHT"; event_add($_GET['id'], "<a href='viewuser.php?u={$userid}'>{$ir['username']}</a> Attempted to Rob your Business but was caught."); $jailtime = mt_rand(10, 40); $query = sprintf('UPDATE users SET jail = jail +%u, jail_reason = "Failed to Rob %s.", rob = 0 WHERE userid = %u', $jailtime, $r['busName'], $userid); $db->query($query); $db->query("UPDATE users SET rob = rob + 1 WHERE userid = {$userid}"); $db->query("UPDATE businesses SET bussecurity = bussecurity + 1 WHERE busId = {$_GET['id']}"); business_alert($r['busId'], " Someone tried to rob from your company and got busted ! "); } else { if ($ir['robskill'] > $r['bussecurity']) { $rando = mt_rand(10, 25); $cash = round($r['busCash'] / $rando); print "\n\n<h1><font color=green>SUCESS !! </font></h1> <br><br> \n\n<div id='mainOutput' style='text-align: center; color: white; width: 600px; border: 1px solid #222222; height: 70px;\nmargin: 0 auto 10px; clear: both; position: relative; left: -20px; padding: 8px'>\n\n\nAfter scoping out the latest company for a few days, you decide now is your chance to do some damage. You sneak up to the backdoor after dark and jiggle the lock. With a bit of luck on your side, the door is unlocked. You sneak in flashlight in hand and head for the vault. Noticing the lack of security in this place you are hopeful someone hasn't beat you to the punch. As you enter the dark office where the stash of cash is located it would appear luck is on your side twice! The owner left the key to the safe on his desk! You quickly grab the cash and bolt. You earned yourself a nice smooth {$cash} cash."; $db->query("UPDATE users SET money = money + {$cash}, rob = 0 WHERE userid = {$userid}"); $db->query("UPDATE users SET rob = rob + 1 WHERE userid = {$userid}"); $db->query("UPDATE businesses SET busCash = busCash - {$cash}, bussecurity = bussecurity - 1 WHERE busId = {$_GET['id']}"); $robbery = $money = money_formatter($cash); business_alert($r['busId'], " Someone successfully robbed {$robbery} from your company ! "); } } } } } }