Jump to content
MakeWebGames

thedestroyer

Members
  • Posts

    277
  • Joined

  • Last visited

    Never

Everything posted by thedestroyer

  1. Re: Businesses Mod [Mccode V2] obviously dont forget richards sqls and this one too   ALTER TABLE `businesses` ADD `busEmployees` int (11) not null default 0;   Enjoy!
  2. Re: Businesses Mod [Mccode V2] business_view.php   <?php include_once (DIRNAME(__FILE__). '/globals.php'); echo '<p class="heading">Companies</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]Company 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']).' companies[/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 company 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]Companies:[/b] The '.stripslashes($r['className']).' company 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']).' company 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']).' companies</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 company 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 company 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 company 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 company to view.'; } } function send_application() { global $ir; $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 company.'; } else if(mysql_num_rows($check) || mysql_num_rows($check_member)) { echo 'You are part of a company 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 company right now, wait for a responce.'; } else if(!$_GET['id']) { echo 'You did not choose a company 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())); echo 'Your application was sent to the selected company, 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 company 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 company. 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 company 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(); ?>
  3. Re: Businesses Mod [Mccode V2] business_manage.php continued   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['busEmployees']) { $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']))); 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_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.'; 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']*100000); 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']*100000); if ($inf['busMoney'] < $price_upgrade) { die('You do not have enough gold in the vault.'); }else{ mysql_query(sprintf("UPDATE `businesses` SET `busEmployees` = busEmployees+5, `busMoney` = busMoney - ".$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.'; } } } $h->endpage(); ?>
  4. Re: Businesses Mod [Mccode V2] business_manage.php this will be over 2 posts   <?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 '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=upgrade"]Upgrade The Business[/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=view_vault"]View the vault[/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>'; } }
  5. Re: Businesses Mod [Mccode V2] 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] $'.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']).' </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(); ?>
  6. Re: Businesses Mod [Mccode V2] business_cron.php (edited so profits are not ridiculously high)   <?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'] / 95000) * ($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'])); } } ?>
  7. Re: Businesses Mod [Mccode V2] ok 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(); ?>
  8. Re: Businesses Mod [Mccode V2] Also later on I may add some more companies of my own. If anyone would like me to share them please let me know and i will be happy to :-)
  9. Re: Businesses Mod [Mccode V2] Ok people I have finally finished teh cron so profits are not ridiculously high but you must be using richards mod. Replace business_cron.php with: <?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'] / 95000) * ($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'])); } } ?>   Enjoy!
  10. Re: Businesses Mod [Mccode V2] Which table is the one for your workers in the sqls?
  11. Re: Businesses Mod [Mccode V2]   ok good luck i will have a look too :-)
  12. Re: Businesses Mod [Mccode V2] I would try but i find it pointless as you don't even need to get workers to make money.
  13. Re: Businesses Mod [Mccode V2] I have but the profits are ridiculously high
  14. Re: Looking for code paying $5   And like you know how to code it don't you not
  15. Re: Looking for code paying $5   Oh yeh lmao I guess thats why they both have a load more -1s than +1 lmfao
  16. Re: Looking for code paying $5 Stop wiping his ass haunted
  17. Re: Looking for code paying $5   just gave u a +1 btw for some random reason lol
  18. Re: Looking for code paying $5 And so you dont think i pay? go ask Lithium then i bought his item market mod
  19. Re: Looking for code paying $5   He didnt read properly cos i put i want to test it first and he didnt read lmao cos obviously if it didn't work he wouldn't have fixed it say you are the person who hacks everyones games too arent you? cos you have nothing better to do and dont post again you will only embarass yourself more
  20. Hi can someone please help I want to add a code into global_func.php so that when your brave gets to a certain amount it cannot increase anymore thanks.
  21. Re: Looking for code paying $5 lol no way im saying on here theres too many people on here that try to hack anyones game they can find
  22. Re: Looking for code paying $5 Can anyone make one for me then?
  23. Hi I am looking for a code to make it so your brave increases after doing a certain amount of crimes instead of levelling. I know there's a mod for it on here but it didn't work for me. Mail me if interested. I will want to try it on my site first and i am paying $5. Thanks
  24. Re: Crime Update   How did u get it to work?
  25. Re: Crime Update This code seriously messed up my game i edited people to set their brave bak to starting brave then it didnt work and my players are goin to be mad now thanks a lot :x
×
×
  • Create New...