From 84e2c47d3ac9901213eeb8b27ff0878ea5f28d82 Mon Sep 17 00:00:00 2001 From: bye Date: Sun, 19 Nov 2023 12:24:38 +0000 Subject: [PATCH] Forgot to commit lawl --- .idea/dataSources.xml | 2 +- .../5bc27beb-c8ab-420d-bdbc-055b37ae9e39.xml | 197 ++++++++++++++--- .../storage_v2/_src_/schema/id.Gw0AAA.meta | 2 +- .idea/id.iml | 3 + .idea/php.xml | 8 + 404.html | 3 +- account.php | 120 +++++----- accounts_handler.php | 37 ++++ admin.php | 15 +- admin_accounts.php | 9 +- admin_apps.php | 23 ++ admin_apps_create.php | 39 ++++ bcid.svg | 6 + composer.json | 5 +- composer.lock | 151 ++++++++++++- credits.html | 206 ++++++++++++++++++ database.php | 17 ++ docs.php | 41 ++++ docs/hosting/configphp.md | 17 ++ docs/hosting/index.md | 7 + docs/index.md | 1 + favicon.ico | Bin 0 -> 582 bytes favicon.svg | 44 ++++ footer.php | 2 +- forgot_password.php | 2 +- head.php | 2 + header.php | 17 +- index.php | 48 +++- landing.php | 1 + misc_functions.php | 4 + profile.php | 64 ++++++ signin.php | 8 +- signout.php | 2 + styles/colours.css | 19 +- styles/design.css | 33 ++- styles/layout.css | 22 +- styles/profiles.css | 39 ++++ styles/types.css | 6 +- 38 files changed, 1094 insertions(+), 128 deletions(-) create mode 100644 admin_apps.php create mode 100644 admin_apps_create.php create mode 100644 bcid.svg create mode 100644 credits.html create mode 100644 database.php create mode 100644 docs.php create mode 100644 docs/hosting/configphp.md create mode 100644 docs/hosting/index.md create mode 100644 docs/index.md create mode 100644 favicon.ico create mode 100644 favicon.svg create mode 100644 profile.php create mode 100644 styles/profiles.css diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml index 092000e..b7c12c5 100644 --- a/.idea/dataSources.xml +++ b/.idea/dataSources.xml @@ -5,7 +5,7 @@ mariadb true org.mariadb.jdbc.Driver - jdbc:mariadb://id.local:3306/id + jdbc:mariadb://id:3306/id $ProjectFileDir$ diff --git a/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39.xml b/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39.xml index 718f6a6..f35c051 100644 --- a/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39.xml +++ b/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39.xml @@ -1217,8 +1217,8 @@ phpmyadmin|schema||phpmyadmin|localhost|UPDATE|G 1 - 2023-11-10.19:39:44 - 2023-11-10.19:39:47 + 2023-11-16.19:58:39 + 2023-11-16.19:58:50 utf8mb4_general_ci @@ -1248,94 +1248,237 @@ phpmyadmin|schema||phpmyadmin|localhost|UPDATE|G InnoDB utf8mb4_general_ci - +
InnoDButf8mb4_general_ci
- + + InnoDB + utf8mb4_general_ci +
+ + InnoDB + utf8mb4_general_ci +
+ + InnoDB + utf8mb4_general_ci +
+ varchar(7)|0s 1 1 - + text|0s 1 2 - + date|0s current_timestamp() 1 3 - + text|0s 4 - + text|0s 1 5 - + tinyint(1)|0s 1 6 - + + tinyint(1)|0s + 0 + 1 + 7 + + + tinyint(1)|0s + 0 + 1 + 8 + + id btree 1 - + email hash 1 - + 1 1 PRIMARY - + email - + + int(10)|0s + 1 + 1 + + + varchar(7)|0s + 2 + + + text|0s + 1 + 3 + + + text|0s + 4 + + + owner_id + set-null + cascade + id + accounts + + + id + btree + 1 + + + owner_id + btree + + + 1 + 1 + PRIMARY + + 1 int(11)|0s 1 1 - - tinytext|0s + + int(11)|0s 1 2 - - varchar(7)|0s + + text|0s 1 3 - - int(11)|0s - 1 + + text|0s 4 - - owner_id + + text|0s + 1 + 5 + + + app_id id - accounts + apps - + id btree 1 - + + app_id + btree + + + 1 + 1 + PRIMARY + + + 8 + int(11)|0s + 1 + 1 + + + tinytext|0s + 1 + 2 + + + varchar(7)|0s + 1 + 3 + + + int(11)|0s + 1 + 4 + + + owner_id + id + accounts + + + id + btree + 1 + + owner_id btree - + + 1 + 1 + PRIMARY + + + varchar(7)|0s + 1 + 1 + + + text|0s + 2 + + + tinyint(1)|0s + 0 + 1 + 3 + + + tinyint(1)|0s + 0 + 1 + 4 + + + id + id + accounts + + + id + btree + 1 + + 1 1 PRIMARY diff --git a/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39/storage_v2/_src_/schema/id.Gw0AAA.meta b/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39/storage_v2/_src_/schema/id.Gw0AAA.meta index 4867f21..d4880e4 100644 --- a/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39/storage_v2/_src_/schema/id.Gw0AAA.meta +++ b/.idea/dataSources/5bc27beb-c8ab-420d-bdbc-055b37ae9e39/storage_v2/_src_/schema/id.Gw0AAA.meta @@ -1,2 +1,2 @@ #n:id -! [1699645184000, 0, null, null, -2147483648, -2147483648] +! [1700164719000, 0, null, null, -2147483648, -2147483648] diff --git a/.idea/id.iml b/.idea/id.iml index f61ecb3..21a8ff4 100644 --- a/.idea/id.iml +++ b/.idea/id.iml @@ -16,6 +16,9 @@ + + + diff --git a/.idea/php.xml b/.idea/php.xml index 5e0063f..4c1495a 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -23,12 +23,20 @@ + + + + + + + + diff --git a/404.html b/404.html index e2066aa..811b6d0 100644 --- a/404.html +++ b/404.html @@ -1,2 +1,3 @@

