-
Posts
5,717 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Adam
-
Clue was in your description: Assuming you want to remove *every* cookie, you could try something like: if (!empty($_COOKIE)) { foreach ($_COOKIE as $name => $value) { setcookie($name, $value, time() -1); } } Edit: You could also introduce an array_key_exists check using an array of cookies to remove if you only want to target certain cookies, or alternatively omit some from the removal.
-
...Which folder? Could show the paths as opposed to just naming them.
-
Well if it's not there, that's why you're getting the error? Do you have another copy of it anywhere? Check your recycle bin too.
-
So it's in the right dir. What are the permissions are on the file? Could you post the exact error you get when you try to access the it through the browser?
-
Echoing a certain part of a text held inside a div
Adam replied to Bikkebakke's topic in PHP Coding Help
Look into cURL. Then you'll probably want to use DOMDocument or a regular expression to parse the data you need. -
The document* root, what's the path to the directory in which you keep your server documents? Often it's named "htdocs" or "public_html", or something along those lines. Find that, look in the directory, and check to see if index.php is there.
-
Yar: if (preg_match('#^http://#', $str)) { Using "#" as the delimiter or it just looks ridiculous.
-
... What is it he wants to do
-
You don't need regexp for that, you can just use substr: if (substr($str, 0, 7) == 'http://') {
-
In which case he wouldn't get a 404 error returned from the web server.
-
Assuming $week contains an actual date, you should be able to just change your strotime() line to: $week = strtotime('last sunday + 1 day', $week);
-
placing javascript cookie value into a textbox
Adam replied to TeddyKiller's topic in Javascript Help
Are you wanting to do this on an event? If not it would be much easier to do using PHP: <input type="text" name=".." value="<?php if (!empty($_COOKIE['cookie_name'])) echo $_COOKIE['cookie_name']; ?>" /> -
Have you tried to alert the xml.responseText to ensure it's what you're expecting?
-
Perhaps this can be of use .. http://serverfault.com/questions/138007/php-output-buffer-flush-issue-on-apache-linux
-
Given the use of language "which of the following methods are (...)" suggests the answer allows multiple answers, and would have to anyway as 4 of those can return data.
-
No this shouldn't be impossible - I believe you can make HTTP requests with Flash? You could make a request to a PHP script that will return some indicator they have the right authentication to upload a file..? I guess it depends how embedded the Flash is, is it just the form you display or is it part of a larger Flash site or something? The latter being more awkward as you can't just conditionally display the application. To be honest I don't really know a massive amount about Flash so I may not be of any use here.
-
http://www.google.co.uk/search?q=javascript+insert+text+at+cursor
-
Why don't you validate them before you display the upload form? Edit: Ah, flash.
-
Apologies if English is not your first language, but I couldn't understand a word of that. Sounds like you're wanting the work done for you? Maybe you should be posting this on the freelance board.
-
Warning: Invalid argument supplied for foreach() in
Adam replied to lehrnroo's topic in PHP Coding Help
How are you calling the script? My guess would be that the key you're passing into $rakenne[$osio] contains characters IE can't handle through the URL. And/or have you dumped out the value of $osio to make sure it's what you're expecting? I'd reccomend adding in an array_key_exists check before blindly trying the loop too. -
Given that then, I don't think you need to worry about any legal obligations. To further secure the data though you could encrypt it?
-
How about $_SERVER['REFERER']? We're unable to see the $session object you're using there, so can't say how it's populating the 'referer' property.
-
Ideas toward my language selection php code please?
Adam replied to Bottyz's topic in PHP Coding Help
Sorry, I thought you meant for regular links. Thinking about it then, you may want 2 constants: define('HREF_BASE', '/path'); define('LANG_BASE', HREF_BASE . '/' . $lang); HREF_BASE containing the path to your site with no language specification. LANG_BASE would be what you could use for normal links. Then to switch the language, you could use a function like below to return the current URL with the modified language param: function switchLangHref($lang) { $href = HREF_BASE . '/' . $lang . '/' . basename($_SERVER['PHP_SELF']); if (!empty($_SERVER['QUERY_STRING'])) { $href .= '?' . $_SERVER['QUERY_STRING']; } return $href; } So you'd call it like: <a href="<?php echo switchLangHref('fr'); ?>">Switch to French</a> I weren't implying you should do it this way, it's just with you already using constants for the language files, I figured this is probably the most fitting. There's loads of different ways this can be done... -
There's also stream_context_create available to you.