Jump to content
MakeWebGames

Manage-Business


Criminal

Recommended Posts

Hey when i try to delete business from manage-business.php owner panel of my business i click delete yes then nothing happens it just stays on that page it doesht load oh anytihng thnx

 

<?php
include "globals.php";
$bq=mysql_query("SELECT * FROM businesses WHERE bID={$ir['business']}",$c);
$bdata=mysql_fetch_array($bq);
if($ir['business']== 0)
{
die("You are not in a business.");
}
if($bdata['bOWNER'] != $userid)
{
die("You dont own this business!");
}
switch($_GET['change'])
{
case "name":
name();
break;

case "bank":
bank();
break;

case "msgs":
msgs();
break;

case "pday":
pday();
break;

case "mmail":
mmail();
break;

case "logo":
logo();
break;

case "flm":
flm();
break;

case "elm":
elm();
break;

case "prov":
prov();
break;

case "apps":
member_apps();
break;

case "kick":
kick();
break;

case "members":
members_list();
break;

case "delete":
delete();
break;

default:
index();
break;
}
function index()
{
global $ir,$c,$userid,$h,$bdata;
print "<center><font color='green'><h2>[b]Welcome to your managers panel for {$bdata['bNAME']}.[/b]</h2></font></center>

<center><table width=75% border=1><tr background='header.jpg'><th>Part of business</th><th>Manage?</th></tr>
<tr><td>Name</td><td>[url='manage-business.php?change=name']Change[/url]</td></tr>
<tr><td>Applications</td><td>[url='manage-business.php?change=apps']Change[/url]</td></tr>
<tr><td>Members</td><td>[url='manage-business.php?change=members']Change[/url]</td></tr>
<tr><td>Bank</td><td>[url='manage-business.php?change=bank']Manage[/url]</td></tr>
<tr><td>Messages</td><td>[url='manage-business.php?change=msgs']Change[/url]</td></tr>
<tr><td>Payment Day</td><td>[url='manage-business.php?change=pday']Change[/url]</td></tr>
<tr><td>Mass Mail</td><td>[url='manage-business.php?change=mmail']Do[/url]</td></tr>
<tr><td>Logo</td><td>[url='manage-business.php?change=logo']Change[/url]</td></tr>
<tr><td>Friends</td><td>[url='manage-business.php?change=flm']Manage[/url]</td></tr>
<tr><td>Enemies</td><td>[url='manage-business.php?change=elm']Manage[/url]</td></tr>
<tr><td>Profit</td><td>[url='manage-business.php?change=prov']View[/url]</td></tr>
<tr><td>Delete Business</td><td>[url='manage-business.php?change=delete']Delete[/url]</td></tr>
</table></center>";
}
function name()
{
global $ir,$c,$userid,$h,$bdata;
if($_POST['newname'])
{
mysql_query("UPDATE businesses SET bNAME='{$_POST['newname']}',bDESCRIPTION='{$_POST['description']}' WHERE bID={$bdata['bID']}",$c);
print "Name and Description Changed
[url='manage-business.php']>Back[/url]
";
exit;
}
else
{
print "[b]Enter your new business name / description[/b]

<form action='manage-business.php?change=name' method='post'>
Name: <input type='text' name='newname'>

Description : <textarea name='description' cols=30 rows=8>{$bdata['bDESCRIPTION']}</textarea>

<input type='submit' value='Change'></form>";
}
}
function bank()
{
global $ir,$c,$userid,$h,$bdata;
if($_POST['user'])
{
$ck=mysql_query("SELECT * FROM users WHERE business={$ir['business']} AND userid={$_POST['user']}",$c);
if(mysql_num_rows($ck)== 0)
{
print "ERROR!
Either this user does not exist or they are not in your business.";
exit;
}
$user=(int) $_POST['user'];
$cash=(int) $_POST['cash'];
$crys=(int) $_POST['crystals'];
mysql_query("UPDATE users SET money=money+$cash, crystals=crystals+$crys WHERE userid=$user",$c);
mysql_query("UPDATE businesses SET bBANKMONEY=bBANKMONEY-$cash, bBANKCRYSTALS=bBANKCRYSTALS-$crys WHERE bID={$bdata['bID']}",$c);
print "\$$cash and $crys Crystals Given to User : $user.
[url='manage-business.php']>Back[/url]
";
}
else
{
print "<center>Your Business bank currently has...

[b]\${$bdata['bBANKMONEY']}[/b] Cash,

[b]{$bdata['bBANKCRYSTALS']}[/b] Crystals.

<hr />
<form action='manage-business.php?change=bank' method='post'>
[b]Give Cash/Crystals to Userid :[/b] <input type='text' name='user' value='$userid'>

<table width=75% border=0>
<tr><td height=10 width=50% align=center valign=top background='header.jpg'>
Bank Money:
<input type='text' name='cash' value='{$bdata['bBANKMONEY']}'>
</td><td height=10 width=50% align=center valign=top background='header.jpg'>
Bank Crystals: <input type='text' name='crystals' value='{$bdata['bBANKCRYSTALS']}'>
</td></tr></table>
</form>


</center>
";
}
}
function msgs()
{
global $ir,$c,$userid,$h,$bdata;
if($_POST['newmsg'])
{
mysql_query("UPDATE businesses SET bMESSAGES='{$_POST['newmsg']}' WHERE bID='{$bdata['bID']}'",$c);
}
else
{
print "Here You May Change Your Business Message.

<form action='manage-business.php?change=msgs' method='post'>
Message :<textarea name='newmsg' cols=30 rows=8>{$bdata['bMESSAGES']}</textarea>

<input type='submit' value='Change!'>

</form>";
}
}
function pday()
{
global $ir,$c,$userid,$h,$bdata;
if($_POST['submq'])
{
if($_POST['monday']== 'Yes') 
{
$monday="<font color=green>[b]Yes[/b]</font>"; 
} 
else 
{
$monday="<font color=red>[b]No[/b]</font>";
}
if($_POST['tuesday']== 'Yes') 
{
$tuesday="<font color=green>[b]Yes[/b]</font>"; 
} 
else 
{
$tuesday="<font color=red>[b]No[/b]</font>";
}
if($_POST['wednesday']== 'Yes') 
{
$wednesday="<font color=green>[b]Yes[/b]</font>"; 
} 
else 
{
$wednesday="<font color=red>[b]No[/b]</font>";
}
if($_POST['thursday']== 'Yes') 
{
$thursday="<font color=green>[b]Yes[/b]</font>"; 
} 
else 
{
$thursday="<font color=red>[b]No[/b]</font>";
}
if($_POST['friday']== 'Yes') 
{
$friday="<font color=green>[b]Yes[/b]</font>"; 
} 
else 
{
$friday="<font color=red>[b]No[/b]</font>";
}
if($_POST['saturday']== 'Yes') 
{
$saturday="<font color=green>[b]Yes[/b]</font>"; 
} 
else 
{
$saturday="<font color=red>[b]No[/b]</font>";
}
if($_POST['sunday']== 'Yes') 
{
$sunday="<font color=green>[b]Yes[/b]</font>"; 
} 
else 
{
$sunday="<font color=red>[b]No[/b]</font>";
}
$totaltext="[b]Days of Payments[/b]

Monday : $monday 

Tuesday : $tuesday 

Wednesday : $wednesday 

Thursday : $thursday 

Friday : $friday 

Saturday : $saturday 

Sunday : $sunday 
";
mysql_query("UPDATE businesses SET bPDAY='$totaltext' WHERE bID='{$bdata['bID']}'",$c);
print "Days Of Payments is now as follows

<hr />
[b]Days of Payments[/b]

Monday : $monday 

Tuesday : $tuesday 

Wednesday : $wednesday 

Thursday : $thursday 

Friday : $friday 

Saturday : $saturday 

Sunday : $sunday 

<hr />";
}
else
{
print "Please tick the days which you want your Payments to be.

<form action='manage-business.php?change=pday' method='post'>
<input type='hidden' name='submq' value='abc123'>
Monday :<input type='checkbox' name='monday' value='Yes'>

Tuesday :<input type='checkbox' name='tuesday' value='Yes'>

Wednesday :<input type='checkbox' name='wednesday' value='Yes'>

Thursday :<input type='checkbox' name='thursday' value='Yes'>

Friday :<input type='checkbox' name='friday' value='Yes'>

Saturday :<input type='checkbox' name='saturday' value='Yes'>

Sunday :<input type='checkbox' name='sunday' value='Yes'>

<input type='submit' value='Change'>

</form>
";
}
}
function mmail()
{
global $ir,$c,$userid,$h,$bdata;
if($_POST['message'])
{
$subj="This is a Mass Mail from Your Business...";
$mmq=mysql_query("SELECT * FROM users WHERE business='{$ir['business']}'",$c);
while($o=mysql_fetch_array($mmq))
{
mysql_query("INSERT INTO mail VALUES('', 0, {$ir['userid']}, {$o['userid']}, unix_timestamp(),'$subj','{$_POST['message']}')",$c);
print "Mass mail sent to {$o['username']}.
";
}
print "Mass Mail Sent!";
}
else
{
$tmq=mysql_query("SELECT * FROM businesses WHERE bID='{$ir['business']}'",$c);
$tm=mysql_num_rows($tmq);
print "[b]Here you may send a mass mail to your Business.[/b]

You have a total of [b]$tm[/b] Members in this Business.

<form action='manage-business.php?change=mmail' method='post'>
Message :<textarea name='message' cols='30' rows='8'>Dear Members Of The Business,
</textarea>

<input type='submit' value='Submit'>

</form>";
}
}
function logo()
{
global $ir,$c,$userid,$h,$bdata;
if($_POST['newlogo'])
{
mysql_query("UPDATE businesses SET bLOGO='{$_POST['newlogo']}' WHERE bID='{$ir['business']}'",$c);
print "Logo Successfully Changed!

";
}
else
{
print "Please Paste Your Picture URL for Your New Business Logo

<form action='manage-business.php?change=logo' method='post'>
New Logo: <input type='text' name='newlogo' value='{$bdata['bLOGO']}'>

<input type='submit' value='Change Pic'>

</form>";
}
}
function flm()
{
global $ir,$c,$userid,$h,$bdata;
if($_POST['business'])
{
if($_POST['business'] == $bdata['bID'])
{
print "You cannot add your own business...Haha!";
exit;
}
$cq=mysql_query("SELECT * FROM bf WHERE bfFROM={$ir['business']} AND bfTO={$_POST['business']}",$c);
if(mysql_num_rows($cq))
{
print "You have already added this business.";
exit;
}
mysql_query("INSERT INTO bf VALUES ('{$ir['business']}','{$_POST['business']}')",$c);
mysql_query("UPDATE businesses SET bPOPULATION=bPOPULATION+50 WHERE bID={$_POST['business']}",$c);
print "You have added a business as your friend..
";
}
else
{
$sb=mysql_query("SELECT * FROM businesses",$c);
$rem=mysql_query("SELECT * FROM bf WHERE bfFROM={$ir['business']}",$c);
print "Remove an friend

<form action='friendremove.php' method='post>
Friend (By Business ID) :<select name='fri'>";
while($fo=mysql_fetch_array($rem))
{
print "<option value='{$fo['bfTO']}'>{$fo['bfTO']}</option>";
}
print "</select>
<input type='submit' value='Remove!'>
</form>

";
print "Add a friend:

<form action='manage-business.php?change=flm' method='post'>
Business : <select name='business'>";
while($b=mysql_fetch_array($sb))
{
print "<option value='{$b['bID']}'>{$b['bNAME']}</option>";
}
print "</select>

<input type='submit' value='Add'></form>
";
}
}
function elm()
{
global $ir,$c,$userid,$h,$bdata;
if($_POST['business'])
{
if($_POST['business'] == $bdata['bID'])
{
print "You cannot add your own business as a Enemy!!";
exit;
}
$cq=mysql_query("SELECT * FROM be WHERE beFROM={$ir['business']} AND beTO={$_POST['business']}",$c);
if(mysql_num_rows($cq))
{
print "You have already added this business as a enemy.";
exit;
}
mysql_query("INSERT INTO be VALUES ('{$ir['business']}','{$_POST['business']}')",$c);
mysql_query("UPDATE businesses SET bPOPULATION=bPOPULATION-50 WHERE bID={$_POST['business']}",$c);
print "You have added a business as your enemy..
";
}
else
{
$sb=mysql_query("SELECT * FROM businesses",$c);
$rem=mysql_query("SELECT * FROM be WHERE beFROM={$ir['business']}",$c);
print "Remove an enemy

<form action='enemyremove.php' method='post>
Enemy (By Business ID) :<select name='eny'>";
while($mo=mysql_fetch_array($rem))
{
print "<option value='{$mo['beTO']}'>{$mo['beTO']}</option>";
}
print "</select>
<input type='submit' value='Remove!'>
</form>

";
print "Add a enemy:

<form action='manage-business.php?change=elm' method='post'>
Business : <select name='business'>";
while($b=mysql_fetch_array($sb))
{
print "<option value='{$b['bID']}'>{$b['bNAME']}</option>";
}
print "</select>

<input type='submit' value='Add'></form>
";
}
}
function prov()
{
global $ir,$c,$userid,$h,$bdata;
if($_GET['insert']== 'bank')
{
$profit=(float) $bdata['bPROFIT'];
mysql_query("UPDATE businesses SET bBANKMONEY=bBANKMONEY-$profit,bPROFIT='0' WHERE bID='{$ir['business']}'",$c);
event_add($ir['userid'],"You emptied the Businesses Profit to the Banks Cash.",$c);
}
else
{
$profit=number_format($bdata['bPROFIT']);
print "Your business has \$$profit Cash.

[url='manage-business.php?change=prov&insert=bank']Add Profit to Business Cash Bank[/url]

[url='manage-business.php']>Back[/url]
";
}
}
function members_list()
{
global $ir,$c,$userid,$bdata;
print "
<center>[b]<u>[url='manage-business.php?change=add']<font color='red'>Check Applications</font>[/url]</u>[/b]</center>


<center><table border=1 width=75%><tr background='header.jpg'><th>User</th><th>Level</th><th>Days In Business</th><th>Action</th></tr>";
$q=mysql_query("SELECT * FROM users WHERE business={$bdata['bID']}",$c);
while($r=mysql_fetch_array($q))
{
print "<tr><td>[url='viewuser.php?u={$r[']{$r['username']}[/url]</td><td>{$r['level']}</td>
<td>{$ir['dib']}</td><td>";
if($bdata['bOWNER'] == $userid || $userid==1)
{
print "[url='manage-business.php?action=kick&ID={$r[']Kick[/url]";
}
else
{
print " ";
}
print "</td></tr>";
}
print "</table></center>

[url='manage-business.php']> Back to your business home[/url]";
}
function member_apps()
{
global $ir,$c,$userid,$bdata,$h;
$_GET['bapp'] = abs((int) $_GET['bapp']);
if($_GET['bapp'])
{
$aq=mysql_query("SELECT b.*,u.* FROM bapps b LEFT JOIN users u ON b.bappFROM=u.userid WHERE b.bappID={$_GET['bapp']} AND b.bappBUSINESS={$bdata['bID']}",$c);
if (mysql_num_rows($aq))
{
$bappdata=mysql_fetch_array($aq);
if($_GET['what'] == 'decline')
{
mysql_query("DELETE FROM bapps WHERE bappID={$_GET['bapp']}",$c);
event_add($bappdata['bappFROM'],"Your application to join the {$bdata['bNAME']} Business was declined",$c,'business');
mysql_query("INSERT INTO busevents VALUES ('',{$bdata['bID']},unix_timestamp(),\"[url='viewuser.php?u=$userid']{$ir['username']}[/url] has declined [url='viewuser.php?u={$bappdata[']{$bappdata['username']}[/url]'s application to join the Business.\");",$c);
print "You have declined the application by {$bappdata['username']}.

[url='manage-business.php?action=apps']> Back[/url]";
}
else if ($bappdata['business'] != 0)
{
print "That person is already in a Business.";
$h->endpage();
exit;
}
mysql_query("DELETE FROM bapps WHERE bappID={$_GET['bapp']}",$c);
event_add($bappdata['bappFROM'],"Your application to join the {$bdata['bNAME']} Business was accepted, Congrats!",$c,'business');
mysql_query("INSERT INTO busevents VALUES ('',{$bdata['bID']},unix_timestamp(),\"[url='viewuser.php?u=$userid']{$ir['username']}[/url] has accepted [url='viewuser.php?u={$bappdata[']{$bappdata['username']}[/url]'s application to join the Business.\");",$c);
mysql_query("UPDATE users SET business={$bdata['bID']},dib=0 WHERE userid={$bappdata['userid']}",$c);
print "You have accepted the application by {$bappdata['username']}.

[url='manage-business.php?action=apps']> Back[/url]";
}
}
print "[b]Applications[/b]

<table width=85% border=2><tr background='header.jpg'><th>User</th><th>Level</th><th>Money</th><th>Reason</th>
<th>Action</th></tr>";
$q=mysql_query("SELECT b.*,u.* FROM bapps b LEFT JOIN users u ON b.bappFROM=u.userid WHERE b.bappBUSINESS={$bdata['bID']}",$c);
while($r=mysql_fetch_array($q))
{
print "<tr><td>[url='viewuser.php?u={$r[']{$r['username']} [{$r['userid']}][/url]</td><td>{$r['level']}</td><td>\${$r['money']}</td>
<td>{$r['bappTEXT']}</td><td><a href='bapplications.php?action=apps&app={$r['bappID']}&what=accept'>
Accept</a> | <a href='bapplications.php?action=apps&app={$r['bappID']}&what=decline'>
Decline</a></td></tr>";
}
print "</table>";
}
function delete()
{
global $ir,$c,$userid,$h,$bdata;
if($_POST['yesorno']== 'yes')
{
mysql_query("UPDATE users SET business=0 WHERE business={$bdata['bID']}",$c);
mysql_query("DELETE FROM businesses WHERE bID={$bdata['bID']}",$c);
print "Business deleted.

[url='index.php']Home[/url]
";
exit;
}
else
{
print "Are you 100% sure you want to delete this business

<form action='manage-business.php?change=delete' method='post'>
<input type='submit' name='yesorno' value='Yes'>


</form>
<form action='index.php' method='link'><input type='submit' value='No'></form>";
}
}
$h->endpage();
?>
Link to comment
Share on other sites