404

-

Sorry, that page couldn't be found.

\ No newline at end of file +

Sorry, that page couldn't be found.

+ diff --git a/account.php b/account.php index 2dd71ad..d4408c1 100644 --- a/account.php +++ b/account.php @@ -1,6 +1,6 @@ prepare('SELECT * FROM accounts WHERE id = ? LIMIT 1'); $stmt->execute([$_SESSION['id']]); @@ -59,6 +59,9 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { $message = "Updated sucessfully. Changes might take a few minutes to take effect."; + header('Location: /profile'); + die("Redirecting..."); + } skip_submit: @@ -73,61 +76,68 @@ if (isset($message )) { } ?> -
- -
- - - +
+
+ +
+ + + +
+ +
-
-
- Profile -
- - -
-
- - -
- -
- - -
- -
- - -
-
-
- Password -

You only need to insert values here if you're resetting your password.

-
- - -
-
- - -
-
- - -
-
- - -
- -
-

Danger Zone

-

Sign out - Delete account

-
diff --git a/accounts_handler.php b/accounts_handler.php index e82d637..c262cac 100644 --- a/accounts_handler.php +++ b/accounts_handler.php @@ -1,6 +1,43 @@ prepare($sql); + $stmt->execute([$bcid]); + $has_pfp = $stmt->fetch(); + } catch (PDOException $e) { + http_response_code(500); + die($e); + } + + $appendix = "default.png"; + + if ($has_pfp['has_pfp']) { + $appendix = $bcid; + } + + return 'https://cdn.byecorps.com/id/profile/'.$appendix; + +} + +function get_display_name($bcid, $use_bcid_fallback=true):string { + $display_name = db_execute("SELECT display_name FROM accounts WHERE id = ?", [$bcid])['display_name']; + if (!empty($display_name)) { + return $display_name; + } + + if ($use_bcid_fallback) { + return $bcid; + } + + return ""; +} + // Password resets const PASSWORD_RESET_VALIDITY = 300; // in seconds. function create_password_reset($bcid):string { diff --git a/admin.php b/admin.php index 5151a28..d92d029 100644 --- a/admin.php +++ b/admin.php @@ -1,16 +1,23 @@ - -

