-
Posts
1,832 -
Joined
-
Last visited
-
Days Won
3
Everything posted by salathe
-
Turn up (and on!) your error reporting levels. Use error_reporting(E_ALL | E_STRICT); ini_set('display_errors', '1'); somewhere before the mkdir line.
-
Use brainz power, mind things wonderful can do!
-
Search for the term "inline editing".
-
How about letting him choose?
-
You'll need to convert that into something usable by PHP's date funtions and from there it is easy to get the day of the week. For example (the following could be mushed onto one line, it is split up for ease of understanding): $date = '20100312122636'; // Grab date parts $year = substr($date, 0, 4); $month = substr($date, 4, 2); $day = substr($date, 6, 2); // Get the UNIX timestamp for the date $timestamp = gmmktime(0, 0, 0, $month, $day, $year); // Print the day of week echo date('l', $timestamp);
-
Regex wizards - matching same number of opening and closing tags
salathe replied to frizi's topic in Regex Help
You should be using the DOM. If you're having trouble doing that, please ask questions. Any regex solution will be far more complicated and difficult to maintain and understand in the future (or even, now). -
Accessing element of array returned from function
salathe replied to DataRater's topic in PHP Coding Help
Function array dereferencing (which is what you're trying to do) is not available in PHP. You'll need to use more normal methods of getting the value that you want, like: $arr = ReturnArray(); $var = $arr['A']; P.S. list won't work because of the string indexes. -
No.
-
Use the s pattern modifier (/.../s) to allow the dot meta character to match newlines.
-
Again, if you're trying to do what I think you're trying to do then no. The referrer information comes from the browser, it is up to them whether to send a referrer or not: your website cannot say, "don't send a referrer for the next page".
-
If you want to do what I think you are wanting to do then what you want to do is not possible, unless you own all of the domains which will belong to the "fake referrers".
-
Why do you feel the need to call trim, stripslashes and htmlspecialchars on the input? You seem to be confusing a couple of things, or trying to do everything in one place. In particular, htmlspecialchars has no place being anywhere near input... why would anyone want to store all input data as HTML-encoded strings? Sure, it can be useful when outputting data (in this case, from the database). Back to the original question, the only advantage would be towards an attacker looking for an easy way into your site.
-
How to validade international alphabetic characters?
salathe replied to lopes_andre's topic in Regex Help
Spaces plural or just one, or?.. Sorry if this sounds like 20 questions but you need to be precise. This will match multiple words (at least one word; consisting only of 'letters') separated by a single space: /^\pL+(?: \pL+)*$/Du -
What do you want?
-
How to validade international alphabetic characters?
salathe replied to lopes_andre's topic in Regex Help
Is there anything other than spaces that you need to allow? Just one space, new lines, tabs? -
How to validade international alphabetic characters?
salathe replied to lopes_andre's topic in Regex Help
Here's how I would do it, compare the function with yours to see the differences. function alpha_international($subject) { return (bool) preg_match('/^\pL+$/Du', $subject); } -
How to validade international alphabetic characters?
salathe replied to lopes_andre's topic in Regex Help
I guess you missed the side-comment in my post (make sure to use the u modifier) as that is what is missing. With that appended to your regex pattern, you're good to go. -
You'll likely be needing to wrap the JavaScript code in script tags, as you normally would when writing JavaScript in HTML.
-
How to validade international alphabetic characters?
salathe replied to lopes_andre's topic in Regex Help
\w is not to be relied on for this kind of problem as precisely what it matches varies between different locales in use. I'm sure there have been threads discussing exactly that topic which might be worth a search. By "international alphabetic characters" do you mean absolutely any letter character at all? If so then \pL (make sure to use the u modifier) will likely be sufficient. If you only want accented latin characters, then \pL would be overkill. So it depends what precisely you are wanting to match. -
A far more useful solution would be to go through the file (often line-by-line) so as to only load a small portion of it into memory at any one time. Unless there is some particular need to load 71 MB into memory every time the script is executed, I would advise against it. I'd also echo the others' suggestion of enabling and displaying all errors during development.
-
Yes, it is possible and there are a myriad of different ways to do something like this. Are you just thinking theoretically or do you have some script/application in mind where this would be useful?
-
That is the idea, just with correct JavaScript syntax. javascript:ajaxpage('viewcustomers.php', 'body');ajaxpage('viewcustomerl.php', 'leftpanel');
-
Sure, just add it in there beside the existing one.
-
For what it's worth, you can (likely) use the http_build_query function to make an array into the required string format. $example = array('a' => 'apple', 'b' => 'banana'); $postfields = http_build_query($example); echo $postfields; Gives us the array formatted as a=apple&b=banana