Skip to content

Create PHP news site with admin dashboard and Shopee ad flow - #37

Open
huzely wants to merge 1 commit into
masterfrom
codex/create-complete-news-website-k9yerp
Open

Create PHP news site with admin dashboard and Shopee ad flow#37
huzely wants to merge 1 commit into
masterfrom
codex/create-complete-news-website-k9yerp

Conversation

@huzely

@huzely huzely commented Dec 30, 2025

Copy link
Copy Markdown
Owner

Summary

  • Build public news site with slug-based routing, multi-theme UI, Shopee overlay ad flow, and caching
  • Add Vietnamese admin panel for login, CRUD bài viết, cài đặt, thống kê, copy link, và đổi theme/logo/banner
  • Implement PDO database schema, tracking API với rate-limit, Telegram queue, và cơ chế lỗi/log thân thiện
  • Refine Shopee overlay theo đặc tả (bypass ?ad=0, giữ affiliate, chạy trên click slug và truy cập trực tiếp), gộp thông báo click qua Telegram, truyền token để track ad_click không delay, và bổ sung bắt nút X để mở Shopee + tab bài
  • Cải thiện bố cục mobile admin: topbar sticky với nút Menu, sidebar dạng drawer overlay, form settings 1 cột full-width hiển thị rõ ô link Shopee và nút "LƯU CÀI ĐẶT"

Testing

  • find public_html -name '*.php' -print0 | xargs -0 -n1 php -l

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +9 to +11
$id = (int)($_GET['id'] ?? 0);
$stmt = $pdo->prepare('DELETE FROM articles WHERE id = :id');
$stmt->execute([':id' => $id]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Delete endpoint lacks CSRF protection

The admin delete action deletes a post purely from a GET id without verifying a CSRF token. An attacker could trick a logged-in admin into loading /admin/post_delete.php?id=... (e.g., via an image tag), silently deleting content without consent. Add CSRF validation (as used elsewhere) before executing the delete to prevent cross-site request forgery.

Useful? React with 👍 / 👎.

Comment on lines +10 to +14
document.addEventListener('DOMContentLoaded',function(){
var o=document.createElement('div');
o.id='adOverlay';
o.style.cssText='position:fixed;inset:0;z-index:99999;background:rgba(0,0,0,.75);display:flex;align-items:center;justify-content:center;padding:14px;';
var b=document.createElement('div');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Ad overlay never renders when script is injected after click

The overlay is only created inside a DOMContentLoaded listener. On the homepage the ad script is added dynamically from a click handler after the page has already fired DOMContentLoaded, so this handler never runs and the overlay/redirect flow does not trigger—clicking a post just prevents navigation. The overlay should be initialized immediately when the script loads (or the load timing changed) so clicks actually show the ad flow.

Useful? React with 👍 / 👎.

Comment on lines +5 to +9
if(!truthy(S.adsEnabled)||!S.adLink||S.bypass===true) return;
function openFlow(slug){
try{window.open('/'+slug+'?ad=0','_blank','noopener');}catch(e){}
window.location.href=S.adLink;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Ad clicks are never tracked

The ad flow navigates to the article and Shopee link but never calls the tracking endpoint or trackEvent for an ad_click. As a result events rows, dashboard counts, and Telegram notifications for ad clicks will stay at zero even when users interact with the overlay. Trigger the tracking call before redirecting so clicks are recorded.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant