
Daniel0
Staff Alumni-
Posts
11,885 -
Joined
-
Last visited
Everything posted by Daniel0
-
You probably already know this, but that's not valid syntax.
-
Idealistic? They're not saying they'll block IE6. They're saying that they will stop supporting it. Basically they won't make any efforts trying to get things working (functionally and aesthetically). Basically, adamant and/or ignorant users who aren't upgrading are preventing them from using newer technologies. Dropping support for older browsers alleviates that. Note that they aren't only phasing out support for IE6, but also versions like FF2, Safari 2, Chrome 3, etc.
-
From my experience, a lot of form spam is done by humans and humans tend to pass CAPTCHAs. The only way of catching that is by manually verifying everything/everyone or applying a spam filter that uses various heuristics for determining whether or not it's spam. Machine learning is of course way more difficult than simply writing a CAPTCHA script. There are various services (e.g. akismet) you can use for this.
-
My combo is Firefox + Adblock Plus + Vimperator + Tree Style Tab (+ some other less significant stuff). Works well for me. I don't care what browser people use as long as they keep it reasonably upgraded. If they don't, they shouldn't expect that things will continue to work for them at least. I assume you mean the user agent string. See this: http://webaim.org/blog/user-agent-string-history/
-
http://developers.facebook.com/news.php?blog=1&story=358
-
Many of them are probably using some sort of CMS that's customized for their needs. Hell, even The White House is using Drupal.
-
You can integrate that with PHP Unix man pages as well to get the full documentation. pear channel-discover doc.php.net pear install doc.php.net/pman Now you should be able to access PHP documentation like pman strpos. Then it's just a matter of setting keywordprg to pman for PHP files in vim.
-
You haven't upgraded to Windows 7 unless the end result is that the operating system you're running is Windows 7.
-
More like this if it's a form you want to use. <?php $updateitems=array('test1/test1.txt','test1/test2.txt','test1/test3.txt','test1/test4.txt','test1/test5.txt'); echo '<form method="post" action="http://localhost:80/updatefileonelocalserver.php">'; foreach ($updateitems as $item) { echo '<input type="hidden" name="items[]" value="' . $item . '">'; } // etc. echo '</form>'; ?>
-
Pass an array using POST.
-
Use preg_replace_callback or use the /e modifier.
-
You're definitely doing something wrong if you need that many parameters!
-
What do you mean with "hide"?
-
How do you upgrade XP to Win7 by installing Linux?
-
How is it confusing that you need to include upper case letters?
-
This software is not written by PHP Freaks. Comments about the forum software should be directed to SMF over at http://www.simplemachines.org/
-
That's not true. Object destructors and shutdown functions will still run after a call to die() or exit(). daniel@daniel-laptop:~$ cat test.php <?php class Foo { public function __destruct() { echo 'Destruct: ' . __CLASS__ . PHP_EOL; } } function shutdown() { echo 'Shutdown: ' . __FUNCTION__ . PHP_EOL; } $foo = new Foo(); register_shutdown_function('shutdown'); die(); echo 'This will not be output.'; ?> daniel@daniel-laptop:~$ php test.php Shutdown: shutdown Destruct: Foo
-
It isn't needed. In fact it's discouraged as of PHP 5.
-
Untested. <?php $db = new PDO('mysql:host=localhost;dbname=test', 'user', 'password'); $string = 'my name is David'; $words = explode(' ', $string); $stmt = $db->prepare('INSERT INTO words (word) VALUES(?)'); foreach ($words as $word) { $stmt->execute(array($word)); } Or using PHP 5.3 and anonymous functions (still untested): <?php $db = new PDO('mysql:host=localhost;dbname=test', 'user', 'password'); $string = 'my name is David'; $stmt = $db->prepare('INSERT INTO words (word) VALUES(?)'); array_walk(function($word) use ($stmt) { $stmt->execute(array($word)); }, explode(' ', $string));
-
Well, say I'm at http://www.google.com/search?q=php+help (Google search results for "php help") and I follow a link to PHP Freaks. If I do echo $_SERVER['HTTP_REFERRER'];, I'll just get http://www.google.com/search?q=php+help back. Whether that's "enough" is up to yourself of course. Consider this example: <?php $ref = 'http://www.google.com/search?q=php+help&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:official&client=firefox-a'; $components = parse_url($ref); if (preg_match('#^(?:www\.)?google(\.[a-z]+){1,2}$#i', $components['host']) && $path == '/search') { parse_str($components['query'], $query); if (isset($query['q'])) { echo 'Google search query: ' . htmlentities($query['q']); } }
-
That could easily work. Just check if the referrer is from Google's result page.
-
Yes it will, the single quote is part of the SQL syntax, not part of PHP's syntax. The variable appears inside a PHP double quoted string, so it will be substituted with its value before it's given to mysql_query(). As for the problem, you can't do like foo.php?book_title=C++ because a + will be decoded as a space.
-
You would want to use md5_file() on $_FILES['file']['tmp_name'] instead. It needs a path to a file on the filesystem and it returns the MD5 hash of its contents. Either you can store MD5 hashes for files in a database and do a query to check if it already exists, or you can iterate through all the files in your upload directory, get their MD5 hash and compare it to the new one. A file can still be a duplicate even though it has a different name. On your computer, try to make file and then copy-paste it in the same folder with a different name. Do we agree it's a duplicate? One heuristic for checking whether a file is a duplicate or not can be comparing hashes of their contents, in this case using MD5.
-
Single quoted strings do not have variable interpolation.
-
No, we'll not help you break the law if that's what you're asking. Personally, I don't care whether you pirate things or not, but you won't get help doing it here. Check out Can You Run It? to check if your computer satisfies the system requirements for a particular game. It obviously doesn't contain all games, but it contains a lot. Otherwise, find the system requirements on the publisher's website and compare them to your own hardware. Generally, built-in graphic cards aren't really suited for playing games.