forked from simmoo/Mafia-Game-Script
/
compspecials.php
57 lines (54 loc) · 1.5 KB
/
compspecials.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
include_once (DIRNAME(__FILE__) . '/globals.php');
$_POST['ID'] = abs(@intval($_POST['ID']));
if(!$_POST['ID'])
{
echo "Invalid use of file";
exit;
}
else
{
$com = $db->query("SELECT bmembBusiness FROM businesses_members WHERE bmembMember='{$ir['userid']}'");
$cc=$db->fetch_row($com);
$clas = $db->query("SELECT * FROM businesses WHERE busId='{$cc['bmembBusiness']}'");
$cs=$db->fetch_row($clas);
$clas = $db->query("SELECT * FROM businesses WHERE busDirector='1'");
$cs=$db->fetch_row($clas);
$q=$db->query("SELECT * FROM compspecials WHERE csID={$_POST['ID']}");
if($db->num_rows($q) == 0)
{
print "There is no Company Special with this ID!";
}
else
{
$r=$db->fetch_row($q);
if($ir['comppoints'] < $r['csCOST'])
{
print "You don't have enough company points to get this reward!";
$h->endpage();
exit;
}
if($r['csJOB'] != $cs['busClass'])
{
print "You are not in this type of Company!";
$h->endpage();
exit;
}
if($r['csITEM'])
{
item_add($userid, $r['csITEM'], '1');
}
$money=($r['csMONEY']);
$crys=($r['csCRYSTALS']);
$cost=($r['csCOST']);
$endu=($r['csENDU']);
$iq=($r['csIQ']);
$lab=($r['csLABOUR']);
$str=($r['csSTR']);
$db->query(sprintf("UPDATE users SET money=money+%u, crystals=crystals+%u, comppoints=comppoints-%u WHERE userid=%u",$money, $crys, $cost, $userid));
$db->query(sprintf("UPDATE userstats SET strength=strength+%u,IQ=IQ+%u,labour=labour+%u WHERE userid=%u", $str, $iq, $lab, $userid));
print "You successfully redeemed the {$r['csNAME']} Special for {$r['csCOST']} Company Points.";
}
}
$h->endpage();
?>