-
Posts
3,655 -
Joined
-
Last visited
-
Days Won
12
Content Type
Profiles
Forums
Events
Everything posted by a_bertrand
-
Re: Paypal IPN. Secure? If you write correctly your paypal handling it will be 100% sure, as you control directly to the paypal site if the transaction is correct or not. Make sure to control that the total is indeed the number of item x your price, so that nobody can pay for a 0.01 priced item ;-)
-
Re: please iwant db.php file That's the class I wrote which reflects more or less ADOdb syntax but yet is much faster as it has less functions. Don't know if this is what you was looking for. <?PHP Class database { var $conn; var $nbquer; var $storeQuery; var $storeID; function database($host,$username,$password,$dbname) { $this->nbquer=0; $this->conn = mysql_connect($host, $username, $password) //$this->conn = mysql_pconnect($host, $username, $password) or die("Could not connect : " . mysql_error()); mysql_select_db($dbname,$this->conn) or die("Could not select database"); } function startStore($id) { $this->storeQuery=true; $this->storeID=$id; $file=fopen("cache/queries_$id.txt","w"); fclose($file); } function close() { mysql_close($this->conn);} function execute($query) { if($this->storeQuery) {$file=fopen("cache/queries_".($this->storeID).".txt","a"); fwrite($file,"$query-*@*-"); fclose($file);} $this->nbquer++; $res=new resultset(); return $res->exec($query,$this->conn); } function getid() { return mysql_insert_id(); } function SelectLimit($query,$nb,$start) { $res=new resultset(); return $res->exec($query." LIMIT $start,$nb",$this->conn); } function updateclob($table,$field,$data,$where) { $query="UPDATE $table SET $field=".$this->qstr($data)." WHERE $where"; return mysql_query($query,$this->conn); } function qstr($str) { return "'".mysql_real_escape_string($str)."'"; } } class resultset { var $result; var $fields; var $EOF; function resultset() {$this->EOF=true;$this->result=null;} function exec($query,$conn) { $this->EOF=false; $this->result = mysql_query($query,$conn); if($this->result === FALSE) { $this->result=null;$this->EOF=true; return false; } if($this->result === TRUE) { $this->result=null;$this->EOF=true; return true; } $this->fields=mysql_fetch_row($this->result); if($this->fields === FALSE) { $this->EOF=true; $this->fields=array(); } return $this; } function close() { if($this->result != null) @mysql_free_result($this->result); } function movenext() { $this->fields=mysql_fetch_row($this->result); if($this->fields === FALSE) { $this->fields=array(); $this->EOF=true; } } function fieldcount() { return mysql_num_fields($this->result); } function fetchfield($col) { return mysql_fetch_field($this->result, $col); } } $db=new database("localhost", "your_user", "you_pass", "your_db"); ?>
-
Re: Looking For A Custom Game script Then you may try our engine: http://www.nowhere-else.org/engine/ Keep it mind it's not a game, it's just an engine.
-
Re: please iwant db.php file You can build all the code yourself without using pre-existing packages. Now, personally, I would not avoid other packages by principle, you should still check if there isn't something which does what you want as it may spare you a lot of work. Only problem is that most of those packages are under the GNU license or similar, which means you may have some troubles for commercial re-distribution, check carefully the license which comes with packages you may use.
-
MyIsam or InnoDB or ?
a_bertrand replied to a_bertrand's topic in MySQL, Oracle, Postgress or other DB
Re: MyIsam or InnoDB or ? Table locks immediate 185260831 Table locks waited 716621 Factor 1:258... which seems still acceptable And if you check articles like this one (there is tons of those kind): http://www.devshed.com/c/a/MySQL/MySQL-Optimization-part-2/ You will soon see that indeed InnoDB is not the "best option" for all needs (better design or not). Also something else, why people developping a dabatase like MySQL would keep MyISAM if it would be so inferior in any case against InnoDB? Why don't they drop simply MyISAM then? Simply because InnoDB is not the solution for everything. All my tests demonstrated what? (Live on the running game while converting a table or via my tool) Well simply that so far I don't see a benefit using InnoDB. Doesn't mean InnoDB is not good, or MyISAM is better, simply that for me, at the moment, myISAM still outperform InnoDB. CtrlFreq: All those talk about good design and teaching others, sorry but you can keep it for yourself, really I don't need that. I'm not a new player in the DB field, nor in the web development, and I really don't need a coach for those things. I just shared my experience (which is just mine), and asked if others got different results... also as somebody asked for the tool I developed, well I gave it for free too... Now if you had a bad day, you can simply avoid to answer and it will help to improve the overall mood of the community. codestryke: Thanks for your answer, indeed I don't usually do my choice only based on tests (as tests are always imperfect by nature), but simply as I wasn't able to see any improvement nor decrease in performance during real life runs, and I had the option to test it on the new server just before bringing the new server live, I though it would be a good timing for a test. -
MyIsam or InnoDB or ?
a_bertrand replied to a_bertrand's topic in MySQL, Oracle, Postgress or other DB
Re: MyIsam or InnoDB or ? CtrlFreq: all good and well, but as yourself stated, on my case it's not the case, so why choose something slower RIGHT NOW? In case in a few years I will redo the experiment and see if it changes, up to then it would simply stupid switching and now have a lower performance. If my table is small or not, it's not the point, the point is my ACTUAL performances. However thanks for your info, as I get it like "watch out, maybe the situation will change if your DB grows yet more". You could just have said that without pointing bad testing environment, wrong queries or whatever... That would have been more friendly and productive. -
MyIsam or InnoDB or ?
a_bertrand replied to a_bertrand's topic in MySQL, Oracle, Postgress or other DB
Re: MyIsam or InnoDB or ? Sorry CtrlFreq, but I believe you didn't read carefully what I said. This reflect the normal usage of my database, with near real queries. Why should I increase the number of rows in one table? Why should I try only with the player table when my game doesn't only do that? If you want to test performances for your game, for your own code, you should run near real life queries and that what I did. I do not care at all if in other setups InnoDB are faster, that wasn't what I want to test / stress. What I wanted to see is how it react for my own personal needs. If you don't believe this is my own real usage of the database, well not my problem, and again I'm not using McCode, so.... my usage is not the same as you will get. Also I don't care about seeing which query blocks which not, I do know very well what means a table lock vs. row lock, but that's not the unique thing. Even on the MySQL site they state an high load on the disks for the InnoDB engine.... which is also not something you really want, isn't it? -
MyIsam or InnoDB or ?
a_bertrand replied to a_bertrand's topic in MySQL, Oracle, Postgress or other DB
Re: MyIsam or InnoDB or ? Was tested with PLAYER 6000 records. PLAYER_MESSAGES 346992 records. INVENTORY 398298 records QUESTVARIABLES 467392 recods 4 updates and 10 select per iteration... that was already specified BTW ;) And I doubt we should not note performances differences with those numbers. BTW If you unzip and check the config, you see exactly the queries used. Again, this doesn't mean InnoDB is not good, it just mean that for me it is not the fastest DB for my own game right now. That's all. -
MyIsam or InnoDB or ?
a_bertrand replied to a_bertrand's topic in MySQL, Oracle, Postgress or other DB
Re: MyIsam or InnoDB or ? To allow others do the test as well, I made a version of my test tool which can be configured by editing an XML file: http://www.nowhere-else.org/temp/TestMySQL.zip Edit the TestMySQL.exe.config (without breaking it) to reflect your config. ConnectionSting: should reflects how to connect to your database QueryID: should allows to retrieve a list of ID which will be then used to run the queries without too much caching. NBThreads: tells how many concurrent threads should be launched. Queries: is the list of queries you want to run... where @ID is replaced by one of the value returned by the QueryID select. Now to run the test you need .NET 2.0 or above installed on your PC. It may run on Linux too, with Mono installed (never tested it). Just uncompress the zip, edit the config file and run the exe... To understand what the output is, basically the top line shows how many iterations per second your system can answer, that means basically how many times per second the full list of queries has been run. Of course the higher number of queries you put the slower it will be. So make something similar as your game do, and you will be able to know how many "pages" your database will be able to server per second... Isn't that cool? Now, to come back to my myIsam vs. InnoDB -> I do have definitively an higher number of iterations per second with myIsam than InnoDB. Also the disk activity is much more reduced with myIsam. -
Re: InnoDB or MyISAM Do some tests instead of assuming it would be better. I did, with 200 threads doing queries at the same time and saddly InnoDB was't as fast as MySQL even with updates. But again, this is for my own application, maybe yours is different (I don't use McCode for example). Also, I don't need transactions...
-
Re: Monitor your server from PHP - Remote GUI is not good due to his slowness, unless you are in the same network. - Compatibility with some back-ends, then yes, but I rarely saw a back-end which doesn't offer yet web services. - Server memory is never cheap, specially if you need to rent your dedicated server.
-
Re: Monitor your server from PHP Honestly you would run your PHP scripts on a windows server? Would be a non-sense... I would run on a windows server only for ASPX applications (with IIS) but certainly not for a PHP installation. I do use PHP on windows but only for the development ;) Why? Well simply check the memory usage of your server with just the OS loaded, and tell me which of a Linux box or a Windows box use less memory, add to that cron and ssh and you know why I use Linux as servers.
-
A little script to get the HDD activity and memory / cpu usage. I used popen but you may use other functions as well. <?PHP echo "<PRE>\n"; echo "[b]IO STATS[/b]\n"; $handle=popen("/usr/bin/iostat -k sda 1 2","r"); fread($handle,16000); $lines=explode("\n",fread($handle,16000)); array_shift($lines); array_shift($lines); array_shift($lines); echo implode("\n",$lines); pclose($handle); echo "[b]Top[/b]\n"; $handle=popen("/usr/bin/top -b -n 1","r"); echo fread($handle,16000); pclose($handle); echo "</PRE>\n"; ?>
-
Improve security against brute force SSH attacks
a_bertrand replied to a_bertrand's topic in Tutorials
Re: Improve security against brute force SSH attacks NP, some times there is so many possible solutions that you just find one which may not be the best one. Or some time a better solution appear after you already installed something... A server move is for me a good excuse to check what exists :-D -
Improve security against brute force SSH attacks
a_bertrand replied to a_bertrand's topic in Tutorials
Re: Improve security against brute force SSH attacks CSF -> Linux Firewall software? And this pam module has the advantage first to not be visible from outside, second that it doesn't use any cron or special script to check your logs... It's simply called for each ssh your server get. So for me this is the best option. -
Hi, If you rent a VPS or a dedicated server or you have your own server connected to Internet, you should make sure nobody can break into your system simply by trying all sort of username/password. On relatively easy way to do so, is to install an additional pam_module: pam_abl -> http://www.hexten.net/wiki/index.php/Pam_abl Now to configure it check this site: http://www.ducea.com/2006/06/29/using-pam-to-block-brute-force-attacks/ Make sure the" auth required /lib/security/pam_abl.so ..." is above the remaining auth parts of your PAM SSH config or it will not work. This will not prevent the attacker to try... simply it will never work after the module detected a brute force attack, even with the correct password! After X days (you can configure it) the blocked list is cleaned, and things are back to normal. You may also check this site: http://rhcelinuxguide.wordpress.com/2006/06/01/autoblock-ips-with-failed-ssh-logins/ As there, you will find also some explanation how to block completely the IP of the "hacker" so that he/she cannot reach your server anymore. See you soon for some more SysAdmin work! (thanks mdshare to point me to the right place ;-) )
-
Re: NEAB engine FREE edition Released a new version which should fix some issues with new PHP configurations. Have fun!
-
Re: miniNEaB version 4.0 Thanks Nyna
-
Re: miniNEaB version 4.0 We just released the final version of the miniNEAB 4.0 engine. All owners can now download from their download links the latest release and the latest release of all the modules. As main changes: - Added new skin system - Improved 2D map speed - Improved 2D map speed - Imaged buttons - Sub windows for prefs, journal and others - On map NPC dialogs - Faster loading maps - URL hiding for improved security - On map life - Player dialogs on map are drawn inside balloons - Some animated avatars - Improved default home page - Improved all the optional modules to make the integration much easier The demo shows the new version as well.
-
Re: Some cool PHP links... Thanks for the link, I found a few interesting things there (like the injector checker library or the Yahoo speed group).
-
Re: 2009 Legal Rules for your website Good info, but what about sites which doesn't reside in the US? I don't think the same laws can be applied, right? So for me those laws applies only on website hosted directly on the US territory.
-
MyIsam or InnoDB or ?
a_bertrand replied to a_bertrand's topic in MySQL, Oracle, Postgress or other DB
Re: MyIsam or InnoDB or ? Thanks codestryke, that was also my planned approach, as I'm still somehow scared of the table lock approach of MyISAM. I do already use quiet a few HEAP tables (for things which doesn't need to be kept long and at the same time will be selected / modified a lot). -
Re: Query. Optimized? There is also a good free way to know how optimized your queries are, and if you need either to change your queries or add indexes to your tables: Simply open your trusted phpMyAdmin and run your query (works only with select queries!) adding the keyword EXPLAIN: EXPLAIN SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=1 That will give you back the info of how many rows have been loaded to get your data back and more... Always a very useful tool.
-
MyIsam or InnoDB or ?
a_bertrand replied to a_bertrand's topic in MySQL, Oracle, Postgress or other DB
Re: MyIsam or InnoDB or ? Cronus: thanks to share your experience. I wasn't searching somebody which tested like me... Just other tests was ok ;-) Lithium: Thanks for the link, but actually this was the first link I read, then I checked also those http://www.mysqlperformanceblog.com/2007/01/08/innodb-vs-myisam-vs-falcon-benchmarks-part-1/ http://tag1consulting.com/MySQL_Engines_MyISAM_vs_InnoDB Oddly enough from those two links InnoDB seems faster than MyISAM, so I thought, great! I will switch right away... But wait... Maybe we should do some tests... and that's why I did my post, my results are not the same as those guys. -
Hi, Maybe some of you already thought about it, if not then you should ;-) To explain why you should, and at the same time to not make it a too long story just let tell you a bit of the background of my own game dev adventure. So far I was renting a dedicated server in the US by Lunarpages, and I was really happy with their service, however the price is somehow... not so low. Also as the number of player grows (as should any game experience), we may soon face troubles with our current hardware. Finally having a server hosted on the US territory has some drawbacks, specially if your are, like me, not living in the US, you may have legal troubles which in that case could be under the US law (due to the fact your server is running there), but there is also simply timezones troubles which having your server nearby would be avoided. Well, for all those reasons, we decided to buy our own server and host it here in Switzerland (yes I'm Swiss). Now, it's just a good time to test things and see if some parts could be optimized, as we don't risk to have impact yet on the players while playing ourself with the new server. So we decided to test for example if we should use MyISAM tables or have at least some InnoDB tables. Why? well InnoDB offers a few advantages over MyISAM: - Row locking instead of table locking (which means when you do an update it will not lock the whole table, but just the rows you are modifying) - Transactions supported. - Full backup consistency (without locking all the tables during the backup) All this seams nice, but what about speed? Well, searching on the net, lot of people says InnoDB is actually faster than MyISAM... so why not jump on it right away? Well, let's say I'm a skeptic guy, and unless I test it myself, I tend to not believe it ;-) So how did I tested it? Well using my full game setup, and extracting about 14 queries (10 select and 4 updates) I created a small C# program which connect to my DB Server, create 200 threads (concurrent connections) and runs in loop my 14 queries by changing the player ID at each loop, to be sure that the server doesn't cache too much my results ;-) Results? InnoDB 130 iterations per seconds MyISAM 400 iterations per seconds Those queries are not the lightest one (on purpose), and the updates should actually lock the tables which other thread should try to read... so we should really experience near real life experience. Conclusion: I will not move to InnoDB as it's clearly too slow for my own experience. I may however double test if just changing one or two table I do gain something or not... but so far InnoDB didn't proved me it's superiority... specially as I don't really need the transactions. The only thing which I would miss is the possibility to make hot backups without locking my tables. Just for info, my Server is a quad core with 4GB ram, and running Linux Cent-OS 5 in 64 bit. I did tweaked the my.cfg to use a lot more memory than default (without going to swap), as well setup correctly the number of thread the server uses. If you had another experience about it, please share it ;-)