Created
December 29, 2012 21:09
-
-
Save anonymous/4409393 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function signup() { | |
$data['title'] = 'Signup'; | |
$this->load->helper('form'); | |
$this->load->library('form_validation'); | |
$this->load->model('user_model'); | |
$this->form_validation->set_rules('firstname', 'First name', 'required'); | |
$this->form_validation->set_rules('lastname', 'Last name', 'required'); | |
$this->form_validation->set_rules('email', 'Email', 'required|valid_email'); | |
$this->form_validation->set_rules('password', 'Password', 'required'); | |
if ($this->form_validation->run() === FALSE) { | |
$this->load->view('templates/header', $data); | |
$this->load->view('user/signup', $data); | |
$this->load->view('templates/footer'); | |
} else { | |
$this->user_model->createUser(); | |
$this->load->view('templates/header', $data); | |
$this->load->view('user/usercreated'); | |
$this->load->view('templates/footer'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function createUser() { | |
try { | |
$data = array( | |
'first_name' => $this->input->post('firstname'), | |
'last_name' => $this->input->post('lastname'), | |
'email' => $this->input->post('email'), | |
'gender' => $this->input->post('gender'), | |
'birthday' => $this->input->post('birthday'), | |
'bio' => $this->input->post('aboutme'), | |
'password' => $this->input->post('password') | |
); | |
$data['salt'] = $this->saltCreate($data['email']); | |
$data['password'] = $this->passwordHash($data['password'], $data['salt']); | |
} catch (Exception $e) { | |
echo $e->getMessage(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div data-role="content"> | |
<?php echo validation_errors(); ?> | |
<?php echo form_open('user/signup', array('data-ajax' => 'false')) ?> | |
Input fiels with * are mandatory! | |
<div data-role="fieldcontain"> | |
<fieldset data-role="controlgroup" data-mini="true"> | |
<label for="firstname"> | |
First name * | |
</label> | |
<input name="firstname" id="firstname" placeholder="" value="test-<?php echo rand(); ?>" type="text"> | |
</fieldset> | |
</div> | |
<div data-role="fieldcontain"> | |
<fieldset data-role="controlgroup" data-mini="true"> | |
<label for="lastname"> | |
Last name * | |
</label> | |
<input name="lastname" id="lastname" placeholder="" value="test-<?php echo rand(); ?>" type="text"> | |
</fieldset> | |
</div> | |
<div data-role="fieldcontain"> | |
<fieldset data-role="controlgroup" data-mini="true"> | |
<label for="email"> | |
Email * (is your log in) | |
</label> | |
<input name="email" id="email" placeholder="" value="test-<?php echo rand(); ?>@test.de" type="email"> | |
</fieldset> | |
</div> | |
<div data-role="fieldcontain"> | |
<fieldset data-role="controlgroup" data-mini="true"> | |
<label for="password"> | |
Password * | |
</label> | |
<input name="password" id="password" placeholder="" value="test-<?php echo rand(); ?>" type="password"> | |
</fieldset> | |
</div> | |
<div data-role="fieldcontain"> | |
<fieldset data-role="controlgroup" data-mini="true"> | |
<label for="birthday"> | |
Birthday | |
</label> | |
<input name="birthday" id="birthday" placeholder="" value="" type="date"> | |
</fieldset> | |
</div> | |
<div data-role="fieldcontain"> | |
<label for="gender"> | |
Gender | |
</label> | |
<select id="gender" name="gender" data-mini="true"> | |
<option value="male">Male</option> | |
<option value="female">Female</option> | |
</select> | |
</div> | |
<div data-role="fieldcontain"> | |
<fieldset data-role="controlgroup"> | |
<label for="aboutme"> | |
About me | |
</label> | |
<textarea name="aboutme" id="aboutme" placeholder="" data-mini="true"></textarea> | |
</fieldset> | |
</div> | |
<div class="ui-block-b"> | |
<button type="submit" data-theme="a" class="ui-btn-hidden" aria-disabled="false" data-mini="true">Submit</button> | |
</div> | |
</form> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment