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