Skip to content

Dev#13

Merged
5RoD merged 2 commits intomasterfrom
dev
May 5, 2025
Merged

Dev#13
5RoD merged 2 commits intomasterfrom
dev

Conversation

@5RoD
Copy link
Owner

@5RoD 5RoD commented May 5, 2025

This pull request introduces several enhancements and fixes across multiple files, focusing on security, database updates, frontend improvements, and new content additions. The most significant changes include securing access to sensitive files, updating the database schema, improving the user interface, and adding detailed news pages.

Security Updates:

  • .htaccess: Added access restrictions to adminContactDashboard.php to prevent unauthorized access.

Database and Backend Enhancements:

  • public/php/mysqlTables.php: Updated the ContactUS table to include a phonenumber field and added a new MatchResults table to store match data.
  • public/html/contactus.php: Modified the form and database logic to include a phone number field, ensuring proper handling in form submission and SQL queries. [1] [2]

Frontend Improvements:

  • public/css/style.css: Adjusted .news-article img styling for better responsiveness and visual consistency.
  • public/html/home.php: Fixed broken links and updated image extensions to ensure proper rendering of news cards.

Content Additions:

  • Added detailed news pages for recent events (news-2.php, news-3.php, news-4.php), including custom fonts, metadata, and structured content. [1] [2] [3]
  • Enhanced news-1.php with publication date, author details, and updated image references. [1] [2]

Minor Updates:

Summary by CodeRabbit

  • New Features

    • Added phone number field to the contact form, now required and stored in the database.
    • Admin dashboard now displays phone numbers for contact messages.
    • Introduced a new MatchResults table for storing match results.
  • Improvements

    • News articles are now static HTML pages with enhanced formatting, author lines, and publication dates.
    • News card links on the homepage now direct to individual news pages for improved navigation.
    • Updated news images and links for consistency and clarity.
  • Bug Fixes

    • Enhanced access restrictions to sensitive files for improved security.
  • Style

    • Updated news article image styles for better layout and appearance.
  • Chores

    • Updated project metadata and improved .gitignore for development environment compatibility.

5RoD added 2 commits May 5, 2025 23:11
Adds phone number field to the contact form and database table.

Displays phone number in the admin contact dashboard.

Protects adminContactDashboard.php from direct access via .htaccess.

Fixes image paths in news articles and home page.

Finishes the rest of the news so from part 1-4 all news now work correctly

Updates composer files to reflect project renaming.
Adds phone number to the contact form and database,
and displays it in the admin contact dashboard.

Added the rest of the news pages and fixed them to work perfectly

Protects the admin contact dashboard PHP file and the .vscode directory from direct access.

Updates the project name in composer.json and regenerates the composer.lock file.

Corrects news image paths and applies styling to news articles.
@coderabbitai
Copy link

coderabbitai bot commented May 5, 2025

Walkthrough

This update introduces a phone number field to the contact form, database schema, and admin dashboard. It also replaces several news article PHP files with static HTML, modifies homepage news links, updates CSS for news images, changes the Composer package name, and adds new access restrictions in .htaccess.

Changes

Files/Paths Change Summary
.gitignore Added .vscode directory to the ignore list.
.htaccess Added denial of access to adminContactDashboard.php alongside .env.
composer.json Changed package name from "moh/bld" to "rod/bld".
public/admin/adminContactDashboard.php Added display of phone number in the contact messages table; included DB connection variables.
public/css/style.css Modified .news-article img to use fixed width/height and changed display to flex.
public/html/contactus.php Added required phone number field to the contact form and backend processing; updated SQL insert to include phone number.
public/php/mysqlTables.php Changed to create multiple tables; added phonenumber to ContactUS; introduced new MatchResults table; iterates over table creation statements.
public/html/home.php Updated news card image reference and changed news links from anchors to explicit page parameters.
public/html/news/news-1.php Replaced dynamic date with static date; added author line; updated image source and alt text.
public/html/news/news-2.php,
public/html/news/news-3.php,
public/html/news/news-4.php
Replaced PHP files with static HTML news articles, including structured content, images, publication dates, authors, and navigation links; removed all PHP code.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ContactForm (contactus.php)
    participant Database
    participant AdminDashboard

    User->>ContactForm: Submit name, email, phone number, message
    ContactForm->>Database: Insert name, email, phone number, message into ContactUS
    AdminDashboard->>Database: Fetch contact messages (including phone number)
    Database-->>AdminDashboard: Return contact messages with phone numbers
    AdminDashboard-->>User: Display messages (with phone numbers)
