Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. @ProjectFear: yeah probably. For some reason I interpreted the OP to mean "You can pick up to 5 but no more." @rn14: in the else {..} use a header to redirect back to the form.
  2. You mean like this? if (count($_POST['meal']) > 5)) { // too many }
  3. It's more secure... but I mean, better security for a switch comes into play because it doesn't echo out packets to all the ports. But we're talking about an xbox and a personal computer at home... but it is technically harder to setup. He has to set his computer up as the gateway and have at least 2 network adapters, 1 for the internet and one for the switch. Also with a switch, you can really only have one device using the internet at a time, because all of the devices share the same IP address. You would have to basically get your ISP to give you multiple IP addresses and go from there. A router acts as the gateway, routing packets to multiple devices even with just one IP address. Not to mention, most routers these days already have a switch built-in. Bottom line is that if you're wanting to make a local area network (lan) ONLY, go for a switch. Example is if you want to give printer access to multiple computers. You can also use a hub for this. But if you're wanting multiple devices to independently access a wide area network (wan) like the internet, go for a router.
  4. based on his description of what he was trying to do and what he did to fix it, I think he really did buy a switch.
  5. Oh. Well then use the code you already posted: $filename="words.txt"; $words=file($filename); shuffle($words); $word=$words[0]; echo $word; file will take all the lines in words.txt and put them into an array, so if there's 4 lines with item1 in your file, it will be in the array 4 times. Then you just shuffle it and pick one. Now, you did say this: That will be hard, if not altogether impossible to accomplish. What if you have like 10 item1's and 2 item2's and 1 item3's? I have no idea what your data range/occurrence is/will be but that's something you also need to explain or at least consider.
  6. $list = file("words.txt"); sort($list); $counts = array_count_values($list); $list = array_unique($list); $list = array_values($list); foreach($list as $key => $val) { $list[$key] = "$val|{$counts[$val]}"; } echo "<pre>"; print_r($list); echo "</pre>";
  7. Or you could store the value in a session var and check the posted var against that, and wrap the query itself in a if(!$_POST) { ...}
  8. Well, it would still sort of be the same principle. You'd have a column in your user account table called numLogins or something and inc it every successful login. Then in your login script, check what number it's at. if it's >=5, don't let them login. Send them to some page saying they logged in 5 times already, or whatever. If you are not wanting to login in anymore whatsoever (like, not even creating a new account)...well, there's no way to 100% prevent them, but you can log their ip address and check for it when registering. But again, there's no way to 100% prevent them from getting around that.
  9. damn ted, you sure do have a lot of regex questions. maybe you should just buck up and read a regex tutorial or two.
  10. I would setup a table that records every time there's a failed login attempt. It would contain columns for ip address, username, time, etc... and in the login script, before selecting where username&&password, check to see how many that ip address has tried to login or how many login attempts were made with that username or both. Could have a cronjob that removes entries after x amount of time or set it up to where user has to contact someone through a form or whatever. Really depends on how robust you want to make it.
  11. I believe your problem is that it selects a random question every time you load the page. So for example, when you first go to the page it selects for instance question 2 but when you hit the submit button and the page reloads, your script turns around and selects another random question/answer and then compares the posted var to it.
  12. Please do not make multiple threads asking the same question. I'm closing this thread because you made this one second, and the first one you actually showed some info.
  13. $updateqa = "UPDATE question SET question='$pquestion', answer='$panswer' where id=1"; Need to change your other ones too.
  14. you should have bought a router, not a switch.
  15. http://www.phpfreaks.com/tutorial/php-basic-database-handling
  16. well if vars echo out correct then perhaps those functions are not evaluating as expected. When I asked where they were, I meant I don't see them anywhere (you did not post them), so I can't see if they are evaluating correctly....what do you mean by this? Are you saying they don't exist? You can't just call functions that don't exist. edit: well okay I see user_exists() but not the other ones.
  17. if (!isset($_POST['submit'])){ remove the ! you're telling it to update it if it's NOT set (as in, you haven't clicked submit yet).
  18. $update = mysql_query("UPDATE `exp` SET `strength` = $replace1, `magic` = $replace2, `skill` = $replace3 WHERE `ID` = '1' ");
  19. do you have cpanel or something equivelent? go to your error log, what does it say?
  20. Did you echo out your posted vars to see if they contain what you expect? if (valid_username($username) || valid_password($password) ||valid_email($email) || $password = $password2 || user_exists($username)) Where is valid_username(), valid_password(), valid_email() and user_exists? Also this should be $password == $password2
  21. function('http://www.example.com/delete_a.asp?ID=' . $matches[1],'','','off');
  22. preg_match("/REF=(\d+)\"/",$string,$matches); echo $matches[1];
  23. well you posted a certain string regex is based off that specific string. Anyways, ddrudik's regex should work for you regardless. Look at his array dump.
  24. "/\((.*):/"
  25. sprintf
×
×
  • 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.