Jump to content
MakeWebGames

Will

Members
  • Posts

    215
  • Joined

  • Last visited

    Never

Everything posted by Will

  1. Just wondering how many people are using Nginx, (or lighttpd for that matter) not apache? I've been using Nginx for a site I work for (http://www.citystruggle.com) and it's much faster, and has a smaller memory footprint; I've tested it up to 10,000 concurrent users :P The php is served through FastCgi, with mysql and memcached. I've been able to overcome no htaccess with some rewrites in the nginx.conf, however the syntax takes a while to get used to. Also I don't use vhost, that server only hosts the single site.
  2. Will

    Dectece user OS

    You have to be able to change the php.ini file
  3. Will

    Dectece user OS

    Just use the phpget_browser() function. You'll need to add the browscap file to your php.ini file though: Browscap file: http://browsers.garykeith.com/downloads.asp and in the php.ini file: browscap=browscap.ini Change the file name to the one your download.
  4. Re: IP Banning tool [V1] + [V2] I use: if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_CLIENT_IP']) && (preg_match('~^((0|10|172\.16|192\.168|255|127\.0)\.|unknown)~', $_SERVER['HTTP_CLIENT_IP']) == 0 || preg_match('~^((0|10|172\.16|192\.168|255|127\.0)\.|unknown)~', $_SERVER['REMOTE_ADDR']) != 0)) { if (strtok($_SERVER['HTTP_X_FORWARDED_FOR'], '.') != strtok($_SERVER['HTTP_CLIENT_IP'], '.') && '.' . strtok($_SERVER['HTTP_X_FORWARDED_FOR'], '.') == strrchr($_SERVER['HTTP_CLIENT_IP'], '.') && (preg_match('~^((0|10|172\.16|192\.168|255|127\.0)\.|unknown)~', $_SERVER['HTTP_X_FORWARDED_FOR']) == 0 || preg_match('~^((0|10|172\.16|192\.168|255|127\.0)\.|unknown)~', $_SERVER['REMOTE_ADDR']) != 0)) $_SERVER['REMOTE_ADDR'] = implode('.', array_reverse(explode('.', $_SERVER['HTTP_CLIENT_IP']))); else $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CLIENT_IP']; } if (!empty($_SERVER['HTTP_CLIENT_IP']) && (preg_match('~^((0|10|172\.16|192\.168|255|127\.0)\.|unknown)~', $_SERVER['HTTP_CLIENT_IP']) == 0 || preg_match('~^((0|10|172\.16|192\.168|255|127\.0)\.|unknown)~', $_SERVER['REMOTE_ADDR']) != 0)) { if (strtok($_SERVER['REMOTE_ADDR'], '.') != strtok($_SERVER['HTTP_CLIENT_IP'], '.')) $_SERVER['REMOTE_ADDR'] = implode('.', array_reverse(explode('.', $_SERVER['HTTP_CLIENT_IP']))); else $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',') !== false) { $ips = array_reverse(explode(', ', $_SERVER['HTTP_X_FORWARDED_FOR'])); foreach ($ips as $i => $ip) { if (preg_match('~^((0|10|172\.16|192\.168|255|127\.0)\.|unknown)~', $ip) != 0 && preg_match('~^((0|10|172\.16|192\.168|255|127\.0)\.|unknown)~', $_SERVER['REMOTE_ADDR']) == 0) continue; $_SERVER['REMOTE_ADDR'] = trim($ip); break; } } elseif (preg_match('~^((0|10|172\.16|192\.168|255|127\.0)\.|unknown)~', $_SERVER['HTTP_X_FORWARDED_FOR']) == 0 || preg_match('~^((0|10|172\.16|192\.168|255|127\.0)\.|unknown)~', $_SERVER['REMOTE_ADDR']) != 0) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR']; } elseif (!isset($_SERVER['REMOTE_ADDR'])) { $_SERVER['REMOTE_ADDR'] = ''; } $ip=$_SERVER['REMOTE_ADDR'];   It's not mine, can't remeber where from. Effective Though.
  5. Re: Factorial Program in C++ - 1 Million Factorial   What's it for?
  6. Re: [mccode] Money,crystals cap   ... Stats are a decimal as well.....
  7. Re: [mccode] Password reset code   Then you already have it in there.
  8. Re: [mccode] Password reset code   I hoped by me saying you didn't read the instructions would prompt you to do so; I guess not. You didn't put the function in global_func.php or never included it. Re-read the instructions carefully.
  9. Re: [mccode] Password reset code   Yeah, You didn't read the instructions.
  10. Re: Money,crystals cap   err sorry dude but u are sadly mistaken as i have changed it from Decimal bigger then INT and oh yer it works fine so maybe ya shud think before you speak I did think. You clearly didn't as your sentence is incoherent and I can derive no meaning from it. Perhaps you should rephrase it?
  11. Will

    Php Image Table

    Re: Php Image Table Doesn't include the table module.
  12. Will

    Php Image Table

    Before I make one myself; I was wondering if anybody knows a free class to make a table as an image. I know Jpgraph do it in but only in their paid version but I'm looking for something free. Just to save myself the trouble; and before you ask there is a valid reason why it has to be an image. Thanks.
  13. Will

    PHP Form issue

    Re: PHP Form issue   The user can still edit it...
  14. Will

    PHP Form issue

    Re: PHP Form issue Why even bother with encryption? You can never trust an input from a user; as said just use a session.
  15. Will

    loop problem

    Re: loop problem Well in will only ever increase the level is the exp is less than 0: while($e < 0) { Mayby it should be > instead?
  16. Re: Factorial Program in C++ - 1 Million Factorial ok. I should try and make mine faster; perhaps I'm going the wrong way about it but I can't think of any other way. Perhaps make a second pointer so the loop doesn't run through 0's. Or stick more than 1 character in each key of the array.
  17. Re: Factorial Program in C++ - 1 Million Factorial The core2 only makes a slight difference on an intel duel core I think. The 64 result is about right due to caclulations being done quicker. Are you running a x64 OS, should only have worked if you did? I run XPx64.
  18. Re: Javascript + Ajax ....should be: <?php //Added <?php tags to make it look neater function _3() { global $ir,$h,$set,$data; echo '[b]Shoutbox Room[/b] ' if(file_exists("shoutbox.php")) { echo ' <script type="text/javascript" language="javascript"> var xmlHttp; function GetXmlHttpObject() { var objXMLHttp=null; if (window.XMLHttpRequest) { objXMLHttp=new XMLHttpRequest(); } else if (window.ActiveXObject) { objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP"); } return objXMLHttp; } function update() { xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { return; } xmlHttp.onreadystatechange=function() { if(xmlHttp.readyState==4 && xmlHttp.status == 200) { var response = xmlHttp.responseText; if (response) { document.getElementById("ShoutBox.Room").innerHTML=response; } } } //change the url to the chatbox file var url="shoutbox.php"; xmlHttp.open("get", url+ "?ms=" + new Date().getTime()); xmlHttp.send(null); } //5 seconds setInterval("update()", 5000); </script> <div id="ShoutBox.Room" style=" height:400px; width:98%; overflow:scroll;"> </div>'; } else { echo 'Shoutbox Currently Down.'; } _back(); } ?>   Then you need a file called shoutbox.php to output the shoutbox data.
  19. Re: Javascript + Ajax Updated my first post to incude an AJAX version Also there is an AJAX board: http://criminalexistence.com/ceforums/http://makewebgames.io/phpBB3/viewforum.php?f=6.0
  20. Re: Javascript + Ajax I said to put that JS into the page the iframe is opening; that will refresh the iframe.
  21. Re: Javascript + Ajax Easier just do put something in the page the iframe is opening:   <script type="text/javascript" language="javascript"> function jsreload () { window.location.reload(); } setTimeout('jsreload()', 5000); </script>   That reloads every 5 seconds. Or you could use AJAX:   <script type="text/javascript" language="javascript"> var xmlHttp; function GetXmlHttpObject(){ var objXMLHttp=null; if (window.XMLHttpRequest){ objXMLHttp=new XMLHttpRequest(); }else if (window.ActiveXObject){ objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP"); } return objXMLHttp; } function update() { xmlHttp=GetXmlHttpObject(); if (xmlHttp==null){ return; } xmlHttp.onreadystatechange=function() { if(xmlHttp.readyState==4 && xmlHttp.status == 200) { var response = xmlHttp.responseText; if (response) { document.getElementById('shoutbox').innerHTML=response; } } } //change the url to the chatbox file var url="shoutbox.php"; xmlHttp.open("get", url+ '?ms=' + new Date().getTime()); xmlHttp.send(null); } //5 seconds setInterval("update()", 5000); </script> Change the url variable to the shoutbox feed This would mean to change the div tag to: <div id="shoutbox" style=" height:400px; width:98%; overflow:scroll;"> </div>
  22. Re: Enumeration Permutations - Minor Notice Was it right?
  23. Re: [FAQ] Quotes, and heredoc Or you could just use ?> <?php to close the php tags and write HTML. It makes no difference to speed as php just ignores it. For variables you could use: <?=$variable?>
  24. Re: [Free][v1][v2] Password reset code What are you trying to get at :? The passwords should be encrypted; even better than md5; and this was made for encrypted passwords as you can't tell them their password as you don't know what it is.
  25. Will

    Books

    Re: Books This is a good one: http://www.amazon.co.uk/exec/obidos/ASIN/032152599X
×
×
  • Create New...