Jump to content

requinix

Administrators
  • Posts

    15,227
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. For kicks, how about posting the HTML for the form? Do a View Source on the page and copy/paste the relevant part(s).
  2. What does the HTML for the form look like? Did you rename the fields like I said?
  3. Is that your actual code? Do a var_dump() of $ar1, $ar2, and $bigar before their respective loops and make sure they're arrays. Because somehow they're not, even though I don't see how that's possible with the code you've shown*. * Well yes, $bigar=null. But the other two I don't know.
  4. Succeeding? I tried and it does not, even though I can (thought I could) see how it should be able to match something, even if it's the wrong text. Anyway, the middle part in the list was to exclude the delimiters. I made sure it wasn't " " but didn't include " ". Together they're "?p>". #<p>([^<]+|(?!</?p>)<|(?R))+</p>#i $content = '<h1>heading</h1><p>page content</p> <p>outer content 1 <p>Nested Content</p> outer content 2 </p>'; $regex = '#<p>([^<]+|(?!</?p>)<|(?R))+</p>#i'; preg_match_all($regex, $content, $matches); var_dump($matches); array(2) { [0]=> array(2) { [0]=> string(19) "<p>page content</p>" [1]=> string(61) "<p>outer content 1 <p>Nested Content</p> outer content 2 </p>" } [1]=> array(2) { [0]=> string(12) "page content" [1]=> string(17) " outer content 2 " } } Without trying to hijack the topic, the basic form is beginning delimiter ( valid content that isn't either delimiter | (?R) )+ ending delimiter In this case your original expression defined the valid content to be "not a )". When trying to match paired parentheses the regex would look like / \( # beginning delimiter ( [^()]+ # valid content is everything, besides a parenthesis (the delimiter) | (?R) # recursion )+ \) # ending delimiter /ix
  5. Properly paired is a definite requirement, but with that expression #<p>[^<]+</p>#i it's quite easy to turn it into something that can handle nested s. You know, as an academic exercise. #<p>([^<]+|(?!<p>)<|(?R))+</p>#i Same as before but the contents of the tag are either a] normal-looking text, b] the start of an HTML tag that isn't " ", or c] the entire expression matched recursively.
  6. The page with the error is where you should be looking for the error. Kinda... The cause of "premature end of script headers" errors tend to be either obvious or entirely non-obvious. May have to do with extensions or Apache or security restrictions on the machine or a bug or God knows what else. The best place to look for the problem would be in whatever changed around the time those errors started showing up.
  7. Because I'm pretty sure php://input will be empty. That's not where the data you want is.
  8. Just the tags? Or are you stripping out the ? How are you getting $content? Is it just a string? Do you know if it's always valid HTML? What if it isn't? Is there always just the and ? How else can $content vary?
  9. It most certainly is valid. So are OPTIONS and TRACE and CONNECT. OP: Are you sure $_GET is empty? I'd expect it to have your img_id just fine.
  10. It's no wonder it doesn't work: 1. No $ on the variable in the for loop 2. You're using addition (+) when you probably mean concatenation (.) 3. You're doing the addition in the wrong place anyways 4. You're trying to add two items to $a1 for every $i 5a. You're probably not using PHP 5.4 5b. If you are you're trying to add a number to an array 6. You pulled $key out of mid air I'm going to guess that your inputs are named "dataA1", "dataA2", and so on. Change that so they're all called "dataA[]". Or if you really want the numbers, "dataA[1]" and "dataA[2]". That way $_POST["dataA"] will be an array - something easier to deal with. As for the code, it's DOA. $a1 = array(); if (isset($_POST["dataA"]) && is_array($_POST["dataA"])) { foreach ($_POST["dataA"] as $key => $value) { if (is_string($value) && $value != "") { $a1[$key] = $value; } } }
  11. First step I would take is building up an array that looked like array( "Cardiff" => array( "total" => 2.72, "count" => 1 ), "London" => array( "total" => 4.24, "count" => 1 ), "Birmingham" => array( "total" => 6.755, "count" => 2 ) )
  12. I'll rephrase. Has this code ever run correctly on the live server? If so, when did it stop and did anything change (on the live server) around that time?
  13. Two new posts? Meh. Not bothered enough to rewrite mine. You're sending them to "locations-page.php". There's nothing in there about "myLocation". Yes you set a variable, but that was on the previous page. The new page doesn't know about it unless you tell it. But if you're asking about stuff that's wrong, we have to step back a little further. It sounds like you're creating a bunch of PHP files for all the different sities and zip codes? That's a lot of files. Doesn't it sound a bit unreasonable to you? It is. The way it's actually done is with URL rewriting. The web server (like Apache) looks at the URL, sees that it fits a pattern, and rewrites it to a different URL. For example, it sees "/location/philadelphia-pa-19128" and silently turns it into "/locations-page.php?city=philadelphia&state=pa&zip=19128". Blah blah blah search for PHP and URL rewriting for plenty of information how to do it.
  14. The "refer" is the referrer, as in the place the user was just before they got to the page in question (such as with a link or form). Needless to say, if you see it's the preceding page then that's good. Has anything changed recently? Or is this the first time you've tried running this code?
  15. Putting aside the fact that you should probably be using the sqlsrv extension (mssql is deprecated), if you're on a shared server then it's highly unlikely that you'll get the administrator(s) to add an extension for you. But you might as well ask them.
  16. Right. And what I'm saying is that model REGEXP "[0-9]" will also include the model!="" (contains something) and model REGEXP "[0-9][a-z]" (contains a number followed by a letter) cases. They're redundant. Still need the !=0 though.
  17. Maybe I'm misreading it but your two conditions are simply "record contains numbers and other stuff OR record contains numbers and not other stuff". Which is really just saying that it has to contain a number.
  18. PPS: it's "__construct"
  19. You just showed how to do that: call chmod() on the file. Apparently it's necessary... Normally the web server is running as a different user than the account owner, like "apache" versus "njdubois". Given that situation I can think of at least three different ways to manage permissions on uploads: 1. Directory is owned by apache:apache and 0755/0775, files are owned by apache:apache and 0644/0664 2. Directory is owned by njdubois:yourgroup and 0777, files are owned by apache:apache and 0644/0664 3. Directory is owned by njdubois:yourgroup and 2777, files are owned by apache:yourgroup and 0644/0664 Note that the directory is owned by either you or apache and the files are always owned by apache. No alternatives. You shouldn't need to change permissions on the uploaded files unless there's some unusual umask set and you don't have u+rw g+r/rw o+r by default (and even then you might not have to do anything).
  20. man crontab My Ubuntu says that it'll use /usr/bin/editor as a fallback; some Googling suggests that's true for CentOS too. [edit] IIRC you can manually modify the crontab file so long as you restart/SIGHUP the cron daemon.
  21. When you said there were no empty lines you lied. Unknowingly. There's a newline at the end of your file and after that is an empty line. Also, file is much better for getting lines from a file.
  22. If mysql_query() returns a boolean for a SELECT query then it means your query failed. There was an error. 1. What is the value of $term? 2. Why aren't you escaping it? 3. Why aren't you using mysqli or PDO and prepared statements? That's the most secure way to run a query involving user input. 4. If after #1 you don't see the problem, echo out mysql_error to get an error message. Also,
  23. I'm not sure Redirect will look at the query string, and that doesn't seem to be documented. If that's the case then you do need mod_rewrite. RewriteCond %{QUERY_STRING} =page=old-address RewriteRule ^/?index\.php$ http://www.newsite.com/new-adress [L,R=301] Also, Redirect is part of mod_alias. If you use it then you don't need a RewriteEngine or a RewriteBase. Completely different mechanisms.
×
×
  • 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.