Joomlatwork
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 20, 2013, 04:48:38 AM

Login with username, password and session length
Search:     Advanced search
16035 Posts in 5274 Topics by 10994 Members
Latest Member: Imminnics
* Home Help Search Login Register
+  Joomlatwork
|-+  Joomla accelerate component
| |-+  Support questions
| | |-+  Stop page from being cached
« previous next »
Pages: [1] Print
Author Topic: Stop page from being cached  (Read 1674 times)
ljk
Newbie
*
Posts: 8


View Profile Email
« on: January 11, 2008, 02:51:42 AM »

Hello,

Our pages on our site have a form on them which when submitted go to "content/view/261/1/". The form has 2 fields and both are autofilled in for the user. The page "content/view/261/1/" is running a php script that if the first field is not blank, goes to another website. What we are finding is that sometimes when you submit the form we go to the external website (what is supposed to happen) but many times we just go to this page: content/view/261/1/ and get the form showing up again, which happens when the first field is not filled in.

On our pages we have:
Code:
            <form action="content/view/261/1/" method="post">
              Enter  e-mail:
              <input name="email" type="text" style="width:100px; margin:0" value="demo"  />
              <br />
              Enter  password:
              <input name="Password" type="password" style="width:100px; margin:0" value="choice"  />
              <input type="hidden" name="TargetReferral" value="<?php echo $row[0]->cb_referralvaultid ?>" />
              <input type="hidden" name="VendorId" value="1" />
              <input type="hidden" name="ProfileId" value="<?php echo $row[0]->cb_profileid ?>" />
              <br />
              <input type="submit" name="Submit" value="Send Referral" style="width:100px; margin:0" />
              <br />
            </form>

and on "content/view/261/1/" page we have:
Code:
$email = strval( mosGetParam( $_REQUEST, 'email', '' ) );
$errorstr = '';
if ( $email ) {
header ('Location: http://xxx.net/HCReferralSender2.aspx?SourceID=12&TargetID=12&VendorID=1&ProfilePageID=250');
}
       <form action="content/view/261/1/" method="post">
         Enter your e-mail address:
         <input type="text" name="email" style="width:100px; margin:0"  /><br />
         Enter your password:
         <input type="password" name="Password" style="width:100px; margin:0"  />
         <input type="hidden" name="TargetReferral" value="<?php echo $row[0]->cb_referralvaultid ?>" />
         <input type="hidden" name="VendorId" value="1" />
         <input type="hidden" name="ProfileId" value="<?php echo $row[0]->cb_profileid ?>" />
         <br />
         <input type="submit" name="Submit" value="Send Referral" style="width:100px; margin:0" /><br />
     
       </form>

I have tried entering under URL parts that may not be cached:
Code:
id=261
/261/1

I have looked in the Repository but can not find page: content/view/261/1/

Any ideas of what else to try to get this form to function correctly?

Thanks.
Logged
joomlatwork
Administrator
Hero Member
*****
Posts: 2817


View Profile Email
« Reply #1 on: January 11, 2008, 07:41:44 AM »

This is because the action is a POST. In your cache configuration you can enable/disable POST actions to be cached. In your case this must disabled.

- Another solution is to manually add the specific page into the cache repository and then disable the URL from be cached.

Which cache version are you using? In the release 2.0 you can define actions whereby the cache can be bypassed and a disable cache cookie can be set. In this case add an hidden field for example:
<input type="hidden" name="setbypasscache" value="bypass" />

In your cache config add in the Set the bypass cache cookie if the following actions are set: field:
setbypasscache=bypass

Regards,

Richard

Logged
ljk
Newbie
*
Posts: 8


View Profile Email
« Reply #2 on: January 11, 2008, 06:32:49 PM »

Hello,

We have 1.0B, we just got the cache component last month. Is version 2 a free upgrade to what we got?

We already have POSTS to be cached set to No.

I tried adding the page to the repository and set it not to be published/cached, but I am still getting the same results.

Any other ideas?

Thank you for your help.

Logged
joomlatwork
Administrator
Hero Member
*****
Posts: 2817


View Profile Email
« Reply #3 on: January 11, 2008, 09:42:04 PM »

Yes, the upgrade is free.

You can download it from:  http://www.joomlatwork.com/component/option,com_login/Itemid,44/

What you can do is add the following code into the index.php file:

Code:
if ( strpos( $_SERVER['REQUEST_URI'], "content/view/261/")) {
setcookie("bypass_cache", "true", time()+ $cache_TTL, "/");
        $bypass_cache = true;
}

After the block:

Quote
if ( strpos( $_SERVER['REQUEST_URI'], "comprofiler")) {
   setcookie("bypass_cache", "true", time()+ $cache_TTL, "/");
   if ( $is_debug ) {
      $debug_out = $debug_out . "<br/>Bypassing cache because LOGIN POST";
   }
   $bypass_cache = true;   
}

This should disable the cache for the specific URL.... although it's a POST. Check please your debug output.....

Regards,

Richard
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.12 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!