-
Posts
15,227 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
Create Cache File From Http_Host And Request_Uri
requinix replied to stegers's topic in Applications
That may be correct for you but in the general case, and actually I would suspect your case even, that won't work. It'll use the same cache for example.com/file.php as it would example.com/path/to/file.php. The first basename() and rtrim() is totally unnecessary while the second basename() is the problem. You're also not doing any kind of checking on the names provided, like with unsafe characters (there are many which aren't valid for Windows file names) or query strings ("?") or subdirectories ("/"). -
MySQL's DELETE has a multi-table syntax, but I would still recommend you keep it as it is now. You could do away with the temporary $q and just execute the queries directly though - cuts the number of lines in half.
-
How To Handle Xx Amount Of Slashes In A Rewritten Url.
requinix replied to Johns3n's topic in Apache HTTP Server
But /path/to/page will also match your RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)$ /index.php?slug=$1&type=$2&view=$3 [L,PT] It's ambiguous. -
You really should be putting quotes around those array keys when they're not inside strings*. You may not see the message but PHP complains every time you do that. As for cleaner code... I don't see much to do. <?php if ($row["PACKAGE"] != 3) { ?> <h3><a href = "<?PHP mrd("$MyProductTitle", "$row[LID]", "$_GET[category]", "$rowxxx[MR]", "index.php?page=detail"); ?>"><?php echo "$row[TITLE]"; ?></a></h3> <?PHP } ?> <?php if ($row["PACKAGE"] != 1) { ?> <?php echo "$row[TITLE]"; ?> <?PHP } ?> <p><?php echo $row["CAPTION"]; ?></p> * Unless you use the {} syntax, then you do.
-
What code did you try? I'm sure it just needs a small change to make it work. [edit] Actually I can guess. $today will be this very second, not just "today". Everything in $schedule will be the same too: you didn't specify a time so one will get filled in for you. So rather than compare $date with $today, compare date("Y-m-d", $date) with date("Y-m-d", $today).
-
How To Handle Xx Amount Of Slashes In A Rewritten Url.
requinix replied to Johns3n's topic in Apache HTTP Server
So example.com?path=this/is/a/path/to/this/&slug=page is the destination URL, and that's supposed to be the result of going to example.com/this/is/a/path/to/this/page Right? -
Noob Question Regarding Reading Directories
requinix replied to BorysSokolov's topic in PHP Coding Help
Every directory has a . and .. entry in it, references to the directory itself and its parent directory respectively. readdir() will return every single thing in the directory including those two. Since you generally don't want to see them in a directory listing the condition is there to make sure that the is only echoed if the filename isn't "." or "..".- 1 reply
-
- php
- directories
-
(and 2 more)
Tagged with:
-
Please don't troll us. <html> <?php error_reporting(-1); ini_set("display_errors", true); ?> <body> <h1>Today is <?php echo date("Y-m-d"); ?></h1> <p><input type="button" value="<?php echo 'This is a button'; ?>" /></p> <pre> <?php function test_getIndex_Of_Array() { $temp = array(); for ($i = 1; $i < 11; $i++) { $temp[$i - 1] = $i; } $count = sizeof($temp); for ($i = 0; $i < $count; $i++) { echo $i . ' ' . $temp[$i] . '<br>'; } } ////////////////////////////////////////////////////////////////////////////////// function test_ArraySum() { $temp = array(); for ($i = 1; $i < 11; $i++) { $temp[$i - 1] = $i; } $sum = array_sum($temp); echo $sum; } test_getIndex_Of_Array(); ?> </pre> <p><?php echo bin2hex(basename(__FILE__)); ?></p> </body> </html> What does that output?
-
Do a View Source on that page. Are you sure there isn't a "Connection Failed" message? It would say something like Connection Failed: Unknown MySQL server host '$db_host' (110) The reason for that is that, if I may quote someone,
-
I'd expect it to be in a "like" associative table.
-
You mean like the three that are indented way off to the side? Code works for me. I get 0 1<br>1 2<br>2 3<br>3 4<br>4 5<br>5 6<br>6 7<br>7 8<br>8 9<br>9 10<br>55
-
The URL you're trying is .../dillon_original.jpg&h=54&w=80&zc=2 Something's missing?
-
Since \p{Common} includes "[characters] that are not part of an identified script" you probably don't want to include that. Otherwise, unless you really want Unicode, [a-z0-9]/i could be just fine.
-
Whichever is the one you need, the first line is the initialization (happens before the loops) and the second line is the action you do inside that if block. Like $words = array(1,2,3,4); $num = count($words); //The total number of possible combinations $total = pow(2, $num); /* initialization */ //Loop through each possible combination for ($i = 0; $i < $total; $i++) { //For each combination check if each bit is set for ($j = 0; $j < $total; $j++) { //Is bit $j set in $i? if (pow(2, $j) & $i) { echo $words[$j] . ' '; /* action */ } } echo '<br />'; }
-
With the fix I mentioned, yes it does make sense. If $words contained more than just the numbers 1-4, like words or names, then this is basically the easiest way to enumerate all the possible combinations. Actually, considering the output 1 2 1 2 3 1 3 2 3 1 2 3... if you were to, say, hit all of those numbers on the numeric keypad lock on a particular set of cars, you would be able to get in. Except this output is horribly inefficient: there's a significantly shorter list out there.
-
Ditto.
-
...Of course, if the question has nothing to do with URL rewriting and more about having the name of a file in a string...
-
If you actually have a file named "2-lines-noted-pads-565.php" then just hardcode the number. Then kick yourself for actually having a file named that. Hopefully you have URL rewriting. If that's the case then your rewriting should match that number and pass it to the underlying script. Doing so depends on (cough) what you have right now...
-
1. Are you actually using "old.php" and "new.php", or are those placeholders for the real filenames? If so then what are those filenames? 2. Have you tried the banner one yet? Does that work?
-
Stick the [R] flag back in. What happens now?
-
You do have the new.php in place, right? What does your access log say the 404 was for?
-
Do an UPDATE where you set the value of the new column = the old column.