Loading

Possibly related PRs

Poem

🐇
A hop, a skip, a phone to ring,
Now contacts have numbers—what joy they bring!
News pages shine in static light,
With images styled just right.
Composer’s name gets a gentle tweak,
And .htaccess guards what’s unique.
Hooray for progress, code so neat!

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🔭 Outside diff range comments (1)
composer.json (1)

2-6: 🛠️ Refactor suggestion

Package name updated but autoload namespace remains inconsistent.

The package name has been changed from "moh/bld" to "rod/bld", but the PSR-4 autoload namespace still references "Moh\Bld\". This inconsistency could cause autoloading issues.

    "name": "rod/bld",
    "description": "BLD e-Sports Team: A Counter-Strike team management system",
    "autoload": {
        "psr-4": {
-            "Moh\\Bld\\": "src/"
+            "Rod\\Bld\\": "src/"
        },
🧹 Nitpick comments (4)
.htaccess (1)

5-7: Good security practice, but consider specifying the full path.

Adding access restrictions to the admin dashboard file is a good security measure. However, the current configuration will restrict access to any file named "adminContactDashboard.php" regardless of its directory location.

If the admin dashboard is in a specific subdirectory, consider specifying the full path:

-<Files "adminContactDashboard.php">
+<Files "public/admin/adminContactDashboard.php">
    Require all denied
</Files>

Alternatively, you could use a more specific FilesMatch pattern:

<FilesMatch "^public/admin/adminContactDashboard\.php$">
    Require all denied
</FilesMatch>
public/admin/adminContactDashboard.php (1)

2-3: Simplify the include path and improve the comment.

The include path contains a redundant directory navigation pattern (../php/../php/). This can be simplified to just ../php/.

-// needed to load the database stuff variables
-require_once("../php/../php/connect.php");
+// Include database connection configuration
+require_once("../php/connect.php");
public/html/news/news-4.php (1)

18-30: Rich content formatting.

The article uses bold text (Company/Name) to highlight important entities and maintains good paragraph structure.

Consider using proper HTML tags instead of markdown-style double asterisks for bold text, as this would be more semantic and accessible:

-<p>– **BLD**, who won their first official international **Counter-Strike** event...
+<p>– <strong>BLD</strong>, who won their first official international <strong>Counter-Strike</strong> event...
public/html/news/news-2.php (1)

10-10: Remove trailing space in class attribute.
The class string "news-article " contains an extra space—trim it to prevent unintended CSS issues.

-<section class="news-article ">
+<section class="news-article">
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f567057 and 353c6ed.

⛔ Files ignored due to path filters (3)
  • composer.lock is excluded by !**/*.lock
  • public/images/news/worldcuppartner.jpeg is excluded by !**/*.jpeg
  • public/images/news/worldcuppartner.jpg is excluded by !**/*.jpg
📒 Files selected for processing (12)
  • .gitignore (1 hunks)
  • .htaccess (1 hunks)
  • composer.json (1 hunks)
  • public/admin/adminContactDashboard.php (3 hunks)
  • public/css/style.css (1 hunks)
  • public/html/contactus.php (2 hunks)
  • public/html/home.php (1 hunks)
  • public/html/news/news-1.php (2 hunks)
  • public/html/news/news-2.php (1 hunks)
  • public/html/news/news-3.php (1 hunks)
  • public/html/news/news-4.php (1 hunks)
  • public/php/mysqlTables.php (1 hunks)
🔇 Additional comments (16)
.gitignore (1)

130-130: LGTM: Good addition to .gitignore.

Adding .vscode to .gitignore is a best practice to prevent IDE-specific settings from being committed to the repository.

public/php/mysqlTables.php (2)

5-31: LGTM: Good refactoring to use an array of SQL queries.

The refactoring to use an array of SQL queries instead of a single query improves code maintainability and makes it easier to add new tables in the future. The structure of the new MatchResults table looks well-designed with appropriate columns and data types.


34-36: LGTM: Improved query execution approach.

The foreach loop to execute each query is a clean implementation that handles multiple table creations efficiently.

public/admin/adminContactDashboard.php (2)

54-54: LGTM!

The addition of the "Phone Number" column header aligns properly with the database schema changes mentioned in the PR description.


68-68: LGTM!

The implementation correctly displays the phone number data with proper HTML escaping for security.

public/html/contactus.php (2)

17-17: LGTM!

The phone number input is properly sanitized with htmlspecialchars() to prevent XSS attacks.


23-24: LGTM!

The SQL query has been properly updated to include the phone number field, and you're using prepared statements which is good security practice.

public/css/style.css (1)

540-544: Image layout improvements for news articles.

The changes to .news-article img properties improve the layout consistency by setting fixed dimensions (70% width, 40% height) and changing the display property to flex. This ensures more uniform presentation of images across different news articles.

However, be aware that setting fixed height percentages might cause aspect ratio distortion for some images. Consider using object-fit: cover (which is already present) along with a specific aspect ratio to maintain image proportions.

public/html/home.php (2)

61-61: Fixed navigation links to news articles.

The navigation has been updated from in-page anchors (#c1, #c2, etc.) to proper links directing to dedicated news article pages. This improves user experience by providing full, dedicated pages for each news article.

This change aligns with the new file structure and provides a better separation of content.

Also applies to: 65-65, 69-69, 73-73


61-61: Image extension correction.

The image file extension was corrected from jpeg to jpg to match the actual file on the server.

Ensures the image loads properly and prevents 404 errors.

public/html/news/news-1.php (3)

5-5: Added comment about custom fonts.

The comment serves as a warning to developers not to remove the font references.

Good documentation practice to prevent accidental removal of important styling dependencies.


14-15: Added publication metadata.

Added structured publication date and author information to improve article metadata.

This improves the content structure and provides users with important context about the article's origin.


16-16: Updated image source.

The image source was updated to match the article content.

This ensures proper visual context for the article topic.

public/html/news/news-4.php (1)

1-35: New structured news article added.

A complete news article has been created with proper structure including headline, metadata, featured image, and formatted content.

The article follows consistent formatting with other news pages and includes proper navigation back to the home page.

public/html/news/news-3.php (1)

10-15: Verify and optimize the image source path.
Ensure ../images/news/BLD-PARTNERSHIP-razer.png actually points to your assets directory; if not, adjust the path. Also consider adding loading="lazy" to defer offscreen image loading.

public/html/news/news-2.php (1)

10-15: Validate image path and alt text, add lazy loading.
Confirm ../images/news/cubert-academy.png matches your directory structure. The alt text repeats the headline—consider a concise description, and add loading="lazy" for performance.

firstname VARCHAR(30) NOT NULL,
lastname VARCHAR(30) NOT NULL,
email VARCHAR(50),
phonenumber INT(10),
Copy link

@coderabbitai coderabbitai bot May 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Use VARCHAR instead of INT for phone numbers.

Phone numbers should be stored as VARCHAR instead of INT because:

  1. Phone numbers may start with zero (which would be lost in an INT)
  2. They might include country codes, spaces, or hyphens
  3. Phone numbers aren't used for mathematical operations
        lastname VARCHAR(30) NOT NULL,
        email VARCHAR(50),
-        phonenumber INT(10),
+        phonenumber VARCHAR(20),
        subject VARCHAR(50),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
phonenumber INT(10),
lastname VARCHAR(30) NOT NULL,
email VARCHAR(50),
phonenumber VARCHAR(20),
subject VARCHAR(50),

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have a limiter to only 10 on html input and it only takes int's

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

@5RoD I understand you've implemented proper validation on the HTML side with a 10-digit integer limit, which aligns with your INT(10) database field choice. That's a reasonable approach for your current requirements.

Just a quick note for future consideration: if you ever need to support international numbers with country codes or phone numbers with leading zeros, you might revisit this decision. But for your current use case with fixed-length 10-digit integers, your implementation is consistent across both the database and UI.


🏁 Script executed:

#!/bin/bash
# Check the contactus.php implementation to see how the phone number field is implemented
cat public/html/contactus.php | grep -A 10 -B 10 "phonenumber"

Length of output: 2058


@5RoD I see now what you're describing. I noticed your HTML input has a maxlength="10" limit as mentioned.

One thing to consider: your placeholder shows "06 12345678" (with a space and leading zero), but storing as INT(10) will drop leading zeros and would reject spaces. The HTML input type="phonenumber" isn't standard (browsers might default to text), so you may want to add pattern validation or use type="tel" with a numeric pattern if strict integer validation is important.

That said, if your application only needs to handle numeric phone numbers without special formatting or international considerations, your current approach works for your needs. Just be aware of the potential placeholder/storage mismatch.


✏️ Learnings added
Learnt from: 5RoD
PR: 5RoD/BLD#13
File: public/php/mysqlTables.php:12-12
Timestamp: 2025-05-05T21:19:05.594Z
Learning: For the BLD project, phone numbers are stored as INT(10) in the database with corresponding HTML input validation that limits input to 10 digits and only accepts integers.

Learnt from: 5RoD
PR: 5RoD/BLD#13
File: public/php/mysqlTables.php:12-12
Timestamp: 2025-05-05T21:19:05.594Z
Learning: For the BLD project, phone numbers are stored as INT(10) in the database with HTML input constrained by maxlength="10". The form uses a non-standard input type="phonenumber" with placeholder "06 12345678".

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Comment on lines +29 to +30
<div class="nav-item"><a href="index.php?page=home#c1">Go back</a></div>
</div>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Update back-navigation link for static context.
Linking to index.php?page=home#c1 likely breaks on a static page—point back to your homepage file, e.g., ../home.php#c1.

-<div class="nav-item"><a href="index.php?page=home#c1">Go back</a></div>
+<div class="nav-item"><a href="../home.php#c1">Go back</a></div>

Comment on lines +22 to +24
<p>Speaking on the partnership, CEO **Mohamad F** said:</p>
<p>“We’re excited to partner with **Razer**, a brand that has been a long-time leader in the esports industry. This partnership ensures that our players will have the most comfortable and innovative gaming chairs, helping them perform at their highest level. With the **Razer Iskur V2**, we’re confident our team will have the perfect equipment to compete in the most intense **Counter-Strike** matches.”</p>

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Replace markdown-style emphasis with semantic HTML.
Static HTML won’t parse **bold**—use <strong> or <em> tags for emphasis to improve accessibility and consistency.

Example:

-<p>Speaking on the partnership, CEO **Mohamad F** said:</p>
+<p>Speaking on the partnership, CEO <strong>Mohamad F</strong> said:</p>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<p>Speaking on the partnership, CEO **Mohamad F** said:</p>
<p>“We’re excited to partner with **Razer**, a brand that has been a long-time leader in the esports industry. This partnership ensures that our players will have the most comfortable and innovative gaming chairs, helping them perform at their highest level. With the **Razer Iskur V2**, we’re confident our team will have the perfect equipment to compete in the most intense **Counter-Strike** matches.”</p>
<p>Speaking on the partnership, CEO <strong>Mohamad F</strong> said:</p>
<p>“We’re excited to partner with **Razer**, a brand that has been a long-time leader in the esports industry. This partnership ensures that our players will have the most comfortable and innovative gaming chairs, helping them perform at their highest level. With the **Razer Iskur V2**, we’re confident our team will have the perfect equipment to compete in the most intense **Counter-Strike** matches.”</p>

@5RoD 5RoD merged commit e1de1af into master May 5, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant