Jump to content

Kryptix

Members
  • Posts

    283
  • Joined

  • Last visited

    Never

Everything posted by Kryptix

  1. I had a big problem with this game I run where logging in would take forever as I had the Index wrong on a table (which I still don't understand). Now I'm having issues with saving, it's taking forever to save one player and when it loops through 200 players it's taking like 200 seconds to save which just isn't good and is messing a lot of things up. Could indexing be causing this? I really don't know what I'm doing regarding to indexes, could anyone have a look through my tables and help me out at all?
  2. Thank-you, I'll give that a go. I'm just using the bog standard PayPal buttons, web payments standard, I believe? I'll try that tonight but I'm still open to help if anyone fancies earning some money.
  3. It's not a big paid job though, I don't really need any code, I just need walking through it and I'm sure there's many people here who know it like the back of their hand.
  4. Change: <input name="submit" type="button" value="submit"/> To: <input name="submit" type="submit" value="submit"/>
  5. I've tried everything I know to try and get this to work but I'm still stuck. Is there anyone out there who could possibly help me over MSN/TeamViewer? It's really simple what I'm trying to do, user clicks a button on my site to pay a fixed payment of £4 and then they're redirected back. If it's confirmed that it's paid it edits the database. I just can't get the PayPal API to tell my script that it's successful. I can pay if anyone fancies helping me. :-\ Send me a PM if you're interested. I don't expect this for free as I really need a walk through.
  6. Just one. I've made it loop through 100,000 usernames and it encodes them all flawlessly, but if Apache has been running for a while (it varies) it randomly hangs. Sometimes it takes 3 days, other times it takes a few minutes. As I said, they work on other systems so I'm pretty sure it's a configuration problem but I don't have any idea where to start looking. I don't get how they can run perfectly 100,000 times in a row and then suddenly start timing out for no apparent reason.
  7. I have a really annoying problem, PHP just sits there until it times out if Apache has been running for a while. If you restart Apache it works absolutely fine! It's only when using the two functions before to encode/decode a username. I'm using the latest XAMPP on Windows Server 2003 although it also happens on my Windows XP box. function encode_username($username) { $username = strtolower($username); $clean = ''; for($i = 0;$i < strlen($username);$i++) { $c = ord($username{$i}); if($c >= 97 && $c <= 122) { $clean .= chr($c); } else if($c >= 48 && $c <= 57) { $clean .= chr($c); } else { $clean .= ' '; } } $clean = trim($clean); if(strlen($clean) > 12) { $clean = substr($clean, 0, 12); } $hash = '0'; for($i = 0;$i < strlen($clean);$i++) { $c = ord($clean{$i}); $hash = bcmul($hash, 37); if($c >= 97 && $c <= 122) { $hash = bcadd($hash, (1 + $c) - 97); } else if($c >= 48 && $c <= 57) { $hash = bcadd($hash, (27 + $c) - 48); } } return $hash; } function decode_username($hash) { if(!$hash) { return 'invalid_name'; } $username = ''; while($hash) { $i = bcmod($hash, 37); $hash = bcdiv($hash, 37); if($i == '0') { $username = ' '.$username; } else if($i < 27) { if(bcmod($hash, 37) == '0') { $username = chr(($i + 65) - 1).$username; } else { $username = chr(($i + 97) - 1).$username; } } else { $username = chr(($i + 48) - 27).$username; } } return $username; } Does anyone know what could be causing this? The exact code has been working fine on many other systems so it seems like a configuration problem. I really need to get this resolved but I'm baffled.
  8. Actually, ignore that, I no longer want to allow underscores. I'm just going to only allow spaces, letters and numbers now so I can simply trim() the entry thus getting rid of the spaces at the start and end. if (!preg_match('/^[\w\x20]+$/', trim($_GET['x']))) { echo "Invalid"; } else if (strlen(trim($_GET['x'])) < 3) { echo "Too short"; } else if (strlen(trim($_GET['x'])) > 11) { echo "Too long"; } else { echo "Valid"; } Can someone please give me the correct regex that I need? I simply removed the underscore in this one but it's still allowing underscores. Thanks a lot for your help.
  9. OK thanks a lot for your help. One last thing... How would I modify it so they can't use a space or a underscore at the start or the end of their name? _INVALID_ _INVALID INVALID_ VALID VAL_ID VaL_iD Va_L_i_D Invalid_ Inva!lid Inv"&lid Thank you very much for the time. I'm going to go and read up but if you could give me the exact regex needed it would help a LOT. Also, what's the 2-19 about? I need to allow any number, anywhere, as well as it's 0-9. Can you also define how long a name can be using this? If so, the max needs to be 11.
  10. Thanks, could you explain it to me please? It's like reading Greek!
  11. I need to validate form submission to check every character they have entered is a-z, A-Z, 0-9 and either a underscore or a space. How would I do this? Add every character to an array and then check or is there a better way?
  12. I still can't get it working the way I want. Could I possible upload `rscd_players` too so you can double check? It's just not right.
  13. I need to validate form submission to check every character they have entered is a-z, A-Z, 0-9 and either a underscore or a space. How would I do this? Add every character to an array and then check or is there a better way?
  14. The database corrupted a few months back and I haven't ever figured out how to delete the duplicates. I'd love to but not sure how. It doesn't seem to cause any problem but I guess it will in this query. Can I use DISTINCT() around `user` to prevent seeing the duplicates? If so, could you give me an example? Eep! You are right. I was copying the query from one I use that has to sum several values and i forgot to remove it. The corrected query should be: SET @num :=0; SELECT a.user, a.exp_attack AS Attack, @num := @num +1 AS Rank FROM `rscd_experience` a ORDER BY a.exp_attack DESC Yay, there we go! We finally got there! Thank-you both for your efforts, you've been a massive help. Now, this is the query I'm using: SET @num :=0; SELECT `rscd_players`.`user`, `username`, `exp_attack`, @num := @num +1 AS `rank` FROM `rscd_experience` JOIN `rscd_players` ON `rscd_players`.`user` = `rscd_experience`.`user` WHERE `username` = 'Kryptix' ORDER BY `exp_attack` DESC That puts Kryptix as #1 rank even though he's not. How would I get around that? I basically need to enter a players `username` and then have it display the results like: username | exp_attack | rank_attack | exp_strength | rank_strength | exp_defense | rank_defense Kryptix 13049472 37 58472947 1 1305 3957 How would I achieve those results?
  15. Same as you mate. Could you show me how to use the query you wrote in PHP? Is it all within the same query?
  16. Cheers for your help josborne but I still haven't got this working. when you paste the two queries into PhpMyAdmin does it show both of them being executed at the top?
  17. I'm making a little search script that simply does the following: SELECT * FROM `rscd_objects` WHERE `object` = '" . $db->escape(trim($_POST['object'])) . "' OR `x` = '" . $db->escape(trim($_POST['x'])) . "' OR `y` = '" . $db->escape(trim($_POST['y'])) I just searched for '999'9 in $_POST['object'] and got the following results: Can anyone explain why that's happening? I just want it to select the last entry.
  18. It only seems to run the first query, but if I can get it working in PHP I'm not really bothered. Do you just run it within the same query? Could you give me an example? How would I do a join from there? I need to JOIN `rscd_players` ON `rscd_players`.`user` = `rscd_experience`.`user` and then just SELECT `username`, `exp_attack` and `rank` I wish I could fix this PhpMyAdmin problem out. Thanks again for your on-going help.
  19. I have no experience with indexes which is why I posted the thread about them the other day. I'm quite new to this. Look at the screenshot I posted, it's ordered by exp_attack but rank seems random. It's not assigning the rank properly. The person with the highest exp_attack should be rank 1 and the person with the lowest exp_attack should be the lowest rank. For some reason PhpMyAdmin only seems to execute the bottom query when I run yours, but that doesn't explain fenway's method as that's a single query. I honestly don't know but I'd love to get this resolved, thank-you both for your continuing help. How do I run your queries as one on PhpMyAdmin? When I do it, it only shows the bottom one in the query executed.
  20. Thanks guys but it's still not right, the order of rank is wrong. Here's the table:http://86.7.138.3/RSCE/rscd_experience.sql.gz
  21. OK I'm using that query and I think that's where the problem is, PhpMyAdmin seems to only execute the bottom query (thus not setting the var), and I can't get fenway's query working. Do you know how I can run two at once or let PhpMyAdmin run them both? How would I do it on a actual query on a PHP page?
  22. #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@num := 0 ) b GROUP BY a.user ORDER BY a.exp_attack DESC LIMIT 0, 30' at line 2 Again though, will that assign them a rank depending on the order DESC of the exp_attack?
  23. Could I have it back please? I no longer have access to the e-mail but I use the alias xa0s everywhere. I presume the posts are long gone?
  24. CREATE TABLE `rscd_experience` ( `user` varchar(255) NOT NULL, `exp_attack` int(10) unsigned NOT NULL DEFAULT '0', `exp_defense` int(10) unsigned NOT NULL DEFAULT '0', `exp_strength` int(10) unsigned NOT NULL DEFAULT '0', `exp_hits` int(10) unsigned NOT NULL DEFAULT '1200', `exp_ranged` int(10) unsigned NOT NULL DEFAULT '0', `exp_prayer` int(10) unsigned NOT NULL DEFAULT '0', `exp_magic` int(10) unsigned NOT NULL DEFAULT '0', `exp_cooking` int(10) unsigned NOT NULL DEFAULT '0', `exp_woodcut` int(10) unsigned NOT NULL DEFAULT '0', `exp_fletching` int(10) unsigned NOT NULL DEFAULT '0', `exp_fishing` int(10) unsigned NOT NULL DEFAULT '0', `exp_firemaking` int(10) unsigned NOT NULL DEFAULT '0', `exp_crafting` int(10) unsigned NOT NULL DEFAULT '0', `exp_smithing` int(10) unsigned NOT NULL DEFAULT '0', `exp_mining` int(10) unsigned NOT NULL DEFAULT '0', `exp_herblaw` int(10) unsigned NOT NULL DEFAULT '0', `exp_agility` int(10) unsigned NOT NULL DEFAULT '0', `exp_thieving` int(10) unsigned NOT NULL DEFAULT '0', `exp_quest` int(10) unsigned NOT NULL DEFAULT '0', `id` int(10) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) USING BTREE, KEY `user` (`user`), KEY `user_3` (`user`), FULLTEXT KEY `user_2` (`user`) ) ENGINE=MyISAM AUTO_INCREMENT=9322 DEFAULT CHARSET=latin1 CREATE TABLE `rscd_players` ( `user` varchar(255) NOT NULL, `username` varchar(255) NOT NULL DEFAULT '', `group_id` int(10) DEFAULT '4', `owner` int(5) unsigned NOT NULL, `combat` int(10) DEFAULT '3', `skill_total` int(10) DEFAULT '3', `x` int(5) unsigned DEFAULT '213', `y` int(5) unsigned DEFAULT '452', `fatigue` int(10) DEFAULT '0', `combatstyle` tinyint(1) DEFAULT '0', `block_chat` tinyint(1) unsigned DEFAULT '0', `block_private` tinyint(1) unsigned DEFAULT '0', `block_trade` tinyint(1) unsigned DEFAULT '0', `block_duel` tinyint(1) unsigned DEFAULT '0', `block_global` tinyint(1) unsigned NOT NULL DEFAULT '1', `cameraauto` tinyint(1) unsigned DEFAULT '0', `onemouse` tinyint(1) unsigned DEFAULT '0', `soundoff` tinyint(1) unsigned DEFAULT '0', `showroof` tinyint(1) DEFAULT '0', `autoscreenshot` tinyint(1) DEFAULT '0', `combatwindow` tinyint(1) DEFAULT '0', `haircolour` int(5) unsigned DEFAULT '2', `topcolour` int(5) unsigned DEFAULT '8', `trousercolour` int(5) unsigned DEFAULT '14', `skincolour` int(5) unsigned DEFAULT '0', `headsprite` int(5) unsigned DEFAULT '1', `bodysprite` int(5) unsigned DEFAULT '2', `male` tinyint(1) unsigned DEFAULT '1', `skulled` int(10) unsigned DEFAULT '0', `pass` varchar(255) NOT NULL, `creation_date` int(10) unsigned NOT NULL DEFAULT '0', `creation_ip` varchar(15) NOT NULL DEFAULT '0.0.0.0', `login_date` int(10) unsigned DEFAULT '0', `login_ip` varchar(15) DEFAULT '0.0.0.0', `loggedin` tinyint(1) DEFAULT '0', `banned` tinyint(1) DEFAULT '0', `muted` tinyint(1) DEFAULT '0', `deaths` int(10) DEFAULT '0', `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `online` tinyint(1) unsigned zerofill DEFAULT '0', `kills` int(10) NOT NULL, `highscores` tinyint(1) NOT NULL DEFAULT '0', `clan` int(3) NOT NULL DEFAULT '0', `clan_confirmed` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `user` (`user`), KEY `user_3` (`user`), FULLTEXT KEY `user_2` (`user`) ) ENGINE=MyISAM AUTO_INCREMENT=8059 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC COMMENT='InnoDB free: 9216 kB'
  25. Thanks so much. I tried the first query but it doesn't put the rank in order. It just generates a rank randomly it seems (or when the entry was created). I need to join the table `rscd_players` ON `rscd_experience`.`user` = `rscd_players`.`user` too, and select `username`, `exp_attack` and `rank`. Could you show me how to do that? I feel that you're a lot closer than I was.
×
×
  • 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.