Team 1
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # COSC 3380 Library Database ### Team 1 Members - Hunter Jerry McPherson: [Hunter6058](https://github.com/Hunter6058) - Rodolfo Jose Chavez: [RodolfoChavez22](https://github.com/RodolfoChavez22) - Elinnoel S. Nuñez: [elinnunez](https://github.com/elinnunez) - Justin Isaac Jose: [jjugsting](https://github.com/jjugstin) ## Project Description The goal in building this project was to create an online library database management system with different functionalities such as item requests, item cancellations, create, read, update, and delete operations. There are 3 types of accounts, (users, staff, admin) that have different levels of accessibility. All users may request/hold items from the catalog database and there is also different maximum requests/orders and loan periods allowed for different types of users. ## File Description For this project, our team used MYSQL for the database build, PHP for both server side scripting and front end design, AWS to host our website as well as XAMPP for the sql dump hosting. ## Live Site http://18.207.206.17/library ## Installation Instructions for Windows localhost - Download & Install [XAMPP](https://www.apachefriends.org/download.html) - git clone project inside htdocs directory of XAMPP file location - Run XAMPP and click Start on Apache & MySQL - Go to http://127.0.0.1/phpmyadmin and create new database named library - Import the sql dump file that's inside sql folder into the newly created database - Open connect.php file and edit file line 3 as `$con=new mysqli('localhost', 'root', '', 'library');` and save. - Open browser and enter directory: http://localhost/library/homepage.php - Project should now run on local server ## Roles - User ``` Maximum 3 current holds at any given time Allowed 1 week loan periods ``` - Staff ``` Maximum 5 current holds at any given time Allowed 2 week loan periods ``` - Admin ``` Maximum 5 current holds at any given time Allowed 2 week loan periods Can edit/add/delete items and users Ability to accept/cancel user item requests View reports and loan history of all users ``` - All ``` Rate of $3 added to balance owed per each day an item is past due date ``` ## Triggers - NOTIFICATIONS TRIGGER - We implemented a trigger in the reservation table that triggered an insert into the notification table every time a new reservation was made. The insert logged the reservation id, user id and the item id into the notifications table. ``` CREATE TRIGGER 'notification' AFTER INSERT ON 'reservation' FOR EACH ROW INSERT into notifications VALUES(null, NEW.user, item) ``` - AUDIT LOG TRIGGER - Implemented user update/insert/delete triggers in the user table that would log types of actions into the audit table for display in admin dashboard. ``` EXAMPLE OF AFTER USER DELETE, OTHER TRIGGER FOLLOW THE SAME FORMAT CREATE TRIGGER `User_delete` AFTER UPDATE ON `user` FOR EACH ROW IF NEW.Deleted_id = 1 THEN INSERT INTO audit (Type, Type_id, Action, Date) VALUES ('user', NEW.User_id, 'DELETE', NOW()); END IF ``` - ITEM INSERT AND DELETE TRIGGERS- We implemented a set of insert and delete triggers that would be called if an item (book, journal, electronic, or disk) was inserted or deleted. Trigger would update their respective item table (like the book table for a book item) on the status of the item and update the user table of the user who's book it was by adding or decrementing their current orders total. ``` EXAMPLE OF BOOK DELETE TRIGGER OTHER TRIGGERS FOLLOW THE SAME FORMAT CREATE TRIGGER `Item_Delete_Book` AFTER UPDATE ON `item` FOR EACH ROW IF New.Book_id IS NULL AND Old.Book_id is NOT NULL THEN UPDATE book SET book.Rental_status = book.Rental_status + 1 WHERE book.Book_id = old.Book_id; UPDATE user SET user.Current_orders = user.Current_orders - 1 WHERE user.User_id = New.User_id; END IF ``` - ADD LOAN TRIGGER - AFTER UPDATE Trigger created on the reservations table that would create a loan in loans table when requested items were approved by admin and the reservation is updated to "Loaned". Depending on the type of user account, the correct loan period due date would be set for the requesting user. ``` CREATE TRIGGER `Add_Loan` AFTER UPDATE ON `reservation` FOR EACH ROW INSERT INTO loan (Item,User,Loan_date,Return_date) VALUES (New.Item,New.User,CURRENT_DATE,CURRENT_DATE + INTERVAL 14 DAY) ``` ## Features ## Admin Panel - Dashboard holds reports and general statistics about the website along with a audit log listing any edits done to the items within the database - User/Item (Book, Journal, Disk, Electronics) pages involve the use of create, read, update, delete operations, sorting and search filter functionality to display data of each of their respective table - Loans page allows admins/librarians to confirm that a item has been returned and will update the user according to whether they turned in an item on time or not (get a fine if they dont) - Requests tab allows admins/librarians to accept or cancel book requests, if accepted it gets forwarded to the loans page, if it gets cancelled it gets put back in the catalog. - Restore page allows admins to recover any items that were marked for deletion. - Reports page displays loan history with search filter functionality as well as catalog item statistics ## User Dashboard - Dashboard holds important user information with the option to update some of that information that may change like email or password. - Also allows user to see their Book history with information on the date it was requested, book status (if it was returned or still on loan, ect.) and book name. - User is allowed to see books that are still being pending and click a checkbox to cancel the request. - User also can check any notifications, which includes a message that shows to the user what item they have requested. - Once a user has "debt" accumulated they can no longer request books until balance is 0. ## Catalog - Users are able to search through the database by different item types (Books, Disks, Journals, Electronics) and filter through results by title, creator, or issn/isbn. - Search results display images, name, creator, item type, publisher and availability of items to the user - On clicking each row, modal popups display more information such as copies available, description and the reservation button for the user. - Reservation functionality that allows only logged in users to request an item with item request limits. ## Home Page - Home page servers to promote books that are 'popular' by showing books who are running low on supply. - Clicking on the book image presented allows user to read a description of the book and important book information as well as book supply. - Home page allows signed-in users to reserve one of the promoted books straight from the home page. - This page also has a search button option that will redirect users to the catalog and show queried result based on the title searched by the user. ## Signup/Login - Signup account validation in order to create secure accounts with needed security measures. - User account validation is used in order to display the correct features depending on user type - Passwords are stored inside the database in hashed form for security - Security features are implemented to only allow non-deleted users access to login and request items. ## Project Tree Structure ``` library ├─ .htaccess ├─ about.php ├─ admin │ ├─ adminpanel.php │ ├─ astyle.css │ ├─ book │ │ ├─ add.php │ │ ├─ delete.php │ │ ├─ restore.php │ │ └─ update.php │ ├─ books.php │ ├─ dashboard.php │ ├─ disk │ │ ├─ add.php │ │ ├─ delete.php │ │ ├─ restore.php │ │ └─ update.php │ ├─ disks.php │ ├─ electronic │ │ ├─ add.php │ │ ├─ delete.php │ │ ├─ restore.php │ │ └─ update.php │ ├─ electronics.php │ ├─ journal │ │ ├─ add.php │ │ ├─ delete.php │ │ ├─ restore.php │ │ └─ update.php │ ├─ journals.php │ ├─ key │ │ ├─ author.php │ │ ├─ brand.php │ │ ├─ genre.php │ │ ├─ publisher.php │ │ └─ type.php │ ├─ loans.php │ ├─ reports.php │ ├─ request.php │ ├─ requests │ │ └─ requestchange.php │ ├─ restore.php │ ├─ user │ │ ├─ add.php │ │ ├─ delete.php │ │ ├─ restore.php │ │ └─ update.php │ └─ users.php ├─ catalog.php ├─ connect.php ├─ find.php ├─ footer.php ├─ header.php ├─ homepage.php ├─ img │ ├─ image.jpg ├─ index.php ├─ login.php ├─ logout.php ├─ modal.js ├─ README.md ├─ reserve.php ├─ signup.php ├─ sql │ └─ library.sql ├─ style.css ├─ user │ └─ userdashboard.php └─ validate_signup.php ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully