Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Cache And Referer


if we click on back on this browser, this forum somehow refreshes itself. So I assume it uses something like cache. But what about sometimes, like we're filling up a form and click on submit than later realize we miss out something and this time when we click back, we get a "Warning, page had expired". So is this also using cache? If this two is the same case, how come this forum won't get affected by the expired page?

For the HTTP_Referer, I'm sorry but can anyone show some example like how do we stick this function to remember every part of the click on our site link like this forum?

I'm really desperate to know this answer and hope someone could just briefly go through these two functions to me (rather than send me to php.net or any site) I don't mean to repeat this and hope no one will get offended by this post. I just need a little explaination.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Header("Cache-Control: No-cache, Must-revalidate");
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

When should I use the above on my website?

Referer
I'm looking for a way to change the refferer of the client clicking on
a link to an external site. In other words, the external site should not see where the visitor is coming from, or even better, if i could manipulate the referer so that in their web-server's logs it will show as if they are coming from their own site.

I've tried different ideas none of which worked.

404 Get Referer ?
Is it possible to catch the referer when using a 404 document ? for example, someone surfs to www.test.com/mkqjdfkjdfk mkdjfmqkd doesn't excist, so I want to catch this string to analyze it further on ..

Referer
Is it possible to get the page anchor name when using $_SERVER['HTTP_REFERER'];?

So instead of mysite.com/one.html it'll show mysite.com/one.html#two

Referer?
I want to make something so that you can only see a page if you have been referred there by a certain page. For example www.bla.com/test.php can only be accessed if the page it was linked from was www.bla.com/test123.php.

How would i go about doing this? You don't have to litrally write the code out if you don't want to, just an idea of what i have to learn/read in order to do this (i know basic php, been doing it for a while but ive had a big break so i don't remember much).

Finding Referer In PHP
I'm trying to determine the location a user has come from when they access a script of mine (a custom web logging script). I've searched the manual for 'referer' but can't find any relevant references and looking at output from phpinfo doesn't shed any light on which, if any, variables might hold info about where the user has come from.

Referer Header
I wasn't too clear about how the referer header works if sent on a php page on domain Z. Does it mean that it will send to the destination server a referer specified in the header, even if it is not the actual referer of the site?

e.g.

header("Referer: http://www.wanttosendthis.com");
header("Location: http://www.anothersite.com");

With anothersite.com show in it's logs the referer as wanttosendthis.com?

Getting Referer Of Script In PHP
I need to obtain the URL of the site that called one of my scripts. My code on client side looks like this:

<SCRIPT type="text/javascript" src="http://example.com/scripts/apiscript.php?key=[hash of site]">

on server side, what do I have to do to get the referer (calling url), so that I can use it to calcuate the required hash?

Http Referer?
I'm bulding this web site and I do not want other to link to my pages. I can use on every sinle page the http_referer to detect who's the referer and decide if I have to give access or not... but isn't there a better way of doing this instead of putting a piece of code on very single page ?

Page Referer Not Getting Set
I do web design for some small organizations, and one of the sites I have
set up takes online conference registrations. Now, most of the time it
works. In fact, every time I try it, it works fine.

However, after having many complaints about it not working right, I finally
discovered that some of my users do not have the page referer set when they
request my page, and I was checking on the form submission page to make sure
that the referer was the correct page.

What could cause people to not have their referer set? What is the solution
for this sort of problem? Just don't check the referer?

IP Lookup Or HTTP Referer
I want to know if there is a function that I can know the IP of a user. For HTTP_REFERER, I can get the URL from the user such as www.sony.com. BUT is there any way I can also know the IP of that?

How To Keep A REFERER After Redirecting With .htaccess
When users click on a link such as /stuff/page5.html for example, when page5.html does not exist, i need to redirect to MyScript.php using the .htaccess (this works fine) but I need to hold on to the page5.html so I can make a better 404 page (and so i can be nitified of any 404 in order to fix them).

Using $HTTP_REFERER returns the original page that the user clicked on, and $REQUEST_URI returns "/stuff/My404.php".

I think what I need to do is somehow redirect to My404.php?BrokenLink=page5.html in the .htaccess but i'm not sure how to do this.

Referer Based Allow/disallow
If referrer is internal (www.mysite.com), then show the page, else show an error message.
Basically do not want outside link, and would prefer not to have direct link through the browser either.

Dynamic Http Referer
I have people coming to my site from the page http://www.domain.com/attn.php. If i put into the script that i should let anyone into my page coming from attn.php then if the URL is changed by the variable $check it doesnt let them in. What do i do to make sure that anyone coming from 'http://www.domain.com/attn.php?check=$anything' gets in? PHP Code:

Referer And Keyword Info Sent Via Form?
I've learned that HTTP_REFERRER, at least in my tests, returns the page visted on the current domain before the form page, not the domain visited before the current domain, so that hasn't been useful. I don't know how I would get keywords in this case. I've searched around for scripts or tutorials and have been surprised to find nothing helpful

The site in question has a separate stats package, but it doesn't track converting keywords and that's really what I'm after. There isn't high volume traffic, so getting them individually via a form (rather than input into a database) isn't a problem.

My question is really whether what I'm trying to do is possible with a few lines of code, or have I underestimated the complexity of the task?

Zone Alarm (pro) - Block Referer
i'm having troble with a script where i check referer, on a PC with Zone
Alarm Pro the referer isn't send...

i did a couple of page of testing and no referer is sand, closing ZAP the
referer will work

How can i solve this, do you know wich option is in zone alarm that dosen't

404 Error Referer Script Problems
I am having trouble extracting the original referer in my 404 error script.
This is what I have so far:

1) I set the .htaccess file to the following and it works fine:

