Jump to content
MakeWebGames

Modern-Empires

Members
  • Posts

    123
  • Joined

  • Last visited

    Never

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Modern-Empires's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. 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
  2. Re: [v2] New Header will u ever be making a login for this?
  3. Re: [V2] Chat PLEASE NOTE if you are using mozilla firefox that the usersonline section is working :P
  4. 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
  5. Re: [V2] Chat   using mysql version will make the game more prone to hackers
  6. 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
  7. Re: [V2] Chat   i would put the auther down but i dont know who made it, sorry to whoever made it, i
  8. Re: [V2] Chat ok thanks for that, probs wasnt thinking when i made it lol
  9. 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
  10. 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....
  11. 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>'; } } ?>
  12. 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
  13. 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
  14. Re: [mccode] Reset your users without deleating them nope i havent used it and dont plan to use
  15. 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
×
×
  • Create New...