├── LICENSE ├── README.md ├── db └── library_db.sql ├── screenshots ├── 1. home.png ├── 10. pending_registrations.png ├── 2. member_login.png ├── 3. member_registration1.png ├── 4. member_registration2.png ├── 5. member_registration3.png ├── 6. books1.png ├── 7. books2.png ├── 8. my_books.png └── 9. librarian_home.png └── src ├── css ├── custom_checkbox_style.css ├── custom_radio_button_style.css ├── form_styles.css ├── global_styles.css ├── header_style.css └── index_style.css ├── db_connect.php ├── header.php ├── img ├── ic_arrow.svg ├── ic_librarian.svg ├── ic_logo.svg └── ic_member.svg ├── index.php ├── librarian ├── css │ ├── header_librarian_style.css │ ├── header_style.css │ ├── home_style.css │ ├── index_style.css │ ├── insert_book_style.css │ ├── pending_book_requests_style.css │ ├── pending_registrations_style.css │ ├── update_balance_style.css │ └── update_copies_style.css ├── due_handler.php ├── header_librarian.php ├── home.php ├── img │ ├── ic_book_author.svg │ ├── ic_book_category.svg │ ├── ic_book_copies.svg │ ├── ic_book_isbn.svg │ ├── ic_book_price.svg │ ├── ic_book_title.svg │ ├── ic_librarian.svg │ ├── ic_logo.svg │ └── ic_required.svg ├── index.php ├── insert_book.php ├── pending_book_requests.php ├── pending_registrations.php ├── update_balance.php ├── update_copies.php └── verify_librarian.php ├── logout.php ├── member ├── css │ ├── header_member_style.css │ ├── header_style.css │ ├── home_style.css │ ├── index_style.css │ ├── my_books_style.css │ └── register_style.css ├── header_member.php ├── home.php ├── img │ ├── ic_logo.svg │ ├── ic_member.svg │ ├── ic_member_balance.svg │ ├── ic_member_email.svg │ ├── ic_member_name.svg │ ├── ic_member_pass.svg │ ├── ic_member_username.svg │ └── ic_required.svg ├── index.php ├── my_books.php ├── register.php └── verify_member.php ├── message_display.php └── verify_logged_out.php /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Adnan Ansari 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Library 2 | A library management system implemented in PHP, with attention to details like: 3 | * Separate user roles for Librarian and Member 4 | * Member registration and book issue must be confirmed by a Librarian 5 | * Automatic email confirmation to members on successful registration and book issue 6 | * Automatic email reminders to book issuers to return books 7 | * Automatic penalty deduction on returning a book after the due date 8 | 9 | **Note:** Please use the username *genesis* and password *librarian* for logging into the Librarian portal 10 | 11 | # Screenshots 12 | ![](https://github.com/psyclone20/Library/blob/master/screenshots/1.%20home.png) ![](https://github.com/psyclone20/Library/blob/master/screenshots/2.%20member_login.png) ![](https://github.com/psyclone20/Library/blob/master/screenshots/3.%20member_registration1.png) ![](https://github.com/psyclone20/Library/blob/master/screenshots/4.%20member_registration2.png) ![](https://github.com/psyclone20/Library/blob/master/screenshots/5.%20member_registration3.png) ![](https://github.com/psyclone20/Library/blob/master/screenshots/6.%20books1.png) ![](https://github.com/psyclone20/Library/blob/master/screenshots/7.%20books2.png) ![](https://github.com/psyclone20/Library/blob/master/screenshots/8.%20my_books.png) ![](https://github.com/psyclone20/Library/blob/master/screenshots/9.%20librarian_home.png) ![](https://github.com/psyclone20/Library/blob/master/screenshots/10.%20pending_registrations.png) 13 | -------------------------------------------------------------------------------- /db/library_db.sql: -------------------------------------------------------------------------------- 1 | -- phpMyAdmin SQL Dump 2 | -- version 4.5.1 3 | -- http://www.phpmyadmin.net 4 | -- 5 | -- Host: 127.0.0.1 6 | -- Generation Time: Oct 11, 2016 at 03:57 PM 7 | -- Server version: 10.1.13-MariaDB 8 | -- PHP Version: 5.6.21 9 | 10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 11 | SET time_zone = "+00:00"; 12 | 13 | 14 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 15 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 16 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 17 | /*!40101 SET NAMES utf8mb4 */; 18 | 19 | -- 20 | -- Database: `library_db` 21 | -- 22 | 23 | DELIMITER $$ 24 | -- 25 | -- Procedures 26 | -- 27 | CREATE DEFINER=`root`@`localhost` PROCEDURE `generate_due_list` () NO SQL 28 | SELECT I.issue_id, M.email, B.isbn, B.title 29 | FROM book_issue_log I INNER JOIN member M on I.member = M.username INNER JOIN book B ON I.book_isbn = B.isbn 30 | WHERE DATEDIFF(CURRENT_DATE, I.due_date) >= 0 AND DATEDIFF(CURRENT_DATE, I.due_date) % 5 = 0 AND (I.last_reminded IS NULL OR DATEDIFF(I.last_reminded, CURRENT_DATE) <> 0)$$ 31 | 32 | DELIMITER ; 33 | 34 | -- -------------------------------------------------------- 35 | 36 | -- 37 | -- Table structure for table `book` 38 | -- 39 | 40 | CREATE TABLE `book` ( 41 | `isbn` char(13) NOT NULL, 42 | `title` varchar(80) NOT NULL, 43 | `author` varchar(80) NOT NULL, 44 | `category` varchar(80) NOT NULL, 45 | `price` int(4) UNSIGNED NOT NULL, 46 | `copies` int(10) UNSIGNED NOT NULL 47 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 48 | 49 | -- 50 | -- Dumping data for table `book` 51 | -- 52 | 53 | INSERT INTO `book` (`isbn`, `title`, `author`, `category`, `price`, `copies`) VALUES 54 | ('0000545010225', 'Harry Potter and the Deathly Hallows', 'J. K. Rowling', 'Fiction', 550, 30), 55 | ('0000553103547', 'A Game of Thrones', 'George R. R. Martin', 'Fiction', 500, 10), 56 | ('0000553106635', 'A Storm of Swords', 'George R. R. Martin', 'Fiction', 550, 15), 57 | ('0000553108034', 'A Clash of Kings', 'George R. R. Martin', 'Fiction', 500, 10), 58 | ('0000553801503', 'A Feast for Crows', 'George R. R. Martin', 'Fiction', 600, 20), 59 | ('0000747532699', 'Harry Potter and the Philosopher''s Stone', 'J. K. Rowling', 'Fiction', 300, 12), 60 | ('0000747538492', 'Harry Potter and the Chamber of Secrets', 'J. K. Rowling', 'Fiction', 300, 10), 61 | ('0000747542155', 'Harry Potter and the Prisoner of Azkaban', 'J. K. Rowling', 'Fiction', 350, 16), 62 | ('0000747546240', 'Harry Potter and the Goblet of Fire', 'J. K. Rowling', 'Fiction', 400, 15), 63 | ('0000747551006', 'Harry Potter and the Order of the Phoenix', 'J. K. Rowling', 'Fiction', 400, 20), 64 | ('0000747581088', 'Harry Potter and the Half-Blood Prince', 'J. K. Rowling', 'Fiction', 500, 25), 65 | ('9780066620992', 'Good to Great', 'Jim Collins', 'Non-fiction', 300, 10), 66 | ('9780241257555', 'The Pigeon Tunnel', 'John le Carré', 'Non-fiction', 200, 25), 67 | ('9780439023511', 'Mockingjay', 'Suzanne Collins', 'Fiction', 500, 20), 68 | ('9780439023528', 'The Hunger Games', 'Suzanne Collins', 'Fiction', 400, 10), 69 | ('9780545227247', 'Catching Fire', 'Suzanne Collins', 'Fiction', 400, 14), 70 | ('9780553801477', 'A Dance with Dragons', 'George R. R. Martin', 'Fiction', 600, 30), 71 | ('9780967752808', 'Sandbox Wisdom', 'Tom Asacker', 'Non-fiction', 250, 5), 72 | ('9781501141515', 'Born to Run', 'Bruce Springsteen', 'Non-fiction', 250, 20), 73 | ('9788183331630', 'Let Us C', 'Yashavant Kanetkar', 'Education', 200, 22), 74 | ('9789350776667', 'Computer Graphics and Virtual Reality', 'Sanjesh S. Pawale', 'Education', 100, 30), 75 | ('9789350776773', 'Microcontroller and Embedded Systems', 'Harish G. Narula', 'Education', 80, 15), 76 | ('9789350777077', 'Advanced Database Management Systems', 'Mahesh Mali', 'Education', 60, 29), 77 | ('9789350777121', 'Operating Systems', 'Rajesh Kadu', 'Education', 50, 24), 78 | ('9789351194545', 'Open Source Technologies', 'Dayanand Ambawade', 'Education', 100, 20), 79 | ('9789381626719', 'Stay Hungry Stay Foolish', 'Rashmi Bansal', 'Non-fiction', 100, 5); 80 | 81 | -- -------------------------------------------------------- 82 | 83 | -- 84 | -- Table structure for table `book_issue_log` 85 | -- 86 | 87 | CREATE TABLE `book_issue_log` ( 88 | `issue_id` int(11) NOT NULL, 89 | `member` varchar(20) NOT NULL, 90 | `book_isbn` varchar(13) NOT NULL, 91 | `due_date` date NOT NULL, 92 | `last_reminded` date DEFAULT NULL 93 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 94 | 95 | -- 96 | -- Dumping data for table `book_issue_log` 97 | -- 98 | 99 | INSERT INTO `book_issue_log` (`issue_id`, `member`, `book_isbn`, `due_date`, `last_reminded`) VALUES 100 | (1, 'seph32', '9789350777077', '2016-10-17', NULL), 101 | (2, 'seph32', '9780545227247', '2016-10-17', NULL); 102 | 103 | -- 104 | -- Triggers `book_issue_log` 105 | -- 106 | DELIMITER $$ 107 | CREATE TRIGGER `issue_book` BEFORE INSERT ON `book_issue_log` FOR EACH ROW BEGIN 108 | SET NEW.due_date = DATE_ADD(CURRENT_DATE, INTERVAL 7 DAY); 109 | UPDATE member SET balance = balance - (SELECT price FROM book WHERE isbn = NEW.book_isbn) WHERE username = NEW.member; 110 | UPDATE book SET copies = copies - 1 WHERE isbn = NEW.book_isbn; 111 | DELETE FROM pending_book_requests WHERE member = NEW.member AND book_isbn = NEW.book_isbn; 112 | END 113 | $$ 114 | DELIMITER ; 115 | DELIMITER $$ 116 | CREATE TRIGGER `return_book` BEFORE DELETE ON `book_issue_log` FOR EACH ROW BEGIN 117 | UPDATE member SET balance = balance + (SELECT price FROM book WHERE isbn = OLD.book_isbn) WHERE username = OLD.member; 118 | UPDATE book SET copies = copies + 1 WHERE isbn = OLD.book_isbn; 119 | END 120 | $$ 121 | DELIMITER ; 122 | 123 | -- -------------------------------------------------------- 124 | 125 | -- 126 | -- Table structure for table `librarian` 127 | -- 128 | 129 | CREATE TABLE `librarian` ( 130 | `id` int(11) NOT NULL, 131 | `username` varchar(20) NOT NULL, 132 | `password` char(40) NOT NULL 133 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 134 | 135 | -- 136 | -- Dumping data for table `librarian` 137 | -- 138 | 139 | INSERT INTO `librarian` (`id`, `username`, `password`) VALUES 140 | (1, 'genesis', '93c768d0152f72bc8d5e782c0b585acc35fb0442'); 141 | 142 | -- -------------------------------------------------------- 143 | 144 | -- 145 | -- Table structure for table `member` 146 | -- 147 | 148 | CREATE TABLE `member` ( 149 | `id` int(11) NOT NULL, 150 | `username` varchar(20) NOT NULL, 151 | `password` char(40) NOT NULL, 152 | `name` varchar(80) NOT NULL, 153 | `email` varchar(80) NOT NULL, 154 | `balance` int(4) NOT NULL 155 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 156 | 157 | -- 158 | -- Dumping data for table `member` 159 | -- 160 | 161 | INSERT INTO `member` (`id`, `username`, `password`, `name`, `email`, `balance`) VALUES 162 | (1, 'cloud9', 'c67adbca4bd9f7e583f05f4c7edbcb733c7c9233', 'Cloud Strife', 'cloud@shinra.com', 1000), 163 | (2, 'seph32', '75bf2b008d91258f56fc0d3a938ca64b8a631533', 'Sephiroth', 'seph@shinra.com', 540), 164 | (3, 'zack_ff7', '52d849001964af394040dc48b673f748e55e1af7', 'Zack Fair', 'zack@shinra.com', 1000); 165 | 166 | -- 167 | -- Triggers `member` 168 | -- 169 | DELIMITER $$ 170 | CREATE TRIGGER `add_member` AFTER INSERT ON `member` FOR EACH ROW DELETE FROM pending_registrations WHERE username = NEW.username 171 | $$ 172 | DELIMITER ; 173 | DELIMITER $$ 174 | CREATE TRIGGER `remove_member` AFTER DELETE ON `member` FOR EACH ROW DELETE FROM pending_book_requests WHERE member = OLD.username 175 | $$ 176 | DELIMITER ; 177 | 178 | -- -------------------------------------------------------- 179 | 180 | -- 181 | -- Table structure for table `pending_book_requests` 182 | -- 183 | 184 | CREATE TABLE `pending_book_requests` ( 185 | `request_id` int(11) NOT NULL, 186 | `member` varchar(20) NOT NULL, 187 | `book_isbn` varchar(13) NOT NULL, 188 | `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP 189 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 190 | 191 | -- 192 | -- Dumping data for table `pending_book_requests` 193 | -- 194 | 195 | INSERT INTO `pending_book_requests` (`request_id`, `member`, `book_isbn`, `time`) VALUES 196 | (1, 'zack_ff7', '9780553801477', '2016-10-10 12:53:27'), 197 | (2, 'cloud9', '0000545010225', '2016-10-10 12:53:59'), 198 | (5, 'seph32', '0000553103547', '2016-10-10 12:59:45'); 199 | 200 | -- -------------------------------------------------------- 201 | 202 | -- 203 | -- Table structure for table `pending_registrations` 204 | -- 205 | 206 | CREATE TABLE `pending_registrations` ( 207 | `username` varchar(20) NOT NULL, 208 | `password` char(40) NOT NULL, 209 | `name` varchar(80) NOT NULL, 210 | `email` varchar(80) NOT NULL, 211 | `balance` int(4) NOT NULL, 212 | `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP 213 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 214 | 215 | -- 216 | -- Dumping data for table `pending_registrations` 217 | -- 218 | 219 | INSERT INTO `pending_registrations` (`username`, `password`, `name`, `email`, `balance`, `time`) VALUES 220 | ('test', 'a94a8fe5ccb19ba61c4c0873d391e987982fbbd3', 'Test', 'test@test.com', 500, '2016-10-10 13:01:13'), 221 | ('test2', '109f4b3c50d7b0df729d299bc6f8e9ef9066971f', 'Test 2', 'test2@test2.com', 800, '2016-10-10 13:03:41'); 222 | 223 | -- 224 | -- Indexes for dumped tables 225 | -- 226 | 227 | -- 228 | -- Indexes for table `book` 229 | -- 230 | ALTER TABLE `book` 231 | ADD PRIMARY KEY (`isbn`); 232 | 233 | -- 234 | -- Indexes for table `book_issue_log` 235 | -- 236 | ALTER TABLE `book_issue_log` 237 | ADD PRIMARY KEY (`issue_id`); 238 | 239 | -- 240 | -- Indexes for table `librarian` 241 | -- 242 | ALTER TABLE `librarian` 243 | ADD PRIMARY KEY (`id`), 244 | ADD UNIQUE KEY `username` (`username`); 245 | 246 | -- 247 | -- Indexes for table `member` 248 | -- 249 | ALTER TABLE `member` 250 | ADD PRIMARY KEY (`id`), 251 | ADD UNIQUE KEY `username` (`username`), 252 | ADD UNIQUE KEY `email` (`email`); 253 | 254 | -- 255 | -- Indexes for table `pending_book_requests` 256 | -- 257 | ALTER TABLE `pending_book_requests` 258 | ADD PRIMARY KEY (`request_id`); 259 | 260 | -- 261 | -- Indexes for table `pending_registrations` 262 | -- 263 | ALTER TABLE `pending_registrations` 264 | ADD PRIMARY KEY (`username`), 265 | ADD UNIQUE KEY `email` (`email`); 266 | 267 | -- 268 | -- AUTO_INCREMENT for dumped tables 269 | -- 270 | 271 | -- 272 | -- AUTO_INCREMENT for table `book_issue_log` 273 | -- 274 | ALTER TABLE `book_issue_log` 275 | MODIFY `issue_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; 276 | -- 277 | -- AUTO_INCREMENT for table `librarian` 278 | -- 279 | ALTER TABLE `librarian` 280 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; 281 | -- 282 | -- AUTO_INCREMENT for table `member` 283 | -- 284 | ALTER TABLE `member` 285 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; 286 | -- 287 | -- AUTO_INCREMENT for table `pending_book_requests` 288 | -- 289 | ALTER TABLE `pending_book_requests` 290 | MODIFY `request_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; 291 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 292 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 293 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 294 | -------------------------------------------------------------------------------- /screenshots/1. home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/psyclone20/Library/fdfa65cf8a4433fee01b0b333e5d2f2359e8e1c1/screenshots/1. home.png -------------------------------------------------------------------------------- /screenshots/10. pending_registrations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/psyclone20/Library/fdfa65cf8a4433fee01b0b333e5d2f2359e8e1c1/screenshots/10. pending_registrations.png -------------------------------------------------------------------------------- /screenshots/2. member_login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/psyclone20/Library/fdfa65cf8a4433fee01b0b333e5d2f2359e8e1c1/screenshots/2. member_login.png -------------------------------------------------------------------------------- /screenshots/3. member_registration1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/psyclone20/Library/fdfa65cf8a4433fee01b0b333e5d2f2359e8e1c1/screenshots/3. member_registration1.png -------------------------------------------------------------------------------- /screenshots/4. member_registration2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/psyclone20/Library/fdfa65cf8a4433fee01b0b333e5d2f2359e8e1c1/screenshots/4. member_registration2.png -------------------------------------------------------------------------------- /screenshots/5. member_registration3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/psyclone20/Library/fdfa65cf8a4433fee01b0b333e5d2f2359e8e1c1/screenshots/5. member_registration3.png -------------------------------------------------------------------------------- /screenshots/6. books1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/psyclone20/Library/fdfa65cf8a4433fee01b0b333e5d2f2359e8e1c1/screenshots/6. books1.png -------------------------------------------------------------------------------- /screenshots/7. books2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/psyclone20/Library/fdfa65cf8a4433fee01b0b333e5d2f2359e8e1c1/screenshots/7. books2.png -------------------------------------------------------------------------------- /screenshots/8. my_books.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/psyclone20/Library/fdfa65cf8a4433fee01b0b333e5d2f2359e8e1c1/screenshots/8. my_books.png -------------------------------------------------------------------------------- /screenshots/9. librarian_home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/psyclone20/Library/fdfa65cf8a4433fee01b0b333e5d2f2359e8e1c1/screenshots/9. librarian_home.png -------------------------------------------------------------------------------- /src/css/custom_checkbox_style.css: -------------------------------------------------------------------------------- 1 | /*----------Custom checkbox----------*/ 2 | .control-group { 3 | display: inline-block; 4 | width: 200px; 5 | height: 210px; 6 | margin: 10px; 7 | padding: 30px; 8 | text-align: left; 9 | vertical-align: top; 10 | background: #fff; 11 | box-shadow: 0 1px 2px rgba(0,0,0,.1); 12 | } 13 | 14 | .control { 15 | font-size: 18px; 16 | position: relative; 17 | display: block; 18 | margin-bottom: 15px; 19 | padding-left: 30px; 20 | cursor: pointer; 21 | } 22 | 23 | .control input { 24 | position: absolute; 25 | z-index: -1; 26 | opacity: 0; 27 | } 28 | 29 | .control__indicator { 30 | position: absolute; 31 | top: -2px; 32 | left: 0; 33 | width: 20px; 34 | height: 20px; 35 | background: #e6e6e6; 36 | } 37 | 38 | /* Hover and focus states */ 39 | .control:hover input ~ .control__indicator, 40 | .control input:focus ~ .control__indicator { 41 | background: #cccccc; 42 | } 43 | 44 | /* Checked state */ 45 | .control input:checked ~ .control__indicator { 46 | -webkit-animation: cd-bounce 0.3s; 47 | -moz-animation: cd-bounce 0.3s; 48 | animation: cd-bounce 0.3s; 49 | background: #d75069; 50 | } 51 | 52 | /* Disabled state */ 53 | .control input:disabled ~ .control__indicator { 54 | -webkit-animation: cd-bounce 0.3s; 55 | -moz-animation: cd-bounce 0.3s; 56 | animation: cd-bounce 0.3s; 57 | pointer-events: none; 58 | opacity: .6; 59 | background: #e6e6e6; 60 | } 61 | 62 | /* Check mark */ 63 | .control__indicator:after { 64 | position: absolute; 65 | display: none; 66 | content: ''; 67 | } 68 | 69 | /* Show check mark */ 70 | .control input:checked ~ .control__indicator:after { 71 | display: block; 72 | } 73 | 74 | /* Checkbox tick */ 75 | .control--checkbox .control__indicator:after { 76 | top: 4px; 77 | left: 8px; 78 | width: 5px; 79 | height: 10px; 80 | transform: rotate(45deg); 81 | border: solid #fff; 82 | border-width: 0 2px 2px 0; 83 | } 84 | 85 | @-webkit-keyframes cd-bounce { 86 | 0%, 100% { 87 | -webkit-transform: scale(1); 88 | } 89 | 50% { 90 | -webkit-transform: scale(0.8); 91 | } 92 | } 93 | @-moz-keyframes cd-bounce { 94 | 0%, 100% { 95 | -moz-transform: scale(1); 96 | } 97 | 50% { 98 | -moz-transform: scale(0.8); 99 | } 100 | } 101 | @keyframes cd-bounce { 102 | 0%, 100% { 103 | -webkit-transform: scale(1); 104 | -moz-transform: scale(1); 105 | -ms-transform: scale(1); 106 | -o-transform: scale(1); 107 | transform: scale(1); 108 | } 109 | 50% { 110 | -webkit-transform: scale(0.8); 111 | -moz-transform: scale(0.8); 112 | -ms-transform: scale(0.8); 113 | -o-transform: scale(0.8); 114 | transform: scale(0.8); 115 | } 116 | } -------------------------------------------------------------------------------- /src/css/custom_radio_button_style.css: -------------------------------------------------------------------------------- 1 | /*----------Custom radio button----------*/ 2 | .control-group { 3 | display: inline-block; 4 | width: 200px; 5 | height: 210px; 6 | margin: 10px; 7 | padding: 30px; 8 | text-align: left; 9 | vertical-align: top; 10 | background: #ffffff; 11 | box-shadow: 0 1px 2px rgba(0,0,0,.1); 12 | } 13 | 14 | .control { 15 | font-size: 18px; 16 | position: relative; 17 | display: block; 18 | margin-bottom: 15px; 19 | padding-left: 30px; 20 | cursor: pointer; 21 | } 22 | 23 | .control input { 24 | position: absolute; 25 | z-index: -1; 26 | opacity: 0; 27 | } 28 | 29 | .control__indicator { 30 | position: absolute; 31 | top: 2px; 32 | left: 0; 33 | width: 20px; 34 | height: 20px; 35 | background: #e6e6e6; 36 | } 37 | 38 | .control--radio .control__indicator { 39 | border-radius: 50%; 40 | } 41 | 42 | /* Hover and focus states */ 43 | .control:hover input ~ .control__indicator, 44 | .control input:focus ~ .control__indicator { 45 | background: #cccccc; 46 | } 47 | 48 | /* Checked state */ 49 | .control input:checked ~ .control__indicator { 50 | -webkit-animation: cd-bounce 0.3s; 51 | -moz-animation: cd-bounce 0.3s; 52 | animation: cd-bounce 0.3s; 53 | background: #d75069; 54 | } 55 | 56 | /* Disabled state */ 57 | .control input:disabled ~ .control__indicator { 58 | -webkit-animation: cd-bounce 0.3s; 59 | -moz-animation: cd-bounce 0.3s; 60 | animation: cd-bounce 0.3s; 61 | pointer-events: none; 62 | opacity: .6; 63 | background: #e6e6e6; 64 | } 65 | 66 | /* Check mark */ 67 | .control__indicator:after { 68 | position: absolute; 69 | display: none; 70 | content: ''; 71 | } 72 | 73 | /* Show check mark */ 74 | .control input:checked ~ .control__indicator:after { 75 | display: block; 76 | } 77 | 78 | /* Radio button inner circle */ 79 | .control--radio .control__indicator:after { 80 | top: 7px; 81 | left: 7px; 82 | width: 6px; 83 | height: 6px; 84 | border-radius: 50%; 85 | background: #ffffff; 86 | } 87 | 88 | @-webkit-keyframes cd-bounce { 89 | 0%, 100% { 90 | -webkit-transform: scale(1); 91 | } 92 | 50% { 93 | -webkit-transform: scale(0.8); 94 | } 95 | } 96 | @-moz-keyframes cd-bounce { 97 | 0%, 100% { 98 | -moz-transform: scale(1); 99 | } 100 | 50% { 101 | -moz-transform: scale(0.8); 102 | } 103 | } 104 | @keyframes cd-bounce { 105 | 0%, 100% { 106 | -webkit-transform: scale(1); 107 | -moz-transform: scale(1); 108 | -ms-transform: scale(1); 109 | -o-transform: scale(1); 110 | transform: scale(1); 111 | } 112 | 50% { 113 | -webkit-transform: scale(0.8); 114 | -moz-transform: scale(0.8); 115 | -ms-transform: scale(0.8); 116 | -o-transform: scale(0.8); 117 | transform: scale(0.8); 118 | } 119 | } -------------------------------------------------------------------------------- /src/css/form_styles.css: -------------------------------------------------------------------------------- 1 | /*----------Form styles----------*/ 2 | .cd-form { 3 | width: 90%; 4 | max-width: 600px; 5 | margin: 4em auto; 6 | font-size: 1.3rem; 7 | color: #94aab0; 8 | margin-bottom: 10px; 9 | display: block; 10 | } 11 | 12 | .cd-form::after { 13 | clear: both; 14 | content: ""; 15 | display: table; 16 | } 17 | 18 | .cd-form legend { 19 | padding-bottom: 10px; 20 | margin-bottom: 20px; 21 | font-size: 2rem; 22 | border-bottom: 1px solid #ecf0f1; 23 | display: block; 24 | width: 100%; 25 | -webkit-appearance: none; 26 | -moz-appearance: none; 27 | -ms-appearance: none; 28 | -o-appearance: none; 29 | appearance: none; 30 | } 31 | 32 | .cd-form div { 33 | position: relative; 34 | margin: 20px 0; 35 | } 36 | 37 | .cd-form input, .cd-form select { 38 | font-family: "Open Sans", sans-serif; 39 | font-size: 1.6rem; 40 | color: #2b3e51; 41 | } 42 | 43 | .cd-form input[type="text"], 44 | .cd-form input[type="password"], 45 | .cd-form input[type="email"], 46 | .cd-form input[type="number"], 47 | .cd-form select, 48 | .cd-form legend { 49 | display: block; 50 | width: 100%; 51 | -webkit-appearance: none; 52 | -moz-appearance: none; 53 | -ms-appearance: none; 54 | -o-appearance: none; 55 | appearance: none; 56 | } 57 | 58 | .cd-form input[type="text"], 59 | .cd-form input[type="password"], 60 | .cd-form input[type="email"], 61 | .cd-form input[type="number"], 62 | .cd-form select { 63 | padding: 12px; 64 | border: 1px solid #cfd9db; 65 | background-color: #ffffff; 66 | border-radius: .25em; 67 | box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.08); 68 | } 69 | 70 | .cd-form input[type="text"]:focus, 71 | .cd-form input[type="email"]:focus, 72 | .cd-form input[type="password"]:focus, 73 | .cd-form input[type="number"]:focus, 74 | .cd-form select:focus { 75 | outline: none; 76 | border-color: #d75069; 77 | box-shadow: 0 0 5px rgba(44, 151, 222, 0.2); 78 | } 79 | 80 | .cd-form .cd-select { 81 | position: relative; 82 | } 83 | 84 | .cd-form .cd-select::after { 85 | content: ''; 86 | position: absolute; 87 | z-index: 1; 88 | right: 16px; 89 | top: 50%; 90 | margin-top: -8px; 91 | display: block; 92 | width: 16px; 93 | height: 16px; 94 | background: url("../img/ic_arrow.svg") no-repeat center center; 95 | pointer-events: none; 96 | } 97 | 98 | .cd-form select { 99 | box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); 100 | cursor: pointer; 101 | } 102 | 103 | .cd-form select::-ms-expand { 104 | display: none; 105 | } 106 | 107 | .cd-form input[type="submit"] { 108 | border: none; 109 | background: #d75069; 110 | border-radius: .25em; 111 | padding: 16px 20px; 112 | color: #ffffff; 113 | font-family: "Open Sans", sans-serif; 114 | font-weight: bold; 115 | float: right; 116 | cursor: pointer; 117 | -webkit-font-smoothing: antialiased; 118 | -moz-osx-font-smoothing: grayscale; 119 | -webkit-appearance: none; 120 | -moz-appearance: none; 121 | -ms-appearance: none; 122 | -o-appearance: none; 123 | appearance: none; 124 | } 125 | 126 | .cd-form input[type="submit"]:focus { 127 | outline: none; 128 | background: #2b3e51; 129 | } 130 | 131 | .cd-form input[type="submit"]:active { 132 | -webkit-transform: scale(0.9); 133 | -moz-transform: scale(0.9); 134 | -ms-transform: scale(0.9); 135 | -o-transform: scale(0.9); 136 | transform: scale(0.9); 137 | } 138 | 139 | .cd-form [required] { 140 | background: url("img/ic_required.svg") no-repeat top right; 141 | } 142 | 143 | .cd-form .error-message { 144 | display: none; 145 | } 146 | 147 | .cd-form .error-message p { 148 | background: #e94b35; 149 | color: #ffffff; 150 | font-size: 1.4rem; 151 | text-align: center; 152 | -webkit-font-smoothing: antialiased; 153 | -moz-osx-font-smoothing: grayscale; 154 | border-radius: .25em; 155 | padding: 16px; 156 | } 157 | 158 | .cd-form .success-message p { 159 | background: #4caf50; 160 | color: #ffffff; 161 | font-size: 1.4rem; 162 | text-align: center; 163 | -webkit-font-smoothing: antialiased; 164 | -moz-osx-font-smoothing: grayscale; 165 | border-radius: .25em; 166 | padding: 16px; 167 | } 168 | 169 | .cd-form .error-field { 170 | border-color: #e94b35 !important; 171 | } 172 | 173 | @media only screen and (min-width: 600px) { 174 | .cd-form div { 175 | margin: 32px 0; 176 | } 177 | .cd-form legend + div { 178 | margin-top: 20px; 179 | } 180 | .cd-form input[type="text"], 181 | .cd-form input[type="password"], 182 | .cd-form input[type="email"], 183 | .cd-form input[type="number"], 184 | .cd-form select { 185 | padding: 16px; 186 | } 187 | } -------------------------------------------------------------------------------- /src/css/global_styles.css: -------------------------------------------------------------------------------- 1 | /*----------Global styles----------*/ 2 | *, *::after, *::before { 3 | -webkit-box-sizing: border-box; 4 | -moz-box-sizing: border-box; 5 | box-sizing: border-box; 6 | } 7 | 8 | html { 9 | font-size: 62.5%; 10 | } 11 | 12 | body { 13 | font-size: 1.8rem; 14 | font-family: "Open Sans", sans-serif; 15 | color: #2b3e51; 16 | background-color: #ffffff; 17 | } -------------------------------------------------------------------------------- /src/css/header_style.css: -------------------------------------------------------------------------------- 1 | html * { 2 | -webkit-font-smoothing: antialiased; 3 | -moz-osx-font-smoothing: grayscale; 4 | } 5 | 6 | *, *:after, *:before { 7 | -webkit-box-sizing: border-box; 8 | -moz-box-sizing: border-box; 9 | box-sizing: border-box; 10 | } 11 | 12 | body { 13 | font-size: 100%; 14 | font-family: "Open Sans", sans-serif; 15 | background-color: white; 16 | margin: 0; 17 | } 18 | 19 | img { 20 | max-width: 100%; 21 | } 22 | 23 | header { 24 | position: relative; 25 | height: 50px; 26 | background: #343642; 27 | } 28 | 29 | header #cd-logo { 30 | float: left; 31 | margin: 0 0 0 5%; 32 | /* reduce logo size on mobile and make sure it is left aligned with the transform-origin property */ 33 | -webkit-transform-origin: 0 50%; 34 | -moz-transform-origin: 0 50%; 35 | -ms-transform-origin: 0 50%; 36 | -o-transform-origin: 0 50%; 37 | transform-origin: 0 50%; 38 | -webkit-transform: scale(0.8); 39 | -moz-transform: scale(0.8); 40 | -ms-transform: scale(0.8); 41 | -o-transform: scale(0.8); 42 | transform: scale(0.8); 43 | } 44 | 45 | header #cd-logo img , header #cd-logo p{ 46 | display: inline-block; 47 | vertical-align: middle; 48 | } 49 | 50 | header #cd-logo p{ 51 | color: #d75069; 52 | font-weight: bold; 53 | font-size: 1.4rem; 54 | } 55 | 56 | header::after { 57 | /* clearfix */ 58 | content: ''; 59 | display: table; 60 | clear: both; 61 | } 62 | 63 | header a{ 64 | text-decoration: none; 65 | } 66 | 67 | @media only screen and (min-width: 768px) { 68 | header { 69 | height: 80px; 70 | } 71 | header #cd-logo { 72 | margin: 4px 0 0 5%; 73 | -webkit-transform: scale(1); 74 | -moz-transform: scale(1); 75 | -ms-transform: scale(1); 76 | -o-transform: scale(1); 77 | transform: scale(1); 78 | } 79 | } -------------------------------------------------------------------------------- /src/css/index_style.css: -------------------------------------------------------------------------------- 1 | #allTheThings { 2 | width: 90%; 3 | max-width: 800px; 4 | text-align: center; 5 | margin: 8em auto; 6 | font-size: 1.3rem; 7 | color: #94aab0; 8 | display: block; 9 | } 10 | 11 | a{ 12 | color: #94aab0; 13 | text-decoration: none; 14 | } 15 | 16 | #member{ 17 | display: inline-block; 18 | } 19 | 20 | #verticalLine { 21 | display: inline-block; 22 | margin-left: 20px; 23 | border-left: solid #343642; 24 | } 25 | 26 | #librarian-link{ 27 | margin-left: 20px; 28 | } 29 | 30 | #member, #librarian 31 | { 32 | transition: all .2s ease-in-out; 33 | } 34 | 35 | #member:hover, #librarian:hover 36 | { 37 | transform: scale(1.1); 38 | } -------------------------------------------------------------------------------- /src/db_connect.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/header.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 13 | 14 |
15 | 16 | -------------------------------------------------------------------------------- /src/img/ic_arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/img/ic_librarian.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/img/ic_logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/img/ic_member.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/index.php: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | Library 16 | 17 | 18 | 19 |
20 |
21 | 22 |
23 |  Member 24 |
25 |
26 |
27 | 33 |
34 |
35 | 36 | -------------------------------------------------------------------------------- /src/librarian/css/header_librarian_style.css: -------------------------------------------------------------------------------- 1 | html * { 2 | -webkit-font-smoothing: antialiased; 3 | -moz-osx-font-smoothing: grayscale; 4 | } 5 | 6 | *, *:after, *:before { 7 | -webkit-box-sizing: border-box; 8 | -moz-box-sizing: border-box; 9 | box-sizing: border-box; 10 | } 11 | 12 | body { 13 | font-size: 100%; 14 | font-family: "Open Sans", sans-serif; 15 | background-color: white; 16 | margin: 0; 17 | } 18 | 19 | img { 20 | max-width: 100%; 21 | } 22 | 23 | header { 24 | position: relative; 25 | height: 50px; 26 | background: #343642; 27 | } 28 | 29 | header #cd-logo { 30 | float: left; 31 | margin: 0 0 0 5%; 32 | /* reduce logo size on mobile and make sure it is left aligned with the transform-origin property */ 33 | -webkit-transform-origin: 0 50%; 34 | -moz-transform-origin: 0 50%; 35 | -ms-transform-origin: 0 50%; 36 | -o-transform-origin: 0 50%; 37 | transform-origin: 0 50%; 38 | -webkit-transform: scale(0.8); 39 | -moz-transform: scale(0.8); 40 | -ms-transform: scale(0.8); 41 | -o-transform: scale(0.8); 42 | transform: scale(0.8); 43 | } 44 | 45 | header #cd-logo img , header #cd-logo p{ 46 | display: inline-block; 47 | vertical-align: middle; 48 | } 49 | 50 | header #cd-logo p{ 51 | font-size: 2.2rem !important; 52 | color: #d75069; 53 | font-weight: bold; 54 | font-size: 1.4rem; 55 | } 56 | 57 | header::after { 58 | /* clearfix */ 59 | content: ''; 60 | display: table; 61 | clear: both; 62 | } 63 | 64 | header a { 65 | text-decoration: none; 66 | } 67 | 68 | @media only screen and (min-width: 768px) { 69 | header { 70 | height: 80px; 71 | } 72 | header #cd-logo { 73 | margin: 4px 0 0 5%; 74 | -webkit-transform: scale(1); 75 | -moz-transform: scale(1); 76 | -ms-transform: scale(1); 77 | -o-transform: scale(1); 78 | transform: scale(1); 79 | } 80 | } 81 | 82 | .dropbtn { 83 | background: url("../img/ic_librarian.svg") no-repeat 8px center; 84 | background-color: #d75069; 85 | margin-top: 10%; 86 | color: white; 87 | min-width: 120px; 88 | padding: 0 8px 0 8px; 89 | font-size: 16px; 90 | font-family: "Open Sans", sans-serif; 91 | border: none; 92 | cursor: pointer; 93 | } 94 | 95 | 96 | #librarian-name{ 97 | margin-left: 32px; 98 | } 99 | 100 | .dropdown { 101 | position: relative; 102 | display: inline-block; 103 | float: right; 104 | margin-right: 5%; 105 | } 106 | 107 | .dropdown-content { 108 | display: none; 109 | right: 0; 110 | position: absolute; 111 | background-color: #f9f9f9; 112 | min-width: 160px; 113 | font-size: 1.6rem; 114 | box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); 115 | } 116 | 117 | .dropdown-content a { 118 | color: black; 119 | padding: 12px 16px; 120 | text-decoration: none; 121 | display: block; 122 | } 123 | 124 | .dropdown-content a:hover { 125 | background-color: #f1f1f1 126 | } 127 | 128 | .dropdown:hover .dropdown-content { 129 | display: block; 130 | } 131 | 132 | .dropdown:hover .dropbtn { 133 | background-color: #d34060;; 134 | } -------------------------------------------------------------------------------- /src/librarian/css/header_style.css: -------------------------------------------------------------------------------- 1 | html * { 2 | -webkit-font-smoothing: antialiased; 3 | -moz-osx-font-smoothing: grayscale; 4 | } 5 | 6 | *, *:after, *:before { 7 | -webkit-box-sizing: border-box; 8 | -moz-box-sizing: border-box; 9 | box-sizing: border-box; 10 | } 11 | 12 | body { 13 | font-size: 100%; 14 | font-family: "Open Sans", sans-serif; 15 | background-color: white; 16 | margin: 0; 17 | } 18 | 19 | img { 20 | max-width: 100%; 21 | } 22 | 23 | header { 24 | position: relative; 25 | height: 50px; 26 | background: #343642; 27 | } 28 | 29 | header #cd-logo { 30 | float: left; 31 | margin: 0 0 0 5%; 32 | /* reduce logo size on mobile and make sure it is left aligned with the transform-origin property */ 33 | -webkit-transform-origin: 0 50%; 34 | -moz-transform-origin: 0 50%; 35 | -ms-transform-origin: 0 50%; 36 | -o-transform-origin: 0 50%; 37 | transform-origin: 0 50%; 38 | -webkit-transform: scale(0.8); 39 | -moz-transform: scale(0.8); 40 | -ms-transform: scale(0.8); 41 | -o-transform: scale(0.8); 42 | transform: scale(0.8); 43 | } 44 | 45 | header #cd-logo img , header #cd-logo p{ 46 | display: inline-block; 47 | vertical-align: middle; 48 | } 49 | 50 | header #cd-logo p{ 51 | color: #d75069; 52 | font-weight: bold; 53 | font-size: 2.2rem; 54 | } 55 | 56 | header::after { 57 | /* clearfix */ 58 | content: ''; 59 | display: table; 60 | clear: both; 61 | } 62 | 63 | @media only screen and (min-width: 768px) { 64 | header { 65 | height: 80px; 66 | } 67 | header #cd-logo { 68 | margin: 4px 0 0 5%; 69 | -webkit-transform: scale(1); 70 | -moz-transform: scale(1); 71 | -ms-transform: scale(1); 72 | -o-transform: scale(1); 73 | transform: scale(1); 74 | } 75 | } -------------------------------------------------------------------------------- /src/librarian/css/home_style.css: -------------------------------------------------------------------------------- 1 | html { 2 | font-size: 62.5%; 3 | } 4 | 5 | body{ 6 | font-family: "Open Sans", sans-serif; 7 | } 8 | 9 | #allTheThings{ 10 | width: 90%; 11 | max-width: 600px; 12 | margin: 4em auto; 13 | font-size: 1.3rem; 14 | color: #94aab0; 15 | margin-bottom: 10px; 16 | display: block; 17 | } 18 | 19 | #allTheThings input[type="button"] { 20 | width: 100%; 21 | border: none; 22 | background: #d75069; 23 | border-radius: .25em; 24 | padding: 16px 20px; 25 | margin-bottom: 20px; 26 | color: #ffffff; 27 | font-weight: bold; 28 | font-family: "Open Sans", sans-serif; 29 | font-size: 1.6rem; 30 | float: right; 31 | cursor: pointer; 32 | -webkit-font-smoothing: antialiased; 33 | -moz-osx-font-smoothing: grayscale; 34 | -webkit-appearance: none; 35 | -moz-appearance: none; 36 | -ms-appearance: none; 37 | -o-appearance: none; 38 | appearance: none; 39 | } 40 | 41 | #allTheThings input[type="button"]:focus { 42 | outline: none; 43 | background: #2b3e51; 44 | } 45 | 46 | #allTheThings input[type="button"]:active { 47 | -webkit-transform: scale(0.9); 48 | -moz-transform: scale(0.9); 49 | -ms-transform: scale(0.9); 50 | -o-transform: scale(0.9); 51 | transform: scale(0.9); 52 | } 53 | 54 | a{ 55 | text-decoration: none; 56 | } -------------------------------------------------------------------------------- /src/librarian/css/index_style.css: -------------------------------------------------------------------------------- 1 | /*----------Custom Icons----------*/ 2 | .cd-form .icon input{ 3 | padding-left: 54px !important; 4 | } 5 | .cd-form .l-user { 6 | background: url("../img/ic_book_author.svg") no-repeat 16px center; 7 | } 8 | .cd-form [required].l-user { 9 | background: url("../img/ic_book_author.svg") no-repeat 16px center, url("../img/ic_required.svg") no-repeat top right; 10 | } 11 | .cd-form .l-pass { 12 | background: url("../../member/img/ic_member_username.svg") no-repeat 16px center; 13 | } 14 | .cd-form [required].l-pass { 15 | background: url("../../member/img/ic_member_pass.svg") no-repeat 16px center, url("../img/ic_required.svg") no-repeat top right; 16 | } -------------------------------------------------------------------------------- /src/librarian/css/insert_book_style.css: -------------------------------------------------------------------------------- 1 | /*----------Custom Icons----------*/ 2 | .cd-form .icon input, .cd-form .icon select{ 3 | padding-left: 54px !important; 4 | } 5 | .cd-form .b-isbn { 6 | background: url("../img/ic_book_isbn.svg") no-repeat 16px center; 7 | } 8 | .cd-form [required].b-isbn { 9 | background: url("../img/ic_book_isbn.svg") no-repeat 16px center, url("../img/ic_required.svg") no-repeat top right; 10 | } 11 | .cd-form .b-title { 12 | background: url("../img/ic_book_title.svg") no-repeat 16px center; 13 | } 14 | .cd-form [required].b-title { 15 | background: url("../img/ic_book_title.svg") no-repeat 16px center, url("../img/ic_required.svg") no-repeat top right; 16 | } 17 | .cd-form .b-author { 18 | background: url("../img/ic_book_author.svg") no-repeat 16px center; 19 | } 20 | .cd-form [required].b-author { 21 | background: url("../img/ic_book_author.svg") no-repeat 16px center, url("../img/ic_required.svg") no-repeat top right; 22 | } 23 | .cd-form .b-category { 24 | background: url("../img/ic_book_category.svg") no-repeat 16px center; 25 | } 26 | .cd-form .b-price { 27 | background: url("../img/ic_book_price.svg") no-repeat 16px center; 28 | } 29 | .cd-form [required].b-price { 30 | background: url("../img/ic_book_price.svg") no-repeat 16px center, url("../img/ic_required.svg") no-repeat top right; 31 | } 32 | .cd-form .b-copies { 33 | background: url("../img/ic_book_copies.svg") no-repeat 16px center; 34 | } 35 | .cd-form [required].b-copies { 36 | background: url("../img/ic_book_copies.svg") no-repeat 16px center, url("../img/ic_required.svg") no-repeat top right; 37 | } -------------------------------------------------------------------------------- /src/librarian/css/pending_book_requests_style.css: -------------------------------------------------------------------------------- 1 | /*----------Form styles----------*/ 2 | .cd-form { 3 | width: 90%; 4 | max-width: 600px; 5 | margin: 4em auto; 6 | font-size: 1.3rem; 7 | color: #94aab0; 8 | margin-bottom: 10px; 9 | display: block; 10 | } 11 | 12 | .cd-form::after { 13 | clear: both; 14 | content: ""; 15 | display: table; 16 | } 17 | 18 | .cd-form legend { 19 | padding-bottom: 10px; 20 | margin-bottom: 20px; 21 | font-size: 2rem; 22 | border-bottom: 1px solid #ecf0f1; 23 | } 24 | 25 | .cd-form legend { 26 | display: block; 27 | width: 100%; 28 | -webkit-appearance: none; 29 | -moz-appearance: none; 30 | -ms-appearance: none; 31 | -o-appearance: none; 32 | appearance: none; 33 | } 34 | 35 | .cd-form input[type="submit"] { 36 | border: none; 37 | background: #d75069; 38 | border-radius: .25em; 39 | padding: 16px 20px; 40 | color: #ffffff; 41 | font-weight: bold; 42 | font-family: "Open Sans", sans-serif; 43 | cursor: pointer; 44 | -webkit-font-smoothing: antialiased; 45 | -moz-osx-font-smoothing: grayscale; 46 | -webkit-appearance: none; 47 | -moz-appearance: none; 48 | -ms-appearance: none; 49 | -o-appearance: none; 50 | appearance: none; 51 | } 52 | 53 | .no-touch .cd-form input[type="submit"]:hover { 54 | background: #42a2e1; 55 | } 56 | 57 | .cd-form input[type="submit"]:focus { 58 | outline: none; 59 | background: #2b3e51; 60 | } 61 | 62 | .cd-form input[type="submit"]:active { 63 | -webkit-transform: scale(0.9); 64 | -moz-transform: scale(0.9); 65 | -ms-transform: scale(0.9); 66 | -o-transform: scale(0.9); 67 | transform: scale(0.9); 68 | } 69 | 70 | .cd-form .error-message { 71 | display: none; 72 | } 73 | 74 | .cd-form .error-message p { 75 | background: #e94b35; 76 | color: #ffffff; 77 | font-size: 1.4rem; 78 | text-align: center; 79 | -webkit-font-smoothing: antialiased; 80 | -moz-osx-font-smoothing: grayscale; 81 | border-radius: .25em; 82 | padding: 16px; 83 | } 84 | 85 | .cd-form .success-message p { 86 | background: #4caf50; 87 | color: #ffffff; 88 | font-size: 1.4rem; 89 | text-align: center; 90 | -webkit-font-smoothing: antialiased; 91 | -moz-osx-font-smoothing: grayscale; 92 | border-radius: .25em; 93 | padding: 16px; 94 | } 95 | 96 | .cd-form .error-field { 97 | border-color: #e94b35 !important; 98 | } -------------------------------------------------------------------------------- /src/librarian/css/pending_registrations_style.css: -------------------------------------------------------------------------------- 1 | /*----------Form styles----------*/ 2 | .cd-form { 3 | width: 90%; 4 | max-width: 600px; 5 | margin: 4em auto; 6 | font-size: 1.3rem; 7 | color: #94aab0; 8 | margin-bottom: 10px; 9 | display: block; 10 | } 11 | 12 | .cd-form::after { 13 | clear: both; 14 | content: ""; 15 | display: table; 16 | } 17 | 18 | .cd-form legend { 19 | padding-bottom: 10px; 20 | margin-bottom: 20px; 21 | font-size: 2rem; 22 | border-bottom: 1px solid #ecf0f1; 23 | } 24 | 25 | .cd-form legend { 26 | display: block; 27 | width: 100%; 28 | -webkit-appearance: none; 29 | -moz-appearance: none; 30 | -ms-appearance: none; 31 | -o-appearance: none; 32 | appearance: none; 33 | } 34 | 35 | .cd-form input[type="submit"] { 36 | border: none; 37 | background: #d75069; 38 | border-radius: .25em; 39 | padding: 16px 20px; 40 | color: #ffffff; 41 | font-weight: bold; 42 | font-family: "Open Sans", sans-serif; 43 | cursor: pointer; 44 | -webkit-font-smoothing: antialiased; 45 | -moz-osx-font-smoothing: grayscale; 46 | -webkit-appearance: none; 47 | -moz-appearance: none; 48 | -ms-appearance: none; 49 | -o-appearance: none; 50 | appearance: none; 51 | } 52 | 53 | .no-touch .cd-form input[type="submit"]:hover { 54 | background: #42a2e1; 55 | } 56 | 57 | .cd-form input[type="submit"]:focus { 58 | outline: none; 59 | background: #2b3e51; 60 | } 61 | 62 | .cd-form input[type="submit"]:active { 63 | -webkit-transform: scale(0.9); 64 | -moz-transform: scale(0.9); 65 | -ms-transform: scale(0.9); 66 | -o-transform: scale(0.9); 67 | transform: scale(0.9); 68 | } 69 | 70 | .cd-form .error-message { 71 | display: none; 72 | } 73 | 74 | .cd-form .error-message p { 75 | background: #e94b35; 76 | color: #ffffff; 77 | font-size: 1.4rem; 78 | text-align: center; 79 | -webkit-font-smoothing: antialiased; 80 | -moz-osx-font-smoothing: grayscale; 81 | border-radius: .25em; 82 | padding: 16px; 83 | } 84 | 85 | .cd-form .success-message p { 86 | background: #4caf50; 87 | color: #ffffff; 88 | font-size: 1.4rem; 89 | text-align: center; 90 | -webkit-font-smoothing: antialiased; 91 | -moz-osx-font-smoothing: grayscale; 92 | border-radius: .25em; 93 | padding: 16px; 94 | } 95 | 96 | .cd-form .error-field { 97 | border-color: #e94b35 !important; 98 | } -------------------------------------------------------------------------------- /src/librarian/css/update_balance_style.css: -------------------------------------------------------------------------------- 1 | /*----------Custom Icons----------*/ 2 | .cd-form .icon input{ 3 | padding-left: 54px !important; 4 | } 5 | .cd-form .m-user { 6 | background: url("../../member/img/ic_member_username.svg") no-repeat 16px center; 7 | } 8 | .cd-form [required].m-user { 9 | background: url("../../member/img/ic_member_username.svg") no-repeat 16px center, url("../img/ic_required.svg") no-repeat top right; 10 | } 11 | .cd-form .m-balance { 12 | background: url("../img/ic_book_price.svg") no-repeat 16px center; 13 | } 14 | .cd-form [required].m-balance { 15 | background: url("../img/ic_book_price.svg") no-repeat 16px center, url("../img/ic_required.svg") no-repeat top right; 16 | } -------------------------------------------------------------------------------- /src/librarian/css/update_copies_style.css: -------------------------------------------------------------------------------- 1 | /*----------Custom Icons----------*/ 2 | .cd-form .icon input{ 3 | padding-left: 54px !important; 4 | } 5 | .cd-form .b-isbn { 6 | background: url("../img/ic_book_isbn.svg") no-repeat 16px center; 7 | } 8 | .cd-form [required].b-isbn { 9 | background: url("../img/ic_book_isbn.svg") no-repeat 16px center, url("../img/ic_required.svg") no-repeat top right; 10 | } 11 | .cd-form .b-copies { 12 | background: url("../img/ic_book_copies.svg") no-repeat 16px center; 13 | } 14 | .cd-form [required].b-copies { 15 | background: url("../img/ic_book_copies.svg") no-repeat 16px center, url("../img/ic_required.svg") no-repeat top right; 16 | } -------------------------------------------------------------------------------- /src/librarian/due_handler.php: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | Reminders for today 10 | 11 | 12 | 13 | 14 | 0) 20 | { 21 | $successfulEmails = 0; 22 | $idArray; 23 | $header = 'From: ' . "\r\n"; 24 | $subject = "Return your book today"; 25 | $query = ""; 26 | 27 | for($i=0; $i<$rows; $i++) 28 | { 29 | $row = mysqli_fetch_array($result); 30 | $to = $row[1]; 31 | $message = "This is a reminder to return the book '".$row[3]."' with ISBN ".$row[2]." to the library."; 32 | if(mail($to, $subject, $message, $header) != FALSE) 33 | { 34 | $idArray[$i] = $row[0]; 35 | $successfulEmails++; 36 | } 37 | } 38 | 39 | mysqli_next_result($con); 40 | 41 | for($i=0; $i<$rows; $i++) 42 | { 43 | $query = $con->prepare("UPDATE book_issue_log SET last_reminded = CURRENT_DATE WHERE issue_id = ?;"); 44 | $query->bind_param("d", $idArray[$i]); 45 | $query->execute(); 46 | $query->get_result(); 47 | } 48 | 49 | if($successfulEmails > 0) 50 | echo "

Successfully notified ".$successfulEmails." members

"; 51 | else 52 | echo "ERROR: Couldn't notify any member."; 53 | } 54 | else 55 | echo "

No reminders pending

"; 56 | ?> 57 | 58 | -------------------------------------------------------------------------------- /src/librarian/header_librarian.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 14 | 15 | 23 |
24 | 25 | -------------------------------------------------------------------------------- /src/librarian/home.php: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | Welcome 10 | 11 | 12 | 13 |
14 | 15 | 16 |
17 | 18 | 19 |
20 | 21 | 22 |
23 | 24 | 25 |
26 | 27 | 28 |
29 | 30 | 31 |

32 |
33 | 34 | -------------------------------------------------------------------------------- /src/librarian/img/ic_book_author.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/librarian/img/ic_book_category.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/librarian/img/ic_book_copies.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/librarian/img/ic_book_isbn.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/librarian/img/ic_book_price.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/librarian/img/ic_book_title.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/librarian/img/ic_librarian.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/librarian/img/ic_logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/librarian/img/ic_required.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/librarian/index.php: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | Librarian Login 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | Librarian Login 19 | 20 |
21 |

22 |
23 | 24 |
25 | 26 |
27 | 28 |
29 | 30 |
31 | 32 | 33 | 34 |
35 | 36 | 37 | prepare("SELECT id FROM librarian WHERE username = ? AND password = ?;"); 41 | $query->bind_param("ss", $_POST['l_user'], sha1($_POST['l_pass'])); 42 | $query->execute(); 43 | if(mysqli_num_rows($query->get_result()) != 1) 44 | echo error_without_field("Invalid username/password combination"); 45 | else 46 | { 47 | $_SESSION['type'] = "librarian"; 48 | $_SESSION['id'] = mysqli_fetch_array($result)[0]; 49 | $_SESSION['username'] = $_POST['l_user']; 50 | header('Location: home.php'); 51 | } 52 | } 53 | ?> 54 | 55 | -------------------------------------------------------------------------------- /src/librarian/insert_book.php: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | Add book 11 | 12 | 13 | 14 | 15 | 16 |
17 | Enter book details 18 | 19 |
20 |

21 |
22 | 23 |
24 | 25 |
26 | 27 |
28 | 29 |
30 | 31 |
32 | 33 |
34 | 35 |
36 |

Category

37 | 38 |

39 | 44 |

45 |
46 | 47 |
48 | 49 |
50 | 51 |
52 | 53 |
54 | 55 |
56 | 57 |
58 | 59 | 60 | prepare("SELECT isbn FROM book WHERE isbn = ?;"); 64 | $query->bind_param("s", $_POST['b_isbn']); 65 | $query->execute(); 66 | 67 | if(mysqli_num_rows($query->get_result()) != 0) 68 | echo error_with_field("A book with that ISBN already exists", "b_isbn"); 69 | else 70 | { 71 | $query = $con->prepare("INSERT INTO book VALUES(?, ?, ?, ?, ?, ?);"); 72 | $query->bind_param("ssssdd", $_POST['b_isbn'], $_POST['b_title'], $_POST['b_author'], $_POST['b_category'], $_POST['b_price'], $_POST['b_copies']); 73 | 74 | if(!$query->execute()) 75 | die(error_without_field("ERROR: Couldn't add book")); 76 | echo success("Successfully added book"); 77 | } 78 | } 79 | ?> 80 | -------------------------------------------------------------------------------- /src/librarian/pending_book_requests.php: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | Pending Book Requests 11 | 12 | 13 | 14 | 15 | 16 | prepare("SELECT * FROM pending_book_requests;"); 18 | $query->execute(); 19 | $result = $query->get_result();; 20 | $rows = mysqli_num_rows($result); 21 | if($rows == 0) 22 | echo "

