Jump to content

clearing cache


andyd34

Recommended Posts

I am having an issue with ie7 and cant seem to get my head round it as the issue is not present in firefox

 

I am submitting a form and then redirecting back to the form page but the original values are still showing in ie7 until I refresh the page. I have tried adding



header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); 

 

but it hasn't made any difference. This form is loaded via jquery and its in a phpbb3 template file. Can someone please help

Link to comment
https://forums.phpfreaks.com/topic/176230-clearing-cache/
Share on other sites

Are you sure that you are not storing the values somewhere like sessions for example to handle error situations and re-display the values in case of error and then displaying these stored values in the form printing page? The form values should not be present anymore after redirect. I don't think cache is the issue here (I might be wrong also). Maybe show more of your code?

Link to comment
https://forums.phpfreaks.com/topic/176230-clearing-cache/#findComment-928759
Share on other sites

Positive, its just a standard form, its submitting fine and all is well in ie6 and ff3 on windows and ff on ubuntu its just ie7 thats why i cannot figure it out. Anyway here is the code

 

ucp_profile_profile_images.html

<!-- INCLUDE ucp_header.html -->
<script>
$(document).ready(function(){
	$("#load_images").load("./ajax/load_images.php");
});
</script>

<div id="upload" ><span>Upload File<span></div>
<h3 align="center" id="status" ></h3>
<ul id="files" >
</ul>
<br clear="all" />
<div id="load_images"></div>


<!-- INCLUDE ucp_footer.html -->

 

./ajax/load_images.php

 

<?php
/**
*
* @package phpBB3
* @version $Id: index.php 8987 2008-10-09 14:17:02Z acydburn $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
*/

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);


// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');

header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past


$user_id = $user->data['user_id'];


$sql  = "SELECT * FROM phpbb_img_uploads WHERE user_id = '$user_id' ORDER BY file_loaded DESC";
$result =mysql_query($sql);
$records = mysql_num_rows($result);
if($records) {
$i=1;
?>
<form name="img_form" id="img_form" action="./ajax/update_images.php" method="post">
<?
while($row = mysql_fetch_assoc($result)) {
?>
<div style="width:100%" id="image_div_<?=$i?>">
<input type="hidden" id="filename[<?=$i?>]" name="filename[<?=$i?>]" value="<?=str_replace(".jpg", "", $row['file_name'])?>" />
<input type="hidden" id="counter" name="counter" value="<?=$i?>" />
  <table width="100%" bgcolor="#666666" cellpadding="4" cellspacing="1">
    <tr>
      <td bgcolor="#FFFFFF" width="60"><img src="./images/img_uploads/<?=$row['file_name']?>" width="75" /></td>
      <td bgcolor="#FFFFFF" align="center"><table width="90%" cellpadding="4" cellspacing="0">
          <tr>
            <td align="left" width="15">
						<? if($row['file_status']=='public') {?>
							<input type="radio" name="img_status[<?=$i?>]" id="img_status[<?=$i?>]" value="public" checked="checked" />
						<? } else { ?>
							<input type="radio" name="img_status[<?=$i?>]" id="img_status[<?=$i?>]" value="public" />
						<? } ?>
            </td>
            <td align="left">
						Public
					</td>
          </tr>

          <tr style="cursor:pointer">
            <td align="left" width="15">
						<? if($row['file_status']=='friends') {?>
							<input type="radio" name="img_status[<?=$i?>]" id="img_status[<?=$i?>]" value="friends" checked="checked" />
						<? } else { ?>
							<input type="radio" name="img_status[<?=$i?>]" id="img_status[<?=$i?>]" value="friends" />
						<? } ?>
            </td>
            </td>
            <td align="left">
					Friends only
					</td>
          </tr>

          <tr style="cursor:pointer">
            <td align="left" width="15">
						<? if($row['file_status']=='private') {?>
							<input type="radio" name="img_status[<?=$i?>]" id="img_status[<?=$i?>]" value="private" checked="checked" />
						<? } else { ?>
							<input type="radio" name="img_status[<?=$i?>]" id="img_status[<?=$i?>]" value="private" />
						<? } ?>
            </td>
            </td>
            <td align="left">
					Private
					</td>
          </tr>
        </table></td>
      <td width="100" align="center" bgcolor="#FFFFFF">
			<input type="checkbox" name="del[<?=$i?>]" id="del[<?=$i?>]" value="delete"  />
		</td>
    </tr>
  </table>
</div>
<?
$i++;
}
}
else
{
echo "<h1 align='center'>No images on file</h1>";
}
mysql_free_result($result);
?>
<p align="center" style="padding:20px"><input type="submit" id="submit" class="submit" value="update images" /></p>
</form>

 

./ajax/update_images.php

<?php
/**
*
* @package phpBB3
* @version $Id: index.php 8987 2008-10-09 14:17:02Z acydburn $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
*/

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);


// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();


$user_id = $user->data['user_id'];

foreach($_REQUEST as $key => $val) {
$$key = $val;

}

for($i=1; $i <= $counter; $i++) {
$status = $img_status[$i];
$file = $filename[$i] . ".jpg";
if($status=='public' || $status=='friends' || $status=='private')
{
	$sql = "UPDATE phpbb_img_uploads SET file_status = '$status' WHERE file_name = '$file' AND user_id = '$user_id'";

	$result = $db->sql_query($sql);
	header("location: ../ucp.php?i=profile&mode=profile_images");
}
}		
?>

 

If i open ./ajax/load_images.php in ie7 then press f5 and go back to the form page its refreshed until i update it again

Link to comment
https://forums.phpfreaks.com/topic/176230-clearing-cache/#findComment-928771
Share on other sites

Now that I think of it, if it works in all other browsers it should not be a code problem. And the database gets updated as it should when you press submit? Sorry but I don't really know what would be wrong now, all looks ok. Have you tried adding the HTML meta no cache tag to the ucp_profile_profile_images.html?

Link to comment
https://forums.phpfreaks.com/topic/176230-clearing-cache/#findComment-928776
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.