[eluser]got 2 doodle[/eluser]
OK, I'm back to posting to my thread. The dedicated ssl certificate has been configured and installed. Now I can remove the index.php with a simple .htaccess file (I couldn't figure out how to deal with the shared ssl configuration in the .htaccess)
Anyway a new quirk has popped up, In my registration controller I was checking that the connection was actually secure by checking the port number. I wanted to guarantee that there was no way the form could be shown if the connection was not secure. I also needed to know how the user came to be at the registration controller, ie: have they selected a product yet or do we give them a choice of products. Up until the dedicated certificate was installed I just checked for port 443 but now the port number is 12198 so I check for either possible port. I have asked my hosting company if the port will always be the same. Here's the code that checks the port.
Code:
// check if this is by program
if(isset($_POST['by_program'])) {
if( $_SERVER['SERVER_PORT'] == '443' or $_SERVER['SERVER_PORT'] == '12198'){
$program_id = $_POST['program'];
secure_redirect('/register/program/'.$program_id.'/', 'refresh');
} else { secure_redirect('/register/', 'refresh') ;}
} else {
// not by program
if( !$_SERVER['SERVER_PORT'] == '443' or !$_SERVER['SERVER_PORT'] == '12198'){ secure_redirect('/register/', 'refresh') ;}
}
// no program selected
if($this->uri->segment(3) == '') { secure_redirect('/register/', 'refresh'); }
so this is working but only on two ports (443 and 12198)
Does anyone know about this port 12198 thing!!
Also I made a change that makes it easier to work between local and remote installations.
I set a constant in index.php
Code:
/*
|---------------------------------------------------------------
| DEFINE APPLICATION CONSTANTS
|---------------------------------------------------------------
|
| EXT - The file extension. Typically ".php"
| FCPATH - The full server path to THIS file
| SELF - The name of THIS file (typically "index.php)
| BASEPATH - The full server path to the "system" folder
| APPPATH - The full server path to the "application" folder
|
*/
define('SERVER_LOCATION','local'); /* local or remote */ <--- new constant
define('EXT', '.'.pathinfo(__FILE__, PATHINFO_EXTENSION));
define('FCPATH', __FILE__);
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
define('BASEPATH', $system_folder.'/');
My thinking was that index.php rarely changes once it's been uploaded to the server.
Now in config/config.php
Code:
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://www.your-site.com/
|
*/
switch (SERVER_LOCATION) {
case 'local';
$config['index_page'] = "";
$config['base_url'] = "http://".$_SERVER['SERVER_NAME'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
$config['secure_base_url'] = "https://".$_SERVER['SERVER_NAME'];
$config['secure_base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
break;
case 'remote';
$config['index_page'] = "";
$config['base_url'] = "http://tatacentre.ca/";
$config['secure_base_url'] = "https://tatacentre.ca/";
break;
}
Just thought I would share this last bit, so far it seems like a good idea.
doodle