
Modern-Empires
Members-
Posts
123 -
Joined
-
Last visited
Never
Content Type
Profiles
Forums
Events
Everything posted by Modern-Empires
-
hmm ok i was adding thi mod to my new game that i am working on and i added illusions edit to where it lets ya know about new events etc, well when i added it all the links had 0 0 next to them which was confusing, please help
-
Re: [v2] New Header will u ever be making a login for this?
-
Re: [V2] Chat PLEASE NOTE if you are using mozilla firefox that the usersonline section is working :P
-
Re: [V2] Chat the credit for making this mod then goes to you, and thanks, i liked the edits i made, had no trouble at all adding them into the script lol, i dide try addeing the smiles script into it so when you type :) it would show up but i could not get it to work lol, well i look forward to the update mate, thanks for creating this script, now i know who created it i can put it back in the script created by now lol, thanks
-
Re: [V2] Chat using mysql version will make the game more prone to hackers
-
Re: [v2] New Header yh please some-1 post it for them please, i would post my working copy of this but i have edited it so much that i cba editing it back so that i can post it lol
-
Re: [V2] Chat i would put the auther down but i dont know who made it, sorry to whoever made it, i
-
Re: [V2] Chat ok thanks for that, probs wasnt thinking when i made it lol
-
Re: [V2] Chat yeah it is normally but this chat is safe from it, and alot of people dont like IRC, i dont lol, plus IRC aint really intergrated with the game where this one is
-
Please note that i DID not make this but just mearly edited and made more options Create File and call it chat.php <?php session_start(); require "globals.php"; $name=$ir['username']; if($ir['donatordays']) { $name = "/donator.gif' border=0><font color=blue>$name </font><font color={$ir['colour']}></a>"; } else $name = "[url='viewuser.php?u={$ir[']<font color=white>$name </font><font color={$ir['colour']}>[/url]"; if( $ir['user_level'] == 2 ){ $name = " [url='viewuser.php?u={$ir['] [img=/admin.gif]<a href='viewuser.php?u={$ir['userid']}'><font color='red'>{$ir['username']} </font>[/url]<font color={$ir['colour']}>"; } if( $ir['userid'] ==1 ){ $name = " [url='viewuser.php?u={$ir['][img=/owner.gif]<a href='viewuser.php?u={$ir['userid']}'><font color='orange'>{$ir['username']} </font>[/url]<font color={$ir['colour']}>"; } ?> <center> <style type="text/css"> input, textarea { font-family: courier new; font-size: 12px; background: black; } #content { width:500px; text-align:center; margin-left:25px; } #chatwindow { border:1px solid grey; padding:4px; color:#FAFAD2; width: 490px; height:452px; font-family: sans-serif; font-size: 14px; text-align:left; background-image: none; } #chatwindow a { font-family: sans-serif; padding-top: 1px; } #chatnick { border: none; color:#FFCC00; padding:0px;} #chatmsg { border: none; color:#FFCC00; border-bottom:1px solid #2e8b57; padding:4px;} #current_users { border: 1px solid grey; padding:3px 3px 0px 3px; margin-top:3px; width: 475px; margin-left:auto; margin-right:auto; text-align:center; } #ch_input { border: 1px solid grey; padding:3px 3px 0px 3px; margin-top:3px; width: 475px; margin-left:auto; margin-right:auto; text-align:center; } #ch_input2 { border: 1px solid grey; padding:3px 3px 0px 3px; margin-top:3px; width: 475px; margin-left:auto; margin-right:auto; text-align:center; } </style> <div id="content" style="margin-left:auto; margin-right:auto;"> [b]Chatroom[/b] [img=/owner.gif]Owner [img=/admin.gif]Admins [img=/donator.gif]Donators <center><div id="chatwindow"></div></center> <div id="ch_input"> <center> <input id="chatkey" type="text" size=1 style="display:none" value = "" > <input id="chatnick" type="text" size="1" maxlength="999" style="display:none" value="<? echo "".$name.""; ?>"> <input id="chatmsg" type="text" size="59" maxlength="116" style="<? echo "".$style."";// <-- can set a predefined style here ?>" onkeyup="keyup(event.keyCode);"> <input type="button" value="add" onclick="submit_msg();" style="color: #CCCC99; cursor:pointer;"> </center> </div> <div id="current_users"> </div> </div> <script type="text/javascript"> var nick_maxlength=18; var http_request=false; var http_request2=false; var http_request3=false; var intUpdate; var whoUpdate; var whoSubmit; /* reading */ function ajax_request(url){http_request=false;if(window.XMLHttpRequest){http_request=new XMLHttpRequest();if(http_request.overrideMimeType){http_request.overrideMimeType('text/xml');}}else if(window.ActiveXObject){try{http_request=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}} if(!http_request){alert('Giving up :( Cannot create an XMLHTTP instance');return false;} http_request.onreadystatechange=alertContents;http_request.open('GET',url,true);http_request.send(null);} function alertContents(){if(http_request.readyState==4){if(http_request.status==200){rec_response(http_request.responseText);}else{}}} /* writing */ function ajax_request2(url){http_request2=false;if(window.XMLHttpRequest){http_request2=new XMLHttpRequest();if(http_request2.overrideMimeType){http_request2.overrideMimeType('text/xml');}}else if(window.ActiveXObject){try{http_request2=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http_request2=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}} if(!http_request2){alert('Giving up :( Cannot create an XMLHTTP instance');return false;} http_request2.onreadystatechange=alertContents2;http_request2.open('GET',url,true);http_request2.send(null);} function alertContents2(){if(http_request2.readyState==4){if(http_request2.status==200){rec_chatcontent(http_request2.responseText);}else{}}} /* whobox update */ function ajax_request3(url){http_request3=false;if(window.XMLHttpRequest){http_request3=new XMLHttpRequest();if(http_request3.overrideMimeType){http_request3.overrideMimeType('text/xml');}}else if(window.ActiveXObject){try{http_request3=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http_request3=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}} if(!http_request3){alert('Giving up :( Cannot create an XMLHTTP instance');return false;} http_request3.onreadystatechange=alertContents3;http_request3.open('GET',url,true);http_request3.send(null);} function alertContents3(){ if(http_request3.readyState==4){ if(http_request3.status==200){ rec_whocontent(http_request3.responseText); }else{ window.setTimeout("alertContents3", "350"); } } } //function ajax_request4(url){http_request4=false;if(window.XMLHttpRequest){http_request4=new XMLHttpRequest();if(http_request4.overrideMimeType){http_request4.overrideMimeType('text/xml');}}else if(window.ActiveXObject){try{http_request4=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http_request4=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}} //if(!http_request4){alert('Giving up :( Cannot create an XMLHTTP instance');return false;} //http_request4.onreadystatechange=alertContents4; //http_request4.open('GET',url,true);http_request4.send(null);} //function alertContents3(){if(http_request3.readyState==4){if(http_request3.status==200){rec_whocontent(http_request3.responseText);}else{}}} /* chat stuff */ chatmsg.focus() var show_newmsg_on_bottom=1; /* set to 0 to let new msg´s appear on top */ var waittime=1100; /* time between chat refreshes (ms) */ var whotime=6000; intUpdate=window.setTimeout("read_cont();", waittime); whoUpdate=window.setTimeout("read_users();", whotime); whoSubmit=window.setTimeout("submit_who();", whotime); chatwindow = document.getElementById('chatwindow'); chatwindow.innerHTML = "Loading..."; current_users = document.getElementById('current_users'); current_users.innerHTML = " <?php // in this section you can do a simple who is online or be creative and write up a who is on this page script // which i wont release at this given time still in work $cn=0; $q=$db->query("SELECT * FROM users WHERE laston>unix_timestamp()-15*60 ORDER BY laston DESC"); while($r=$db->fetch_row($q)) { $la=time()-$r['laston']; $unit="secs"; if($la >= 60) { $la=(int) ($la/60); $unit="mins"; } if($la >= 60) { $la=(int) ($la/60); $unit="hours"; if($la >= 24) { $la=(int) ($la/24); $unit="days"; } } $cn++; print "[url='viewuser.php?u={$r[']<font color=gold>{$r['username']}</font>[/url], "; } ///// down low it will include a read users which is half complete for the ajax users veiwing this page ?>"; function read_users() { zeit2 = new Date(); ms2 = (zeit2.getHours() * 24 * 60 * 1000) + (zeit2.getMinutes() * 60 * 1000) + (zeit2.getSeconds() * 1000) + zeit2.getMilliseconds(); ajax_request3("who.txt?x=" + ms); } function read_cont() { zeit = new Date(); ms = (zeit.getHours() * 24 * 60 * 1000) + (zeit.getMinutes() * 60 * 1000) + (zeit.getSeconds() * 1000) + zeit.getMilliseconds(); ajax_request2("chat.txt?x=" + ms); } function display_msg(msg1) { chatwindow.innerHTML = msg1.substr(0,msg1.length - 1); } function display_who(msg2) { current_users.innerHTML = msg2.substr(0,msg2.length -1); } function keyup(arg1) { if (arg1 == 13) submit_msg(); } function write_who(nick1) { zeit = new Date(); ms = (zeit.getHours() * 24 * 60 * 1000) + (zeit.getMinutes() * 60 * 1000) + (zeit.getSeconds() * 1000) + zeit.getMilliseconds(); ajax_request("http://www.site.com/who.php===were your userpage is" + escape(nick1) + "&tag=" + ms); } function submit_who() { write_who(); whoUpdate=window.setTimeout("submit_who();", whotime); } function submit_msg() { clearTimeout(intUpdate); document.getElementById('chatnick').value ="<? echo "".$name.""; ?>"; if (document.getElementById('chatnick').value.length < nick_maxlength) document.getElementById('chatnick').value=document.getElementById('chatnick').value.substring(0,nick_maxlength); spaces=""; for(i=0;i<(nick_maxlength-document.getElementById('chatnick').value.length);i++) spaces+="-"; v=chatwindow.innerHTML.substring(chatwindow.innerHTML.indexOf("\n")) + "\n" + document.getElementById('chatnick').value + spaces + "| " + chatmsg.value; if (chatmsg.value != "") { //chatwindow.value=v.substring(1); write_msg(chatmsg.value,document.getElementById('chatnick').value,chatkey.value); } chatmsg.value=""; intUpdate=window.setTimeout("read_cont();", waittime); } function write_msg(msg1,nick1) { ajax_request("w.php?m=" + escape(msg1) + "&n=" + escape(nick1)); } function rec_response(str1) { } function rec_chatcontent(cont1) { if (cont1 != "") { out1 = unescape(cont1); if (show_newmsg_on_bottom == 0) { out1 = ""; while (cont1.indexOf("\n") > -1) { out1 = cont1.substr(0, cont1.indexOf("\n")) + "\n" + out1; cont1 = cont1.substr(cont1.indexOf("\n") + 1); out1 = unescape(out1); } } if (chatwindow.innerHTML != out1) { display_msg(out1); } intUpdate=window.setTimeout("read_cont()", waittime); } } function rec_whocontent(cont2) { if (cont2 != "") { current_users.innerHTML = cont2; //out2 = unscape(cont2); //if (current_users.innerHTML != out2) { display_who(out2); } whoUpdate=window.setTimeout("read_users()", whotime); } } </script> </center> Create a TEXT file and call it chat.txt (please make sure you set the permissions to 0777) Create File and call it w.php <?php $fn = "chat.txt"; $maxlines = 22; //$nick_maxlength = 11; /* Set this to a minimum wait time between posts (in sec) */ $waittime_sec = 0; /* spam keywords */ $spam[] = "nigger"; /* IP's to block */ $blockip[] = "72.60.167.89"; /* spam, if message IS exactly that string */ $espam[] = "ajax"; $msg = $_REQUEST["m"]; $n = $_REQUEST["n"]; if ($waittime_sec > 0) { $lastvisit = $_COOKIE["lachatlv"]; setcookie("lachatlv", time()); if ($lastvisit != "") { $diff = time() - $lastvisit; if ($diff < 5) { die(); } } } if ($msg != "") { if (strlen($msg) < 2) { die(); } if (strlen($msg) > 3) { /* Smilies are ok */ if (strtoupper($msg) == $msg) { die(); } } if (strlen($msg) > 150) { die(); } if (strlen($msg) > 15) { if (substr_count($msg, substr($msg, 6, 8)) > 1) { die(); } } foreach ($blockip as $a) { if ($_SERVER["REMOTE_ADDR"] == $a) { die(); } } $mystring = strtoupper($msg); foreach ($spam as $a) { if (strpos($mystring, strtoupper($a)) === false) { /* Everything Ok Here */ } else { die(); } } foreach ($espam as $a) { if (strtoupper($msg) == strtoupper($a)) { die(); } } $handle = fopen ($fn, 'r'); $chattext = fread($handle, filesize($fn)); fclose($handle); $arr1 = explode("\n", $chattext); if (count($arr1) > $maxlines) { /* Pruning */ $arr1 = array_reverse($arr1); for ($i=0; $i<$maxlines; $i++) { $arr2[$i] = $arr1[$i]; } $arr2 = array_reverse($arr2); } else { $arr2 = $arr1; } $chattext = implode("\n", $arr2); if (substr_count($chattext, $msg) > 2) { die(); } $spaces = ""; $inv ="/roll"; $br = " </font></style>"; /// to fix so a new line is called and font and style to finnish the colour varibles you set in the other page $dice= rand(1,6); $dice2= rand(1,6); $dice3= rand(1,6); $dice4= rand(1,6); $roll ="Rolls four 6-sided dice and gets ($dice) ($dice2) ($dice3) ($dice4) </a>"; /// a little feature for your users perhaps gamble if ($msg == "//roll") /// rolling four dice and getting a random number betting cash or crystals determined by the user {$out=$chattext . $n . " " . $roll .$br. " ";} //// removed the - so the user knows that the roll is for real and not placed in there else {$out = $chattext . $n . $spaces . "- " . $msg .$br. "\n";} $out = str_replace("\'", "'", $out); $out = str_replace("\\\"", "\"", $out); $out = str_replace("$inv", $roll,$out); $handle = fopen ($fn, 'w'); fwrite ($handle, $out); fclose($handle); } ?> Open Prefrences: ADD case 'chatcolour2': do_chat_colour(); break; case 'chatcolour': chat_colour(); break; I added this under the pic change case ADD [url='preferences.php?action=chatcolour']Change Chat Room Font colour[/url] It is upto you where you add this in your preferences ADD function chat_colour() { global $ir,$c,$userid,$h; print "<h3>Change chat font colour</h3> <form action='preferences.php?action=chatcolour2' method='post'> Avatar: <input type='text' name='colour' value='{$ir['colour']}' /> <input type='submit' value='Change font colour' /></form>"; } function do_chat_colour() { global $db,$ir,$c,$userid,$h; $db->query("UPDATE users SET colour='{$_POST['colour']}', colour='{$_POST['colour']}' WHERE userid=$userid"); print "colourchanged!"; } i put this right at the bottem of the page above $h->endpage(); ?> Save that page, now all you need to do is run the SQL and you are on your way ALTER TABLE `users` ADD `colour` VARCHAR( 32 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL , ADD `colour` INT( 11 ) NOT NULL DEFAULT 'white'; And thats it....
-
Re: MainMenu Mod! NEW! There, it dont take a rocket science to figure that one out lol, <?php require "sglobal.php"; if($ir['userid'] != 1) { echo 'You are not ment to be here'; $h->endpage(); exit; } $_GET['action'] = ($_GET['action']); switch($_GET['action']) { case "newLink" : new_link(); break; case "editLink" : edit_link(); break; case "deleLink" : dele_link(); break; case "reOrder" : reorder_m(); break; default : index(); break; } function index() { echo '<h3>Mainmenu Settings</h3>'; echo '[url="'. $_SERVER['PHP_SELF'] .'?action=newLink"]Add Menu Link[/url] [url="'. $_SERVER['PHP_SELF'] .'?action=editLink"]Edit Menu Link[/url] [url="'. $_SERVER['PHP_SELF'] .'?action=deleLink"]Delete Menu Link[/url] [url="'. $_SERVER['PHP_SELF'] .'?action=reOrder"]Reorder Menu[/url]'; } function new_link() { global $c; if(!isset($_POST['name'])){ echo '<h3>New Menu</h3>'; echo '<form action="" method="POST">'; echo 'Name: <input type="text" name="name" /> Link: <input type="text" name="link" /> For Staff: <select type="dropdown" name="staff"><option value="0">Everyone</option><option value="1">Staff Only</option><option value="2">Donators Only</option><option value="3">Gangs</option></select> Active: <select type="dropdown" name="active"><option value="0">Yes</option><option value="1">No</option></select> <input type="submit" value="-Add Menu-"></form>'; } else { $name = mysql_real_escape_string(htmlspecialchars($_POST['name'])); $link = mysql_real_escape_string(htmlspecialchars($_POST['link'])); $staff = abs(@intval ($_POST['staff'])); $active = abs(@intval ($_POST['active'])); mysql_query("INSERT INTO `mainmenu` (`name`, `link`, `order`, `staff`, `active`) VALUES('{$name}', '{$link}', '0', '{$staff}', '{$active}')", $c) or die(mysql_error()); echo $name . ' Menu has been added!'; } } function edit_link() { switch($_POST['page']) { case "2": $name = mysql_real_escape_string(htmlspecialchars($_POST['name'])); $link = mysql_real_escape_string(htmlspecialchars($_POST['link'])); $staff = abs(@intval ($_POST['staff'])); $active = abs(@intval ($_POST['active'])); mysql_query("UPDATE `mainmenu` SET `name` = '". $name ."', `link` = '". $link ."', `staff` = '". $staff ."', `active` = '". $active ."' WHERE (`id` = '". $_POST['id'] ."')") or die(mysql_error()); print "Menu has been updated!"; break; case "1": $sql = mysql_query("SELECT * FROM `mainmenu` WHERE (`id` = '". $_POST['mainmenu'] ."')") or die (mysql_error()); $row = mysql_fetch_array($sql); echo '<h3>Editing a menu link</h3><hr /> <form action="'. $_SERVER['PHP_SELF'] .'?action=editLink" method="post"> <input type="hidden" name="page" value="2" /> <input type="hidden" name="id" value="'. $_POST['mainmenu'] .'" /> Name: <input type="text" name="name" value="'. $row['name'] .'" /> Link: <input type="text" name="link" value="'. $row['link'] .'" /> For Staff: <select type="dropdown" name="staff"><option value="0" '; if($row['staff'] == 0) { echo 'selected="selected"'; } echo '>Everyone</option> <option value="1" '; if($row['staff'] == 1) { echo 'selected="selected"'; } echo '>Staff Only</option> <option value="2" '; if($row['staff'] == 2) { echo 'selected="selected"'; } echo '>Donators Only</option> <option value="3" '; if($row['staff'] == 3) { echo 'selected="selected"'; } echo '>Gangs</option></select> Active: <select type="dropdown" name="active"><option value="0" '; if($row['active'] == 0) { echo 'selected="selected"'; } echo '>Yes</option> <option value="1" '; if($row['active'] == 1) { echo 'selected="selected"'; } echo '>No</option></select> <input type="submit" value="-Update Menu-" /></form>'; break; default: echo '<h3>Edit a Menu</h3> <form action="'. $_SERVER['PHP_SELF'] .'?action=editLink" method="POST"> <input type="hidden" name="page" value="1" /> Menu Name: '. mainmenu_dropdown($c, "mainmenu") .' <input type="submit" value="-Edit Menu-" /></form>'; break; } } function dele_link() { if($_POST['mainmenu']) { mysql_query("DELETE FROM `mainmenu` WHERE (`id` = '". $_POST['mainmenu'] ."')") or die (mysql_error()); print "Menu Has just been deleted!"; } else { echo '<h3>Delete a Menu</h3>'; echo 'Make sure you want to delete it, there is no undo, unless you add it back.!'; echo '<form action="'. $_SERVER['PHP_SELF'] .'?action=deleLink" method="POST">'; echo 'Menu Name: '. mainmenu_dropdown($c, "mainmenu") .' '; echo '<input type="submit" value="-Delete Menu, Be Sure-" /></form>'; } } function reorder_m() { global $c, $h; if($_POST['submit']) { unset($_POST['submit']); $used = array(); foreach($_POST as $v) { if(in_array($v, $used)) { echo 'Error, You have used the same Reorder number twice, Please go back and try again!'; $h->endpage(); exit; } $used[] = $v; } foreach($_POST as $k => $v) { $ml = str_replace("order","", $k); if(is_numeric($ml)) { mysql_query("UPDATE `mainmenu` SET `order`='{$v}' WHERE `id`='{$ml}'"); } } echo 'Mainmenu Links has been reordered!'; } else { $sql = mysql_query("SELECT * FROM `mainmenu` ORDER BY `order`"); $rows = mysql_num_rows($sql); $i = 0; echo '<h3>Reorder Mainmenu Links</h3><hr /> <table width="80%" cellspacing="1"> <tr> <th>Menu Names</th> <th>Order</th> </tr> <form action="?action=reOrder" method="POST"> <input type="hidden" name="submit" value="1" />'; while($r = mysql_fetch_array($sql)) { $bgcolor = ($bgcolor == "RED") ? "GREEN" : "RED"; $i++; echo '<tr style="background-color: '. $bgcolor .'"> <td>'. $r['name'] .'</td> <td><select name="order'. $r['id'] .'" type="dropdown">'; for($j = 1; $j <= $rows; $j++) { if($j == $i) { echo '<option value="'. $j .'" selected="selected">'. $j .'</option>'; } else { echo '<option value="'. $j .'">'. $j .'</option>'; } } echo '</select></td></tr>'; } echo '<tr> <td colspan="2" align="center"><input type="submit" value="-Reorder Mainmenu-" /></td> </tr></form></table>'; } } ?>
-
Re: [v2] New Header guys if you follow all the instructions carful and read this forum from top to bottem it would work 100% even the staff panel part, so just read this thread carefully and then you wont have errors, +1 for this mod, really like this mod +1 if the login and register was with this aswell
-
Re: [v2] New Header this is kwl but it do we get a login page with this aswell as it would suit the game better it the login and register page was with it aswell
-
[mccode] Reset your users without deleating them
Modern-Empires replied to Redeye's topic in Free Modifications
Re: [mccode] Reset your users without deleating them nope i havent used it and dont plan to use -
Re: Register.php problem with V2 i have looked at this error and this is one of my first time i've asked help for like this, i've been trying to work this out for hours now
-
Re: Sell Your Gang VR1 yh i think that sounds like a good idea, but i think to make sure that the main owner can cancel the rent at anytime, i think it would be a good idea due to the fact some players might have a week break but needs some1 to look after it, so yh go for it
-
Register Page <?php /*-------------------------------------------------------------- - Made by The Phenomenal Ishz - Free CE Members Only - Register Page - Not to be sold. --------------------------------------------------------------*/ session_start(); include "config.php"; global $_CONFIG; define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; $db=new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c=$db->connection_id; $set=array(); $settq=$db->query("SELECT * FROM settings"); while($r=$db->fetch_row($settq)) { $set[$r['conf_name']]=$r['conf_value']; } $q=$db->query("SELECT userid FROM users"); $membs=$db->num_rows($q); $q=$db->query("SELECT * FROM users WHERE laston>unix_timestamp()-15*60 ORDER BY laston DESC"); $online=mysql_num_rows($q); $q=$db->query("SELECT userid FROM users WHERE gender='Male'"); $male=$db->num_rows($q); $q=$db->query("SELECT userid FROM users WHERE gender='Female'"); $fem=$db->num_rows($q); $q=mysql_query("SELECT * FROM users WHERE laston<unix_timestamp()-86400*10 ORDER BY laston DESC",$c); $act=mysql_num_rows($q); $perctact = $membs - $act; $pact = round( ($perctact/$membs)*100, 0 ); while($r=$db->fetch_row($settq)) { $set[$r['conf_name']]=$r['conf_value']; } //thx to [url]http://www.phpit.net/code/valid-email/[/url] for valid_email 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; } session_start(); print <<<EOF <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>{$set['game_name']} Registration</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="imagetoolbar" content="no" /> <meta name="keywords" content="" /> <meta name="description" content="" /> <meta name="author" content="" /> <meta name="copyright" content="" /> <meta name="revisit-after" content="3 days" /> <script type="text/javascript"> var xmlHttp // xmlHttp variable function GetXmlHttpObject(){ // This function we will use to call our xmlhttpobject. var objXMLHttp=null // Sets objXMLHttp to null as default. if (window.XMLHttpRequest){ // If we are using Netscape or any other browser than IE lets use xmlhttp. objXMLHttp=new XMLHttpRequest() // Creates a xmlhttp request. }else if (window.ActiveXObject){ // ElseIf we are using IE lets use Active X. objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") // Creates a new Active X Object. } // End ElseIf. return objXMLHttp // Returns the xhttp object. } // Close Function function CheckPasswords(password){ // This is our fucntion that will check to see how strong the users password is. xmlHttp=GetXmlHttpObject() // Creates a new Xmlhttp object. if (xmlHttp==null){ // If it cannot create a new Xmlhttp object. alert ("Browser does not support HTTP Request") // Alert Them! return // Returns. } // End If. var url="check.php?password="+escape(password) // Url that we will use to check the password. xmlHttp.open("GET",url,true) // Opens the URL using GET xmlHttp.onreadystatechange = function () { // This is the most important piece of the puzzle, if onreadystatechange = equal to 4 than that means the request is done. if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text. document.getElementById("passwordresult").innerHTML = xmlHttp.responseText; // Updates the div with the response text from check.php } // End If. }; // Close Function xmlHttp.send(null); // Sends NULL insted of sending data. } // Close Function. function CheckUsername(password){ // This is our fucntion that will check to see how strong the users password is. xmlHttp=GetXmlHttpObject() // Creates a new Xmlhttp object. if (xmlHttp==null){ // If it cannot create a new Xmlhttp object. alert ("Browser does not support HTTP Request") // Alert Them! return // Returns. } // End If. var url="checkun.php?password="+escape(password) // Url that we will use to check the password. xmlHttp.open("GET",url,true) // Opens the URL using GET xmlHttp.onreadystatechange = function () { // This is the most important piece of the puzzle, if onreadystatechange = equal to 4 than that means the request is done. if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text. document.getElementById("usernameresult").innerHTML = xmlHttp.responseText; // Updates the div with the response text from check.php } // End If. }; // Close Function xmlHttp.send(null); // Sends NULL insted of sending data. } // Close Function. function CheckEmail(password){ // This is our fucntion that will check to see how strong the users password is. xmlHttp=GetXmlHttpObject() // Creates a new Xmlhttp object. if (xmlHttp==null){ // If it cannot create a new Xmlhttp object. alert ("Browser does not support HTTP Request") // Alert Them! return // Returns. } // End If. var url="checkem.php?password="+escape(password) // Url that we will use to check the password. xmlHttp.open("GET",url,true) // Opens the URL using GET xmlHttp.onreadystatechange = function () { // This is the most important piece of the puzzle, if onreadystatechange = equal to 4 than that means the request is done. if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text. document.getElementById("emailresult").innerHTML = xmlHttp.responseText; // Updates the div with the response text from check.php } // End If. }; // Close Function xmlHttp.send(null); // Sends NULL insted of sending data. } // Close Function. function PasswordMatch() { pwt1=document.getElementById('pw1').value; pwt2=document.getElementById('pw2').value; if(pwt1 == pwt2) { document.getElementById('cpasswordresult').innerHTML="OK"; } else { document.getElementById('cpasswordresult').innerHTML="Not Matching"; } } </script> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body id="home"> <div id="all"> <div id="container"> <div id="header"> <div id="logo"><a href="#">[img=images/logo.gif] <font size=2>[b]The Chaos Revolution[/b]</font></a></div> <div id="head"> <ul> [*][url="#"]<font size=1>Login</font>[/url] [*][url="#"]<font size=1>Register</font>[/url] [*][url="#"]<font size=1>Screenshots</font></font>[/url] [/list] </div> </div> EOF; $IP = ($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; if(file_exists('ipbans/'.$IP)) { die("[b]<font color=red size=+1>Your IP has been banned, there is no way around this.</font>[/b]</body></html>"); } if($_POST['username']) { if($set['regcap_on']) { if(!$_SESSION['captcha'] or $_SESSION['captcha'] != $_POST['captcha']) { unset($_SESSION['captcha']); die("Captcha Test Failed >[url='register.php']Back[/url]"); } unset($_SESSION['captcha']); } if(!valid_email($_POST['email'])) { die("Sorry, the email is invalid. >[url='register.php']Back[/url]"); } if(strlen($_POST['username']) < 4) { die("Sorry, the username is too short. >[url='register.php']Back[/url]"); } $sm=100; if($_POST['promo'] == "Your Promo Code Here") { $sm+=100; } $username=$_POST['username']; $username=str_replace(array("<", ">"), array("<", ">"), $username); $q=$db->query("SELECT * FROM users WHERE username='{$username}' OR login_name='{$username}'"); $q2=$db->query("SELECT * FROM users WHERE email='{$_POST['email']}'"); if($db->num_rows($q)) { print "Username already in use. Choose another. >[url='register.php']Back[/url]"; } else if($db->num_rows($q2)) { print "E-Mail already in use. Choose another. >[url='register.php']Back[/url]"; } else if($_POST['password'] != $_POST['cpassword']) { print "The passwords did not match, go back and try again. >[url='register.php']Back[/url]"; } else if($_POST['squestion'] != $_POST['csquestion']) { print "<h1>ERROR! The Questions Dont Match</h1> >[url='register.php']Back[/url]"; } else { $_POST['ref'] = abs((int) $_POST['ref']); $IP = ($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; $q=$db->query("SELECT * FROM users WHERE lastip='$IP' AND userid={$_POST['ref']}"); if($db->num_rows($q)) { die("No creating referral multies. Bad dog. >[url='register.php']Back[/url]"); } if($_POST['ref']) { $q=$db->query("SELECT * FROM users WHERE userid={$_POST['ref']}"); $r=$db->fetch_row($q); } $db->query("INSERT INTO users (username, login_name, userpass, squestion, level, money, crystals, donatordays, user_level, energy, maxenergy, will, maxwill, brave, maxbrave, hp, maxhp, location, gender, signedup, email, bankmoney, lastip, lastip_signup) VALUES( '{$username}', '{$username}', md5('{$_POST['password']}'), '{$_POST['squestion']}', 1, $sm, 0, 0, 1, 12, 12, 100, 100, 5, 5, 100, 100, 1, '{$_POST['gender']}', unix_timestamp(), '{$_POST['email']}', 0, '$IP', '$IP', random_string('alnum', 32))"); $i=$db->insert_id(); $db->query("INSERT INTO userstats VALUES($i, 10, 10, 10, 10, 10)"); // get data just entered $getUser = mysql_query("SELECT userid, login_name, email, Random_key FROM users WHERE login_name = '{$username}'") or die(mysql_error()); $row = mysql_fetch_assoc($getUser); // Send rego email $stamp = unix_timestamp; $to = $_POST['email']; $subject = "GAME Account Activation"; $body = "Hello " . $username . ",\n\nThank you for registering at Modern-Empires!\n\nClick this link to activate your account: http://www.modern-empires/GAME/activate.php?ID=".$row['userid']."&key=".$row['Random_key']." \n\n -Peter Greenacre"; $headers = "From: [email][email protected][/email]\r\n"; if (mail($to, $subject, $body, $headers)) {} if($_POST['ref']) { require "global_func.php"; $db->query("UPDATE users SET crystals=crystals+2 WHERE userid={$_POST['ref']}"); event_add($_POST['ref'],"For referring $username to the game, you have earned 2 valuable crystalliums!",$c); $db->query("INSERT INTO referals VALUES('', {$_POST['ref']}, $i, unix_timestamp(),'{$r['lastip']}','$IP')"); } print "You have signed up, enjoy the game. > [url='login.php']Login[/url]"; } } else { if($set['regcap_on']) { $chars="123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!?\\/%^"; $len=strlen($chars); $_SESSION['captcha']=""; for($i=0;$i<6;$i++) $_SESSION['captcha'].=$chars[rand(0, $len - 1)]; } $year=date('Y'); echo ' <div id="main"> <div id="menu"> <h2>Member Login</h2><center> <form action="authenticate.php" method="post" name="login" onsubmit="return saveme();" > Username: <input type="text" name="username" /> Password: <input type="password" name="password" /> Remember me? <input type="radio" value="ON" name="save" />Yes <input type="radio" name="save" value="OFF" />No <input type="submit" value="Submit" /></form> [url="#"]<font size=1>Forgot your password?[/url] [url="#"]Not registered?</font>[/url] </p></center> <h2>Game Stats</h2> <center> Registered Users: '.$membs.' Total Online: '.$online.' Total Males: '.$male.' Total Females: '.$fem.' Percent Active: '.$pact.' </center> </div> <div id="text"> <h2>Registration</h2> <form action="register.php" method="post" /> <table width="75%" border="0" class="table" cellspacing="1"> <tr> <td width="30%">Username</td> <td width="40%"><input type="text" name="username" onkeyup="CheckUsername(this.value);" /></td> <td width="30%"><div id="usernameresult"></div></td> </tr> <tr> <td>Password</td> <td><input type="password" id="pw1" name="password" onkeyup="CheckPasswords(this.value);PasswordMatch();" /></td> <td><div id="passwordresult"></div></td> </tr> <tr> <td>Confirm Password</td><td><input type="password" name="cpassword" id="pw2" onkeyup="PasswordMatch();" /></td> <td><div id="cpasswordresult"></div></td> </tr> <tr> <td>Secret Question</td> <td><input type="text" name="squestion" /></td> </tr> <tr> <td>Re-type Secret Question</div></td> <td><input type="text" name="csquestion" /> </td> </tr> <tr> <td>Email</td><td><input type="text" name="email" onkeyup="CheckEmail(this.value);" /></td> <td><div id="emailresult"></div></td> </tr> <tr> <td>Gender</td> <td colspan="2"> <select name="gender"> <option value="Male">Male</option> <option value="Female">Female</option> </select></td> </tr> <tr> <td>Promo Code</td><td colspan="2"><input type="text" name="promo" /></td> </tr>'; print" <tr><td>Captcha</td><td colspan='2'><input type='hidden' name='ref' value='"; if($_GET['REF']) { print $_GET['REF']; } print "' />"; if($set['regcap_on']) { print " [img=captcha_verify.php?bgcolor=C3C3C3] <input type='text' name='captcha' /></td> </tr>"; } print " <tr> <td colspan='3'><center><input type='submit' value='Submit' /></center></td> </tr> </table></center> [url=''][/url]"; } echo' </div> </div> <div id="footer"> <center><div id="left_footer">© Copyright 2009</div></center> <div id="right_footer"> [url="TOS.php"]Terms of Service[/url] | [url="contact.php"]Contact Us[/url] </div> </div> </div> </div> <div id="bottom"> <div id="bottom_center"></div> </div> </div> </body> </html>'; ?> Database CREATE TABLE IF NOT EXISTS `users` ( `userid` int(11) NOT NULL auto_increment, `username` varchar(255) NOT NULL default '', `userpass` varchar(255) NOT NULL default '', `level` int(11) NOT NULL default '0', `exp` decimal(11,4) NOT NULL default '0.0000', `money` int(11) NOT NULL default '0', `crystals` int(11) NOT NULL default '0', `laston` int(11) NOT NULL default '0', `lastip` varchar(255) NOT NULL default '', `job` int(11) NOT NULL default '0', `energy` int(11) NOT NULL default '0', `will` int(11) NOT NULL default '0', `maxwill` int(11) NOT NULL default '0', `brave` int(11) NOT NULL default '0', `maxbrave` int(11) NOT NULL default '0', `maxenergy` int(11) NOT NULL default '0', `hp` int(11) NOT NULL default '0', `maxhp` int(11) NOT NULL default '0', `lastrest_life` int(11) NOT NULL default '0', `lastrest_other` int(11) NOT NULL default '0', `location` int(11) NOT NULL default '0', `hospital` int(11) NOT NULL default '0', `jail` int(11) NOT NULL default '0', `jail_reason` varchar(255) NOT NULL default '', `fedjail` int(11) NOT NULL default '0', `user_level` int(11) NOT NULL default '1', `gender` enum('Male','Female') NOT NULL default 'Male', `daysold` int(11) NOT NULL default '0', `signedup` int(11) NOT NULL default '0', `gang` int(11) NOT NULL default '0', `daysingang` int(11) NOT NULL default '0', `course` int(11) NOT NULL default '0', `cdays` int(11) NOT NULL default '0', `jobrank` int(11) NOT NULL default '0', `donatordays` int(11) NOT NULL default '0', `email` varchar(255) NOT NULL default '', `login_name` varchar(255) NOT NULL default '', `display_pic` text NOT NULL, `duties` varchar(255) NOT NULL default 'N/A', `bankmoney` int(11) NOT NULL default '0', `cybermoney` int(11) NOT NULL default '-1', `staffnotes` longtext NOT NULL, `mailban` int(11) NOT NULL default '0', `mb_reason` varchar(255) NOT NULL default '', `hospreason` varchar(255) NOT NULL default '', `lastip_login` varchar(255) NOT NULL default '127.0.0.1', `lastip_signup` varchar(255) NOT NULL default '127.0.0.1', `last_login` int(11) NOT NULL default '0', `voted` text NOT NULL, `crimexp` int(11) NOT NULL default '0', `attacking` int(11) NOT NULL default '0', `verified` int(11) NOT NULL default '0', `forumban` int(11) NOT NULL default '0', `fb_reason` varchar(255) NOT NULL default '', `posts` int(11) NOT NULL default '0', `forums_avatar` varchar(255) NOT NULL default '', `forums_signature` text NOT NULL, `new_events` int(11) NOT NULL default '0', `new_mail` int(11) NOT NULL default '0', `friend_count` int(11) NOT NULL default '0', `enemy_count` int(11) NOT NULL default '0', `new_announcements` int(11) NOT NULL default '0', `boxes_opened` int(11) NOT NULL default '0', `user_notepad` text NOT NULL, `equip_primary` int(11) NOT NULL default '0', `equip_secondary` int(11) NOT NULL default '0', `equip_armor` int(11) NOT NULL default '0', `force_logout` tinyint(4) NOT NULL default '0', `fishing_aloud` int(11) NOT NULL default '20', `squestion` varchar(255) NOT NULL, `Random_key` varchar(32) default NULL, `activated` int(1) NOT NULL default '0', PRIMARY KEY (`userid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ; i cant work out where the error is between these 2, the error is QUERY ERROR: Column count doesn't match value count at row 1 Query was INSERT INTO users (username, login_name, userpass, squestion, level, money, crystals, donatordays, user_level, energy, maxenergy, will, maxwill, brave, maxbrave, hp, maxhp, location, gender, signedup, email, bankmoney, lastip, lastip_signup) VALUES( 'Test', 'Test', md5('123456789'), 'secretanswer', 1, 100, 0, 0, 1, 12, 12, 100, 100, 5, 5, 100, 100, 1, 'Male', unix_timestamp(), '[email protected]', 0, '88.107.133.23', '88.107.133.23', random_string('alnum', 32))
-
[mccode] Reset your users without deleating them
Modern-Empires replied to Redeye's topic in Free Modifications
Re: [mccode] Reset your users without deleating them do not use this, it's full of bugs and will mess up everything DO NOT USE -
Re: need help 1 - this is the wrong section to post it... 2 - need more info such as, is the game codes new? have you added/edited any pages,
-
Re: Sell Your Gang VR1 good mod, V2 for people that cant code <?php session_start(); require "globals.php"; print "<h3>Gangs Market</h3>"; switch($_GET['action']) { case "buy": gang_buy(); break; case "remove": gang_remove(); break; case "add": gang_add(); break; default: gangmarket_index(); break; } function gangmarket_index() { global $ir,$c,$userid,$h; print "<table width=75% border=1 bordercolor=#666666><tr><td>"; if($ir['gang']) { print "[url='gangmarket.php?action=add']> Add Your Gang[/url]"; } print "</td> </tr> </table> <table width=75% border=1 bordercolor=#666666><th>Seller</th> <th>Gang </th> <th> Price </th> <th>Average Rating</th> <th>Links</th> </tr>"; $q=mysql_query("SELECT gm.*, u.*,g.* FROM gangsmarket gm LEFT JOIN users u ON u.userid=gm.gm_from LEFT JOIN gangs g ON gm.gm_gang=g.gangID",$c) or die(mysql_error()); while($r=mysql_fetch_array($q)) { if($r['gang'] != $r['gangID']) { mysql_query("DELETE FROM gangsmarket WHERE gm_id={$r['gm_id']}",$c); } if($r['gm_from'] == $userid) { $link = "[url='gangmarket.php?action=remove&ID={$r[']Remove[/url]"; } else { $link = "[url='gangmarket.php?action=buy&ID={$r[']Buy[/url]"; } $total=$r['gangRESPECT']+mysql_num_rows(mysql_query("SELECT * FROM users WHERE gang={$r['gangID']}")); $total=$total/10; if($total > 1000) { $rate=10; } elseif($total > 900) { $rate=9; } elseif($total > 800) { $rate=8; } elseif($total > 700) { $rate=7; } elseif($total > 600) { $rate=6; } elseif($total > 500) { $rate=5; } elseif($total > 400) { $rate=4; } elseif($total > 300) { $rate=3; } elseif($total > 200) { $rate=2; } else { $rate=1; } print "\n<tr> <td>[url='viewuser.php?u={$r[']{$r['username']}[/url] [{$r['userid']}]</td> <td>[b]{$r['gangNAME']}[/b]</td> <td> \$" . number_format($r['gm_price'])."</td> <td>$rate/10</td> <td>[$link]</td> </tr>"; } print "</table>"; } function gang_remove() { global $ir,$c,$userid,$h; $q=mysql_query("SELECT * FROM gangsmarket WHERE gm_id={$_GET['ID']} AND gm_from=$userid",$c); if(!mysql_num_rows($q)) { print "Error, either this gang do not exist, or you are not the owner. [url='gangmarket.php']> Back[/url]"; $h->endpage(); exit; } $r=mysql_fetch_array($q); mysql_query("DELETE FROM gangsmarket WHERE gm_id={$_GET['ID']}",$c); print "Your gang removed from market! [url='gangmarket.php']> Back[/url]"; } function gang_buy() { global $ir,$c,$userid,$h; $q=mysql_query("SELECT * FROM gangsmarket WHERE gm_id={$_GET['ID']}",$c); if(!mysql_num_rows($q)) { print "Error, either this gang do not exist, or they have already been bought. [url='gangmarket.php']> Back[/url]"; $h->endpage(); exit; } elseif($ir['gang'] != 0) { print "Error, you are already in a gang so you cannot purchase this one. [url='gangmarket.php']> Back[/url]"; $h->endpage(); exit; } $r=mysql_fetch_array($q); if($r['gm_price'] > $ir['money']) { print "Error, you do not have the funds to buy this gang. [url='gangmarket.php']> Back[/url]"; $h->endpage(); exit; } mysql_query("UPDATE users SET gang={$r['gm_gang']},daysingang=0 where userid=$userid",$c) or die(mysql_error()); mysql_query("DELETE FROM gangsmarket WHERE gm_id={$_GET['ID']}",$c); mysql_query("UPDATE gangs SET gangPRESIDENT={$userid},gangVICEPRES={$userid} WHERE gangID={$r['gm_gang']}",$c); mysql_query("UPDATE users SET gang=0,daysingang=0 where userid={$r['gm_from']}",$c); mysql_query("UPDATE users SET money=money-{$r['gm_price']} WHERE userid=$userid",$c); mysql_query("UPDATE users SET money=money+{$r['gm_price']} WHERE userid={$r['gm_from']}",$c); event_add($r['gm_from'],"[url='viewuser.php?u=$userid']{$ir['username']}[/url] bought your gang from the market for \$".number_format($r['gm_price']).".",$c); print "You bought the gang from the market for \$".number_format($r['gm_price'])."."; } function gang_add() { global $ir,$c,$userid,$h; $_POST['price'] = abs((int) $_POST['price']); if($_POST['price']) { $q=mysql_query("SELECT * FROM gangsmarket WHERE gm_from=$userid",$c); if($_POST['price'] > 20000000000) { die("Your limit is \$20billion "); } elseif(mysql_num_rows($q)) { die ("You have already added your gang to the market."); } elseif(!$ir['gang']) { die ("You dont have a gang."); } $tp=$_POST['price']; mysql_query("INSERT INTO gangsmarket (gm_id,gm_from,gm_gang,gm_price) VALUES ('NULL', '{$userid}', '{$ir['gang']}', '{$tp}');", $c); print "Gang added to market! [url='gangmarket.php']> Back[/url]"; } else { print "<table width=75% border=1 bordercolor=#666666><tr><td>[b]Here you are adding your whole gang including the contents.[/b]</td> </tr> </table> <form action='gangmarket.php?action=add' method='post'><table width=75% border=1 bordercolor=#666666><tr> <td>Price:</td> <td>[b]Maximum price is \$20,000,000,000[/b] <input type='text' name='price' value='20000000' /></td></tr><tr> <td colspan=2 align=center><input type='submit' value='Add To Market' /></tr></table></form>"; } } $h->endpage(); ?>
-
Re: [mccode v2] Fishing Mod good mod, edited my copy tho cos i though it was giving out to much exp and money but thanks for the good mod
-
change colours without editing the pages [V2]
Modern-Empires replied to Modern-Empires's topic in Requests & In Production
Re: change colours without editing the pages [V2] i would of posted up here but my laptop got drunk on my wine so it's now not working and i lost the only copy i had on my PC -
Re: Help needed will pay $20 aint this in the wrong section
-
change colours without editing the pages [V2]
Modern-Empires replied to Modern-Empires's topic in Requests & In Production
Re: change colours without editing the pages [V2] and without even a CSS page, geez it's sooooooooooooooooooooooooooooo simple