No requests pending

"; 23 | else 24 | { 25 | echo "
"; 26 | echo "Pending book requests"; 27 | echo "
28 |

29 |
"; 30 | echo " 31 | 32 | 33 | 34 | 35 | 36 | "; 37 | for($i=0; $i<$rows; $i++) 38 | { 39 | $row = mysqli_fetch_array($result); 40 | echo ""; 41 | echo ""; 47 | for($j=1; $j<4; $j++) 48 | echo ""; 49 | echo ""; 50 | } 51 | echo "
Username
Book
Time
42 | 46 | ".$row[$j]."
"; 52 | echo "

"; 53 | echo "    "; 54 | echo ""; 55 | echo "
"; 56 | echo "
"; 57 | } 58 | 59 | $header = 'From: ' . "\r\n"; 60 | 61 | if(isset($_POST['l_grant'])) 62 | { 63 | $requests = 0; 64 | for($i=0; $i<$rows; $i++) 65 | { 66 | if(isset($_POST['cb_'.$i])) 67 | { 68 | $request_id = $_POST['cb_'.$i]; 69 | $query = $con->prepare("SELECT member, book_isbn FROM pending_book_requests WHERE request_id = ?;"); 70 | $query->bind_param("d", $request_id); 71 | $query->execute(); 72 | $resultRow = mysqli_fetch_array($query->get_result()); 73 | $member = $resultRow[0]; 74 | $isbn = $resultRow[1]; 75 | $query = $con->prepare("INSERT INTO book_issue_log(member, book_isbn) VALUES(?, ?);"); 76 | $query->bind_param("ss", $member, $isbn); 77 | if(!$query->execute()) 78 | die(error_without_field("ERROR: Couldn\'t issue book")); 79 | $requests++; 80 | 81 | $query = $con->prepare("SELECT email FROM member WHERE username = ?;"); 82 | $query->bind_param("s", $member); 83 | $query->execute(); 84 | $to = mysqli_fetch_array($query->get_result())[0]; 85 | $subject = "Book successfully issued"; 86 | 87 | $query = $con->prepare("SELECT title FROM book WHERE isbn = ?;"); 88 | $query->bind_param("s", $isbn); 89 | $query->execute(); 90 | $title = mysqli_fetch_array($query->get_result())[0]; 91 | 92 | $query = $con->prepare("SELECT due_date FROM book_issue_log WHERE member = ? AND book_isbn = ?;"); 93 | $query->bind_param("ss", $member, $isbn); 94 | $query->execute(); 95 | $due_date = mysqli_fetch_array($query->get_result())[0]; 96 | $message = "The book '".$title."' with ISBN ".$isbn." has been issued to your account. The due date to return the book is ".$due_date."."; 97 | 98 | mail($to, $subject, $message, $header); 99 | } 100 | } 101 | if($requests > 0) 102 | echo success("Successfully granted ".$requests." requests"); 103 | else 104 | echo error_without_field("No request selected"); 105 | } 106 | 107 | if(isset($_POST['l_reject'])) 108 | { 109 | $requests = 0; 110 | for($i=0; $i<$rows; $i++) 111 | { 112 | if(isset($_POST['cb_'.$i])) 113 | { 114 | $requests++; 115 | $request_id = $_POST['cb_'.$i]; 116 | 117 | $query = $con->prepare("SELECT member, book_isbn FROM pending_book_requests WHERE request_id = ?;"); 118 | $query->bind_param("d", $request_id); 119 | $query->execute(); 120 | $resultRow = mysqli_fetch_array($query->get_result()); 121 | $member = $resultRow[0]; 122 | $isbn = $resultRow[1]; 123 | 124 | $query = $con->prepare("SELECT email FROM member WHERE username = ?;"); 125 | $query->bind_param("s", $member); 126 | $query->execute(); 127 | $to = mysqli_fetch_array($query->get_result())[0]; 128 | $subject = "Book issue rejected"; 129 | 130 | $query = $con->prepare("SELECT title FROM book WHERE isbn = ?;"); 131 | $query->bind_param("s", $isbn); 132 | $query->execute(); 133 | $title = mysqli_fetch_array($query->get_result())[0]; 134 | $message = "Your request for issuing the book '".$title."' with ISBN ".$isbn." has been rejected. You can request the book again or visit a librarian for further information."; 135 | 136 | $query = $con->prepare("DELETE FROM pending_book_requests WHERE request_id = ?"); 137 | $query->bind_param("d", $request_id); 138 | if(!$query->execute()) 139 | die(error_without_field("ERROR: Couldn\'t delete values")); 140 | 141 | mail($to, $subject, $message, $header); 142 | } 143 | } 144 | if($requests > 0) 145 | echo success("Successfully deleted ".$requests." requests"); 146 | else 147 | echo error_without_field("No request selected"); 148 | } -------------------------------------------------------------------------------- /src/librarian/pending_registrations.php: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | Pending Registrations 11 | 12 | 13 | 14 | 15 | 16 | prepare("SELECT username, name, email, balance FROM pending_registrations"); 18 | $query->execute(); 19 | $result = $query->get_result(); 20 | $rows = mysqli_num_rows($result); 21 | if($rows == 0) 22 | echo "

