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


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Refreshing Cache Through Php Header Function Yields No Result?


I am building a website for a client. He wants a login page with a "Your account" page for his clients. I am using a combination of javascript and php.

Upon succesful login $_SESSION variables are set to 1.
example: $_SESSION['logged']= 1;

If the client logs out due to idle time or pressing 'logout' these values are set to zero.
example: $_SESSION['logged']= 0;

Upon loading of "your account" and any of its sub-pages, that page checks $_SESSION['logged']. If the value is zero it redirects automatically back to the login page. Providing oppertunity to log in again if you wish.

The checking of $_SESSION['logged'] is supposed to redirect even if the client has logged out, but has pressed "back" on the browser to try and see a login page.

The page does not do this. Pressing "back" reveals the page. Interacting with the page or pressing "refresh" THEN causes it to redirect.

I need the page to auto-redirect, not show. I am aware that it is the page being cached and keeping those values until you interact with it. I have fully tested the header function in php. Using 'must-revalidate' & 'no-cache' and other version! (most info from php.net).

I get no errors when testing the pages, so my code is correctly spelled! But there is simply no reaction by the page, it just does what it does, which is not what it is supposed to do?

I ask for experience! Is there a specific way of doing the header functions? Perhaps it must be placed in a specific place in the page? And how can i check that the page is actually using the functions and not just moving over them with no action taken?




View Complete Forum Thread with Replies

Related Forum Messages:
Refreshing Browser Data - Cache Controls Not Working
I have a page that needs to refresh one part every time the page is visited. This part is controlled by

include "refreshme.php";

However, the data only refreshes when the browser's refresh button is physically pressed. I have included the following headers at the top of the source page.

header("Expires: Thu, 1 Sep 2007 07:00:00 GMT");
header("Cache-Control: no-cache, must-revalidate");
header('Cache-Control: post-check=0, pre-check=0', FALSE);
header("Pragma: no-cache");

Still no luck. Any idea on how to do this? I accomplish image refreshing by attaching a random number to the file. Example:

<?php $rand=rand(100000,999999); $rand="?".$rand;?>
<img src="<?php echo $picture.$rand;?>">

I cannot get something similar to work on the included php file.

View Replies !
Forms - Set Some Sort Of Cache Or Something So That I Wont Have To Keep Refreshing The Page?
I have a lot of forms on the site I'm working on and basically I get this error if I click 'back' in my web browser. Is there anyway I can set some sort of cache or something so that I wont have to keep refreshing the page?

View Replies !
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?

View Replies !
Cache Mysql Result Sets
In order to speed up performance, I want to cache the query result sets into somewhere so that php can read them directly and quickly instead of connect to mysql every time information is getting retrieved. But I don't know where I should store query result set.

View Replies !
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:

View Replies !
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.

View Replies !
Header( ) And Cache
I am just made aware of the effect of Header( )and page caching for PHP pages. It seems that my pages are not being cached because I was furnishing no information in a header. A couple of hours searching led me mostly to folks that want to prevent caching in certain cases. It all seems rather confusing, and I'm hoping that out there somewhere is a generic Header( )set up that will allow my CSS file to be cached in the users browser.

View Replies !
Cache & Header
At the very top of my PHP script I have:

header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");

However, IE doesn't seem to care :(
It still caches the pages... Any idea what might be wrong?

Normally I would put all this in .htaccess, but the @$%# who initially installed Apache compiled PHP/Perl/MySQL etc as dependencies of Apache, instead of loading them as modules. And, neither mod_expires nor mod_headers were compiled with Apache. So, if I wanted to either mod_, I would have to recompile not only Apache but also MySQL/PHP/Perl... (as far as I can tell). Either way, I'm not in the mood to recompile Apache at all :)

So, the reason why the PHP headers are failing -- is that related to the absence of mod_expires or mod_headers? Is there anything I can do to get the browser to not cache the page?

View Replies !
Cache - Mozila It Takes Probalbly Less Than Half Time To Display Result.
Our Internal website(PHP/MYSQL) takes ages to display result on Internet explorer 6 but when I tried on Mozila it takes probalbly less than half time to display result.

