It is a website with programming exercises. Started as https://www.codeabbey.com in September of 2013 it is now (as of summer 2024) moving to opensource, so that everyone can quickly setup similar website for personal coding puzzle collection, or for school, enterprise company needs (e.g. for interviewing, screening candidates).
Here are two parts - one about how it works and another about how to run it. Consult them in any order according to your needs.
To make studying the project easier it could be done in steps. These steps are represented by certain points (branches) in repository, as more and more functionality are added.
- Step 1 - framework - at this point here is bare minimum of files, or "framework" which work for page loading. Refer to README in this version to learn more.
- Step 2 - users - now database is enabled and functionality of registering users, login, logout is added.
- Step 3 - htaccess - about some important features which are configured outside PHP code
- Step 4 - tasks - pages for creating, editing, listing and viewing tasks.
- Step 5 - submit - submission and checking.
- Step 6 - userrank - user profile and ranking pages.
- Step 7 - sync - no critical features added, mainly some improvements due to syncronizing codebase with existing website.
At previous steps a number of changes were made which made the code significantly diverge from the main site, which is inconvenient for further manipulations and support. So a kind of "sync-up" process was undertaken, which involved some changes and additions both in main site code and also here. All should work as on step 6, there are minor improvements to main page.
This is a typical PHP + MySQL application, so you need an http-server with PHP interpreter and MySQL (MariaDB).
There are THREE ways to launch this zoo relatively easily.
Docker is something resembling virtual-machine (but not exactly) widely used in industry. We describe
the content of "containers" we need in a file (or few) and docker prepares everything. You'll need to install
docker itself (there could be subtle steps like setting user group in linux but generally it is not much
complicated) - this is available in linux, windows and OsX. Then run files docker-build.sh to build an
image containing our Apache2 httpd + PHP server with MariaDB in one. then docker-run.sh to launch container
from it. If all is fine, the site should be ready at http://localhost:8080/
To initialize database: open http://localhost:8080/sqlexec.php and copy-paste content of the file dbinit.sql into the textarea, then click exec.
Pick some free hosting, for example AwardSpace / AtWebpages and simply copy files there. If you'll get error because RewriteRules exist in .htaccess while
the server has no rewrite module enabled, and you can't control it - just comment these lines.
Then you'll get the site running on the web. There could be some limitations about some auxiliary functions (e.g. 3rd party login etc) but that's not much important for you now (such things anyway require efforts to setup).
Setup database: this is done with control-panel of the hosting - generally you are provided
with some database name and connection info and create user here via web-interface. So then you
need to put corresponding settings into conf.php file and populate database with tables, for
which use the content of dbinit.sql except first few lines (no user or db creation) with
some query running tool in the web-interface.
With this approach you'll find software package (by the name XAMPP probably) which contains HTTP server, PHP and MySQL
inside and set up on your machine. It is not very difficult also and in some respects more handy than with docker.
Then copy files there and setup database. For managing database there should be PHPMyAdmin
web tool in the LAMPP packet - make use of it and generally follow instructions for
shared hosting given above.