fixed bugs with old system for views/actions
This commit is contained in:
@@ -4,3 +4,4 @@ composer.lock
|
||||
/data/profile_pictures
|
||||
/data/articles
|
||||
/data/tmp
|
||||
import.sql
|
||||
|
||||
@@ -11,7 +11,7 @@ include_once 'components/head.php';
|
||||
if (!isset($_SESSION['role_id']))
|
||||
header('Location: user.php?view=login');
|
||||
else if ($_SESSION['role_id'] >= contributor)
|
||||
header('Location: user.php?action=view&user_id=' . $_SESSION['user_id']);
|
||||
header('Location: user.php?view=display&user_id=' . $_SESSION['user_id']);
|
||||
|
||||
include_once 'functions/admin_functions.php';
|
||||
|
||||
@@ -32,7 +32,7 @@ if (isset($_POST['action']) && isset($_POST['form_id']) || isset($_FILES['csv'])
|
||||
break;
|
||||
|
||||
case 'view':
|
||||
header('Location: user.php?action=view&user_id=' . $_POST['selected_users'][0]);
|
||||
header('Location: user.php?view=display&user_id=' . $_POST['selected_users'][0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ function admin_user_view()
|
||||
|
||||
foreach ($results as $key => $result) {
|
||||
$display .= '
|
||||
<tr data-href="user.php?action=view&user_id=' . $result['user_id'] . '">
|
||||
<tr data-href="user.php?view=display&user_id=' . $result['user_id'] . '">
|
||||
<td class="excluded_cell">
|
||||
<label class="form_checkbox_container">
|
||||
<input name="selected_users[]" value="' . $result['user_id'] . '" type="checkbox">
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
#### Overview:
|
||||
This site is built in PHP with MariaDB and a Golang HTTP server. Composer is being used to supply the following PHP packages:
|
||||
|
||||
- `vlucas/phpdotenv`
|
||||
- `erusev/parsedown`
|
||||
- `wildbit/postmark-php`
|
||||
|
||||
---
|
||||
#### 19/03/2025 - Foundations:
|
||||
Tonight, I [pushed](https://github.com/quaxlyqueen/vintagecoding.net/tree/5af0547864f730091c98d64cc18014bc69d0a041) the first major feature implementation. The database is designed, and a component has been created for article cards, and markdown parsing into HTML for the articles themselves.
|
||||
|
||||
---
|
||||
#### 20/03/2025 - Refining UX:
|
||||
Just now, I [pushed](https://github.com/quaxlyqueen/vintagecoding.net/tree/c0fc9e9d0053975837ae48fa1db93b5095d33146) the second major feature implementation. I've narrowed in on the database design with small tweaks, setup some dynamic page loading on articles.php, created a navigation bar, a dark/light mode button, and styled everything up. It's shaping up pretty well!
|
||||
|
||||
There's a lot more work to be done. The entire login system needs to be implemented, user homepages, account management, admin panels, the article composer...the list goes on.
|
||||
|
||||
---
|
||||
#### 25/03/2025 - Account Management:
|
||||
Just now, I [pushed](https://github.com/quaxlyqueen/vintagecoding.net/tree/9a45075010434a4dedd0c5d48a78ff6be3bcfddc) the third major feature implementation: account management! Not the most exciting thing ever, but it is important for the long term success of this project. With that completed, v0.0.9 is completed! Though I prematurely labeled the commit v0.1.0...But in any case there's a lot to go before release.
|
||||
|
||||
There is now a sign up and login user flow, a user page with basic settings, and authorization for accessing things like the article composer. Oh yeah, I got a basic version of that running in [this commit](https://github.com/quaxlyqueen/vintagecoding.net/tree/0a27cd1f5cd02735d06a64090a05937a5d6bcf3a) a few hours ago.
|
||||
|
||||
Two major tasks remain prior to v0.1.0. First, I still need to finish implementing the image upload on new sign ups (and for changing a profile picture), but that should be relatively minor. Second, I need to use author information to flesh out article pages.
|
||||
|
||||
I'm now setting my sights on v0.2.0, and the myriad of features I'm planning on implementing for that. It'll be the account and customization overhaul. Tools for the owner and administrator(s), enabling users to request their role to be changed to contributor or administrator, user home pages with their own custom CSS, the ability to theme the site however they please, and mobile support! I'm excited just thinking about it. It'll require a MAJOR overhaul of the CSS, but thanks to the minimalist aesthetic, the CSS file is only a few hundred disorganized lines.
|
||||
|
||||
I've put maybe 30 hours into this project so far. I'm not sure if that's good or bad, but not getting crazy with the CSS has saved a **ton** of time. And, I really like how it's looking. I'm really excited about this project and I am giddy to see how much I can get implemented by the release on 25/05/2025 -- two months! I'm starting an *unpaid* internship tomorrow, so I probably won't have the time to put 30 hours a week into this. For now, I'm just excited to see what the future holds.
|
||||
|
||||
---
|
||||
#### 01/04/2025 - Basic Security & Administration:
|
||||
Earlier today, I [pushed](https://github.com/quaxlyqueen/vintagecoding.net/tree/cec9091ee01839b133ecbbc5616463a759837dda) a major security fix along with getting CI/CD setup, and last night I [pushed](https://github.com/quaxlyqueen/vintagecoding.net/tree/b9bb620ae01134431ff1941e7577ba58eee84e42) a secure overhaul of the 'Remember Me' functionality. I didn't write about it then, but a few days ago I also [pushed](https://github.com/quaxlyqueen/vintagecoding.net/tree/ff7e799b7fd2822cf27e0afe47274de222b2b508) the image upload along with a image cropper. Still buggy as hell, but its a start. And a couple days ago I [committed](https://github.com/quaxlyqueen/vintagecoding.net/tree/e6735a9a206a207b6fab704785451a6309944ddd) admin functionality to manage users and articles. I would've thought I'd slow down, but I'm just trucking along.
|
||||
|
||||
Specifically, the 'Remember Me' functionality is now using a token system, a randomly generated 1024 bit string, associated with the user ID and hashed values of both the remote address and (if used) forwarded for headers. If these don't match what is stored in the database, this should mean that the client browser/device is not the original browser/device used to create the token.
|
||||
|
||||
For the other security fix, I converted all of the `mysqli` statements to prepared statements. This is to mitigate the risk of SQL Injection attacks. Particularly since this site is live (though I'm not promoting it so it is still 'unreleased'), it is important to ensure that despite the lack of sensitive information, would-be attackers are unable to access user information, gain admin access, or compromise the server in any way.
|
||||
|
||||
Onto the user home pages! Here's a general breakdown of what I have in mind. Every user has a homepage that they can customize the CSS for. Effectively, give the users a place to make their own. Eventually even change the layout and structure of their page. For now, the page is going to have some pretty simple information: a list of articles written by the user, the number of articles they have read, and the number their articles have been read. More is to come in the future, but that's a long way out.
|
||||
|
||||
---
|
||||
#### 08/04/2025 - Image Cropping & Editing Articles:
|
||||
Yesterday, I [pushed](https://github.com/quaxlyqueen/vintagecoding.net/tree/e5b3e048b8dc6731fa383778c26eba47186e5310) an update to the image cropper. In other words, it *actually* works now lol. I was driving home from class and I just realized that I needed to both offset the position from the window to the image, and scale the coordinates based on the size of the image. And just a moment ago, I [pushed](https://github.com/quaxlyqueen/vintagecoding.net/tree/e829e2e56695af5b77074f926c8d0c270e501f4b) editing articles. And here and there, I've worked on some basic Cross Site Scripting preventative measures, honeypots on signup to help prevent bots, and basic mobile responsiveness.
|
||||
|
||||
With some work being done with security now, I'm having second thoughts about allowing users to have custom CSS on their homepages. I'll punt that off till later.
|
||||
|
||||
All in all, things are going smoothly! I'm pretty proud of what I've built so far, and it has been quite educational. From prepared SQL statements, to XSS, form processing, and secure 'remember me' functionality. I'm not sure how much this site will be used by anyone else, and if that is the case I'll eventually just use this as a personal blog.
|
||||
|
||||
---
|
||||
#### 12/04/2025 - Enhanced Markdown Editing Experience:
|
||||
This was my first foray into the world of AJAX. I just [pushed](https://github.com/quaxlyqueen/vintagecoding.net/tree/fb35e9322647878386bcc3be572cd404b38fd91b) the implementation of a markdown preview while composing or editing articles. The possibilities are **very** exciting, I'm already thinking of other places that the AJAX would be useful for.
|
||||
|
||||
Next, I'm looking to introduce Vim motions to the site, for general navigation and also for article composition and editing. It'll be an interesting challenge I think, and I could use the JavaScript practice.
|
||||
|
||||
I haven't said this previously, but I am *loving* PHP. Such a joy to work with, and pair that with AJAX for a very interactive experience? Phenomenal DX. I've been looking at an interesting project, [NativePHP](https://nativephp.com), that I'd like to eventually use for another project.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 671 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 411 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 1.5 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.6 KiB |
@@ -9,7 +9,7 @@ include_once 'components/foot.php';
|
||||
|
||||
function home_content()
|
||||
{
|
||||
$content = '
|
||||
$content = '
|
||||
<div class="article">
|
||||
<h1>Vintage Coding</h1>
|
||||
<h3>Intentional Craftsmanship Over Ephemeral Trends</h3>
|
||||
@@ -30,5 +30,5 @@ function home_content()
|
||||
</div>
|
||||
';
|
||||
|
||||
return $content;
|
||||
return $content;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ if (isset($_POST['form_id'])) {
|
||||
|
||||
if ($msg === true) {
|
||||
login($_POST['username'], $_POST['password'], false);
|
||||
header('Location: user.php?action=view&user_id=' . $_SESSION['user_id']);
|
||||
header('Location: user.php?view=display&user_id=' . $_SESSION['user_id']);
|
||||
}
|
||||
break;
|
||||
case 'login_form':
|
||||
|
||||
Reference in New Issue
Block a user