Does anyone know why? And What I can do to run IE faster?

View Replies !
Send A Header In The Php Script To Tell The Client To Cache The Image?
I have a php random avatar script. It seems to use more bandwidth than when there was just one image. Can I send a header in the php script to tell the client to cache the image?

View Replies !
Header() Function - Warning: Cannot Modify Header Information
I have attempted using the code provided, but I consistantly get an error concerning the header() function found on the bottom on the script.

What am I not understanding about header information?
I always get this error:

Warning: Cannot modify header information - headers already sent by (output started at C:apacheApache2htdocsPHPupdateupdate.php:9) in C:apacheApache2htdocsPHPupdateupdate.php on line 71

Is the tutorial not correct? Because I've seen similar tutorials that put the header() function in similar places too.

Here is the code:....

View Replies !
Header("Cache-Control: Public") Not Working
I have read somewhere else in this newsgroup that the way to avoid the
message (Warning: Page has Expired blah, blah blah ... ) when one
presses the back button is to place the statement
header("Cache-Control: public");
at the top of the script.
I have done this but I still get the annoying message.
The session.cache_expire in php.ini is set to 180. I am using shared
SSL.


View Replies !
How To Add Function Result To Array?
The way I'd like to set up a particular set of functions is to have them either return TRUE or, for example:

$errors[type] = "Sorry, the file type is not allowed. Allowed types are ".print_array_inline($acceptedTypes).". ";

Then later, I have a foreach loop that echos each array element. However, when I echo each array element is doesn't output the whatever the print_array_inline function does.

Any suggestions?

View Replies !
Query Result Navigator Function
I've just updated this, and I thought I'd also say that not only can this provide a page navigation for MySQL or other database results, but can be used to navigate other lists.. such as a file list. PHP Code:

View Replies !
Adding Result Row To Mail Function
I have an email script that will pull the addreses from my club membership database. That part works fine. the problem I am having is being able to include row results inside of the actual email message. My message variable is something like this: Code:

View Replies !
Saving Result Of Function Without Being Echoed
I am trying to save the function "rand(1, 1000000)" in a variable but when I am for example trying:

$randomnumber = rand(1, 1000000);

it is executing it right ahead while when i try

$randomnumber = "rand(1, 1000000)";

or

$randomnumber = 'rand(1, 1000000)'

It is saving rand(1, 1000000) as variable.

But what I need is a variable saving the result of rand(1, 1000000) so the number does not change either.

Any ideas how I would do this?

View Replies !
Storing The Result Of Javascript Function
how do I store the result of a javascript function into a PHP variable? I have a div that is hidden or shown based on whether or not a checkbox is clicked. Initially the div needs to be hidden.

So how do i make sure that it will be hidden in all browsers when the page loads. The code for hiding and unhiding it works in the different browsers i have tried, but not initially being hidden. attached is what I currently have.

View Replies !
MySQL Result To Real Array In Function
I'd like to create a function which input is the result of a mySQL
query.
The output should be exactly the same, only not a mySQL result array,
but a 'real' array.
So it should also get the fieldnames returned by mySQL and use those as
keys.

I can't get things to work properly: it should return a
multidimensional array,
like

$result_array[1] = array(
[field1] => field1 value,
[field2] => field2 value,
etc.
)

somehow my result is (with code below)

$result_array[1] = array(
[0] => field1 value,
[field1] => field1 value,
[1] => field2 value,
[field2] => field2 value,
etc.
)

+++++ code ++++++

$get_res= mysql_query(QUERY);

if( $res = mysql_fetch_array( $get_res ) )
{

do{

$result[] = $res;

}while( $res = mysql_fetch_array( $get_res ) );

};

foreach( $result as $key => $value ){

print_r($value);

};

View Replies !
Assign MySQL Function Result To PHP Variable
I know to use: mysql_fetch_row($result) to convert a row from a SQL query result set into an array for use with PHP. but in the case of SQL queries that return one value, such as calls to MySQL functions, is there another PHP mysql api function I should use.

