Jump to content
MakeWebGames

Coly010

Members
  • Posts

    912
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by Coly010

  1. Coly010

    Securing $_POST

    As my question is somewhat related I thought it would be better to append it to this question. If I have a textarea or input box where a user enters text or a message, how can I have it where I can secure the $_POST['message'] whilst allowing my users to put say apostrophes (single quote) or even a double quote into the message? Is there a function that I can use, because when I test it with stripslases() and htmlentities() it wont insert the value into the database.
  2. oh right, ok, makes more sense now.
  3. Ok, so I've gone the OOP approach to connecting to my mysql database, and thus my variable is $db. now my problem is that when I try to run this code $sql = $db->query("SELECT * FROM users WHERE (username = '$username' & password = '$epassword')"); $nr = $db->num_rows($sql);   i get this error : Fatal error: Call to undefined method mysqli::num_rows() in C:\xampp\htdocs\chat\au.php on line 16 I do not know what what is wrong with how I called the method, can anyone point it out? I'd be really appreciative. Thanks :)
  4. @HauntedDawg worked a charm, thanks :)
  5. Thanks :) i'll try that now and get back to you on whether it works :)
  6. Thanks :), got it sorted now. But now I have another problem, unrelated to the table in the original post I want to pull the bottom most rows from the mysql database with a limit on it. now I know that I do this with ORDER BY DESC LIMIT 20 but after that if i was to echo them to the screen it would be in descending order from the database. How would i go about echoing them in reverse order from how they were taking from the database?
  7. Sniko, I thought i might have had that problem, so I set it up so that for everytime someone adds a friend, it puts two entries into the table. I know i do not have to do this, but at the time when i created it i did not know how to check both ways, now however i might go back and change it all. Thanks to both of you for the answers :) it helps a lot
  8. Ok, so I have a table in my database called friends. It has three columns. f_id, u1_id, u2_id. f_id is simply the primary key, etc. u1_id is the userid of one of the users u2_id is the userid of the other user. This entry links these two users together as friends. simple as. now say someone has fifty friends. that means there will be 50 entries, with his/her userid as the u1_id. Now my problem. I have a php file with a GET function that gets the id of the friend that the user has clicked on. essentially the user will click on the link that appears from this: $q = mysqli_query($c, "SELECT u2_id FROM friends WHERE u1_id = '$userid'"); $q2 = mysqli_num_rows($q); while($q3 = mysqli_fetch_array($q)) { $f_id = $q3['u2_id']; $fs = mysqli_query($c, "SELECT * FROM users WHERE userid = $f_id"); $fr = mysqli_fetch_array($fs); if( $fr['online'] == 1 ) { echo "<img src='img/online.png' width='16' height='16' /> <a href=\"chat.php?fid={$fr['userid']}\">" . $fr['username'] . "</a><br />"; } }   now we all know that the GET can be faked, anyone can enter any value they like into the url and have it processed. So what i want to be able to do in the chat.php file is have a way to check that the two people really are friends. How would i go about doing it. For example i cannot have $f_id = abs((int)$_GET[fid']); $q = mysqli_query($c, "SELECT * FROM friends WHERE u1_id = '$userid'"); $q2 = mysqli_num_rows($q); while($q3 = mysqli_fetch_array($q)) { if( $fid != $q3['u2_id']) { echo "you cannot talk to someone who does not know you"; } }   in the hope that it finds one person out of fifty, because it could end up echoing 49 "you cannot talk to someone who does not know you" before finding that one person. Any help would be extremely appreciated.
  9. Thanks, worked perfectly. Have another problem now though. If i want to put a different set of results, which do not have a limit on them, into a table which has four columns, how can I code it so that after every 4 it will take a new row?
  10. Ok, so I'm trying to save myself a bit of time, whilst adding a feature into my site. I have a mysqli_query(); get an array of results ordered in descending order by the visits column. $r = mysqli_query($c, "SELECT * FROM games ORDER BY visits DESC"); $r2= mysqli_fetch_array($r2);   ok, now I only want the first 5 results and want to be able to place their id into a link like: <a href='game.php?id={$r2['id']}'>Link</a> and i only want the first 5, so im thinking i have to loop through them. Now i dont know how to do this. I'm thinking : for ( $i = 0; $i <= 5; $i++ ) { echo '<a href="game.php?id={$r2[\'id\']}'; }   now when i do this it only repeats one of them, it doesn't lit through them. Any ideas?
  11. Yeah it is, i think i should look at more pictures of islands for next time
  12. It is the output of that, although from memory so there is more than likely variations. And thanks for the advice, I'll take that into account for the next time I do one.
  13. Ok, so I made this on Blender, rendered with the built in Blender Render Engine, and would love some feedback. [ATTACH=CONFIG]922[/ATTACH]
  14. Thanks a_bertrand. I couldn't understand the code in for that game as it was very very disorganized but it did help me create a theory from which I googled multiple aspects of java coding and was then able to somewhat succesfully use it to tile a background. Thanks - Coly010
  15. Very nice Mod, great being able to change the chances of different outcomes! I'll more than likely end up using it Thanks
  16. I'm currently working on a 2D RPG using java, however I have hit what you could call a slight problem. To create my Map, I'm going to tile together different 32 * 32 images. At the moment I'm using an Array (int[] ) which stores different numbers to represent different tiles. Then I'm using a Loop to loop through the array. Something like: for (int i = 0; i < Map.Map1.length; i++) for (int j=1; I < Map.Map1.length; j++) { // Tiling Code Here }   There are two problems : the j integer is supposed to represent the y size of the array and the i to be x value. However the .length part simply gives the full length I assume and ignores x / y positions. And the next problem is how to position the tile(image) according to the number returned from the Array. Thanks for any help given! - Coly010
  17. Great Thread, great timing too as I'm starting a biggish project :P thanks
  18. Ok, Thanks. I'll Defragment it or whatever you call it and do a general disk cleanup.
  19. Yeah I have a slightly less powerful PC. Well, actually its my Dad's as its his website I have hosted on one.com so I just make the changes to his website on his computer. I don't know off the top of my head what the RAM / CPU is however if One.com is using more then I'm guessing its a problem with the website and not actually IE. Thanks for researching into it ROZ - Coly010
  20. I don't know if IE has a high CPU issue but when I use it, even on its own, it ends up freezing my computer, multiple times. And as for One.com not making their File System Cross-Compatible is a complete joke. As you know ROZ I'm attempting to improve my design skills, and if I was to program one of those templates, I'd need to make it Cross Compatible with variety of browsers. Is that not like one of the first things you need to consider when designing websites? And just so you all know, if you try to use Chrome or Ff it simply comes up that this FileSystem needs to be run in IE. - Coly010
  21. Yeah, thanks for the comments! I have the settings of IE at default and I always use Chrome however, to use the filemanager on One.com you need to use IE 6 and above. It happens with other sites too, I checked to make sure if it was just one.com but I think it might have to do with opening a few too many tabs/windows which carry the same session id. As for why I use Chrome : It Loads the homepage quickly while IE is attempting to cause your CPU to meltdown trying to decide whether to load the homepage or just to crash, whilst showing very unhelpful dialogue boxes saying " To speed up browsing, disable add-ons" when I have no add-ons activated Except for Mcafee which runs perfectly quickly on FF and Chrome :L Thanks anyway, - Coly010
  22. Recently, and this has happened a lot, when I've been using the hosting services on one.com, especially when I'm using the File Manager, IE just closes down all the IE windows and tabs that are open, with no apparent reason. This is most annoying especially when I'm trying to fix a bug and decide to simply fix it through the online text editor. I lose all changes I have made and twice I've lost the contents of full files because IE just simply closed everything. The Version of IE is : IE 9 Has anyone else experienced this problem and if they have, do you have a solution? Thanks - Coly010
  23. Thanks everybody for the advice!! It really helps, I'll continue to practice and improve my skills before posting again. - Coly010
  24. Ok, again thank you for the advice
  25. I took the advice from rulerofzu and DreamCoder and decided to look at some Photoshop Tutorials. I have now designed another login No Longer For Sale It is intended to be a Simple Login. Name : Abstract Login It is a PSD. The image is in the attachments. It has been watermarked for obvious reasons.   - Coly010
×
×
  • Create New...