Jump to content


  • Posts

  • Joined

  • Last visited


Everything posted by genericnumber1

  1. You should try setting... output_buffering = Off and using sleep (so you can see the delay). That should hopefully do it. Edit: For setting the directive just for the one file, you would have to do it in .htaccess. The ini_set function can not modify output_buffering.
  2. You might check your PHP.ini for the output_buffering setting. Make sure that is disabled. Also make sure you're not using any other output buffers (ob_start(), etc) Edit: Also, did you define wait() elsewhere or did you mean sleep?
  3. ~ reverses all bits. So 0 in 8 bits is... 00000000 (binary) or 0x00 (hex) and ~0 is the reverse of that, which is... 11111111 (binary) or 0xff (hex) this number, 0xff, is -1 in binary. To find out why negative numbers are represented in this way (why is -1 0xff and not 10000001//0x81?) you can read up on two's complement. The main reason for this binary representation comes down to making it much easier to represent negative numbers at a lower level. Eg, subtraction is simply addition of a negative number, addition of negative numbers can be done without special cases in the same circuitry as addition of positive numbers, etc.
  4. If you want to set how many decimals you want and then just go from there, you can easily just calculate a random integer and shift the decimal over. Eg. A pseudo-random floating point number between 1-1000 with 3 decimals could just be mt_rand(1*10^3, 1000*10^3)/10^3 (note: not integer division). In their method rang is probably the range of points (max - min). min is the lowest number, and RAND_MAX I would assume is a constant whose value is the same as mt_getrandmax.
  5. Dont' have quotes around it. WHERE $searchtype LIKE
  6. When echoing something, PHP will never be executed (unless you use eval, but that would just be silly!). To avoid XSS problems with HTML and CSS, just use the htmlentities or htmlspecialchars functions on any input you don't trust (hopefully all input). Edit: Grammar!
  7. Well I don't know what it is you have exactly. If it's just in a php file, check the encoding of that file. If it's in a database, check the encoding of the database table.
  8. Also be sure you're setting the content-type header of the email to text/html.
  9. http://www.phpfreaks.com/forums/index.php/topic,95426.0.html
  10. Try encoding whatever it is in Unicode.
  11. It shouldn't be too much worry, just use mysql_real_escape_string or a comparable method for your DB (or prepared statements) and you should be fine. If you're asking what encoding your database table should be in, I'm always fond of Unicode, but any regular latin encoding should work just fine.
  12. This is always a hard question to solve when people's mail() function isn't working. It can fall under many categories including, but not limited to, server misconfiguration (it just doesn't send), ISP limitations (can only send in certain ways allowed by ISP) and spam filtration (email was sent, but was, for some reason, blocked). I've no idea what your problem is, but hopefully I've given you some more ideas, or perhaps annoyances, when it comes to worrying about why it's not working. Sorry I can't help out more, but I've never been good at troubleshooting these mail() issues.
  13. Nearly anything that can be done server-side is doable with php as it is turing complete, including tournament systems. We can help you figure out how to make it if you work to make it yourself and ask small questions as you go (things like "how do I do it?" are unlikely to be answered). If you feel like asking someone to make it for you, hop on over to the freelance forums to ask for someone to help you there. I'd refrain from going into too much troubleshooting over PMs as it takes away from the general knowledge available and because it is against the rules (for the before mentioned reason), not that you would get in trouble for it.
  14. I'm not sure I understand your question, could you put it in question form and add some more detail?
  15. Well you can also do that. There are probably an infinite number of ways you can implement access control; I was merely pointing out the method most used in large systems.
  16. For your example, combined with premiso's, you could retrieve the information like this... SELECT * FROM table1 INNER JOIN table2 ON table1.id = table2.personid WHERE table1.age = 18 That SHOULD give you results you expect after you've renamed the table names. It's been a while since I've had to work with SQL (embarrassingly enough), so my knowledge of these things could be a bit rusty, but you get the general idea - joins are your friend.
  17. You can do it with 1, 2, 20, 42, tables if you'd like. That's just how the tutorial creator decided to do it. That said, I honestly can't see why he is using two tables either. It seems like he's creating a table to have just one row, because if there is more than one row that is retrieved, it will only take the last one anyway. Perhaps he meant to create a way to have multiple feeds, but got lazy halfway through? I'd find a different tutorial... but that's just me.
  18. Most things with specific permissions deals with something call ACL (Access control lists), but are a fairly complicated topic when you get to the lowest level of it. The data structures typically deal with integers representing permissions and utilizing bitmasks to check these permissions. Unfortunately, since you're new, which is no big deal since we all were just starting out at some point, it would probably be pretty scary. If you really want to look into how real systems do it, or if you're feeling adventurous, you can google "Access control list" or "ACL". You could also check out Zend Framework's ACL class: http://framework.zend.com/manual/en/zend.acl.html . edit: broken link, silly period.
  19. Try something like... <?php $uniqueItems[(string)$items[$i]->ItemAttributes->Title] = &$items[$i]; ?> It won't work if it's not a final node though.
  20. What is the type of $xml->Items->Item->ItemAttributes->Title? I assumed it was just a string. If it's an array or another object, you'll need to use a different method.
  21. While I'd probably do it in a multidimensional array, if you insist on using two separate arrays.. Edit: Looks like you didn't want a solution, just a starting point. Look into explode and trim. A solution: <?php $itemStr = '[Trees][300][boxes][4000][Gizmos][3]'; $items = array(); $quantity = array(); $itemList = trim($itemStr, '[]'); $itemList = explode('][', $itemList); for($i = 0; $i < count($list); $i += 2) { $items = $itemList[$i]; $quantity = $itemList[$i+1]; } ?>
  22. You could just rely on the usual override mechanics of an array and recreate the array with unique values... <?php $xml = simplexml_load_string($response); $items = &$xml->Items->Item; $uniqueItems = array(); for($i = count($items)-1; $i >= 0; --$i) { $uniqueItems[$items[$i]->ItemAttributes->Title] = &$items[$i]; } foreach($uniqueItems as $item) { $title = $item->ItemAttibutes->Title; // ... } ?>
  23. If you're passing a password, you should be using POST. You don't want someone's password popping up in the URL! That said, if you were to stick with using GET (you shouldn't), you can use $_GET['E'] to retrieve name@email.com, the %40 is just the url encoding of the @ symbol.
  24. After you do a header redirect you need to tell the script to die(), or execution will continue as normal. I'm not up to the task of digging through your code to tell if this is exactly what the problem is, but a quick glance says it could be, so I figured it worth mentioning.
  • 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.