Re: Manage-Business

Try this:

 

<?php
include "globals.php";
$bq=$db->query("SELECT * FROM businesses WHERE bID={$ir['business']}",$c);
$bdata=$db->fetch_row($bq);
if($ir['business']== 0)
{
die("You are not in a business.");
}
if($bdata['bOWNER'] != $userid)
{
die("You dont own this business!");
}
switch($_GET['change'])
{
case "name":
name();
break;

case "bank":
bank();
break;

case "msgs":
msgs();
break;

case "pday":
pday();
break;

case "mmail":
mmail();
break;

case "logo":
logo();
break;

case "flm":
flm();
break;

case "elm":
elm();
break;

case "prov":
prov();
break;

case "apps":
member_apps();
break;

case "kick":
kick();
break;

case "members":
members_list();
break;

case "delete":
delete();
break;

default:
index();
break;
}
function index()
{
global $ir,$c,$userid,$h,$bdata;
print "<center><font color='green'><h2>[b]Welcome to your managers panel for {$bdata['bNAME']}.[/b]</h2></font></center>

<center><table width=75% border=1><tr background='header.jpg'><th>Part of business</th><th>Manage?</th></tr>
<tr><td>Name</td><td>[url='manage-business.php?change=name']Change[/url]</td></tr>
<tr><td>Applications</td><td>[url='manage-business.php?change=apps']Change[/url]</td></tr>
<tr><td>Members</td><td>[url='manage-business.php?change=members']Change[/url]</td></tr>
<tr><td>Bank</td><td>[url='manage-business.php?change=bank']Manage[/url]</td></tr>
<tr><td>Messages</td><td>[url='manage-business.php?change=msgs']Change[/url]</td></tr>
<tr><td>Payment Day</td><td>[url='manage-business.php?change=pday']Change[/url]</td></tr>
<tr><td>Mass Mail</td><td>[url='manage-business.php?change=mmail']Do[/url]</td></tr>
<tr><td>Logo</td><td>[url='manage-business.php?change=logo']Change[/url]</td></tr>
<tr><td>Friends</td><td>[url='manage-business.php?change=flm']Manage[/url]</td></tr>
<tr><td>Enemies</td><td>[url='manage-business.php?change=elm']Manage[/url]</td></tr>
<tr><td>Profit</td><td>[url='manage-business.php?change=prov']View[/url]</td></tr>
<tr><td>Delete Business</td><td>[url='manage-business.php?change=delete']Delete[/url]</td></tr>
</table></center>";
}
function name()
{
global $ir,$c,$userid,$h,$bdata;
if($_POST['newname'])
{
$db->query("UPDATE businesses SET bNAME='{$_POST['newname']}',bDESCRIPTION='{$_POST['description']}' WHERE bID={$bdata['bID']}",$c);
print "Name and Description Changed
[url='manage-business.php']>Back[/url]
";
exit;
}
else
{
print "[b]Enter your new business name / description[/b]

<form action='manage-business.php?change=name' method='post'>
Name: <input type='text' name='newname'>

Description : <textarea name='description' cols=30 rows=8>{$bdata['bDESCRIPTION']}</textarea>

<input type='submit' value='Change'></form>";
}
}
function bank()
{
global $ir,$c,$userid,$h,$bdata;
if($_POST['user'])
{
$ck=$db->query("SELECT * FROM users WHERE business={$ir['business']} AND userid={$_POST['user']}",$c);
if($db->num_rows($ck)== 0)
{
print "ERROR!
Either this user does not exist or they are not in your business.";
exit;
}
$user=(int) $_POST['user'];
$cash=(int) $_POST['cash'];
$crys=(int) $_POST['crystals'];
$db->query("UPDATE users SET money=money+$cash, crystals=crystals+$crys WHERE userid=$user",$c);
$db->query("UPDATE businesses SET bBANKMONEY=bBANKMONEY-$cash, bBANKCRYSTALS=bBANKCRYSTALS-$crys WHERE bID={$bdata['bID']}",$c);
print "\$$cash and $crys Crystals Given to User : $user.
[url='manage-business.php']>Back[/url]
";
}
else
{
print "<center>Your Business bank currently has...

[b]\${$bdata['bBANKMONEY']}[/b] Cash,

[b]{$bdata['bBANKCRYSTALS']}[/b] Crystals.

<hr />
<form action='manage-business.php?change=bank' method='post'>
[b]Give Cash/Crystals to Userid :[/b] <input type='text' name='user' value='$userid'>

<table width=75% border=0>
<tr><td height=10 width=50% align=center valign=top background='header.jpg'>
Bank Money:
<input type='text' name='cash' value='{$bdata['bBANKMONEY']}'>
</td><td height=10 width=50% align=center valign=top background='header.jpg'>
Bank Crystals: <input type='text' name='crystals' value='{$bdata['bBANKCRYSTALS']}'>
</td></tr></table>
</form>


</center>
";
}
}
function msgs()
{
global $ir,$c,$userid,$h,$bdata;
if($_POST['newmsg'])
{
$db->query("UPDATE businesses SET bMESSAGES='{$_POST['newmsg']}' WHERE bID='{$bdata['bID']}'",$c);
}
else
{
print "Here You May Change Your Business Message.

<form action='manage-business.php?change=msgs' method='post'>
Message :<textarea name='newmsg' cols=30 rows=8>{$bdata['bMESSAGES']}</textarea>

<input type='submit' value='Change!'>

</form>";
}
}
function pday()
{
global $ir,$c,$userid,$h,$bdata;
if($_POST['submq'])
{
if($_POST['monday']== 'Yes')
{
$monday="<font color=green>[b]Yes[/b]</font>";
}
else
{
$monday="<font color=red>[b]No[/b]</font>";
}
if($_POST['tuesday']== 'Yes')
{
$tuesday="<font color=green>[b]Yes[/b]</font>";
}
else
{
$tuesday="<font color=red>[b]No[/b]</font>";
}
if($_POST['wednesday']== 'Yes')
{
$wednesday="<font color=green>[b]Yes[/b]</font>";
}
else
{
$wednesday="<font color=red>[b]No[/b]</font>";
}
if($_POST['thursday']== 'Yes')
{
$thursday="<font color=green>[b]Yes[/b]</font>";
}
else
{
$thursday="<font color=red>[b]No[/b]</font>";
}
if($_POST['friday']== 'Yes')
{
$friday="<font color=green>[b]Yes[/b]</font>";
}
else
{
$friday="<font color=red>[b]No[/b]</font>";
}
if($_POST['saturday']== 'Yes')
{
$saturday="<font color=green>[b]Yes[/b]</font>";
}
else
{
$saturday="<font color=red>[b]No[/b]</font>";
}
if($_POST['sunday']== 'Yes')
{
$sunday="<font color=green>[b]Yes[/b]</font>";
}
else
{
$sunday="<font color=red>[b]No[/b]</font>";
}
$totaltext="[b]Days of Payments[/b]

Monday : $monday 

Tuesday : $tuesday 

Wednesday : $wednesday 

Thursday : $thursday 

Friday : $friday 

Saturday : $saturday 

Sunday : $sunday 
";
$db->query("UPDATE businesses SET bPDAY='$totaltext' WHERE bID='{$bdata['bID']}'",$c);
print "Days Of Payments is now as follows

<hr />
[b]Days of Payments[/b]

Monday : $monday 

Tuesday : $tuesday 

Wednesday : $wednesday 

Thursday : $thursday 

Friday : $friday 

Saturday : $saturday 

Sunday : $sunday 

<hr />";
}
else
{
print "Please tick the days which you want your Payments to be.

<form action='manage-business.php?change=pday' method='post'>
<input type='hidden' name='submq' value='abc123'>
Monday :<input type='checkbox' name='monday' value='Yes'>

Tuesday :<input type='checkbox' name='tuesday' value='Yes'>

Wednesday :<input type='checkbox' name='wednesday' value='Yes'>

Thursday :<input type='checkbox' name='thursday' value='Yes'>

Friday :<input type='checkbox' name='friday' value='Yes'>

Saturday :<input type='checkbox' name='saturday' value='Yes'>

Sunday :<input type='checkbox' name='sunday' value='Yes'>

<input type='submit' value='Change'>

</form>
";
}
}
function mmail()
{
global $ir,$c,$userid,$h,$bdata;
if($_POST['message'])
{
$subj="This is a Mass Mail from Your Business...";
$mmq=$db->query("SELECT * FROM users WHERE business='{$ir['business']}'",$c);
while($o=$db->fetch_row($mmq))
{
$db->query("INSERT INTO mail VALUES('', 0, {$ir['userid']}, {$o['userid']}, unix_timestamp(),'$subj','{$_POST['message']}')",$c);
print "Mass mail sent to {$o['username']}.
";
}
print "Mass Mail Sent!";
}
else
{
$tmq=$db->query("SELECT * FROM businesses WHERE bID='{$ir['business']}'",$c);
$tm=$db->num_rows($tmq);
print "[b]Here you may send a mass mail to your Business.[/b]

You have a total of [b]$tm[/b] Members in this Business.

<form action='manage-business.php?change=mmail' method='post'>
Message :<textarea name='message' cols='30' rows='8'>Dear Members Of The Business,
</textarea>

<input type='submit' value='Submit'>

</form>";
}
}
function logo()
{
global $ir,$c,$userid,$h,$bdata;
if($_POST['newlogo'])
{
$db->query("UPDATE businesses SET bLOGO='{$_POST['newlogo']}' WHERE bID='{$ir['business']}'",$c);
print "Logo Successfully Changed!

";
}
else
{
print "Please Paste Your Picture URL for Your New Business Logo

<form action='manage-business.php?change=logo' method='post'>
New Logo: <input type='text' name='newlogo' value='{$bdata['bLOGO']}'>

<input type='submit' value='Change Pic'>

</form>";
}
}
function flm()
{
global $ir,$c,$userid,$h,$bdata;
if($_POST['business'])
{
if($_POST['business'] == $bdata['bID'])
{
print "You cannot add your own business...Haha!";
exit;
}
$cq=$db->query("SELECT * FROM bf WHERE bfFROM={$ir['business']} AND bfTO={$_POST['business']}",$c);
if($db->num_rows($cq))
{
print "You have already added this business.";
exit;
}
$db->query("INSERT INTO bf VALUES ('{$ir['business']}','{$_POST['business']}')",$c);
$db->query("UPDATE businesses SET bPOPULATION=bPOPULATION+50 WHERE bID={$_POST['business']}",$c);
print "You have added a business as your friend..
";
}
else
{
$sb=$db->query("SELECT * FROM businesses",$c);
$rem=$db->query("SELECT * FROM bf WHERE bfFROM={$ir['business']}",$c);
print "Remove an friend

<form action='friendremove.php' method='post>
Friend (By Business ID) :<select name='fri'>";
while($fo=$db->fetch_row($rem))
{
print "<option value='{$fo['bfTO']}'>{$fo['bfTO']}</option>";
}
print "</select>
<input type='submit' value='Remove!'>
</form>

";
print "Add a friend:

<form action='manage-business.php?change=flm' method='post'>
Business : <select name='business'>";
while($b=$db->fetch_row($sb))
{
print "<option value='{$b['bID']}'>{$b['bNAME']}</option>";
}
print "</select>

<input type='submit' value='Add'></form>
";
}
}
function elm()
{
global $ir,$c,$userid,$h,$bdata;
if($_POST['business'])
{
if($_POST['business'] == $bdata['bID'])
{
print "You cannot add your own business as a Enemy!!";
exit;
}
$cq=$db->query("SELECT * FROM be WHERE beFROM={$ir['business']} AND beTO={$_POST['business']}",$c);
if($db->num_rows($cq))
{
print "You have already added this business as a enemy.";
exit;
}
$db->query("INSERT INTO be VALUES ('{$ir['business']}','{$_POST['business']}')",$c);
$db->query("UPDATE businesses SET bPOPULATION=bPOPULATION-50 WHERE bID={$_POST['business']}",$c);
print "You have added a business as your enemy..
";
}
else
{
$sb=$db->query("SELECT * FROM businesses",$c);
$rem=$db->query("SELECT * FROM be WHERE beFROM={$ir['business']}",$c);
print "Remove an enemy

<form action='enemyremove.php' method='post>
Enemy (By Business ID) :<select name='eny'>";
while($mo=$db->fetch_row($rem))
{
print "<option value='{$mo['beTO']}'>{$mo['beTO']}</option>";
}
print "</select>
<input type='submit' value='Remove!'>
</form>

";
print "Add a enemy:

<form action='manage-business.php?change=elm' method='post'>
Business : <select name='business'>";
while($b=$db->fetch_row($sb))
{
print "<option value='{$b['bID']}'>{$b['bNAME']}</option>";
}
print "</select>

<input type='submit' value='Add'></form>
";
}
}
function prov()
{
global $ir,$c,$userid,$h,$bdata;
if($_GET['insert']== 'bank')
{
$profit=(float) $bdata['bPROFIT'];
$db->query("UPDATE businesses SET bBANKMONEY=bBANKMONEY-$profit,bPROFIT='0' WHERE bID='{$ir['business']}'",$c);
event_add($ir['userid'],"You emptied the Businesses Profit to the Banks Cash.",$c);
}
else
{
$profit=number_format($bdata['bPROFIT']);
print "Your business has \$$profit Cash.

[url='manage-business.php?change=prov&insert=bank']Add Profit to Business Cash Bank[/url]

[url='manage-business.php']>Back[/url]
";
}
}
function members_list()
{
global $ir,$c,$userid,$bdata;
print "
<center>[b]<u>[url='manage-business.php?change=add']<font color='red'>Check Applications</font>[/url]</u>[/b]</center>


<center><table border=1 width=75%><tr background='header.jpg'><th>User</th><th>Level</th><th>Days In Business</th><th>Action</th></tr>";
$q=$db->query("SELECT * FROM users WHERE business={$bdata['bID']}",$c);
while($r=$db->fetch_row($q))
{
print "<tr><td>[url='viewuser.php?u={$r[']{$r['username']}[/url]</td><td>{$r['level']}</td>
<td>{$ir['dib']}</td><td>";
if($bdata['bOWNER'] == $userid || $userid==1)
{
print "[url='manage-business.php?action=kick&ID={$r[']Kick[/url]";
}
else
{
print " ";
}
print "</td></tr>";
}
print "</table></center>

[url='manage-business.php']> Back to your business home[/url]";
}
function member_apps()
{
global $ir,$c,$userid,$bdata,$h;
$_GET['bapp'] = abs((int) $_GET['bapp']);
if($_GET['bapp'])
{
$aq=$db->query("SELECT b.*,u.* FROM bapps b LEFT JOIN users u ON b.bappFROM=u.userid WHERE b.bappID={$_GET['bapp']} AND b.bappBUSINESS={$bdata['bID']}",$c);
if ($db->num_rows($aq))
{
$bappdata=$db->fetch_row($aq);
if($_GET['what'] == 'decline')
{
$db->query("DELETE FROM bapps WHERE bappID={$_GET['bapp']}",$c);
event_add($bappdata['bappFROM'],"Your application to join the {$bdata['bNAME']} Business was declined",$c,'business');
$db->query("INSERT INTO busevents VALUES ('',{$bdata['bID']},unix_timestamp(),\"[url='viewuser.php?u=$userid']{$ir['username']}[/url] has declined [url='viewuser.php?u={$bappdata[']{$bappdata['username']}[/url]'s application to join the Business.\");",$c);
print "You have declined the application by {$bappdata['username']}.

[url='manage-business.php?action=apps']> Back[/url]";
}
else if ($bappdata['business'] != 0)
{
print "That person is already in a Business.";
$h->endpage();
exit;
}
$db->query("DELETE FROM bapps WHERE bappID={$_GET['bapp']}",$c);
event_add($bappdata['bappFROM'],"Your application to join the {$bdata['bNAME']} Business was accepted, Congrats!",$c,'business');
$db->query("INSERT INTO busevents VALUES ('',{$bdata['bID']},unix_timestamp(),\"[url='viewuser.php?u=$userid']{$ir['username']}[/url] has accepted [url='viewuser.php?u={$bappdata[']{$bappdata['username']}[/url]'s application to join the Business.\");",$c);
$db->query("UPDATE users SET business={$bdata['bID']},dib=0 WHERE userid={$bappdata['userid']}",$c);
print "You have accepted the application by {$bappdata['username']}.

[url='manage-business.php?action=apps']> Back[/url]";
}
}
print "[b]Applications[/b]

<table width=85% border=2><tr background='header.jpg'><th>User</th><th>Level</th><th>Money</th><th>Reason</th>
<th>Action</th></tr>";
$q=$db->query("SELECT b.*,u.* FROM bapps b LEFT JOIN users u ON b.bappFROM=u.userid WHERE b.bappBUSINESS={$bdata['bID']}",$c);
while($r=$db->fetch_row($q))
{
print "<tr><td>[url='viewuser.php?u={$r[']{$r['username']} [{$r['userid']}][/url]</td><td>{$r['level']}</td><td>\${$r['money']}</td>
<td>{$r['bappTEXT']}</td><td><a href='bapplications.php?action=apps&app={$r['bappID']}&what=accept'>
Accept</a> | <a href='bapplications.php?action=apps&app={$r['bappID']}&what=decline'>
Decline</a></td></tr>";
}
print "</table>";
}
function delete()
{
global $ir,$c,$userid,$h,$bdata;
if($_POST['yesorno']== 'yes')
{
$db->query("UPDATE users SET business=0 WHERE business={$bdata['bID']}",$c);
$db->query("DELETE FROM businesses WHERE bID={$bdata['bID']}",$c);
print "Business deleted.

[url='index.php']Home[/url]
";
exit;
}
else
{
print "Are you 100% sure you want to delete this business

<form action='manage-business.php?change=delete' method='post'>
<input type='submit' name='yesorno' value='Yes'>


</form>
<form action='index.php' method='link'><input type='submit' value='No'></form>";
}
}
$h->endpage();
?>
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...