ErrorDocument 404 /404.php

2) I've tried the following variables and they all produce the same results:

$REQUEST_URI
$HTTP_REFERER
$REDIRECT_URL

3) The above mentioned variables all return "/404.php" and not the
originally requested page.

Getting Page Referer Without Depending On User
I NEED the page referer for a script i've built to work, basicly i'm redirecting to my frames page with a line like this..

if ($m == "find") { $mainframe = $_SERVER['HTTP_REFERER']; }

but i've been told that this data is sent from the user, so i need some way of telling my script which page to use as the main frame.

Check Referer - Call To Unsupported Or Undefined Function Error()
I have a Fatal error: Call to unsupported or undefined function error() in line 24
Line 24 is: error("Unauthorized access to: $HTTP_REFERER"); What I'm doing wrong?

$referers = array('mydomain.com','www.mydomain.com');

function check_referer () {
global $REFERERS, $HTTP_REFERER;
if ($HTTP_REFERER != "")
while (list($val, $ref) = each($REFERERS))
if (preg_match("/^http://$ref/", $HTTP_REFERER))
return;
error("Unauthorized access to: $HTTP_REFERER");
exit; }
check_referer();

Cache Off
how can i manage cache memory in my database or table..

Cache
I can't seem to get any browser to stop caching things. I've tried it with the following PHP.

<?
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " MT"); // always modified
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");?>

and with the following HTML:

<META http-equiv="Expires" content="Tue, 20 Aug 1996 14:25:27 GMT">

And It just keeps caching. Does anyone know how to make a browser not cache your content.

To Cache Or Not To Cache?
When dealing with a large amount of pages, is it better to dynamically create from the database then cache each page in a folder, or to dynamically create it using info from a database every time someone access's the page?

Cache
i see a lot of codes that are use with header no cache i know this is meant not to let the user catch your page content, but of what benifit is it?

shouldn't this be for a secure website?

for a normal page wouldn't it be best to let the user cache so the page to be refresh faster? i try searching for this questions, but no real explanation on why or why not.

Skipping Cache
I'm working on an e-com. store and the client wants it so that after you checkout if you hit the back button it skips all the previous pages in the cart and takes you back to page before you enter the cart. From what I've read it seems like I can force a page to not cache but I don't want the pages in the history at all... is there a way to do this?

No-Cache And Mod_gzip And PHP
I am using the following headers and they are working fine.

Header('Cache-Control: no-cache');
Header('Pragma: no-cache');

However I just recently installed mod_zip. The problem is mod_zip is working but the pages are now being cached. When I turn off mod_zip the files dont get cached. When I enable it appears it is ignoring all my headers.

I need help getting my server to run mod_gzip and not cache my pages. Those are the only headers I am using in my file.

Headers Using No-cache
Have some problems with a php image updating in a page of mine. In both i have a header like so..

//HEADER MAKES SURE IT REFRESHES
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");

which should be making sure the image is remade as opposed to taking it from the cache however it seems to be a bit random, sometimes it does, it sometimes it does'nt..

Loss Of Cache
I have a little script that takes the data from a user filled-in form, and then generates a pdf file with the content. Between the actual filling in of the form and the generation of the pdf file, there is a confirmation screen where the user sees the values he/she is submitting and confirms wether they are right or not.