For example, right now I use a "workaround" technique from PHPBuilder:
$result=mysql_query("SELECT COUNT(*) FROM tablename");
list($numrows)=mysql_fetch_row($result);

Rather than using this "workaround" code is there a way to simply assign the result of the MySQL function query to a variable.

$result=mysql_query("SELECT COUNT(*) FROM tablename");
$numrows=mysteryfunction($result);

View Replies !
Chmode With Mkidir Function, The Result Isn't As Expected
I've tried to create a directory with the php function mkdir(). I've used a "0777" mode , so that owner,group and other can read,write and exectue files in this directory.
There's no problem creating the directory, but after it has been created, its mode is "0755".

Where did I commit a mistake ?

View Replies !
Using The Function Prevents Accessing The Result Of The Match.
I don't know if this is possible, but it should be. However, it doesn't seem to be working for me. how I can get it to work:

I use :||: for my delimiter for str_replace, etc.

When replying, the new PM is appended in front of the existing chain of replies, thus the same table entry is used and updated each time. Problem is in storing the sent date, and providing time zone and format adjustments:

$string='This is the message that was sent on :|1161850848|:'

$newString=preg_replace('/([0-9]*)/',format_time(adjust_time('${1}')),$string);
// the result of this is as if ${1} = 0

$newString=preg_replace('/([0-9]*)/','${1}',$string);
// returns 'This is the message that was sent on 1161850848'

It seems that using the function prevents accessing the result of the match.

View Replies !
Search Function That Highlight Result Instead Of Filtering It Out
I am trying to create a search function that will jump to the page containing the result and highlight it instead of filtering it out. To more clearly illustrate what I mean take a look at this link:

I would like to search for eg. "bruce wayne" (its record number 30) and just have that row highlighted. Anybody who could steer me in the right direction would be a massive help as I've spent the last 2 days trying to work this out with no joy.

View Replies !
How To Cache A File Into Client's Cache?
My site is a bit slow and I wonder if I can explicitly cache A file (image) into client's cache (temporary files).

View Replies !
Function To Test If Mysql_fetch_array($result) Pointing Last Record?
I try to perform multiple insert statment, but the problem is in the below codes, the last sql concatenation ends with ",". I wonder if there is any php function to test if the $result set contains the last record.

------------------
//Get topic id of vote_topic from last insert record
$sql_topic_id = "SELECT topic_id FROM vote_topic ORDER BY topic_id DESC LIMIT 1";
$result = mysql_query($sql_topic_id,$conn);
$row = mysql_fetch_array($result);

//Get all student info from stuinfo
$sql_strn = "SELECT strn from stuinfo";
$result1 = mysql_query($sql_strn,$conn);

//Dump all student strn into vote_status.
//Multiple insert statement? How?
$sql2 = "INSERT INTO vote_status (strn,topic_id) VALUES ";
while ($row1 = mysql_fetch_array($result1)){
$sql2 .= "VALUES ('".$row1[strn]."','".$row[topic_id]."'),";}
mysql_query($sql2,$conn);
---------------------

View Replies !
Warning: Session_start() [function.session-start]: Cannot Send Session Cache Limiter
I upgraded from PHP 4 to PHP 5 recently, and this code was working on PHP 4 but it isnt anymore. It came up with this error:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/jonoc33/public_html/clansolutions/members/inc/top.php:5) in /home/jonoc33/public_html/clansolutions/members/menu.php on line 3

Warning: Cannot modify header information - headers already sent by (output started at /home/jonoc33/public_html/clansolutions/members/inc/top.php:5) in /home/jonoc33/public_html/clansolutions/members/menu.php on line 6

The code that contains line 3 and 6 is this:

<?
include("inc/top.php");

Should I ask to downgrade to PHP 4?

View Replies !
Warning: Session_start() [function.session-start]: Cannot Send Session Cache Limiter - Session_destory();
I'm getting this error: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent ... output started at blah blah blah.... on line 1.

Line one is <?php session_start();

This page is a login and logout page. I use session_destory(); to log the user out when a link is clicked. It redirects them to this page, with a ?action=logout in the url. I use $_GET to test if action == logout, and if it does, it calls session_destory(); and then uses javascript to redirect the user after 5 seconds to the homepage.

