Jump to content
MakeWebGames

Richard

Members
  • Posts

    277
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Richard

  1. Re: [mccodes lite] Gangs Don't worry about it :) Thanks for commenting
  2. Re: [mccodes lite] Gangs manage_faction.php continued: function give_vault() { global $ir,$c,$userid,$h; $sql = sprintf("SELECT * FROM `factions` fa WHERE (faID = %u)", mysql_real_escape_string($ir['faction'])); $q = mysql_query($sql); $r = mysql_fetch_array($q); if ($r['faLEADER'] != $userid) { print " You are not authorised to access this page. <hr width='90%'>> [url='factions.php']Back[/url]<hr width='90%'>"; } else if (($_POST['money'] || $_POST['points']) AND $_POST['user']) { $sql2 = sprintf("SELECT * FROM `users` WHERE (userid = %u)", mysql_real_escape_string($_POST['user'])); $q2 = mysql_query($sql2); $r2 = mysql_fetch_array($q2); if($_POST['money'] > $r['faVAULT']) { print " You are trying to give more money than your faction has. <hr width='90%'>> [url='manage_faction.php?step=give']Back[/url]<hr width='90%'>"; } else if($_POST['points'] > $r['faPOINTS']) { print " You are trying to give more points than your faction has. <hr width='90%'>> [url='manage_faction.php?step=give']Back[/url]<hr width='90%'>"; } else { $fac = sprintf("UPDATE `users` SET crystals=crystals+%d, money=money+%d WHERE (userid = %u)", mysql_real_escape_string($_POST['points']), mysql_real_escape_string($_POST['money']), mysql_real_escape_string($_POST['user'])); $use = sprintf("UPDATE `factions` SET faVAULT = faVAULT - %d, faPOINTS = faPOINTS - %d WHERE (faID = %u)", mysql_real_escape_string($_POST['money']), mysql_real_escape_string($_POST['points']), mysql_real_escape_string($ir['faction'])); mysql_query($fac); mysql_query($use); print " You gave ".money_formatter($_POST['money'])." and {$_POST['points']} Points to [url='viewuser.php?u={$r2[']{$r2['username']}[/url]. <hr width='90%'>> [url='manage_faction.php?step=give']Back[/url]<hr width='90%'>"; } } else { print " <form action='manage_faction.php?step=give' method='post'> <table width='50%' cellspacing='1'> <tr bgcolor='#AAAAAA'><th colspan='2'>Faction Vault</th></tr> <tr bgcolor='#DFDFDF' height='100'><td align='center' colspan='2'>Your faction vault currently contains ".money_formatter($r['faVAULT'])." and {$r['faPOINTS']} Points.</td></tr> <tr bgcolor='#AAAAAA'><th colspan='2'>Give</th></tr> <tr bgcolor='#DFDFDF'><td align='center'> Money: <input type='text' name='money'> </td> <td align='center'> Points: <input type='text' name='points'> </td> </tr> <tr bgcolor='#DFDFDF'><td colspan='2' align='center' height='50'> <select name='user' type='dropdown'>"; $users = sprintf("SELECT * FROM `users` WHERE (faction = %u)", mysql_real_escape_string($ir['faction'])); $use = mysql_query($users); while($us = mysql_fetch_array($use)) { print "<option value='{$us['userid']}'>{$us['username']}</option>"; } print "</select></td></tr> <tr bgcolor='#AAAAAA'><th colspan='2'><input type='submit' value='Give'></th></tr> </table> <hr width='90%'>> [url='manage_faction.php']Back[/url]<hr width='90%'>"; } } function app_manage() { global $ir,$c,$userid,$h; $sql = sprintf("SELECT * FROM `factions` fa WHERE (faID = %u)", mysql_real_escape_string($ir['faction'])); $q = mysql_query($sql); $r = mysql_fetch_array($q); if ($r['faLEADER'] != $userid) { print " You are not authorised to access this page. <hr width='90%'>> [url='factions.php']Back[/url]<hr width='90%'>"; } else if (!$_GET['act']) { $sql2 = sprintf("SELECT * FROM `faction_apps` fp LEFT JOIN `users` u ON (u.userid = fp.fpUSER) LEFT JOIN `factions` fa ON (fa.faID = fp.fpFACTION) WHERE (fp.fpFACTION = %u)", mysql_real_escape_string($ir['faction'])); $q2 = mysql_query($sql2); print "This is a list of all applications to your faction. <table width='90%' cellspacing='1'><tr bgcolor='#AAAAAA'><th width='15%'>User</th><th width='50%'>Application</th><th width='15%'>Time</th><th width='20%'>Manage</th></tr>"; while($r2 = mysql_fetch_array($q2)) { print "<tr><td>[url='viewuser.php?u={$r2[']{$r2['username']}[/url]</td> <td>{$r2['fpAPP']}</td> <td>".date('F j Y, g:i:s a',$r2['fpTIME'])."</td> <td>[[url='manage_faction.php?step=apps&act=accept&ID={$r2[']Accept[/url] | [url='manage_faction.php?step=apps&act=decline&ID={$r2[']Decline[/url]]</td></tr>"; } print "</table> <hr width='90%'>> [url='manage_faction.php']Back[/url]<hr width='90%'>"; } else if ($_GET['act'] == 'accept') { if ($_GET['ID']) { $sql2 = sprintf("SELECT * FROM `faction_apps` fp LEFT JOIN `users` u ON (u.userid = fp.fpUSER) LEFT JOIN `factions` fa ON (fa.faID = fp.fpFACTION) WHERE (fp.fpFACTION = %u)", mysql_real_escape_string($ir['faction'])); $q2 = mysql_query($sql2); $r2 = mysql_fetch_array($q2); $sql3 = sprintf("UPDATE `users` SET `faction` = '%s' WHERE (`userid` = %u)", mysql_escape_string($r2['fpFACTION']), $r2['fpUSER']); mysql_query($sql3); $sql4 = sprintf("DELETE FROM `faction_apps` WHERE (`fpID` = %u)", mysql_escape_string($_GET['ID'])); mysql_query($sql4); print " [url='viewuser.php?u={$r2[']{$r2['username']}[/url] was accepted into your faction! <hr width='90%'>> [url='manage_faction.php']Back[/url]<hr width='90%'>"; } else { print " Invalid application ID! <hr width='90%'>> [url='manage_faction.php?step=pref']Back[/url]<hr width='90%'>"; } } else if ($_GET['act'] == 'decline') { if ($_GET['ID']) { $sql2 = sprintf("SELECT * FROM `faction_apps` fp LEFT JOIN `users` u ON (u.userid = fp.fpUSER) LEFT JOIN `factions` fa ON (fa.faID = fp.fpFACTION) WHERE (fp.fpFACTION = %u)", mysql_real_escape_string($ir['faction'])); $q2 = mysql_query($sql2); $r2 = mysql_fetch_array($q2); $sql4 = sprintf("DELETE FROM `faction_apps` WHERE (`fpID` = %u)", mysql_escape_string($_GET['ID'])); mysql_query($sql4); print " [url='viewuser.php?u={$r2[']{$r2['username']}[/url]'s application was denied! <hr width='90%'>> [url='manage_faction.php']Back[/url]<hr width='90%'>"; } else { print " Invalid application ID! <hr width='90%'>> [url='manage_faction.php?step=pref']Back[/url]<hr width='90%'>"; } } } function leave_faction() { global $ir,$c,$userid,$h; $sql = sprintf("SELECT * FROM `factions` fa WHERE (faID = %u)", mysql_real_escape_string($ir['faction'])); $q = mysql_query($sql); $r = mysql_fetch_array($q); if (!$_GET['act']) { print " Would you like to leave the {$r['faNAME']} faction: <form action='manage_faction.php?step=leave&act=conf' method='post'> <input type='submit' value='Leave'></form> <hr width='90%'>> [url='manage_faction.php']Back[/url]<hr width='90%'>"; } else if ($_GET['act'] == 'conf') { if ($_POST['user'] AND ($r['faLEADER'] != $_POST['user']) AND ($r['faCOLEADER'] != $_POST['user'])) { $sql3 = sprintf("UPDATE `users` SET `faction` = '%d' WHERE (`userid` = %u)", 0, $userid); mysql_query($sql3); print " You left the faction! <hr width='90%'>> [url='explore.php']Back[/url]<hr width='90%'>"; } else { print " You cannot leave while you are still leader or co-leader! <hr width='90%'>> [url='manage_faction.php']Back[/url]<hr width='90%'>"; } } } function kick_member() { global $ir,$c,$userid,$h; $sql = sprintf("SELECT * FROM `factions` fa WHERE (faID = %u)", mysql_real_escape_string($ir['faction'])); $q = mysql_query($sql); $r = mysql_fetch_array($q); if ($r['faLEADER'] != $userid) { print " You are not authorised to access this page. <hr width='90%'>> [url='factions.php']Back[/url]<hr width='90%'>"; } else if (!$_GET['act']) { print " Please select a faction member to kick out: <form action='manage_faction.php?step=kick&act=submit' method='post'> <select name='user' type='dropdown'>"; $users = sprintf("SELECT * FROM `users` WHERE (faction = %u)", mysql_real_escape_string($ir['faction'])); $use = mysql_query($users); while($us = mysql_fetch_array($use)) { print "<option value='{$us['userid']}'>{$us['username']}</option>"; } print "</select> <input type='submit' value='Kick'></form> <hr width='90%'>> [url='manage_faction.php']Back[/url]<hr width='90%'>"; } else if ($_GET['act'] == 'submit') { if ($_POST['user'] AND ($r['faLEADER'] != $_POST['user']) AND ($r['faCOLEADER'] != $_POST['user'])) { $sql3 = sprintf("UPDATE `users` SET `faction` = '%d' WHERE (`userid` = %u)", 0, $_POST['user']); mysql_query($sql3); print " This user was kicked out of the faction! <hr width='90%'>> [url='manage_faction.php']Back[/url]<hr width='90%'>"; } else { print " You did not select a user to kick out! <hr width='90%'>> [url='manage_faction.php?step=kick']Back[/url]<hr width='90%'>"; } } } $h->endpage(); ?>   Find in attacklost.php $expgainp=round($expgain/$ir['exp_needed']*100,4); print " and lost $expgainp% EXP!";   Add below: if ($ir['faction'] AND $r['faction']) { mysql_query("UPDATE factions SET faREPUTATION=faREPUTATION-1 WHERE faID={$ir['faction']}",$c); mysql_query("UPDATE factions SET faREPUTATION=faREPUTATION+1 WHERE faID={$r['faction']}",$c); mysql_query("UPDATE factions SET faCHAIN=faCHAIN+1 WHERE faID={$r['faction']}",$c); mysql_query("UPDATE factions SET faBCHAIN=faCHAIN WHERE faCHAIN > faBCHAIN faID={$ir['faction']}",$c); mysql_query("UPDATE factions SET faCHAIN=0 WHERE faID={$ir['faction']}",$c); print " You have lost <font color='red'>-1</font> Reputation for your faction and broken your chain."; }   Find in attackwon.php print " and gained $expperc% EXP!"; mysql_query("UPDATE users SET exp=exp+$expgain,money=money+$stole WHERE userid=$userid",$c);   Add below: if ($ir['faction'] AND $r['faction']) { mysql_query("UPDATE factions SET faREPUTATION=faREPUTATION-1 WHERE faID={$r['faction']}",$c); mysql_query("UPDATE factions SET faREPUTATION=faREPUTATION+1 WHERE faID={$ir['faction']}",$c); mysql_query("UPDATE factions SET faCHAIN=faCHAIN+1 WHERE faID={$ir['faction']}",$c); mysql_query("UPDATE factions SET faBCHAIN=faCHAIN WHERE faCHAIN > faBCHAIN faID={$r['faction']}",$c); mysql_query("UPDATE factions SET faCHAIN=0 WHERE faID={$r['faction']}",$c); print " You have gained <font color='green'>+1</font> Reputation for your faction."; }   Add into mainmenu.php if($ir['faction']) { print "[url='manage_faction.php']Your Faction[/url] "; }   Add into explore.php [url='factions.php?step=create']Create Faction[/url] [url='factions.php']View Factions[/url] [url='factions.php?step=search']Search Factions[/url] [url='manage_faction.php']Your Faction[/url]
  3. Re: [mccodes lite] Gangs Create manage_faction.php <?php session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm); $h->menuarea(); print "<font face='Arial' size='4'>Your Faction</font><hr width='90%'>"; if (!$ir['faction']) { die (" You are not in a faction at this time. <hr width='90%'>> [url='explore.php']Back[/url]<hr width='90%'>"); } switch ($_GET['step']) { case 'name': change_name(); break; case 'desc': change_desc(); break; case 'vault': faction_vault(); break; case 'donate': donate_vault(); break; case 'status': change_status(); break; case 'give': give_vault(); break; case 'leave': leave_faction(); break; case 'image': change_image(); break; case 'pref': change_pref(); break; case 'coleader': change_coleader(); break; case 'apps': app_manage(); break; case 'kick': kick_member(); break; default: leader_panel(); break; } function leader_panel() { global $ir,$c,$userid,$h; print " <table width='50%' cellspacing='1'> <tr><td align='center' width='50%'>[b]Leader Options[/b]</td> <td align='center' width='50%'>[b]Member Options[/b]</td></tr> <tr><td align='left' valign='top'> > [url='manage_faction.php?step=name']Change Name[/url] > [url='manage_faction.php?step=desc']Change Description[/url] > [url='manage_faction.php?step=status']Change Status[/url] > [url='manage_faction.php?step=image']Change Image[/url] > [url='manage_faction.php?step=pref']Change Prefix[/url] > [url='manage_faction.php?step=coleader']Change Co-Leader[/url] > [url='manage_faction.php?step=give']Give Money / Points[/url] > [url='manage_faction.php?step=apps']Manage Apps[/url] > [url='manage_faction.php?step=kick']Kick Member[/url] </td><td align='right' valign='top'> [url='manage_faction.php?step=vault']Faction Vault[/url] < [url='manage_faction.php?step=leave']Leave Faction[/url] <</td></tr> </table> <hr width='90%'>> [url='factions.php']Back[/url]<hr width='90%'>"; } function change_name() { global $ir,$c,$userid,$h; $sql = sprintf("SELECT * FROM `factions` fa WHERE (faID = %u)", mysql_real_escape_string($ir['faction'])); $q = mysql_query($sql); $r = mysql_fetch_array($q); if ($r['faLEADER'] != $userid) { print " You are not authorised to access this page. <hr width='90%'>> [url='factions.php']Back[/url]<hr width='90%'>"; } else if (!$_GET['act']) { print " Please type a new faction name below: <form action='manage_faction.php?step=name&act=submit' method='post'> <input type='text' name='name'> <input type='submit' value='Change'></form> <hr width='90%'>> [url='manage_faction.php']Back[/url]<hr width='90%'>"; } else if ($_GET['act'] == 'submit') { $sql2 = sprintf("SELECT * FROM `factions` WHERE (`faNAME` LIKE '%%%s%%')", mysql_real_escape_string($_POST['name'])); $cn = mysql_query($sql2); $rows = mysql_num_rows($cn); if ($_POST['name'] AND !$rows) { $sql3 = sprintf("UPDATE `factions` SET `faNAME` = '%s' WHERE (`faID` = %u)", mysql_escape_string($_POST['name']), $ir['faction']); mysql_query($sql3); print " Faction name changed to {$_POST['name']}! <hr width='90%'>> [url='manage_faction.php']Back[/url]<hr width='90%'>"; } else { print " You did not type a new name or the faction name is already taken! <hr width='90%'>> [url='manage_faction.php?step=name']Back[/url]<hr width='90%'>"; } } } function change_desc() { global $ir,$c,$userid,$h; $sql = sprintf("SELECT * FROM `factions` fa WHERE (faID = %u)", mysql_real_escape_string($ir['faction'])); $q = mysql_query($sql); $r = mysql_fetch_array($q); if ($r['faLEADER'] != $userid) { print " You are not authorised to access this page. <hr width='90%'>> [url='factions.php']Back[/url]<hr width='90%'>"; } else if (!$_GET['act']) { print " Please type a new faction description below: <form action='manage_faction.php?step=desc&act=submit' method='post'> <textarea type='text' name='desc' cols='50' rows='8'>{$r['faDESC']}</textarea> <input type='submit' value='Change'></form> <hr width='90%'>> [url='manage_faction.php']Back[/url]<hr width='90%'>"; } else if ($_GET['act'] == 'submit') { if ($_POST['desc']) { $sql3 = sprintf("UPDATE `factions` SET `faDESC` = '%s' WHERE (`faID` = %u)", mysql_escape_string($_POST['desc']), $ir['faction']); mysql_query($sql3); print " Faction description changed! <hr width='90%'>> [url='manage_faction.php']Back[/url]<hr width='90%'>"; } else { print " You did not type a new faction description! <hr width='90%'>> [url='manage_faction.php?step=desc']Back[/url]<hr width='90%'>"; } } } function change_status() { global $ir,$c,$userid,$h; $sql = sprintf("SELECT * FROM `factions` fa WHERE (faID = %u)", mysql_real_escape_string($ir['faction'])); $q = mysql_query($sql); $r = mysql_fetch_array($q); if ($r['faLEADER'] != $userid) { print " You are not authorised to access this page. <hr width='90%'>> [url='factions.php']Back[/url]<hr width='90%'>"; } else if (!$_GET['act']) { print " Please select a new faction status below: <form action='manage_faction.php?step=status&act=submit' method='post'> <select name='status' type='dropdown'> <option value='Peaceful'>Peaceful</option> <option value='Aggressive'>Aggressive</option> </select> <input type='submit' value='Change'></form> <hr width='90%'>> [url='manage_faction.php']Back[/url]<hr width='90%'>"; } else if ($_GET['act'] == 'submit') { if ($_POST['status']) { $sql3 = sprintf("UPDATE `factions` SET `faSTATUS` = '%s' WHERE (`faID` = %u)", mysql_escape_string($_POST['status']), $ir['faction']); mysql_query($sql3); print " Faction status changed! <hr width='90%'>> [url='manage_faction.php']Back[/url]<hr width='90%'>"; } else { print " You did not select a new faction status! <hr width='90%'>> [url='manage_faction.php?step=status']Back[/url]<hr width='90%'>"; } } } function change_image() { global $ir,$c,$userid,$h; $sql = sprintf("SELECT * FROM `factions` fa WHERE (faID = %u)", mysql_real_escape_string($ir['faction'])); $q = mysql_query($sql); $r = mysql_fetch_array($q); if ($r['faLEADER'] != $userid) { print " You are not authorised to access this page. <hr width='90%'>> [url='factions.php']Back[/url]<hr width='90%'>"; } else if (!$_GET['act']) { print " Please type a new faction image location below: <form action='manage_faction.php?step=image&act=submit' method='post'> <input type='text' name='image'> <input type='submit' value='Change'></form> <hr width='90%'>> [url='manage_faction.php']Back[/url]<hr width='90%'>"; } else if ($_GET['act'] == 'submit') { if ($_POST['image']) { $sql3 = sprintf("UPDATE `factions` SET `faIMAGE` = '%s' WHERE (`faID` = %u)", mysql_escape_string($_POST['image']), $ir['faction']); mysql_query($sql3); print " Faction image changed! <hr width='90%'>> [url='manage_faction.php']Back[/url]<hr width='90%'>"; } else { print " You did not type a new faction image location! <hr width='90%'>> [url='manage_faction.php?step=image']Back[/url]<hr width='90%'>"; } } } function change_pref() { global $ir,$c,$userid,$h; $sql = sprintf("SELECT * FROM `factions` fa WHERE (faID = %u)", mysql_real_escape_string($ir['faction'])); $q = mysql_query($sql); $r = mysql_fetch_array($q); if ($r['faLEADER'] != $userid) { print " You are not authorised to access this page. <hr width='90%'>> [url='factions.php']Back[/url]<hr width='90%'>"; } else if (!$_GET['act']) { print " Please type a new faction prefix below: <form action='manage_faction.php?step=pref&act=submit' method='post'> <input type='text' name='pref'> <input type='submit' value='Change'></form> <hr width='90%'>> [url='manage_faction.php']Back[/url]<hr width='90%'>"; } else if ($_GET['act'] == 'submit') { if ($_POST['pref']) { $sql3 = sprintf("UPDATE `factions` SET `faPREF` = '%s' WHERE (`faID` = %u)", mysql_escape_string($_POST['pref']), $ir['faction']); mysql_query($sql3); print " Faction prefix changed! <hr width='90%'>> [url='manage_faction.php']Back[/url]<hr width='90%'>"; } else { print " You did not type a new faction prefix! <hr width='90%'>> [url='manage_faction.php?step=pref']Back[/url]<hr width='90%'>"; } } } function change_coleader() { global $ir,$c,$userid,$h; $sql = sprintf("SELECT * FROM `factions` fa WHERE (faID = %u)", mysql_real_escape_string($ir['faction'])); $q = mysql_query($sql); $r = mysql_fetch_array($q); if ($r['faLEADER'] != $userid) { print " You are not authorised to access this page. <hr width='90%'>> [url='factions.php']Back[/url]<hr width='90%'>"; } else if (!$_GET['act']) { print " Please select a new faction co-leader below: <form action='manage_faction.php?step=coleader&act=submit' method='post'> <select name='user' type='dropdown'>"; $users = sprintf("SELECT * FROM `users` WHERE (faction = %u)", mysql_real_escape_string($ir['faction'])); $use = mysql_query($users); while($us = mysql_fetch_array($use)) { print "<option value='{$us['userid']}'>{$us['username']}</option>"; } print "</select> <input type='submit' value='Change'></form> <hr width='90%'>> [url='manage_faction.php']Back[/url]<hr width='90%'>"; } else if ($_GET['act'] == 'submit') { if ($_POST['user']) { $sql3 = sprintf("UPDATE `factions` SET `faCOLEADER` = '%s' WHERE (`faID` = %u)", mysql_escape_string($_POST['user']), $ir['faction']); mysql_query($sql3); print " Faction co-leader changed! <hr width='90%'>> [url='manage_faction.php']Back[/url]<hr width='90%'>"; } else { print " You did not select a new faction co-leader! <hr width='90%'>> [url='manage_faction.php?step=coleader']Back[/url]<hr width='90%'>"; } } } function faction_vault() { global $ir,$c,$userid,$h; $sql = sprintf("SELECT * FROM `factions` fa WHERE (faID = %u)", mysql_real_escape_string($ir['faction'])); $q = mysql_query($sql); $r = mysql_fetch_array($q); print "<form action='manage_faction.php?step=donate' method='post'> <table width='50%' cellspacing='1'> <tr bgcolor='#AAAAAA'><th colspan='2'>Faction Vault</th></tr> <tr bgcolor='#DFDFDF' height='100'><td align='center' colspan='2'>Your faction vault currently contains ".money_formatter($r['faVAULT'])." and {$r['faPOINTS']} Points.</td></tr> <tr bgcolor='#AAAAAA'><th colspan='2'>Donate</th></tr> <tr bgcolor='#DFDFDF'><td align='center'> Money: <input type='text' name='money'> </td> <td align='center'> Points: <input type='text' name='points'> </td> </tr> <tr bgcolor='#AAAAAA'><th colspan='2'><input type='submit' value='Donate'></th></tr> </table><hr width='90%'>> [url='manage_faction.php']Back[/url]<hr width='90%'>"; } function donate_vault() { global $ir,$c,$userid,$h; $sql = sprintf("SELECT * FROM `factions` fa WHERE (faID = %u)", mysql_real_escape_string($ir['faction'])); $q = mysql_query($sql); $r = mysql_fetch_array($q); if ($_POST['money'] || $_POST['points']) { if($_POST['money'] > $ir['money']) { print " You are trying to donate more money than you have. <hr width='90%'>> [url='manage_faction.php?step=vault']Back[/url]<hr width='90%'>"; } else if($_POST['points'] > $ir['crystals']) { print " You are trying to donate more Points than you have. <hr width='90%'>> [url='manage_faction.php?step=vault']Back[/url]<hr width='90%'>"; } else { $fac = sprintf("UPDATE `users` SET crystals=crystals-%d, money=money-%d WHERE (userid = %u)", mysql_real_escape_string($_POST['points']), mysql_real_escape_string($_POST['money']), $userid); $use = sprintf("UPDATE `factions` SET faVAULT = faVAULT + %d, faPOINTS = faPOINTS + %d WHERE (faID = %u)", mysql_real_escape_string($_POST['money']), mysql_real_escape_string($_POST['points']), mysql_real_escape_string($ir['faction'])); mysql_query($fac); mysql_query($use); print " You donated ".money_formatter($_POST['money'])." and {$_POST['points']} Points to the faction. <hr width='90%'>> [url='manage_faction.php?step=vault']Back[/url]<hr width='90%'>"; } } else { print " You did not type an amount of money to donate to the faction. <hr width='90%'>> [url='manage_faction.php?step=vault']Back[/url]<hr width='90%'>"; } }
  4. This is a very basic Factions modifcation I created for Mccodes Lite. Like an idiot I decided to copy tc again, so I suggest if you use this you edit the look of it alot. It is basically just a start at the moment, hopefully somebody will add to it. Enjoy! Run SQL: ALTER TABLE users ADD faction INT(11) NOT NULL DEFAULT 0; ALTER TABLE users ADD faction_days INT(11) NOT NULL DEFAULT 0; CREATE TABLE `factions` ( `faID` int(11) NOT NULL auto_increment, `faNAME` varchar(255) NOT NULL default '', `faDESC` text NOT NULL, `faSTATUS` enum('Peaceful','Aggressive') NOT NULL, `faIMAGE` varchar(255) NOT NULL, `faPREF` varchar(12) NOT NULL default '', `faVAULT` int(11) NOT NULL default '0', `faPOINTS` int(11) NOT NULL default '0', `faCHAIN` int(11) NOT NULL, `faBCHAIN` int(11) NOT NULL, `faREPUTATION` int(11) NOT NULL default '0', `faLEADER` int(11) NOT NULL default '0', `faCOLEADER` int(11) NOT NULL default '0', `faCAPACITY` int(11) NOT NULL default '0', `faCRIME` int(11) NOT NULL default '0', `faTIME` int(11) NOT NULL default '0', PRIMARY KEY (`faID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE `faction_apps` ( `fpID` int(11) NOT NULL auto_increment, `fpUSER` int(11) NOT NULL, `fpFACTION` int(11) NOT NULL, `fpAPP` varchar(255) NOT NULL, `fpTIME` int(11) NOT NULL, PRIMARY KEY (`fpID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; Create factions.php <?php session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm); $h->menuarea(); print "<font face='Arial' size='4'>Factions</font><hr width='90%'>"; switch ($_GET['step']) { case 'create': create_faction(); break; case 'profile': faction_profile(); break; case 'users': faction_members(); break; case 'search': search_factions(); break; case 'apply': faction_apply(); break; default: factions_index(); break; } function factions_index() { global $ir,$c,$userid,$h; $sql = sprintf("SELECT * FROM `factions` fa LEFT JOIN `users` u ON (u.userid = fa.faLEADER) ORDER BY faID DESC"); $q = mysql_query($sql); print "This is a list of all factions by ID <table width='90%' cellspacing='1'><tr bgcolor='#AAAAAA'><th width='25%'>Name</th><th width='13%'>Members</th><th width='12%'>Reputation</th><th width='50%'>Image</th></tr>"; while($r = mysql_fetch_array($q)) { print "<tr><td>[url='factions.php?step=profile&ID={$r[']<h3>{$r['faNAME']}</h3>[/url]</td><td>"; $membs = sprintf("SELECT * FROM `users` WHERE faction = %u", mysql_real_escape_string($r['faID'])); $mems = mysql_query($membs); print mysql_num_rows($mems)."</td> <td>{$r['faREPUTATION']}</td> <td>[img={$r[]</td></tr>"; } print "</table> <hr width='90%'>> [url='explore.php']Back[/url]<hr width='90%'>"; } function create_faction() { global $ir,$c,$userid,$h; $sql = sprintf("SELECT * FROM `factions` WHERE faID > 0"); $q = mysql_query($sql); $fcs = mysql_num_rows($q); $r['faCOST'] = ($fcs*10000); if($ir['money'] < $r['faCOST']) { print " You don't have enough money. It costs ".money_formatter($r['faCOST'])." to create a new Faction. <hr width='90%'>> [url='explore.php']Back[/url]<hr width='90%'>"; } else if($ir['faction'] > 0) { print " You are already part of a Faction. Leave before creating a new one. <hr width='90%'>> [url='explore.php']Back[/url]<hr width='90%'>"; } else if($_POST['name'] AND $_POST['description'] AND $_POST['status']) { $ins = sprintf("INSERT INTO `factions` (`faID`, `faNAME`, `faDESC`, `faSTATUS`, `faLEADER`, `faCOLEADER`, `faCAPACITY`, `faREPUTATION`) VALUES ('NULL','%s', '%s', '%s', '%d', '%d', '%d', '%d')", mysql_real_escape_string($_POST['name']), mysql_real_escape_string($_POST['description']), mysql_real_escape_string($_POST['status']), $userid, $userid, 10, 100); mysql_query($ins); $r['insID'] = mysql_insert_id($c); $fac = sprintf("UPDATE `users` SET faction = %d, money=money-%d WHERE (userid = %u)", $r['insID'], $r['faCOST'], $userid); mysql_query($fac); print " The {$_POST['name']} faction was successfully created. <hr width='90%'>> [url='factions.php?step=manage']Back[/url]<hr width='90%'>"; } else { print " <form action='factions.php?step=create' method='post'> A new faction will cost $10,000 times the amount of factions in existence. The current price is [b]".money_formatter($r['faCOST'])."[/b]. Name your Faction <input type='text' name='name' /> Choose a Status <select type='dropdown' name='status'> <option value='Peaceful'>Peaceful</option> <option value='Aggressive'>Aggressive</option> </select> Description <textarea name='description' cols='40' rows='7'></textarea> <input type='submit' value='Create' /></form> <hr width='90%'>> [url='factions.php']Back[/url]<hr width='90%'>"; } } function faction_profile() { global $ir,$c,$userid,$h; $sql = sprintf("SELECT * FROM `factions` fa LEFT JOIN `users` u ON (u.userid = fa.faLEADER) WHERE (fa.faID = %u)", mysql_real_escape_string($_GET['ID'])); $q = mysql_query($sql); $r = mysql_fetch_array($q); print " <table width='400' bgcolor='#DFDFDF'><tr><td align='center'>[b]<font size='5'>{$r['faNAME']}</font>[/b]</td></tr></table> [img={$r[] <table width='400' bgcolor='#DFDFDF'><tr><td valign='middle' align='center'><font size='5'>[b]{$r['faREPUTATION']}[/b]</font></td></tr></table> <table width='400' bgcolor='#DFDFDF'><tr><td width='200' valign='middle'> [b]Leader: [/b][url='viewuser.php?u={$r[']{$r['username']}[/url] "; $col = sprintf("SELECT * FROM `users` WHERE (userid = %u)", mysql_real_escape_string($r['faCOLEADER'])); $q2 = mysql_query($col); $co = mysql_fetch_array($q2); print "[b]Co-Leader: [/b][url='viewuser.php?u={$r[']{$co['username']}[/url] "; $membs = sprintf("SELECT * FROM `users` WHERE faction = %u", mysql_real_escape_string($r['faID'])); $mems = mysql_query($membs); print "[b]Members: [/b]".mysql_num_rows($mems)." [b]Reputation: [/b]{$r['faREPUTATION']} [b]Current chain: [/b]{$r['faCHAIN']} attacks [b]Best chain: [/b]{$r['faBCHAIN']} attacks [b]Status: [/b]"; if ($r['faSTATUS'] == 'Peaceful') { print "<font color='green'>[b]Peaceful[/b]</font>"; } else { print "<font color='red'>[b]Aggressive[/b]</font>"; } print " </td> <td valign='top' align='right' width='200'>[url='factions.php?step=users&ID={$r[']User list[/url] < [url='factions.php?step=apply&ID={$r[']Apply[/url] < </td></tr></table> <table width='400' bgcolor='#DFDFDF'><tr> <td width='50%' height='100%'> <table width='100%' height='100%'><tr> <td align='center'> {$r['faDESC']} </td> </tr></table></td></tr></table> <hr width='90%'>> [url='factions.php']Back[/url]<hr width='90%'>"; } function faction_members() { global $ir,$c,$userid,$h; $sql = sprintf("SELECT * FROM `factions` fa LEFT JOIN `users` u ON (u.faction = fa.faID) WHERE (fa.faID = %u)", mysql_real_escape_string($_GET['ID'])); $q = mysql_query($sql); print "<table width='90%' cellspacing='1'><tr bgcolor='#AAAAAA'><th width='25%'>Num</th><th width='25%'>Name</th><th width='25%'>Level</th><th width='25%'>Days in Faction</th></tr>"; while ($r = mysql_fetch_array($q)) { $cn++; print "<tr><td>$cn.</td><td>[url='viewuser.php?u={$r[']{$r['username']}[/url]</td><td>{$r['level']}</td><td>{$r['faction_days']}</td></tr>"; } print "</table> <hr width='90%'>> [url='factions.php?step=profile&ID={$_GET[']Back[/url]<hr width='90%'>"; } function search_factions() { global $ir,$c,$userid,$h; if (!$_POST['name']) { print "<form action='factions.php?step=search' method='post'> [b]Search by Keyword[/b] Insert the keyword that you'd like to search for Factions: <input type='text' name='name'> <input type='submit' value='Search'></form> <hr width='90%'>> [url='factions.php']Back[/url]<hr width='90%'>"; } else { $sql = sprintf("SELECT * FROM `factions` fa LEFT JOIN `users` u ON (u.userid = fa.faLEADER) WHERE (`faNAME` LIKE '%%%s%%')", mysql_real_escape_string($_POST['name'])); $q = mysql_query($sql); print "[b]Search by Keyword[/b] Keyword: {$_POST['name']} <table width='90%' cellspacing='1'><tr bgcolor='#AAAAAA'><th width='25%'>Name</th><th width='13%'>Members</th><th width='12%'>Reputation</th><th width='50%'>Image</th></tr>"; while($r = mysql_fetch_array($q)) { print "<tr><td>[url='factions.php?step=profile&ID={$r[']<h3>{$r['faNAME']}</h3>[/url]</td><td>"; $membs = sprintf("SELECT * FROM `users` WHERE faction = %u", mysql_real_escape_string($r['faID'])); $mems = mysql_query($membs); print mysql_num_rows($mems)."</td> <td>{$r['faREPUTATION']}</td> <td>[img={$r[]</td></tr>"; } print "</table> <hr width='90%'>> [url='factions.php?step=search']Back[/url]<hr width='90%'>"; } } function faction_apply() { global $ir,$c,$userid,$h; if ($ir['faction']) { print " You are already in a faction at this time. <hr width='90%'>> [url='factions.php']Back[/url]<hr width='90%'>"; } else if (!$_GET['act']) { print " Please type an application to this faction below: <form action='factions.php?step=apply&act=submit&ID={$_GET['ID']}' method='post'> <textarea type='text' name='app' cols='50' rows='8'>Type your application here</textarea> <input type='submit' value='Submit'></form> <hr width='90%'>> [url='factions.php?step=profile&ID={$_GET[']Back[/url]<hr width='90%'>"; } else if ($_GET['act'] == 'submit') { if ($_POST['app']) { $ins = sprintf("INSERT INTO `faction_apps` (`fpID`, `fpUSER`, `fpFACTION`, `fpAPP`, `fpTIME`) VALUES ('NULL','%d', '%d', '%s', '%d')", mysql_real_escape_string($ir['userid']), mysql_real_escape_string($_GET['ID']), mysql_real_escape_string($_POST['app']), time()); mysql_query($ins); print " Your application was submitted! <hr width='90%'>> [url='factions.php?step=profile&ID={$_GET[']Back[/url]<hr width='90%'>"; } else { print " You did not type an application to send! <hr width='90%'>> [url='factions.php?step=apply&ID={$_GET[']Back[/url]<hr width='90%'>"; } } } $h->endpage(); ?>
  5. Re: free free crystal market for lite Looks exactly like the V1 Crystal Market and it requires SQL.
  6. Re: Basic Forums [LITE / V1] Seeing as I cant update the orignal post now I'll post this here. I've updated a couple of things. - Staff Delete Topics & Posts - Little it tidier   <?php session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm); $h->menuarea(); print "<font face='Arial' size='4'>Forums</font><hr width='90%'>"; if ($ir['forum_ban']) { die (" You are banned from the forums for ".number_format($ir['forum_ban'])." more days. The reason for this is {$ir['forum_reason']}. <hr width='90%'>> [url='explore.php']Back[/url]<hr width='90%'>"); } switch ($_GET['view']) { case 'topic': view_topic(); break; case 'section': view_section(); break; case 'reply': reply_forum(); break; case 'edit': edit_reply(); break; case 'editpost': edit_message(); break; case 'delpost': delete_post(); break; case 'deltop': delete_topic(); break; case 'newtopic': create_topic(); break; case 'newsect': create_section(); break; default: forums_index(); break; } function forums_index() { global $ir,$c,$userid,$h; $sql = sprintf("SELECT * FROM `forums_sections` fs LEFT JOIN `users` u ON (u.userid = fs.fsCREATOR) ORDER BY fs.fsID DESC"); $sql = mysql_query($sql); print "<table width='90%' cellspacing='1'><tr bgcolor='#AAAAAA'><td colspan='4'>[b]Public Forums[/b]"; if ($ir['user_level'] == '2') { print " >> [[url='forums.php?view=newsect'][b]New Forum[/url]][/b]"; } print "</td></tr>"; while($r = mysql_fetch_array($sql)) { print "<tr><td width='50%'>[url='forums.php?view=section&ID={$r[']{$r['fsNAME']}[/url] [size="1"][i]{$r['fsDESC']}[/i][/size]</td> <td width='25%'>Started by [url='viewuser.php?u={$r[']{$r['username']}[/url]</td> <td width='25%'>{$r['fsPOSTS']} Topics</td></tr>"; } print "</table><hr width='90%'>"; } function view_section() { global $ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); $sql = sprintf("SELECT * FROM `forums_topics` ft LEFT JOIN `users` u ON (u.userid = ft.ftUSER) LEFT JOIN `forums_sections` fs ON (fs.fsID = ft.ftFORUM) WHERE (ft.ftFORUM = %u)", $_GET['ID']); $sql = mysql_query($sql); print "<table width='90%' cellspacing='1'><tr bgcolor='#AAAAAA'><td colspan='3'>[b][url='forums.php']Public Forums[/url] >> [[url='forums.php?view=newtopic'][b]New Topic[/url]][/b]</td></tr>"; while($r = mysql_fetch_array($sql)) { print "<tr><td width='50%'>[url='forums.php?view=topic&ID={$r[']{$r['ftNAME']}[/url]"; if ($r['fpUSER'] == $ir['userid'] || $ir['user_level'] == 2) { print " [[url='forums.php?view=deltop&ID={$r[']Delete[/url]]"; } print " [size="1"][i]{$r['ftDESC']}[/i][/size]</td> <td width='25%'>Started by [url='viewuser.php?u={$r[']{$r['username']}[/url]</td> <td width='25%'>{$r['ftPOSTS']} Posts</td></tr>"; } print "</table><hr width='90%'>"; } function view_topic() { global $ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); $sql = sprintf("SELECT * FROM `forums_posts` fp LEFT JOIN `users` u ON (u.userid = fp.fpUSER) LEFT JOIN `forums_topics` ft ON (ft.ftID = fp.fpTOPIC) LEFT JOIN `forums_sections` fs ON (fs.fsID = ft.ftFORUM) WHERE (fp.fpTOPIC = %u)", $_GET['ID']); $sql = mysql_query($sql); print "<table width='90%' cellspacing='1'>"; while($r = mysql_fetch_array($sql)) { print "<tr bgcolor='#AAAAAA'><td colspan='4'>[b][url='forums.php']Public Forums[/url] >> [url='forums.php?view=section&ID={$r[']{$r['fsNAME']}[/url] >> {$r['ftNAME']}[/b]</td></tr> <tr><td width='10%' valign='top'>[url='viewuser.php?u={$r[']{$r['username']}[/url] [{$r['userid']}] Level {$r['level']} {$r['posts']} Posts </td> <td width='90%' valign='top'> [b]Subject: [/b]{$r['fpSUBJECT']} "; if ($r['fpUSER'] == $ir['userid']) { print "[[url='forums.php?view=editpost&ID={$r[']Edit[/url]]"; } if ($r['fpUSER'] == $ir['userid'] || $ir['user_level'] == 2) { print " [[url='forums.php?view=delpost&ID={$r[']Delete[/url]]"; } print " [i]Posted at ".date('F j Y, g:i:s a',$r['fpTIME'])."[/i] <hr />{$r['fpPOST']} "; if ($r['fpEDIT']) { print "[i]Last edited by [url='viewuser.php?u={$r[']{$r['username']}[/url] at ".date('F j Y, g:i:s a',$r['fpTIME']).".[/i] "; } print "</td> </tr>"; } print "</table><hr width='90%'> <form action='forums.php?view=reply' method='post'> [b]Reply to this Topic:[/b] <input type='hidden' name='ID' value='{$_GET['ID']}' /> Subject <input type='text' name='subject' /> Message <textarea name='message' cols='40' rows='7'></textarea> <input type='submit' value='Reply' /></form> <hr width='90%'>"; } function create_section() { global $ir,$c,$userid,$h; if($ir['user_level'] != '2') { print " You are not permitted to access this area of the forums. <hr width='90%'>> [url='explore.php']Back[/url]<hr width='90%'>"; } else if($_POST['name'] AND $_POST['description']) { $sql = sprintf("INSERT INTO `forums_sections` (`fsID`, `fsNAME`, `fsDESC`, `fsCREATOR`, `fsPOSTS`) VALUES ('NULL','%s', '%s', '%d', '%d')", mysql_real_escape_string($_POST['name']), mysql_real_escape_string($_POST['description']), $userid, 0); mysql_query($sql); print " The {$_POST['name']} forum section was successfully created. <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } else { print " <form action='forums.php?view=newsect' method='post'> Create Forum Section: Name <input type='text' name='name' /> Description <textarea name='description' cols='40' rows='7'></textarea> <input type='submit' value='Create' /></form> <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } } function create_topic() { global $ir,$c,$userid,$h; if($_POST['name'] AND $_POST['description'] AND $_POST['section'] AND $_POST['subject'] AND $_POST['message']) { $_POST['section'] = abs((int) $_POST['section']); $sql = sprintf("INSERT INTO `forums_topics` (`ftID`, `ftFORUM`, `ftNAME`, `ftDESC`, `ftUSER`) VALUES ('NULL','%d', '%s', '%s', '%d')", $_POST['section'], mysql_real_escape_string($_POST['name']), mysql_real_escape_string($_POST['description']), $userid); mysql_query($sql); $i = mysql_insert_id($c); $fm = sprintf("INSERT INTO `forums_posts` (`fpID`, `fpTOPIC`, `fpSUBJECT`, `fpPOST`, `fpUSER`, `fpTIME`) VALUES ('NULL','%d', '%s', '%s', '%d', '%d')", $i, mysql_real_escape_string($_POST['subject']), mysql_real_escape_string($_POST['message']), $userid, time()); mysql_query($fm); $upd = sprintf("UPDATE `forums_sections` SET fsPOSTS = fsPOSTS + 1 WHERE (`fsID` = %u)", $_POST['section']); mysql_query($upd); print " The {$_POST['name']} forum topic was successfully created. <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } else { print " <form action='forums.php?view=newtopic' method='post'> Create Forum Topic: Name <input type='text' name='name' /> Forum <select name='section' type='dropdown'> <option value='0'>None</option>"; $q = sprintf("SELECT * FROM `forums_sections`",$c); $q = mysql_query($q); while($r = mysql_fetch_array($q)) { print "<option value='{$r['fsID']}'>{$r['fsNAME']}</option>"; } print "</select> Description <textarea name='description' cols='40' rows='7'></textarea> [b]First Message:[/b] Subject <input type='text' name='subject' /> Message <textarea name='message' cols='40' rows='7'></textarea> <input type='submit' value='Create' /></form> <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } } function reply_forum() { global $ir,$c,$userid,$h; if($_POST['subject'] AND $_POST['message'] AND $_POST['ID']) { $_POST['ID'] = abs((int) $_POST['ID']); $sql = sprintf("INSERT INTO `forums_posts` (`fpID`, `fpTOPIC`, `fpSUBJECT`, `fpPOST`, `fpUSER`, `fpTIME`) VALUES ('NULL','%d', '%s', '%s', '%d', '%d')", $_POST['ID'], mysql_real_escape_string($_POST['subject']), mysql_real_escape_string($_POST['message']), $userid, time()); mysql_query($sql); $upd = sprintf("UPDATE `forums_topics` SET ftPOSTS = ftPOSTS + 1 WHERE (`ftID` = %u)", $_POST['ID']); mysql_query($upd); $upda = sprintf("UPDATE `users` SET posts = posts + 1 WHERE (`userid` = %u)", $ir['userid']); mysql_query($upda); print " Your reply was successfully posted. <hr width='90%'>> [url='forums.php?view=topic&ID={$_POST[']Back[/url]<hr width='90%'>"; } else { print " You missed one or more of the required fields. Go back and try again. <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } } function edit_message() { global $ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); $sql = sprintf("SELECT * FROM `forums_posts` WHERE (fpID = %u)", $_GET['ID']); $sql = mysql_query($sql); $r = mysql_fetch_array($sql); if ($ir['userid'] != $r['fpUSER']) { print " You are not the owner of this message. <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } else { print "<form action='forums.php?view=edit&ID={$_GET['ID']}' method='post'> [b]Edit Message:[/b] Subject <input type='text' name='subject' value='{$r['fpSUBJECT']}' /> Message <textarea name='message' cols='40' rows='7'>{$r['fpPOST']}</textarea> <input type='submit' value='Edit' /></form> <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } } function edit_reply() { global $ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); $sql = sprintf("SELECT * FROM `forums_posts` WHERE (fpID = %u)", $_GET['ID']); $sql = mysql_query($sql); $r = mysql_fetch_array($sql); if ($ir['userid'] != $r['fpUSER'] || $ir['user_level'] != 2) { print " You are not authorised to edit this message. <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } else if($_POST['subject'] AND $_POST['message'] AND $_GET['ID']) { $edit = sprintf("UPDATE `forums_posts` SET `fpSUBJECT` = '%s', `fpPOST` = '%s', `fpEDIT` = '%d' WHERE (`fpID` = %u)", mysql_escape_string($_POST['subject']), mysql_escape_string($_POST['message']), time(), $_GET['ID']); mysql_query($edit); print " Your post was successfully edited. <hr width='90%'>> [url='forums.php?view=topic&ID={$_GET[']Back[/url]<hr width='90%'>"; } else { print " You missed one or more of the required fields. Go back and try again. <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } } function delete_post() { global $ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); $sql = sprintf("SELECT * FROM `forums_posts` WHERE (fpID = %u)", $_GET['ID']); $sql = mysql_query($sql); $r = mysql_fetch_array($sql); if ($ir['userid'] != $r['fpUSER'] || $ir['user_level'] != 2) { print " You are not authorised to remove this message. <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } else if($r['fpID']) { $edit = sprintf("DELETE FROM `forums_posts` WHERE (`fpID` = %u)", $_GET['ID']); mysql_query($edit); print " The post was successfully removed. <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } else { print " This post has already been deleted. <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } } function delete_topic() { global $ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); $sql = sprintf("SELECT * FROM `forums_topics` WHERE (ftID = %u)", $_GET['ID']); $sql = mysql_query($sql); $r = mysql_fetch_array($sql); if ($ir['userid'] != $r['ftUSER'] || $ir['user_level'] != 2) { print " You are not authorised to remove this topic. <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } else if($r['ftID']) { $posts = sprintf("DELETE FROM `forums_posts` WHERE (`fpTOPIC` = %u)", $_GET['ID']); mysql_query($posts); $edit = sprintf("DELETE FROM `forums_topics` WHERE (`ftID` = %u)", $_GET['ID']); mysql_query($edit); print " The topic was successfully removed. <hr width='90%'>> [url='forums.php?view=topic&ID={$_GET[']Back[/url]<hr width='90%'>"; } else { print " This topic has already been deleted. <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } } $h->endpage(); ?>
  7. Re: Basic Forums [LITE / V1]   Thanks, I haven't posted in a while :) I'm working on a gangs mod for lite too.
  8. Bear in mind that this is basic. I have tried my best to secure it however it may require a few little edits. Enjoy! Run SQL: ALTER TABLE users ADD forum_ban INT( 11 ) NOT NULL DEFAULT 0; ALTER TABLE users ADD forum_reason VARCHAR( 255 ) NOT NULL DEFAULT 0; ALTER TABLE users ADD posts INT( 11 ) NOT NULL DEFAULT 0; CREATE TABLE `forums_posts` ( `fpID` int(11) NOT NULL auto_increment, `fpTOPIC` int(11) NOT NULL default '0', `fpUSER` int(11) NOT NULL default '0', `fpTIME` int(11) NOT NULL default '0', `fpSUBJECT` varchar(255) NOT NULL default '', `fpPOST` text NOT NULL, `fpEDIT` int(11) NOT NULL default '0', PRIMARY KEY (`fpID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE `forums_sections` ( `fsID` int(11) NOT NULL auto_increment, `fsNAME` varchar(255) NOT NULL default '', `fsDESC` varchar(255) NOT NULL default '', `fsCREATOR` int(11) NOT NULL default '0', `fsPOSTS` int(11) NOT NULL, PRIMARY KEY (`fsID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE `forums_topics` ( `ftID` int(11) NOT NULL auto_increment, `ftFORUM` int(11) NOT NULL default '0', `ftNAME` varchar(255) NOT NULL default '', `ftDESC` varchar(255) NOT NULL default '', `ftUSER` int(11) NOT NULL default '0', `ftSTATUS` enum('open','locked') NOT NULL default 'open', `ftPOSTS` int(11) NOT NULL, PRIMARY KEY (`ftID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; Create forums.php <?php session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm); $h->menuarea(); print "<font face='Arial' size='4'>Forums</font><hr width='90%'>"; if ($ir['forum_ban']) { die (" You are banned from the forums for ".number_format($ir['forum_ban'])." more days. The reason for this is {$ir['forum_reason']}. <hr width='90%'>> [url='explore.php']Back[/url]<hr width='90%'>"); } switch ($_GET['view']) { case 'topic': view_topic(); break; case 'section': view_section(); break; case 'reply': reply_forum(); break; case 'edit': edit_reply(); break; case 'editpost': edit_message(); break; case 'newtopic': create_topic(); break; case 'newsect': create_section(); break; default: forums_index(); break; } function forums_index() { global $ir,$c,$userid,$h; $sql = sprintf("SELECT * FROM `forums_sections` fs LEFT JOIN `users` u ON (u.userid = fs.fsCREATOR) ORDER BY fs.fsID DESC"); $sql = mysql_query($sql); if ($ir['user_level'] == '2') { print "[[url='forums.php?view=newsect']Create Section[/url]] "; } print "<table width='90%' cellspacing='1'><tr bgcolor='#AAAAAA'><td colspan='4'>[b]Public Forums[/b]</td></tr>"; while($r = mysql_fetch_array($sql)) { print "<tr><td width='50%'>[url='forums.php?view=section&ID={$r[']{$r['fsNAME']}[/url] [size="1"][i]{$r['fsDESC']}[/i][/size]</td> <td width='25%'>Started by [url='viewuser.php?u={$r[']{$r['username']}[/url]</td> <td width='25%'>{$r['fsPOSTS']} Topics</td></tr>"; } print "</table><hr width='90%'>"; } function view_section() { global $ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); $sql = sprintf("SELECT * FROM `forums_topics` ft LEFT JOIN `users` u ON (u.userid = ft.ftUSER) LEFT JOIN `forums_sections` fs ON (fs.fsID = ft.ftFORUM) WHERE (ft.ftFORUM = %u)", $_GET['ID']); $sql = mysql_query($sql); print "[[url='forums.php?view=newtopic']Create Topic[/url]] "; print "<table width='90%' cellspacing='1'><tr bgcolor='#AAAAAA'><td colspan='3'>[b][url='forums.php']Public Forums[/url][/b]</td></tr>"; while($r = mysql_fetch_array($sql)) { print "<tr><td width='50%'>[url='forums.php?view=topic&ID={$r[']{$r['ftNAME']}[/url] [size="1"][i]{$r['ftDESC']}[/i][/size]</td> <td width='25%'>Started by [url='viewuser.php?u={$r[']{$r['username']}[/url]</td> <td width='25%'>{$r['ftPOSTS']} Posts</td></tr>"; } print "</table><hr width='90%'>"; } function view_topic() { global $ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); $sql = sprintf("SELECT * FROM `forums_posts` fp LEFT JOIN `users` u ON (u.userid = fp.fpUSER) LEFT JOIN `forums_topics` ft ON (ft.ftID = fp.fpTOPIC) LEFT JOIN `forums_sections` fs ON (fs.fsID = ft.ftFORUM) WHERE (fp.fpTOPIC = %u)", $_GET['ID']); $sql = mysql_query($sql); print "<table width='90%' cellspacing='1'>"; while($r = mysql_fetch_array($sql)) { print "<tr bgcolor='#AAAAAA'><td colspan='4'>[b][url='forums.php']Public Forums[/url] >> [url='forums.php?view=section&ID={$r[']{$r['fsNAME']}[/url] >> {$r['ftNAME']}[/b]</td></tr> <tr><td width='10%' valign='top'>[url='viewuser.php?u={$r[']{$r['username']}[/url] [{$r['userid']}] Level {$r['level']} {$r['posts']} Posts </td> <td width='90%' valign='top'> [b]Subject: [/b]{$r['fpSUBJECT']} "; if ($r['fpUSER'] == $ir['userid']) { print "[[url='forums.php?view=editpost&ID={$r[']Edit[/url]]"; } print " [i]Posted at >".date('F j Y, g:i:s a',$r['fpTIME'])."[/i] <hr />{$r['fpPOST']} </td> </tr>"; } print "</table> <form action='forums.php?view=reply' method='post'> [b]Reply to this Topic:[/b] <input type='hidden' name='ID' value='{$_GET['ID']}' /> Subject <input type='text' name='subject' /> Message <textarea name='message' cols='40' rows='7'></textarea> <input type='submit' value='Reply' /></form> <hr width='90%'>"; } function create_section() { global $ir,$c,$userid,$h; if($ir['user_level'] != '2') { print " You are not permitted to access this area of the forums. <hr width='90%'>> [url='explore.php']Back[/url]<hr width='90%'>"; } else if($_POST['name'] AND $_POST['description']) { $sql = sprintf("INSERT INTO `forums_sections` (`fsID`, `fsNAME`, `fsDESC`, `fsCREATOR`, `fsPOSTS`) VALUES ('NULL','%s', '%s', '%d', '%d')", mysql_real_escape_string($_POST['name']), mysql_real_escape_string($_POST['description']), $userid, 0); mysql_query($sql); print " The {$_POST['name']} forum section was successfully created. <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } else { print " <form action='forums.php?view=newsect' method='post'> Create Forum Section: Name <input type='text' name='name' /> Description <textarea name='description' cols='40' rows='7'></textarea> <input type='submit' value='Create' /></form> <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } } function create_topic() { global $ir,$c,$userid,$h; if($_POST['name'] AND $_POST['description'] AND $_POST['section'] AND $_POST['subject'] AND $_POST['message']) { $_POST['section'] = abs((int) $_POST['section']); $sql = sprintf("INSERT INTO `forums_topics` (`ftID`, `ftFORUM`, `ftNAME`, `ftDESC`, `ftUSER`) VALUES ('NULL','%d', '%s', '%s', '%d')", $_POST['section'], mysql_real_escape_string($_POST['name']), mysql_real_escape_string($_POST['description']), $userid); mysql_query($sql); $i = mysql_insert_id($c); $fm = sprintf("INSERT INTO `forums_posts` (`fpID`, `fpTOPIC`, `fpSUBJECT`, `fpPOST`, `fpUSER`, `fpTIME`) VALUES ('NULL','%d', '%s', '%s', '%d', '%d')", $i, mysql_real_escape_string($_POST['subject']), mysql_real_escape_string($_POST['message']), $userid, time()); mysql_query($fm); $upd = sprintf("UPDATE `forums_sections` SET fsPOSTS = fsPOSTS + 1 WHERE (`fsID` = %u)", $_POST['section']); mysql_query($upd); print " The {$_POST['name']} forum topic was successfully created. <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } else { print " <form action='forums.php?view=newtopic' method='post'> Create Forum Topic: Name <input type='text' name='name' /> Forum <select name='section' type='dropdown'> <option value='0'>None</option>"; $q = sprintf("SELECT * FROM `forums_sections`",$c); $q = mysql_query($q); while($r = mysql_fetch_array($q)) { print "<option value='{$r['fsID']}'>{$r['fsNAME']}</option>"; } print "</select> Description <textarea name='description' cols='40' rows='7'></textarea> [b]First Message:[/b] Subject <input type='text' name='subject' /> Message <textarea name='message' cols='40' rows='7'></textarea> <input type='submit' value='Create' /></form> <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } } function reply_forum() { global $ir,$c,$userid,$h; if($_POST['subject'] AND $_POST['message'] AND $_POST['ID']) { $_POST['ID'] = abs((int) $_POST['ID']); $sql = sprintf("INSERT INTO `forums_posts` (`fpID`, `fpTOPIC`, `fpSUBJECT`, `fpPOST`, `fpUSER`, `fpTIME`) VALUES ('NULL','%d', '%s', '%s', '%d', '%d')", $_POST['ID'], mysql_real_escape_string($_POST['subject']), mysql_real_escape_string($_POST['message']), $userid, time()); mysql_query($sql); $upd = sprintf("UPDATE `forums_topics` SET ftPOSTS = ftPOSTS + 1 WHERE (`ftID` = %u)", $_POST['ID']); mysql_query($upd); $upda = sprintf("UPDATE `users` SET posts = posts + 1 WHERE (`userid` = %u)", $ir['userid']); mysql_query($upda); print " Your reply was successfully posted. <hr width='90%'>> [url='forums.php?view=topic&ID={$_POST[']Back[/url]<hr width='90%'>"; } else { print " You missed one or more of the required fields. Go back and try again. <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } } function edit_message() { global $ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); $sql = sprintf("SELECT * FROM `forums_posts` WHERE (fpID = %u)", $_GET['ID']); $sql = mysql_query($sql); $r = mysql_fetch_array($sql); if ($ir['userid'] != $r['fpUSER']) { print " You are not the owner of this message. <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } else { print "<form action='forums.php?view=edit&ID={$_GET['ID']}' method='post'> [b]Edit Message:[/b] Subject <input type='text' name='subject' value='{$r['fpSUBJECT']}' /> Message <textarea name='message' cols='40' rows='7'>{$r['fpPOST']}</textarea> <input type='submit' value='Edit' /></form> <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } } function edit_reply() { global $ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); $sql = sprintf("SELECT * FROM `forums_posts` WHERE (fpID = %u)", $_GET['ID']); $sql = mysql_query($sql); $r = mysql_fetch_array($sql); if ($ir['userid'] != $r['fpUSER']) { print " You are not the owner of this message. <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } else if($_POST['subject'] AND $_POST['message'] AND $_GET['ID']) { $edit = sprintf("UPDATE `forums_posts` SET `fpSUBJECT` = '%s', `fpPOST` = '%s' WHERE (`fpID` = %u)", mysql_escape_string($_POST['subject']), mysql_escape_string($_POST['message']), $_GET['ID']); mysql_query($edit); print " Your post was successfully edited. <hr width='90%'>> [url='forums.php?view=topic&ID={$_GET[']Back[/url]<hr width='90%'>"; } else { print " You missed one or more of the required fields. Go back and try again. <hr width='90%'>> [url='forums.php']Back[/url]<hr width='90%'>"; } } $h->endpage(); ?>
  9. Re: Simple Job Specials [V2] The job specials table goes just above the get promoted and quit job links
  10. Re: Basic Stock Market [V2] Cron Updated
  11. Re: [V2] Ignore User Mail [V2] Thanks for this. I've had to slightly edit it a bit for my game, but I left the credit in :)
  12. Re: Script For Header Brilliant :) Thank you very much
  13. Re: My forgot password. [v2] & [v1] Thanks alot for this Killah :)
  14. Re: Fav band, music Bon Jovi Phil Collins Bryan Adams Guns N Roses Foreigner Whitesnake Aerosmith Kiss Take That Michael Jackson Journey Queen
  15. Re: [FREE] [V2] Simple but better looking game header! This looks very good, much better than the usual header :)
  16. Re: Ammo [V2] This will enable you to buy ammo for each gun. Try this. Run SQL: CREATE TABLE `ammunition` ( `amID` int(11) NOT NULL auto_increment, `amUSER` int(11) NOT NULL default '0', `amWEAPON` int(11) NOT NULL default '0', `amAMMO` int(11) NOT NULL default '0', PRIMARY KEY (`amID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;   Create ammunition.php: <?php include "globals.php"; print "<font face='Arial' size='4'>Ammunition Store</font><hr width=75%> "; $_GET['ID'] = abs((int) $_GET['ID']); $_POST['ID'] = abs((int) $_POST['ID']); $_POST['clips'] = abs((int) $_POST['clips']); $cost=($_POST['clips']*500); if($_POST['clips']) { $q=$db->query("SELECT iv.*,i.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid WHERE itmid={$_POST['ID']} AND i.itmtype=4 AND inv_userid=$userid"); if($db->num_rows($q)==0) { print "This item is not a Gun! <hr width=75%>> [url='inventory.php']Back[/url]<hr width=75%>"; } else if ($ir['money']<$cost) { print "You cannot afford that many clips! <hr width=75%>> [url='ammunition.php']Back[/url]<hr width=75%>"; } else { $r=$db->fetch_row($q); $x=$db->query("SELECT * FROM ammunition WHERE amWEAPON={$_POST['ID']} AND amUSER=$userid"); $y=$db->num_rows($x); $z=$db->fetch_row($x); if ($y) { $clips=($z['amAMMO']+$_POST['clips']); $db->query("UPDATE users SET money=money-$cost WHERE userid=$userid"); $db->query("UPDATE ammunition SET amAMMO=amAMMO+{$_POST['clips']} WHERE amWEAPON={$_POST['ID']} AND amUSER=$userid"); print "You bought {$_POST['clips']} rounds of ammunition for your {$r['itmname']}! You now have $clips clips for this gun. <hr width=75%>> [url='ammunition.php']Back[/url]<hr width=75%>"; } else { $db->query("UPDATE users SET money=money-$cost WHERE userid=$userid"); $db->query("INSERT INTO ammunition VALUES ('','$userid','{$_POST['ID']}',{$_POST['clips']})"); print "You bought {$_POST['clips']} rounds of ammunition for your {$r['itmname']}! <hr width=75%>> [url='ammunition.php']Back[/url]<hr width=75%>"; } } } else { $q=$db->query("SELECT iv.*,i.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid WHERE itmid={$_GET['ID']} AND itmtype=4 AND inv_userid=$userid"); if($db->num_rows($q)==0) { print "This item is not a Gun! <hr width=75%>> [url='inventory.php']Back[/url]<hr width=75%>"; } else { $r=$db->fetch_row($q); print "Standard ammunition costs $500 per round for all guns. How much ammunition would you like to buy for your {$r['itmname']}. <form action='ammunition.php' method='post'> <input type='hidden' name='ID' value='{$_GET['ID']}' /> Clips: <input type='text' name='clips' value='0' /> <input type='submit' value='Purchase' /></form> <hr width=75%>> [url='inventory.php']Back[/url]<hr width=75%>"; } } $h->endpage(); ?>   In inventory.php find: if($i['itmtype'] == 'YOUR ITEM TYPE FOR GUN HERE') { print " [[url='ammunition.php?ID={$i[']Ammo[/url]]"; }   In attack.php replace: if($_GET['wepid']) {   with: if($_GET['wepid']) { $x=$db->query("SELECT * FROM ammunition WHERE amUSER=$userid AND amWEAPON={$_GET['wepid']} AND amAMMO>0"); $y=$db->num_rows($x); if (!$y) { print "You have no ammunition in this gun!"; $h->endpage(); exit; }   Also in attack.php find: if($odata['hp']==1) { $odata['hp']=0;$mydamage+=1; } $db->query("UPDATE users SET hp=hp-$mydamage WHERE userid={$_GET['ID']}");   replace with: if($odata['hp']==1) { $odata['hp']=0;$mydamage+=1; } $db->query("UPDATE users SET hp=hp-$mydamage WHERE userid={$_GET['ID']}"); $ammo=$db->query("SELECT * FROM items WHERE itmid={$_GET['wepid']}"); $am=$db->fetch_row($ammo); if ($am['itmtype'] == '4') { $db->query("UPDATE ammunition SET amAMMO=amAMMO-1 WHERE amUSER=$userid AND amWEAPON={$_GET['wepid']} AND amAMMO>0"); }   Change the 4's in this to your item type id for guns.
  17. Re: Basic Stock Market [V2] Ive fixed so you cant buy negative amounts of stock now
  18. Re: Crime Group Descriptions Sounds good :)
  19. Re: Basic Stock Market [V2] Thats odd, the cron I posted works fine for me
  20. Re: Basic Stock Market [V2] It looks like you've put it into global_func correctly.
  21. Re: Basic Stock Market [V2] Just place the cron data into cron_fivemins.php instead of cron_hour.php
  22. Re: Basic Stock Market [V2] Just Change where it says &nbsp to Amount:
  23. Re: Basic Stock Market [V2] You'll need to add the stock_dropdown code from the post above yours to fix that
  24. Re: Basic Stock Market [V2] Add into global_func.php function stock_dropdown($connection,$ddname="stock",$selected=-1) { global $db; $ret="<select name='$ddname' type='dropdown'>"; $q=$db->query("SELECT * FROM stock ORDER BY stNAME ASC"); if($selected == -1) { $first=0; } else { $first=1; } while($r=$db->fetch_row($q)) { $ret.="\n<option value='{$r['stID']}'"; if ($selected == $r['stID'] || $first == 0) { $ret.=" selected='selected'";$first=1; } $ret.= ">{$r['stNAME']}</option>"; } $ret.="\n</select>"; return $ret; }
  25. Re: Basic Stock Market [V2] Clickable dot is so you can choose between buying an amount of stock from dropdown or typing the amount yourself. Ill post stock dropdown code as soon as I get back on computer
×
×
  • Create New...