~skye/poker/README

view raw


POKER

	A free and open source poker website.

DEPENDS

	* php8.3
	* {php8.3-,}sqlite

RUNNING

	In debug mode,
	% etc/run.sh

	Otherwise, with fcgi.

FS

	/
	| com.php          common functions/types/etc.
	| cfg.php          server config stuff.
	| index.php        you know.
	| act/
	     forms/pages/actions.
	     | auth.php    POST  login & register accounts.
	     | mkroom.php  POST  create rooms.
	     | room.php    GET   view a room. play the game.
	| etc/
	     misc scripts.
	     | chown.sh    fix file ownership.
	     | run.sh      run the php debug server.
	| src/
	     misc php/js src files.
	     | db.php      connect to and manage the main database.
	     | room.php    Room class and room database management.
	| css/
	     css shit.
	     | style.css   main stylesheet.
	     | style.php   load and manage stylesheets.
	| run/
	     database files.
	     | poker.db    main database.
	     | rooms/      room datatbases, named after their hashes.

ARCHITECTURE

	Every file requires com.php, which provides utilities and
	starts the session.

	You connect to the database:

		require 'src/db.php';
		$db = new Database('run/poker.db');

	You can find a user by name:

		$db->get_user($name);

	...or by id:

		$db->get_user_by_id($id);

	New methods added to Database should sanitize their inputs
	automatically and use collect_rows() to collect their outputs
	into arrays.

	You can get the currently logged in user:

		$me = whoami($db);
		if (!!$me) {
			/* user is logged in */
		} else {
			/* couldn't get logged in user */
		}

	You can connect to a room by its hash:

		require 'src/room.php';
		$r = Room::from_hash($hash);