The problem is that if they spot an error and go back to the form (using the back button), they get a message saying that the page contains POSTDATA that has expired from cache etc... and when they get the form back, it is blank.

Cache Busting
I have the need to prevent user caching on particular pages. I've read the manual pages on header and session_cache_limiter.

Am I right to think that these snippets are ALL that I need to reliably prevent users from caching the pages?

When using sessions:
session_cache_limiter('nocache');
session_start();

When not using sessions:
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

I don't understand the comments on those manual pages about sending a dozen different headers. Are they all necessary? Or are they legacy hacks?

PHP W/ Caché Database
How I connect PHP on Caché Database? I'm using Windows/Apache.

Cache Issue
All of my PHP pages have a default of no-cache. But for a specific page, I need to have cache available. I am using:

session_cache_limiter('private');
session_cache_expire(1);

But the pages will not get refreshed with new visits even after several days, or even with Refresh. (however on IE, CTRL+F5 would bring the updated page). Do you have any idea on what I am missing. Here is the returned header for that page:

Result code: 200 (OK / OK)
Date: Sat, 04 Mar 2006 12:37:58 GMT
Server: Apache/1.3.33 (Unix) mod_tsunami/3.0
Cache-Control: private, max-age=60, pre-check=60
Expires: Thu, 19 Nov 1981 08:52:00 GMT
X-Powered-By: PHP/4.3.2
Set-Cookie: PHPSESSID=95817bf8b4d7eb3435797b2fd9f09636; path=/
Last-Modified: Tue, 21 Feb 2006 07:43:07 GMT
Content-Type: text/html
X-Cache: MISS from wc02.inet.mesa1.secureserver.net
Proxy-Connection: close

LRU Cache Implementation
Most of my application's operations (including SQL queries and numerical
computation) can be cached. An LRU (least recently used) cache would fit
the bill perfectly.

This LRU cache should be preserved over multiple requests from the same
session. If possible, it should be seen across multiple sessions so that
all users can benefit from it.

I can't implement either solution. In principle I could preserve the
cache across multiple requests by using $_SESSION, but I don't think
this would be wise. The whole structure would weigh on the order of a
MB, so access would probably be really, really slow.

Also consider that access to the cache must be serialized.

I could in principle write the C code to do the caching. But this would
be extremely ugly since I want to cache PHP objects, not C structures.
There would also be the overhead of converting to and from PHP's
representation.

How To Clear Cache
I have a php file which will list the pending
task for each developer. If the developer
changes some thing it will update to database.
Once the user clicks the update button it shows
the another page and there will be button back to
list of pending task. It will again fetch from database.

At the second time if user update some other data. It giving
me the old data list also.

I used ClearStatCache() this is not working. And also I added

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="expires" CONTENT="0"> in my php file.

No-cache With Images
I have a page that creates an image with imagePNG function and saves it to disk. Beside the image, there is also a form on the page, in which you can change the imagage data. When an user submits the form, then the same page is called, and the different image should be displayed (with the same name). Problem : the image stays the same, the image file changes ; PHP Code:

Cache Problemette
I am trying to prevent a browser going back to a logon screen and any user
being able to refresh (and the browser re-submits the post data).

I understand that the following should work. It doesn't.

header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Expires: Mon,26 Jul 1997 05:00:00 GMT");
I am inserting the code before any output.

Crazy Cache !!
I've a page where I can upload and delete images.

I've such problem I'm trying to solve. My images are numbered xxxx-1.jpg,
xxxx-2.jpg, xxxx-3.jpg (where xxxx is the article number).

Now, when the used deletes the 2nd pictures, then I update the database for
having the xxxx-3.jpg renamed in xxxx-2.jpg and also I rename the file on
the server.

Problem: if I go to the article page, then the OLD xxxx-2.jpg is shown. I've
to refresh with CTRL pushed to get the correct image. Also if I come back to
manage those pictures again, then the third is definetively removed, and the
xxxx-2.jpg shown the old one, not the xxxx-3.jpg renamed.

How to avoid the server to store such think ? I don't want the cache for
such pictures.

No-cache Header
I want to keep Proxie Servers and the Browser Cache from storing my page - to provide always a new version. I didn't have any success with meta HTTP-EQUIV tags, now I want to try it with PHP headers. Does the following code work?: PHP Code:

Cookie Is In A Cache?
I'm setting a cookie with setcookie, and as long as I'm not closing the
browser - the cookie is kept and passed to the next page.

But as soon as I leave the site or close the browser, the cookie is
gone, ans there is nothing in $_COOKIE dor the next time.

