[eluser]Darker[/eluser]
http://109.235.69.39/ci/register
click "register" and you can see...
Why ?
register.php controller
Code:
<?
class Register extends CI_Controller {
public function index() {
$this->load->library('form_validation');
$this->form_validation->set_rules('first_name', 'First name', 'required');
$this->form_validation->set_rules('last_name', 'Last name', 'required');
$this->form_validation->set_rules('username', 'Username', 'callback_checkuser');
$this->form_validation->set_rules('password', 'Password', 'required');
$this->form_validation->set_rules('password2', 'Password Confirmation', 'required');
$this->form_validation->set_rules('email', 'Email', 'required');
$this->form_validation->set_rules('country', 'Country', 'required');
$this->form_validation->set_rules('city', 'City', 'required');
$this->form_validation->set_rules('date_of_birth', 'Date of birth', 'required');
$this->form_validation->set_rules('agree', 'You must check "I agree with terms and conditions"', 'required');
if ($this->form_validation->run() == FALSE) {
$data['action'] = "";
} else {
$data['action'] = "register_success";
}
$data['page'] = 'pages/register_view';
$data['temporary_data'] = $data;
$this->load->view('main_view', $data);
}
function checkuser($username) {
$this->load->model('user_model');
$exists = $this->user_model->ifUserExists($username);
if ($exists) { return FALSE; } else { return TRUE; }
}
}
?>
register_view.php view
Code:
<?
print_r($temporary_data);
if ($action == "register_success") {
?>
<h2>Success!</h2>
Congratulations, registration successful. We sent you an email with account confirmation link.
<?
} else {
$this->load->helper('form');
echo form_open(base_url() . 'register');
?>
<strong>Fill in registration form</strong>
<br /><br />
First name:<br />
<? echo form_input('first_name'); ?>
<br />Last name:<br />
<? echo form_input('last_name'); ?>
<br />Username:<br />
<? echo form_input('username'); ?>
<br />Password:<br />
<? echo form_password('password'); ?>
<br />Confirm password:<br />
<? echo form_password('password2'); ?>
<br />E-mail address:<br />
<? echo form_input('email'); ?>
<br />Country:<br />
<?
$options = array(
'0' => '-- none --', '1' => 'Lithuania',
'2' => 'Latvia', '3' => 'Estonia');
echo form_dropdown('country', $options, 'Lithuania');
?>
<br />City:<br />
<? echo form_input('city'); ?>
<br />Date of birth:<br />
<? echo form_input('date_of_birth'); ?>
<br /><br />
<? echo form_checkbox('agree', '1', TRUE); ?>
I agree with terms and conditions
<br /><br />
<?
echo form_submit('submit', ' Register ');
echo form_close();
}
?>
Thanks for you help.