-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
The problem is not so much about variable keys, or about using variable variables, or about trying to use floats as array keys, or about $pricelist being backwards, or about magic strings like "PIRATES", but more about all those things together. $prices = array( "DISCOFEEST" => 6.5, "HAWAI/TROPICAL" => 8, "PIRATES" => 7 ); $productPrice = $prices["PIRATES"]; Why can't you do it that way?
-
FFS I can't find a single screenshot showing the icon. I think he's talking about the unlocked lock icon, probably about mixed content (the unsecure stuff on a secure page) or a certificate problem (like for a homemade cert). [edit] itran, for future reference, when you want help identifying something you see on your screen, it's a really good idea to take a screenshot and actually show the mysterious icon to us. Describing it doesn't always work and is always harder for us to understand than if we could look at a picture instead.
-
* You can't set a DEFAULT CURRENT_TIMESTAMP on a DATETIME column. Only TIMESTAMPs. So what type is the column? * MySQL will convert TIMESTAMPs to the current timezone when pulling the data. * How is the user viewing the data? Surely not with a MySQL client. Which means that if the value is changing then there's something in code somewhere affecting that.
-
Normally the easiest solution is (?<!...) is a "negative lookbehind assertion", and forces the engine to only consider cases where that ... does not match. But its biggest drawback prevents its use here: it cannot be variable length. Like (?<!(^|\s)\S+\d\S+) So the next best thing: a non-capturing group. (??<=^|\s)[^\s\d]+\d\S+)\s(lot|unit|spc|...) [edit] Entirely numbers? Makes it easier. (??<=^|\s)[^\s\d]+\s(lot|unit|spc|...)
-
You say "help me" so I assume that means you're willing to write code (given guidance and suggestions from us)? As opposed to wanting someone to write it all for you and you, in all likelihood, paying them for the work? If that's so, how far have you gotten on your own and how much PHP do you know?
-
No but if you know what the file is like and how to use it then it's pretty easy to write one. function validate($htpasswd, $username, $password) { // file exists if (!is_file($htpasswd) || !is_readable($htpasswd)) { trigger_error("{$htpasswd} passwd file not found", E_USER_WARNING); return false; } // valid username... docs don't really define this but it can't contain a colon if (strpos($username, ":") !== false) { trigger_error("Invalid username", E_USER_NOTICE); return false; } // search the file foreach (file($htpasswd) as $line) { // lines are in the form "username:hashed password" list($lineuser, $linehash) = explode(":", trim($line)); if ($lineuser == $username) { return crypt($password, $linehash) == $linehash; } } return false; }
-
Saving 12 bytes per hash just isn't enough in my eyes to deal with binary data. Disk space is cheap.
-
I'm sure it's doable, but it's so much harder for us to give you an appropriate answer when you have a hard time telling us what the actual problem is.
-
It's the same as before except you have to worry about the URL conflicting with existing pages. That's why I would suggest a structure closer to /rules/Ax-men So, good news and bad news. Bad news: it's difficult to do string replacement with mod_rewrite, which you would use to turn "Ax-men" (as requested) to "Ax men" (what rules.php wants) Good news: you could just do that in rules.php As for the whole conflict thing should you stick with your original plan, the solution is a couple RewriteConds before the RewriteRule: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d
-
That second "dimension" isn't an array. It's an object. Which you can tell by the $results[$i]->id_str
-
$_COOKIE contains user-editable values. You're open to SQL injection.
-
It doesn't have to, but yeah pretty much.
-
DOMdocument. getElementById() then the "value" attribute of that element.
-
Exactly the way you might think you have to: do a query to get the IDs and whatever information is necessary to know their URLs, then dump it to a file. (Because caching it in a file will be much better than doing it on demand.)
-
You can edit but there's only a short window after posting in which you can. For some reason the PHP code is not executing. So that's where to start looking. But you say that the AJAX works the second time? Or that the AJAX doesn't work at all and something else is refreshing the page?
-
You won't see them in HTML because whitespace, like tabs and newlines, are collapsed into single spaces. Most of the time. Use a instead, or even better put the content into an appropriate structure (table, span, div, or whatever) and style that as you want.
-
Php Creates Cookie But Doesn't Store Them?
requinix replied to BrettHartel's topic in PHP Coding Help
Calling setcookie() does not make the values appear in $_COOKIE automatically. They'll take effect on the next page load. If you need them immediately then you can make your own setcookie()-type function which calls setcookie() and also sets the value in $_COOKIE, like function savecookie($name, $value, $expire = 0, $path = null, $domain = null, $secure = false, $httponly = false) { if (setcookie($name, $value, $expire, $path, $domain, $secure, $httponly)) { if ($value === false || $expire < time()) { unset($_COOKIE[$name]); } else { $_COOKIE[$name] = $value; } return true; } else { return false; } } -
Programme From Multiple Lines Into One Straight Line
requinix replied to sungpeng's topic in PHP Coding Help
This. I rarely do View Source anymore because I have Chrome: right-click, Inspect Element, and read the tree just fine. You can obfuscate your site with XSLT or Javascript and it won't make any difference at all. HTML obfuscation is a battle you cannot win. [edit] On that note, it's trivial to watch AJAX requests and Flash video downloads. I can see everything your website is doing, every AJAX request it makes, every file it downloads, and I can replay that against you. Then I can deconstruct the requests and reassemble the pieces in any way I want, send those requests to your server, and you'll never know the difference. -
Programme From Multiple Lines Into One Straight Line
requinix replied to sungpeng's topic in PHP Coding Help
Why would you want to do that? Whitespace in PHP is completely harmless, while removing that makes code a billion times harder to manage. -
If you don't know what a "cycle" or "sequence" is then how are you supposed to solve the problem?
-
What is a "cycle"?
-
You can't access variables defined in other functions. That's true for every programming language I can think of. Make updateTotal() return the value, then call it in results() to get that value. [edit] Or use it as window.total instead, I guess.