Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
registration sessions
  • Loading branch information
Shemona Singh authored and Shemona Singh committed Dec 6, 2017
1 parent e8c8469 commit ff101aa
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 9 deletions.
7 changes: 3 additions & 4 deletions db/lamp.sql
Expand Up @@ -7,7 +7,7 @@
#
# Host: 127.0.0.1 (MySQL 5.7.20)
# Database: lamp
# Generation Time: 2017-12-06 01:23:04 +0000
# Generation Time: 2017-12-06 03:52:18 +0000
# ************************************************************


Expand All @@ -28,7 +28,7 @@ DROP TABLE IF EXISTS `Tweets`;
CREATE TABLE `Tweets` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`tweet` char(140) DEFAULT NULL,
`date_time` datetime DEFAULT CURRENT_TIMESTAMP,
`date_time` timestamp NULL DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Expand Down Expand Up @@ -56,8 +56,7 @@ VALUES
(21,'my favorite slang word is swag','2017-12-05 17:12:49',1),
(22,'lettuce is a healthy vegetable','2017-12-05 18:36:51',2),
(23,'I wish I was a DMD major','2017-12-05 18:48:39',1),
(24,'PHP is my favorite language','2017-12-05 19:52:54',1),
(25,'I love twitter!','2017-12-05 23:49:05',2);
(24,'PHP is my favorite language','2017-12-05 19:52:54',1);

/*!40000 ALTER TABLE `Tweets` ENABLE KEYS */;
UNLOCK TABLES;
Expand Down
Binary file added db/lamp.sql.zip
Binary file not shown.
8 changes: 4 additions & 4 deletions www/application/config/database.php
Expand Up @@ -78,10 +78,10 @@ $query_builder = TRUE;

$db['default'] = array(
'dsn' => '',
'hostname' => 'database',
'username' => 'lamp',
'password' => 'lamp',
'database' => 'lamp',
'hostname' => 'external-db.s161944.gridserver.com',
'username' => 'db161944_web3_17',
'password' => 'f8-N8r*qY*m',
'database' => 'db161944_shs12010',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
Expand Down
3 changes: 3 additions & 0 deletions www/application/controllers/Register.php
Expand Up @@ -36,6 +36,7 @@ class Register extends CI_Controller {
else {
//add user to db
$user = $this->User_Info_Model->addUser();

$data['user'] = $user;
//get user id, launch session, send to home
if($user !== []){
Expand All @@ -44,6 +45,8 @@ class Register extends CI_Controller {

//$this->load->view('login', $data);
redirect('/All_Tweets');
$this->load->view('templates/header');
$this->load->view('register', $data);
}
// if no, refresh register
else {
Expand Down
10 changes: 9 additions & 1 deletion www/application/models/User_Info_Model.php
Expand Up @@ -26,7 +26,15 @@ class User_Info_Model extends CI_Model {
'location' => $this->input->post('location')
);

return $this->db->insert('Users', $data);
$this->db->insert('Users', $data);

$this->db->select('*');
$this->db->from('Users');
$this->db->where('username', $this->input->post('username'));
$this->db->where('password', $this->input->post('password'));
$query = $this->db->get();
$result = $query->result_array()[0];
return $result;
}

}
1 change: 1 addition & 0 deletions www/application/views/register.php
Expand Up @@ -4,6 +4,7 @@
<div class="login register container">
<img class="icon reg" src="../img/twitter.png" alt="Twitter">
<h1>Register</h1>
<?php echo gettype($user); ?>
<div class="form-group">
<label for="firstname">First Name</label>
<input class="form-control" type="text" name="firstname" value="<?php echo set_value('firstname'); ?>"/>
Expand Down

0 comments on commit ff101aa

Please sign in to comment.