what does the error mean, I've seen it before, but for some reason it's not comming to me.

View Replies !
Login Script - Warning: Session_start() [function.session-start]: Cannot Send Session Cache Limiter
I'm working on a PHP login script that queries a mysql database for the proper authentication. I'm using cookies to mandate the session, and I keep getting this error.

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent in /services/index.php on line -695985749 Code:

View Replies !
Header() Function
I have an hectic with header() function. Many times i used
header() function. But this time i encountered some problem.

I coded as
header("Location: myaccount.php?suc=password changed
successfully");

This redirects the page to
myaccount.php?suc=password

instead of
myaccount.php?suc=password
changed successfully

This is working as we expect in my local apache server. But, this
occurs when i uploaded to the remote server.

I dont know why this is.

View Replies !
Add The Last Header Function
I am having a hard time with the header function.. if you look at the script below, both the 2 first header functions work no problem upon given cirumstances.. but as soon as I add the last header function, the first header function does not work.. it always reverts to the last header..  what am i doing wrong? Code:

View Replies !
Header Function
im buildin a log in page that u write the user name ans password then its direct u to another page i use the header function to accomplish this but its give an warning

Warning: Cannot modify header information - headers already sent by (output started at C:xampphtdocslogin.php:16) in C:xampphtdocslogin.php on line 38)

so it only work when i put in the top of the script which make me unable to check if the user logged in and i wanna it inside if statment block so i can check the users login data
so what to do?

View Replies !
Warning: Session_start() [function.session-start]: Cannot Send Session Cache Limiter - Headers Already Sent (output Started At
I found a wonderful Captcha script and it works wonderfully, except when i use include to put it into another file...
I get this error message:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/user/public_html/index.php:12) in /home/user/public_html/securimage.php on line 386
After some short research here it appears that this happens because there is already HTML output in the main page..

I am using the include function to add it (the form) to the regular index.php page.... Do I need to add something in the headers to prevent this? Code:

View Replies !
Warning: Mysql_result() [function.mysql-result]: Unable To Jump To Row 0
i want to grab the value of a sql entry. but the thing is, sometimes this value is <NULL>. i thought, no biggy, i'll just have an if statement:

if (is_numeric(mysql_result($query, 0))) {
//do something
} else {
//do something else using mysql_result($category_id_query, 0);
}

however, this doe not work. i get this error: Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 is there a way to check to see if mysql_result() is <NULL> without throwing an error.

View Replies !
Warning: Session_start() [function.session-start]: Cannot Send Session Cache Limiter - Headers Already Sent (output Started At C:xampphtdocsestprocessUpload.php:4)
I just installed Xampp as its the only way i can get PHP, mySql and phpMyAdmin to work on vista. I have code which normally works on another machine but now im getting this error. Code:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:xampphtdocs estprocessUpload.php:4)

Any ideas why i would be getting this error now?

View Replies !
Header Function Into Html
i am trying to put an header function into html, but it doesn't work. Am I put the function wrong or what? Below is my script.

<? header("Cache-Control: no-cache, must-revalidate");?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

View Replies !
PHP Header() Function Not Working
I have the following :

<?php
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
?>

Code:

View Replies !
Is There A Function To Unset A Header?
I'm trying to prevent the server from automatically putting in the "Content-Encoding: gzip" header since it is in fact incorrect. Instead, I would take care of this myself so that "Transfer-Encoding: gzip" is used for browsers which actually follow the standard correctly (apparently only Opera, but nonetheless).


View Replies !
Header Function Disfunction
i got this script here that refuses to work as i intended. it registers a session key and then redirects the user to a welcome page. all this after choosing form a form and clicking a link/button. but the redirection does not work, keeps coming back to page where the user selects from a form and submits (the first page from which the script is called).

<?php

session_start();

header("Cache-control: private"); // IE 6 Fix.

// Get the user's input from the form
$skin = $_POST['skin'];

// Register session key with the value
$_SESSION['name'] = $skin;

header('location:http://localhost/welcome.php3');
?>