No registrations pending

"; 23 | else 24 | { 25 | echo "
"; 26 | echo "Pending registrations"; 27 | echo "
28 |

29 |
"; 30 | echo " 31 | 32 | 33 | 34 | 35 | 36 | 37 | "; 38 | for($i=0; $i<$rows; $i++) 39 | { 40 | $row = mysqli_fetch_array($result); 41 | echo ""; 42 | echo ""; 48 | $j; 49 | for($j=0; $j<3; $j++) 50 | echo ""; 51 | echo ""; 52 | echo ""; 53 | } 54 | echo "
Username
Name
Email
Balance
43 | 47 | ".$row[$j]."$".$row[$j]."


"; 55 | echo "
"; 56 | echo "    "; 57 | echo ""; 58 | echo "
"; 59 | echo "
"; 60 | } 61 | 62 | $header = 'From: ' . "\r\n"; 63 | 64 | if(isset($_POST['l_confirm'])) 65 | { 66 | $members = 0; 67 | for($i=0; $i<$rows; $i++) 68 | { 69 | if(isset($_POST['cb_'.$i])) 70 | { 71 | $username = $_POST['cb_'.$i]; 72 | $query = $con->prepare("SELECT * FROM pending_registrations WHERE username = ?;"); 73 | $query->bind_param("s", $username); 74 | $query->execute(); 75 | $row = mysqli_fetch_array($query->get_result()); 76 | 77 | $query = $con->prepare("INSERT INTO member(username, password, name, email, balance) VALUES(?, ?, ?, ?, ?);"); 78 | $query->bind_param("ssssd", $username, $row[1], $row[2], $row[3], $row[4]); 79 | if(!$query->execute()) 80 | die(error_without_field("ERROR: Couldn\'t insert values")); 81 | $members++; 82 | 83 | $to = $row[3]; 84 | $subject = "Library membership accepted"; 85 | $message = "Your membership has been accepted by the library. You can now issue books using your account."; 86 | mail($to, $subject, $message, $header); 87 | } 88 | } 89 | if($members > 0) 90 | echo success("Successfully added ".$members." members"); 91 | else 92 | echo error_without_field("No registration selected"); 93 | } 94 | 95 | if(isset($_POST['l_delete'])) 96 | { 97 | $requests = 0; 98 | for($i=0; $i<$rows; $i++) 99 | { 100 | if(isset($_POST['cb_'.$i])) 101 | { 102 | $username = $_POST['cb_'.$i]; 103 | $query = $con->prepare("SELECT email FROM pending_registrations WHERE username = ?;"); 104 | $query->bind_param("s", $username); 105 | $query->execute(); 106 | $email = mysqli_fetch_array($query->get_result())[0]; 107 | 108 | $query = $con->prepare("DELETE FROM pending_registrations WHERE username = ?;"); 109 | $query->bind_param("s", $username); 110 | if(!$query->execute()) 111 | die(error_without_field("ERROR: Couldn\'t delete values")); 112 | $requests++; 113 | 114 | $to = $email; 115 | $subject = "Library membership rejected"; 116 | $message = "Your membership has been rejected by the library. Please contact a librarian for further information."; 117 | mail($to, $subject, $message, $header); 118 | } 119 | } 120 | if($requests > 0) 121 | echo success("Successfully deleted ".$requests." requests"); 122 | else 123 | echo error_without_field("No registration selected"); 124 | } 125 | ?> 126 | 127 | -------------------------------------------------------------------------------- /src/librarian/update_balance.php: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | Update balance 11 | 12 | 13 | 14 | 15 | 16 |
17 | Enter the details 18 | 19 |
20 |

