Jump to content

Daniel0

Staff Alumni
  • Posts

    11,885
  • Joined

  • Last visited

Everything posted by Daniel0

  1. I can't answer that as that person wasn't me, but I would guess trying to provoke an error to see if he could get information about how the site works.
  2. Right, you are actually calling it twice: $sql = "UPDATE postcode SET mailcount = mailcount + 1 WHERE postcodeID=$emailid"; mysql_query($sql) or trigger_error('<p>There seems to be a problem, please try again soon.</p>'); $result = mysql_query($sql); Of course it'll update twice when you call it twice.
  3. It depends on what you are going to use the value for. If it's to be used as XML/HTML/XHTML/CSV/SQL/JSON/YAML/MySQL/Oracle/etc., the way you'll sanitize it differs. Even if you say it's MySQL, PHP has three different ways of doing it: the mysql extension, the mysqli (MySQL improved) extension, and the PDO extension. Then within MySQLi/PDO you may choose to use prepared statements or escape things manually. A hashing algorithm and a salt will usually suffice. You could use something like sha256 with hash; that'll be stronger than e.g. md5(). The longer the salt the better as well.
  4. You're probably executing the query twice. Try posting the code.
  5. I think something like this should do it: function wordwrap2($text, $maxLength, $separator = '-') { $lines = explode("\n", $text); $linesNew = array(); foreach ($lines as $line) { $length = strlen($line); if ($length > $maxLength) { $start = substr($line, 0, $maxLength); if (strlen($start) != strlen(rtrim($start))) { $linesNew[] = rtrim($start); } else { $linesNew[] = $start . $separator; } $linesNew[] = wordwrap2(trim(substr($line, $maxLength)), $maxLength, $separator); } else { $linesNew[] = $line; } } return join("\n", $linesNew); }
  6. No, I didn't actually try to upload one. What kind of error do you get?
  7. at is a unix command. Like this: daniel@daniel-laptop:~$ at -h Usage: at [-V] [-q x] [-f file] [-mldbv] timespec ... at [-V] [-q x] [-f file] [-mldbv] -t time at -c job ... atq [-V] [-q x] atrm [-V] job ... batch
  8. Oh, I don't doubt you know how to spell your country's name. Just figured it was an unintentional typo or whatever. Not like it matters anyway.
  9. No, it says "austrailia"
  10. If you're going to use the command line, why not just use at like I already suggested?
  11. Yeah I just tried setting it to 10G. No problem.
  12. 'Foo said \'hi bar\'' preg_match_all('#\'((?:[^\'\\\\]|\\\\.)*)\'#', $string, $matches);
  13. Either $_GET, $_POST or $_COOKIE contains an array. Probably someone who tried to do stuff like ?foo[]=bar or whatever to see if he could generate an error. See this: php > var_dump(array_map('stripslashes', array(array()))); Notice: Array to string conversion in php shell code on line 1 Call Stack: 60.0963 115064 1. {main}() php shell code:0 60.0964 116000 2. array_map() php shell code:1 array(1) { [0]=> string(5) "Array" }
  14. What does php.ini and phpinfo() say? Maybe you're changing the wrong php.ini file. I've tried that before.
  15. We just use feedburner and let them figure it out for us. According to them we've got about 5000 subscribers on our main feed. It gives you all sorts of statistics.
  16. Okay, I just tested. This will work: <?php $bufferSize = 10; $file = 'test.txt'; $size = filesize($file); $fp = fopen($file, 'r'); $buffer = ''; for ($pos = $size - $bufferSize;; $pos -= $bufferSize) { $pos = max(0, $pos); fseek($fp, $pos); $b = rtrim(fread($fp, $bufferSize)); $nlPos = strrpos($b, "\n"); if ($nlPos !== false) { $buffer = substr($b, $nlPos) . $buffer; break; } else { $buffer = $b . $buffer; } if ($pos == 0) { break; } } $lastLine = trim($buffer);
  17. I suppose you could do something like this. It will search backwards for a newline. It isn't tested. <?php $bufferSize = 10; $file = 'file.txt'; $size = filesize($file); $fp = fopen($file, 'a'); $buffer = ''; for ($pos = $size - $bufferSize;; $pos -= $bufferSize) { $pos = max(0, $pos); fseek($fp, $pos2); $b = fread($fp, $bufferSize); $nlPos = strrpos($b, "\n"); if ($nlPos !== false) { $buffer = substr($b, $nlPos) . $buffer; break; } else { $buffer = $b . $buffer; } if ($pos == 0) { break; } } $lastLine = trim($buffer); You don't know how many lines there are before you've read the entire string.
  18. You can't do that unless the exact line length is deterministic.
  19. It would seem so: http://www.phpfreaks.com/forums/index.php/topic,276596.0.html
  20. I'd say it depends on what you're going to use it for. If it's for displaying on e.g. your website, I think it's perfectly legitimate making it span over many pages. If you're applying for a job that isn't listed anywhere, I don't think size matters so much either. Of course still while omitting irrelevant shit like "When I was 10 years old I mowed my neighbor's lawn every Saturday".
  21. Yeah but as far as I remember, it only supports IE7 and IE8 rendering mode. No IE6.
  22. Won't work if the user leaves the page before a minute has passed.
  23. You can use at on Linux. It's essentially a one-time cronjob.
  24. Remind me not to sign up on any web site you created.
  25. No, but you can on Linux/BSD. Simply don't start X when booting, so just remove it from /etc/init.d or wherever your boot scripts are.
×
×
  • 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.