The cookie is not shown in the cookies folder.

This is the command I use:
setcookie ('lang', $lang, 77000);

Reading Not From Cache
I wrote an php script which creates a tex document and convert it with

"passthru ("texi2pdf generate.tex");"

into a pdf file. After that an java script pops up a new window with the
generated pdf file. Unfortunately, my browser always shows an old pdf file
from the cache which was created earlier.

How can I force to load the recent pdf file?

Cache Control
How can i cache a page in Php3?

Browser Cache
I'm working on an 'e-commerce-like' site, where users can look at catalogs, look at items description, and put items in shopping carts. Most of my pages are dynamically generated (using PHP4), with the contents pulled from a MySQL database.

The problem is, for example, from the catalog page I click on an item to see more detailed description (which is also dynamically generated). But then, if I want to go back to the catalog page by clicking the browser's Back button, I'll get a page saying that the page that I wanted has expired or no longer available.

Header Cache
How come if I place this at the top of the page, it doesn't work?

header( "Cache-Control: no-store, no-cache, must-revalidate" );
header( "Cache-Control: post-check=0, pre-check=0", false );
header( "Pragma: nocache" );

I have a script that rotates images, then saves them, along with the new thumbnail, but when the page that I display the image on reloads, the image thumbnail hasn't change. If i press F5, or ctrl+F, or Refresh, then the thumbnail changes to the new updated image. The above code is on the saves the new rotated image file, and on the page that displays the thumbnail.

How Would I Prevent PHP GD Cache?
How can I prevent my PHP GD code below from caching in browser? I guess that I would use a header; but I am not sure where to put it; it tried to put it before "imagejpeg($image)", but that did not help. The problem is that when I use a pop-up the image will display from cache and then be displayed again from PHP GD script. Code:

Clear Cache
Is it possible to clear the notebook or cache on a visitors PC with php??

I am trying to stop people copying the txt from a site by either selecting the txt and copying to clipboard or taking a screen shot.

I have been told that this is possible with PHP but am yet to find anything in the manual!! all I can find is informatin about clearing the server cache.

No Page Cache Question
I have a page that I need to have expire immediately after the user leaves it. This page is a "order processing" page that was intended to prevent users from double submitting an order but if the user clicks back from the approval page, his or her order is then processed again. Any ideas on how to accomplish this would be greatly appreciated.

Cache Clearing Problem
when a form is submitted in php to mysql for eg., and when the page is refreshed the same record is inserted again.

I need to clear browser cache. I tried using unset() and also

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

Is there something I am missing.

Browser Password-cache
how can I clear the password-cache in the browser so it shows an authentication-Dialog again? When I just unset the variables $PHP_AUTH_USER and $PHP_AUTH_PW the passwords are still saved and the browser doesn't show the authentication window. Is there a trick?

Cache With Secure Forms
I am in the process of trying to plan out a Content Management System and it really bugs me that after logging out, you can just hit the back button and you are back into the 'restricted' area!

The solution that i was considering was to have a processing page that handles both the login and the logout- redirecting according to the query string. Still, that doesn't seem secure... any ideas?

Identify Users By The Cache
I would like to know, if it's possible to identify a user by an ID, which is saved in the Cache? I have heard from the PEAR CACHE LITE class and already read the well written article about this one. So it would be interisting to know, if one can use the CACHE LITE class to save the User's IDs into the Cache.

Perhaps it doesn't make sense to you or you would ask, why I don't just save the Users's ID into a MySQL table. Well, I want to exclude users from my web-site, who tried to hack my web-site.

My idea was to use COOKIES containing the User's ID and compare it with the ID, which is saved somewhere else ( for example in the cache ). When the user deletes this COOKIE, he is not allowed to visit this site anymore.

Issue With Cache And Pictures
I have a problem with cached images...

The script first creates some pictures out of avariable source (every time
the script runs the pics are different):

$im = imagecreatefromjpeg($file);
imagejpeg($im2,"temp100.jpg",100);
imagejpeg($im2,"temp75.jpg",75);
imagejpeg($im2,"temp50.jpg",50);
imagejpeg($im2,"temp25.jpg",25);

then I show them using normal html img tags

<img src="temp100.jpg">

The problem is that the pictures are cached and the script/IE shows a
fautlhy version of the pictures.

I tried messing with the header as described in the php manual.

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

But this doesn't work... wrong pic-fileversion

Does anybody has a sollution?




Copyright © 2005-08 www.BigResource.com, All rights reserved