It looks like you're new here. If you want to get involved, click one of these buttons!
class Contactus extends CI_Controller {
function __construct()
{
parent::__construct();
}
function index()
{
$this->load->helper('form');
if (!empty($_POST) AND $_SERVER['SERVER_ADDR'] == $_SERVER['REMOTE_ADDR'])
{
// put your processing code here... we show what we do for emailing. You will need to add a correct email address
if ($this->_process($_POST))
{
$this->session->set_flashdata('success', TRUE);
redirect('contactus');
}
}
// use Fuel_page to render so it will grab all opt-in variables and do any necessary parsing
$page_init = array('location' => 'contactus');
$this->load->module_library(FUEL_FOLDER, 'fuel_page', $page_init);
$this->fuel_page->render();
}
function _process($data)
{
if($this->input->post('nospam') != ''):
return FALSE;
else:
$this -> load -> library( 'form_validation' );
$this -> form_validation -> set_error_delimiters('<div class="error">', '</div>');
$this -> form_validation -> set_rules( 'firstName', 'First Name', 'required|min_length[2]' );
$this -> form_validation -> set_rules( 'lastName', 'Last Name', 'required|min_length[2]' );
$this -> form_validation -> set_rules( 'email', 'Email', 'required|valid_email' );
$this -> form_validation -> set_rules( 'message', 'Message', 'required' );
if ( $this -> form_validation -> run() === TRUE )
{
$this->load->library('email');
$this->load->helper('inflector');
// send email
$this->email->from($data['email'], $data['firstName'] . ' ' . $data['lastName']);
/*********************************************************************
YOU MUST FILL OUT THE CORRECT dev_email config in application/config/MY_config.php
AND/OR THE CORRECT TO email address
*********************************************************************/
// check config if we are in dev mode
if ($this->config->item('dev_mode'))
$this->email->to($this->config->item('dev_email'));
else
// need to fill this out to work
$this->email->to('info@test.com');
$this->email->subject('Highland Website Contact Form');
$msg = "<p>The following information was submitted:\n</p>";
foreach($data as $key => $val)
{
if(humanize($key, 3) != 'Send' && humanize($key, 3) != 'Nospam')
$msg .= '<p>' . humanize($key, 3).": ".$val."\n</p>";
}
$this->email->message($msg);
// let her rip
if (!$this->email->send())
{
add_error('There was an error notifying');
return FALSE;
}
return TRUE;
}
endif;
}
}
Comments
Is there a way for me to check what did I download? And if I downloaded the 1.0 beta do I need to redo everything that I've done?
Also, how did you download the file?
I fixed the problem by reinstalling fuel from a different file I've downloaded, but it looks like the last one in Git is broken?
daylightstudio-FUEL-CMS-v0.9.3-168-gb3bef76.zip
and not the one that had problems which is:
daylightstudio-FUEL-CMS-v0.9.3-1194-gea4de59.zip
Very strange.