Jump to content

requinix

Administrators
  • Posts

    15,227
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. 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.
  2. * 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.
  3. 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|...)
  4. 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?
  5. 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; }
  6. Not really, but I would like to know the value of those two variables.
  7. What is the exact value of $userphotos and $photos?
  8. Saving 12 bytes per hash just isn't enough in my eyes to deal with binary data. Disk space is cheap.
  9. 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.
  10. 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
  11. That second "dimension" isn't an array. It's an object. Which you can tell by the $results[$i]->id_str
  12. $_COOKIE contains user-editable values. You're open to SQL injection.
  13. It doesn't have to, but yeah pretty much.
  14. DOMdocument. getElementById() then the "value" attribute of that element.
  15. 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.)
  16. 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?
  17. 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.
  18. 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; } }
  19. 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.
  20. Why would you want to do that? Whitespace in PHP is completely harmless, while removing that makes code a billion times harder to manage.
  21. If you don't know what a "cycle" or "sequence" is then how are you supposed to solve the problem?
  22. What is a "cycle"?
  23. 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.
  24. Since running a query actually makes you get all the results (which mysql_query() does automatically for you) stick a LIMIT 1 on the end so that if there are results you'll only have to discard the one row.
  25. The code itself is simple but what's going on behind the scenes is definitely worth an explanation. $row doesn't exist, as I'm sure you've noticed. But in this context, PHP will create both $row and $row[$field->name] (with a null value) automatically. The proper way of writing that loop would be $row = array(); while($field = $result->fetch_field()) { $row[$field->name] = null; $paramatere[] = &$row[$field->name]; } The next thing to see is the &. That means "reference to", as in "$paramatere[] is a reference to $row[$field->name]". Normal assignment means just "a copy of", but with this the two variables actually refer to the same thing, and if you changed the value of one then the other would be "updated" automatically. So now $paramatere is an array with a lot of references to stuff in $row - one for each field. The array then goes into $stmt->bind_param() by way of call_user_func_array(). As for why it does this? mysqli_stmt::bind_result() and ::bind_param() are not normal functions in the sense that you pass in values as arguments and they return values to you. Instead you pass in variables, as references, and the functions then modify (bind_result) or repeatedly access (bind_param) the values with no extra effort on your part. To do this they both require variables which are references - you can't just pass in a variable normally because that'll just be a copy and the functions won't work. The whole point of that $row stuff and references and call_user_func_array() are to pass in an unknown number of variable references to the function.
×
×
  • 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.