Conversation
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.
WalkthroughThis 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 Changes
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)
Possibly related PRs
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 7
🔭 Outside diff range comments (1)
composer.json (1)
2-6: 🛠️ Refactor suggestionPackage 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
⛔ Files ignored due to path filters (3)
composer.lockis excluded by!**/*.lockpublic/images/news/worldcuppartner.jpegis excluded by!**/*.jpegpublic/images/news/worldcuppartner.jpgis 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
.vscodeto .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 imgproperties 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.pngactually points to your assets directory; if not, adjust the path. Also consider addingloading="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.pngmatches your directory structure. The alt text repeats the headline—consider a concise description, and addloading="lazy"for performance.
| firstname VARCHAR(30) NOT NULL, | ||
| lastname VARCHAR(30) NOT NULL, | ||
| email VARCHAR(50), | ||
| phonenumber INT(10), |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Use VARCHAR instead of INT for phone numbers.
Phone numbers should be stored as VARCHAR instead of INT because:
- Phone numbers may start with zero (which would be lost in an INT)
- They might include country codes, spaces, or hyphens
- 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.
| phonenumber INT(10), | |
| lastname VARCHAR(30) NOT NULL, | |
| email VARCHAR(50), | |
| phonenumber VARCHAR(20), | |
| subject VARCHAR(50), |
There was a problem hiding this comment.
we have a limiter to only 10 on html input and it only takes int's
There was a problem hiding this comment.
🧩 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.
| <div class="nav-item"><a href="index.php?page=home#c1">Go back</a></div> | ||
| </div> |
There was a problem hiding this comment.
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>| <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> | ||
|
|
There was a problem hiding this comment.
🛠️ 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.
| <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> |
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 toadminContactDashboard.phpto prevent unauthorized access.Database and Backend Enhancements:
public/php/mysqlTables.php: Updated theContactUStable to include aphonenumberfield and added a newMatchResultstable 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 imgstyling 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:
news-2.php,news-3.php,news-4.php), including custom fonts, metadata, and structured content. [1] [2] [3]news-1.phpwith publication date, author details, and updated image references. [1] [2]Minor Updates:
composer.json: Changed the project name from "moh/bld" to "rod/bld" for consistency.public/admin/adminContactDashboard.php: Added aPhone Numbercolumn to the admin dashboard for better contact management. [1] [2]Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Style
Chores