Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6255901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:27:03+00:00 2026-05-24T14:27:03+00:00

Using CakePHP 1.3 we have a booking system for hotel rooms. A check-availability form

  • 0

Using CakePHP 1.3 we have a booking system for hotel rooms. A check-availability form should bring the user to a secure payment page (https://secure.domain.com/bookings/payment). After making the payment, the user gets a confirmation page (secured is also ok), but from here, any links in our header/footer should take the user back to the non-secured domain (http://domain.com).

Currently we have our SSL UCC Cert set up for the domains https://secure.domain.com and https://domain.com. We have also hard coded the check-availability form to run the action https://secure.domain.com/bookings/payment. Thus, we can get the user to get in to the HTTPS secured area, but not back out unless we hard code all our links in that section.

Cake’s security component is quite confusing and thus I am looking for the best solution to make this happen.

Can Cake’s Security component be used for HTTPS payment pages, make life easier, and keep the code more CakePHP standardized? Any other suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T14:27:04+00:00Added an answer on May 24, 2026 at 2:27 pm

    I used the example from http://techno-geeks.org/2009/03/using-the-security-component-in-cakephp-for-ssl/ but found it problematic. I ended up adding the following to my app_controller.php.

    The code below redirects HTTPS to http://www.example.com and HTTP to example.com. If a user is logged in (see $loggedUser), it forces HTTPS for every connection.

    // Pages requiring a secure connection.
    $secureItems = array();
    
    // beforeFilter
    function beforeFilter() {
        // Your logic...    
        $this->__checkSSL();
    }
    
    /**
     * Check SSL connection.
     */
    function __checkSSL() {
        /** Make sure we are secure when we need to be! **/
        if (empty($this->loggedUser)) {
            if (in_array($this->action, $this->secureItems) && !env('HTTPS')) {
                $this->__forceSSL();
            } 
    
            if (!in_array($this->action, $this->secureItems) && env('HTTPS')) {
                $this->__unforceSSL();
            }
        } else {
            // Always force HTTPS if user is logged in.
            if (!env('HTTPS')) {
                $this->__forceSSL();
            }
        }
    }
    
    /**
     * Redirect to a secure connection
     * @return unknown_type
     */
    function __forceSSL() { 
        if (strstr(env('SERVER_NAME'), 'www.')) {
            $this->redirect('https://' . env('SERVER_NAME') . $this->here);
        } else {
            $this->redirect('https://www.' . env('SERVER_NAME') . $this->here); 
        }
    }
    
    /**
     * Redirect to an unsecure connection
     * @return unknown_type
     */
    function __unforceSSL() {
        if (strstr(env('SERVER_NAME'), 'www.')) {
            $server = substr(env('SERVER_NAME'), 4);
            $this->redirect('http://' . $server . $this->here);
        } else {
            $this->redirect('http://' . env('SERVER_NAME') . $this->here);  
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using CakePHP 1.3 , I have a (working) form that has dynamically created form
Using online interfaces to a version control system is a nice way to have
Using CakePHP: I have a many-to-one relationship, let's pretend it's many Leafs to Trees.
I have used cakePHP 1.2 and know how to use behaviors in it. using
Using cakephp, I have a generic address table, which I want to link to
Using CakePHP 1.3, I have the following layout: /srv/www/_cakephp13/ /app/ /cake/ /plugins/ /vendors/ etc...
I have a PHP application using CakePHP. I need to present a table showing
This site is built using CakePHP 1.2* I have an element that needs to
I have a site set up using CakePHP and MySQL and I want to
I am using cakephp 1.2 and I have an array that appears to have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.