Welcome Guest, Not a member yet? Register   Sign In
SSL in CodeIgnitor
#3

[eluser]got 2 doodle[/eluser]
extend form helper - create the following file /system/application/helpers/my_form_helper.php

Code:
if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Secure Form Declaration
*
* Creates the opening portion of the form.
*
* @access    public
* @param    string    the URI segments of the form destination
* @param    array    a key/value pair of attributes
* @param    array    a key/value pair hidden data
* @return    string
*/    
if (! function_exists('secure_form_open'))
{
    function secure_form_open($action = '', $attributes = array(), $hidden = array())
    {
        $CI =& get_instance();

        $action = ( strpos($action, '://') === FALSE) ? $CI->config->secure_site_url($action) : $action;

        $form = '<form action="'.$action.'"';
    
        if ( ! isset($attributes['method']))
        {
            $form .= ' method="post"';
        }
    
        if (is_array($attributes) AND count($attributes) > 0)
        {
            foreach ($attributes as $key => $val)
            {
                $form .= ' '.$key.'="'.$val.'"';
            }
        }
    
        $form .= '>';

        if (is_array($hidden) AND count($hidden > 0))
        {
            $form .= form_hidden($hidden);
        }
    
        return $form;
    }
}
/*
|--------------------------------------------------------------------------
| Notes Caveats
|--------------------------------------------------------------------------
| Caching: Although it would be ilogical to do so caching a secure page
| would probably break the system.  Probably code should be put in place
| to prevent caching https: pages.
|
|
*/

sorry for the stupidly long post!
I could tolerate some suggestions for this also


Messages In This Thread
SSL in CodeIgnitor - by El Forum - 11-18-2008, 12:48 PM
SSL in CodeIgnitor - by El Forum - 11-18-2008, 12:49 PM
SSL in CodeIgnitor - by El Forum - 11-18-2008, 12:51 PM
SSL in CodeIgnitor - by El Forum - 11-18-2008, 12:53 PM
SSL in CodeIgnitor - by El Forum - 11-19-2008, 06:54 PM
SSL in CodeIgnitor - by El Forum - 11-20-2008, 09:10 AM
SSL in CodeIgnitor - by El Forum - 12-02-2008, 09:14 AM
SSL in CodeIgnitor - by El Forum - 12-11-2008, 02:16 PM
SSL in CodeIgnitor - by El Forum - 01-12-2009, 06:57 PM
SSL in CodeIgnitor - by El Forum - 01-12-2009, 09:57 PM
SSL in CodeIgnitor - by El Forum - 01-13-2009, 10:04 AM
SSL in CodeIgnitor - by El Forum - 01-17-2010, 08:49 PM
SSL in CodeIgnitor - by El Forum - 02-03-2011, 08:31 AM
SSL in CodeIgnitor - by El Forum - 02-04-2011, 06:19 AM
SSL in CodeIgnitor - by El Forum - 03-10-2011, 12:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB