Jump to content
MakeWebGames

Uridium

Members
  • Posts

    2,691
  • Joined

  • Last visited

  • Days Won

    85

Everything posted by Uridium

  1. Re: one of my mods deleted ? Well those that were lucky enough to have the script from yesterday i guess your the only pople who have it :) which i guess makes your game unique as i wont be reposting the script.
  2. Quick question why was one of my mods deleted... the one that allows users to set a price for their being rescued from jail. This was an original script and wasnt stolen if thats what any staff here are thinknig myself and Richard did it from scratch.. so why was it removed. ok excerts were taken from preferences.php and jailbail.php
  3. Re: [MCCODES V2] Updated Jail now lets users Offer rescue Price edits
  4. Before i start a massive Thank You to RICHARD for his emmense help with this script :) The usual jail allows users to jailbail and bust which i found to be quite Crap. So what makes this one better... Well this one allows your players to set their own amount to be rescued from jail. when a player rescues them they will recieve the asking price for the bail rather than a set bail amount as before... open up preferences.php and add these new cases... case 'rescuechange2': do_bail_offer(); break; case 'rescuechange': bail_offer(); break; Staying in preferences.php add function bail_offer() { global $ir,$c,$userid,$h; print "<h3>Change Rescue Cost</h3> Please note that 0 will be in place if you dont have ther cash to cover a rescue <form action='preferences.php?action=rescuechange2' method='post'> New Rescue Ammount: <input type='text' name='bailoffer' /> <input type='submit' value='Change Rescue Ammount' /></form>"; } function do_bail_offer() { global $db,$ir,$c,$userid,$h; if($_POST['bailoffer'] == "") { print "You did not enter an ammount [url='preferences.php?action=rescuechange']> Back[/url]"; } else { $db->query("UPDATE users SET rescue='{$_POST['bailoffer']}' WHERE userid=$userid"); print "<h1>rescue Amount changed changed!</h1>"; } } Add this to the links section in the same file [url='preferences.php?action=rescuechange']Change Rescue Offer[/url] Now run this small SQL ALTER TABLE `users` ADD `rescue` INT( 11 ) NOT NULL DEFAULT '0'; now call this file rescue.php <?php include "globals.php"; if($ir['jail']) { echo 'You are stuck in the Jail right now.'; } else { $fetch = $db->query(sprintf("SELECT * FROM `users` WHERE (`userid` = '%u')", abs((int) $_GET['ID']))); if(!mysql_num_rows($fetch)) { echo 'You cannot bail out a non-existant user.'; } else { $r = $db->fetch_row($fetch); if(!$r['jail']) { echo 'This user is no longer stuck in Jail.'; } if($r['rescue'] AND ($r['money'] > $r['rescue'])) { $cost = $r['rescue']; } else { $cost = 0; } if($ir['money'] < $cost) { echo 'You cannot afford to bail this user out of Jail right now.'; } else { echo 'You have bailed '.$r['username'].' out of Jail for a total of $'.number_format($cost).'.'; $db->query(sprintf("UPDATE `users` SET `money` = `money` - '%d', `jail` = '0' WHERE `userid` = '%u'", $cost, $r['userid'])); $db->query(sprintf("UPDATE `users` SET `money` = `money` + '%d' WHERE `userid` = '%u'", $ir['userid'])); event_add($r['userid'], "[url='viewuser.php?u={$ir[']{$ir['username']}[/url] bailed you out of jail.", $c); } } } $h->endpage(); ?> and finally call this jail.php <?php include "globals.php"; if($r['rescue'] AND ($r['money'] > $r['rescue'])) { $cost = $r['rescue']; } else { $cost = 0; } if($ir['hospital']) { die("<h1>You are in hospital so whats the point</h1>"); } print "<h3>Jail</h3> <table width='75%' class=\"table\" border=\"0\" cellspacing=\"1\"><tr bgcolor=grey><th>Name</th> <th>Level</th> <th>Time</th><th>Reason</th><th>Rescue Price</th> <th>Actions</th></tr>"; $q=$db->query("SELECT u.*,c.* FROM users u LEFT JOIN gangs c ON u.gang=c.gangID WHERE u.jail > 0 ORDER BY u.jail DESC"); while($r=$db->fetch_row($q)) { print "\n<tr><td>{$r['gangPREF']} [url='viewuser.php?u={$r[']{$r['username']}[/url] [{$r['userid']}]</td><td>{$r['level']}</td><td>{$r['jail']} minutes</td><td>{$r['jail_reason']}</td><td>\$ {$r['rescue']}</td> <td>[[url='rescue.php?ID={$r[']Rescue[/url]]</td></tr>"; } print "</table>"; print"<h3>You are currently Offering $rescue as your rescue reward</h3>"; $h->endpage(); ?> Screenie
  5. Re: [mccode v1 v2] player card Stupid dyslexic Keyboards that was supposed to say Doesn't not Does :)
  6. Re: [mccode v1 v2] player card As Eternal Said this does work in offline mode I used it on Xampp and either got the DIE error or scambled image as text. Im suposing this has something to do with Xampp not being able to cope with GD2.
  7. Re: [MCCODES V2] Stop Users Refreshing attack pages / Leaving Fight Im assuming your game from the attack.php shows the header and mainmenu You can defeat this by opening globals.php change header.php to header2.php also change the file globals to globals2.php in your attack.php change include "globals.php"; to include "globals2.php"; open header.php and remove any parts that will display mainmenu or the players stats links and rename file header2.php goto viewuser.php and rename attack.php to attack2.php Your users dont have any links to click on now.
  8. This will stop your users from Refreshing pages or Opening new pages when they are in a fight... add this near the bottom of your attack.php before the $h->endpage();   $_GET['userid']=abs((int) $_GET['userid']); if(($_SESSION['userid'] == $r['userid']) || $r['userid']<100) { die ("Do Not Try Refreshing Pages [url='attack.php?ID={$_GET[']Continue Fight[/url]"); }   If a page is Refreshed they will be back straight into the fight with their opponent.
  9. Re: [mccode v1 v2] player card Eternal showed me this script when it had just two lines and said I have an Idea. This was whilst we were chatting about MCC not having a compare items or homes script. Now thats hes finished it and ive seen it working this is a GREAAAAAAAt mod :) very easy to alter and very easy to install nice one :) +1
  10. As I havent seen this available on MCC i decided to make a mod whereby the owner can compare different Items and houses they have added to their games... call this file compare.php   <?PHP include "globals.php"; global $db,$ir,$c; switch($_GET['action']) { case 'compareitem': compare_item_begin(); break; case 'compareitemform': compare_item_form(); break; case 'compareitemsub': compare_item_sub(); break; case 'comparehouse': comparehouse(); break; default: print "Error: This script requires an action."; break; } function compare_item_begin() { global $db,$ir,$c,$h,$userid; if($ir['user_level'] > 2) { die("403"); } print "<h3>comparing Item</h3> You can compare any aspect of this item. <form action='compare.php?action=compareitemform' method='post'> Item: ".item_dropdown($c,'item')." <input type='submit' value='Compare Item From Dropdown' /></form> <form action='compare.php?action=compareitemform' method='post'> Compare Item BY ID: <input type='text' name='item' value='0' /> <input type='submit' value='Compare Item BY ID' /></form>"; } function compare_item_form() { global $db,$ir,$c,$h; if($ir['user_level'] > 2) { die("403"); } $d=$db->query("SELECT * FROM items WHERE itmid={$_POST['item']}"); $itemi=$db->fetch_row($d); print "<h3>compareing Item</h3> <form action='compare.php?action=compareitem' method='post'> <input type='hidden' name='itmid' value='{$_POST['item']}' /> Item Name: <input type='text' name='itmname' value='{$itemi['itmname']}' /> Item Desc.: <input type='text' name='itmdesc' value='{$itemi['itmdesc']}' /> Item Type: ".itemtype_dropdown($c,'itmtype',$itemi['itmtype'])." Item Buyable: <input type='checkbox' name='itmbuyable'"; if ($itemi['itmbuyable']) { print " checked='checked'"; } print " /> Item Price: <input type='text' name='itmbuyprice' value='{$itemi['itmbuyprice']}' /> Item Sell Value: <input type='text' name='itmsellprice' value='{$itemi['itmsellprice']}' /><hr />[b]Usage Form[/b]<hr />"; $stats=array( "energy" => "Energy", "will" => "Will", "brave" => "Brave", "hp" => "Health", "strength" => "Strength", "agility" => "Agility", "guard" => "Guard", "labour" => "Labour", "IQ" => "IQ", "hospital" => "Hospital Time", "jail" => "Jail Time", "money" => "Money", "crystals" => "Crystals", "cdays" => "Education Days Left", "bankmoney" => "Bank money", "cybermoney" => "Cyber money", "crimexp" => "Crime XP"); for($i=1;$i<=3;$i++) { if($itemi["effect".$i]) { $efx=unserialize($itemi["effect".$i]); } else { $efx=array("inc_amount" => 0); } $switch1=($itemi['effect'.$i.'_on'] > 0) ? " checked='checked'" : ""; $switch2=($itemi['effect'.$i.'_on'] > 0) ? "" : " checked='checked'"; print "[b]<u>Effect {$i}</u>[/b] On? <input type='radio' name='effect{$i}on' value='1'$switch1 /> Yes <input type='radio' name='effect{$i}on' value='0'$switch2 /> No Stat: <select name='effect{$i}stat' type='dropdown'>"; foreach($stats as $k => $v) { if($k==$efx['stat']) { print "<option value='{$k}' selected='selected'>{$v}</option>\n"; } else { print "<option value='$k'>{$v}</option>\n"; } } if($efx['dir']=="neg") { $str="<option value='pos'>Increase</option><option value='neg' selected='selected'>Decrease</option>"; } else { $str="<option value='pos' selected='selected'>Increase</option><option value='neg'>Decrease</option>"; } if($efx['inc_type']=="percent") { $str2="<option value='figure'>Value</option><option value='percent' selected='selected'>Percent</option>"; } else { $str2="<option value='figure' selected='selected'>Value</option><option value='percent'>Percent</option>"; } print "</select> Direction: <select name='effect{$i}dir' type='dropdown'>{$str} </select> Amount: <input type='text' name='effect{$i}amount' value='{$efx['inc_amount']}' /> <select name='effect{$i}type' type='dropdown'>{$str2}</select><hr />"; } print "[b]Combat Usage[/b] Weapon Power: <input type='text' name='weapon' value='{$itemi['weapon']}' /> Armor Defense: <input type='text' name='armor' value='{$itemi['armor']}' /><hr /> <input type='submit' value='Next Item To Compare' /></form>"; } function compare_item_sub() { global $db,$ir,$c,$h,$userid; if($ir['user_level'] > 2) { die("403"); } if(!isset($_POST['itmname']) || !isset($_POST['itmdesc']) || !isset($_POST['itmtype']) || !isset($_POST['itmbuyprice']) || !isset($_POST['itmsellprice'])) { print "You missed one or more of the fields. Please go back and try again. [url='compare.php?action=compareitem']> Back[/url]"; $h->endpage(); exit; } } function comparehouse() { global $db, $ir, $c, $h, $userid; switch($_POST['step']) { case "2": $price=abs((int) $_POST['price']); $will=abs((int) $_POST['will']); $q=$db->query("SELECT * FROM houses WHERE hWILL={$will} AND hID!={$_POST['id']}"); if($db->num_rows($q)) { print "Sorry, you cannot have two houses with the same maximum will."; $h->endpage(); exit; } $name=$_POST['name']; $q=$db->query("SELECT * FROM houses WHERE hID={$_POST['id']}"); $old=$db->fetch_row($q); if($old['hWILL'] == 100 && $old['hWILL'] != $will) { die("Sorry, this house's will bar cannot be compareed."); } print "<h3>compareing a House</h3><hr /> <form action='compare.php?action=comparehouse' method='post'> <input type='hidden' name='step' value='1' /> House: ".house_dropdown($c, "house")." <input type='submit' value='compare House' /></form>"; break; case "1": $q=$db->query("SELECT * FROM houses WHERE hID={$_POST['house']}"); $old=$db->fetch_row($q); print "<h3>compareing a House</h3><hr /> <form action='compare.php?action=comparehouse' method='post'> <input type='hidden' name='step' value='2' /> <input type='hidden' name='id' value='{$_POST['house']}' /> Name: <input type='text' name='name' value='{$old['hNAME']}' /> Price: <input type='text' name='price' value='{$old['hPRICE']}' /> Max Will: <input type='text' name='will' value='{$old['hWILL']}' /> <input type='submit' value='compare House' /></form>"; break; default: print "<h3>compareing a House</h3><hr /> <form action='compare.php?action=comparehouse' method='post'> <input type='hidden' name='step' value='1' /> House: ".house_dropdown($c, "house")." <input type='submit' value='compare House' /></form>"; break; } } ?>   add these link to smenu.php compare.php?action=compareitem compare.php?action=comparehouse You can Switch Between Items or houses without adding anything to your dbase so you cant harm anything... EDITED as Compare form wasnt working Correctly... Now Fixed
  11. Re: Battle ladder [Mccodes V2] call this file battle_ladder.php   <?php include_once ('globals.php'); switch($_GET['page']) { case 'signup': ladder_signup(); break; default: ladder_index(); break; } function ladder_index() { global $ir, $db; if(!isset($_GET['id'])) { echo '<h2>Battle Ladder</h2> [url="battle_ladder.php?page=signup"][b]Join a ladder[/b][/url] [url="battle_ladder.php?id='.$r['bmemberLadder'].'"]<h2>'.stripslashes($r['ladder_name']).'</h2>[/url] (Level '.$r['maxentry_level'].' Required) <table width="300"> <tr> <td>'; $fetch = $db->query("SELECT * FROM `ladder_settings` ORDER BY `maxentry_level` ASC"); while ($r = $db->fetch_row($fetch)) { $count ++; echo $count.'. [url="battle_ladder.php?id='.$r['ladder_id'].'"]'.stripslashes($r['ladder_name']).'[/url] (Level '.$r['maxentry_level'].' Required) '; } echo '</td> </tr> </table>'; } else { $fetch = $db->query(sprintf("SELECT * FROM `battle_members` LEFT JOIN `users` ON `userid` = `bmemberUser` WHERE `bmemberLadder` = '%u' ORDER BY `bmemberScore` DESC", abs((int) $_GET['id']))); if(!$db->num_rows($fetch)) { echo '<h2>No Members are apart of this Ladder Yet</h2>'; } else { echo '<table width="600" class="table"> <tr> <th width="10%">Rank</th> <th width="40%">Name</th> <th width="20%">Score</th> <th width="15%">Wins</th> <th width="15%">Losses</th> <th width="25%">Hospital</th> <th width="25%">Attack</th> </tr>'; while($r = $db->fetch_row($fetch)) { $count ++; echo '<tr> <td align="center">'.$count.'</td> <td>[url="viewuser.php?u='.$r['userid'].'"]'.$r['username'].'[/url]</td> <td>'.number_format($r['bmemberScore']).'</td> <td>'.$r['bmemberWins'].'</td> <td>'.$r['bmemberLosses'].'</td> <td>'.$r['hospital'].' Mins</td> <td>[url="attack.php?ID='.$r['userid'].'&ladder='.$r['bmemberLadder'].'"]Attack[/url]</td> </tr>'; } } } } function ladder_signup() { global $ir, $db; if(!isset($_GET['id'])) { echo '<h2>Join a ladder</h2> You are qualified to join one of the ladders shown below. <table width="300" border="5"> <tr> <td>'; $fetch = $db->query(sprintf("SELECT * FROM `ladder_settings` WHERE `maxentry_level` <= '%d' ORDER BY `maxentry_level` ASC", $ir['level'])); while ($r = $db->fetch_row($fetch)) { echo '[url="battle_ladder.php?page=signup&id='.$r['ladder_id'].'"]<h2>'.stripslashes($r['ladder_name']).'</h2>[/url] '.stripslashes($r['ladder_description']).' '; } echo '</td> </tr> </table>'; } else { $check = $db->query(sprintf("SELECT * FROM `battle_members` WHERE `bmemberUser` = '%u'", $ir['userid'])); if($db->num_rows($check)) { echo 'You are part of another ladder at this time, wait for that to finish before joining another.'; } else { $sql = $db->query(sprintf("SELECT * FROM `ladder_settings` WHERE `ladder_id` = '%u'", abs((int) $_GET['id']))); $r = $db->fetch_row($sql); if($r['maxentry_level'] > $ir['level']) { echo 'You are not experienced enough to join this ladder right now.'; } else { $db->query(sprintf("INSERT INTO `battle_members` (`bmemberId`, `bmemberUser`, `bmemberLadder`, `bmemberScore`) VALUES ('NULL','%u', '%d', '%d')", $ir['userid'], $r['ladder_id'], 100)); echo '<h3>You have signed up to the </h3><h2>'.stripslashes($r['ladder_name']).'</h2><h3>, attack other members of that ladder to increase the score.</h3>'; } } } } $h->endpage(); ?>   These tables that were given by RICHARD are no longer needed   CREATE TABLE IF NOT EXISTS `battle_ladders` ( `ladderId` int(11) NOT NULL AUTO_INCREMENT, `ladderName` varchar(255) NOT NULL DEFAULT '', `ladderLevel` int(11) NOT NULL, PRIMARY KEY (`ladderId`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;   put this in your mainmenu.php   [url='battle_ladder.php']Battle Ladder[/url]   But use the rest of RICHARDS setup for attackwon and attacklost + the SQLS for the members.. Few things ive done 1 = users can attack anyone once on a ladder but if they dont belong to that ladder NO score will be given for any wins Scores will only be given to those that are on the same ladder... 2 = Users can only join a ladder that have their MAX level settings
  12. Re: Battle ladder [Mccodes V2] why does stupid MCC only select 2 types of player names that being yourself or the one your attacking im trying to make it so you can attack any player on a list by name and peeing me of lol
  13. Re: Battle ladder [Mccodes V2]   Cheers Radio :) Yep im in process now of redoing RICHARDS original battle_ladder.php It wont be using the same basis as the attackwon.php and attacklost.php or even attack.php I thought as its a battle_ladder it would need its own attack script which has nothing to do with attacks outside of the ladder. The querirs would still be the same however just the script names will be changed.. Ive already started on the battle_ladder.php so it shows if a user is in hospital that cant be attacked and the ability to show you your currrent history from those that have attacked you and from you attacking them. and also if a user isnt of a certaion level only the levels they match up to will be displayed which is working fine.. also the password protected tournaments are working and the dontators part is working..
  14. Re: Battle ladder [Mccodes V2]   in your SMENU.PHP change my Original link for delete which was.   > [url='tourny_creator.php?action=delladder']Delete A Tournament[/url] ";   TO   > [url='tourny_creator.php?action=deleteladder']Delete A Tournament[/url] ";   Sorry for the confusion
  15. Re: Battle ladder [Mccodes V2]   Eternal this MOD was tested on your game i just never added the smenu links as for avguste's post as i stated my tables for the battle_ladder are different and will need to be altered. 1 because i was doing the script offline and used my own sqls to set it up I will however change RICHARDS SQLS and battle_ladder script so it fits the one i posted. This was a ailly error on my behalf i should have just used Richards SQLS.. Regards the DELETION of tournaments i will repost my copy as i know that one works or it maybe just that ive made an error on the smenu.php links...
  16. Re: Battle ladder [Mccodes V2] wait till i get home from vacation and i'll have a look should be later tonight when i get back on..
  17. Re: Battle ladder [Mccodes V2] some of the sqls from the battle_ladder.php will need to be changed to be able to use the ones from the admin panel yep my fault i gave the tables different names.... Regards deleting tourneys only tournament 1 is un-deleteable the rest you create can be deleted.
  18. Re: [All versions] Mailbox clickable bbcode and smilies Are you getting errors or are the images not being able to be clicked on or not visible at bottom of mailbox
  19. Re: [All versions] Mailbox clickable bbcode and smilies Tested it on a fresh copy of MCC worked 1st no problems
  20. Re: [All versions] Mailbox clickable bbcode and smilies Ooops My Bad sorry :)
  21. Re: [All versions] Mailbox clickable bbcode and smilies REDSNAKE open up your mailbox on your site and view source Then goto olaceys site open mailbox and view source on that You will see his images use INPUT TYPE where as yours it doesnt mention it.
  22. Re: [All versions] Mailbox clickable bbcode and smilies Heres a few more PATTERNS to add... GOOGLE VIDEO   $patterns[] = "#\[GVideo\]http://video.google.[A-Za-z0-9.]{2,5}/videoplay\?docid=([0-9A-Za-z-_]*)[^[]*\[/GVideo\]#is";   YOUTUBE   $patterns[] = "#\[youtube\]http://(?:www\.)?youtube.com/watch\?v=([0-9A-Za-z-_]{11})[^[]*\[/youtube\]#is";
  23. Re: Battle ladder [Mccodes V2] 3 easy steps 1 = upload and amend files 2 = Run the installler adding your first tournament (becomes useless after 1st install cannot be used again until you have dropped the ladder_settings table via your phpmyadmin ) 3 = Goto your admin panel and create more tourneys, edit and delete. For safety reasons Tournement ID 1 Cannot be deleted but it can be edited Thats it,,,
  24. Re: Battle ladder [Mccodes V2] PART 2 call this file tourny_creator.php Thanks goes to TONKA For his help with this piece cheers pal :)   <?php include "sglobals.php"; //This contains Tournament layouts //Illusions 2009 switch($_GET['action']) { case 'createladder': create_ladder(); break; case 'createladdersub': create_ladder_sub(); break; case 'editladder': edit_ladder(); break; case 'editladderform': edit_ladder_form(); break; case 'editladdersub': edit_ladder_sub(); break; case 'deleteladder': delete_ladder(); break; default: print "Error: This script requires an action."; break; } function htmlspcl($in) { return str_replace("'", "'", htmlspecialchars($in)); } function create_ladder() { global $db,$ir, $c; if($ir['user_level'] != 2) { die("Access Denied"); } print "Create New Tournament Ladder. <table width='75%' class='table' cellspacing='1'> <form action='tourny_creator.php?action=createladdersub' method='post'> <tr> <td align='center'>Ladder ID Number Give your Tournament ladder an ID</td> <td><input type='text' name='ladder_id' value='0' /></td> </tr> <tr> <td align='center'>Ladder Name Give your Tournament ladder a name</td> <td><input type='text' name='ladder_name' value='Basic Attack Ladder' /></td> </tr> <tr> <td align='center'>Ladder Description Brief Description about this ladder.</td> <td><textarea rows='6' cols='40' name='ladder_description'></textarea></td> </tr> <tr> <td align='center'>Minimum Ladder Entry Level Minimum Entry Level for a Player of this ladder type</td> <td><input type='text' name='minentry_level' value='1' /></td> </tr> <tr> <td align='center'>Maximum Entry Level Maximum Entry Level for a Player of this ladder type</td> <td><input type='text' name='maxentry_level' value='3' /></td> </tr> <tr> <td align='center'>Password Protect ? Use a Password for this tournament or leave blank</td> <td><input type='text' name='pass_protect' value='' /></td> </tr> <tr> <td align='center'>Donator Only Tournament Do you want this to be a Donator Only Tournament 1= YES 0= NO</td> <td><input type='text' name='don_only' value='0' /></td> </tr> <tr> <td align='center'>Cash Entry Do you want to charge users to join this tournament if its free just enter 0</td> <td><input type='text' name='ladder_charge' value='0' /></td> </tr> <tr> <td colspan='2' align='center'><input type='submit' value='Create New Tournament' /></td> </tr> </table></form></center>"; } function create_ladder_sub() { global $db,$ir,$c,$userid; if($ir['user_level'] != 2) { die("Access Denied"); } if(!isset($_POST['ladder_id']) || !isset($_POST['ladder_name'])) { print "You missed one or more of the required fields. Please go back and try again. [url='tourny_creator.php?action=createladder']> Back[/url]"; $h->endpage(); exit; } $Get = $db->query(sprintf("SELECT `ladder_id` FROM `ladder_settings` WHERE `ladder_id`='%s'", addslashes($_POST['ladder_id']))); if($db->num_rows($Get)) { print "<h1>Sorry ID {$_POST['ladder_id']} is already In Use.</h1><h1>DO YOU WANT TO</h1> [url='tourny_creator.php?action=createladder']1 Try Include another Tournament[/url] [url='tourny_creator.php?action=editladder']2 Edit An Existing Tournament[/url] [url='tourny_creator.php?action=deleteladder']3 Delete an existing Tournament[/url]"; exit; } $db->query("INSERT INTO ladder_settings VALUES('{$_POST['ladder_id']}', '{$_POST['ladder_name']}', '{$_POST['ladder_description']}', '{$_POST['minentry_level']}', '{$_POST['maxentry_level']}', '{$_POST['pass_protect']}', '{$_POST['don_only']}', '{$_POST['ladder_charge']}')"); $i=mysql_insert_id($c); print "<h1>{$_POST['ladder_name']}</h1> Was Successfully Created <h1>DO YOU WANT TO</h1> <a href='tourny_creator.php?action=createladdersub'>1 Create Another Tournament <a href='tourny_creator.php?action=editladder'>2 Edit An Exsisting Tournament [url='tourny_creator.php?action=deleteladder']3 Delete an existing Tournament[/url]"; stafflog_add("Created new Tournament {$_POST['ladder_name']} [$i]"); } function edit_ladder() { global $db,$ir,$c,$h,$userid; if($ir['user_level'] != 2) { die("Access Denied"); } print "<h3>Editing Tournament</h3> You can edit any aspect of this Tournament. <form action='tourny_creator.php?action=editladderform' method='post'> Tournament: ".tournament_dropdown($c,'ladder_id')." <input type='submit' value='Edit Tournament' /></form> OR enter a Tournament ID to edit: <form action='tourny_creator.php?action=editladderform' method='post'> Tournament: <input type='text' name='ladder_id' value='0' /> <input type='submit' value='Edit Tournament' /></form>"; } function edit_ladder_form() { global $db,$ir,$c,$h,$userid; if($ir['user_level'] != 2) { die("Access Denied"); } $d=$db->query("SELECT * FROM ladder_settings WHERE ladder_id={$_POST['ladder_id']}"); $itemi=$db->fetch_row($d); print "<h3>Editing Tournament</h3> <table width='75%' class='table' cellspacing='1'> <form action='tourny_creator.php?action=editladdersub' method='post'> <tr> <td align='center'>Ladder ID ID for this Ladder</td> <td><input type='text' name='ladder_id' value='{$itemi['ladder_id']}' /></td> </tr> <tr> <td align='center'>Ladder Name Give your Tournament ladder a name</td> <td><input type='text' name='ladder_name' value='{$itemi['ladder_name']}' /></td> </tr> <tr> <td align='center'>Ladder Description Description for this Event</td> <td><input type='text' name='ladder_description' value='{$itemi['ladder_description']}' /></td> </tr> <tr> <td align='center'>Minimum Ladder Entry Level Minimum Entry Level for a Player of this ladder type</td> <td><input type='text' name='minentry_level' value='{$itemi['minentry_level']}' /></td> </tr> <tr> <td align='center'>Maximum Entry Level Maximum Entry Level for a Player of this ladder type</td> <td><input type='text' name='maxentry_level' value='{$itemi['maxentry_level']}' /></td> </tr> <tr> <td align='center'>Password Protect ? Use a Password for this tournament or leave blank</td> <td><input type='text' name='pass_protect' value='{$itemi['pass_protect']}' /></td> </tr> <tr> <td align='center'>Donator Only Tournament Do you want this to be a Donator Only Tournament</td> <td><input type='text' name='don_only' value='{$itemi['don_only']}' /></td> </tr> <tr> <td align='center'>Cash Entry Do you want to charge users to join this tournament if its free just enter 0</td> <td><input type='text' name='ladder_charge' value='{$itemi['ladder_charge']}' /></td> </tr> <tr> <td colspan='2' align='center'><input type='submit' value='Edit This Tournament' /></td> </tr> </table></form></center>"; } function edit_ladder_sub() { global $db,$ir,$c,$h,$userid; if($ir['user_level'] != 2) { die("403"); } global $db,$ir,$c,$h,$userid; if($ir['user_level'] != 2) { die("Access Denied"); } $db->query("UPDATE `ladder_settings` SET `ladder_name` = '{$_POST['ladder_name']}', `ladder_description` = '{$_POST['ladder_description']}', `minentry_level` = '{$_POST['minentry_level']}', `maxentry_level` = '{$_POST['maxentry_level']}', `pass_protect` = '{$_POST['pass_protect']}', `don_only` = '{$_POST['don_only']}', `ladder_charge` = '{$_POST['ladder_charge']}' WHERE `ladder_id` = '{$_POST['ladder_id']}' "); stafflog_add("Edited Tournament {$_POST['ladder_name']} [{$_POST['ladder_id']}]"); print "<h1>Tournament {$_POST['ladder_name']} Updated</h1> <a href='tourny_creator.php?action=createladdersub'>1 Create Another Tournament <a href='tourny_creator.php?action=editladder'>2 Edit An Exsisting Tournament [url='tourny_creator.php?action=deleteladder']3 Delete an existing Tournament[/url]"; } function delete_ladder() { global $ir,$c,$h,$userid,$db; if($ir['user_level'] != 2) { die("Access Denied"); } $undeletable = array('1'); // add more IDs here, such as NPCs switch ($_GET['step']) { default: echo "<h3>Deleteing Tournament</h3> Here you can delete a tournament. <form action='tourny_creator.php?action=deleteladder&step=2' method='post'> Delete Tournament: ".tournament_dropdown($c,'ladder_id')." <input type='submit' value='Delete Tournament' /></form> OR enter a tournament ID to Delete: <form action='tourny_creator.php?action=deleteladder&step=2' method='post'> Delete Tournament: <input type='text' name='ladder_id' value='0' /> <input type='submit' value='Delete Tournament' /></form>"; break; case 2: $target = $_POST['ladder_id']; if (!is_numeric($target)) exit; if (in_array($target,$undeletable)) { die(' <h1>You cannot delete this Tournament its a Fixed Base Sorry try editing it.<h1>'); } $d=$db->query("SELECT ladder_id FROM ladder_settings WHERE ladder_id='$target'"); $itemi=$db->fetch_row($d); print "<h3>Confirm</h3> Delete Tournament ".$itemi["ladder_id"]."? <form action='tourny_creator.php?action=deleteladder&step=3' method='post'> <input type='hidden' name='ladder_id' value='$target' /> <input type='submit' name='yesorno' value='Yes' /> <input type='submit' name='yesorno' value='No' onclick=\"window.location='tourny_creator.php?action=deleteladder';\" /></form>"; break; case 3: $target = $_POST['ladder_id']; if (!is_numeric($target)) exit; if (in_array($target,$undeletable)) { die('You cannot delete this Tournament.'); } if($_POST['yesorno']=='No') { die("<h1>Tournament {$itemi['ladder_name']} has not been deleted.</h1> <a href='tourny_creator.php?action=createladdersub'>1 Create A New Tournament <a href='tourny_creator.php?action=editladder'>2 Edit An Existing Tournament [url='tourny_creator.php?action=deleteladder']3 Delete an existing Tournament[/url]"); } if ($_POST['yesorno'] != ("No" || "Yes")) die('Eh'); $d=$db->query("SELECT ladder_id FROM ladder_settings WHERE ladder_id='$target'"); $itemi=$db->fetch_row($d); $db->query("DELETE FROM ladder_settings WHERE ladder_id='$target'"); echo "<h1>Tournament {$itemi['ladder_name']} Successfully Deleted.</h1> <a href='tourny_creator.php?action=createladdersub'>1 Create A New Tournament <a href='tourny_creator.php?action=editladder'>2 Edit An Exsisting Tournament [url='tourny_creator.php?action=deleteladder']3 Delete an existing Tournament[/url]"; stafflog_add("Deleted Ladder {$itemi['ladder_name']} [{$_POST['ladder_id']}]"); break; } } $h->endpage(); ?>   and add these links to your smenu.php   print " <hr /> [b]Tournament System[/b] "; if($ir['user_level']==2) { print "> [url='tourny_creator.php?action=createladder']Create New Tournament[/url] > [url='tourny_creator.php?action=editladder']Edit A Tournament[/url] > [url='tourny_creator.php?action=delladder']Delete A Tournament[/url] "; }
  25. Re: Battle ladder [Mccodes V2] SQLS DO NOT INSERT THESE DIRECTLY INTO YOUR PHPMYADMIN Just save as ladder.sql and upload to your game site.... The reason for this is because its part of the Installation so you can create your first Tournament at setup..   CREATE TABLE `ladder_settings` ( `ladder_id` int(11) NOT NULL auto_increment, `ladder_name` varchar(255) NOT NULL, `ladder_description` varchar(255) NOT NULL, `minentry_level` int(11) NOT NULL, `maxentry_level` int(11) NOT NULL, `pass_protect` varchar(255) NOT NULL, `don_only` int(11) NOT NULL, `ladder_charge` int(11) NOT NULL, PRIMARY KEY (`ladder_id`) ) ENGINE=MyISAM ;   Open up global_func.php and add this piece near the top   function tournament_dropdown($connection,$ddname="ladder_id",$selected=-1) { global $db; $ret="<select name='$ddname' type='dropdown'>"; $q=$db->query("SELECT * FROM ladder_settings ORDER BY ladder_name DESC"); if($selected == -1) { $first=0; } else { $first=1; } while($r=$db->fetch_row($q)) { $ret.="\n<option value='{$r['ladder_id']}'"; if ($selected == $r['ladder_id'] || $first == 0) { $ret.=" selected='selected'";$first=1; } $ret.=">{$r['ladder_name']}</option>"; } $ret.="\n</select>"; return $ret; }   Now call this file tourny_installer.php   <?php session_start(); ob_start(); function valid_email($email) { // First, we check that there's one @ symbol, and that the lengths are right if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { // Email invalid because wrong number of characters in one section, or wrong number of @ symbols. return false; } // Split it into sections to make life easier $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for ($i = 0; $i < sizeof($local_array); $i++) { if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { return false; } } if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return false; // Not enough parts to domain } for ($i = 0; $i < sizeof($domain_array); $i++) { if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { return false; } } } return true; } ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Illusions Tournament Installer</title> <script language="JavaScript"> <!-- function getCookieVal (offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } function GetCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } function SetCookie (name,value,expires,path,domain,secure) { document.cookie = name + "=" + escape (value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); } function DeleteCookie (name,path,domain) { if (GetCookie(name)) { document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; } } // --> </script> <script language="JavaScript"> var usr; var pw; var sv; function getme() { usr = document.login.username; pw = document.login.password; sv = document.login.save; if (GetCookie('player') != null) { usr.value = GetCookie('username') pw.value = GetCookie('password') if (GetCookie('save') == 'true') { sv[0].checked = true; } } } function saveme() { if (usr.value.length != 0 && pw.value.length != 0) { if (sv[0].checked) { expdate = new Date(); expdate.setTime(expdate.getTime()+(365 * 24 * 60 * 60 * 1000)); SetCookie('username', usr.value, expdate); SetCookie('password', pw.value, expdate); SetCookie('save', 'true', expdate); } if (sv[1].checked) { DeleteCookie('username'); DeleteCookie('password'); DeleteCookie('save'); } } else { alert('You must enter a username/password.'); return false; } } </script> <style type="text/css"> <!-- body { background-color: #DEDEDE; margin-top: 0px; margin-bottom: 0px; font-family:calibri, helvetica, arial, geneva, sans-serif;font-size:12px;color: black; scrollbar-base-color: #005B70; scrollbar-arrow-color: #F3960B; scrollbar-DarkShadow-Color: #000000; } a:visited,a:active,a:hover,a:link { color: black;text-decoration: none; } table,tr,td { font-family:helvetica, arial, geneva, sans-serif;font-size: 12px; } img { border:none; } textarea { font-family:helvetica, arial, geneva, sans-serif;font-size:12px;color: black; } .table2 { } .lgrad { background-image:url(lgrad.jpg); background-repeat:repeat-y; width:19px; } .linegrad { background-image:url(linegrad.PNG); background-repeat:repeat-y; background-align: center; width:2px; } .rgrad { background-image:url(rgrad.jpg); background-repeat:repeat-y; width:19px; } .dgrad { background-image:url(dgrad.jpg); background-repeat:repeat-x; height:38px; } .dgradl { background-image:url(dgradl.jpg); background-repeat:no-repeat; height:38px; width:38px; } .dgradr { background-image:url(dgradr.jpg); background-repeat:no-repeat; height:38px; width:38px; } .center { width:932px; background-color:#FFFFFF; vertical-align:top; text-align:center; } .table { background-color:#000000; } .table3 { background-color:#000000; } .table td { background-color:#DEDEDE; height:22px; } .table3 td { background-color:#CCCCCC; } td .alt { background-color:#EEEEEE; height:22px; } td .h { background-image:url(tablehgrad.png); background-repeat:repeat-x; font-weight: bold; background-color: #D6D6D6; } .table th { background-image:url(tablehgrad.png); background-repeat:repeat-x; font-weight: bold; background-color: #D6D6D6; } --> </style></head> <body onload="getme();"> <center> <table width="970" border="0" cellpadding="0" cellspacing="0" class="table2"> <tr> <td class="lgrad"></td> <td class="center">[img=title.jpg] <h2>Illusions 2009 Tournament Installer</h2> <?php switch($_GET['code']) { case "install": install(); break; case "config": config(); break; default: diagnostics(); break; } function menuprint($highlight) { $items=array( 'diag' => '1. Diagnostics', 'input' => '2. Configuration', 'sql' => '3. Installation & Extras', ); $c=0; print "<hr />"; foreach($items as $k => $v) { $c++; if($c > 1) { print " >> "; } if($k==$highlight) { print "<font color='black'>{$v}</font>"; } else { print "<font color='gray'>{$v}</font>"; } } print "<hr />"; } function diagnostics() { menuprint("diag"); if (version_compare(phpversion(), '4.2.0') < 0) { $pv="<font color='red'>Failed</font>"; $pvf=0; } else { $pv="<font color='green'>OK</font>"; $pvf=1; } if(is_writable('./')) { $wv="<font color='green'>OK</font>"; $wvf=1; } else { $wv="<font color='red'>Failed</font>"; $wvf=0; } if(function_exists('mysql_connect') || function_exists('mysqli_connect')) { $dv="<font color='green'>OK</font>"; $dvf=1; } else { $dv="<font color='red'>Failed</font>"; $dvf=0; } if(str_replace('tourny_installer.php','',$_SERVER['SCRIPT_NAME']) == "/") { $av="<font color='green'>OK</font>"; $avf=1; } else { $av="<font color='red'>Failed</font>"; $avf=0; } print "<h3>Basic Diagnostic Results:</h3> <table width='80%' class='table' cellspacing='1'> <tr> <td>PHP version >= 4.2.0</td> <td>{$pv}</td> </tr> <tr> <td>Game folder writable</td> <td>{$wv}</td> </tr> <tr> <td>MySQL support in PHP present</td> <td>{$dv}</td> </tr> <tr> <td>Game installed at root level of domain or subdomain</td> <td>{$av}</td> </tr> </table>"; if($pvf+$wvf+$dvf+$avf < 4) { print "<hr /><font color='red'>One of the basic diagnostics failed, so Setup cannot continue. Please fix the ones that failed and try again.</font><hr />"; } else { print "<hr />> [url='tourny_installer.php?code=config']Next Step[/url]<hr />"; } } function config() { menuprint("input"); print "<h3>Ladder System Setup:</h3> <center> <form action='tourny_installer.php?code=install' method='post'> <table width='75%' class='table' cellspacing='1'> <tr> <th colspan='2'>Database Config</th> </tr> <tr> <td align='center'>MySQL Driver</td> <td><select name='driver' type='dropdown'>"; if(function_exists('mysql_connect')) { print "<option value='mysql'>MySQL Standard</option>"; } if(function_exists('mysqli_connect')) { print "<option value='mysql'>MySQLi Enhanced</option>"; } print "</select></td> </tr> <tr> <td align='center'>Hostname This is usually localhost</td> <td><input type='text' name='hostname' value='localhost' /></td> </tr> <tr> <td align='center'>Username The user must be able to use the database</td> <td><input type='text' name='username' value='' /></td> </tr> <tr> <td align='center'>Password</td> <td><input type='text' name='password' value='' /></td> </tr> <tr> <td align='center'>Database Name The database should not have any other software using it.</td> <td><input type='text' name='database' value='' /></td> </tr> <tr> <th colspan='2'><h2>Ladder System Setup </h2></th> </tr> <tr> <td align='center'>Ladder ID Number Give your Tournament ladder a name</td> <td><input type='hidden' name='ladder_id' value='1' /></td> </tr> <tr> <td align='center'>Ladder Name Give your Tournament ladder a name</td> <td><input type='text' name='ladder_name' value='Basic Attack Ladder' /></td> </tr> <tr> <td align='center'>Ladder Description Brief Description about this ladder.</td> <td><textarea rows='6' cols='40' name='ladder_description'></textarea></td> </tr> <tr> <td align='center'>Minimum Ladder Entry Level Minimum Entry Level for a Player of this ladder type</td> <td><input type='text' name='minentry_level' value='1' /></td> </tr> <tr> <td align='center'>Maximum Entry Level Maximum Entry Level for a Player of this ladder type</td> <td><input type='text' name='maxentry_level' value='3' /></td> </tr> <tr> <td align='center'>Password Protect ? Use a Password for this tournament or leave blank</td> <td><input type='text' name='pass_protect' value='' /></td> </tr> <tr> <td align='center'>Donator Only Tournament Do you want this to be a Donator Only Tournament</td> <td><input type='checkbox' name='don_only' value='0' />YES <input type='checkbox' name='don_only' value='1' checked='checked' />NO</td> </tr> <tr> <td align='center'>Cash Entry Do you want to charge users to join this tournament if its free just enter 0</td> <td><input type='text' name='ladder_charge' value='0' /></td> </tr> <tr> <td colspan='2' align='center'><input type='submit' value='Install' /></td> </tr> </table></form></center>"; } function install() { menuprint("sql"); { print "Config writing Bypassed. Attempting DB connection "; define('MONO_ON', 1); require "class/class_db_mysql.php"; $db=new database; $db->configure($_POST['hostname'], $_POST['username'], $_POST['password'], $_POST['database'], 0); $db->connect(); $c=$db->connection_id; print "Connection Successful. Writing Main MySQL data. "; $fo=fopen("ladder.sql","r"); $query=""; $lines=explode("\n",fread($fo,1024768)); fclose($fo); foreach($lines as $line) { if(!(strpos($line,"--") === 0) && trim($line) != "") //check for commented lines or blankies { $query.=$line; if(!(strpos($line,";") === FALSE)) { $db->query($query); $query=""; } } } print "Main MySQL data was written. Now write Extra MySQL data. "; //$username=$_POST['a_username']; $IP = ($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; $db->query("INSERT INTO ladder_settings VALUES('{$_POST['ladder_id']}', '{$_POST['ladder_name']}', '{$_POST['ladder_description']}', '{$_POST['minentry_level']}', '{$_POST['maxentry_level']}', '{$_POST['pass_protect']}', '{$_POST['don_only']}', '{$_POST['ladder_charge']}')"); $path=$_SERVER['HTTP_HOST']; print " <h2>[b]Ladder Installation Was Successful![/b]</h2><hr /> <center><h1><font color='green'>SETUP COMPLETE</h1></font></center> Goto your Admin Panel to ADD, DELETE, EDIT your Tournaments"; } } ?> </td> <td class="rgrad"></td> </tr> <tr> <td colspan="3"> <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tr> <td class="dgradl"> </td> <td class="dgrad"> </td> <td class="dgradr"> </td> </tr> </table> </td> </tr> </table> </body> </html>   PART 2 to Follow
×
×
  • Create New...