diff --git a/db/lamp.sql b/db/lamp.sql index 7cfa85c..26c2979 100644 --- a/db/lamp.sql +++ b/db/lamp.sql @@ -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 # ************************************************************ @@ -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; @@ -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; diff --git a/db/lamp.sql.zip b/db/lamp.sql.zip new file mode 100644 index 0000000..62cc635 Binary files /dev/null and b/db/lamp.sql.zip differ diff --git a/www/application/config/database.php b/www/application/config/database.php index 4d3bb20..b751b34 100755 --- a/www/application/config/database.php +++ b/www/application/config/database.php @@ -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, diff --git a/www/application/controllers/Register.php b/www/application/controllers/Register.php index 64c6a40..ff74a94 100644 --- a/www/application/controllers/Register.php +++ b/www/application/controllers/Register.php @@ -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 !== []){ @@ -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 { diff --git a/www/application/models/User_Info_Model.php b/www/application/models/User_Info_Model.php index b9f6aea..6a5509d 100644 --- a/www/application/models/User_Info_Model.php +++ b/www/application/models/User_Info_Model.php @@ -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; } } diff --git a/www/application/views/register.php b/www/application/views/register.php index 47a10f7..1f8541b 100644 --- a/www/application/views/register.php +++ b/www/application/views/register.php @@ -4,6 +4,7 @@
Twitter

Register

+