{"id":19003448,"url":"https://github.com/magnetic-fox/noter-backend","last_synced_at":"2025-09-02T18:32:36.165Z","repository":{"id":205806424,"uuid":"715086014","full_name":"Magnetic-Fox/Noter-Backend","owner":"Magnetic-Fox","description":"Simple PHP Backend for my Noter project.","archived":false,"fork":false,"pushed_at":"2024-12-27T13:20:28.000Z","size":65,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-27T14:28:17.050Z","etag":null,"topics":["backend","experiments","functional","learning","networking","new","noter","old","php","php-backend","php-database-connection","rest","simple","ugly"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Magnetic-Fox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-06T13:01:18.000Z","updated_at":"2024-12-27T13:20:31.000Z","dependencies_parsed_at":"2023-11-18T03:23:46.117Z","dependency_job_id":"cd62d794-eed9-4478-a3d0-e54fba5aa985","html_url":"https://github.com/Magnetic-Fox/Noter-Backend","commit_stats":null,"previous_names":["magnetic-fox/noter-backend"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Magnetic-Fox%2FNoter-Backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Magnetic-Fox%2FNoter-Backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Magnetic-Fox%2FNoter-Backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Magnetic-Fox%2FNoter-Backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Magnetic-Fox","download_url":"https://codeload.github.com/Magnetic-Fox/Noter-Backend/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240027414,"owners_count":19736210,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","experiments","functional","learning","networking","new","noter","old","php","php-backend","php-database-connection","rest","simple","ugly"],"created_at":"2024-11-08T18:19:09.803Z","updated_at":"2025-02-21T13:44:22.153Z","avatar_url":"https://github.com/Magnetic-Fox.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Noter Backend\n\nThis repo contains my really simple PHP backend for my Noter project.\n\n## What is included in this repo?\n\nA PHP scripts implementing backend for simple notetaking (Noter, in short) application with some config PHP files.\nThe solution here is provided in \"ready to use\" form. That's the reason, why there is `index.php` file, which is a main backend file.\nFiles `noterapi.php` and `noterconst.php` implements all functions and constants needed for this solution to work.\nFiles `mysql-connect.php` and `noter-config.php` are configuration files provided here with default values.\n`test.php` is a really, really simple form for testing the backend.\n\n## Database structure\n\nFor Noter to work, the database has to be prepared correctly.\nThere are two tables needed. One called `Noter_Users` and another one called `Noter_Entries`. The first one is for storing information about users (username, password hash, etc.) and the second one is for storing notes created by registered users.\n\n### `Noter_Users` table\nHere are the columns for `Noter_Users` table:\n```\nColumn Name             Data Type               NULL?           Auto Increment? Key             Default (sugg.)\n-----------------------+-----------------------+---------------+---------------+---------------+---------------\nID                      int(10) unsigned        NOT NULL        auto_increment  PRIMARY_KEY\nUserName                varchar(255)            NOT NULL\nPasswordHash            varchar(255)            NOT NULL\nActive                  tinyint(1)              NOT NULL                                        1\nDateRegistered          datetime(6)             NOT NULL\nRemoteAddress           varchar(100)                                                            NULL\nForwardedFor            varchar(100)                                                            NULL\nUserAgent               varchar(255)                                                            NULL\nLastChanged             datetime(6)             NOT NULL\nLastRemoteAddress       varchar(100)                                                            NULL\nLastForwardedFor        varchar(100)                                                            NULL\nLastUserAgent           varchar(255)                                                            NULL \n```\n\nThe only constraint needed for table above is to make ID a primary key.\n\n### `Noter_Entries` table\nHere are the columns for `Noter_Entries` table:\n```\nColumn Name             Data Type               NULL?           Auto Increment? Key             Default (sugg.)\n-----------------------+-----------------------+---------------+---------------+---------------+---------------\nID                      int(10) unsigned        NOT NULL        auto_increment  PRIMARY_KEY\nUserID                  int(10) unsigned        NOT NULL                        FOREIGN KEY\nSubject                 varchar(255)            NOT NULL\nEntry                   longtext                NOT NULL\nDateAdded               datetime(6)             NOT NULL\nLastModified            datetime(6)             NOT NULL\nLocked                  tinyint(1)              NOT NULL                                        0\nRemoteAddress           varchar(100)                                                            NULL\nForwardedFor            varchar(100)                                                            NULL\nUserAgent               varchar(255)                                                            NULL\nLastRemoteAddress       varchar(100)                                                            NULL\nLastForwardedFor        varchar(100)                                                            NULL\nLastUserAgent           varchar(255)                                                            NULL\n```\n\nThe constraints for table above are as follows:\n* ID has to be primary key of the table\n* UserID has to be foreign key pointing to the actual user ID in the `Noter_Users` table.\n\n## SQL Codes for creating needed tables\n\nFor further information, there are SQL codes, generated by database editor of my choice (DBeaver), for creating the tables mentioned above.\n\n### `Noter_Users`\n\n```\nCREATE TABLE `Noter_Users` (\n  `ID` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `UserName` varchar(255) NOT NULL,\n  `PasswordHash` varchar(255) NOT NULL,\n  `Active` tinyint(1) NOT NULL DEFAULT 1,\n  `DateRegistered` datetime(6) NOT NULL,\n  `RemoteAddress` varchar(100) DEFAULT NULL,\n  `ForwardedFor` varchar(100) DEFAULT NULL,\n  `UserAgent` varchar(255) DEFAULT NULL,\n  `LastChanged` datetime(6) NOT NULL,\n  `LastRemoteAddress` varchar(100) DEFAULT NULL,\n  `LastForwardedFor` varchar(100) DEFAULT NULL,\n  `LastUserAgent` varchar(255) DEFAULT NULL,\n  PRIMARY KEY (`ID`)\n)\n```\n\n### `Noter_Entries`\n```\nCREATE TABLE `Noter_Entries` (\n  `ID` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `UserID` int(10) unsigned NOT NULL,\n  `Subject` varchar(255) NOT NULL,\n  `Entry` longtext NOT NULL,\n  `DateAdded` datetime(6) NOT NULL,\n  `LastModified` datetime(6) NOT NULL,\n  `Locked` tinyint(1) NOT NULL DEFAULT 0,\n  `RemoteAddress` varchar(100) DEFAULT NULL,\n  `ForwardedFor` varchar(100) DEFAULT NULL,\n  `UserAgent` varchar(255) DEFAULT NULL,\n  `LastRemoteAddress` varchar(100) DEFAULT NULL,\n  `LastForwardedFor` varchar(100) DEFAULT NULL,\n  `LastUserAgent` varchar(255) DEFAULT NULL,\n  PRIMARY KEY (`ID`),\n  KEY `Noter_Entries_FK` (`UserID`),\n  CONSTRAINT `Noter_Entries_FK` FOREIGN KEY (`UserID`) REFERENCES `Noter_Users` (`ID`)\n)\n``` \n\n## Disclaimer\n\nI've made much effort to provide here working and checked codes with hope it will be useful.\n**However, these codes are provided here \"AS IS\", with absolutely no warranty! I take no responsibility for using them - DO IT ON YOUR OWN RISK!**\n\n## License\n\nCodes provided here are free for personal use.\nIf you like to use any part of these codes in your software, just please give me some simple credits and it will be okay. ;)\nIn case you would like to make paid software and use parts of these codes - please, contact me before.\n\n*Bartłomiej \"Magnetic-Fox\" Węgrzyn,\nNovember 8, 2021 - November 9, 2023*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagnetic-fox%2Fnoter-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagnetic-fox%2Fnoter-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagnetic-fox%2Fnoter-backend/lists"}