Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
register end session
  • Loading branch information
Shemona Singh authored and Shemona Singh committed Dec 6, 2017
1 parent 0ffa868 commit 418b1ec
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
32 changes: 28 additions & 4 deletions www/application/controllers/Register.php
@@ -1,16 +1,17 @@
<?php
ini_set('error_reporting', ~E_NOTICE);

class Register extends CI_Controller {
function __Construct(){
parent::__Construct();
$this->load->database(); // load database
$this->load->model('User_Info_Model'); // load model
//$this->output->enable_profiler(TRUE);
session_start();
}

public function index(){
$this->load->helper(array('form', 'url'));

$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');

$this->form_validation->set_rules('firstname', 'First Name', 'required');
Expand All @@ -31,9 +32,32 @@ class Register extends CI_Controller {
// https://www.codeigniter.com/user_guide/libraries/form_validation.html#callbacks-your-own-validation-methods

// add user to db, launch session, send to home

else {
$this->User_Info_Model->addUser();
redirect('/all_tweets');
//add user to db
$user = $this->User_Info_Model->addUser();
$data['user'] = $user;
//get user id, launch session, send to home
if($user !== []){
$this->session->set_userdata($user);
$data = $this->session->all_userdata();

//$this->load->view('login', $data);
redirect('/All_Tweets');
}
// if no, refresh register
else {
$this->load->view('templates/header');
$this->load->view('register', $data);
}

}







}
}
8 changes: 4 additions & 4 deletions www/application/views/home.php
Expand Up @@ -12,10 +12,10 @@ error_reporting(0);

<?php $this->load->library('form_validation'); ?>
<form class="form" action="/index.php/all_tweets/search_keyword" method="post">
<div class="form-group">
<input type="text" name="keyword" class="form-control" placeholder="What would you like to find?">
</div>
<button class="btn btn-primary" type="submit" value="Search">Search</button>
<div class="form-group">
<input type="text" name="keyword" class="form-control" placeholder="What would you like to find?">
</div>
<button class="btn btn-primary" type="submit" value="Search">Search</button>
</form>
<!-- DISPLAY ERROR IF NO SEARCH RESULTS FOUND -->
<?php
Expand Down
1 change: 1 addition & 0 deletions www/css/styles.css
Expand Up @@ -80,6 +80,7 @@ img.icon.reg {
margin-top:0!important
}


.row {
margin-left: 0px;
}
Expand Down

0 comments on commit 418b1ec

Please sign in to comment.