21 |
22 | 23 |
24 | 25 |
26 | 27 |
28 | 29 |
30 | 31 | 32 |
33 | 34 | 35 | prepare("SELECT username FROM member WHERE username = ?;"); 39 | $query->bind_param("s", $_POST['m_user']); 40 | $query->execute(); 41 | if(mysqli_num_rows($query->get_result()) != 1) 42 | echo error_with_field("Invalid username", "m_user"); 43 | else 44 | { 45 | $query = $con->prepare("UPDATE member SET balance = balance + ? WHERE username = ?;"); 46 | $query->bind_param("ds", $_POST['m_balance'], $_POST['m_user']); 47 | if(!$query->execute()) 48 | die(error_without_field("ERROR: Couldn\'t add balance")); 49 | echo success("Balance successfully updated"); 50 | } 51 | } 52 | ?> 53 | -------------------------------------------------------------------------------- /src/librarian/update_copies.php: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | Update copies 11 | 12 | 13 | 14 | 15 | 16 |
17 | Enter the details 18 | 19 |
20 |

21 |
22 | 23 |
24 | 25 |
26 | 27 |
28 | 29 |
30 | 31 | 32 |
33 | 34 | 35 | prepare("SELECT isbn FROM book WHERE isbn = ?;"); 39 | $query->bind_param("s", $_POST['b_isbn']); 40 | $query->execute(); 41 | if(mysqli_num_rows($query->get_result()) != 1) 42 | echo error_with_field("Invalid ISBN", "b_isbn"); 43 | else 44 | { 45 | $query = $con->prepare("UPDATE book SET copies = copies + ? WHERE isbn = ?;"); 46 | $query->bind_param("ds", $_POST['b_copies'], $_POST['b_isbn']); 47 | if(!$query->execute()) 48 | die(error_without_field("ERROR: Couldn\'t add copies")); 49 | echo success("Copies successfully updated"); 50 | } 51 | } 52 | ?> 53 | -------------------------------------------------------------------------------- /src/librarian/verify_librarian.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/logout.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/member/css/header_member_style.css: -------------------------------------------------------------------------------- 1 | html * { 2 | -webkit-font-smoothing: antialiased; 3 | -moz-osx-font-smoothing: grayscale; 4 | } 5 | 6 | *, *:after, *:before { 7 | -webkit-box-sizing: border-box; 8 | -moz-box-sizing: border-box; 9 | box-sizing: border-box; 10 | } 11 | 12 | body { 13 | font-size: 100%; 14 | font-family: "Open Sans", sans-serif; 15 | background-color: white; 16 | margin: 0; 17 | } 18 | 19 | img { 20 | max-width: 100%; 21 | } 22 | 23 | header { 24 | position: relative; 25 | height: 50px; 26 | background: #343642; 27 | } 28 | 29 | header #cd-logo { 30 | float: left; 31 | margin: 0 0 0 5%; 32 | /* reduce logo size on mobile and make sure it is left aligned with the transform-origin property */ 33 | -webkit-transform-origin: 0 50%; 34 | -moz-transform-origin: 0 50%; 35 | -ms-transform-origin: 0 50%; 36 | -o-transform-origin: 0 50%; 37 | transform-origin: 0 50%; 38 | -webkit-transform: scale(0.8); 39 | -moz-transform: scale(0.8); 40 | -ms-transform: scale(0.8); 41 | -o-transform: scale(0.8); 42 | transform: scale(0.8); 43 | } 44 | 45 | header #cd-logo img , header #cd-logo p{ 46 | display: inline-block; 47 | vertical-align: middle; 48 | } 49 | 50 | header #cd-logo p{ 51 | font-size: 2.2rem !important; 52 | color: #d75069; 53 | font-weight: bold; 54 | font-size: 1.4rem; 55 | } 56 | 57 | header::after { 58 | /* clearfix */ 59 | content: ''; 60 | display: table; 61 | clear: both; 62 | } 63 | 64 | header a{ 65 | text-decoration: none; 66 | } 67 | 68 | @media only screen and (min-width: 768px) { 69 | header { 70 | height: 80px; 71 | } 72 | header #cd-logo { 73 | margin: 4px 0 0 5%; 74 | -webkit-transform: scale(1); 75 | -moz-transform: scale(1); 76 | -ms-transform: scale(1); 77 | -o-transform: scale(1); 78 | transform: scale(1); 79 | } 80 | } 81 | 82 | .dropbtn { 83 | background: url("../img/ic_member.svg") no-repeat 8px center; 84 | background-color: #d75069; 85 | margin-top: 10%; 86 | color: white; 87 | min-width: 120px; 88 | padding: 0 8px 0 8px; 89 | font-size: 16px; 90 | font-family: "Open Sans", sans-serif; 91 | border: none; 92 | cursor: pointer; 93 | } 94 | 95 | 96 | #librarian-name{ 97 | margin-left: 32px; 98 | } 99 | 100 | .dropdown { 101 | position: relative; 102 | display: inline-block; 103 | float: right; 104 | margin-right: 5%; 105 | } 106 | 107 | .dropdown-content { 108 | display: none; 109 | right: 0; 110 | position: absolute; 111 | background-color: #f9f9f9; 112 | min-width: 160px; 113 | font-size: 1.6rem; 114 | box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); 115 | } 116 | 117 | .dropdown-content a { 118 | color: black; 119 | padding: 12px 16px; 120 | text-decoration: none; 121 | display: block; 122 | } 123 | 124 | .dropdown-content a:hover {background-color: #f1f1f1} 125 | 126 | .dropdown:hover .dropdown-content { 127 | display: block; 128 | } 129 | 130 | .dropdown:hover .dropbtn { 131 | background-color: #d34060;; 132 | } -------------------------------------------------------------------------------- /src/member/css/header_style.css: -------------------------------------------------------------------------------- 1 | html * { 2 | -webkit-font-smoothing: antialiased; 3 | -moz-osx-font-smoothing: grayscale; 4 | } 5 | 6 | *, *:after, *:before { 7 | -webkit-box-sizing: border-box; 8 | -moz-box-sizing: border-box; 9 | box-sizing: border-box; 10 | } 11 | 12 | body { 13 | font-size: 100%; 14 | font-family: "Open Sans", sans-serif; 15 | background-color: white; 16 | margin: 0; 17 | } 18 | 19 | img { 20 | max-width: 100%; 21 | } 22 | 23 | header { 24 | position: relative; 25 | height: 50px; 26 | background: #343642; 27 | } 28 | 29 | header #cd-logo { 30 | float: left; 31 | margin: 0 0 0 5%; 32 | /* reduce logo size on mobile and make sure it is left aligned with the transform-origin property */ 33 | -webkit-transform-origin: 0 50%; 34 | -moz-transform-origin: 0 50%; 35 | -ms-transform-origin: 0 50%; 36 | -o-transform-origin: 0 50%; 37 | transform-origin: 0 50%; 38 | -webkit-transform: scale(0.8); 39 | -moz-transform: scale(0.8); 40 | -ms-transform: scale(0.8); 41 | -o-transform: scale(0.8); 42 | transform: scale(0.8); 43 | } 44 | 45 | header #cd-logo img , header #cd-logo p{ 46 | display: inline-block; 47 | vertical-align: middle; 48 | } 49 | 50 | header #cd-logo p{ 51 | color: #d75069; 52 | font-weight: bold; 53 | font-size: 2.2rem; 54 | } 55 | 56 | header::after { 57 | /* clearfix */ 58 | content: ''; 59 | display: table; 60 | clear: both; 61 | } 62 | 63 | @media only screen and (min-width: 768px) { 64 | header { 65 | height: 80px; 66 | } 67 | header #cd-logo { 68 | margin: 4px 0 0 5%; 69 | -webkit-transform: scale(1); 70 | -moz-transform: scale(1); 71 | -ms-transform: scale(1); 72 | -o-transform: scale(1); 73 | transform: scale(1); 74 | } 75 | } -------------------------------------------------------------------------------- /src/member/css/home_style.css: -------------------------------------------------------------------------------- 1 | /*----------Form styles----------*/ 2 | .cd-form { 3 | width: 90%; 4 | max-width: 1200px; 5 | margin: 4em auto; 6 | font-size: 1.3rem; 7 | color: #94aab0; 8 | margin-bottom: 10px; 9 | display: block; 10 | } 11 | 12 | .cd-form::after { 13 | clear: both; 14 | content: ""; 15 | display: table; 16 | } 17 | 18 | .cd-form legend { 19 | padding-bottom: 10px; 20 | margin-bottom: 20px; 21 | font-size: 2rem; 22 | border-bottom: 1px solid #ecf0f1; 23 | display: block; 24 | width: 100%; 25 | -webkit-appearance: none; 26 | -moz-appearance: none; 27 | -ms-appearance: none; 28 | -o-appearance: none; 29 | appearance: none; 30 | } 31 | 32 | .cd-form input[type="submit"] { 33 | border: none; 34 | background: #d75069; 35 | border-radius: .25em; 36 | padding: 16px 20px; 37 | color: #ffffff; 38 | font-family: "Open Sans", sans-serif; 39 | font-weight: bold; 40 | float: right; 41 | cursor: pointer; 42 | -webkit-font-smoothing: antialiased; 43 | -moz-osx-font-smoothing: grayscale; 44 | -webkit-appearance: none; 45 | -moz-appearance: none; 46 | -ms-appearance: none; 47 | -o-appearance: none; 48 | appearance: none; 49 | } 50 | 51 | .no-touch .cd-form input[type="submit"]:hover { 52 | background: #42a2e1; 53 | } 54 | 55 | .cd-form input[type="submit"]:focus { 56 | outline: none; 57 | background: #2b3e51; 58 | } 59 | 60 | .cd-form input[type="submit"]:active { 61 | -webkit-transform: scale(0.9); 62 | -moz-transform: scale(0.9); 63 | -ms-transform: scale(0.9); 64 | -o-transform: scale(0.9); 65 | transform: scale(0.9); 66 | } 67 | 68 | .cd-form .error-message{ 69 | display: none; 70 | } 71 | 72 | .cd-form .error-message p { 73 | background: #e94b35; 74 | color: #ffffff; 75 | font-size: 1.4rem; 76 | text-align: center; 77 | -webkit-font-smoothing: antialiased; 78 | -moz-osx-font-smoothing: grayscale; 79 | border-radius: .25em; 80 | padding: 16px; 81 | } 82 | 83 | .cd-form .success-message p { 84 | background: #4caf50; 85 | color: #ffffff; 86 | font-size: 1.4rem; 87 | text-align: center; 88 | -webkit-font-smoothing: antialiased; 89 | -moz-osx-font-smoothing: grayscale; 90 | border-radius: .25em; 91 | padding: 16px; 92 | } -------------------------------------------------------------------------------- /src/member/css/index_style.css: -------------------------------------------------------------------------------- 1 | /*----------Custom Icons----------*/ 2 | .cd-form .icon input{ 3 | padding-left: 54px !important; 4 | } 5 | .cd-form .m-user { 6 | background: url("../img/ic_member_username.svg") no-repeat 16px center; 7 | } 8 | .cd-form [required].m-user { 9 | background: url("../img/ic_member_username.svg") no-repeat 16px center, url("../img/ic_required.svg") no-repeat top right; 10 | } 11 | .cd-form .m-pass { 12 | background: url("../img/ic_member_username.svg") no-repeat 16px center; 13 | } 14 | .cd-form [required].m-pass { 15 | background: url("../img/ic_member_pass.svg") no-repeat 16px center, url("../img/ic_required.svg") no-repeat top right; 16 | } -------------------------------------------------------------------------------- /src/member/css/my_books_style.css: -------------------------------------------------------------------------------- 1 | /*----------Form styles----------*/ 2 | .cd-form { 3 | width: 90%; 4 | max-width: 1000px; 5 | margin: 4em auto; 6 | font-size: 1.3rem; 7 | color: #94aab0; 8 | margin-bottom: 10px; 9 | display: block; 10 | } 11 | 12 | .cd-form::after { 13 | clear: both; 14 | content: ""; 15 | display: table; 16 | } 17 | 18 | .cd-form legend { 19 | padding-bottom: 10px; 20 | margin-bottom: 20px; 21 | font-size: 2rem; 22 | border-bottom: 1px solid #ecf0f1; 23 | } 24 | 25 | .cd-form legend { 26 | display: block; 27 | width: 100%; 28 | -webkit-appearance: none; 29 | -moz-appearance: none; 30 | -ms-appearance: none; 31 | -o-appearance: none; 32 | appearance: none; 33 | } 34 | 35 | .cd-form input[type="submit"] { 36 | border: none; 37 | background: #d75069; 38 | border-radius: .25em; 39 | padding: 16px 20px; 40 | color: #ffffff; 41 | font-family: "Open Sans", sans-serif; 42 | font-weight: bold; 43 | float: right; 44 | cursor: pointer; 45 | -webkit-font-smoothing: antialiased; 46 | -moz-osx-font-smoothing: grayscale; 47 | -webkit-appearance: none; 48 | -moz-appearance: none; 49 | -ms-appearance: none; 50 | -o-appearance: none; 51 | appearance: none; 52 | } 53 | 54 | .cd-form input[type="submit"]:focus { 55 | outline: none; 56 | background: #2b3e51; 57 | } 58 | 59 | .cd-form input[type="submit"]:active { 60 | -webkit-transform: scale(0.9); 61 | -moz-transform: scale(0.9); 62 | -ms-transform: scale(0.9); 63 | -o-transform: scale(0.9); 64 | transform: scale(0.9); 65 | } 66 | 67 | .cd-form .error-message, .cd-form .success-message{ 68 | display: none; 69 | } 70 | 71 | .cd-form .error-message p { 72 | background: #e94b35; 73 | color: #ffffff; 74 | font-size: 1.4rem; 75 | text-align: center; 76 | -webkit-font-smoothing: antialiased; 77 | -moz-osx-font-smoothing: grayscale; 78 | border-radius: .25em; 79 | padding: 16px; 80 | } 81 | 82 | .cd-form .success-message p { 83 | background: #4caf50; 84 | color: #ffffff; 85 | font-size: 1.4rem; 86 | text-align: center; 87 | -webkit-font-smoothing: antialiased; 88 | -moz-osx-font-smoothing: grayscale; 89 | border-radius: .25em; 90 | padding: 16px; 91 | } -------------------------------------------------------------------------------- /src/member/css/register_style.css: -------------------------------------------------------------------------------- 1 | /*----------Custom Icons----------*/ 2 | .cd-form .icon input{ 3 | padding-left: 54px !important; 4 | } 5 | .cd-form .m-user { 6 | background: url("../img/ic_member_username.svg") no-repeat 16px center; 7 | } 8 | .cd-form [required].m-user { 9 | background: url("../img/ic_member_username.svg") no-repeat 16px center, url("../img/ic_required.svg") no-repeat top right; 10 | } 11 | .cd-form .m-pass { 12 | background: url("../img/ic_member_username.svg") no-repeat 16px center; 13 | } 14 | .cd-form [required].m-pass { 15 | background: url("../img/ic_member_pass.svg") no-repeat 16px center, url("../img/ic_required.svg") no-repeat top right; 16 | } 17 | .cd-form .m-name { 18 | background: url("../img/ic_member_name.svg") no-repeat 16px center; 19 | } 20 | .cd-form [required].m-name { 21 | background: url("../img/ic_member_name.svg") no-repeat 16px center, url("../img/ic_required.svg") no-repeat top right; 22 | } 23 | .cd-form .m-email { 24 | background: url("../img/ic_member_email.svg") no-repeat 16px center; 25 | } 26 | .cd-form [required].m-email { 27 | background: url("../img/ic_member_email.svg") no-repeat 16px center, url("../img/ic_required.svg") no-repeat top right; 28 | } 29 | .cd-form .m-balance { 30 | background: url("../img/ic_member_balance.svg") no-repeat 16px center; 31 | } 32 | .cd-form [required].m-balance { 33 | background: url("../img/ic_member_balance.svg") no-repeat 16px center, url("../img/ic_required.svg") no-repeat top right; 34 | } -------------------------------------------------------------------------------- /src/member/header_member.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 14 | 15 | 33 |
34 | 35 | -------------------------------------------------------------------------------- /src/member/home.php: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | Welcome 11 | 12 | 13 | 14 | 15 | 16 | prepare("SELECT * FROM book ORDER BY title"); 18 | $query->execute(); 19 | $result = $query->get_result(); 20 | if(!$result) 21 | die("ERROR: Couldn't fetch books"); 22 | $rows = mysqli_num_rows($result); 23 | if($rows == 0) 24 | echo "

No books available

"; 25 | else 26 | { 27 | echo "
"; 28 | echo "Available books"; 29 | echo "
30 |

31 |
"; 32 | echo ""; 33 | echo " 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | "; 42 | for($i=0; $i<$rows; $i++) 43 | { 44 | $row = mysqli_fetch_array($result); 45 | echo " 46 | "; 51 | for($j=0; $j<6; $j++) 52 | if($j == 4) 53 | echo ""; 54 | else 55 | echo ""; 56 | echo ""; 57 | } 58 | echo "
ISBN
Title
Author
Category
Price
Copies available
47 | $".$row[$j]."".$row[$j]."
"; 59 | echo "

"; 60 | echo "
"; 61 | } 62 | 63 | if(isset($_POST['m_request'])) 64 | { 65 | if(empty($_POST['rd_book'])) 66 | echo error_without_field("Please select a book to issue"); 67 | else 68 | { 69 | $query = $con->prepare("SELECT copies FROM book WHERE isbn = ?;"); 70 | $query->bind_param("s", $_POST['rd_book']); 71 | $query->execute(); 72 | $copies = mysqli_fetch_array($query->get_result())[0]; 73 | if($copies == 0) 74 | echo error_without_field("No copies of the selected book are available"); 75 | else 76 | { 77 | $query = $con->prepare("SELECT request_id FROM pending_book_requests WHERE member = ?;"); 78 | $query->bind_param("s", $_SESSION['username']); 79 | $query->execute(); 80 | if(mysqli_num_rows($query->get_result()) == 1) 81 | echo error_without_field("You can only request one book at a time"); 82 | else 83 | { 84 | $query = $con->prepare("SELECT book_isbn FROM book_issue_log WHERE member = ?;"); 85 | $query->bind_param("s", $_SESSION['username']); 86 | $query->execute(); 87 | $result = $query->get_result(); 88 | if(mysqli_num_rows($result) >= 3) 89 | echo error_without_field("You cannot issue more than 3 books at a time"); 90 | else 91 | { 92 | $rows = mysqli_num_rows($result); 93 | for($i=0; $i<$rows; $i++) 94 | if(strcmp(mysqli_fetch_array($result)[0], $_POST['rd_book']) == 0) 95 | break; 96 | if($i < $rows) 97 | echo error_without_field("You have already issued a copy of this book"); 98 | else 99 | { 100 | $query = $con->prepare("SELECT balance FROM member WHERE username = ?;"); 101 | $query->bind_param("s", $_SESSION['username']); 102 | $query->execute(); 103 | $memberBalance = mysqli_fetch_array($query->get_result())[0]; 104 | 105 | $query = $con->prepare("SELECT price FROM book WHERE isbn = ?;"); 106 | $query->bind_param("s", $_POST['rd_book']); 107 | $query->execute(); 108 | $bookPrice = mysqli_fetch_array($query->get_result())[0]; 109 | if($memberBalance < $bookPrice) 110 | echo error_without_field("You do not have sufficient balance to issue this book"); 111 | else 112 | { 113 | $query = $con->prepare("INSERT INTO pending_book_requests(member, book_isbn) VALUES(?, ?);"); 114 | $query->bind_param("ss", $_SESSION['username'], $_POST['rd_book']); 115 | if(!$query->execute()) 116 | echo error_without_field("ERROR: Couldn\'t request book"); 117 | else 118 | echo success("Book successfully requested. You will be notified by email when the book is issued to your account"); 119 | } 120 | } 121 | } 122 | } 123 | } 124 | } 125 | } 126 | ?> 127 | 128 | -------------------------------------------------------------------------------- /src/member/img/ic_logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/member/img/ic_member.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/member/img/ic_member_balance.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/member/img/ic_member_email.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/member/img/ic_member_name.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/member/img/ic_member_pass.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/member/img/ic_member_username.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/member/img/ic_required.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/member/index.php: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | Member Login 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | Member Login 19 | 20 |
21 |

22 |
23 | 24 |
25 | 26 |
27 | 28 |
29 | 30 |
31 | 32 | 33 | 34 |



35 | 36 |

Don't have an account? Sign up 37 |

38 | 39 | 40 | prepare("SELECT id, balance FROM member WHERE username = ? AND password = ?;"); 44 | $query->bind_param("ss", $_POST['m_user'], sha1($_POST['m_pass'])); 45 | $query->execute(); 46 | $result = $query->get_result(); 47 | 48 | if(mysqli_num_rows($result) != 1) 49 | echo error_without_field("Invalid username/password combination"); 50 | else 51 | { 52 | $resultRow = mysqli_fetch_array($result); 53 | $balance = $resultRow[1]; 54 | if($balance < 0) 55 | echo error_without_field("Your account has been suspended. Please contact a librarian for further information"); 56 | else 57 | { 58 | $_SESSION['type'] = "member"; 59 | $_SESSION['id'] = $resultRow[0]; 60 | $_SESSION['username'] = $_POST['m_user']; 61 | header('Location: home.php'); 62 | } 63 | } 64 | } 65 | ?> 66 | 67 | -------------------------------------------------------------------------------- /src/member/my_books.php: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | My books 11 | 12 | 13 | 14 | 15 | 16 | 17 | prepare("SELECT book_isbn FROM book_issue_log WHERE member = ?;"); 19 | $query->bind_param("s", $_SESSION['username']); 20 | $query->execute(); 21 | $result = $query->get_result(); 22 | $rows = mysqli_num_rows($result); 23 | if($rows == 0) 24 | echo "