Admin panel

If you're not Bye and you're seeing this, I'm fucked!

Accounts

+

Apps

+ +

Init

  • diff --git a/admin_accounts.php b/admin_accounts.php index 483fcf7..3a73e80 100644 --- a/admin_accounts.php +++ b/admin_accounts.php @@ -1,9 +1,4 @@ -"); -} + query($sql); @@ -12,14 +7,12 @@ if (!$result) { die(""); } - $count_req = $pdo->query("SELECT COUNT(*) FROM accounts"); $count = $count_req->fetchColumn(); ?> -

    Admin

    Accounts

    There is currently accounts registered.

    diff --git a/admin_apps.php b/admin_apps.php new file mode 100644 index 0000000..8ae771a --- /dev/null +++ b/admin_apps.php @@ -0,0 +1,23 @@ +fetchColumn(); + +?> +

    Apps

    + +

    There is currently apps registered.

    + + +
      +
      ";
      +        print_r($row);
      +		echo "";
      +    }
      +    ?>
      +
    + diff --git a/admin_apps_create.php b/admin_apps_create.php new file mode 100644 index 0000000..bc3bec9 --- /dev/null +++ b/admin_apps_create.php @@ -0,0 +1,39 @@ + + +

    App Creator

    + +
    + + + + + + + +
    \ No newline at end of file diff --git a/bcid.svg b/bcid.svg new file mode 100644 index 0000000..8911001 --- /dev/null +++ b/bcid.svg @@ -0,0 +1,6 @@ + + Made with Pixels to Svg https://codepen.io/shshaw/pen/XbxvNj + + + + \ No newline at end of file diff --git a/composer.json b/composer.json index b051582..7e441b3 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,9 @@ { "require": { "sentry/sdk": "^4.0", - "phpmailer/phpmailer": "^6.8" + "phpmailer/phpmailer": "^6.8", + "erusev/parsedown": "^1.7", + "erusev/parsedown-extra": "^0.8.1", + "kornrunner/blurhash": "^1.2" } } diff --git a/composer.lock b/composer.lock index 426f4ed..1f28978 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,109 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "909990e5dfeb8b9d8bb3572e0f7de24e", + "content-hash": "9baad85ecd1e18878c3fe588203305a1", "packages": [ + { + "name": "erusev/parsedown", + "version": "1.7.4", + "source": { + "type": "git", + "url": "https://github.com/erusev/parsedown.git", + "reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/cb17b6477dfff935958ba01325f2e8a2bfa6dab3", + "reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35" + }, + "type": "library", + "autoload": { + "psr-0": { + "Parsedown": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Emanuil Rusev", + "email": "hello@erusev.com", + "homepage": "http://erusev.com" + } + ], + "description": "Parser for Markdown.", + "homepage": "http://parsedown.org", + "keywords": [ + "markdown", + "parser" + ], + "support": { + "issues": "https://github.com/erusev/parsedown/issues", + "source": "https://github.com/erusev/parsedown/tree/1.7.x" + }, + "time": "2019-12-30T22:54:17+00:00" + }, + { + "name": "erusev/parsedown-extra", + "version": "0.8.1", + "source": { + "type": "git", + "url": "https://github.com/erusev/parsedown-extra.git", + "reference": "91ac3ff98f0cea243bdccc688df43810f044dcef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/erusev/parsedown-extra/zipball/91ac3ff98f0cea243bdccc688df43810f044dcef", + "reference": "91ac3ff98f0cea243bdccc688df43810f044dcef", + "shasum": "" + }, + "require": { + "erusev/parsedown": "^1.7.4" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35" + }, + "type": "library", + "autoload": { + "psr-0": { + "ParsedownExtra": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Emanuil Rusev", + "email": "hello@erusev.com", + "homepage": "http://erusev.com" + } + ], + "description": "An extension of Parsedown that adds support for Markdown Extra.", + "homepage": "https://github.com/erusev/parsedown-extra", + "keywords": [ + "markdown", + "markdown extra", + "parsedown", + "parser" + ], + "support": { + "issues": "https://github.com/erusev/parsedown-extra/issues", + "source": "https://github.com/erusev/parsedown-extra/tree/0.8.x" + }, + "time": "2019-12-30T23:20:37+00:00" + }, { "name": "guzzlehttp/psr7", "version": "2.6.1", @@ -181,6 +282,54 @@ }, "time": "2021-10-08T21:21:46+00:00" }, + { + "name": "kornrunner/blurhash", + "version": "v1.2.2", + "source": { + "type": "git", + "url": "https://github.com/kornrunner/php-blurhash.git", + "reference": "bc8a4596cb0a49874f0158696a382ab3933fefe4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kornrunner/php-blurhash/zipball/bc8a4596cb0a49874f0158696a382ab3933fefe4", + "reference": "bc8a4596cb0a49874f0158696a382ab3933fefe4", + "shasum": "" + }, + "require": { + "php": "^7.3|^8.0" + }, + "require-dev": { + "ext-gd": "*", + "ocramius/package-versions": "^1.4|^2.0", + "phpstan/phpstan": "^0.12", + "phpunit/phpunit": "^9", + "vimeo/psalm": "^4.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "kornrunner\\Blurhash\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Boris Momčilović", + "email": "boris.momcilovic@gmail.com" + } + ], + "description": "Pure PHP implementation of Blurhash", + "homepage": "https://github.com/kornrunner/php-blurhash", + "support": { + "issues": "https://github.com/kornrunner/php-blurhash/issues", + "source": "https://github.com/kornrunner/php-blurhash.git" + }, + "time": "2022-07-13T19:38:39+00:00" + }, { "name": "phpmailer/phpmailer", "version": "v6.8.1", diff --git a/credits.html b/credits.html new file mode 100644 index 0000000..1b46f18 --- /dev/null +++ b/credits.html @@ -0,0 +1,206 @@ + + +
    + +
    +
    +

    ByeCorps ID

    + v. +
    + +

    ByeCorps ID is a ByeCorps service created by Bye. It wouldn't be possible without the work of other amazing people.

    + + +
    + +

    Credits

    +
      +
    • Bye, who programmed this entire thing.
    • +
    • Adam Newbold for writing the code this site depends on for routing
    • +
    • PHP, the language it's built in.
    • +
    • Composer, to keep all the libs together.
    • +
    • Caddy, the webserver it's usually running on.
    • +
    • MariaDB, the MySQL server.
    • +
    • PhpStorm by JetBrains and Visual Studio Code by Microsoft, both of which were used to make this service.
    • +
    + +

    Music

    + + +

    Third-party libraries

    + +

    ByeCorps ID relies on the following third-party libraries:

    +
      +
    • sentry/sdk for diagnostics.
    • +
    • phpmailer/phpmailer for email.
    • +
    • erusev/parsedown and erusev/parsedown-extra for parsing Markdown right in PHP.
    • +
    • kornrunner/blurhash for generating blurhashes.
    • +
    + +

    Getting the FPS of your display powered by this StackOverflow answer.

    + + +

    Thank you for using ByeCorps ID.

    +
    + + diff --git a/database.php b/database.php new file mode 100644 index 0000000..bd1fcbd --- /dev/null +++ b/database.php @@ -0,0 +1,17 @@ +prepare($sql); + $stmt->execute($variables); + return $stmt->fetch(); + +} + +function db_query($sql) { + global $pdo; + + return $pdo->query($sql); +} diff --git a/docs.php b/docs.php new file mode 100644 index 0000000..83fcf34 --- /dev/null +++ b/docs.php @@ -0,0 +1,41 @@ +"; + +$file = fopen($file_path, "r"); +$file_contents = fread($file, filesize($file_path)); +fclose($file); + +echo $Parsedown->parse($file_contents); diff --git a/docs/hosting/configphp.md b/docs/hosting/configphp.md new file mode 100644 index 0000000..a9ec9d3 --- /dev/null +++ b/docs/hosting/configphp.md @@ -0,0 +1,17 @@ +# config.php + +Here's all the variables in `config.php`: + +| Variable | Description / Example | +|----------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `BASE_URL` | The url generated for emails. Should be "https://id.byecorps.com" in production. | +| `DB_ADDRESS` | The address for the database. Usually `localhost` | +| `DB_USERNAME` | Username for connecting to the database. | +| `DB_PASSWORD` | Password for the database. | +| `DB_DATABASE` | The database to connect to. | +| `PDO_OPTIONS` | `
    const PDO_OPTIONS = [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_EMULATE_PREPARES => false,];` | +| `DB_DSN` | `mysql:host='.DB_ADDRESS.';dbname='.DB_DATABASE.';charset=utf8mb4`, for PDO. | +| `SENTRY_DSN ` | Used for Sentry. | +| `MAIL_HOST` | SMTP host for emails | +| `MAIL_USERNAME` | SMTP username | +| `MAIL_PASSWORD` | SMTP password | \ No newline at end of file diff --git a/docs/hosting/index.md b/docs/hosting/index.md new file mode 100644 index 0000000..8d7e14a --- /dev/null +++ b/docs/hosting/index.md @@ -0,0 +1,7 @@ +# Hosting + +Here's everything you need to know about hosting ByeCorps ID. This mainly covers the `config.php` file. + +## Contents + +- [config.php](hosting/configphp) diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..cdf3ce4 --- /dev/null +++ b/docs/index.md @@ -0,0 +1 @@ +# ByeCorps ID docs \ No newline at end of file diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..55f8337278fc94f2ad9f2c340658d36f65ecf594 GIT binary patch literal 582 zcmZQzU<5)QUIrj3!C=6|z#zuJz@P!dJU}c3#2|4H0LhJl;U5AA3>X-Y@q+>ehW{TJ Q7(g^K{tgs-3B({d01|%_1ONa4 literal 0 HcmV?d00001 diff --git a/favicon.svg b/favicon.svg new file mode 100644 index 0000000..bc9d790 --- /dev/null +++ b/favicon.svg @@ -0,0 +1,44 @@ + + + + + Made with Pixels to Svg https://codepen.io/shshaw/pen/XbxvNj + + + diff --git a/footer.php b/footer.php index 5ea6a24..5740dae 100644 --- a/footer.php +++ b/footer.php @@ -1,3 +1,3 @@
    - © ByeCorps + © ByeCorps Credits
    \ No newline at end of file diff --git a/forgot_password.php b/forgot_password.php index 3795b61..f96d8ee 100644 --- a/forgot_password.php +++ b/forgot_password.php @@ -3,7 +3,7 @@ use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; -if (isset($_SESSION['auth'])) { +if ($_SESSION['auth']) { header('Location: /account'); } diff --git a/head.php b/head.php index 51e1992..2d5c655 100644 --- a/head.php +++ b/head.php @@ -7,5 +7,7 @@ > <?php if (isset($doc_title)) { echo $doc_title." | "; } ?>ByeCorps ID + + \ No newline at end of file diff --git a/header.php b/header.php index 7cae72e..81242f3 100644 --- a/header.php +++ b/header.php @@ -2,8 +2,7 @@ fetchColumn(); } -if ($name == '') { +if (empty($name)) { $name = ''.format_bcid($_SESSION['id']).''; } @@ -20,18 +19,20 @@ skip_auth: ?> - - +
    + + ByeCorps ID +
- + + Admin panel"; ?> diff --git a/index.php b/index.php index 29c6d78..843ce30 100644 --- a/index.php +++ b/index.php @@ -1,24 +1,35 @@ SENTRY_DSN, -// // Specify a fixed sample rate -// 'traces_sample_rate' => 1.0, -// // Set a sampling rate for profiling - this is relative to traces_sample_rate -// 'profiles_sample_rate' => 1.0, -//]); +if ($_SESSION['auth']) { + $user = db_execute("SELECT * FROM `accounts` WHERE id = ? LIMIT 1", [$_SESSION['id']]); +} + +\Sentry\init([ + 'dsn' => SENTRY_DSN, + // Specify a fixed sample rate + 'traces_sample_rate' => 1.0, + // Set a sampling rate for profiling - this is relative to traces_sample_rate + 'profiles_sample_rate' => 1.0, +]); function does_variable_exists( $variable ) { return (isset($$variable)) ? "true" : "false"; @@ -56,7 +67,10 @@ $paths = array( "/" => ["landing.php"], "/admin" => ['admin.php'], "/admin/init/database" => ["admin_initdatabase.php"], - "/admin/accounts" => ["admin_accounts.php"], + "/admin/list/accounts" => ["admin_accounts.php"], + "/admin/list/apps" => ["admin_apps.php"], + "/admin/create/app" => ["admin_apps_create.php"], + "/account" => ["account.php", "Your account"], "/signin" => ["signin.php", "Sign in"], "/signup" => ["signup.php", "Sign up"], @@ -64,6 +78,9 @@ $paths = array( "/forgot/password" => ["forgot_password.php", "Forgot password"], "/admin/signinas" => ["signinas.php"], "/reset/password" => ["reset_password.php", "Reset password"], + "/docs" => ["docs.php", "Docs"], + "/credits" => ["credits.html", "Credits"], + "/profile" => ["profile.php", "Profile"], ); if (isset($paths[$path])) { @@ -91,12 +108,19 @@ else { Admin"; + } + + if ($uri[0] == "admin" && !$user['is_admin']) { http_response_code(401); die(""); } + if ($uri[0] == "docs") { + $include = "docs.php"; + } } diff --git a/landing.php b/landing.php index c60788c..6e59f94 100644 --- a/landing.php +++ b/landing.php @@ -1,5 +1,6 @@
+

ByeCorps ID

Log into ByeCorps and beyond with a single ID.

diff --git a/misc_functions.php b/misc_functions.php index 149d3f4..1164dad 100644 --- a/misc_functions.php +++ b/misc_functions.php @@ -7,4 +7,8 @@ function generateRandomString($length = 10) { $randomString .= $characters[random_int(0, $charactersLength - 1)]; } return $randomString; +} + +function current_git_commit():string { + return trim(exec("git log --pretty=\"%h\" -n1 HEAD 2>&1")); } \ No newline at end of file diff --git a/profile.php b/profile.php new file mode 100644 index 0000000..e0fa505 --- /dev/null +++ b/profile.php @@ -0,0 +1,64 @@ + + + + "0000000", + "public_display_name" => false, + "public_avatar" => false, + "description" => null, + ]; +} + +$avatar = "https://cdn.byecorps.com/id/profile/default.png"; +$display_name = ""; + +if ($_SESSION['id'] != $profile['id']) { + if ($profile['public_avatar']) { + $avatar = get_avatar_url($profile['id']); + } + if ($profile['public_display_name']) { + $display_name = get_display_name($profile['id'], false); + } +} else { + $avatar = get_avatar_url($profile['id']); + $display_name = get_display_name($profile['id'], false); +} + + + +?> + +
+ Avatar +
+
+
+
+
+ +
+
+

Badges

+
+ +
+

Info

+ + + + + + +
Joined
+ +
+
diff --git a/signin.php b/signin.php index 03614f1..6de8f74 100644 --- a/signin.php +++ b/signin.php @@ -28,7 +28,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($query['callback'])) { header("Location: ".$query['callback']); } else { - header("Location: /account"); + header("Location: /profile"); +// echo "
";
+//            var_dump($user);
+//            var_dump($_SESSION);
+//            die();
         }
 
         exit;
@@ -52,5 +56,5 @@ if (isset($message)) {
 
 
 

- New? Register for a ByeCorps ID. + Forgot password? • New? Register for a ByeCorps ID.

\ No newline at end of file diff --git a/signout.php b/signout.php index fb565e5..c128d18 100644 --- a/signout.php +++ b/signout.php @@ -1,5 +1,7 @@ diff --git a/styles/colours.css b/styles/colours.css index 61ee275..f11cb97 100644 --- a/styles/colours.css +++ b/styles/colours.css @@ -19,10 +19,21 @@ --red-8: #e03131; --green-5: #51cf66; --green-8: #2f9e44; + --grey-0: #f8f9fa; + --grey-2: #e9ecef; + --grey-8: #343a40; + --grey-9: #212529; + + --background: white; + --background-dark: #121212; color-scheme: light dark; } +html { + background: var(--background, white); +} + button, .button { background-color: #1f302b40; color: var(--white); @@ -47,7 +58,7 @@ header a { color: var(--dark-slate-gray); } -input { +input, textarea { all: unset; padding: 1em; text-align: start; @@ -91,6 +102,10 @@ input[data-com-onepassword-filled="dark"] { } @media screen and (prefers-color-scheme: dark) { + html { + background: var(--background-dark, #121212); + } + button.primary, .button.primary { color: var(--flax); background-color: var(--dark-slate-gray); @@ -105,7 +120,7 @@ input[data-com-onepassword-filled="dark"] { color: var(--flax); } - input { + input, textarea { background-color: #2c2c2c77; } diff --git a/styles/design.css b/styles/design.css index 27cc92b..acdac55 100644 --- a/styles/design.css +++ b/styles/design.css @@ -21,7 +21,7 @@ header a { /* inputs */ -input { +input, textarea { all: unset; padding: 1em; text-align: start; @@ -45,3 +45,34 @@ input:disabled { opacity: 0.75; cursor: not-allowed; } + +table { + background-color: var(--grey-2); + width: 100%; + font-size: 1.1rem; + padding: .5rem; + border-radius: 1.0rem; +} + +table > tbody > tr { + display: grid; + align-items: center; + gap: 0.5rem; + grid-template-columns: auto 1fr; +} + +table > tbody > tr > td { + background: var(--grey-0); + border-radius: .5em; + padding: .5em; +} + +@media screen and (prefers-color-scheme: dark) { + table { + background-color: var(--grey-9); + } + + table > tbody > tr > td { + background: var(--grey-8); + } +} diff --git a/styles/layout.css b/styles/layout.css index 6e4f2b4..03d20f2 100644 --- a/styles/layout.css +++ b/styles/layout.css @@ -4,6 +4,8 @@ body { display: flex; flex-direction: column; + + min-height: 100vh; } header { @@ -20,6 +22,7 @@ header .start { display: flex; gap: 1rem; + } header .middle { @@ -30,12 +33,21 @@ header .middle { header .end { margin-left: auto; display: flex; + gap: 1rem; +} + +header .avatar { + height: 1.5em; } main { height: 100%; flex: 1; padding: 1rem 1rem; + + max-width: 1500px; + margin: auto; + width: 100%; } footer { @@ -62,7 +74,7 @@ legend { } form:has(fieldset) { - + /* fit two fieldsets side by side */ display: grid; grid-template-columns: 1fr 1fr; @@ -123,8 +135,16 @@ form { gap: 1rem; } +.hero .logo { + height: 128px; +} + .accountnav { display: flex; gap: 1rem; } +#wrapper { + display: flex; +} + diff --git a/styles/profiles.css b/styles/profiles.css new file mode 100644 index 0000000..147c159 --- /dev/null +++ b/styles/profiles.css @@ -0,0 +1,39 @@ + +#profile { + display: flex; + gap: 1rem; + padding: 1rem; + width: 750px; + border-radius: 2em; + align-items: center; + + margin: auto; + + background: var(--grey-0); +} + +#profile > .avatar { + height: 150px; + + border-radius: 1em; +} + +#profile > .info > .displayname { + font-size: 2.5rem; + font-weight: bolder; +} + +#profile > .info > .bcid { + font-size: 1.5rem; +} + +#details { + display: grid; + grid-template-columns: 3fr 1fr; +} + +@media screen and (prefers-color-scheme: dark) { + #profile { + background: var(--grey-9); + } +} diff --git a/styles/types.css b/styles/types.css index 83ae2a8..7b09f26 100644 --- a/styles/types.css +++ b/styles/types.css @@ -6,7 +6,7 @@ @import url(/fontawesome/css/all.css); html { - font-family: 'montserrat', sans-serif; + font-family: montserrat, sans-serif; font-weight: 400; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; @@ -22,6 +22,10 @@ h2.subheading + h1 { margin-top: 0; } +#sitetitle, .font-montserrat, h1, h2, h3, h4, h5, h6, legend { + font-family: 'montserrat', sans-serif; +} + .bc-1 { font-weight: 700; }