Jump to content

slyte33

Members
  • Posts

    137
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

slyte33's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Makes sense...logical answers here... so storing a list isn't really a good way of doing 'anything' if theres better ways?
  2. I wasn't sure how much space it'd take, thanks for the info. You're right, but what if I wanted to use this for say, checking which users read a forum thread. If new post in thread update the list of ids to blank VS having to delete 1,000s of rows in "users_who_havent_read_thread" table; would that be efficient. Heck, is the second way I listed efficient for anything
  3. I didn't know how to phrase the title correctly.. I'm creating a friends list for players in my game. I could easily create a table and have fields "players_id" and "friends_id". so my table "friends" could be friends players_id | friends_id ---------------------------- players_id = 1 | friends_id = 2 players_id = 1 | friends_id = 11 players_id = 1 | friends_id = 6 players_id = 1 | friends_id = 64 but with 1,000 players each having 100 friends, that's 100,000 rows. ..or i could do this: friends players_id | friends_id ---------------------------- players_id = 1 | friends_id = (2)(11)(6)(64) with this code: $get_friends= explode(')(', substr($player['friends_id'], 1, -1)); foreach($get_friends as $friend_list) { $list_ids_query=$db->execute("select * from players where pID='".$friend_list[0]."'"); $friends=$list_ids_query->fetchrow(); if ($friends['id']!=$_GET['friendID']){$add_friend=1;}else{$add_friend=0;} } if ($add_friend==1){ $update=$db->execute("update friends set friends_id= CONCAT( friends_id, '(".$_GET['friendID'].")')"); }else{ //is already friend } I'm just wondering if that saves space, works more efficiently and if I'm doing it correctly to begin with. Thanks EDIT: Accidentally posted thread without finishing if you didn't get the rest hitman6003
  4. I got it working using your method. I made a new table "has_read_chat" and had it JOIN the table with message_id in table "chat". It's working very nicely, thanks!
  5. But then I cannot update the database for each player that visit the chat room. I need it to update based on the players ID because if I don't it will update the database for every player instead :/
  6. I've spent 3 hours trying to achieve this and decided to come for help I have tried exploding to insert each ID then using if hasread!=in_array(players_id,hasread)..can't seem to get it working correctly. I have a chatroom with tabs to change the room including user private messaging.. my chat table looks like this: user_id message_id chatroom_id message time_sent user_has_read Let's say you're in the general chat..when sending a message it will insert as chatroom_id=1 private messaging chat_id's are mt_rand'd but all open rooms appear at the top of the chat. Tabs at the top display chat rooms name and how many new chat posts since you last visited the page, I.E. [General (0) *viewing now*] [Trade (2)] [slyte33(5)] So basically, I need to update the "user_has_read" field which each player's ID that entered that chatroom where players_id is not in the field. user_has_read could be displayed like this (1)(5)(3) (users with ID 1,5,3 entered chatroom, so all messages unread for those users now become read) Any help would be greatly appreciated!
  7. Try this if ($ip == $test1 || $ip == $test2)
  8. I have a textbox to enter your username on my game.. As you type, the text is replaced with a php imagecreate using a TTF font with css positioning it in the textbox. the text-indent is set to -9999. I need to know if this is a good approach to making my game look more professional.. go to http://foarpg.com/game.php and simply click "Register", begin typing in the textbox Also how can I stop, using PHP ofcourse, the textbox from acting as if a slash ( \ ) is two characters even with stripslashes being used? Max char length is 12, but 6 slashes acts as 12 O.O
  9. Try changing your last line to <?php } ?> just incase your server doesn't support short tags
  10. I managed to get the login working & returning the right results. All I need now is how to get that session c=#. I checked my cookies, there is no session with the same session I have. I don't think it's a cookie.. i think it's just a validator to make sure you can't change their links or something. If you change the key in anyway it'll return to login screen + reset the key, no going back.
  11. I am trying to make a username availability checker on my website for the game runescape to see if a username is in use or not. The link to get the result is https://secure.runescape.com/m=displaynames/c=tjl0oh6Ehhs/check_name.ws?displayname=name If you click it, you'll notice you can't access the page without being logged in first. I'm trying to use curl to log the account in + get the session key (c=tjl0oh6Ehhs) because it's needed for the name checker page. I can't seem to figure out how to do this..here's my code though. Notice I haven't attempted to store the session key because I can't even get it to login yet :\ <?php $username = 'username'; $password = 'password'; $feedUrl = 'https://secure.runescape.com/m=weblogin/loginform.ws?mod=www&ssl=1'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $feedUrl); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_TIMEOUT, 30 ); curl_setopt($curl, CURL_HTTP_VERSION_1_1, true); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, 'username='.$username.'&password='.$password.'&dest=title.ws&mod=www&ssl=0'); curl_setopt($curl, CURLOPT_ENCODING, "gzip, deflate"); curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); $feedContent = curl_exec ($curl); curl_close ($curl); ?>
  12. I'm clueless with java fairly good with PHP. How could i make this line an if else like you would with php listener.statusUpdated(i, "OK".equals(lines[0]) ? "AVAILABLE" : "NOT AVAILABLE"); Thanks
  13. Very smart..I've been trying to think of all kinds of ways to do this and you solved it that quick! Thank you!!
  14. So I'm making a game. The game has a village, you start at the center of the village. North,east,south and west of the village, for example, is "areas" you can travel to. These areas are stored in the database, with an INT as (travel_time). I need the travel time to be accurate based on where you're already at and where you plan to go. I've created a crappy example below..but it would better give an idea as to what I'm asking for: If you're in the center already, the travel time to "Battle2, Training1, Markets1 and Trading1 would all be the same. What if you are in "Training2" and want to travel to "Trading2". That would be a longer travel time. I'm not sure how to store these in the database to make a formula or something for travel time. This might be a little confusing, just ask me more questions if needed. Thank you for any help, it is much appreciated.
  15. Ok I did figure out a way to fetch the data and update the database with each players ID that viewed the new announcement. Now how would I check to see if 1 player's ID has been stored?
×
×
  • 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.