Jump to content
MakeWebGames

fbiss

Members
  • Posts

    148
  • Joined

  • Last visited

Everything posted by fbiss

  1.   This can also be done without having a second table. Just include a column that holds a Boolean value and if its 1 then the players pull it in their query. The if they "delete" it, it just updates the value to 0. This would allow staff to still see it.
  2. Hi Alex, I was doing a google search today and came across your review.   I truly appreciate that you took the time and effort to write a honest unsolicited review of my game. It deffinitely helps me to visulize what a new player coming to the game would experience. I like your writting style and you do well to explain the overall structure of the game. Keep up the great work! :thumbsup:
  3. I know i personally move threads that I see that are in the wrong category and i do this quite frequently. If members of the forum are annoyed by certain users constantly posting topics to the wrong category, imagine how staff feels having to keep moving their posts. Even if you send them a polite private message to make sure they are posting to the right category, some continue to do so.
  4. Generally speaking, there is a lot of players that will take mods and use them how they arent supposed to be used. 1. What if someone more wealthy in the game decideds to just spam someones mailbox so that they can no longer receive mails. 2. Players should always be able to receive mails from staff no matter what their limit.
  5.   if the stats are running into the billions , then the issue is with the (int) which has a limit of 2,147,483,647
  6. fbiss

    Auctions

    I didnt say that it was the best, i said it wasnt that bad. My $ir query has 9 joins and only takes 0.001 second. What i was saying is, if you have 100 auctions, you are going to be making a ton of queries to the datebase, everytime every users goes to a new page. I pitty your mysql servers.
  7. fbiss

    Auctions

    $ir isn’t that bad if properly indexed. With this modification, even with 100 current auctions, you will get. 1 Select query that pulls 100 rows of data, and then 100 Select queries after that (in the while loop). If you are using the players to replace the use of a cron, you could at least Join the data from both tables into 1 Select statement, use a timestamp condition to limit the query to only needed rows, and index all fields that are used in the join and where statements.
  8. fbiss

    Auctions

    I'm suprised that nobody has mentioned this yet... This modification looks horribly inefficent with every user pulling the information for every auction every page refresh... 8| :wacko:
  9. fbiss

    YQL

    I haven't used it yet, but read this article last week http://net.tutsplus.com/tutorials/other/an-api-for-the-web-learning-yql/
  10. fbiss

    header help

    code looks fine. make sure your getip() function is secure.
  11. no.. now if u were using that session to save something back into the database or file system.. then yea maybe.
  12. my above post was fixed, this should work for you.
  13. thats going to make it never use the Session Try this   if (empty($_SESSION['topgangs'])) { $_SESSION['topgangs']=''; $fivgz=$db->query("SELECT gangNAME, gangID FROM gangs ORDER BY gangRESPECT DESC LIMIT 3"); while($r=$db->fetch_row($fivgz)) { $_SESSION['topgangs'].= "[size="1"]<a href='gangs.php?action=view&ID={$r['gangID']}'>{$r['gangNAME']}<a>[/size] "; } } echo $_SESSION['topgangs'];
  14. change $SESSION['uGANG'] to $_SESSION['uGANG'] at the end   you may want to consider reading up on file caching instead
  15. Heres my function, for v2   function get_gymranks() { global $row, $userid, $db; $ts = $row['strength'] + $row['agility'] + $row['guard'] + $row['IQ'] + $row['labour']; $q = $db->query("SELECT (SELECT COUNT(u.userid) FROM userstats us LEFT JOIN users u ON (u.userid = us.userid) WHERE strength > '{$row['strength']}' AND (u.user_level > 0) AND (u.userid <> $userid)) as strength_rank, (SELECT COUNT(u.userid) FROM userstats us LEFT JOIN users u ON (u.userid = us.userid) WHERE guard > '{$row['guard']}' AND (u.user_level > 0) AND (u.userid <> $userid)) as guard_rank, (SELECT COUNT(u.userid) FROM userstats us LEFT JOIN users u ON (u.userid = us.userid) WHERE agility > '{$row['agility']}' AND (u.user_level > 0) AND (u.userid <> $userid)) as agility_rank, (SELECT COUNT(u.userid) FROM userstats us LEFT JOIN users u ON (u.userid = us.userid) WHERE IQ > '{$row['IQ']}' AND (u.user_level > 0) AND (u.userid <> $userid)) as IQ_rank, (SELECT COUNT(u.userid) FROM userstats us LEFT JOIN users u ON (u.userid = us.userid) WHERE labour > '{$row['labour']}' AND (u.user_level > 0) AND (u.userid <> $userid)) as labour_rank, (SELECT COUNT(u.userid) FROM userstats us LEFT JOIN users u ON (u.userid = us.userid) WHERE strength+agility+guard+IQ+labour > $ts ) as total_rank"); $r = $db->fetch_row($q); $ranks = array('strength' => $r['strength_rank']+1, 'guard' => $r['guard_rank']+1, 'agility' => $r['agility_rank']+1, 'IQ' => $r['IQ_rank']+1, 'labour' => $r['labour_rank']+1, 'total' => $r['total_rank']+1, ); return $ranks; }   now before display of the ranks i have if(!$_SESSION['granks'] || $_SESSION['granktime'] < time()) { $_SESSION['granks'] = get_gymranks(); $_SESSION['granktime'] = time()+60; } $row['ranks'] = $_SESSION['granks'];   now you can use $row['ranks']['strength'] $row['ranks']['agility'] etc.. depending on your code, you may need to change all the $row to $ir
  16. fbiss

    Query

    Lithium, Wouldn't you need a condition on your statement if its false? [mysql] UPDATE users SET energy = IF(test1 > 0, maxenergy, energy), will = IF(test2 > 0, maxwill, will) WHERE userid=$userid [/mysql]
  17. Hey chaoswar4u What I do, is the gym page creates two $_SESSION variables, one to hold the last updated time, and one to hold an array of the users personal ranks. when you work out , it checks to see if the current time minus 60 seconds is greater then the session time variable. If it is, then it pulls the ranks , stores the new ranks in the session ranks variable , and updates the session time variable with the current time.
  18. Actually i might be wrong "The time limit has expired yet please wait some more time" Do you mean "hasnt" if so, you need to invert the < to a > when db_time is set, is it set to current time or a future time stamp?
  19. for 6 hours, you need to calculate 60 seconds x 60 mins x 6 hours = 21600 seconds So you want to find out if its been been longer then current time (unix_timestamp) minus 21600 seconds.   $q=$db->query("SELECT * FROM drugs_bank WHERE db_time < unix_timestamp() - 21600 WHERE userid = $userid"); if(mysql_num_rows($q) == 0) { echo"The time limit has expired yet please wait some more time"; }
  20. It is not a good idea to store any passwords as plain text period. Your own encryption/decryption method is better but still not that great of an idea. If a hacker gets into your server/control panel , he can read the source code and copy the decryption method. IMO, 1 way hashing is the best way to go. For even stronger security, I would suggest using something unique yet reproducible as the Salt for the hash. As an example you could take the login name(since this doesnt change) , concatenate the password to it and concatenate a long strong of characters(same for everyone). This salt would prodcue a hash that even if two users have the same password, they would have different hashes.
  21. Will you be posting the code for this? if not this is in the wrong category
  22. I think you need to reconsider your table structures. unless someone else chimes in, I dont know of any effecient way to left join a table to multiple columns like that. If i were you, i would rebuild your code setup to something like these 3 tables. This way it will more like the item/inventory tables. [mysql]-- Table structure for table `drugs_streets` -- CREATE TABLE IF NOT EXISTS `drugs_streets` ( `streetid` int(11) NOT NULL AUTO_INCREMENT, `location` int(11) NOT NULL, `drugid` int(11) NOT NULL, `defaultprice` int(11) NOT NULL, `buy` int(11) NOT NULL, `sell` int(11) NOT NULL, PRIMARY KEY (`streetid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=67 ; --[/mysql] I have changed `drug` to `drugid` in this table and made it an int, you will relate the number here to match the `drugid` in table drugs_drugs ---------------------------------------------------- [mysql]-- Table structure for table `drugs_drugs` -- CREATE TABLE IF NOT EXISTS `drugs_drugs` ( `drugid` int(11) NOT NULL AUTO_INCREMENT, `drugtype` varchar(255) NOT NULL default '', PRIMARY KEY (`drugid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; --[/mysql] add a row for each type of drug (cocaine, heroin, weed, etc) ---------------------------------------------------- [mysql]-- Table structure for table `drugs_inv` -- CREATE TABLE IF NOT EXISTS `drugs_inv` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userid` int(11) NOT NULL, `drugid` int(11) NOT NULL, `qty` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; --[/mysql]
  23. can you export the table structures for the two tables and add them here?
  24. $_GET['amount']   is empty, there is nothing in the form to set amount also, you have this line   $amount = abs((int) $_GET['amount']);   And you dont even use $amount in the queries. Either change the query or replace that line with   $_GET['amount'] = abs((int) $_GET['amount']);
  25. scott94, i removed your DB username from your post. That would make you more vulnerable to hacks.
×
×
  • Create New...