Daniel0
Staff Alumni-
Posts
11,885 -
Joined
-
Last visited
Everything posted by Daniel0
-
I've just got the one on my laptop.
-
Or they'll just click the "blue E" aka "The Internet".
-
How to block unknown robots with mod_rewrite?
Daniel0 replied to longtone's topic in Apache HTTP Server
You would do something like this: RewriteCond %{HTTP_USER_AGENT} ^bot* [NC] RewriteRule .* - [F,L] The NC makes it case insensitive, the F means it'll give a 403 Forbidden response code and the L means the mod_rewrite chain stops on a successful match. -
PHP_EOL is just a built-in constant holding the end of line character sequence for the operating system PHP is currently running on. You can replace it with anything else of course. Also, I fixed up your bbcode quote in your post.
-
In total, try making it this (in this order): RewriteRule ^search/?$ /search.php [L,NC] RewriteRule ^search/(.*)\.html$ /search.php?q=$1 [L,NC,QSA] RewriteRule ^search/(.*)\.html,([0-9]+) /search.php?q=$1&pagenum=$2 [L,NC] RewriteCond %{QUERY_STRING} q=([^&]+) RewriteRule ^search.php$ /search/%1.html [R,L]
-
Can't you just lower the expiration time to one day only?
-
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('/path/to/something')); foreach ($iterator as $item) { if ($iterator->isDot()) continue; echo $item->getPathname() . PHP_EOL; }
-
You cannot do that. RewriteRule doesn't match against the query string, but only the path. RewriteCond %{QUERY_STRING} q=([^&]+) RewriteRule ^search.php$ /search/%1.html [R] Likewise untested. Also, your existing rewrites could be written like this instead: RewriteRule ^search/?$ /search.php [L,NC] RewriteRule ^search/(.*)\.html$ /search.php?q=$1 [L,NC,QSA] RewriteRule ^search/(.*)\.html,([0-9]+) /search.php?q=$1&pagenum=$2 [L,NC]
-
Any of you tried the new Women's Edition yet?
-
"Truly wonderful, the mind of a child is." --Yoda Edit: Sort of related: http://daniel0.net/pics/superman.jpg
-
Well, it's the same principle (you'd probably want to use the first approach). The inner for loop is for every cell, and the outer for loop does something on each row. Assuming you mean an HTML table, something like this: <table> <?php $rows = 10; $cols = 10; for ($i = 0; $i < $rows; ++$i) { echo '<tr>'; for ($j = 0; $j < $cols; ++$j) { echo "<td>{$i},{$j}</td>"; } echo '</tr>'; } ?></table> Again, untested.
-
Don't show raw error messages with potentially sensitive information to your users (mysql_error()). Implement some proper error handling that allows you to turn off error messages like that in a production environment (but still logs it), but shows it during development. Well, it would be a good idea storing them in a configuration file that isn't stored in a publicly accessible folder. If the PHP module somehow fails on your web server, your login information will be in plain sight to everybody. It's also a good idea for organizing your files properly.
-
$rows = 10; $cols = 10; for ($i = 0; $i < $rows; ++$i) { for ($j = 0; $j < $cols; ++$j) { echo '[]'; } echo PHP_EOL; } // OR for ($i = 0; $i < $rows; ++$i) { echo str_repeat('[]', $cols) . PHP_EOL; } // OR for ($i = 0; $i < $rows * $cols; ++$i) { echo '[]'; if ($rows % $cols == 0) { echo PHP_EOL; } } Neither of them tested, but the principles still apply.
-
There is not anything inherently wrong with the short tags. If you can control the environment where they'll be used, I see no issue using it. For instance, on PHP Freaks I could turn short tags on and use them if I wanted to. That would be no problem whatsoever.
-
Look at this line: if(in_array(1697, $group_id_ary) Now count the opening parentheses and the closing parentheses. Notice anything?
-
Use rename if you just want to move it without having anything to do with uploads.
-
Special laws apply to Microsoft because of their monopoly. OS X and Linux do not have are not monopolies on the OS market, so those rules don't apply to them. It may be a stupid law, but seeing as it is a law it does have to be followed. That being said, IE only runs on Windows so it's impossible to force other operating systems to include it even if you wanted to do it.
-
Well, you're also fucked if your mechanical brakes fail, so what's your point?
-
I think the thing about this incident "traumatizing" the kid is BS as well. I agree with MrAdam. Small children don't care about having to stay away from school for a couple of days. Basically it's just a few days off -- neat!
-
Starting more processes isn't necessarily bad. If you start Google Chrome and open 10 tabs, you'll likely be running 11 Chrome processes.
-
The blog post forgot to mention that the student had told the teacher that it was himself on the cross. http://wbztv.com/local/taunton.cross.drawing.2.1370369.html
-
Heh... yeah that's what takes up most of the "182 days" SMF claims I've been online on this forum. Do that once two times per hour and you've spent one hour on the forums according to SMF.
-
The Java Runtime VM doesn't compile the code when you execute .class files. At that point it has already been compiled.
-
If he wanted to retain control over MySQL then he shouldn't have sold it. If he wanted to ensure that MySQL forever remained open source he should have added that clause when he sold it. If Oracle wanted to de-open source MySQL it's their own business. It's certainly none of Widenius', Stallman's or the European Council's. The legally binding promises he wants Oracle to make are things he should have originally demanded before selling it. It's pretty lame coming back now still wanting to decide shit unless he is willing to pay a couple of [mb]illion dollars (or whatever it's worth).
-
Actually, at times I think the Windows 7 GUI feels more responsive than on my Ubuntu install. Right now, nautilus is using 600 MB memory.