[eluser]anna16[/eluser]
Guys can you help me spot the not.
The error,
Code: Parse error: syntax error, unexpected '`', expecting ';' or '{' in /home/coder9/public_html/ci172x/application/controllers/membership/site.php on line 28
The controller site.php
Code: <?php
class Site extends Controller
{
//function __construct()
function Site()
{
parent::Controller();
$this->load->library('session');
$this->load->helper('form');
$this->load->helper('url');
$this->load->model('membership/membership');
}
function register_form()
{
$data = array();
$data['email'] = '';
$data['username'] = '';
$data['password'] = '';
$data['message_email_existence'] = '';
$data['message_username_existence'] = '';
$this->load->view('membership/register_form', $data);
}
function register_account() ``
{
$this->load->library('form_validation');
$data['email'] = $this->input->post('email');
$data['username'] = $this->input->post('username');
$data['password'] = $this->input->post('password');
$data['ip'] = $this->input->ip_address();
$data['date_registered'] = date("Y-j-n-");
#$data['date_registered'] = '2010-31-31';
#$data['date_registered'] = '';
$data['confirm'] = 'no';
//check for email validity, clean malicious data and duplicate
$this->form_validation->set_rules('email', 'Email', 'required|valid_email|xss_clean');
#$this->form_validation->set_rules('email', 'Email', 'callback_email_check');
//check for username validity, clean malicious data and duplicate
$this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[4]|max_length[12]|xss_clean');
$this->form_validation->set_rules('username', 'Username', 'callback_username_check');
$this->form_validation->set_rules('password', 'Password', 'required|matches[confirm]');
$this->form_validation->set_rules('confirm', 'Password Confirmation', 'required');
if ($this->form_validation->run() == FALSE) //display the registration form again if invalid data is encountered.
{
$this->load->view('membership/register_form', $data);
}
else
{
//add record and display success page
$this->membership->register_account($data);
$this->send_activate_email($data);
$this->load->view('membership/register_success', $data);
}
}
function username_check($str)
{
$username_exist = $this->membership->get_username($str);
if($username_exist == TRUE)
{
$this->form_validation->set_message('username_check', 'Sorry this username is already been use.');
return FALSE;
}
else
{
$this->form_validation->set_message('username_check', 'This username is available.');
return TRUE;
}
}
function send_activate_email($data)
{
$this->load->library('email');
$this->email->from('[email protected]', 'Admin');
$this->email->to($data['email']);
$this->email->subject('Activate your account');
$this->email->message('Pleae click the link below to activate your account at samplesite.com');
#$this->email->set_alt_message('Pleae click the link below to activate your account at samplesite.com<br><a href="coder9.com">click here</a>');
$this->email->send();
}
/* ************************************* */
/* Below are for testing purpose only. */
/* ************************************* */
function email_test()
{
$config = Array(
'protocol' => 'mail',
'smtp_host' => 'mail.coder9.com',
'smtp_port' => 25,
'smtp_user' => '[email protected]',
'smtp_pass' => 'asdf1234',
'mailtype' => 'html'
);
$this->load->library('email', $config);
$this->email->from('[email protected]', 'Admin');
$this->email->to('[email protected]');
$this->email->subject('Activate your account - email test');
$this->email->message('<b>Pleae click the link below to activate your account at samplesite.com</b><br>user: <br>pass: <br><br><a href="http://www.coder9.com">click here</a>');
$this->email->send();
}
function show_username()
{
$this->load->model('membership/membership');
$data['username_exist'] = $this->membership->get_username_test();
echo 'username_exist '. $data['username_exist'];
#$this->load->view('membership/register_form', $data);
}
//test boolean
function show_return()
{
$name = TRUE;
echo 'true: '. $name;
echo '<br>';
$name = FALSE;
echo 'false: '. $name;
}
//test echo
function echo_test()
{
$no = 45;
echo 'value: ', $no;
}
function register_success()
{
$this->load->view('membership/register_success');
}
}
//end of class
Thanks in advanced.
|