Jump to content
MakeWebGames

Richard

Members
  • Posts

    277
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Richard

  1. Run SQL: CREATE TABLE `stock` ( `stID` int(11) NOT NULL auto_increment, `stNAME` varchar(255) NOT NULL default '', `stDESC` varchar(255) NOT NULL default '', `stOWNER` varchar(255) NOT NULL default '', `stCOST` int(11) NOT NULL default '0', `stPERC` int(11) NOT NULL default '0', `stIMAGE` varchar(255) NOT NULL default 'stockdefault.png', `stPRICE` int(11) NOT NULL default '0', PRIMARY KEY (`stID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE `shares` ( `usID` int(11) NOT NULL auto_increment, `usUSER` int(11) NOT NULL default '0', `usSTOCK` int(11) NOT NULL default '0', `usSHARES` int(11) NOT NULL default '0', PRIMARY KEY (`usID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; Create stockmarket.php <?php include "globals.php"; print "<center><font size='4' face='Arial, Helvetica, sans-serif'>Stock Market</font><hr width=75%>"; switch($_GET['action']) { default: stock_market(); break; case 'view': view_company(); break; case 'buy': buy_stock(); break; case 'sell': sell_stock(); break; } function stock_market() { global $db,$ir,$c,$userid,$h; print "Welcome to the Stock Market. Stocks can earn you lots of money if you invest correctly. If your stock plummets to $0 per share, all of your stock will be removed, so be aware. Stocks are always a gamble, and no money will be refunded until you decide to sell your stock. Remember to buy low, and sell high. Good Luck!<hr width='75%'> <form action='stockmarket.php?action=view' method='post'> <table width=75% cellspacing='1' class='table'> <tr class='h'> <th width='150' class='h'>Stock Company</th> <th class='h'>Current Price</th> <th class='h'>Original Price</th> <th class='h'>% Change</th> <th class='h'>Details</th> </tr>"; $q=$db->query("SELECT * FROM stock ORDER BY stID DESC",$c); while($r=$db->fetch_row($q)) { print "<tr> <td>{$r['stNAME']}</td> <td>" . money_formatter($r['stCOST'])."</td> <td>" . money_formatter($r['stPRICE'])."</td> <td>"; if ($r['stPERC']>0) { print "<font color=green>+{$r['stPERC']}%</font>"; } else { print "<font color=red>{$r['stPERC']}%</font>"; } print "</td> <td><input type='radio' name='ID' value='{$r['stID']}' /></td> </tr>"; } print "<tr class='h'><th class='h' colspan='5' align='center'><input type='submit' value='View Details'></th></tr></table></form><hr width='75%'>> [url='index.php']Back[/url]<hr width='75%'>"; } function view_company() { global $db,$ir,$c,$userid,$h; $_POST['ID'] = abs((int) $_POST['ID']); $stock=$db->query("SELECT * FROM shares WHERE usUSER=$userid AND usSTOCK={$_POST['ID']}",$c); $stocks = $db->num_rows($stock); if(!$stocks) { $amnt=2; } else { $amnt=0; while ($i=$db->fetch_row($stock)) { $amnt=$amnt+$i['usSHARES']; } $db->query("DELETE FROM shares WHERE usUSER=$userid AND usSTOCK={$_POST['ID']}",$c); $db->query("INSERT INTO shares VALUES ('', '$userid', '{$_POST['ID']}', '$amnt')",$c); } $x=$db->query("SELECT * FROM shares WHERE usSTOCK={$_POST['ID']} AND usUSER=$userid"); $a=$db->num_rows($x); $y=$db->fetch_row($x); if ($a) { $q=$db->query("SELECT * FROM stock WHERE stID={$_POST['ID']}"); $r=$db->fetch_row($q); print "<table width='75%' cellspacing='1' class='table'> <tr><th>Shares</th><th>Value</th><th>Sell</th></tr> <tr><td>{$y['usSHARES']}</td><td>" . money_formatter($r['stCOST']*$y['usSHARES'])."</td><td width=20%>[url='stockmarket.php?action=sell&ID={$y[']Sell Stock[/url]</td></tr></table> "; } $q=$db->query("SELECT * FROM stock WHERE stID={$_POST['ID']}"); $r=$db->fetch_row($q); if(!$_POST['ID']) { print " Invalid Company ID! <hr width=75%>> [url='stockmarket.php']Back[/url]<hr width=75%>"; } else { print " [img={$r[] <form action='stockmarket.php?action=buy&ID={$r['stID']}' method='post'><table width=75% cellspacing='1' class='table'> <tr><th colspan='3' align='center' class='h'>Stock Details</th></tr> <tr><th class='h'>Name: </th><td colspan='2'>{$r['stNAME']}</td></tr> <tr><th class='h'>Description: </th><td colspan='2'>{$r['stDESC']}</td></tr> <tr><th class='h'>Owner: </th><td colspan='2'>{$r['stOWNER']}</td></tr> <tr><th class='h'>Share Cost: </th><td colspan='2'>" . money_formatter($r['stCOST'])."</td></tr> <tr><th class='h'>Last Change: </th><td colspan='2'>"; if ($r['stPERC']>0) { print "<font color=green>+{$r['stPERC']}%</font>"; } else { print "<font color=red>{$r['stPERC']}%</font>"; } print "</td></tr> <tr><th class='h'>Amount: </th><td width=20%> <select name='amount'> <option value='5'>5</option> <option value='10'>10</option> <option value='25'>25</option> <option value='50'>50</option> <option value='100'>100</option> <option value='250'>250</option> <option value='500'>500</option> <option value='1000'>1000</option> </select></td><td><input type='radio' name='setting' value='1' checked /></td></tr> <tr><th class='h'>&nbsp</th><td width=20%><input type='text' name='amount2' size='6' value='0'></td><td><input type='radio' name='setting' value='0' /></td></tr> <tr class='h'><th colspan='3' align='center' class='h'><input type='submit' value='Purchase'></th></tr></table></form> <hr width=75%>> [url='stockmarket.php']Back[/url]<hr width=75%>"; } } function buy_stock() { global $db,$ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); $q=$db->query("SELECT * FROM stock WHERE stID={$_GET['ID']}"); $r=$db->fetch_row($q); if (!$_POST['setting']) { $amount=($_POST['amount2']); } else { $amount=($_POST['amount']); } $cost=($amount*($r['stCOST'])); if(!$_GET['ID']) { print " Invalid Stock ID! <hr width=75%>> [url='stockmarket.php']Back[/url]<hr width=75%>"; } else if($ir['money']<$cost) { print " You cannot afford to buy this Stock! <hr width=75%>> [url='stockmarket.php']Back[/url]<hr width=75%>"; } else if($amount<1) { print " You must type a valid amount of stock! <hr width=75%>> [url='stockmarket.php']Back[/url]<hr width=75%>"; } else { $db->query("INSERT INTO shares VALUES(NULL, '$userid', '{$_GET['ID']}', '$amount')"); $db->query("UPDATE users SET money=money-$cost WHERE userid=$userid"); print " You bought $amount shares of {$r['stNAME']}! <hr width=75%>> [url='stockmarket.php']Back[/url]<hr width=75%>"; } } function sell_stock() { global $db,$ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); $q=$db->query("SELECT * FROM shares WHERE usID={$_GET['ID']} AND usUSER=$userid"); $r=$db->fetch_row($q); $x=$db->query("SELECT * FROM stock WHERE stID={$r['usSTOCK']}"); $y=$db->fetch_row($x); if(!$_GET['ID']) { print " Invalid Stock ID! <hr width=75%>> [url='stockmarket.php']Back[/url]<hr width=75%>"; } else { $cost=($r['usSHARES']*($y['stCOST'])); $cost2=money_formatter($r['usSHARES']*($y['stCOST'])); print " You sold your {$r['usSHARES']} Shares of {$y['stNAME']} for $cost2! <hr width=75%>> [url='stockmarket.php']Back[/url]<hr width=75%>"; $db->query("UPDATE users SET money=money+$cost WHERE userid=$userid"); $db->query("DELETE FROM shares WHERE usID={$_GET['ID']}"); } } $h->endpage(); ?> Add into cron_hour.php $stock=$db->query("SELECT * FROM stock",$c); while($st=$db->fetch_row($stock)) { $rand1=(int) rand(1,2); $rand2=(int) rand(1,25); if($rand1 == 1) { $db->query("UPDATE stock SET stCOST=stCOST+$rand2,stPERC='$rand2' WHERE stID={$st['stID']}",$c); } else { $db->query("UPDATE stock SET stCOST=stCOST-$rand2,stPERC='-$rand2' WHERE stID={$st['stID']}",$c); } } $db->query("UPDATE stock SET stCOST=0 WHERE stCOST<0",$c); $db->query("DELETE FROM stock WHERE stCOST=0",$c); Create staff_stocks.php <?php include "sglobals.php"; if($ir['user_level'] > 2) { die("403"); } //This contains shop stuffs switch($_GET['action']) { case "addstock": addstock(); break; case "editstock": editstock(); break; case "delstock": delstock(); break; default: print "Error: This script requires an action."; break; } function addstock() { global $db, $ir, $c, $h, $userid; $desc=($_POST['desc']); $owner=($_POST['owner']); $image=($_POST['image']); $name=$_POST['name']; $cost=$_POST['cost']; if($desc && $owner && $name) { $db->query("INSERT INTO stock VALUES(NULL, '$name', '$desc', '$owner', '$cost', '0', '$image', '$cost')"); print "{$name} stock added to the game."; stafflog_add("Created $name stock."); } else { print "<h3>Add Stock</h3><hr /> <form action='staff_stocks.php?action=addstock' method='post'> Name: <input type='text' name='name' /> Description: <input type='text' name='desc' /> Owner: <input type='text' name='owner' /> Price Per Share: <input type='text' name='cost' /> Image: <input type='text' name='image' /> <input type='submit' value='Add Stock' /></form>"; } } function editstock() { global $db, $ir, $c, $h, $userid; switch($_POST['step']) { case "2": $desc=($_POST['desc']); $owner=($_POST['owner']); $image=($_POST['image']); $name=$_POST['name']; $cost=$_POST['cost']; $db->query("UPDATE stock SET stNAME='$name', stDESC='$desc', stOWNER='$owner', stCOST='$cost', stIMAGE='$image', stPRICE='$cost' WHERE stID={$_POST['id']}"); print "$name stock was edited successfully."; stafflog_add("Edited $name stock."); break; case "1": $q=$db->query("SELECT * FROM stock WHERE stID={$_POST['stock']}"); $old=$db->fetch_row($q); print "<h3>Editing Stock</h3><hr /> <form action='staff_stocks.php?action=editstock' method='post'> <input type='hidden' name='step' value='2' /> <input type='hidden' name='id' value='{$_POST['stock']}' /> Name: <input type='text' name='name' value='{$old['stNAME']}' /> Description: <input type='text' name='desc' value='{$old['stDESC']}' /> Owner: <input type='text' name='owner' value='{$old['stOWNER']}' /> Price Per Share: <input type='text' name='cost' value='{$old['stCOST']}' /> Image: <input type='text' name='image' value='{$old['stIMAGE']}' /> <input type='submit' value='Edit Stock' /></form>"; break; default: print "<h3>Editing Stock</h3><hr /> <form action='staff_stocks.php?action=editstock' method='post'> <input type='hidden' name='step' value='1' /> Stock: ".stock_dropdown($c, "stock")." <input type='submit' value='Edit Stock' /></form>"; break; } } function delstock() { global $db,$ir,$c,$h,$userid; if($_POST['stock']) { $db->query("DELETE FROM shares WHERE usSTOCK={$_POST['stock']}"); $db->query("DELETE FROM stock WHERE stID={$_POST['stock']}"); print "Stock deleted."; stafflog_add("Deleted stock ID {$_POST['stock']}"); } else { print "<h3>Delete Stock</h3><hr /> <form action='staff_stocks.php?action=delstock' method='post'> Stock: ".stock_dropdown($c, "stock")." <input type='submit' value='Delete Stock' /></form>"; } } function report_clear() { global $db,$ir,$c,$h,$userid; if($ir['user_level'] > 3) { die("403"); } $_GET['ID'] = abs((int) $_GET['ID']); stafflog_add("Cleared player report ID {$_GET['ID']}"); $db->query("DELETE FROM preports WHERE prID={$_GET['ID']}"); print "Report cleared and deleted! [url='staff_users.php?action=reportsview']> Back[/url]"; } $h->endpage(); ?> In smenu.php add: [b]Stocks[/b] > [url='staff_stocks.php?action=addstock']Add Stock[/url] > [url='staff_stocks.php?action=editstock']Edit Stock[/url] > [url='staff_stocks.php?action=delstock']Delete Stock[/url] Ive been testing this for a while, and it seems to work fine :)
  2. Re: Criminal Record [V2] Ive tried this criminal record, but it didn't work for me. So ive slightly changed it and got it to work. SQL: CREATE TABLE `criminalrecord` ( `crID` int(11) NOT NULL auto_increment, `crCRIME` int(11) NOT NULL, `crUSER` int(11) NOT NULL, `crRESULT` int(11) NOT NULL, PRIMARY KEY (`crID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;   Replace docrime.php <?php $macropage="docrime.php?c={$_GET['c']}"; include "globals.php"; if($ir['jail'] or $ir['hospital']) { die("This page cannot be accessed while in jail or hospital."); } $_GET['c']=abs((int) $_GET['c']); if(!$_GET['c']) { print "Invalid crime"; } else { $q=$db->query("SELECT * FROM crimes WHERE crimeID={$_GET['c']}",$c); $r=$db->fetch_row($q); if($ir['brave'] < $r['crimeBRAVE']) { print "You do not have enough Brave to perform this crime."; } else { $ec="\$sucrate=".str_replace(array("LEVEL","CRIMEXP","EXP","WILL","IQ"), array($ir['level'], $ir['crimexp'], $ir['exp'], $ir['will'], $ir['IQ']),$r['crimePERCFORM']).";"; eval($ec); print $r['crimeITEXT']; $ir['brave']-=$r['crimeBRAVE']; $db->query("UPDATE users SET brave={$ir['brave']} WHERE userid=$userid",$c); if(rand(1,100) <= $sucrate) { print str_replace("{money}",$r['crimeSUCCESSMUNY'],$r['crimeSTEXT']); $ir['money']+=$r['crimeSUCCESSMUNY']; $ir['crystals']+=$r['crimeSUCCESSCRYS']; $ir['exp']+=(int) ($r['crimeSUCCESSMUNY']/8); $db->query("UPDATE users SET money={$ir['money']}, crystals={$ir['crystals']}, exp=exp+{$r['crimeXP']},crimexp=crimexp+{$r['crimeXP']} WHERE userid=$userid",$c); $db->query("INSERT INTO `criminalrecord` (`crID`, `crCRIME`, `crUSER`, `crRESULT`) VALUES ('', '$_GET[c]', '$userid', '1');",$c); if($r['crimeSUCCESSITEM']) { item_add($userid, $r['crimeSUCCESSITEM'], 1); } } else { if(rand(1, 2) == 1) { print $r['crimeFTEXT']; } else { print $r['crimeJTEXT']; $db->query("UPDATE `users` SET `jail` = '$r[crimeJAILTIME]', `jail_reason` = '$r[crimeJREASON]' WHERE `userid` = '$userid'"); $db->query("INSERT INTO `criminalrecord` (`crID`, `crCRIME`, `crUSER`, `crRESULT`) VALUES ('', '$_GET[c]', '$userid', '0');",$c); } } print " [url='docrime.php?c={$_GET[']Try Again[/url] [url='criminal.php']Crimes[/url]"; } } $h->endpage(); ?>   Add criminalrecord.php <?php include "globals.php"; print "<h3>Criminal Record</h3> "; $q=$db->query("SELECT * FROM crimes ORDER BY crimeNAME DESC",$c); print "<table width=90% cellspacing='1' class='table'><tr><th>Crime Name</th><th>Succeeded</th><th>Failed</th><th>Total</th></tr>"; if($db->num_rows($q)== 0) { print "<tr><td colspan=4>You have no Crimes Logged</td></tr>"; } while($r=$db->fetch_row($q)) { $q2=$db->query("SELECT * FROM `criminalrecord` WHERE `crUSER` = '$userid' AND `crCRIME` = '$r[crimeID]' AND `crRESULT` = '1'",$c); $q3=$db->query("SELECT * FROM `criminalrecord` WHERE `crUSER` = '$userid' AND `crCRIME` = '$r[crimeID]' AND `crRESULT` = '0'",$c); $RES=$db->num_rows($q2)+$db->num_rows($q3); if($db->num_rows($q2) or $db->num_rows($q3)) { $perc1=$db->num_rows($q2)/$RES*100; $perc2=$db->num_rows($q3)/$RES*100; print "<tr><td> ".$r['crimeNAME']." </td><td> ".$db->num_rows($q2)." (<font color='green'>$perc1%</font>)</td><td> ".$db->num_rows($q3)." (<font color='#500001'>$perc2%</font>)</td><td> ".$RES." </td></tr>"; } else { print ""; } } print "</table><hr width=90%>> [url='criminal.php']Crimes[/url]<hr width=90%>"; $h->endpage(); ?>
  3. Re: Simple Trades [V2] when you cancel it should delete it from the table, so it should say invalid trade
  4. Re: Updated Display Pic System [V2] after the query that deletes the image, it might work to add after if ($ir['display_count'] == 0) { $db->query("UPDATE users SET display_pic='default.png' WHERE userid=$userid"); } This will only work if you have the display_count field added into users table
  5. Re: Simple Marriage [V2] paddy™, I have altered this script so when you divorce, It sets each partners will to 0, and take $2,500 from the divorcer.   <?php include "globals.php"; print "<center><font size='4' face='Arial, Helvetica, sans-serif'>Marriage</font><hr width=75%>"; switch($_GET['action']) { case 'propose': propose_marriage(); break; case 'roses': send_roses(); break; case 'note': send_note(); break; case 'divorce': divorce_marriage(); break; case 'confirm': divorce_confirm(); break; case 'accept': accept_proposal(); break; case 'decline': decline_proposal(); break; default: marriage_index(); break; } function marriage_index() { global $ir,$c,$userid, $db; print "<center> Welcome to the marriage office! What would you like to do today? "; if (!$ir['marriage']) { print "> [url='marriage.php?action=propose']Propose marriage[/url] "; } else { print "> [url='marriage.php?action=divorce']Divorce partner ($2,500)[/url] > [url='marriage.php?action=roses']Send Bouquet of Roses ($10,000)[/url] > [url='marriage.php?action=note']Send a love note[/url] "; } print " <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } function propose_marriage() { global $db,$ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); if(!$_POST['ID']) { print " <form action='marriage.php?action=propose' method='post'> Please type the ID# of the user you wish to propose to below. ID: <input type='text' name='ID' value='{$_GET['ID']}' maxlength='10' length='10' size='10' width='10' /> <input type='submit' value='Propose' /> </form> <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else if($ir['marriage']) { print " You are already married. <hr width=75%>> [url='trade.php']Back[/url]<hr width=75%>"; } else if($_POST['ID'] == $userid) { print " You cannot propose to yourself! <hr width=75%>> [url='marriage.php']Back[/url]<hr width=75%>"; } else { $db->query("INSERT INTO proposals VALUES ('', '$userid', '{$_POST['ID']}')", $c); $q=$db->query("SELECT * FROM proposals WHERE prFROM=$userid"); $r=$db->fetch_row($q); event_add($_POST['ID'], "{$ir['username']} would like to marry you: • [url='marriage.php?action=accept&ID={$r[']Accept[/url] • [url='marriage.php?action=decline&ID={$r[']Decline[/url]", $c,'general'); print " Proposal sent! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } } function accept_proposal() { global $db,$ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); $q=$db->query("SELECT * FROM proposals WHERE prID={$_GET['ID']}"); $r=$db->fetch_row($q); if(!$_GET['ID']) { print " Invalid proposal ID! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else if($r['prUSER'] != $userid) { print " You cannot accept this proposal! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else { $q=$db->query("SELECT * FROM proposals WHERE prUSER=$userid"); $r=$db->fetch_row($q); event_add($r['prFROM'], "{$ir['username']} has accepted your proposal!", $c); $db->query("UPDATE users SET marriage={$r['prFROM']} WHERE userid=$userid"); $db->query("UPDATE users SET marriage=$userid WHERE userid={$r['prFROM']}"); $db->query("DELETE FROM proposals WHERE prID={$_GET['ID']}"); print " Proposal accepted! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } } function decline_proposal() { global $db,$ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); $q=$db->query("SELECT * FROM proposals WHERE prID={$_GET['ID']}"); $r=$db->fetch_row($q); if(!$_GET['ID']) { print " Invalid proposal ID! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else if($r['prUSER'] != $userid) { print " You cannot decline this proposal! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else { $q=$db->query("SELECT * FROM proposals WHERE prID={$_GET['ID']}"); $r=$db->fetch_row($q); event_add($r['prFROM'], "{$ir['username']} has declined your proposal.", $c); $db->query("DELETE FROM proposals WHERE prID={$_GET['ID']}"); print " Proposal declined! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } } function divorce_marriage() { global $db,$ir,$c,$userid,$h; if ($ir['marriage']) { print " Are you sure you wish to divorce your partner? A divorce will cost $2,500 in court fees. <hr width=75%><table width=75%><tr><td width=50% align='center'>> [url='marriage.php']No[/url]</td><td width=50% align='center'>> [url='marriage.php?action=confirm']Yes[/url]</td></tr></table><hr width=75%>"; } else { print " You are not married! <hr width=75%>> [url='marriage.php']Back[/url]<hr width=75%>"; } } function divorce_confirm() { global $db,$ir,$c,$userid,$h; if ($ir['money']<2500) { print " You dont have enough money to file for divorce! <hr width=75%>> [url='marriage.php']Back[/url]<hr width=75%>"; } else if ($ir['marriage']) { print " You divorced your partner! <hr width=75%>> [url='marriage.php']Back[/url]<hr width=75%>"; event_add($ir['marriage'], "{$ir['username']} divorced you!", $c,'general'); $db->query("UPDATE users SET marriage=0,will=0 WHERE userid={$ir['marriage']}"); $db->query("UPDATE users SET marriage=0,will=0,money=money-2500 WHERE userid=$userid"); } else { print " You are not married! <hr width=75%>> [url='marriage.php']Back[/url]<hr width=75%>"; } } function send_roses() { global $db,$ir,$c,$userid,$h; if ($ir['marriage']) { if ($ir['money']>1000) { print " You sent a Bouquet of Roses to your partner! <hr width=75%>> [url='marriage.php']Back[/url]<hr width=75%>"; $db->query("UPDATE users SET money=money-10000 WHERE userid=$userid"); $rand=rand(12,27); $part=$db->query("SELECT * FROM users WHERE userid={$ir['marriage']}"); $pr=$db->fetch_row($part); $will=($pr['maxwill']-$pr['will']); if ($rand<$will) { $db->query("UPDATE users SET will=will+$rand WHERE userid={$ir['marriage']}"); } else { $db->query("UPDATE users SET will=maxwill WHERE userid={$ir['marriage']}"); } event_add($ir['marriage'], "{$ir['username']} sent you a Bouquet of Roses restoring $rand Will!", $c); $rose=$db->query("SELECT * FROM items WHERE itmname='Bouquet of Roses'"); $rs=$db->fetch_row($rose); $db->query("INSERT INTO inventory VALUES('',{$rs['itmid']},{$ir['marriage']},'1');",$c); } else { print " You are not married! <hr width=75%>> [url='marriage.php']Back[/url]<hr width=75%>"; } } } function send_note() { global $db,$ir,$c,$userid,$h; if (!$_POST['note']) { print " <form action='marriage.php?action=note' method='post'> Please type a love note to send to your partner. Note: <textarea rows='5' cols='34%' name='note'></textarea> <input type='submit' value='Send' /> </form> <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else { $note=str_replace(array("\n"),array(" "),strip_tags($_POST['note'])); $db->query("INSERT INTO mail VALUES ('',0,$userid,{$ir['marriage']},unix_timestamp(),'Love Note','$note')",$c) or die($db->error()); $db->query("UPDATE users SET new_mail=new_mail+1 WHERE userid={$ir['marriage']}"); print " Your love note was sent to your partner! <hr width=75%>> [url='marriage.php']Back[/url]<hr width=75%>"; } } $h->endpage(); ?>
  6. Re: Simple Marriage [V2] Good Idea, Ill change that now
  7. Re: Simple Job Specials [V2] Try the above post again, ive updated
  8. Re: Simple Job Specials [V2] Try this <?php include "sglobals.php"; if($ir['user_level'] > 2) { die("403"); } //This contains shop stuffs switch($_GET['action']) { case 'newjob': newjob(); break; case 'jobedit': jobedit(); break; case 'newjobrank': newjobrank(); break; case 'jobrankedit': jobrankedit(); break; case 'jobdele': jobdele(); break; case 'jobrankdele': jobrankdele(); break; case 'newjobspec': newjobspec(); break; case 'jobspecedit': jobspecedit(); break; case 'jobspecdele': jobspecdele(); break; default: print "Error: This script requires an action."; break; } function newjob() { global $db,$ir,$userid; if ( $_POST['jNAME']) { $db->query("INSERT INTO jobs VALUES('','{$_POST['jNAME']}', 0, '{$_POST['jDESC']}', '{$_POST['jOWNER']}')"); $i=$db->insert_id(); $db->query("INSERT INTO jobranks VALUES('', '{$_POST['jrNAME']}', $i, {$_POST['jrPAY']}, {$_POST['jrIQG']}, {$_POST['jrLABOURG']}, {$_POST['jrSTRG']}, {$_POST['jrIQN']}, {$_POST['jrLABOURN']}, {$_POST['jrSTRN']})"); $j=$db->insert_id(); $db->query("UPDATE jobs SET jFIRST=$j WHERE jID=$i"); print "Job created! "; } else { print <<<EOF <form action='staff_jobs.php?action=newjob' method='post'> [b]Job Name:[/b] <input type='text' name='jNAME' /> [b]Job Description:[/b] <input type='text' name='jDESC' /> [b]Job Owner:[/b] <input type='text' name='jOWNER' /> <hr>[b]First Job Rank:[/b] [b]Rank Name:[/b] <input type='text' name='jrNAME' /> [b]Pays:[/b] <input type='text' name='jrPAY' /> [b]Gains:[/b] Str: <input type='text' name='jrSTRG' size=3 maxlength=3> Lab: <input type='text' name='jrLABOURG' size=3 maxlength=3> IQ: <input type='text' name='jrIQG' size=3 maxlength=3> [b]Reqs:[/b] Str: <input type='text' name='jrSTRN' size=5 maxlength=5> Lab: <input type='text' name='jrLABOURN' size=5 maxlength=5> IQ: <input type='text' name='jrIQN' size=5 maxlength=5> <input type='submit' value='Create Job' /></form> EOF; } } function jobedit() { global $db,$ir,$userid; if ( $_POST['stage2']) { $db->query("UPDATE jobs SET jNAME='{$_POST['jNAME']}', jDESC='{$_POST['jDESC']}', jOWNER='{$_POST['jOWNER']}', jFIRST={$_POST['jFIRST']} WHERE jID={$_POST['jID']}"); print "Job updated! "; } else if ( $_POST['stage1']) { $q=$db->query("SELECT * FROM jobs WHERE jID={$_POST['jID']}"); $r=$db->fetch_row($q); print <<<EOF <form action='staff_jobs.php?action=jobedit' method='post'> <input type='hidden' name='stage2' value='1'> <input type='hidden' name='jrID' value='{$_POST['jrID']}'> [b]Job Name:[/b] <input type='text' name='jNAME' value='{$r['jNAME']}'> [b]Job Description:[/b] <input type='text' name='jDESC' value='{$r['jDESC']}'> [b]Job Owner:[/b] <input type='text' name='jOWNER' value='{$r['jOWNER']}'> [b]First Job Rank:[/b] EOF; print jobrank_dropdown($c,'jFIRST',$r['jFIRST']); print <<<EOF <input type='submit' value='Edit' /> </form> EOF; } else { print <<<EOF <form action='staff_jobs.php?action=jobedit' method='post'> <input type='hidden' name='stage1' value='1'> Select a job to edit. EOF; print job_dropdown($c, 'jID', -1); print <<<EOF <input type='submit' value='Edit Job' /> </form> EOF; } } function newjobrank() { global $db,$ir,$userid; if ( $_POST['jrNAME']) { $db->query("INSERT INTO jobranks VALUES('', '{$_POST['jrNAME']}', {$_POST['jrJOB']}, {$_POST['jrPAY']}, {$_POST['jrIQG']}, {$_POST['jrLABOURG']}, {$_POST['jrSTRG']}, {$_POST['jrIQN']}, {$_POST['jrLABOURN']}, {$_POST['jrSTRN']}, {$_POST['jrPOINTS']})"); print "Job rank created! "; } else { print <<<EOF <form action='staff_jobs.php?action=newjobrank' method='post'> [b]Rank Name:[/b] <input type='text' name='jrNAME' /> [b]Pays:[/b] <input type='text' name='jrPAY' /> [b]Points:[/b] <input type='text' name='jrPOINTS' /> [b]Job:[/b] EOF; print job_dropdown($c,"jrJOB", -1); print <<<EOF [b]Gains:[/b] Str: <input type='text' name='jrSTRG' size=3 maxlength=3> Lab: <input type='text' name='jrLABOURG' size=3 maxlength=3> IQ: <input type='text' name='jrIQG' size=3 maxlength=3> [b]Reqs:[/b] Str: <input type='text' name='jrSTRN' size=5 maxlength=5> Lab: <input type='text' name='jrLABOURN' size=5 maxlength=5> IQ: <input type='text' name='jrIQN' size=5 maxlength=5> <input type='submit' value='Create Job Rank' /></form> EOF; } } function jobrankedit() { global $db,$ir,$userid; if ( $_POST['stage2']) { $db->query("UPDATE jobranks SET jrNAME='{$_POST['jrNAME']}', jrJOB = {$_POST['jrJOB']}, jrPAY= {$_POST['jrPAY']}, jrIQG={$_POST['jrIQG']}, jrLABOURG={$_POST['jrLABOURG']}, jrSTRG={$_POST['jrSTRG']}, jrIQN={$_POST['jrIQN']}, jrLABOURN={$_POST['jrLABOURN']}, jrSTRN={$_POST['jrSTRN']}, jrPOINTS={$_POST['jrPOINTS']} WHERE jrID={$_POST['jrID']}"); print "Job rank updated! "; } else if ( $_POST['stage1']) { $q=$db->query("SELECT * FROM jobranks WHERE jrID={$_POST['jrID']}"); $r=$db->fetch_row($q); print <<<EOF <form action='staff_jobs.php?action=jobrankedit' method='post'> <input type='hidden' name='stage2' value='1'> <input type='hidden' name='jrID' value='{$_POST['jrID']}'> [b]Job Rank Name:[/b] <input type='text' name='jrNAME' value='{$r['jrNAME']}'> [b]Job:[/b] EOF; print job_dropdown($c,'jrJOB',$r['jrJOB']); print <<<EOF [b]Pays:[/b] <input type='text' name='jrPAY' value='{$r['jrPAY']}' /> [b]Points:[/b] <input type='text' name='jrPOINTS' value='{$r['jrPOINTS']}' /> [b]Gains:[/b] Str: <input type='text' name='jrSTRG' size=3 maxlength=3 value='{$r['jrSTRG']}'> Lab: <input type='text' name='jrLABOURG' size=3 maxlength=3 value='{$r['jrLABOURG']}'> IQ: <input type='text' name='jrIQG' size=3 maxlength=3 value='{$r['jrIQG']}'> [b]Reqs:[/b] Str: <input type='text' name='jrSTRN' size=5 maxlength=5 value='{$r['jrSTRN']}'> Lab: <input type='text' name='jrLABOURN' size=5 maxlength=5 value='{$r['jrLABOURN']}'> IQ: <input type='text' name='jrIQN' size=5 maxlength=5 value='{$r['jrIQN']}'> [b]Job:[/b] <input type='submit' value='Edit' /> </form> EOF; } else { print <<<EOF <form action='staff_jobs.php?action=jobrankedit' method='post'> <input type='hidden' name='stage1' value='1'> Select a job rank to edit. EOF; print jobrank_dropdown($c, 'jrID', -1); print <<<EOF <input type='submit' value='Edit Job Rank' /> </form> EOF; } } function jobrankdele() { global $db,$ir,$userid; if ( $_POST['stage1']) { $q=$db->query("SELECT * FROM jobranks WHERE jrID={$_POST['jrID']}"); $jr=$db->fetch_row($q); $_POST['jID']=$jr['jrJOB']; $db->query("DELETE FROM jobranks WHERE jrID={$_POST['jrID']}"); print "Job rank successfully deleted! "; $db->query("UPDATE users u LEFT JOIN jobs j ON u.job=j.jID SET u.jobrank=j.jFIRST WHERE u.job={$_POST['jID']} and u.jobrank={$_POST['jrID']}"); $q=$db->query("SELECT * FROM jobs WHERE jFIRST={$_POST['jrID']}"); if($db->num_rows($q)) { $r=$db->fetch_row($q); print "[b]Warning![/b] The Job {$r['jNAME']} now has no first rank! Please go edit it and include a first rank. "; } } else { print <<<EOF <form action='staff_jobs.php?action=jobrankdele' method='post'> <input type='hidden' name='stage1' value='1'> Select a job rank to delete. EOF; print jobrank_dropdown($c, 'jrID', -1); print <<<EOF <input type='submit' value='Delete Job Rank' /> </form> EOF; } } function jobdele() { global $db,$ir,$userid; if ( $_POST['stage1']) { $db->query("DELETE FROM jobs WHERE jID={$_POST['jID']}"); print "Job rank successfully deleted! "; $db->query("DELETE FROM jobranks WHERE jrJOB={$_POST['jID']}"); print mysql_affected_rows()." job ranks deleted. "; $db->query("UPDATE users SET job=0,jobrank=0 WHERE job={$_POST['jID']}"); } else { print <<<EOF <form action='staff_jobs.php?action=jobdele' method='post'> <input type='hidden' name='stage1' value='1'> Select a job to delete. EOF; print job_dropdown($c, 'jID', -1); print <<<EOF <input type='submit' value='Delete Job' /> </form> EOF; } } function report_clear() { global $db,$db,$ir,$c,$h,$userid; if($ir['user_level'] > 3) { die("403"); } $_GET['ID'] = abs((int) $_GET['ID']); stafflog_add("Cleared player report ID {$_GET['ID']}"); $db->query("DELETE FROM preports WHERE prID={$_GET['ID']}"); print "Report cleared and deleted! [url='staff_users.php?action=reportsview']> Back[/url]"; } function newjobspec() { global $db,$ir,$userid; if ($_POST['jsNAME']) { $db->query("INSERT INTO jobspecials VALUES('', '{$_POST['jsNAME']}', {$_POST['jsJOB']}, {$_POST['jsCOST']}, {$_POST['jsMONEY']}, {$_POST['jsCRYSTALS']}, {$_POST['jsITEM']}, {$_POST['jsSTR']}, {$_POST['jsIQ']}, {$_POST['jsAGILITY']}, {$_POST['jsLABOUR']})"); print "Job special created! "; } else { print <<<EOF <form action='staff_jobs.php?action=newjobspec' method='post'> [b]Special Name:[/b] <input type='text' name='jsNAME' /> [b]Cost:[/b] <input type='text' name='jsCOST' /> [b]Job:[/b] EOF; print job_dropdown($c,"jsJOB", -1); print <<<EOF [b]Money Gain:[/b] <input type='text' name='jsMONEY' /> [b]Crystal Gain:[/b] <input type='text' name='jsCRYSTALS' /> [b]Item:[/b] EOF; print item_dropdown($c,"jsITEM", -1); print <<<EOF [b]Strength Gain:[/b] <input type='text' name='jsSTR' /> [b]IQ Gain:[/b] <input type='text' name='jsIQ' /> [b]Agility Gain:[/b] <input type='text' name='jsAGILITY' /> [b]Labour Gain:[/b] <input type='text' name='jsLABOUR' /> <input type='submit' value='Create Special' /></form> EOF; } } function jobspecedit() { global $db,$ir,$userid; if ( $_POST['stage2']) { $db->query("UPDATE jobspecials SET jsNAME='{$_POST['jsNAME']}', jsJOB = {$_POST['jsJOB']}, jsCOST= {$_POST['jsCOST']}, jsMONEY={$_POST['jsMONEY']}, jsCRYSTALS={$_POST['jsCRYSTALS']}, jsITEM={$_POST['jsITEM']}, jsSTR={$_POST['jsSTR']}, jsIQ={$_POST['jsIQ']}, jsAGILITY={$_POST['jsAGILITY']}, jsLABOUR={$_POST['jsLABOUR']} WHERE jsID={$_POST['jsID']}"); print "Job special updated! "; } else if ( $_POST['stage1']) { $q=$db->query("SELECT * FROM jobspecials WHERE jsID={$_POST['jsID']}"); $r=$db->fetch_row($q); print <<<EOF <form action='staff_jobs.php?action=jobspecedit' method='post'> <input type='hidden' name='stage2' value='1'> <input type='hidden' name='jsID' value='{$_POST['jsID']}'> [b]Job Special Name:[/b] <input type='text' name='jsNAME' value='{$r['jsNAME']}'> [b]Cost:[/b] <input type='text' name='jsCOST' value='{$r['jsCOST']}' /> [b]Job:[/b] EOF; print job_dropdown($c,'jsJOB',$r['jsJOB']); print <<<EOF [b]Money Gain:[/b] <input type='text' name='jsMONEY' value='{$r['jsMONEY']}' /> [b]Crystal Gain:[/b] <input type='text' name='jsCRYSTALS' value='{$r['jsCRYSTALS']}' /> [b]Item:[/b] EOF; print item_dropdown($c,'jsITEM',$r['jsITEM']); print <<<EOF [b]Strength Gain:[/b] <input type='text' name='jsSTR' value='{$r['jsSTR']}' /> [b]IQ Gain:[/b] <input type='text' name='jsIQ' value='{$r['jsIQ']}' /> [b]Agility Gain:[/b] <input type='text' name='jsAGILITY' value='{$r['jsAGILITY']}' /> [b]Labour Gain:[/b] <input type='text' name='jsLABOUR' value='{$r['jsLABOUR']}' /> <input type='submit' value='Edit Special' /> </form> EOF; } else { print <<<EOF <form action='staff_jobs.php?action=jobspecedit' method='post'> <input type='hidden' name='stage1' value='1'> Select a job special to edit. EOF; print jobspec_dropdown($c, 'jsID', -1); print <<<EOF <input type='submit' value='Edit Job Special' /> </form> EOF; } } function jobspecdele() { global $db,$ir,$userid; if ( $_POST['stage1']) { $q=$db->query("SELECT * FROM jobspecials WHERE jsID={$_POST['jsID']}"); $jr=$db->fetch_row($q); $_POST['jID']=$jr['jsJOB']; $db->query("DELETE FROM jobspecials WHERE jsID={$_POST['jsID']}"); print "Job special successfully deleted! "; } else { print <<<EOF <form action='staff_jobs.php?action=jobspecdele' method='post'> <input type='hidden' name='stage1' value='1'> Select a job special to delete. EOF; print jobspec_dropdown($c, 'jsID', -1); print <<<EOF <input type='submit' value='Delete Job Special' /> </form> EOF; } } $h->endpage(); ?>
  9. Re: Simple Job Specials [V2] Well, as far as I can see, it sounds like you have two jobrank edit functions in your staff_jobs.php
  10. Re: Simple Marriage [V2] Will problem should be fixed, also, Ive reduced the amount of roses to 5
  11. This is a very basic marriage modification. It has very few features, I will be adding more when I think of ideas. SQL:   ALTER TABLE users ADD marriage INT(11) NOT NULL DEFAULT '0'; CREATE TABLE `proposals` ( `prID` int(11) NOT NULL auto_increment, `prFROM` int(11) NOT NULL default '0', `prUSER` int(11) NOT NULL default '0', PRIMARY KEY (`prID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;   Create a special item called 'Bouquet of Roses'. Add a link to marriage.php in the explore page. Create marriage.php   <?php include "globals.php"; print "<center><font size='4' face='Arial, Helvetica, sans-serif'>Marriage</font><hr width=75%>"; switch($_GET['action']) { case 'propose': propose_marriage(); break; case 'roses': send_roses(); break; case 'note': send_note(); break; case 'divorce': divorce_marriage(); break; case 'confirm': divorce_confirm(); break; case 'accept': accept_proposal(); break; case 'decline': decline_proposal(); break; default: marriage_index(); break; } function marriage_index() { global $ir,$c,$userid, $db; print "<center> Welcome to the marriage office! What would you like to do today? "; if (!$ir['marriage']) { print "> [url='marriage.php?action=propose']Propose marriage[/url] "; } else { print "> [url='marriage.php?action=divorce']Divorce partner[/url] > [url='marriage.php?action=roses']Send Bouquet of Roses ($10,000)[/url] > [url='marriage.php?action=note']Send a love note[/url] "; } print " <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } function propose_marriage() { global $db,$ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); if(!$_POST['ID']) { print " <form action='marriage.php?action=propose' method='post'> Please type the ID# of the user you wish to propose to below. ID: <input type='text' name='ID' value='{$_GET['ID']}' maxlength='10' length='10' size='10' width='10' /> <input type='submit' value='Propose' /> </form> <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else if($ir['marriage']) { print " You are already married. <hr width=75%>> [url='trade.php']Back[/url]<hr width=75%>"; } else if($_POST['ID'] == $userid) { print " You cannot propose to yourself! <hr width=75%>> [url='marriage.php']Back[/url]<hr width=75%>"; } else { $db->query("INSERT INTO proposals VALUES ('', '$userid', '{$_POST['ID']}')", $c); $q=$db->query("SELECT * FROM proposals WHERE prFROM=$userid"); $r=$db->fetch_row($q); event_add($_POST['ID'], "{$ir['username']} would like to marry you: • [url='marriage.php?action=accept&ID={$r[']Accept[/url] • [url='marriage.php?action=decline&ID={$r[']Decline[/url]", $c,'general'); print " Proposal sent! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } } function accept_proposal() { global $db,$ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); $q=$db->query("SELECT * FROM proposals WHERE prID={$_GET['ID']}"); $r=$db->fetch_row($q); if(!$_GET['ID']) { print " Invalid proposal ID! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else if($r['prUSER'] != $userid) { print " You cannot accept this proposal! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else { $q=$db->query("SELECT * FROM proposals WHERE prUSER=$userid"); $r=$db->fetch_row($q); event_add($r['prFROM'], "{$ir['username']} has accepted your proposal!", $c); $db->query("UPDATE users SET marriage={$r['prFROM']} WHERE userid=$userid"); $db->query("UPDATE users SET marriage=$userid WHERE userid={$r['prFROM']}"); $db->query("DELETE FROM proposals WHERE prID={$_GET['ID']}"); print " Proposal accepted! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } } function decline_proposal() { global $db,$ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); $q=$db->query("SELECT * FROM proposals WHERE prID={$_GET['ID']}"); $r=$db->fetch_row($q); if(!$_GET['ID']) { print " Invalid proposal ID! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else if($r['prUSER'] != $userid) { print " You cannot decline this proposal! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else { $q=$db->query("SELECT * FROM proposals WHERE prID={$_GET['ID']}"); $r=$db->fetch_row($q); event_add($r['prFROM'], "{$ir['username']} has declined your proposal.", $c); $db->query("DELETE FROM proposals WHERE prID={$_GET['ID']}"); print " Proposal declined! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } } function divorce_marriage() { global $db,$ir,$c,$userid,$h; if ($ir['marriage']) { print " Are you sure you wish to divorce your partner? <hr width=75%><table width=75%><tr><td width=50% align='center'>> [url='marriage.php']No[/url]</td><td width=50% align='center'>> [url='marriage.php?action=confirm']Yes[/url]</td></tr></table><hr width=75%>"; } else { print " You are not married! <hr width=75%>> [url='marriage.php']Back[/url]<hr width=75%>"; } } function divorce_confirm() { global $db,$ir,$c,$userid,$h; if ($ir['marriage']) { print " You divorced your partner! <hr width=75%>> [url='marriage.php']Back[/url]<hr width=75%>"; $db->query("UPDATE users SET marriage=0 WHERE userid={$ir['marriage']}"); $db->query("UPDATE users SET marriage=0 WHERE userid=$userid"); } else { print " You are not married! <hr width=75%>> [url='marriage.php']Back[/url]<hr width=75%>"; } } function send_roses() { global $db,$ir,$c,$userid,$h; if ($ir['marriage']) { if ($ir['money']>1000) { print " You sent a Bouquet of Roses to your partner! <hr width=75%>> [url='marriage.php']Back[/url]<hr width=75%>"; $db->query("UPDATE users SET money=money-10000 WHERE userid=$userid"); $rand=rand(12,27); $part=$db->query("SELECT * FROM users WHERE userid={$ir['marriage']}"); $pr=$db->fetch_row($part); $will=($pr['maxwill']-$pr['will']); if ($rand<$will) { $db->query("UPDATE users SET will=will+$rand WHERE userid={$ir['marriage']}"); } else { $db->query("UPDATE users SET will=maxwill WHERE userid={$ir['marriage']}"); } event_add($ir['marriage'], "{$ir['username']} sent you a Bouquet of Roses restoring $rand Will!", $c); $rose=$db->query("SELECT * FROM items WHERE itmname='Bouquet of Roses'"); $rs=$db->fetch_row($rose); $db->query("INSERT INTO inventory VALUES('',{$rs['itmid']},{$ir['marriage']},'1');",$c); } else { print " You are not married! <hr width=75%>> [url='marriage.php']Back[/url]<hr width=75%>"; } } } function send_note() { global $db,$ir,$c,$userid,$h; if (!$_POST['note']) { print " <form action='marriage.php?action=note' method='post'> Please type a love note to send to your partner. Note: <textarea rows='5' cols='34%' name='note'></textarea> <input type='submit' value='Send' /> </form> <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else { $note=str_replace(array("\n"),array(" "),strip_tags($_POST['note'])); $db->query("INSERT INTO mail VALUES ('',0,$userid,{$ir['marriage']},unix_timestamp(),'Love Note','$note')",$c) or die($db->error()); $db->query("UPDATE users SET new_mail=new_mail+1 WHERE userid={$ir['marriage']}"); print " Your love note was sent to your partner! <hr width=75%>> [url='marriage.php']Back[/url]<hr width=75%>"; } } $h->endpage(); ?>   Add into viewuser.php print "Marital Status: "; if ($r['marriage']) { $part=$db->query("SELECT * FROM users WHERE userid={$r['marriage']}"); $pr=$db->fetch_row($part); print "Married to [url='viewuser.php?u={$pr[']{$pr['username']}[/url]"; } else { print "Single"; } print " ";   If I get any suggestions on new features I'll try my best to add them :) Please don't request Shared Housing, Some of my recent mods have proved that I'm not very good when it comes to Housing mods.
  12. Re: Personals [V2] to fix money problem, above the "Your personal ad was submitted to the newspaper" line add: $db->query("UPDATE users SET money=money-10000 WHERE userid=$userid");
  13. Re: Personals [V2] Actually I can't stand it, to be honest I just don't have much of an imagination for mod ideas...
  14. SQL:   CREATE TABLE `personals` ( `prID` int(11) NOT NULL auto_increment, `prUSER` int(11) NOT NULL default '0', `prTYPE` int(11) NOT NULL default '0', `prIMAGE` varchar(255) NOT NULL default '', `prGENERAL` varchar(255) NOT NULL default '', `prLIKES` varchar(255) NOT NULL default '', `prDISLIKES` varchar(255) NOT NULL default '', `prAGE` int(11) NOT NULL default '0', PRIMARY KEY (`prID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;   Create personals.php   <?php include "globals.php"; print "<center><font size='4' face='Arial, Helvetica, sans-serif'>Personals</font><hr width=90%>"; switch($_GET['action']) { case 'search': personals_search(); break; case 'add': add_personal_conf(); break; case 'add2': add_personal_form(); break; case 'add3': add_personal_submit(); break; case 'delete': delete_personal(); break; default: personals_home(); break; } function personals_home() { global $ir,$c,$userid, $db; print "<center> Welcome to the personals pages! Who are you seeking? Search below or put up your own ad! <form method='get' action='personals.php?action=search'> <input type=hidden name=action value=search> <select name=type> <option value=1>I am a Man seeking a Woman</option> <option value=2>I am a Woman seeking a Man</option> <option value=3>I am a Man seeking a Man</option> <option value=4>I am a Woman seeking a Woman</option> </select><input type=submit value='Search'> </form> > [url='personals.php?action=add']Put up your own personal advertisement[/url] > [url='newspaper.php']Flip back to the front page[/url] "; } function personals_search() { global $ir,$c,$userid, $db; if (!$_GET['type']) { print " You did not select a category! <hr width=90%>> [url='personals.php']Back[/url]<hr width=90%>"; } else { $q=$db->query("SELECT * FROM personals WHERE prTYPE={$_GET['type']} LIMIT 20"); while($r=$db->fetch_row($q)) { $x=$db->query("SELECT * FROM users WHERE userid={$r['prUSER']}"); $y=$db->fetch_row($x); print "<table width=90%><tr bgcolor=#DFDFDF rowspan=3><td width=1% colspan=3 rowspan=3>[img={$r[]</td><td>[url='viewuser.php?u={$r['][b]{$y['username']}[/b][/url] [url='mailbox.php?action=compose&ID={$y['][b][{$y['userid']}][/b][/url]</td></tr> <tr><td> [b]General:[/b] {$r['prGENERAL']} [b]Likes:[/b] {$r['prLIKES']} [b]Dislikes:[/b] {$r['prDISLIKES']} [b]Age:[/b] {$r['prAGE']} </td></tr><tr bgcolor=#DFDFDF><td> <font color=#999999>[i][[/i]</font>[url='mailbox.php?action=compose&ID={$r[']<font color=#777777>[i]Send them a message[/i]</font>[/url]<font color=#999999>[i]][/i]</font> <font color=#999999>[i][[/i]</font>[url='viewuser.php?u={$r[']<font color=#777777>[i]View their profile[/i]</font>[/url]<font color=#999999>[i]][/i]</font>"; if ($r['prUSER'] == $userid) { print " [[/i]</font>[url='personals.php?action=delete&ID={$r[']<font color=#777777>[i]Delete ad[/i]</font>[/url]<font color=#999999>[i]][/i]</font>"; } print "</td></tr><tr><td> </td></tr></table> "; } print "<hr width=90%>> [url='personals.php']Back[/url]<hr width=90%>"; } } function add_personal_conf() { global $ir,$c,$userid, $db; print "<table width=90%><tr><td><center>It will cost [b]$10,000[/b] to add your personals advertisement to the newspaper, we are sorry for this high price. We wish we could put everyone up on here, but we just can't fit all of you on. Only those who can afford our services will get the chance to find the love of their life. Remember, once you have put your ad up, it will be up until 30 more people have posted. During this time, you will not be able to post another ad. <form method='post' action='personals.php?action=add2'> <input type=submit value='Place an ad'> </form> > <a href=personals.php>Back</a> </td></tr></table>"; } function add_personal_form() { global $ir,$c,$userid, $db; $pr=$db->query("SELECT * FROM personals WHERE prUSER=$userid"); $prs=$db->num_rows($pr); if ($prs) { print " You already have a personal ad in the Newspaper! <hr width=90%>> [url='personals.php']Back[/url]<hr width=90%>"; } else if($ir['money'] < 10000) { print " You do not have enough money to place a personal in the Newspaper! <hr width=90%>> [url='personals.php']Back[/url]<hr width=90%>"; } else { print "<form method='post' action='personals.php?action=add3'> <table width=90%> <tr><td bgcolor=#999999 colspan=2><center>[b]Please fill in the boxes below[/b]</td></tr> <tr><td align=center width=50% bgcolor=#DFDFDF>[b]Who are you?[/b]</td><td align=center width=50% bgcolor=#DFDFDF> <select name=type> <option value=1>I am A Man seeking Woman</option> <option value=2>I am A Woman seeking Man</option> <option value=3>I am A Man seeking Man</option> <option value=4>I am A Woman seeking Woman</option> </select> </td></tr> <tr><td align=center width=50% bgcolor=#DFDFDF>[b]Which image would you like to use?[/b]</td><td align=center width=50% bgcolor=#DFDFDF> <input type='text' name='image' size='35' maxlength='1000'> </td></tr> <tr><td align=center width=50% bgcolor=#DFDFDF>[b]A short description of yourself[/b]</td><td align=center width=50% bgcolor=#DFDFDF> <input type='text' name='general' size='35' maxlength='250'> </td></tr> <tr><td align=center width=50% bgcolor=#DFDFDF>[b]What are your likes?[/b]</td><td align=center width=50% bgcolor=#DFDFDF> <input type='text' name='likes' size='35' maxlength='65'> </td></tr> <tr><td align=center width=50% bgcolor=#DFDFDF>[b]What are your dislikes?[/b]</td><td align=center width=50% bgcolor=#DFDFDF> <input type='text' name='dislikes' size='35' maxlength='65'> </td></tr> <tr><td align=center width=50% bgcolor=#DFDFDF>[b]What is your age?[/b]</td><td align=center width=50% bgcolor=#DFDFDF> <input type='text' name='age' size='2' maxlength='2'> </td></tr> <tr><td bgcolor=#DFDFDF colspan=2><center> <input type=submit value='Place your advertisement'> </td></tr> </table> </form> > [url='personals.php?action=add']Back[/url] "; } } function add_personal_submit() { global $ir,$c,$userid, $db; if($_POST['type'] && $_POST['image'] && $_POST['general'] && $_POST['likes'] && $_POST['dislikes'] && $_POST['age']) { $db->query("INSERT INTO personals VALUES(NULL, '$userid', '{$_POST['type']}', '{$_POST['image']}', '{$_POST['general']}', '{$_POST['likes']}', '{$_POST['dislikes']}', '{$_POST['age']}')"); print " Your personal advertisement was submitted to the newspaper! <hr width=90%>> [url='personals.php']Back[/url]<hr width=90%>"; } else { print " You missed one or more of the required fields! <hr width=90%>> [url='personals.php']Back[/url]<hr width=90%>"; } } function delete_personal() { global $ir,$c,$userid, $db; if($_GET['ID']) { $db->query("DELETE FROM personals WHERE prID={$_GET['ID']} AND prUSER=$userid"); print " Personal ad deleted from newspaper. <hr width=90%>> <a href='personals.php'>Back<hr width=90%>"; } else { print " You didn't select an ad to delete. <hr width=90%>> <a href='personals.php'>Back<hr width=90%>"; } } $h->endpage(); ?>
  15. Re: Game Ranks Ive made a hall of fame option to show top 20 users by game rank, since I have no users I can't really test it at the moment, but here it is. Open halloffame.php add this function function hof_rank() { global $db,$ir,$c,$userid, $myf; print "Showing the 20 users with the highest rank <table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>Pos</th> <th>User</th> <th>Rank</th> </tr>"; $q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang LEFT JOIN userstats us ON us.userid=u.userid LEFT JOIN houses h ON h.hWILL=u.maxwill WHERE u.user_level != 0 $myf ORDER BY u.level*u.level*3000+h.hPRICE+us.strength+us.agility+us.guard+us.labour+us.IQ*10 DESC,userid ASC LIMIT 20"); $p=0; while($r=$db->fetch_row($q)) { $p++; if($r['userid'] == $userid) { $t="[b]";$et="[/b]"; } else { $t="";$et=""; } print "<tr> <td>$t$p$et</td> <td>$t{$r['gangPREF']} {$r['username']} [{$r['userid']}]$et</td> <td>[b]".get_gamerank($r['level'],$r['hPRICE'],$r)."[/b]</td> </tr>"; } print "</table>"; }   Add this case: case "rank": hof_rank(); break;   Just add a link to: halloffame.php?action=rank&filter=all
  16. Re: Simple Job Specials [V2] did you replace the jobrankedit function? or just add it in
  17. Re: House Rentals [V2] Im so sorry
  18. Re: Multiple Houses [V2] Ill try to edit so it doesnt show default house
  19. Re: House Rentals [V2] I think this rent function may be fixed now, I think it was giving the property to the original owner instead of the renter. function buy_house() { global $db,$ir,$c,$userid,$h; $q=$db->query("SELECT rent.*, h.*, u.* FROM rentalmarket rent LEFT JOIN houses h ON rentHOUSE=h.hID LEFT JOIN users u ON u.userid=rent.rentOWNER ORDER BY rent.rentCOST, rent.rentDAYS ASC",$c); if(!$db->num_rows($q)) { print "This house is already occupied. [url='rentals.php']> Back[/url]"; $h->endpage(); exit; } $r=$db->fetch_row($q); if($r['rentCOST'] > $ir['money']) { print "Error, you do not have the funds to start renting this house. [url='rentals.php']> Back[/url]"; $h->endpage(); exit; } event_add($r['rentOWNER'],"[url='viewuser.php?u=$userid']{$ir['username']}[/url] is now renting your {$r['hNAME']} for {$r['rentCOST']} per day.",$c); $db->query("INSERT INTO `properties` (`prID`, `prOWNER`, `prHOUSE`) VALUES ('{$r['rentPROP']}', '$userid', '{$r['hID']}');",$c); $db->query("INSERT INTO `rentals` (`reID`, `reOWNER`, `rePID`, `reRENTER`, `reDAYS`, `reCOST`) VALUES ('NULL', '$userid', '{$r['rentPROP']}', '$userid', '{$r['rentDAYS']}', '{$r['rentCOST']}');",$c); $db->query("DELETE FROM rentalmarket WHERE rentID={$_GET['ID']}",$c); $db->query("UPDATE users SET rent={$r['rentCOST']} WHERE userid=$userid",$c); print "You are now renting the {$r['hNAME']} for \$".number_format($r['rentCOST'])." per day."; }
  20. Re: House Rentals [V2] Thanks for that radio_active, I'll have to make sure I test my mods alot more before posting
  21. Re: Simple Trades [V2] If someone is using this at the moment, would you be able to check if it sets both user's trade to 0 in phpmyadmin after the trade is accepted please? :)
  22. Re: Simple Trades [V2] Ive tried, but I cant figure out whats wrong with it
  23. Re: House Rentals [V2] I think it's fixed now, Im terribly sorry to everyone that the bug affected
  24. Re: House Rentals [V2] Im very sorry, I'll fix it
  25. Re: Simple Trades [V2] I've fixed the 'You are already in a trade' bug. The first post has been updated, so just replace trade.php
×
×
  • Create New...