View Replies !
Header Readirect Function
i was wondering if its possible to return after posting something. For example,if a user posts comments how would it redirect to that page if that page had a certain id. My website has blogs and people will click the link which will show that blogs id.

View Replies !
Header Function Not Sending
I've always used Javascript to do a redirect, but I wanted to try this way and it isn't working. Code:

View Replies !
Header Function And Frames
Ive had a look round the net but can't find what Im looking for, I have a page within a frame that I want to redirect, the thing is I would like to redirect to the entire window target=_parent or something? Can this be done with the header function.

header("location: admin/admin.php");

View Replies !
Why Code Continues Even After The Header() Function?
I used header("location: http://google.com");
then I used session_start().

Why did session-start() execute if the page already went someplace else. is this always the case?

View Replies !
Redirect The Other Window With Header Function
I've got a small problem. On my site there's a news section (window 1) and people can react to the news. A small window (windows 2) with a form will popup. After submitting the form I want to close the small window and refresh the NewsWindow (window 1) contents.

View Replies !
Header Function - Breaking Out Of A Frame
I can create a plain htm link and have the new page break out of frames. a href='page.html' target='_top' Can this be done with a Header redirect in php?

View Replies !
The Right Time To Call The Header() Function
When is the right time to call the header function? Should it proceed the session_start() function?

View Replies !
Main Application Of Header() Function
what is the main application of header() function in php.........plz
explain in clear and depth

........

View Replies !
Header Function To Redirect A Page
I am using the header function to redirect a page. Which works great except when I want to send info to the redirected page.

example:
2 pages
a.php
b.php


If I am on page a.php which has a form on it and I hit submit there which normal refreshes back to its self but one of the check boxes are checked I have it redirecting to page b.php. The redirect works great but I would also like the rest of the variables that where submitted in the form to be accessed on page b.php.

Is that at all possible?

View Replies !
Download File Without Header() Function
I am currently working on a little application that offers the user a chance to either view the results of their query on the screen or to download a .csv file. I was wondering how i can deliver the file to the browser without using the header() function as i have already outputted heaps of stuff to the screen (html headers, page divs for formatting etc etc)... Google always seems to point me to someone simply crowing about the header() function.. is there any other way to do this?

View Replies !
Use The Header(); Function To Redirect To Other Pages
I've been trying to use the header(); function to redirect to other pages such as... Login not successful *redirects to login page*. but whenever i try to use the header it says that its being used by another line already. and no where in my code is there another line like it. what does this error mean and how do i fix it?

View Replies !
Header Function And Reloading Of Page
i don't understand about the header function. I have a script that downloads files from my server. How i have it now is that the file name is a link to the same page with a variable appended telling it to download the file.

when i click the link the file does download but the page doesn't reload and the attached variables aren't in the URL. the reason i want the page to reload is that everytime the file is downloaded it updates my mysql database telling it how many times it has been downloaded, and i want the new value to be displayed. Code:

View Replies !
Problem With Header("Location:.. Function
I am trying to use the following function:

header("Location: http://www.mysite.co.uk/home/update/index.php");

....but getting the following error:

Warning: Cannot modify header information - headers already sent by
(output started at
/data/httpd/VirtualHosts/www/htdocs/home/update/index.php:12) in
/data/httpd/VirtualHosts/www/htdocs/home/update/index.php on line 124

Is there any reason why I am getting this error? One concern of mine
was that the header function was not at the top of the page (line 1),
does this matter? I need this command to run a series of statements and
depending on specific conditions, redirect the user to another page.

View Replies !
Calling A Function After Sending Header Information
On my site, users can only download the same file once a month. I use direct link masking so that the user cant see the actual direct link of the file. When the user clicks on the download link next to the file, i run the following: Code:

View Replies !
Mail Function Showing Header Info
I am using a standard mail function within an AMFPHP Class that i have used many times. Now, when i use it it does not work right. When a mail is sent, the $header info and html shows in the email.

I would like to know why the header info is showing in the email, along with why the HTML code is not rendering. I will post examples of code and result. Please provide a solution b4 i pull my hair out. Code:

View Replies !

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