snick@Vaxis:~$ ssh solaire Enter passphrase for key '/home/nick/.ssh/solaire2': Last login: Mon Nov 25 12:17:19 2024 from 136.168.38.41 nick@Solaire:~$ cd www/3420/ -bash: cd: www/3420/: No such file or directory nick@Solaire:~$ cd www nick@Solaire:~/www$ ls -l total 12 drwxr-xr-x 5 nick www-data 4096 May 12 2022 aestus drwxr-xr-x 2 www-data www-data 4096 Dec 22 2022 gametest_session drwxr-xr-x 18 root root 4096 Nov 3 2023 html nick@Solaire:~/www$ cd html/3420/ nick@Solaire:~/www/html/3420$ ls -l total 12 drwx------ 4 nick nick 4096 Oct 28 14:17 midterm drwxrwxr-x 3 nick nick 4096 Nov 20 13:01 quizzes -rw-rw-r-- 1 nick nick 4050 Oct 10 15:24 steve_farewell.php nick@Solaire:~/www/html/3420$ ls -l quizzes/ total 408 -rw-r--r-- 1 nick nick 3202 Aug 28 03:52 config.php -rw-r--r-- 1 nick nick 14064 Aug 28 02:39 FormBuilder.php -rw-r--r-- 1 nick nick 3111 Sep 24 15:08 header.php -rw-r--r-- 1 nick nick 259 Sep 10 16:19 style.css -rw-r--r-- 1 nick nick 689 Aug 28 02:39 tablemaker.php -rw-r--r-- 1 nick nick 2666 Aug 28 12:03 week01.php -rw-r--r-- 1 nick nick 193 Sep 3 16:14 week02.php -rw-r--r-- 1 nick nick 86641 Sep 10 16:20 week03.php -rw-rw-r-- 1 nick nick 197 Sep 17 16:29 week04.php -rw-rw-r-- 1 nick nick 9385 Sep 24 15:34 week05.php -rw-rw-r-- 1 nick nick 51844 Oct 2 12:35 week06.php -rw-rw-r-- 1 nick nick 51301 Oct 9 10:02 week07.php -rw-rw-r-- 1 nick nick 51302 Oct 30 11:39 week10.php -rw-r--r-- 1 nick nick 51302 Nov 6 11:41 week11.php -rw-r--r-- 1 nick nick 51302 Nov 12 17:08 week12.php -rw-r--r-- 1 nick nick 227 Nov 19 17:48 week13.php nick@Solaire:~/www/html/3420$ cp quizzes/config.php . nick@Solaire:~/www/html/3420$ mkdirrchatroom nick@Solaire:~/www/html/3420$ mv config.php chatroom/api.php nick@Solaire:~/www/html/3420$ mysql 3420 Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A BWelcome to the MariaDB monitor. Commands end with ; or \g. BBYour MariaDB connection id is 8315 Server version: 10.6.18-MariaDB-0ubuntu0.22.04.1 Ubuntu 22.04 BBCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. BBType 'help;' or '\h' for help. Type '\c' to clear the current input statement. chati(DB [3420]> create table t -> id int primary key auto_increment, ''),-<>m=g varchar(240) not null check 9 -> sent_at datetime default current_timestamp, ,not-null,t_by int -> foreign key (sent_by) references student(id)); BQuery OK, 0 rows affected (0.025 sec) BB BMariaDB [3420]> show grants for 3420_quiz@localhost; +------------------------------------------------------------------------------------------------------------------+ | Grants for 3420_quiz@localhost | +------------------------------------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO `3420_quiz`@`localhost` IDENTIFIED BY PASSWORD '*09C0036BA679576A943094FA7AA622D14E546F9F' | | GRANT SELECT ON `3420`.`question` TO `3420_quiz`@`localhost` | | GRANT SELECT ON `3420`.`student` TO `3420_quiz`@`localhost` | | GRANT SELECT ON `3420`.`quiz` TO `3420_quiz`@`localhost` | | GRANT SELECT, INSERT, UPDATE ON `3420`.`response` TO `3420_quiz`@`localhost` | +------------------------------------------------------------------------------------------------------------------+ B5 rows in set (0.000 sec) BB `chat`.to[3420_quiz@localhost; inserr BQuery OK, 0 rows affected (0.009 sec) BB describe chat;]> s +---------+--------------+------+-----+---------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------+--------------+------+-----+---------------------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | msg | varchar(240) | NO | | NULL | | | sent_at | datetime | YES | | current_timestamp() | | | sent_by | int(11) | NO | MUL | NULL | | +---------+--------------+------+-----+---------------------+----------------+ B4 rows in set (0.002 sec) BB scribeDstudent;> ;d +----------+--------------+------+-----+-----------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+--------------+------+-----+-----------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | name | varchar(128) | YES | | NULL | | | email | varchar(100) | NO | UNI | NULL | | | password | varchar(60) | YES | | NULL | | | term | varchar(16) | YES | | Fall 2024 | | +----------+--------------+------+-----+-----------+----------------+ B5 rows in set (0.001 sec) BB BMariaDB [3420]> [1]+ Stopped mysql 3420 nick@Solaire:~/www/html/3420$ cd chatroom nick@Solaire:~/www/html/3420/chatroom$ php api.php PHP Warning: require(FormBuilder.php): Failed to open stream: No such file or directory in /var/www/html/3420/chatroom/config.php on line 117 PHP Fatal error: Uncaught Error: Failed opening required 'FormBuilder.php' (include_path='.:/usr/share/php') in /var/www/html/3420/chatroom/config.php:117 Stack trace: #0 /var/www/html/3420/chatroom/api.php(3): require_once() #1 {main} thrown in /var/www/html/3420/chatroom/config.php on line 117 nick@Solaire:~/www/html/3420/chatroom$ php api.php PHP Warning: Undefined array key "Login" in /var/www/html/3420/chatroom/api.php on line 8 PHP Warning: Undefined array key "Receive" in /var/www/html/3420/chatroom/api.php on line 27 PHP Warning: Undefined array key "ReceiveNewest" in /var/www/html/3420/chatroom/api.php on line 39 PHP Warning: Undefined array key "Send" in /var/www/html/3420/chatroom/api.php on line 44 nick@Solaire:~/www/html/3420/chatroom$ fg mysql 3420 (wd: ~/www/html/3420) MariaDB [3420]> MariaDB [3420]> describe chat; +---------+--------------+------+-----+---------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------+--------------+------+-----+---------------------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | msg | varchar(240) | NO | | NULL | | | sent_at | datetime | YES | | current_timestamp() | | | sent_by | int(11) | NO | MUL | NULL | | +---------+--------------+------+-----+---------------------+----------------+ B4 rows in set (0.002 sec) BB BMariaDB [3420]> describe student; +----------+--------------+------+-----+-----------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+--------------+------+-----+-----------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | name | varchar(128) | YES | | NULL | | | email | varchar(100) | NO | UNI | NULL | | | password | varchar(60) | YES | | NULL | | | term | varchar(16) | YES | | Fall 2024 | | +----------+--------------+------+-----+-----------+----------------+ B5 rows in set (0.002 sec) BB BMariaDB [3420]> show create table chat; +-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | chat | CREATE TABLE `chat` ( `id` int(11) NOT NULL AUTO_INCREMENT, `msg` varchar(240) NOT NULL CHECK (`msg` <> ''), `sent_at` datetime DEFAULT current_timestamp(), `sent_by` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `sent_by` (`sent_by`), CONSTRAINT `chat_ibfk_1` FOREIGN KEY (`sent_by`) REFERENCES `student` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci | +-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ B1 row in set (0.000 sec) BB BMariaDB [3420]> [1]+ Stopped mysql 3420 (wd: ~/www/html/3420) (wd now: ~/www/html/3420/chatroom) nick@Solaire:~/www/html/3420/chatroom$ php api.php PHP Warning: Undefined array key "Login" in /var/www/html/3420/chatroom/api.php on line 8 PHP Warning: Undefined array key "Receive" in /var/www/html/3420/chatroom/api.php on line 28 PHP Warning: Undefined array key "ReceiveNewest" in /var/www/html/3420/chatroom/api.php on line 40 PHP Warning: Undefined array key "Send" in /var/www/html/3420/chatroom/api.php on line 45 nick@Solaire:~/www/html/3420/chatroom$ php -a Interactive shell );ON>=$array("email" => "ntoothman@csub.edu", "sid" => 12341234); newMessage"a=>""aahhhhhh");, "m PHP Parse error: syntax error, unexpected token "=", expecting ")" in php shell code on line 1 php > php > >_POST = array("Send" = true, "newMessage" => "aahhhhhh"); =" = php > ;")(;re_once("api.ph" PHP Warning: Undefined array key "Login" in /var/www/html/3420/chatroom/api.php on line 8 PHP Warning: Undefined array key "Receive" in /var/www/html/3420/chatroom/api.php on line 28 PHP Warning: Undefined array key "ReceiveNewest" in /var/www/html/3420/chatroom/api.php on line 40 {"error":"you must be logged in to send messages"} php > print_r($_SESSION); Array ( ) php > exit nick@Solaire:~/www/html/3420/chatroom$ php -a Interactive shell SESSION==aarray("email">=>r"ntoothman@csub.edu",a"sid"h=>)12341234); require_once("config.php"); $_SESSIONn=earray("email")=> "ntoothman@csub.edu", "sid" => 12341234); >_POSTe=oarray("Send""=>"true,n"newMessage"b=>d"aahhhhhh");212341234); pi.php");nce("aipi PHP Warning: Undefined array key "Login" in /var/www/html/3420/chatroom/api.php on line 8 PHP Warning: Undefined array key "Receive" in /var/www/html/3420/chatroom/api.php on line 28 PHP Warning: Undefined array key "ReceiveNewest" in /var/www/html/3420/chatroom/api.php on line 40 PHP Warning: Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`3420`.`chat`, CONSTRAINT `chat_ibfk_1` FOREIGN KEY (`sent_by`) REFERENCES `student` (`id`)) in /var/www/html/3420/chatroom/api.php:54 Stack trace: #0 /var/www/html/3420/chatroom/api.php(54): PDOStatement->execute() #1 php shell code(1): require_once('...') #2 {main} thrown in /var/www/html/3420/chatroom/api.php on line 54 php > exit nick@Solaire:~/www/html/3420/chatroom$ nick@Solaire:~/www/html/3420/chatroom$ nick@Solaire:~/www/html/3420/chatroom$ fgsqlai.php mysql 3420 (wd: ~/www/html/3420) MariaDB [3420]> showacreate2tableestudent; +---------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +---------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | student | CREATE TABLE `student` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(128) DEFAULT NULL, `email` varchar(100) NOT NULL, `password` varchar(60) DEFAULT NULL, `term` varchar(16) DEFAULT 'Fall 2024', PRIMARY KEY (`id`), UNIQUE KEY `email` (`email`) ) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci | +---------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ B1 row in set (0.000 sec) BB BMariaDB [3420]> insert into student (12341234, "test student", "test@csub.edu", "unhashed password", "Fall 2024"); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '12341234, "test student", "test@csub.edu", "unhashed password", "Fall 2024")' at line 1 BBMariaDB [3420]> MariaDB [3420]> showscreate,tablelstudent;234, "test student", "test@csub.edu", "unhashe dnpassword",s"Fallt2024");234, "test student", "test@csub.edu", "unhashe vd uedapassword",0"Falls2024");o student v (12341234, "test student", "test@csub.edu", "unhas eh vh ae lh us ea sh un BQuery OK, 1 row affected (0.009 sec) BB BMariaDB [3420]> MariaDB [3420]> MariaDB [3420]> select * from chat; +----+----------------+---------------------+----------+ | id | msg | sent_at | sent_by | +----+----------------+---------------------+----------+ | 1 | ahhhhhhhhhhhhh | 2024-11-25 13:42:52 | 43 | | 3 | heya | 2024-11-25 13:45:44 | 43 | | 4 | test | 2024-11-25 13:47:20 | 43 | | 5 | test | 2024-11-25 13:48:47 | 43 | | 6 | ahhhhhhhhhhhhh | 2024-11-25 14:01:50 | 12341234 | | 7 | testing | 2024-11-25 14:03:33 | 12341234 | +----+----------------+---------------------+----------+ B6 rows in set (0.001 sec) BB BMariaDB [3420]> delete from chat; BQuery OK, 6 rows affected (0.009 sec) BB BMariaDB [3420]> select * from chat; +----+----------------------+---------------------+----------+ | id | msg | sent_at | sent_by | +----+----------------------+---------------------+----------+ | 8 | testing from curl | 2024-11-25 14:04:18 | 12341234 | | 9 | testing from browser | 2024-11-25 14:04:30 | 12341234 | +----+----------------------+---------------------+----------+ B2 rows in set (0.001 sec) BB selectD* from0chat; +----+---------------------------+---------------------+----------+ | id | msg | sent_at | sent_by | +----+---------------------------+---------------------+----------+ | 8 | testing from curl | 2024-11-25 14:04:18 | 12341234 | | 9 | testing from browser | 2024-11-25 14:04:30 | 12341234 | | 10 | testing in browser again! | 2024-11-25 14:05:26 | 12341234 | +----+---------------------------+---------------------+----------+ B3 rows in set (0.001 sec) BB BMariaDB [3420]> describe chat -> ; +---------+--------------+------+-----+---------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------+--------------+------+-----+---------------------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | msg | varchar(240) | NO | | NULL | | | sent_at | datetime | YES | | current_timestamp() | | | sent_by | int(11) | NO | MUL | NULL | | +---------+--------------+------+-----+---------------------+----------------+ B4 rows in set (0.002 sec) BB BMariaDB [3420]> select chat.id, msg, sent_at, email by sent_at desc; -> from chat join student on chat.sent_by = student.id -> where chat.id > 0 -> order by sent_at desc; +----+---------------------------+---------------------+---------------+ | id | msg | sent_at | email | +----+---------------------------+---------------------+---------------+ | 11 | Haha! | 2024-11-25 14:11:56 | test@csub.edu | | 10 | testing in browser again! | 2024-11-25 14:05:26 | test@csub.edu | | 9 | testing from browser | 2024-11-25 14:04:30 | test@csub.edu | | 8 | testing from curl | 2024-11-25 14:04:18 | test@csub.edu | +----+---------------------------+---------------------+---------------+ B4 rows in set (0.001 sec) BB BMariaDB [3420]> MariaDB [3420]> [1]+ Stopped mysql 3420 (wd: ~/www/html/3420) (wd now: ~/www/html/3420/chatroom) nick@Solaire:~/www/html/3420/chatroom$ php api.php PHP Warning: Undefined array key "Login" in /var/www/html/3420/chatroom/api.php on line 8 PHP Warning: Undefined array key "Receive" in /var/www/html/3420/chatroom/api.php on line 28 PHP Warning: Undefined array key "ReceiveNewest" in /var/www/html/3420/chatroom/api.php on line 40 PHP Warning: Undefined array key "Send" in /var/www/html/3420/chatroom/api.php on line 53 nick@Solaire:~/www/html/3420/chatroom$ php -a Interactive shell >e0);Newest" =>atrue,""LastSeenId" =. php > include("api.php"); PHP Warning: Undefined array key "Login" in /var/www/html/3420/chatroom/api.php on line 8 PHP Warning: Undefined array key "Receive" in /var/www/html/3420/chatroom/api.php on line 28 PHP Warning: Uncaught TypeError: PDOStatement::execute(): Argument #1 ($params) must be of type ?array, int given in /var/www/html/3420/chatroom/api.php:46 Stack trace: #0 /var/www/html/3420/chatroom/api.php(46): PDOStatement->execute() #1 php shell code(1): include('...') #2 {main} thrown in /var/www/html/3420/chatroom/api.php on line 46 php > exit nick@Solaire:~/www/html/3420/chatroom$ exit logout There are stopped jobs. nick@Solaire:~/www/html/3420/chatroom$ exit logout Connection to solaire.cs.csub.edu closed. nick@Vaxis:~$ exit exit