Jump to content
MakeWebGames

jay-dogg2009

Members
  • Posts

    38
  • Joined

  • Last visited

Everything posted by jay-dogg2009

  1. business_view.php     <?php include_once (DIRNAME(__FILE__). '/globals.php'); echo '<p class="heading">Business details</p>'; switch ($_GET['page']) { case 'class': view_class(); break; case 'profile': view_profile(); break; case 'sendapp': send_application(); break; default: business_index(); break; } function business_index() { global $ir; echo '<p align="center"> [b]Business classes:[/b] <table width="600">'; $fetch_classes = mysql_query("SELECT * FROM `businesses_classes` ORDER BY `classId` ASC"); while($r = mysql_fetch_assoc($fetch_classes)) { echo ' <tr> <td width="275" align="right">'.stripslashes($r['className']).' •</td> <td width="50"></td> <td width="275" align="left">> [url="business_view.php?page=class&id='.$r['classId'].'"]View '.stripslashes($r['className']).' businesses[/url]</td> </tr>'; } echo '</table> </p>'; } function view_class() { global $ir; if($_GET['id']) { $fetch_class = mysql_query(sprintf("SELECT * FROM `businesses_classes` WHERE (`classId` = '%u')", abs((int) $_GET['id']))); if(!mysql_num_rows($fetch_class)) { echo 'You cannot view a business class that doesn\'t exist.'; } else { $r = mysql_fetch_assoc($fetch_class); echo '<hr width="600"> <p align="center"> [b]'.stripslashes($r['className']).':[/b] [i]'.stripslashes($r['classDesc']).'[/i] <hr width="600"> <p align="center"> [b]Business details:[/b] The '.stripslashes($r['className']).' business is small and starts with a maximum of [b]'.number_format($r['classMembers']).'[/b] members until it has been upgraded. The total start up cost of a '.stripslashes($r['className']).' business is $'.number_format($r['classCost']).'.</p> <hr width="600"> <table width="600" class="table"> <tr> <th colspan="4">'.stripslashes($r['className']).' ranks</th> </tr>'; $fetch_ranks = mysql_query(sprintf("SELECT * FROM `businesses_ranks` WHERE `rankClass` = '%u'", abs((int) $_GET['id']))); while($rn = mysql_fetch_assoc($fetch_ranks)) { echo ' <tr> <td width="25%">[b]Rank:[/b] '.stripslashes($rn['rankName']).'</td> <td width="20%">[b]Primary stat:[/b] '.stripslashes($rn['rankPrim']).'</td> <td width="20%">[b]Secondary stat:[/b] '.stripslashes($rn['rankSec']).'</td> <td width="45%">[b]Stat gain:[/b] '.$rn['rankPGain'].' '.stripslashes($rn['rankPrim']).' and '.$rn['rankSGain'].' '.stripslashes($rn['rankSec']).'</td> </tr>'; } echo '</table> <hr width="600"> <table width="600" class="table"> <tr> <th colspan="2">'.stripslashes($r['className']).' businesses</th> </tr>'; $bus_rating = mysql_query("SELECT `busCash` FROM `businesses`"); $ttl_profit = 0; while($fetch_cash = mysql_fetch_assoc($bus_rating)) { $ttl_profit += ($fetch_cash['busCash'] + 1); } $fetch_businesses = mysql_query(sprintf("SELECT * FROM `businesses` LEFT JOIN `users` ON (`userid` = `busDirector`) WHERE `busClass` = '%u'", abs((int) $_GET['id']))); while($fb = mysql_fetch_assoc($fetch_businesses)) { $rate = (int) ((($fb['busCash'] + 1) / $ttl_profit * 100) / 20); echo ' <tr> <td width="85%">[url="business_view.php?page=profile&id='.$fb['busId'].'"][b]'.stripslashes($fb['busName']).'[/b][/url] - [url="viewuser.php?u='.$fb['userid'].'"][i]'.stripslashes($fb['username']).'[/i][/url]</td> <td width="15%">[img=images/business/'.$rate.'.gif]</td> </tr>'; } echo '</table> <hr width="600">'; } } else { echo 'You did not select a business class to view.'; } } function view_profile() { global $ir; if($_GET['id']) { $fetch_business = mysql_query(sprintf("SELECT * FROM `businesses` LEFT JOIN `businesses_classes` ON (`classId` = `busClass`) LEFT JOIN `users` ON (`userid` = `busDirector`) WHERE (`busId` = '%u')", abs((int) $_GET['id']))); if(!mysql_num_rows($fetch_business)) { echo 'You cannot view a business that doesn\'t exist.'; } else { $r = mysql_fetch_assoc($fetch_business); echo '<hr width="400"> <table width="400" class="table"> <tr> <th colspan="2">Details of '.stripslashes($r['busName']).' - '.stripslashes($r['className']).'</th> </tr> <tr height="100"> <td colspan="2" valign="middle" align="center">'; if($r['busImage']) { echo '[img='.stripslashes($r['busImage']).']'; } else { echo 'This business has no banner at this time.'; } echo '</td></tr> <tr> <th colspan="2">Further information</th> </tr> <tr height="150"> <td colspan="2" valign="middle" align="center"> <table width="200"> <tr> <td> [b]Class:[/b] '.stripslashes($r['className']).' [b]Director:[/b] [url="viewuser.php?u='.$r['userid'].'"]'.stripslashes($r['username']).'[/url] [b]Latest profit:[/b] $'.number_format($r['busProfit']).' [b]Previous profit:[/b] $'.number_format($r['busYProfit']).' [b]Latest customers:[/b] '.number_format($r['busCust']).' [b]Previous customers:[/b] '.number_format($r['busYCust']).' [url="business_view.php?page=sendapp&id='.$_GET['id'].'"]Send application[/url] </td> </tr> </table> </td> </tr> <tr> <th colspan="2">'.stripslashes($r['busName']).' members</th> </tr> <tr> <td width="50%">[b]Name:[/b] [url="viewuser.php?u='.$r['userid'].'"]'.stripslashes($r['username']).'[/url]</td> <td width="50%">[b]Rank:[/b] Director (None)</td> </tr>'; $fetch_members = mysql_query(sprintf("SELECT * FROM `businesses_members` LEFT JOIN `users` ON (`userid` = `bmembMember`) LEFT JOIN `businesses_ranks` ON (`rankId` = `bmembRank`) WHERE `bmembBusiness` = '%u'", abs((int) $_GET['id']))); while($fm = mysql_fetch_assoc($fetch_members)) { echo ' <tr> <td width="50%">[b]Name:[/b] [url="viewuser.php?u='.$fm['userid'].'"]'.stripslashes($fm['username']).'[/url]</td> <td width="50%">[b]Rank:[/b] '.stripslashes($fm['rankName']).' ($'.number_format($fm['bmembCash']).')</td> </tr>'; } echo '</table> <hr width="400">'; } } else { echo 'You did not select a business to view.'; } } function send_application() { global $ir; if($ir['job']) { echo 'You must quit your current job first'; exit; } $check_bus = mysql_query(sprintf("SELECT * FROM `businesses` WHERE (`busId` = '%u')", abs((int) $_GET['id']))); $check_app = mysql_query(sprintf("SELECT * FROM `businesses_apps` WHERE (`appMember` = '%u') AND (`appBusiness` = '%d')", $ir['userid'], abs((int) $_GET['id']))); $check = mysql_query(sprintf("SELECT * FROM `businesses` WHERE (`busDirector` = '%u')", $ir['userid'])); $check_member = mysql_query(sprintf("SELECT * FROM `businesses_members` WHERE (`bmembMember` = '%u')", $ir['userid'])); if(!mysql_num_rows($check_bus)) { echo 'You cannot send an application to a non-existant business.'; } else if(mysql_num_rows($check) || mysql_num_rows($check_member)) { echo 'You are part of a business right now, leave before sending an application to a new one.'; } else if(mysql_num_rows($check_app)) { echo 'You have a sent application to this business right now, wait for a responce.'; } else if(!$_GET['id']) { echo 'You did not choose a business to send an application to.'; } else if($_POST['application']) { $app = str_replace(array("\n"), array(" "), strip_tags($_POST['application'])); $string_app = mysql_real_escape_string($app); mysql_query(sprintf("INSERT INTO `businesses_apps` (`appId`, `appMember`, `appBusiness`, `appText`, `appTime`) VALUES ('NULL','%d', '%u', '%s', '%d')", $ir['userid'], abs((int) $_GET['id']), $string_app, time())); $fetch_business = mysql_query(sprintf("SELECT * FROM `businesses` LEFT JOIN `businesses_classes` ON (`classId` = `busClass`) LEFT JOIN `users` ON (`userid` = `busDirector`) WHERE (`busId` = '%u')", abs((int) $_GET['id']))); $r = mysql_fetch_assoc($fetch_business); event_add($r['userid'],"{$ir['username']} Has sent an application in to join your business.",$c); echo 'Your application was sent to the selected business, a responce will be given from the director soon.'; } else { $r = mysql_fetch_assoc($check_bus); echo '<form action="business_view.php?page=sendapp&id='.$_GET['id'].'" method="post"> <p align="center"> [b]Enter an application below to send a request to the director of '.stripslashes($r['busName']).'.[/b] You can send one application at a time, wait for the result of that application before sending another. If the business director is not active, it might take a while for the application to be managed, So it could be worth speaking with the director before submitting a new application to the business. Entering a detailed application will increase the chance of having it accepted, but this is no guarantee. Your working stats will also be sent to the director of the business with the application to help them decide. Your application: <textarea type="text" name="application" s="40" rows="10" cols="70" maxlength="255"></textarea> <input type="submit" value="Submit application" /></p> </form>'; } } $h->endpage(); ?>     enjoy :P
  2. business_home.php   <?php include_once (DIRNAME(__FILE__). '/globals.php'); echo '<p class="heading">Manage business</p>'; $check = mysql_query(sprintf("SELECT * FROM `businesses_members` WHERE (`bmembMember` = '%u')", $ir['userid'])); $check_two = mysql_query(sprintf("SELECT * FROM `businesses` WHERE (`busDirector` = '%u')", $ir['userid'])); if(!mysql_num_rows($check_two) AND !mysql_num_rows($check)) { echo 'You are not a member of a business right now, come back another time.'; $h->endpage(); exit; } else { $r = mysql_fetch_assoc($check); $b = mysql_fetch_assoc($check_two); $fetch_business = mysql_query(sprintf("SELECT * FROM `businesses` LEFT JOIN `businesses_classes` ON (`classId` = `busClass`) WHERE (`busId` = '%u') OR (`busId` = '%u')", $r['bmembBusiness'], $b['busId'])); if(!mysql_num_rows($fetch_business)) { echo 'This business does not exist at this time, please come back later.'; $h->endpage(); exit; } else { $inf = mysql_fetch_assoc($fetch_business); } } switch ($_GET['p']) { case 'leave_business': leave_business(); break; case 'view_members': view_members(); break; default: business_index(); break; } function business_index() { global $ir, $inf; echo '[b]'.stripslashes($inf['busName']).' options:[/b] '; if($inf['busDirector'] == $ir['userid']) { echo '[url="business_manage.php"]Manage business[/url] '; } else { echo '[url="business_home.php?p=view_donate"]Donate to the Business[/url] '; echo '[url="business_home.php?p=leave_business"]Leave the business[/url] '; } echo '[url="business_home.php?p=view_members"]View members[/url] '; $fetch_business = mysql_query(sprintf("SELECT * FROM `businesses` LEFT JOIN `businesses_classes` ON (`classId` = `busClass`) LEFT JOIN `users` ON (`userid` = `busDirector`) WHERE (`busId` = '%u')", abs((int) $inf['busId']))); if(!mysql_num_rows($fetch_business)) { echo 'You cannot view a business that doesn\'t exist.'; } else { $r = mysql_fetch_assoc($fetch_business); echo '<hr width="400"> <table width="400" class="table"> <tr> <th colspan="2">Details of '.stripslashes($r['busName']).' - '.stripslashes($r['className']).'</th> </tr> <tr height="100"> <td colspan="2" valign="middle" align="center">'; if($r['busImage']) { echo '[img='.stripslashes($r['busImage']).']'; } else { echo 'This business has no banner at this time.'; } echo '</td></tr> <tr> <th colspan="2">Further information</th> </tr> <tr height="150"> <td colspan="2" valign="middle" align="center"> <table width="200"> <tr> <td> [b]Class:[/b] '.stripslashes($r['className']).' [b]Director:[/b] [url="viewuser.php?u='.$r['userid'].'"]'.stripslashes($r['username']).'[/url] [b]Latest profit:[/b] G$'.number_format($r['busProfit']).' [b]Previous profit:[/b] G$'.number_format($r['busYProfit']).' [b]Latest customers:[/b] '.number_format($r['busCust']).' [b]Previous customers:[/b] '.number_format($r['busYCust']).' </td> </tr> </table>'; } echo ' <table width="600" class="table"> <tr> <th>#</th> <th>Alert text</th> <th>Time</th> </tr>'; $business_alerts = mysql_query(sprintf("SELECT * FROM `businesses_alerts` WHERE `alertBusiness` = '%u' ORDER BY `alertTime` DESC LIMIT 25", $inf['busId'])); while($ba = mysql_fetch_assoc($business_alerts)) { echo ' <tr> <td width="5%">'.$ba['alertId'].'</td> <td width="65%">'.stripslashes($ba['alertText']).'</td> <td width="30%">'.date('d-m-Y, g:i:s A', $ba['alertTime']).'</td> </tr>'; } echo '</table></table>'; } function view_members() { global $ir, $inf; echo '<table width="600" class="table"> <tr> <th width="50%">Member name</th> <th width="50%">Job rank</th> </tr>'; $fetch_members = mysql_query(sprintf("SELECT * FROM `businesses_members` LEFT JOIN `users` ON (`userid` = `bmembMember`) LEFT JOIN `businesses_ranks` ON (`rankId` = `bmembRank`) WHERE `bmembBusiness` = '%u'", $inf['busId'])); while($fm = mysql_fetch_assoc($fetch_members)) { echo ' <tr> <td>[url="viewuser.php?u='.$fm['userid'].'"]'.stripslashes($fm['username']).'[/url] ['.$fm['userid'].']</td> <td>'.stripslashes($fm['rankName']).' ($'.number_format($fm['bmembCash']).')</td> </tr>'; } echo '</table>'; } $h->endpage(); ?>     business_manage.php     <?php include_once (DIRNAME(__FILE__). '/globals.php'); echo '<p class="heading">Manage business</p>'; $fetch_business = mysql_query(sprintf("SELECT * FROM `businesses` LEFT JOIN `businesses_classes` ON (`classId` = `busClass`) WHERE (`busDirector` = '%u')", $ir['userid'])); if(!mysql_num_rows($fetch_business)) { echo 'You do not own a business right now!'; $h->endpage(); exit; } else { $inf = mysql_fetch_assoc($fetch_business); } switch ($_GET['p']) { case 'new_name': new_business_name(); break; case 'new_banner': new_business_banner(); break; case 'new_rank': edit_member_rank(); break; case 'new_salary': edit_member_salary(); break; case 'view_vault': view_vault(); break; case 'donate_cash': donate_cash(); break; case 'debt': sort_debt(); break; case 'bankrupt': bankrupt_business(); break; case 'credit_member': credit_member(); break; case 'view_apps': manage_applications(); break; case 'kick_out': kick_member(); break; case 'new_Director': new_Director(); break; case 'upgrade': upgrade_business(); break; default: business_index(); break; } function business_index() { global $ir, $inf; if($inf['busDebt']) { echo 'This business is in debt of $'.number_format($inf['busDebt']).' right now. Click [url="business_manage.php?p=debt"]here[/url] to sort it out. To bankrupt and close down the business, click [url="business_manage.php?p=bankrupt"]here[/url] to complete proceedings.'; } else { echo ' <table width="300"> <tr> <td> [b]Manage business:[/b] [url="business_manage.php?p=new_name"]Edit business name[/url] [url="business_manage.php?p=new_banner"]Change banner[/url] [url="business_manage.php?p=credit_member"]Credit cash to member[/url] [url="business_manage.php?p=view_apps"]Manage applications[/url] [url="business_manage.php?p=new_rank"]Edit member rank[/url] [url="business_manage.php?p=new_salary"]Edit member salary[/url] [url="business_manage.php?p=kick_out"]Kick member out[/url] [url="business_manage.php?p=upgrade"]Upgrade Business[/url] [url="business_manage.php?p=view_vault"]View the Vault[/url] [url="business_manage.php?p=new_Director"]Change Director of the business[/url] [url="business_manage.php?p=bankrupt"]Bankrupt the Business[/url] </td> </tr> </table>'; } } function new_business_name() { global $ir, $inf; if(!$_POST['name']) { echo '<form action="business_manage.php?p=new_name" method="post"> <p align="center"> [b]You are changing the business name of the '.stripslashes($inf['busName']).' business.[/b] Please enter a new name in the input box below and click \'Change name\' to submit the new name. <input type="text" name="name" /> <input type="submit" value="Change name" /> </p> </form>'; } else { $check = mysql_query(sprintf("SELECT * FROM `businesses` WHERE (`busName` = '%s')", mysql_real_escape_string($_POST['name']))); if(!mysql_num_rows($check)) { mysql_query(sprintf("UPDATE `businesses` SET `busName` = '%s' WHERE `busId` = '%u'", stripslashes($_POST['name']), $inf['busId'])); echo 'The business name was changed to '.stripslashes($_POST['name']).'!'; business_alert($inf['busId'], "The business name was changed to ".stripslashes($_POST['name'])."."); } else { echo 'This business name is in use at this time.'; } } } function new_business_banner() { global $ir, $inf; if(!$_POST['banner']) { echo '<form action="business_manage.php?p=new_banner" method="post"> <p align="center"> [b]You are changing the banner of the '.stripslashes($inf['busName']).' business.[/b] Please enter a new banner image location in the input box below and click \'Change banner\' to submit the new image. [b]Current image:[/b] '; if($inf['busImage']) { echo '[img='.stripslashes($inf['busImage']).']'; } else { echo 'This business has no banner at this time.'; } echo ' New image: <input type="text" name="banner" size="50" /> <input type="submit" value="Change banner" /> </p> </form>'; } else { mysql_query(sprintf("UPDATE `businesses` SET `busImage` = '%s' WHERE `busId` = '%u'", stripslashes($_POST['banner']), $inf['busId'])); echo 'The business banner was updated.'; business_alert($inf['busId'], "The business banner has been updated."); } } function edit_member_rank() { global $ir, $inf; if(!$_POST['member'] || !$_POST['rank']) { echo '<form action="business_manage.php?p=new_rank" method="post"> <p align="center"> [b]Set the business rank:[/b] Business member: <select name="member"> <option value="0">None</option>'; $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> Business rank: <select name="rank"> <option value="0">None</option>'; $select_ranks = mysql_query(sprintf("SELECT * FROM `businesses_ranks` WHERE (`rankClass` = '%u') ORDER BY `rankId` ASC", $inf['classId'])); while($sr = mysql_fetch_assoc($select_ranks)) { echo '<option value="'.$sr['rankId'].'">'.stripslashes($sr['rankName']).' ($'.number_format($sr['rankCash']).')</option>'; } echo '</select> <input type="submit" value="Change rank" /></p> </form>'; } else { $select_member = mysql_query(sprintf("SELECT * FROM `businesses_members` WHERE (`bmembMember` = '%u') AND (`bmembBusiness` = '%u')", abs((int) $_POST['member']), $inf['busId'])); if(!mysql_num_rows($select_member)) { echo 'You cannot edit the rank of this member.'; } else { $select_cash = mysql_query(sprintf("SELECT * FROM `businesses_ranks` WHERE (`rankId` = '%u')", abs((int) $_POST['rank']))); $sc = mysql_fetch_assoc($select_cash); echo 'This member\'s rank was updated.'; mysql_query(sprintf("UPDATE `businesses_members` SET `bmembRank` = '%d', `bmembCash` = '%d' WHERE (`bmembMember` = '%u')", abs((int) $_POST['rank']), $sc['rankCash'], abs((int) $_POST['member']))); business_alert($inf['busId'], "Member ID ".abs((int) $_POST['member'])."\'s rank was changed."); } } } function edit_member_salary() { global $ir, $inf; if(!$_POST['member'] || !$_POST['salary']) { echo '<form action="business_manage.php?p=new_salary" method="post"> <p align="center"> [b]Set the new business salary:[/b] Business member: <select name="member"> <option value="0">None</option>'; $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> Salary amount: <input type="text" name="salary" size="8" maxlength="6" /> <input type="submit" value="Change salary" /></p> </form>'; } else { $select_member = mysql_query(sprintf("SELECT * FROM `businesses_members` WHERE (`bmembMember` = '%u') AND (`bmembBusiness` = '%u')", abs((int) $_POST['member']), $inf['busId'])); if(!mysql_num_rows($select_member)) { echo 'You cannot edit the salary of this member.'; } else { echo 'This member\'s salary was updated to $'.number_format($_POST['salary']).'.'; mysql_query(sprintf("UPDATE `businesses_members` SET `bmembCash` = '%d' WHERE (`bmembMember` = '%u')", abs((int) $_POST['salary']), abs((int) $_POST['member']))); business_alert($inf['busId'], "Member ID ".abs((int) $_POST['member'])."\'s salary was changed to \$".number_format($_POST['salary'])."."); } } } function view_vault() { global $ir, $inf; echo '<form action="business_manage.php?p=donate_cash" method="post"> Your business has $'.number_format($inf['busCash']).' secured in it\'s vault. [b]Donate cash:[/b] Cash amount: <input type="text" name="cash" /> <input type="submit" value="Donate cash">'; } function sort_debt() { global $ir, $inf; if($_POST['cash'] > 0) { if($_POST['cash'] > $ir['money']) { echo 'You do not have enough cash to sort out that amount of debt.'; } else if($_POST['cash'] > $inf['busDebt']) { echo 'The business does not owe that much cash in debt.'; } else { mysql_query(sprintf("UPDATE `users` SET `money` = `money` - '%d' WHERE `userid` = '%u'", abs((int) $_POST['cash']), $ir['userid'])); mysql_query(sprintf("UPDATE `businesses` SET `busDebt` = `busDebt` - '%d' WHERE `busId` = '%u'", abs((int) $_POST['cash']), $inf['busId'])); echo 'You have cleared up $'.number_format($_POST['cash']).' of the business debt.'; business_alert($inf['busId'], "".$ir['username']." paid \$".number_format($_POST['cash'])." of the business debt."); } } else { echo '<form action="business_manage.php?p=debt" method="post"> Your business has $'.number_format($inf['busDebt']).' of debt. [b]Enter amount:[/b] Cash: <input type="text" name="cash" /> <input type="submit" value="Submit" /> </form>'; } } function donate_cash() { global $ir, $inf; if($_POST['cash'] > 0) { if($_POST['cash'] > $ir['money']) { echo 'You do not have enough cash to donate this much to the business.'; } else { mysql_query(sprintf("UPDATE `users` SET `money` = `money` - '%d' WHERE `userid` = '%u'", abs((int) $_POST['cash']), $ir['userid'])); mysql_query(sprintf("UPDATE `businesses` SET `busCash` = `busCash` + '%d' WHERE `busId` = '%u'", abs((int) $_POST['cash']), $inf['busId'])); echo 'You have donated $'.number_format($_POST['cash']).' to the business.'; business_alert($inf['busId'], "".$ir['username']." donated \$".number_format($_POST['cash'])." to the business."); } } else { echo 'You missed one or more of the required fields.'; } } function kick_member() { global $ir, $inf; if(!isset($_POST['member'])) { echo 'Please select a member to kick out of the business: <form action="business_manage.php?p=kick_out" method="post"> Business member: <select name="member"> <option value="0">None</option>'; $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> <input type="submit" value="Kick out" /> </form>'; } else { mysql_query(sprintf("DELETE FROM `businesses_members` WHERE `bmembMember` = '%u'", abs((int) $_POST['member']))); echo 'This member has been kicked out of the business.'; business_alert($inf['busId'], "Member ID ".$_POST['member']." was kicked out of the business."); } } function bankrupt_business() { global $ir, $inf; if(!$_GET['confirm']) { echo 'You are about to bankrupt the '.stripslashes($inf['busName']).' business. Please confirm this action. Once this has been confirmed there is no chance to go back. > [url="business_home.php?p=bankrupt&confirm=1"]Bankrupt the business[/url]'; } else { $send_event = mysql_query(sprintf("SELECT `bmembMember` FROM WHERE `bmembBusiness` = '%u' ORDER BY `bmembId` DESC", $bs['busId'])); while($se = mysql_fetch_assoc($send_event)) { $text = "The director has chosen to bankrupt the {$inf['busName']} business\, all members have been discharged."; insert_event($se['bmembMember'], $text); } mysql_query(sprintf("DELETE FROM `businesses_members` WHERE (`bmembBusiness` = '%u')", $inf['busId'])); mysql_query(sprintf("DELETE FROM `businesses` WHERE (`busId` = '%u')", $inf['busId'])); echo 'You have decided to bankrupt the business, all members have been fired.'; } } function credit_member() { global $ir, $inf; if($_POST['cash'] AND $_POST['member']) { if($_POST['cash'] > $inf['busCash']) { echo 'You cannot credit more than the business has in it\'s vault.'; } else { mysql_query(sprintf("UPDATE `users` SET `money` = `money` + '%d' WHERE `userid` = '%u'", abs((int) $_POST['cash']), abs((int) $_POST['member']))); mysql_query(sprintf("UPDATE `businesses` SET `busCash` = `busCash` - '%d' WHERE `busId` = '%u'", abs((int) $_POST['cash']), $inf['busId'])); echo 'You gave $'.number_format($_POST['cash']).' to this member from the vault.'; business_alert($inf['busId'], "Member ID ".$_POST['member']." was credited \$".number_format($_POST['cash'])." from the business."); } } else { echo '<form action="business_manage.php?p=credit_member" method="post"> <p align="center"> Your business vault contains $'.number_format($inf['busCash']).' at this time, which can be credited to a member. Select a member from the box below and enter an amount of cash to give to them. Cash amount: <input type="text" name="cash" /> Business member: <select name="member"> option value="0">None</option> <option value="'.$ir['userid'].'">'.stripslashes($ir['username']).'</option>'; $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> <input type="submit" value="Credit cash" /> </p> </form>'; } } function manage_applications() { global $ir, $inf; if(!isset($_GET['a'])) { $fetch_apps = mysql_query(sprintf("SELECT * FROM `businesses_apps` LEFT JOIN `users` ON `userid` = `appMember` WHERE `appBusiness` = '%u'", $inf['busId'])); echo '<table width="600" class="table"> <tr> <th width="15%">Member</th> <th width="50%">Application</th> <th width="15%">Time</th> <th width="20%">Manage</th> </tr>'; while($r = mysql_fetch_assoc($fetch_apps)) { echo ' <tr> <td>[url="viewuser.php?u='.$r['userid'].'"]'.stripslashes($r['username']).'[/url]</td> <td>'.stripslashes($r['appText']).'</td> <td>'.date('d-m-Y, g:i:s A', $r['appTime']).'</td> <td>[url="business_manage.php?p=view_apps&a=accept&id='.$r['appId'].'"][size="1"]Accept[/size][/url] [size="1"]-[/size] [url="business_manage.php?p=view_apps&a=decline&id='.$r['appId'].'"][size="1"]Decline[/size][/url]</td> </tr>'; } echo '</table>'; } else if($_GET['a'] == 'accept' AND $_GET['id']) { $fetch_app = mysql_query(sprintf("SELECT * FROM `businesses_apps` LEFT JOIN `users` ON `userid` = `appMember` WHERE `appId` = '%u'", abs((int) $_GET['id']))); if(mysql_num_rows($fetch_app)) { $it = mysql_fetch_assoc($fetch_app); $check = mysql_query(sprintf("SELECT * FROM `businesses_members` WHERE (`bmembMember` = '%u')", $it['appMember'])); if(!mysql_num_rows($check)) { $rows = mysql_query(sprintf("SELECT * FROM `businesses_members` WHERE (`bmembBusiness` = '%u')", $inf['busId'])); if(mysql_num_rows($rows) < $inf['classMembers']) { $fetch_rank = mysql_query(sprintf("SELECT * FROM `businesses_ranks` WHERE (`rankClass` = '%u') ORDER BY `rankCash` ASC LIMIT 1", $inf['classId'])); $fr = mysql_fetch_assoc($fetch_rank); business_alert($inf['busId'], "Member ID ".$it['appMember']." has been accepted into the business."); mysql_query(sprintf("INSERT INTO `businesses_members` (`bmembId`, `bmembMember`, `bmembBusiness`, `bmembCash`, `bmembRank`) VALUES ('NULL', '%u', '%d', '%d', '%d')", $it['appMember'], $inf['busId'], $fr['rankCash'], $fr['rankId'])); mysql_query(sprintf("DELETE FROM `businesses_apps` WHERE `appId` = '%u'", abs((int) $_GET['id']))); event_add($it['appMember'],"Your application to join the business was Accepted Congratulations!",$c); echo 'The selected application has been accepted.'; } else { echo 'Your business cannot hold more members at this time.'; } } else { echo 'This member is part of a business at this time, the application could not be accepted.'; mysql_query(sprintf("DELETE FROM `businesses_apps` WHERE `appId` = '%u'", abs((int) $_GET['id']))); } } else { echo 'The selected application no longer exists.'; } } else if($_GET['a'] == 'decline' AND $_GET['id']) { $fetch_app2 = mysql_query(sprintf("SELECT * FROM `businesses_apps` LEFT JOIN `users` ON `userid` = `appMember` WHERE `appId` = '%u'", abs((int) $_GET['id']))); $it = mysql_fetch_assoc($fetch_app2); $fetch_app = mysql_query(sprintf("SELECT * FROM `businesses_apps` WHERE `appId` = '%u'", abs((int) $_GET['id']))); if(mysql_num_rows($fetch_app)) { echo 'The selected application was declined, It has been removed from the log.'; event_add($it['appMember'],"Your application to join the business was declined sorry!",$c); mysql_query(sprintf("DELETE FROM `businesses_apps` WHERE `appId` = '%u'", abs((int) $_GET['id']))); } else { echo 'The selected application no longer exists.'; } } else { echo 'You did not select an application to manage, go back and select one!'; } } function upgrade_business() { global $ir, $inf; if(!$_GET['confirm']) { $price_upgrade = ($inf['classMembers']*200000); echo 'You are about to upgrade the '.stripslashes($inf['busName']).' business at a cost of $'.number_format($price_upgrade).' for an additional 5 slots. Please confirm this action. Once this has been confirmed there is no chance to go back. [url="business_manage.php?p=upgrade&confirm=1"]Upgrade the business[/url]'; } else { $price_upgrade = ($inf['classMembers']*200000); if ($inf['busCash'] < $price_upgrade) { die('You do not have enough cash in the vault.'); }else{ mysql_query(sprintf("UPDATE `businesses` SET `busEmployees` = `busEmployees` + 5, `busCash` = busCash - ".$price_upgrade." WHERE `busDirector` = ".$ir['userid']."")); business_alert($inf['busId'], "The Director has upgraded the business for 5 extra members."); echo 'You have decided to upgrade the business, you can now emploty an additional 5 members.'; } } } function new_Director() { global $ir, $inf; if(!$_GET['confirm']) { echo '<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 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> <input type="submit" value="Change Director." /> </p> </form>'; } 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 'You have decided to change Directors.'; } } } $h->endpage(); ?>   One More Post
  3. *Fully Working Business mod even with upgrade   business_create.php   <?php include_once (DIRNAME(__FILE__). '/globals.php'); echo '<p class="heading">Create business</p>'; if($_POST['name'] AND $_POST['class']) { $fetch_class = mysql_query(sprintf("SELECT * FROM `businesses_classes` WHERE (`classId` = '%u')", abs((int) $_POST['class']))); $check = mysql_query(sprintf("SELECT * FROM `businesses` WHERE (`busDirector` = '%u')", $ir['userid'])); $check_member = mysql_query(sprintf("SELECT * FROM `businesses_members` WHERE (`bmembMember` = '%u')", $ir['userid'])); if(!mysql_num_rows($fetch_class)) { echo 'You cannot start a business in a class that doesn\'t exist.'; } else { $r = mysql_fetch_assoc($fetch_class); if($ir['level'] < 10) { echo 'You must be at least Level 10 to begin a business.'; } else if($ir['money'] < $r['classCost']) { echo 'You cannot afford to start a business of this class right now.'; } else if(mysql_num_rows($check) || mysql_num_rows($check_member)) { echo 'You are part of a business at this time, leave to start a new one.'; } else { mysql_query(sprintf("INSERT INTO `businesses` (`busId`, `busName`, `busClass`, `busDirector`) VALUES ('NULL','%s', '%d', '%u')", stripslashes($_POST['name']), abs((int) $_POST['class']), $ir['userid'])); mysql_query(sprintf("UPDATE `users` SET `money` = `money` - '%d' WHERE `userid` = '%u'", $r['classCost'], $ir['userid'])); echo 'The '.$_POST['name'].' business was created.'; } } } else { echo '<form action="business_create.php" method="post"> <p align="center"> [b]Create a new business:[/b] Please enter a name for the new business below, then select a class. Business name: <input type="text" name="name" /> Business class: <select name="class"> <option value="0">None</option>'; $select_classes = mysql_query("SELECT * FROM `businesses_classes` ORDER BY `className` ASC"); while($c = mysql_fetch_assoc($select_classes)) { echo '<option value="'.$c['classId'].'">'.stripslashes($c['className']).' ($'.number_format($c['classCost']).')</option>'; } echo '</select> <input type="submit" value="Create business" /></p> </form>'; } $h->endpage(); ?>     business_cron.php     <?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; $set=array(); $settq=$db->query("SELECT * FROM settings"); while($r=$db->fetch_row($settq)) { $set[$r['conf_name']]=$r['conf_value']; } include "global_func.php"; $select_businesses = mysql_query("SELECT * FROM `businesses` LEFT JOIN `businesses_classes` ON (`classId` = `busClass`) ORDER BY `busId` ASC"); while($bs = mysql_fetch_assoc($select_businesses)) { $amount = mysql_num_rows(mysql_query(sprintf("SELECT * FROM `businesses_members` WHERE `bmembBusiness` = '%u'", $bs['busId']))); $new_customers = ((($bs['classCost'] / 999000) * ($amount + 1) + rand(-12, 18)) / 10); $new_profit = (($new_customers + rand(-4, 8)) * ((($bs['classCost'] / 2500) * rand(2, 8)) / 13) * ($amount + 1)); mysql_query(sprintf("UPDATE `businesses` SET `busYCust` = `busCust`, `busYProfit` = `busProfit`, `busCust` = '%d', `busProfit` = '%d', `busCash` = '%d' WHERE `busId` = '%u'", $new_customers, $new_profit, ($new_profit + $bs['busCash']), $bs['busId'])) OR die('Cron not run'); $fetch_members = mysql_query(sprintf("SELECT * FROM `businesses_members` LEFT JOIN `users` ON (`userid` = `bmembMember`) LEFT JOIN `businesses_ranks` ON (`rankId` = `bmembRank`) WHERE `bmembBusiness` = '%u'", $bs['busId'])); while($fm = mysql_fetch_assoc($fetch_members)) { $fetch_stat = array( 'strength' => 'strength', 'intel' => 'IQ', 'labour' => 'labour' ); mysql_query(sprintf("UPDATE `users` SET `money` = `money` + '%d' WHERE `userid` = '%u'", $fm['bmembCash'], $fm['userid'])); mysql_query(sprintf("UPDATE `userstats` SET `{$fetch_stat[$fm['rankPrim']]}` = `{$fetch_stat[$fm['rankPrim']]}` + '%.6f', `{$fetch_stat[$fm['rankSec']]}` = `{$fetch_stat[$fm['rankSec']]}` + '%.6f' WHERE (`userid` = '%u')", $fm['rankPGain'], $fm['rankSGain'], $fm['userid'])); if($bs['busCash'] < $fm['bmembCash']) { $text = "Member ID {$fm['bmembMember']} was not paid their \$".number_format($fm['bmembCash'])." due to lack of funds."; mysql_query(sprintf("INSERT INTO `businesses_alerts` (`alertId`, `alertBusiness`, `alertText`, `alertTime`) VALUES ('NULL', '%u', '%s', '%d')", $bs['busId'], $text, time())); mysql_query(sprintf("UPDATE `businesses` SET `busDebt` = `busDebt` + '%d' WHERE `busId` = '%u'", $fm['bmembCash'], $bs['busId'])); } else { mysql_query(sprintf("UPDATE `businesses` SET `busCash` = `busCash` - '%d' WHERE `busId` = '%u'", $fm['bmembCash'], $bs['busId'])); } } if($bs['busDebt'] > $bs['classCost']) { $send_event = mysql_query(sprintf("SELECT `bmembMember` FROM WHERE `bmembBusiness` = '%u' ORDER BY `bmembId` DESC", $bs['busId'])); while($se = mysql_fetch_assoc($send_event)) { $text = "The {$bs['busName']} business went bankrupt\, all members have been discharged."; insert_event($se['bmembMember'], $text); } mysql_query(sprintf("DELETE FROM `businesses_members` WHERE (`bmembBusiness` = '%u')", $bs['busId'])); mysql_query(sprintf("DELETE FROM `businesses` WHERE (`busId` = '%u')", $bs['busId'])); } } ?>     Rest to follow
  4. yeah its a very nice mod got some good protential to it i have some ideas witch i might impliment in to it if you dont mind?
  5. <?php /*----------------Copyright----------------------------------- Golfing Mod Coded by Gucci Mane Do NOT redistribute or try to sell Do NOT delete this copy right ------------------------------------------------------------*/ include(DIRNAME(__FILE__) .'/globals.php'); if ($ir['jail']) { die("You cant golf while in jail"); } if ($ir['hospital']) { die("You cant golf while in the hospital"); } if ($ir['golf'] ==1) { die("Only 1 time an hour") } echo "<h2>Golfing</h2>"; $chance=rand(1,5); $wincash=rand(0,15000); $wincrystal=rand(0,25); $hosptime=rand(5,15); $jailtime=rand(5,15); $walletpick=rand(0,10000); if ($chance ==1) { echo "<span style='color:green';>You went all 18 holes and found \$$wincash along the way.</span></font>"; $update1 = sprintf("UPDATE users SET money = money + %u WHERE (userid = %u)", $wincash, $userid ); $db->query($update1); } if ($chance ==2) { echo "<span style='color:red'>Wow, your golfing partner accidentally swung back the golf club and wacked you right in the head!</span>"; $update1 = sprintf("UPDATE users SET hospital = %u, hospreason = 'wacked by partner while golfing' WHERE (userid = %u)", $hosptime, $userid ); $db->query($update1); } if ($chance ==3) { echo "<span style='color:green;'>While you were golfing you stumble across a bag and realized there were crystals in it You found $wincrystal crystals!</span>"; $update1 = sprintf("UPDATE users SET crystals = crystals + %u WHERE (userid = %u)", $wincrystal, $userid ); $db->query($update1); } if($chance ==4) { echo "<span style='color:red;'>You were golfing and hit a ball too far and it hit a guy and killed him! ENJOY Jail!</span>"; $update1 = sprintf("UPDATE users SET jail = %u, jailreason = 'Killed a guy while golfin' WHERE (userid = %u)", $jailtime, $userid ); $db->query($update1); } if ($chance ==5) { echo "<span style='color:green;'>You were golfing and seen Randy walking across the road, he drops his wallet Your hurry quick to pick it up and find \$$walletpick, while in the road you got hit by a car.</span>"; $update1 = sprintf("UPDATE users SET money = money + %u, hospital = %u, hospreason = 'hit by car while golfin' WHERE (userid = %u)",$walletpick, $hosptime, $userid ); $db->query($update1); $h->endpage(); ?>     Missed out jail reason and thought ill tidy up the queires apart from that very nice work :P
×
×
  • Create New...