Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- == User Agreement ==
- By installing the gang modification i have confirmed to leave all copyright notices and to not claim it as my own work,
- I also agree, if i go against my agreement, i (the installer) am held responsible and will accept any punishment sniko (the creator) gives.
- == End Agreement ==
- //
- // Part of the recoded/revamped Gang modification
- // Coded by Sniko
- // April 21, 2010
- // File: Create/View gangs
- // Keep ALL comments, Thanks
- // Cypherwerks Production (c) 2010
- //
- */
- // Edit all aspects in zFamily_funcs.php file, Thanks.
- include_once('globals.php');
- echo "<h3>$ModName's</h3>
- <br />";
- if(!$_GET)
- {
- return index();
- }
- switch(@$_GET['p'])
- {
- case 'myFam' : myFam(); break; //Done
- case 'vault' : vault(); break; //Done
- case 'dLogs' : donationLogs(); break; //Done
- case 'aLogs' : aLogs(); break; //Done
- case 'members' : memberList(); break; //Done
- case 'events' : events(); break; //Done
- case 'leave' : leave(); break; //Done
- case 'warStats' : warStats(); break; //Done
- case 'viewHitList' : viewHitList(); break; //Done
- //Armory Stuff now
- case 'armoryIndex' : armoryIndex(); break; //Done
- case 'armoryAdd' : armoryAdd(); break; //Done
- case 'armoryRent' : armoryRent(); break; //Done
- case 'armoryTakeback' : armoryTakeback(); break; //Done
- //Link to the (vice) president Panel
- case 'vpPanel' : vpPanel(); break; //Done
- //(Vice) President Links
- case 'applications' : apps(); break; //Done
- case 'itemLent' : itemLent(); break; //Done
- case 'resign' : resign(); break; //Doing
- // President Links
- case 'CashPayment' : cashPay(); break; //Done
- case 'CrystalPayment' : cryPay(); break; //Done
- case 'changeTag' : changeTag(); break; //Done
- case 'changeImage' : changeIMG(); break; //Done
- case 'changeName' : changeName(); break; //Done
- case 'changeVice' : changeVice(); break; //Done
- case 'changePres' : changePres(); break; //Done
- case 'changeDesc' : changeDesc(); break; //Done
- case 'deleteFam' : deleteFam(); break; //Done
- case 'upgradeSpots' : upgradeSpots(); break; //Done
- case 'mailAll' : mailAll(); break; //Done
- case 'startWar' : startWar(); break; //Done
- case 'hitListCrew' : hitListCrew(); break; //Done
- case 'surrender' : surrender(); break; //Done
- //Outside family cases/functions
- case 'apply' : applyFam(); break; //Done
- case 'viewFamily' : viewFam(); break; //Done
- case 'create' : createFam(); break; //Done
- case 'viewMembs' : viewMembs(); break; //Done
- default: index(); break; //Done
- }
- function index()
- {
- global $db, $userid, $ir, $ModName;
- $title = "$ModName Board";
- $forWhile = $db->query("SELECT * FROM `family_mod` ORDER BY `ID`,`KILLS` DESC");
- if($ir['gang'] == 0)
- {
- inGang($userid, "[<a href='?p=create'>Create a $ModName</a>]", 2, "hide");
- }
- $linkToMyFamily = ($ir['gang'] > 0) ? "[<a href='?p=myFam'>My $ModName</a>]" : "";
- echo "<strong>$linkToMyFamily</strong><br /><br />
- <table class='table' width='85%' style='text-align:center;'>
- <th colspan='3'>Welcome to the $title</th><tr>
- <th width='25%'>$ModName Name/Desc</th>
- <th width='45%'>$ModName Picture</th>
- <th width='10%'>$ModName President/Vice President</th>
- <tr style='background-color:#FFF;'></tr>
- ";
- while($r = $db->fetch_row($forWhile))
- {
- $pres = $db->fetch_row($db->query("SELECT u.`username`,u.`userid`,f.`PRES`,f.`ID` FROM `users` u LEFT JOIN `family_mod` f ON u.`gang`=f.`ID` WHERE `userid`={$r['PRES']}"));
- $vpres = $db->fetch_row($db->query("SELECT u.`username`,u.`userid`,f.`vPRES`,f.`ID` FROM `users` u LEFT JOIN `family_mod` f ON u.`gang`=f.`ID` WHERE `userid`={$r['vPRES']}"));
- echo "<td><a href='?p=viewFamily&id={$r['ID']}'><sub>[{$r['TAG']}]</sub> <strong>{$r['NAME']}<strong><br />
- <sub>".substr($r['DESC'], 0, 25)."...</sub></a></td>
- <td><a href='?p=viewFamily&id={$r['ID']}'><img src='{$r['IMAGE']}' width='250px' height='50px'></a></td>
- <td><a href='viewuser.php?u={$pres['userid']}'>{$pres['username']}</a><br />
- <a href='viewuser.php?u={$vpres['userid']}'>{$vpres['username']}</a></td>
- <tr style='background-color:#FFF;'></tr>";
- }
- //if no family's have been created
- if(!$db->num_rows($forWhile))
- {
- echo "<td colspan='3'>No $ModName have been created!</td>
- </table>";
- }
- //end no family's
- }
- function createFam()
- {
- global $userid, $db, $ir, $NameChange, $ModName, $cost;
- //if they press Create (in form)
- if(isset($_POST['fName']))
- {
- $name = trim(strip_tags(htmlspecialchars(strtolower($db->escape($_POST['fName'])))));
- $desc = strip_tags(htmlspecialchars(strtolower(nl2br($db->escape($_POST['fDesc'])))));
- $tag = trim(strip_tags($_POST['fTag']));
- $pic = strip_tags(htmlspecialchars($_POST['fImage']));
- if(empty($pic))
- {
- $pic = "bla.png";
- }
- if($ir['money'] < $cost)
- {
- die("cannot create a $ModName, as you don't have enough!");
- }
- if(!empty($pic) && PNG($pic) || $pic == "")
- {
- die("This is not an image, please use an image with a PNG extenstion");
- }
- //filter the badies :p
- $bad_words = array('meta', 'refresh', 'REFRESH', 'www'); //feel free to add more
- foreach($bad_words as $f)
- {
- $name = str_replace($f, '', $name);
- $desc = str_replace($f, '', $desc);
- }
- //end filtering
- echo "<table style='background: #6EFF70' width='100%'><th>You have created a $ModName.<br />
- <strong>$ModName Name:</strong> ".stripslashes($name)."</th></table>";
- $db->query("INSERT INTO `family_mod` (`NAME`, `PRES`, `vPRES`, `DESC`, `TAG`, `IMAGE`) VALUES
- ('$name', $userid, $userid, '$desc', '$tag', '$pic')");
- $db->query("INSERT INTO `family_mail` (`LastSentMail`) VALUES (0)");
- $f = $db->fetch_row($db->query("SELECT COUNT(`ID`) as `id` FROM `family_mod`"));
- $newFamily = $f['id'];
- $db->query("UPDATE `users` SET `gang`={$newFamily},`money`=`money`-$cost WHERE `userid`=$userid");
- add_famEvent("The {$ModName} was created!", $newFamily);
- }
- else
- {
- if($ir['gang'])
- {
- inGang($userid, "Create a $ModName because you are already in one!", 0, "hide");
- }
- if(!$ir['gang'])
- {
- echo "<form action='#' method='post'>
- $ModName Name: <input type='text' name='fName' length='5' maxlength='10' />
- <br />
- $ModName Description: <input type='text' name='fDesc' length='10' maxlength='250' />
- <br />
- $ModName Tag: <input type='text' name='fTag' length='5' maxlength='3' />
- <br />
- $ModName Image: <input type='text' name='fImage' length='5' maxlength='1000' />
- <br />
- <input type='submit' value='Create!'>
- </form>";
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=index'>Back</a>]";
- }
- function viewFam()
- {
- global $maxFam, $db, $ir, $ModName;
- //secure the id
- $_GET['id'] == abs(intval($_GET['id']));
- if(!$_GET['id'] || $_GET['id'] > $maxFam)
- {
- echo "No $ModName was selected!";
- }
- else
- {
- $pres = $db->fetch_row($db->query("SELECT u.`username`,u.`userid`,f.`PRES`,f.`ID` FROM `users` u LEFT JOIN `family_mod` f ON u.`gang`=f.`ID` WHERE `userid`=f.`PRES` && `ID`={$_GET['id']}"));
- $vpres = $db->fetch_row($db->query("SELECT u.`username`,u.`userid`,f.`vPRES`,f.`ID` FROM `users` u LEFT JOIN `family_mod` f ON u.`gang`=f.`ID` WHERE `userid`=f.`vPRES` && `ID`={$_GET['id']}"));
- $r = $db->fetch_row($db->query("SELECT * FROM `family_mod` WHERE `ID`={$_GET['id']} LIMIT 1"));
- echo "<table class='table' width='90%' background='#fff'>";
- $apply = ($ir['gang'] == 0) ? "<p style='color: #090; line-height: 1.2'><strong><a href='?p=apply&fam={$_GET['id']}'>Apply</a></strong></p>" : "<s><a title='You are already in a gang!'>Apply</a></s>";
- echo " <th colspan='2'>$apply <p=style='color: #663300; line-height: 1.2'><strong><a href='?p=viewMembs&fam={$_GET['id']}'>View Members</a></strong></p></th>
- <tr><tr>
- <th colspan='2'><img src='{$r['IMAGE']}' width='250px' height='50px' alt='$ModName\'s Image'></th>
- <tr><tr>
- <th><strong>$ModName Name</strong></th>
- <th><strong>Kills</th>
- <tr>
- <td style='border-type: double; text-align: center;'>".stripslashes($r['NAME'])."</td>
- <td style='border-type: double; text-align: center;'>".number_format($r['KILLS'])." war kills</td> <tr><tr>
- <th colspan='2'><strong>$ModName Description</strong></th>
- <tr>
- <td style='border-type: double; text-align: center;' colspan='2'>".stripslashes(nl2br($r['DESC']))."</td>";
- }
- echo "<hr width='45%'>
- [<a href='?p=index'>Back</a>]";
- }
- function viewMembs()
- {
- global $userid, $db, $maxFam, $ir, $ModName;
- //secure the id
- @$_GET['fam'] == abs((int) @$_GET['fam']);
- if(!$_GET)
- {
- echo "No $ModName was selected!<br />
- [<a href='?p=index'>Back</a>]";
- }
- if(!@$_GET['fam'] || $_GET['fam'] > $maxFam)
- {
- echo "No $ModName was selected!<br />
- [<a href='?p=index'>Back</a>]";
- exit();
- }
- $select = $db->query("SELECT `username`,`userid`,`level` FROM `users` WHERE `gang`={$_GET['fam']}");
- $f = $db->fetch_row($db->query("SELECT `NAME` FROM `family_mod` WHERE `ID`={$_GET['fam']}"));
- echo "<h3>{$f['NAME']}'s Members</h3>
- <table class='table' width='80%'>
- <th width='50%'>Username</th>
- <th width='30%'>Level</th>
- <tr>";
- while($r = $db->fetch_row($select))
- {
- echo "<td><center><a href='viewuser.php?u={$r['userid']}'>{$r['username']}</a></center></td>
- <td><center>{$r['level']}</center></td><tr>";
- }
- }
- function applyFam()
- {
- global $userid, $db, $maxFam, $ir, $ModName;
- //secure the id
- @$_GET['fam'] == abs((int) @$_GET['fam']);
- if($ir['gang'] >= 1)
- {
- inGang($userid, "You are already in a $ModName!", 4, "hide");
- exit();
- }
- if(!$_GET)
- {
- echo "No $ModName was selected!<br />
- [<a href='?p=index'>Back</a>]";
- }
- if(!@$_GET['fam'] || $_GET['fam'] > $maxFam)
- {
- echo "No $ModName was selected!<br />
- [<a href='?p=index'>Back</a>]";
- exit();
- }
- $timeStamp = time();
- //if they press submit
- if(isset($_POST['cV']) || isset($_POST['submit']))
- {
- if(strlen($_POST['cV']) < 10)
- {
- echo "Please enter something for your CV! (more than 10 characters in length)";
- }
- else
- $cV = strip_tags(htmlspecialchars($db->escape($_POST['cV'])));
- {
- echo "<table class='table' width='90%' background='#fff'>
- <th><strong>Apply Form</strong></th>
- <tr>
- <td style='border-type: double; text-align: center;'>Thank you for your appliance!</td></table>";
- $db->query("INSERT INTO `family_mod_apply` (`userid`,`time`,`gangID`,`applyNote`) VALUES ($userid, $timeStamp, {$_GET['fam']}, '$cV')");
- add_famEvent("{$ir['username']} has applied for the {$ModName}", $_GET['fam']);
- }
- }
- else
- {
- $r = $db->fetch_row($db->query("SELECT `NAME`,`ID` FROM `family_mod` WHERE `ID`={$_GET['fam']}"));
- $time = date("G:i (a)", $timeStamp);
- echo "You are applying for the family with the name of: ".ucwords(stripslashes($r['NAME']))."<br />
- <table class='table' width='90%' background='#fff'>
- <th colspan='2'><strong>Apply Form</strong></th>
- <tr>
- <td style='border-type: double; text-align: center;' colspan='2'>
- <form action='#' method='post'>
- <textarea cols='20' rows='10' name='cV'>Put something for persuadance</textarea>
- <br />
- <input type='submit' name='submit' value='Apply on {$time}' />
- </form>
- </td>";
- }
- echo "<hr width='45%'>
- [<a href='?p=index'>Back</a>]";
- }
- /*
- // ====== START INSIDE THE FAMILY FUNCTIONS ====== \\
- */
- echo "<p>";
- function myFam()
- {
- global $cost, $startingPlaces, $ir, $db, $Pres_icon, $vPres_icon, $userid, $ModName;
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- //collect the data
- $r = $db->fetch_row($db->query("SELECT * FROM `family_mod` WHERE `ID`={$ir['gang']}"));
- $members = $db->fetch_row($db->query("SELECT COUNT(`gang`) AS `gang` FROM `users` WHERE `gang`={$ir['gang']}"));
- $president = $db->fetch_row($db->query("SELECT `username` FROM `users` WHERE `userid`={$r['PRES']}"));
- $vice_pres = $db->fetch_row($db->query("SELECT `username` FROM `users` WHERE `userid`={$r['vPRES']}"));
- $membs = ($members < $startingPlaces) ? "<font color='black'>{$members['gang']}</font>" : "<font color='green'>{$members['gang']}</font>";
- $vaultCASH = ($r['VAULT_MEM_VIEW'] == 'OFF') ? "<i>Hidden</i>" : number_format($r['VAULT_CASH']);
- $vaultCRYS = ($r['VAULT_MEM_VIEW'] == 'OFF') ? "<i>Hidden</i>" : number_format($r['VAULT_CRYS']);
- $KD = ($r['KILLS'] == 0 || $r['Deaths'] == 0 || $r['KILLS'] / $r['Deaths'] <= 0) ? 0 : sprintf("%01.2f", $r['KILLS'] / $r['Deaths']);
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th width='50%'>{$r['NAME']}</th>
- <th width='50%'>$Pres_icon <a href='viewuser.php?u={$r['PRES']}'>{$president['username']}</a>
- $vPres_icon <a href='viewuser.php?u={$r['vPRES']}'>{$vice_pres['username']}</a>
- </th>
- <tr>
- <td colspan='1'><strong>Members:</strong> $membs</td>
- <td colspan='1'><strong>Vault:</strong> \$$vaultCASH Ι $vaultCRYS crystals</td>
- <tr>
- <td colspan='2'><strong>Kills:</strong> ".number_format($r['KILLS'])." † <strong>Deaths:</strong> ".number_format($r['Deaths'])." † <strong>K/D Ratio:</strong> ".number_format($KD)."%</td>
- </td>
- </table><br /><br />
- <table class='table' width='75%' style='text-align: center;'>
- <th colspan='2'>Links</th>
- <tr>
- <td colspan='1'><a href='?p=vault'>Vault</a></td>
- <td colspan='1'><a href='?p=events'>Events</a></td>
- <tr>
- <td colspan='1'><a href='?p=viewHitList'>Hit list</a></td>
- <td colspan='1'><a href='?p=members'>Members</a></td>
- <tr>
- <td colspan='2'>Forums</td>
- <tr>
- <td colspan='1'><a href='?p=aLogs'>Attack Logs</a></td>
- <td colspan='1'><a href='?p=dLogs'>Donation Logs</a></td>
- <tr>
- <td colspan='1'><a href='?p=warStats'>War Stats</a></td>
- <td colspan='1'><a href='?p=armoryIndex'>Armory</a></td>
- <tr>
- <td style='background-color: #FFCCCC;' colspan='2'><a href='?p=leave'>Leave</a></td>
- </table><br /><br />";
- if($r['PRES'] == $userid || $r['vPRES'] == $userid)
- {
- $position = ($r['PRES'] == $userid) ? "President" : "Vice President";
- echo "<table class='table' width='75%' style='text-align: center;'>
- <td style='background-color: #86C67C;' colspan='2'><a href='?p=vpPanel'>$position Links</a></a></td>
- </table>";
- }
- }
- }
- function vault()
- {
- global $cost, $startingPlaces, $ir, $db, $userid, $ModName;
- echo "<h3>Donate to the $ModName!</h3>";
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- if(isset($_POST['amount']))
- {
- $_POST['cash'] = abs((int) $_POST['cash']);
- $_POST['crystals'] = abs((int) $_POST['crystals']);
- if(empty($_POST['cash']) && empty($_POST['crystals']))
- {
- echo "<table width='75%'>
- <td style='background-color: #FFCCCC;'>Please fill out the form!</a></td>
- </table>";
- unset($_POST['amount']);
- echo "<br />[<a href='?p=vault'>Back to vault</a>]";
- exit();
- }
- if($_POST['cash'] > $ir['money'] || $_POST['crystals'] > $ir['money'])
- {
- echo "<table width='75%'>
- <td style='background-color: #FFCCCC;'>You are putting in more than you actually have!</a></td>
- </table><br />
- [<a href='?p=vault'>Back to vault</a>]";
- exit();
- }
- else
- {
- echo "<table width='75%'>
- <td style='background-color: #BCED91;'><center>Thanks for your financial help!</center></a></td>
- </table>";
- $db->query("UPDATE `family_mod` SET `VAULT_CASH`=`VAULT_CASH`+{$_POST['cash']}, `VAULT_CRYS`=`VAULT_CRYS`+{$_POST['crystals']} WHERE `ID`={$ir['gang']}");
- $db->query("UPDATE `users` SET `money`=`money`-{$_POST['cash']},`crystals`=`crystals`-{$_POST['crystals']} WHERE `userid`=$userid");
- $time = time();
- $db->query("INSERT INTO `family_DonationLogs` (`USERID`,`CASH`,`CRYS`,`TIME`,`family`) VALUES($userid, {$_POST['cash']}, {$_POST['crystals']}, $time, {$ir['gang']})");
- add_famEvent("{$ir['username']} donated to the {$ModName}", $ir['gang']);
- }
- }
- else
- {
- echo "<i>This is a total charity event on behalf of you, everything you put into the vault is non-refundable
- and will be logged so maybe get something in return</i><br />
- <form action='#' method='post'>";
- $cash_strlen = mb_strlen($ir['money']);
- $crys_strlen = mb_strlen($ir['crystals']);
- echo "Cash: <input type='text' name='cash' length='5' maxlength='{$cash_strlen}' />
- <br />
- Crystals: <input type='text' name='crystals' length='5' maxlength='{$crys_strlen}' />
- <br />
- <input type='submit' name='amount' value='Put into vault'>
- </form>";
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function donationLogs()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $ModName;
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- $selectFromLog = $db->query("SELECT u.`gang`,u.`username`,u.`userid`, dl.* FROM `users` u LEFT JOIN `family_DonationLogs` dl ON u.`userid`=dl.`USERID` WHERE u.`gang`={$ir['gang']} && dl.`CASH` > 0 ORDER BY dl.`ID` DESC");
- if(!$db->num_rows($selectFromLog))
- {
- echo "<table width='75%'>
- <td style='background-color: #FFCCCC;'>No logs have been recorded</a></td>
- </table>";
- }
- else
- {
- echo "<table class='table' width='90%'>
- <th>Who</th>
- <th>Cash</th>
- <th>Crystals</th>
- <th>When</th>
- <tr>";
- while ($r = $db->fetch_row($selectFromLog))
- {
- $user = ($r['userid'] == $ir['userid']) ? "<p style='color: #090; line-height: 1.2'><strong>You</strong></p>" : "<strong>{$r['username']}</strong>";
- echo "<td><a href='viewuser.php?p={$r['USERID']}'>$user</a></td>
- <td>$".number_format($r['CASH'])."</td>
- <td>".number_format($r['CRYS'])." crystal(s)</td>
- <td>".date('l F (G:i (a))', $r['TIME'])."</td>
- <tr>";
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- }
- function memberList()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $ModName;
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- $selectMembers = $db->query("SELECT u.`username`,u.`userid`,u.`gang`,f.`ID`,f.`PRES`,f.`vPRES` FROM `users` u LEFT JOIN `family_mod` f ON u.gang=f.ID WHERE f.ID={$ir['gang']}");
- echo "<table class='table' width='30%'>
- <th>Member's Name</th>
- <tr>";
- while ($r = $db->fetch_row($selectMembers))
- {
- $p = ($r['PRES'] == $r['userid']) ? $Pres_icon : "";
- $vp = ($r['vPRES'] == $r['userid']) ? $vPres_icon : "";
- echo "<td><a href='viewuser.php?u={$r['userid']}'>$p $vp {$r['username']}</a></td>
- <tr>";
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function events()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $ModName, $eventsLimit;
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- echo "<table width='80%'>
- <th style='background-color: #000; color: #FFF;'>Event</th>
- <tr>";
- $getEvents = $db->query("SELECT `ID`,`TIME`,`CONTENT` FROM `family_events` WHERE `gangID`={$ir['gang']} ORDER BY `ID` DESC LIMIT $eventsLimit");
- while($r = $db->fetch_row($getEvents))
- {
- echo "<td style='background-color: #F7F7F7; border-color: #333333; border-style: solid;'>".ucwords($r['CONTENT'])."<br />
- <strong>Time:</strong> ".date(".l M Y (g a)", $r['TIME'])."</td><tr>";
- }
- echo "<table>";
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function aLogs()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $ModName;
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- if(@!in_array($_GET['t'], array('against', 'from')) OR @!$_GET['t'])
- {
- echo "<table width='90%' class='table'>
- <th width='45%'><a href='?p=aLogs&t=against'>Attacks against $ModName members</a><br />
- <small>View the logs of attacks that people have committed against fellow $ModName members</small></th>
- <th wodth='45%'><a href='?p=aLogs&t=from'>Attacks from $ModName members<br />
- <small>View the logs of attacks that people have committed from your $ModName</small></th>
- </table>";
- }
- elseif($_GET['t'] == 'against')
- {
- echo "<small>Viewing the attack logs of offenses against your $ModName!</small><br />
- <table width='95%' style='border-style: double;'>
- <th colspan='5' style='background: #EEE'>Attack Logs</th>
- <tr>
- <td style='background: #AAA;border-style: double;'>Attacker</td>
- <td style='background: #AAA;border-style: double;'>Attacked</td>
- <td style='background: #AAA;border-style: double;'>Who Won</td>
- <td style='background: #AAA;border-style: double;'>Time</td>
- <td style='background: #AAA;border-style: double;'>Links</td>
- <tr>";
- $GetLogs = $db->query("SELECT u.`userid`,u.`gang`, al.* FROM `users` u LEFT JOIN `attacklogs` al ON al.`attacked`=u.`userid` WHERE al.`attacked`=u.`userid` && u.`gang`={$ir['gang']} LIMIT 50");
- while ($r = $db->fetch_row($GetLogs))
- {
- if(!$db->num_rows($GetLogs))
- {
- echo "No logs have been reported!";
- }
- else
- {
- $attkr = $db->fetch_row($db->query("SELECT `userid`,`username` FROM `users` WHERE `userid`={$r['attacker']}"));
- $attkd = $db->fetch_row($db->query("SELECT `username` FROM `users` WHERE `userid`={$r['attacked']}"));
- $who_won = ($r['result'] == 'won' && $r['attacker'] != $r['userid']) ? $attkd['username'] : $attkr['username'];
- $links = ($who_won != $attkd['username'] ) ? "[<a href='attack.php?ID={$attkr['userid']}'>Attack the attacker!</a>]" : "<s>Take Revenge</s>";
- echo "<td style='background-color: #F7F7F7; border-color: #333333; border-style: solid;'>{$attkr['username']}</td>
- <td style='background-color: #F7F7F7; border-color: #333333; border-style: solid;'>{$attkd['username']}</td>
- <td style='background-color: #F7F7F7; border-color: #333333; border-style: solid;'>$who_won {$r['result']}</td>
- <td style='background-color: #F7F7F7; border-color: #333333; border-style: solid;'>".date('l F (G:i (a))', $r['time'])."</td>
- <td style='background-color: #F7F7F7; border-color: #333333; border-style: solid;'>$links</td>
- <tr>";
- }
- }
- }
- elseif($_GET['t'] == 'from')
- {
- echo "<small>Viewing the attacks from people in your $ModName</small><br />
- <table width='95%' style='border-style: double;'>
- <th colspan='5' style='background: #EEE'>Attack Logs</th>
- <tr>
- <td style='background: #AAA;border-style: double;'>Attacker</td>
- <td style='background: #AAA;border-style: double;'>Attacked</td>
- <td style='background: #AAA;border-style: double;'>Who Won</td>
- <td style='background: #AAA;border-style: double;'>Time</td>
- <td style='background: #AAA;border-style: double;'>Links</td>
- <tr>";
- $GetLogs = $db->query("SELECT u.`userid`,u.`gang`, al.* FROM `users` u LEFT JOIN `attacklogs` al ON al.`attacker`=u.`userid` WHERE al.`attacker`=u.`userid` && u.`gang`={$ir['gang']} LIMIT 50");
- while ($r = $db->fetch_row($GetLogs))
- {
- if(!$db->num_rows($GetLogs))
- {
- echo "No logs have been reported!";
- }
- else
- {
- $attkr = $db->fetch_row($db->query("SELECT `username` FROM `users` WHERE `userid`={$r['attacker']}"));
- $attkd = $db->fetch_row($db->query("SELECT `username`,`userid` FROM `users` WHERE `userid`={$r['attacked']}"));
- $who_won = ($r['result'] == 'won' && $r['attacker'] != $r['userid']) ? $attkd['username'] : $attkr['username'];
- $links = ($who_won != $attkd['username']) ? "[<a href='attack.php?ID={$attkd['userid']}'>Take Procautions</a>]" : "<s>Take Revenge</s>";
- echo "<td style='background-color: #F7F7F7; border-color: #333333; border-style: solid;'>{$attkr['username']}</td>
- <td style='background-color: #F7F7F7; border-color: #333333; border-style: solid;'>{$attkd['username']}</td>
- <td style='background-color: #F7F7F7; border-color: #333333; border-style: solid;'>$who_won {$r['result']}</td>
- <td style='background-color: #F7F7F7; border-color: #333333; border-style: solid;'>".date('l F (G:i (a))', $r['time'])."</td>
- <td style='background-color: #F7F7F7; border-color: #333333; border-style: solid;'>$links</td>
- <tr>";
- }
- }
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function warStats()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $upgradeSpots, $ModName, $mailDays;
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- $u = $db->fetch_row($db->query("SELECT `LOST`,`WON` FROM `family_mod` WHERE `ID`={$ir['gang']}"));
- echo "<table width='80%' style='text-align: center;'>
- <th style='background-color: #000; color: #FFF;' colspan='3'>General War Stats</th>
- <tr>
- <th style='background-color: #000; color: #FFF;'>Wars Won</th>
- <th style='background-color: #000; color: #FFF;'>Wars Lost</th>
- <tr>
- <td style='background-color: #F7F7F7; border-color: #333333; border-style: solid;'><p style='color: #090;'><strong>".number_format($u['WON'])."</strong></p></td>
- <td style='background-color: #F7F7F7; border-color: #333333; border-style: solid;'><p style='color: #FF0000;'><strong>".number_format($u['LOST'])."</strong></p></td>
- </table>
- <br />
- <table width='80%'>
- <th style='background-color: #000; color: #FFF;' colspan='3'>Wars in progress</th>
- <tr>
- <th style='background-color: #000; color: #FFF;'>Started By</th>
- <th style='background-color: #000; color: #FFF;'>Victims</th>
- <th style='background-color: #000; color: #FFF;'>Started at</th>
- <tr>";
- $war = $db->query("SELECT `ID`,`Starter`,`Victim`,`Time` FROM `family_wars` WHERE `Starter`={$ir['gang']} && `Victim`!={$ir['gang']} || `Starter`!={$ir['gang']} && `Victim`={$ir['gang']} ORDER BY `Time` DESC");
- while ($r = $db->fetch_row($war))
- {
- $str = $db->fetch_row($db->query("SELECT `ID`,`NAME` FROM `family_mod` WHERE `ID`={$r['Starter']}"));
- $vtm = $db->fetch_row($db->query("SELECT `ID`,`NAME` FROM `family_mod` WHERE `ID`={$r['Victim']}"));
- $starter = ($str['ID'] == $ir['gang']) ? "<p style='color: #090; line-height: 1.2'><strong>{$str['NAME']}</strong></p>" : $str['NAME'];
- $victim = ($vtm['ID'] == $ir['gang']) ? "<p style='color: #090; line-height: 1.2'><strong>{$vtm['NAME']}</strong></p>" : $vtm['NAME'];
- echo "<td style='background-color: #F7F7F7; border-color: #333333; border-style: solid;'>$starter</td>
- <td style='background-color: #F7F7F7; border-color: #333333; border-style: solid;'>$victim</td>
- <td style='background-color: #F7F7F7; border-color: #333333; border-style: solid;'>".date("j, D M Y (G:i (a))", $r['Time'])."</td>
- <tr>";
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function viewHitList()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $ModName;
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- $select = $db->query("SELECT `ID`,`HitList` FROM `family_hitlist` WHERE `Adder`={$ir['gang']}");
- echo "<table width='50%'>
- <th style='background-color: #000; color: #FFF;'>Current hit listed {$ModName}'s</th>
- <tr>";
- while ($r = $db->fetch_row($select))
- {
- $f = $db->fetch_row($db->query("SELECT `NAME` FROM `family_mod` WHERE `ID`={$r['HitList']}"));
- echo "<td style='background-color: #F7F7F7; border-color: #333333; border-style: solid; text-align:center;'><a href='?p=viewFamily&id={$r['HitList']}'>{$f['NAME']}</a></td><tr>";
- }
- echo "</table>";
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function leave()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $ModName;
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- //do they have any rented items?
- rentedItem($userid, "BROAD");
- //End rented items
- $selectVps = $db->query("SELECT `PRES`,`vPRES` FROM `family_mod` WHERE `ID`={$ir['gang']} && `PRES`=$userid || `vPRES`=$userid");
- $areTheyInCharge = $db->num_rows($selectVps);
- if(!$areTheyInCharge)
- {
- echo "You have left the $ModName!";
- add_famEvent("{$ir['username']} has left the {$ModName}", $ir['gang']);
- $db->query("UPDATE `users` SET `gang`=0 WHERE `userid`=$userid");
- }
- if($areTheyInCharge)
- {
- echo "<table width='75%'>
- <td style='background-color: #FFCCCC;'><center>You are important to the $ModName, please resign another member to your roll in the $ModName before leave please.<br />
- <hr><a href='?p=myFam'>Back</a></center></td>
- </table>";
- }
- }
- }
- function vpPanel()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $ModName;
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- $selectVps = $db->query("SELECT `PRES`,`vPRES` FROM `family_mod` WHERE `ID`={$ir['gang']} && `PRES`=$userid || `vPRES`=$userid");
- $areTheyInCharge = $db->num_rows($selectVps);
- $selectPnVP = $db->fetch_row($selectVps);
- if(!$areTheyInCharge)
- {
- echo "<table width='75%'>
- <td style='background-color: #FFCCCC;'><center>Strongly guarded and you want to be in here?! Think again!<br />
- <hr><a href='?p=myFam'>Back</a></center></td>
- </table>";
- exit($h->endpage());
- }
- else
- {
- $position = ($selectPnVP['PRES'] == $userid) ? "President" : "Vice President";
- echo "<table class='table' width='85%' style='text-align: center'>
- <th colspan='2'>$position Links</th>
- <tr>";
- if($position == "Vice President")
- {
- echo "<td colspan='2'>[<a href='?p=itemLent'>Items Lent To Members</a>]<br />
- [<a href='?p=applications'>Application Management</a>]<br />
- [<a href='?p=warStats'>War Stats</a>]<br />
- [<a href='?p=resign'>Resign</a>]<br /></td>";
- }
- echo "<tr>";
- if($position == "President")
- {
- echo "<td><u>Cash Flow</u><br />
- [<a href='?p=CashPayment'>Cash Payment</a>]<br />
- [<a href='?p=CrystalPayment'>Crystal Payment</a>]</td>
- <td><u>Major $ModName Changes</u><br />
- [<a href='?p=changeTag'>Change $ModName Tag</a>]<br />
- [<a href='?p=changeImage'>Change $ModName Picture</a>]<br />
- [<a href='?p=changeName'>Change $ModName Name</a>]<br />
- [<a href='?p=changeVice'>Change Vice President</a>]<br />
- [<a href='?p=changePres'>Change President</a>]<br />
- [<a href='?p=changeDesc'>Change Desc.</a>]<br />
- [<a href='?p=deleteFam'>Delete $ModName</a>]</td>
- <tr>
- <td><u>$ModName Members</u><br />
- [<a href='?p=applications'>Applications</a>]<br />
- [<a href='?p=upgradeSpots'>Upgrade Spots</a>]<br />
- [<a href='?p=mailAll'>Mail all Members</a>]<br />
- [<a href='?p=itemLent'>Items Lent To Members</a>]
- </td>
- <td><u>$ModName Wars</u><br />
- [<a href='?p=startWar'>Start War</a>]<br />
- [<a href='?p=warStats'>War Stats</a>]<br />
- [<a href='?p=hitListCrew'>HitList $ModName</a>]<br />
- [<a href='?p=surrender'>Surrender</a>]<br />
- </td>";
- }
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function cashPay()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $ModName;
- $r = $db->fetch_row($db->query("SELECT `VAULT_CASH` FROM `family_mod` WHERE `ID`={$ir['gang']}"));
- $membs = $db->fetch_row($db->query("SELECT COUNT(`userid`) AS `amount` FROM `users` WHERE `gang`={$ir['gang']}"));
- $maxPayout = floor($r['VAULT_CASH'] / $membs['amount']);
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- $AreTheyInCharge = $db->num_rows($db->query("SELECT `PRES` FROM `family_mod` WHERE `PRES`={$ir['userid']}"));
- if(!$AreTheyInCharge)
- {
- echo "<table width='75%'>
- <td style='background-color: #FFCCCC;'><center>Strongly guarded and you want to be in here?! Think again!<br />
- <hr><a href='?p=myFam'>Back</a></center></td>
- </table>";
- exit($h->endpage());
- }
- else
- {
- if(isset($_POST['Payout']))
- {
- if(empty($_POST['Payout']) || $_POST['Payout'] > $maxPayout || !is_numeric($_POST['Payout']))
- {
- echo "<strong>Error:</strong> You didn't give an amount to payout or you gave more than $".number_format($maxPayout)."!<br />
- [<a href='?p=CashPayment'>Back</a>]";
- exit();
- }
- else
- {
- $_Payout = str_replace(",", "", $_POST['Payout']);
- $message = (empty($_POST['PaymentMess'])) ? "<i>Nothing</i>" : $_POST['PaymentMess'];
- echo "You have given ".number_format($membs['amount'])." members $".number_format($_Payout)." and sent the message of: <i>".$db->escape($message)."</i>";
- $selectUsers = $db->query("SELECT `userid` FROM `users` WHERE `gang`={$ir['gang']}");
- while($r = $db->fetch_row($selectUsers))
- {
- event_add($r['userid'], "You have been given $".number_format($_Payout)." from your $ModName!<br /><small>".$db->escape($message)."</small>");
- $db->query("UPDATE `users` SET `money`=`money`+{$_Payout} WHERE `userid`={$r['userid']}");
- }
- $db->query("UPDATE `family_mod` SET `VAULT_CASH`=`VAULT_CASH`-{$_Payout} WHERE `ID`={$ir['gang']}");
- add_famEvent("A mass cash payment was given of $".number_format($_Payout)."!", $ir['gang']);
- }
- }
- else
- {
- echo "<form action='#' method='post'>
- Payment Message: <input type='text' name='PaymentMess' length='5' maxlength='50' />
- <br />
- <fieldset style='width: 50%;'><legend><font style='font-weight: bold; font-size:2em'>†</font></legend>
- There are ".number_format($membs['amount'])." members and you have $".number_format($r['VAULT_CASH'])." in the vault so the <strong>maximum you can give is: $".number_format($maxPayout)."</strong>
- <br /><br />
- Payout: $<input type='text' name='Payout' length='5' maxlength='".strlen($maxPayout)."'/> </fieldset>
- <br />
- <input type='submit' value='Payout'>
- </form>";
- }
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function cryPay()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $ModName;
- $r = $db->fetch_row($db->query("SELECT `VAULT_CRYS` FROM `family_mod` WHERE `ID`={$ir['gang']}"));
- $membs = $db->fetch_row($db->query("SELECT COUNT(`userid`) AS `amount` FROM `users` WHERE `gang`={$ir['gang']}"));
- $maxPayout = floor($r['VAULT_CRYS'] / $membs['amount']);
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- $AreTheyInCharge = $db->num_rows($db->query("SELECT `PRES` FROM `family_mod` WHERE `PRES`={$ir['userid']}"));
- if(!$AreTheyInCharge)
- {
- echo "<table width='75%'>
- <td style='background-color: #FFCCCC;'><center>Strongly guarded and you want to be in here?! Think again!<br />
- <hr><a href='?p=myFam'>Back</a></center></td>
- </table>";
- exit($h->endpage());
- }
- else
- {
- if(isset($_POST['Payout']))
- {
- if(empty($_POST['Payout']) || $_POST['Payout'] > $maxPayout || !is_numeric($_POST['Payout']))
- {
- echo "<strong>Error:</strong> You didn't give an amount to payout or you gave more than $".number_format($maxPayout)."!<br />
- [<a href='?p=CashPayment'>Back</a>]";
- exit();
- }
- else
- {
- $_Payout = str_replace(",", "", $_POST['Payout']);
- $message = (empty($_POST['PaymentMess'])) ? "<i>Nothing</i>" : $_POST['PaymentMess'];
- echo "You have given ".number_format($membs['amount'])." members ".number_format($_Payout)." crystals and sent the message of: <i>".$db->escape($message)."</i>";
- $selectUsers = $db->query("SELECT `userid` FROM `users` WHERE `gang`={$ir['gang']}");
- while($r = $db->fetch_row($selectUsers))
- {
- event_add($r['userid'], "You have been given ".number_format($_Payout)." crystal(s) from your $ModName!<br /><small>".$db->escape($message)."</small>");
- $db->query("UPDATE `users` SET `crystals`=`crystals`+{$_Payout} WHERE `userid`={$r['userid']}");
- }
- $db->query("UPDATE `family_mod` SET `VAULT_CRYS`=`VAULT_CRYS`-{$_Payout} WHERE `ID`={$ir['gang']}");
- add_famEvent("A mass crystal payment was given of $".number_format($_Payout)."!", $ir['gang']);
- }
- }
- else
- {
- echo "<form action='#' method='post'>
- Payment Message: <input type='text' name='PaymentMess' length='5' maxlength='50' />
- <br />
- <fieldset style='width: 50%;'><legend><font style='font-weight: bold; font-size:2em'>†</font></legend>
- There are ".number_format($membs['amount'])." members and you have ".number_format($r['VAULT_CRYS'])." crystal(s) in the vault so the <strong>maximum you can give is: ".number_format($maxPayout)." crystals</strong>
- <br /><br />
- Payout: <input type='text' name='Payout' length='5' maxlength='".strlen($maxPayout)."'/> crystals </fieldset>
- <br />
- <input type='submit' value='Payout'>
- </form>";
- }
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function changeTag()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $ModName;
- $r = $db->fetch_row($db->query("SELECT `TAG` FROM `family_mod` WHERE `ID`={$ir['gang']}"));
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- $AreTheyInCharge = $db->num_rows($db->query("SELECT `PRES` FROM `family_mod` WHERE `PRES`={$ir['userid']}"));
- if(!$AreTheyInCharge)
- {
- echo "<table width='75%'>
- <td style='background-color: #FFCCCC;'><center>Strongly guarded and you want to be in here?! Think again!<br />
- <hr><a href='?p=myFam'>Back</a></center></td>
- </table>";
- exit($h->endpage());
- }
- else
- {
- if(isset($_POST['tag']))
- {
- if(empty($_POST['tag']) || !is_string($_POST['tag']) || $_POST['tag'] == $r['TAG'])
- {
- echo "Please enter a valid tag<br />
- - Has to be 3 Characters in length <br />
- - Has to be an alphabetical character (a-z) <br />
- - Cannot be the same as your previous tag <br />
- [<a href='?p=changeTag'>Back</a>]";
- exit();
- }
- else
- {
- echo "Your $ModName tag has been changed!";
- $db->query("UPDATE `family_mod` SET `TAG`='{$_POST['tag']}' WHERE `ID`={$ir['gang']}");
- echo "<br />[<a href='?p=myFam'>Back</a>]";
- add_famEvent("A new tag was given to the {$ModName} of {$_POST['tag']}", $ir['gang']);
- }
- }
- else
- {
- echo "<form action='#' method='post'>
- <br />
- <fieldset style='width: 50%;'><legend><font style='font-weight: bold; font-size:2em'>†</font></legend>
- Your current tag is: {$r['TAG']}<br /><br />
- New Tag: <input type='text' name='tag' length='3' maxlength='3' />
- <br />
- <input type='submit' value='Change Tag'>
- </form>";
- }
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function changeIMG()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $ModName;
- $r = $db->fetch_row($db->query("SELECT `IMAGE` FROM `family_mod` WHERE `ID`={$ir['gang']}"));
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- $AreTheyInCharge = $db->num_rows($db->query("SELECT `PRES` FROM `family_mod` WHERE `PRES`={$ir['userid']}"));
- if(!$AreTheyInCharge)
- {
- echo "<table width='75%'>
- <td style='background-color: #FFCCCC;'><center>Strongly guarded and you want to be in here?! Think again!<br />
- <hr><a href='?p=myFam'>Back</a></center></td>
- </table>";
- exit($h->endpage());
- }
- else
- {
- if(isset($_POST['img']))
- {
- $_POST['img'] = strip_tags($db->escape($_POST['img']));
- if(empty($_POST['img']) || $_POST['img'] == $r['IMAGE'] || PNG($_POST['img']))
- {
- echo "Please enter a valid image<br />
- - Has to have a .png extension <br />
- - Cannot be the same as your previous image <br />
- [<a href='?p=changeImage'>Back</a>]";
- exit();
- }
- else
- {
- echo "Your $ModName image has been changed!";
- $db->query("UPDATE `family_mod` SET `IMAGE`='{$_POST['img']}' WHERE `ID`={$ir['gang']}");
- echo "<br />[<a href='?p=myFam'>Back</a>]";
- add_famEvent("The {$ModName} now has a new image", $ir['gang']);
- }
- }
- else
- {
- echo "<form action='#' method='post'>
- <br />
- <fieldset style='width: 50%;'><legend><font style='font-weight: bold; font-size:2em'>†</font></legend>
- Your current image is: <img src='{$r['IMAGE']}' width='250px' height='50px'><br /><br />
- New image: <input type='text' name='img' length='3' maxlength='250' />
- <br />
- <input type='submit' value='Change Tag'>
- </form>";
- }
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function changeName()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $ModName;
- $r = $db->fetch_row($db->query("SELECT `NAME` FROM `family_mod` WHERE `ID`={$ir['gang']}"));
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- $AreTheyInCharge = $db->num_rows($db->query("SELECT `PRES` FROM `family_mod` WHERE `PRES`={$ir['userid']}"));
- if(!$AreTheyInCharge)
- {
- echo "<table width='75%'>
- <td style='background-color: #FFCCCC;'><center>Strongly guarded and you want to be in here?! Think again!<br />
- <hr><a href='?p=myFam'>Back</a></center></td>
- </table>";
- exit($h->endpage());
- }
- else
- {
- if(isset($_POST['name']))
- {
- $name = trim(stripslashes($db->escape(htmlspecialchars($_POST['name']))));
- $badWords = array('REFRESH', 'meta', 'www');
- foreach($badWords as $filter)
- {
- $name = str_replace("$filter", "", $name);
- }
- if($name === $r['NAME'] || empty($name) || !is_string($name))
- {
- echo "Please enter a valid new $ModName name!<br />
- - Cannot be the same as your previous name <br />
- - Cannot be nothing <br />
- - Has to be alphabetic characters (a-z)<br />
- [<a href='?p=myFam'>Back</a>]";
- exit();
- }
- $alreadyName = $db->num_rows($db->query("SELECT `NAME` FROM `family_mod` WHERE `NAME`='$name'"));
- if($alreadyName)
- {
- echo "The {$ModName}'s name has already been taken!<br />
- [<a href='?p=myFam'>Back</a>]";
- exit();
- }
- else
- {
- echo "$ModName's name has been changed!";
- $db->query("UPDATE `family_mod` SET `NAME`='$name' WHERE `ID`={$ir['gang']}");
- add_famEvent("The {$ModName} has a new name of {$name}", $ir['gang']);
- }
- }
- else
- {
- echo "<form action='#' method='post'>
- <br />
- <fieldset style='width: 50%;'><legend><font style='font-weight: bold; font-size:2em'>†</font></legend>
- The current $ModName's name is: {$r['NAME']}<br /><br />
- New Name: <input type='text' name='name' length='5' maxlength='10' />
- <br />
- <input type='submit' value='Change Tag'>
- </form>";
- }
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function changeVice()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $ModName;
- $r = $db->fetch_row($db->query("SELECT `vPRES` FROM `family_mod` WHERE `ID`={$ir['gang']}"));
- $vp = $db->fetch_row($db->query("SELECT `username` FROM `users` WHERE `userid`={$r['vPRES']}"));
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- $AreTheyInCharge = $db->num_rows($db->query("SELECT `PRES` FROM `family_mod` WHERE `PRES`={$ir['userid']}"));
- if(!$AreTheyInCharge)
- {
- echo "<table width='75%'>
- <td style='background-color: #FFCCCC;'><center>Strongly guarded and you want to be in here?! Think again!<br />
- <hr><a href='?p=myFam'>Back</a></center></td>
- </table>";
- exit($h->endpage());
- }
- else
- {
- if(isset($_POST['vice']))
- {
- if($_POST['vice'] == $r['vPRES'])
- {
- echo "This user is already the Vice President!<br />
- [<a href='?p=changeVice'>Back</a>";
- exit();
- }
- else
- {
- echo "$vPres_icon has been changed!";
- $r = $db->fetch_row($db->query("SELECT `username` FROM `users` WHERE `userid`={$_POST['vice']}"));
- $db->query("UPDATE `family_mod` SET `vPRES`={$_POST['vice']} WHERE `ID`={$ir['gang']}");
- add_famEvent("The {$ModName} has a new Vice President, so congratualtions to {$r['username']}", $ir['gang']);
- }
- }
- else
- {
- echo "<fieldset style='width: 50%;'><legend><font style='font-weight: bold; font-size:2em'>†</font></legend>
- The current vice president is: {$vp['username']}<br />
- <small>You are changing the vice president of your $ModName</small><br /><br />";
- changeViceDropdown('vice');
- echo "</fieldset>";
- }
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function changePres()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $ModName;
- $r = $db->fetch_row($db->query("SELECT `PRES` FROM `family_mod` WHERE `ID`={$ir['gang']}"));
- $vp = $db->fetch_row($db->query("SELECT `username` FROM `users` WHERE `userid`={$r['PRES']}"));
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- $AreTheyInCharge = $db->num_rows($db->query("SELECT `PRES` FROM `family_mod` WHERE `PRES`={$ir['userid']}"));
- if(!$AreTheyInCharge)
- {
- echo "<table width='75%'>
- <td style='background-color: #FFCCCC;'><center>Strongly guarded and you want to be in here?! Think again!<br />
- <hr><a href='?p=myFam'>Back</a></center></td>
- </table>";
- exit($h->endpage());
- }
- else
- {
- if(isset($_POST['pres']))
- {
- if($_POST['pres'] == $r['PRES'])
- {
- echo "You are the President!<br />
- [<a href='?p=changePres'>Back</a>";
- exit();
- }
- if(passwordEncyption($_POST['confirmPas']) != $ir['userpass'])
- {
- echo "Incorrect password, unable to change the president of your $ModName!<br />
- [<a href='?p=changePres'>Back</a>]";
- exit();
- }
- else
- {
- echo "$Pres_icon has been changed!";
- $db->query("UPDATE `family_mod` SET `PRES`={$_POST['pres']} WHERE `ID`={$ir['gang']}");
- $r = $db->fetch_row($db->query("SELECT `username` FROM `users` WHERE `userid`={$_POST['pres']}"));
- add_famEvent("{$r['username']} has taken leadership of the {$ModName}!", $ir['gang']);
- }
- }
- else
- {
- echo "<fieldset style='width: 50%;'><legend><font style='font-weight: bold; font-size:2em'>†</font></legend>
- The current president is: {$ir['username']}<br />
- <small>You are changing the president of your $ModName</small><br /><br />";
- changePresDropdown('pres');
- echo "</fieldset>";
- }
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function changeDesc()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $descBadWords, $ModName;
- $r = $db->fetch_row($db->query("SELECT `DESC` FROM `family_mod` WHERE `ID`={$ir['gang']}"));
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- $AreTheyInCharge = $db->num_rows($db->query("SELECT `PRES` FROM `family_mod` WHERE `PRES`={$ir['userid']}"));
- if(!$AreTheyInCharge)
- {
- echo "<table width='75%'>
- <td style='background-color: #FFCCCC;'><center>Strongly guarded and you want to be in here?! Think again!<br />
- <hr><a href='?p=myFam'>Back</a></center></td>
- </table>";
- exit($h->endpage());
- }
- else
- {
- if(isset($_POST['desc']))
- {
- $_POST['desc'] = trim(strip_tags($_POST['desc']));
- if(empty($_POST['desc']) || $_POST['desc'] == $r['DESC'])
- {
- echo "Please enter a valid description <br />
- - Cannot be blank <br />
- - Cannot be the same as previous description<br />
- [<a href='?p=changeDesc'>Back</a>]";
- exit();
- }
- else
- {
- foreach($descBadWords as $filter)
- {
- $_POST['desc'] = str_replace("$filter", "", $_POST['desc']);
- }
- echo "The $ModName's description has been changed!";
- $db->query("UPDATE `family_mod` SET `DESC`='{$_POST['desc']}' WHERE `ID`={$ir['gang']}");
- add_famEvent("The {$ModName} now has a new description", $ir['gang']);
- }
- }
- else
- {
- echo "<fieldset style='width: 50%;'><legend><font style='font-weight: bold; font-size:2em'>†</font></legend>
- The current description is: <small>See textbox</small><br />
- <small>You are changing the description of your $ModName</small><br /><br />";
- echo "<form action='#' method='post'>
- <textarea cols='25' rows='10' name='desc'>".nl2br(strip_tags(stripslashes($r['DESC'])))."</textarea>
- <br />
- <input type='submit' value='Change Description'>
- </form>";
- echo "</fieldset>";
- }
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function deleteFam()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $descBadWords, $ModName;
- $r = $db->fetch_row($db->query("SELECT `DESC` FROM `family_mod` WHERE `ID`={$ir['gang']}"));
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- $AreTheyInCharge = $db->num_rows($db->query("SELECT `PRES` FROM `family_mod` WHERE `PRES`={$ir['userid']}"));
- if(!$AreTheyInCharge)
- {
- echo "<table width='75%'>
- <td style='background-color: #FFCCCC;'><center>Strongly guarded and you want to be in here?! Think again!<br />
- <hr><a href='?p=myFam'>Back</a></center></td>
- </table>";
- exit($h->endpage());
- }
- else
- {
- if(isset($_POST['del']))
- {
- if(passwordEncyption($_POST['del']) != $ir['userpass'])
- {
- echo "Your confirmation password is not correct!<br />
- [<a href='?p=myFam'>Back</a>]";
- }
- else
- {
- echo "Your $ModName has been deleted!";
- $db->query("DELETE FROM `family_mod` WHERE `ID`={$ir['gang']}");
- $allFamUsers = $db->query("SELECT `userid` FROM `users` WHERE `gang`={$ir['gang']}");
- while ($r = $db->fetch_row($allFamUsers))
- {
- event_add($r['userid'], "The $ModName you were in was deleted by the president");
- $db->query("UPDATE `users` SET `gang`=0 WHERE `userid`={$r['userid']}");
- }
- }
- }
- else
- {
- echo "<fieldset style='width: 50%;'><legend><font style='font-weight: bold; font-size:2em'>†</font></legend>";
- delFamily('del');
- echo "</fieldset>";
- }
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function apps()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $ModName;
- $r = $db->fetch_row($db->query("SELECT `DESC` FROM `family_mod` WHERE `ID`={$ir['gang']}"));
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- $AreTheyPres = $db->num_rows($db->query("SELECT `PRES` FROM `family_mod` WHERE `PRES`={$ir['userid']} || `vPRES`={$ir['userid']}"));
- if(!$AreTheyPres)
- {
- echo "<table width='75%'>
- <td style='background-color: #FFCCCC;'><center>Strongly guarded and you want to be in here?! Think again!<br />
- <hr><a href='?p=myFam'>Back</a></center></td>
- </table>";
- exit($h->endpage());
- }
- else
- {
- if(@$_GET['action'] == 'accept')
- {
- //for applications, please do not alter
- $DidTheySendAnApp = $db->num_rows($db->query("SELECT `userid` FROM `family_mod_apply` WHERE `gangID`={$ir['gang']} && `userid`={$_GET['user']}"));
- if(!$_GET['user'] || !$DidTheySendAnApp)
- {
- echo "This application does not exist!<br />
- [<a href='?p=myFam'>Back</a>]";
- exit();
- }
- $amntOfMembs = $db->fetch_row($db->query("SELECT COUNT(`userid`) AS `u` FROM `users` WHERE `gang`={$ir['gang']}"));
- $r = $db->fetch_row($db->query("SELECT `SPOTS`,`NAME` FROM `family_mod` WHERE `ID`={$ir['gang']}"));
- if($amntOfMembs['u']+1 > $r['SPOTS'])
- {
- echo "You need to upgrade the amount of spots in your $ModName before accepting this applicant!<br />
- [<a href='?p=myFam'>Back</a>]";
- exit();
- }
- $areTheyInAFam = $db->num_rows($db->query("SELECT `gang` FROM `users` WHERE `userid`={$_GET['user']} && `gang` > 0"));
- if($areTheyInAFam)
- {
- echo "Sorry, but they are already in a $ModName!<br />
- [<a href='?p=myFam'>Back</a>]";
- }
- else
- {
- $r = $db->fetch_row($db->query("SELECT `NAME` FROM `family_mod` WHERE `ID`={$ir['gang']}"));
- $user = $db->fetch_row($db->query("SELECT `userid`,`username` FROM `users` WHERE `userid`={$_GET['user']}"));
- echo "You have accepted the application from {$user['username']}";
- event_add($user['userid'], "Your application from {$r['NAME']} $ModName was accepted, Congratulations!");
- $db->query("UPDATE `users` SET `gang`={$ir['gang']} WHERE `userid`={$_GET['user']}");
- $db->query("DELETE FROM `family_mod_apply` WHERE `userid`={$_GET['user']}");
- add_famEvent("{$user['username']} is now in the {$ModName}!", $ir['gang']);
- }
- }
- elseif(@$_GET['action'] == 'deny')
- {
- //for applications, please do not alter
- $DidTheySendAnApp = $db->num_rows($db->query("SELECT `userid` FROM `family_mod_apply` WHERE `gangID`={$ir['gang']} && `userid`={$_GET['user']}"));
- if(!$_GET['user'] || !$DidTheySendAnApp)
- {
- echo "This application does not exist!<br />
- [<a href='?p=myFam'>Back</a>]";
- exit();
- }
- else
- {
- $r = $db->fetch_row($db->query("SELECT `NAME` FROM `family_mod` WHERE `ID`={$ir['gang']}"));
- $user = $db->fetch_row($db->query("SELECT `userid`,`username` FROM `users` WHERE `userid`={$_GET['user']}"));
- echo "You have declined the application from {$user['username']}";
- event_add($user['userid'], "Your application from {$r['NAME']} $ModName was declined!");
- $db->query("DELETE FROM `family_mod_apply` WHERE `userid`={$_GET['user']}");
- }
- }
- else
- {
- echo "<table width='80%' class='table'>
- <th width='20%'>Applicant</th>
- <th width='20%'>Applied</th>
- <th width='20%'>CV</th>
- <th width='20%'>Links</th>
- <tr>";
- $getData = $db->query("SELECT * FROM `family_mod_apply` WHERE `gangID`={$ir['gang']}");
- while($r = $db->fetch_row($getData))
- {
- $user = $db->fetch_row($db->query("SELECT `userid`,`username` FROM `users` WHERE `userid`={$r['userid']}"));
- echo "<td><a href='viewuser.php?u={$user['userid']}'>{$user['username']}</a></td>
- <td>".date('l F (G:i (a))', $r['time'])."</td>
- <td>".strip_tags(htmlspecialchars($r['applyNote']))."</td>
- <td>[<a href='?p=applications&action=accept&user={$r['userid']}'>Accept</a>]<br />
- [<a href='?p=applications&action=deny&user={$r['userid']}'>Deny</a>]</td>
- <tr>";
- }
- }
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function upgradeSpots()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $upgradeSpots, $ModName;
- $r = $db->fetch_row($db->query("SELECT `DESC` FROM `family_mod` WHERE `ID`={$ir['gang']}"));
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- $AreTheyPres = $db->num_rows($db->query("SELECT `PRES` FROM `family_mod` WHERE `PRES`={$ir['userid']}"));
- if(!$AreTheyPres)
- {
- echo "<table width='75%'>
- <td style='background-color: #FFCCCC;'><center>Strongly guarded and you want to be in here?! Think again!<br />
- <hr><a href='?p=myFam'>Back</a></center></td>
- </table>";
- exit($h->endpage());
- }
- else
- {
- $r = $db->fetch_row($db->query("SELECT `VAULT_CASH` FROM `family_mod` WHERE `ID`={$ir['gang']}"));
- $buyspots = floor($r['VAULT_CASH'] / $upgradeSpots);
- $cost = @$_POST['spots'] * $upgradeSpots;
- if(isset($_POST['spots']))
- {
- $_POST['spots'] == abs((int) $_POST['spots']);
- if(!is_numeric($_POST['spots']) || $_POST['spots'] > $buyspots)
- {
- echo "Sorry, but<br />
- - You can only buy ".number_format($buyspots)." spots (maximum)<br />
- - Please fill out the form<br />
- [<a href='?p=myFam'>Back</a>]";
- }
- else
- {
- echo "You have upgraded your $ModName to include ".number_format($_POST['spots'])." more places!";
- $db->query("UPDATE `family_mod` SET `VAULT_CASH`=`VAULT_CASH`-$cost,`SPOTS`=`SPOTS`+{$_POST['spots']} WHERE `ID`={$ir['gang']}");
- echo "[<a href='?p=myFam'>Back</a>]";
- $Grammer = ($_POST['spots'] > 1) ? "s" : "";
- add_famEvent("The {$ModName} now has an extra ".number_format($_POST['spots'])." spot{$Grammer}!", $ir['gang']);
- }
- }
- else
- {
- echo "<fieldset style='width: 50%;'><legend><font style='font-weight: bold; font-size:2em'>†</font></legend>
- <small>Upgrading the amount of places you have in your $ModName, <strong>1 spot costs $".number_format($upgradeSpots).", you can buy ".number_format($buyspots)." spots!</strong><br /><br />
- <form action='#' method='post'>
- Upgrade to: <input type='text' name='spots' length='5' maxlength='".strlen($buyspots)."'/>
- <br />
- <input type='submit' value='Upgrade!'>
- </form>
- </fieldset>";
- }
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function mailAll()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $upgradeSpots, $ModName, $mailDays;
- $r = $db->fetch_row($db->query("SELECT `userid` FROM `users` WHERE `gang`={$ir['gang']}"));
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- $AreTheyPres = $db->num_rows($db->query("SELECT `PRES` FROM `family_mod` WHERE `PRES`={$ir['userid']}"));
- if(!$AreTheyPres)
- {
- echo "<table width='75%'>
- <td style='background-color: #FFCCCC;'><center>Strongly guarded and you want to be in here?! Think again!<br />
- <hr><a href='?p=myFam'>Back</a></center></td>
- </table>";
- exit($h->endpage());
- }
- else
- {
- if(isset($_POST['mail']))
- {
- $now = date("d") + $mailDays;
- $db->query("UPDATE `family_mail` SET `LastSentMail`={$now} WHERE `ID`={$ir['gang']}") or die(mysql_error());
- $_POST['mail'] == strip_tags(htmlspecialchars(nl2br(trim($_POST['mail']))));
- $badWords = array('meta', 'REFRESH', 'refresh', 'www', 'com');
- foreach($badWords as $filter)
- {
- $_POST['mail'] == str_replace($filter, "", $_POST['mail']);
- }
- $getMembers = $db->query("SELECT `userid` FROM `users` WHERE `gang`={$ir['gang']}");
- while($r = $db->fetch_row($getMembers))
- {
- $db->query("INSERT INTO `mail` VALUES ('NULL', 1, {$ir['userid']}, {$r['userid']}, unix_timestamp(), '$ModName Mail', '{$_POST['mail']}')");
- $db->query("UPDATE `users` SET `new_mail`=1 WHERE `userid`={$r['userid']}");
- }
- echo "You have sent mail to all your members in your $ModName";
- }
- else
- {
- $m = $db->fetch_row($db->query("SELECT `LastSentMail` FROM `family_mail` WHERE `ID`={$ir['gang']}"));
- $nextMail = $m['LastSentMail'] + $mailDays;
- $disabled = ((date("d")) < $nextMail && $m['LastSentMail'] != 0) ? "disabled='yes'" : "";
- $Grammer = ($mailDays > 1) ? "s" : "";
- echo "<fieldset style='width: 50%;'><legend><font style='font-weight: bold; font-size:2em'>†</font></legend>
- <small>You are mailing all your members in your $ModName, <strong>You can do this once every $mailDays day$Grammer, you can sent your next mail on the {$nextMail} ".date("M")."</strong><br /><br />
- <form action='#' method='post'>
- <textarea cols='15' rows='5' name='mail' wrap='hard' $disabled>Enter your message here...</textarea>
- <br />
- <input type='submit' value='Send!' $disabled>
- </form>
- </fieldset>";
- }
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function startWar()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $upgradeSpots, $ModName, $mailDays;
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- $AreTheyPres = $db->num_rows($db->query("SELECT `PRES` FROM `family_mod` WHERE `PRES`={$ir['userid']}"));
- if(!$AreTheyPres)
- {
- echo "<table width='75%'>
- <td style='background-color: #FFCCCC;'><center>Strongly guarded and you want to be in here?! Think again!<br />
- <hr><a href='?p=myFam'>Back</a></center></td>
- </table>";
- exit($h->endpage());
- }
- else
- {
- if(isset($_POST['start']))
- {
- if($_POST['start'] == $ir['gang'])
- {
- echo "You cannot start a war with your own $ModName!<br /> [<a href='?p=myFam'>Back</a>]";
- exit($h->endpage());
- }
- if($_POST['start'] == 0)
- {
- echo "You are already at war with this $ModName!<br /> [<a href='?p=myFam'>Back</a>]";
- exit($h->endpage());
- }
- else
- {
- $r = $db->fetch_row($db->query("SELECT `NAME` FROM `family_mod` WHERE `ID`={$_POST['start']}"));
- $me = $db->fetch_row($db->query("SELECT `NAME` FROM `family_mod` WHERE `ID`={$ir['gang']}"));
- echo "You have started a war with {$r['NAME']}, Good Luck!";
- add_famEvent("A war was started with {$r['NAME']}!", $ir['gang']);
- add_famEvent("A was was declared against you by {$me['NAME']}!", $_POST['start']);
- $time = time();
- $db->query("INSERT INTO `family_wars` (`Starter`,`Victim`,`Time`) VALUES ({$ir['gang']}, {$_POST['start']}, {$time})");
- }
- }
- else
- {
- echo "<fieldset style='width: 50%;'><legend><font style='font-weight: bold; font-size:2em'>†</font></legend>
- <small>You are starting a war with another $ModName, <strong>You can surrender if they are too strong</strong><br /><br />";
- dropdownAllFam('start', 'yes');
- echo " <br />
- </form>
- </fieldset>";
- }
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function hitListCrew()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $upgradeSpots, $ModName, $mailDays;
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- $AreTheyPres = $db->num_rows($db->query("SELECT `PRES` FROM `family_mod` WHERE `PRES`={$ir['userid']}"));
- if(!$AreTheyPres)
- {
- echo "<table width='75%'>
- <td style='background-color: #FFCCCC;'><center>Strongly guarded and you want to be in here?! Think again!<br />
- <hr><a href='?p=myFam'>Back</a></center></td>
- </table>";
- exit($h->endpage());
- }
- else
- {
- if(isset($_POST['hitlist']))
- {
- if($_POST['hitlist'] == $ir['gang'])
- {
- echo "You cannot hit list your own $ModName!<br /> [<a href='?p=myFam'>Back</a>]";
- exit($h->endpage());
- }
- $already = $db->num_rows($db->query("SELECT `ID` FROM `family_hitlist` WHERE `Adder`={$ir['gang']} && `HitList`={$_POST['hitlist']}"));
- if($already)
- {
- echo "This {$ModName} is already on your {$ModName}'s hitlist!<br /> [<a href='?p=myFam'>Back</a>]";
- exit();
- }
- else
- {
- $r = $db->fetch_row($db->query("SELECT `NAME` FROM `family_mod` WHERE `ID`={$_POST['hitlist']}"));
- echo "{$r['NAME']} has been added to the {$ModName}'s hitlist!<br /> [<a href='?p=myFam'>Back</a>]";
- $db->query("INSERT INTO `family_hitlist` (`Adder`,`HitList`) VALUES ({$ir['gang']}, {$_POST['hitlist']})");
- add_famEvent("{$r['NAME']} was added to the hit list!", $ir['gang']);
- exit();
- }
- }
- else
- {
- echo "<fieldset style='width: 50%;'><legend><font style='font-weight: bold; font-size:2em'>†</font></legend>
- <small>You can add another $ModName to the hitlist! <strong>It is advised you hit list $ModName's that you are at war with!</strong><br /><br />";
- dropdownAllFam('hitlist', 'no');
- echo " <br />
- </form>
- </fieldset>";
- }
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function surrender()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $upgradeSpots, $ModName, $mailDays;
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- $AreTheyPres = $db->num_rows($db->query("SELECT `PRES` FROM `family_mod` WHERE `PRES`={$ir['userid']}"));
- if(!$AreTheyPres)
- {
- echo "<table width='75%'>
- <td style='background-color: #FFCCCC;'><center>Strongly guarded and you want to be in here?! Think again!<br />
- <hr><a href='?p=myFam'>Back</a></center></td>
- </table>";
- exit($h->endpage());
- }
- else
- {
- if(isset($_POST['surrender']))
- {
- if($_POST['surrender'] == $ir['gang'])
- {
- echo "You cannot surrender against your own$ModName!<br /> [<a href='?p=myFam'>Back</a>]";
- exit($h->endpage());
- }
- $at_war = $db->num_rows($db->query("SELECT `ID` FROM `family_wars` WHERE `Starter`={$ir['gang']} && `Victim`={$_POST['surrender']} || `Starter`={$_POST['surrender']} && `Victim`={$ir['gang']}"));
- if(!$at_war)
- {
- echo "You are not at war with this {$ModName}!<br /> [<a href='?p=myFam'>Back</a>]";
- exit();
- }
- if(passwordEncyption($_POST['confirmpass']) != $ir['userpass'])
- {
- echo "Incorrect password!<br /> [<a href='?p=myFam'>Back</a>]";
- exit();
- }
- else
- {
- $r = $db->fetch_row($db->query("SELECT `NAME` FROM `family_mod` WHERE `ID`={$_POST['surrender']}"));
- $me = $db->fetch_row($db->query("SELECT `NAME` FROM `family_mod` WHERE `ID`={$ir['gang']}"));
- echo "You have surrenderd against {$r['NAME']}<br /> [<a href='?p=myFam'>Back</a>]";
- $war = $db->query("SELECT `Starter`,`Victim` FROM `family_wars` WHERE `Starter`={$ir['gang']} && `Victim`!={$ir['gang']} || `Starter`!={$ir['gang']} && `Victim`={$ir['gang']}");
- //do the wars won and lost queryes
- $db->query("UPDATE `family_mod` SET `LOST`=`LOST`+1 WHERE `ID`={$ir['gang']}");
- $db->query("UPDATE `family_mod` SET `WON`=`WON`+1 WHERE `ID`={$_POST['surrender']}");
- $field = ($war['Starter'] == $ir['gang']) ? "Victim" : "Starter";
- $db->query("DELETE FROM `family_wars` WHERE {$field}={$_POST['surrender']}");
- add_famEvent("{$r['NAME']} won the war as your president surrenderd!", $ir['gang']);
- add_famEvent("You won the war against {$me['NAME']}! Congratulations!", $_POST['surrender']);
- exit();
- }
- }
- else
- {
- echo "<fieldset style='width: 50%;'><legend><font style='font-weight: bold; font-size:2em'>†</font></legend>
- <small>You are surrending against another {$ModName} <strong>This will ruin your [W]ar[W]in Ratio</strong><br /><br />";
- surrenderForm('surrender');
- echo " <br />
- </form>
- </fieldset>";
- }
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function itemLent()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $upgradeSpots, $ModName, $mailDays;
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- $AreTheyPres = $db->num_rows($db->query("SELECT `PRES` FROM `family_mod` WHERE `PRES`={$ir['userid']} || `vPRES`={$ir['userid']}"));
- if(!$AreTheyPres)
- {
- echo "<table width='75%'>
- <td style='background-color: #FFCCCC;'><center>Strongly guarded and you want to be in here?! Think again!<br />
- <hr><a href='?p=myFam'>Back</a></center></td>
- </table>";
- exit($h->endpage());
- }
- $select = $db->query("SELECT fr.*,u.`username`,u.`gang` FROM `family_armory_rent` fr LEFT JOIN `users` u ON fr.`Renter`=u.`userid` WHERE u.`gang`={$ir['gang']}");
- echo "<fieldset style='width: 50%;'><legend><font style='font-weight: bold; font-size:2em'>†</font></legend>
- <small>Here, you can see who has rented what from your armory.<br />
- </fieldset>
- <table class='table' width='80%' style='text-align: center;'>
- <th colspan='4'>Items being rented!</th>
- <tr style='background-color: #FFF;'></tr>
- <th width='20%'>Item Name</th>
- <th width='20%'>Rented By</th>
- <th width='20%'>Days Left</th>
- <th width='20%'>Give Back</th>
- <tr>";
- if(!$db->fetch_row($select))
- {
- echo "<td colspan='4'>No items have been rented!</td>";
- }
- while ($r = $db->fetch_row($select))
- {
- $i = $db->fetch_row($db->query("SELECT `itmname` FROM `items` WHERE `itmid`={$r['ItemID']}"));
- echo "<td>".ucwords($i['itmname'])."</td>
- <td><a href='viewuser.php?u={$r['Renter']}'>".ucwords($r['username'])."</a></td>
- <td>{$r['Days']} Day(s)</td>
- <td><a href='?p=itemLent&action=giveBack&Entry=".base64_encode($r['ID'])."'>Give Back</a></td>
- <tr>";
- }
- }
- if(@$_GET['action'] == 'giveBack')
- {
- $Max = $db->fetch_row($db->query("SELECT `ID` FROM `family_armory_rent` ORDER BY `ID` DESC LIMIT 1"));
- $_GET['Entry'] = base64_decode($_GET['Entry']);
- if(!$_GET['Entry'] || $_GET['Entry'] > $Max['ID'])
- {
- echo "<br /><table style='background: #FF0000' width='100%'><th>Invalid Entry!<br />[<a href='?p=itemLent'>Back</a>]</th></table>";
- exit($h->endpage());
- }
- else
- {
- $r = $db->fetch_row($db->query("SELECT `ItemID`,`Renter`,`Adder` FROM `family_armory_rent` WHERE `ID`={$_GET['Entry']}"));
- if(!$r['ItemID'])
- {
- echo "<br /><table style='background: #FF0000' width='100%'><th>Uh-Oh, Something happened!<br />[<a href='?p=itemLent'>Back</a>]</th></table>";
- exit($h->endpage());
- }
- else
- {
- $u = $db->fetch_row($db->query("SELECT `username` FROM `users` WHERE `userid`={$r['Adder']}"));
- $i = $db->fetch_row($db->query("SELECT `itmname` FROM `items` WHERE `itmid`={$r['ItemID']}"));
- echo "<br /><table style='background: #6EFF70' width='100%'><th>You have given 1 {$i['itmname']} back to {$u['username']}!<br />[<a href='?p=myFam'>Back</a>]</th></table>";
- event_add($r['Adder'], "You have been given back your {$i['itmname']} from your {$ModName} early!");
- item_add($r['Adder'], $r['ItemID'], 1, 0, 0);
- $db->query("DELETE FROM `family_armory_rent` WHERE `ID`={$_GET['Entry']} LIMIT 1");
- }
- }
- }
- }
- function resign()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $upgradeSpots, $ModName, $mailDays;
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- $AreTheyPres = $db->num_rows($db->query("SELECT `PRES` FROM `family_mod` WHERE `PRES`={$ir['userid']} || `vPRES`={$ir['userid']}"));
- if(!$AreTheyPres)
- {
- echo "<table width='75%'>
- <td style='background-color: #FFCCCC;'><center>Strongly guarded and you want to be in here?! Think again!<br />
- <hr><a href='?p=myFam'>Back</a></center></td>
- </table>";
- exit($h->endpage());
- }
- if(isset($_POST['resign']))
- {
- if(passwordEncyption($_POST['confirmPas']) != $ir['userpass'])
- {
- echo "Incorrect password, unable to resign from your $ModName!<br />
- [<a href='?p=resign'>Back</a>]";
- exit();
- }
- else
- {
- echo "$vPres_icon has been changed!";
- $pres = $db->fetch_row($db->query("SELECT `PRES` FROM `family_mod` WHERE `ID`={$ir['gang']}"));
- $db->query("UPDATE `family_mod` SET `vPRES`={$pres['PRES']} WHERE `ID`={$ir['gang']}");
- $r = $db->fetch_row($db->query("SELECT `username` FROM `users` WHERE `userid`={$pres['PRES']}"));
- add_famEvent("{$ir['username']} has resigned from the {$ModName} as vice president!", $ir['gang']);
- }
- }
- else
- {
- echo "<fieldset style='width: 50%;'><legend><font style='font-weight: bold; font-size:2em'>†</font></legend>
- <small>The current $Pres_icon will become Vice president!</small><br />
- <small>You are resigning from your $ModName</small><br /><br />
- <form action='#' method='post'>
- <small>Please insert your password for confirmation</small><br />
- Password: <input type='password' name='confirmPas' length='5' maxlength='50' /><br />
- <input type='submit' name='resign' value='Resign'>
- </form></fieldset>";
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- /*
- ====== ARMORY FUNCTIONS BELOW ======
- */
- function armoryIndex()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $upgradeSpots, $ModName, $mailDays;
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- echo "<fieldset style='width: 50%;'><legend><font style='font-weight: bold; font-size:2em'>†</font></legend>
- <small>Welcome to the {$ModName}'s armory, here people can contribute and give weapons and/or armor to the {$ModName} where people can \"rent\" them to help during wars or just in general!<br /><br />
- [<a href='?p=armoryAdd'>Add an Item</a>]
- </fieldset>
- <table class='table' width='80%' style='text-align: center;'>
- <th colspan='4'>The Armory!</th>
- <tr style='background-color: #FFF;'></tr>
- <th width='20%'>Item Name</th>
- <th width='20%'>\"Rent\" Time</th>
- <th width='20%'>Donated By</th>
- <th width='20%'>Links</th>
- <tr>";
- //get pres and vpres
- $Pres = $db->fetch_row($db->query("SELECT `PRES` FROM `family_mod` WHERE `ID`={$ir['gang']}"));
- $vPres = $db->fetch_row($db->query("SELECT `vPRES` FROM `family_mod` WHERE `ID`={$ir['gang']}"));
- $selectData = $db->query("SELECT * FROM `family_armory` WHERE `FamID`={$ir['gang']}");
- if(!$db->num_rows($selectData))
- {
- echo "<td colspan='4'>Nothing has been added to the Armory!</td>";
- }
- else
- {
- while($r = $db->fetch_row($selectData))
- {
- $i = $db->fetch_row($db->query("SELECT `itmname` FROM `items` WHERE `itmid`={$r['ItemID']}"));
- $user = $db->fetch_row($db->query("SELECT `username`,`userid` FROM `users` WHERE `userid`={$r['Adder']}"));
- $uCheck = ($Pres['PRES'] == $user['userid']) ? "{$Pres_icon} {$user['username']}" : $user['username'];
- $u = ($vPres['vPRES'] <> $user['userid']) ? $uCheck : "{$vPres_icon} {$user['username']}";
- echo "<td>{$i['itmname']}</td>
- <td>{$r['RentTime']} Days</td>
- <td>{$u}</td>
- <td><a href='?p=armoryRent&entry=".base64_encode($r['ID'])."&item=".base64_encode($r['ItemID'])."&adder=".base64_encode($r['Adder'])."'>Rent</a></td>
- <tr>";
- }
- }
- }
- echo "<hr width='45%'>
- [<a href='?p=myFam'>Back</a>]";
- }
- function armoryAdd()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $upgradeSpots, $ModName, $mailDays;
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- if(isset($_POST['add']))
- {
- $_GET['itm'] = abs((int) $_GET['itm']);
- $doTheyHave = $db->query("SELECT `inv_itemid` FROM `inventory` WHERE `inv_itemid`={$_GET['itm']} && `inv_userid`={$ir['userid']}");
- $r = $db->fetch_row($db->query("SELECT `itmname` FROM `items` WHERE `itmid`={$_GET['itm']}"));
- if(!$db->num_rows($doTheyHave))
- {
- echo "You do not have the {$r['itmname']} in your inventory! <br /> [<a href='?p=armoryIndex'>Back</a>]";
- exit();
- }
- if(!in_array($_POST['days'], array(1,7)))
- {
- echo "You can only put it on rent for 1 day or 1 week!<br /> [<a href='?p=armoryIndex'>Back</a>]";
- exit();
- }
- rentedItem($userid, $_GET['itm']);
- echo "<table width='75%'>
- <td style='background-color: #BCED91;'><center>Thanks for your <strong>item</strong>ical help!</center></a></td>
- </table><br />
- You have donated a {$r['itmname']}!";
- //update inventory and insert it into armory
- $db->query("UPDATE `inventory` SET `inv_qty`=`inv_qty`-1 WHERE `inv_itemid`={$_GET['itm']} && `inv_userid`={$ir['userid']}");
- $db->query("INSERT INTO `family_armory` (`ItemID`,`Adder`,`RentTime`,`FamID`) VALUES ({$_GET['itm']}, {$ir['userid']}, {$_POST['days']}, {$ir['gang']})");
- }
- else
- {
- $selectItems = $db->query("SELECT i.*, it.`itmname`,it.`itmid` FROM `inventory` i LEFT JOIN `items` it ON i.`inv_itemid`=it.`itmid` WHERE `inv_userid`={$ir['userid']}");
- if(!$db->num_rows($selectItems))
- {
- echo "You have no items to give!";
- exit();
- }
- else
- {
- echo "<table class='table' width='90%' style='text-align: center;'>
- <th colspan='3'>Your Items!</th>
- <tr style='background-color: #FFF;'></tr>
- <th>Item Name</th>
- <th>Information</th>
- <th>Links</th>
- <tr>";
- while ($r = $db->fetch_row($selectItems))
- {
- echo "<td>{$r['itmname']}</td>
- <td><strong>QTY:</strong> ".number_format($r['inv_qty'])."</td>
- <td><form action='?p=armoryAdd&itm={$r['itmid']}' method='post'>
- <select name='days'>
- <option value='1'>1 day rent
- <option value='7'>A Week
- </option>
- </select>
- <br />
- <input type='submit' value='Give to Armory!' name='add'></form></td>
- <tr>";
- }
- }
- }
- }
- }
- function armoryRent()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $upgradeSpots, $ModName, $mailDays;
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- if(!@$_GET['adder'] || !@$_GET['item'] || !@$_GET['entry'] || base64_decode(is_string(@$_GET['item'])) || base64_decode(is_string(@$_GET['adder'])) || base64_decode(is_string(@$_GET['entry'])))
- {
- echo "Invalid entry!<br />[<a href='?p=myFam'>Back</a>]";
- exit($h->endpage());
- }
- $itemmax = $db->fetch_row($db->query("SELECT ID FROM `family_armory` WHERE `ID`=".base64_decode($_GET['entry']).""));
- $maxP = $db->num_rows($db->query("SELECT `userid` FROM `users` WHERE `gang`={$ir['gang']} && `userid`=".base64_decode($_GET['adder']).""));
- $inFam = $db->num_rows($db->query("SELECT `ID` FROM `family_armory` WHERE `Adder`=".base64_decode(@$_GET['adder'])." && `ItemID`=".base64_decode(@$_GET['item'])." && `ID`=".base64_decode(@$_GET['entry']).""));
- if(base64_decode($_GET['item']) > $itemmax || $maxP === 0 || $inFam === 0)
- {
- echo "Invalid entry!<br />[<a href='?p=myFam'>Back</a>]";
- exit($h->endpage());
- }
- if(base64_decode($_GET['adder']) == $userid)
- {
- echo "Would you like to take back your item?<br />
- [<a href='?p=armoryTakeback&item={$_GET['item']}&entry={$_GET['entry']}'>Yes</a>]
- <br />
- [<a href='?p=myFam'>No</a>]";
- exit($h->endpage());
- }
- else
- {
- $item = base64_decode($_GET['item']);
- $adder = base64_decode($_GET['adder']);
- $entry = base64_decode($_GET['entry']);
- $i = $db->fetch_row($db->query("SELECT `itmname` FROM `items` WHERE `itmid`={$item}"));
- $a = $db->fetch_row($db->query("SELECT `username` FROM `users` WHERE `userid`={$adder}"));
- $info = $db->fetch_row($db->query("SELECT `RentTime` FROM `family_armory` WHERE `ItemID`={$item} && `ID`={$entry} && `Adder`={$adder}"));
- echo "You have rented the {$i['itmname']} from your $ModName!, you have it for {$info['RentTime']} day(s) so please thank {$a['username']} for their contribution!";
- item_add($userid, $item, 1, 0); //remove the ,0 (i added due to another modification i have)!
- $db->query("INSERT INTO `family_armory_rent` VALUES ('null', $item, $userid, {$info['RentTime']})");
- $db->query("DELETE FROM `family_armory` WHERE `ID`={$entry} && `FamID`={$ir['gang']}");
- event_add($adder, "{$ir['username']} has rented your {$i['itmname']} for {$info['RentTime']} days, you will receive it back into your inventory once the time is up!");
- }
- }
- }
- function armoryTakeback()
- {
- global $cost, $startingPlaces, $userid, $db, $ir, $Pres_icon, $vPres_icon, $h, $upgradeSpots, $ModName, $mailDays;
- if(!$ir['gang'])
- {
- echo "<table class='table' width='75%' style='text-align: center;'>
- <th>You are not in a $ModName!</th>
- <tr>
- <td><i>Create a $ModName for just $".number_format($cost)." and have ".number_format($startingPlaces)." free $ModName spots avabliable!</i></th>
- </td>
- </table><br /><br />";
- exit();
- }
- else
- {
- if(!$_GET['item'])
- {
- echo "Invalid item....<br />[<a href='?p=myFam'>Back</a>]";
- exit($h->endpage());
- }
- $theirs = $db->num_rows($db->query("SELECT `ID` FROM `family_armory` WHERE `ID`='".base64_decode($_GET['entry'])."' && `FamID`={$ir['gang']}"));
- if(!$theirs OR base64_decode(is_string($_GET['item'])) OR base64_decode(is_string($_GET['entry'])))
- {
- echo "This item is not yours to take back!<br /> [<a href='?p=myFam'>Back</a>]";
- exit($h->endpage());
- }
- $item = base64_decode($_GET['item']);
- $entry = base64_decode($_GET['entry']);
- $I = $db->fetch_row($db->query("SELECT `itmname` FROM `items` WHERE `itmid`=".base64_decode($_GET['item']).""));
- echo "You have taken back your {$I['itmname']}, thank you for your contribution to the $ModName!<br />[<a href='?p=myFam'>Back</a>]";
- item_add($userid, $item, 1, 0); //remove the ,0 (i added due to another modification i have)!
- $db->query("DELETE FROM `family_armory` WHERE `ID`={$entry} && `FamID`={$ir['gang']}");
- exit($h->endpage());
- }
- }
- $h->endpage();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement