Jump to content

Kryptix

Members
  • Posts

    283
  • Joined

  • Last visited

    Never

Everything posted by Kryptix

  1. That runs at 1.87 and the NOT IN ran at 2.51 so yeah it's quicker. Thanks for that. Could any of the other queries be improved? DELETE FROM `RSCEmulation`.`rscd_players` WHERE UNIX_TIMESTAMP() > `delete_date` AND `delete_date` != '0'; UPDATE `RSCEmulation`.`users` SET `num_posts` = (SELECT COUNT(`id`) FROM `RSCEmulation`.`posts` WHERE `poster_id` = `users`.`id`); UPDATE `RSCEmulation`.`rscd_experience` SET `exp_hits` = (((`exp_strength` + `exp_attack` + `exp_defense`) / 3) + 1154); INSERT INTO `RSCEmulation Logs`.`web_statistics` (`time`, `total_accounts`, `accounts_today`, `total_characters`, `characters_today`, `online`, `online_unique`, `online_today`, `online_today_unique`, `total_topics`, `topics_today`, `total_posts`, `posts_today`) VALUES (UNIX_TIMESTAMP(), (SELECT COUNT(`id`) FROM `RSCEmulation`.`users`), (SELECT COUNT(`id`) FROM `RSCEmulation`.`users` WHERE FROM_UNIXTIME(`registered`) BETWEEN DATE_ADD(NOW(), INTERVAL -1 DAY) AND NOW()), (SELECT COUNT(`id`) FROM `RSCEmulation`.`rscd_players`), (SELECT COUNT(`id`) FROM `RSCEmulation`.`rscd_players` WHERE FROM_UNIXTIME(`creation_date`) BETWEEN DATE_ADD(NOW(), INTERVAL -1 DAY) AND NOW()), (SELECT COUNT(`id`) FROM `RSCEmulation`.`rscd_players` WHERE `online` = '1'), (SELECT COUNT(DISTINCT(`login_ip`)) FROM `RSCEmulation`.`rscd_players` WHERE `online` = '1'), (SELECT COUNT(`id`) FROM `RSCEmulation`.`rscd_players` WHERE FROM_UNIXTIME(`login_date`) BETWEEN DATE_ADD(NOW(), INTERVAL -1 DAY) AND NOW()), (SELECT COUNT(DISTINCT(`login_ip`)) FROM `RSCEmulation`.`rscd_players` WHERE FROM_UNIXTIME(`login_date`) BETWEEN DATE_ADD(NOW(), INTERVAL -1 DAY) AND NOW()), (SELECT COUNT(`id`) FROM `RSCEmulation`.`topics`), (SELECT COUNT(`id`) FROM `RSCEmulation`.`topics` WHERE FROM_UNIXTIME(`posted`) BETWEEN DATE_ADD(NOW(), INTERVAL -1 DAY) AND NOW()), (SELECT COUNT(`id`) FROM `RSCEmulation`.`posts`),(SELECT COUNT(`id`) FROM `RSCEmulation`.`posts` WHERE FROM_UNIXTIME(`posted`) BETWEEN DATE_ADD(NOW(), INTERVAL -1 DAY) AND NOW())); DELETE FROM `RSCEmulation Logs`.`game_chat` WHERE `time` < UNIX_TIMESTAMP() - 604800; UPDATE `RSCEmulation`.`rscd_experience` SET `total_xp` = (exp_attack + exp_defense + exp_strength + exp_hits + exp_ranged + exp_prayer + exp_magic + exp_cooking + exp_woodcut + exp_fletching + exp_fishing + exp_firemaking + exp_crafting + exp_smithing + exp_mining + exp_herblaw + exp_agility + exp_thieving + exp_runecrafting); SET @num = 0; UPDATE `RSCEmulation`.`rscd_experience` SET `attack_rank` = @num := @num +1 WHERE `exp_attack` > 0 ORDER BY `exp_attack` DESC;
  2. Could you give me an example please?
  3. Doing queries like: DELETE FROM `RSCEmulation`.`rscd_bank` WHERE `owner` NOT IN (SELECT `id` FROM `RSCEmulation`.`users`); rscd_bank has 1,000,000 entries and users have 60,000 entries. Not sure how I can speed them up really. They're all indexed properly AFAIK. How can I sleep between each query to let the game have some time?
  4. I have a SQL file of about 80 queries that takes about 5 minutes to run, but my game server sometimes crashes due to SQL not responding whilst it's cycling through this. Is there anyway to sleep within each query to slow things down and allow the game server to have some queries?
  5. Anyone else know about sha1(md5())?
  6. Also, does anyone know of a good article explaining how password salts work and why it's a good idea to use them? If the salt is stored in the same row as the password I can't see how it makes it more secure?
  7. Anyone else?
  8. Is there anything wrong in doing this? I currently have 100,000+ users all with their passwords hashed in md5(). I want to secure it a bit by simply hashing all of their existing hashes to sha1() and then check their password matches the sha1(md5()). Is there any reason why I shouldn't do this?
  9. Thanks mate.
  10. I have a simple class like this: <?php class packet { private $SERVER = "192.168.1.100"; } ?> This works fine on localhost but on the server the $SERVER variable needs to be "72.20.32.58" instead. It's a pain having to keep changing this manually and using "localhost" doesn't work for some reason. I wanted to use $_SERVER['SERVER_ADDR'] but it errors when I use it. I have an issue with PHP/Apache which means I can't see the error that it returns. Can anyone tell me how I could set the $SERVER variable to $_SERVER['SERVER_ADDR'] in the class?
  11. Thanks mate. I just realised that using the 'Linux way' on Windows works fine too so I'll just use that from now on.
  12. I use my desktop (Windows) to make websites and then once it's completed transfer to my Linux server but I've come across a weird issue. On Windows the file location is like this: C:\Server\Apache\htdocs\RSCEmulation On Linux the file location is like this: /home/rscemulation/public_html Now in those folders I have a folder called 'include', in that I have 2 files: header.php, functions.php In the base folder I have index.php. I then include header.php by using: include "include/header.php"; Then I include functions.php (from header.php) by using: include "functions.php"; Now on Linux this chucks an error, even with "./functions.php" -- I have to use include "include/functions.php" even though I'm already in that directory from the file I'm calling it from, although admittedly the file is being included from the directory below but this works fine on Windows with a base PHP install. This Linux box was given to me and I'm not sure if any PHP settings have been changed or not. I also have a config.php that I keep below the public directory (htdocs or public_html) but it won't let me include it on the Linux server by using "../../config.php" (I've tried all levels ranging from 0-5 with no luck) Can anyone shed some light on this please? I need it to work the same both on the Windows and Linux boxes as I copy and paste the files regularly and it's annoying changing them! Cheers.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.