No books currently issued

"; 25 | else 26 | { 27 | echo "
"; 28 | echo "My books"; 29 | echo "
30 |

31 |
"; 32 | echo "
33 |

34 |
"; 35 | echo" 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | "; 44 | for($i=0; $i<$rows; $i++) 45 | { 46 | $isbn = mysqli_fetch_array($result)[0]; 47 | if($isbn != NULL) 48 | { 49 | $query = $con->prepare("SELECT title, author, category FROM book WHERE isbn = ?;"); 50 | $query->bind_param("s", $isbn); 51 | $query->execute(); 52 | $innerRow = mysqli_fetch_array($query->get_result()); 53 | echo " 54 | "; 60 | echo ""; 61 | for($j=0; $j<3; $j++) 62 | echo ""; 63 | $query = $con->prepare("SELECT due_date FROM book_issue_log WHERE member = ? AND book_isbn = ?;"); 64 | $query->bind_param("ss", $_SESSION['username'], $isbn); 65 | $query->execute(); 66 | echo ""; 67 | echo ""; 68 | } 69 | } 70 | echo "
ISBN
Title
Author
Category
Due Date
55 | 59 | ".$isbn."".$innerRow[$j]."".mysqli_fetch_array($query->get_result())[0]."

"; 71 | echo ""; 72 | echo "
"; 73 | } 74 | 75 | if(isset($_POST['b_return'])) 76 | { 77 | $books = 0; 78 | for($i=0; $i<$rows; $i++) 79 | if(isset($_POST['cb_book'.$i])) 80 | { 81 | $query = $con->prepare("SELECT due_date FROM book_issue_log WHERE member = ? AND book_isbn = ?;"); 82 | $query->bind_param("ss", $_SESSION['username'], $_POST['cb_book'.$i]); 83 | $query->execute(); 84 | $due_date = mysqli_fetch_array($query->get_result())[0]; 85 | 86 | $query = $con->prepare("SELECT DATEDIFF(CURRENT_DATE, ?);"); 87 | $query->bind_param("s", $due_date); 88 | $query->execute(); 89 | $days = (int)mysqli_fetch_array($query->get_result())[0]; 90 | 91 | $query = $con->prepare("DELETE FROM book_issue_log WHERE member = ? AND book_isbn = ?;"); 92 | $query->bind_param("ss", $_SESSION['username'], $_POST['cb_book'.$i]); 93 | if(!$query->execute()) 94 | die(error_without_field("ERROR: Couldn\'t return the books")); 95 | 96 | if($days > 0) 97 | { 98 | $penalty = 5*$days; 99 | $query = $con->prepare("SELECT price FROM book WHERE isbn = ?;"); 100 | $query->bind_param("s", $_POST['cb_book'.$i]); 101 | $query->execute(); 102 | $price = mysqli_fetch_array($query->get_result())[0]; 103 | if($price < $penalty) 104 | $penalty = $price; 105 | $query = $con->prepare("UPDATE member SET balance = balance - ? WHERE username = ?;"); 106 | $query->bind_param("ds", $penalty, $_SESSION['username']); 107 | $query->execute(); 108 | echo ''; 112 | } 113 | $books++; 114 | } 115 | if($books > 0) 116 | { 117 | echo ''; 121 | $query = $con->prepare("SELECT balance FROM member WHERE username = ?;"); 122 | $query->bind_param("s", $_SESSION['username']); 123 | $query->execute(); 124 | 125 | $balance = (int)mysqli_fetch_array($query->get_result())[0]; 126 | if($balance < 0) 127 | header("Location: ../logout.php"); 128 | } 129 | else 130 | echo error_without_field("Please select a book to return"); 131 | } 132 | ?> 133 | 134 | 135 | -------------------------------------------------------------------------------- /src/member/register.php: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | Register 10 | 11 | 12 | 13 | 14 | 15 |
16 | Enter your details 17 | 18 |
19 |

20 |
21 | 22 |
23 | 24 |
25 | 26 |
27 | 28 |
29 | 30 |
31 | 32 |
33 | 34 |
35 | 36 |
37 | 38 |
39 | 40 |
41 | 42 |
43 | 44 |
45 | 46 | 47 | prepare("(SELECT username FROM member WHERE username = ?) UNION (SELECT username FROM pending_registrations WHERE username = ?);"); 55 | $query->bind_param("ss", $_POST['m_user'], $_POST['m_user']); 56 | $query->execute(); 57 | if(mysqli_num_rows($query->get_result()) != 0) 58 | echo error_with_field("The username you entered is already taken", "m_user"); 59 | else 60 | { 61 | $query = $con->prepare("(SELECT email FROM member WHERE email = ?) UNION (SELECT email FROM pending_registrations WHERE email = ?);"); 62 | $query->bind_param("ss", $_POST['m_email'], $_POST['m_email']); 63 | $query->execute(); 64 | if(mysqli_num_rows($query->get_result()) != 0) 65 | echo error_with_field("An account is already registered with that email", "m_email"); 66 | else 67 | { 68 | $query = $con->prepare("INSERT INTO pending_registrations(username, password, name, email, balance) VALUES(?, ?, ?, ?, ?);"); 69 | $query->bind_param("ssssd", $_POST['m_user'], sha1($_POST['m_pass']), $_POST['m_name'], $_POST['m_email'], $_POST['m_balance']); 70 | if($query->execute()) 71 | echo success("Details recorded. You will be notified on the email ID provided when your details have been verified"); 72 | else 73 | echo error_without_field("Couldn\'t record details. Please try again later"); 74 | } 75 | } 76 | } 77 | } 78 | ?> 79 | 80 | -------------------------------------------------------------------------------- /src/member/verify_member.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/message_display.php: -------------------------------------------------------------------------------- 1 | 5 | document.getElementById("error").innerHTML = "'.$message.'"; 6 | document.getElementById("error-message").style.display = "block"; 7 | '; 8 | } 9 | 10 | function error_with_field($message, $field) 11 | { 12 | return ''; 17 | } 18 | 19 | function success($message) 20 | { 21 | return ''; 25 | } 26 | ?> -------------------------------------------------------------------------------- /src/verify_logged_out.php: -------------------------------------------------------------------------------- 1 | --------------------------------------------------------------------------------