This repository contains two things in one codebase:
- A PHP web application (
plexaur.com/ SU Study Materials portal) that serves course pages, searchable files, viewer pages, upload/admin tools, and a sandboxed PHP compiler. - A large academic content archive (BCA, MCA, IBM folders) containing study materials, code labs, records, PDFs, docs, slides, and sample programs.
The app is built in plain PHP + Bootstrap + JS with Apache rewrite-based routing.
Primary academic content directories:
BCA/MCA/IBM/
These folders hold the actual study assets: pdf, doc/docx, ppt/pptx, c/cpp, java, py, html, images, etc. The folder explorer pages and search endpoint index these files.
uploads/: user-contributed archives uploaded frompages/upload.php(zip/rar).output/allFiles/: generated temporary PHP files created byoutput/output.phpfor output previews.compiler/temp/: runtime temp files created bycompiler/run.phpwhen executing submitted PHP snippets.
.env(project root): runtime environment variables.composer.json: dependency management.config/db.php: DB bootstrap usingvlucas/phpdotenv+mysqli.load_env.php: debug utility to verify env loading.
assets/components/navbar.php,footer.php,scripts.phpassets/components/checkApprove.php: consent UI (LocalStorage + async log call).assets/components/log_visit.php: records visits to DB (expects DB include path).assets/style/*,assets/theme/*,assets/script/*,assets/fonts/*,assets/svg/*,assets/images/*
pages/bca.php,mca.php,ibm.php: folder explorer wrappers; include respective*/index.phpexplorer renderers.pages/view.php: secure viewer (only/BCA|/MCA|/IBM), supports PDF/doc/docx/ppt/code rendering and download.pages/search.php: recursive file search + ranking + blocking rules.pages/upload.php: multi-file archive upload (zip,rar, max 64MB each).pages/feedback.php: feedback form UI.pages/submit_feedback.php: JSON POST endpoint for feedback insert.pages/ethical-hacking.php: DB-driven course cards (coursestable).pages/admin.php: admin dashboard wrapper (courses/uploads/feedback tabs).pages/compiler.php: compiler UI page embedding CodeMirror + terminal.pages/about.php,pages/error.php,pages/loading.php,pages/g-tag.php
admin/course-update.php: create/deletecoursesrows.admin/upload-shows.php: list/download/delete files inuploads/.admin/feedback-view.php: list/deletefeedbackrows.output/output.php: sanitizes program source, writes temporary executable copies.output/auto_deletion.php: currently empty.
compiler/index.php: editor/output UI component.compiler/run.php: POST endpoint running validated PHP in temp file, with blocked function/token checks and runtime limits.
index.php: home page (course cards + search box + UI)..htaccess: central routing/security.- allows
dumbcli/install.sh|ps1 - blocks risky extensions elsewhere (
.sh,.ps1,.env,.sql, etc.) - pretty URLs (
/pages/bcastyle) - front controller fallback to
index.php - custom 403/404 =>
pages/error.php
- allows
- Backend: PHP (procedural style + mysqli)
- DB: MySQL/MariaDB (via
mysqli) - Dependency:
vlucas/phpdotenv(Composer) - Frontend: Bootstrap 5, Font Awesome, custom CSS/JS
- Viewer helpers: Prism.js, Mammoth.js, Google Docs embed for some formats
- Server assumptions: Apache with
mod_rewrite,DOCUMENT_ROOTmapped to repo root
- PHP 8.x recommended (7.4+ likely works for most parts)
- PHP extensions:
mysqli,json,mbstring,tokenizer(compiler validator uses token parsing) - Apache +
mod_rewrite - Composer
- MySQL/MariaDB for DB-backed features
Detected keys used by code:
MODE(productionor development-like value)DB_HOSTDB_USERDB_PASSDB_NAME
config/db.php behavior:
- loads env via Dotenv
- toggles error visibility/reporting based on
MODE - creates
$conn = new mysqli(...)
Tables referenced in code:
courses(used by ethical hacking + admin CRUD)- fields referenced:
id,title,description,link,timestamp
- fields referenced:
feedback(feedback submission + admin listing)- fields referenced:
id,name,email,category,rating,message,user_ip, andtimestamporcreated_at
- fields referenced:
ip_addresses(visit logging)- fields referenced:
ip_address,timestamp,page_title
- fields referenced:
pages/search.php:
- scans recursively from
$_SERVER['DOCUMENT_ROOT'] - blocks many directories (
assets,vendor,.git,pages,admin,compiler,output, etc.) - blocks risky/system extensions (
sql,env,log,obj,exe,cbp, etc.) - scores matches by keyword/semester relevance
- returns top 50 JSON paths
pages/view.php:
- requires
?file=path - hard-validates allowed prefix regex: only
/BCA/...,/MCA/...,/IBM/... - protects against browsing outside academic directories
- chooses preview strategy by extension:
pdf=> iframedocx=> Mammoth conversion in browserppt/pptx/doc=> Google docs viewer embed- code/text-like files => syntax-highlighted render
pages/upload.php: accepts multiple files, extensionszip|rar, max 64MB/file, stores inuploads/.admin/upload-shows.php: can hard-delete uploaded files viaunlink.- Admin routes currently have no authentication middleware in code.
compiler/run.php:
- executes user-submitted PHP with restrictive validator
- blocks dangerous functions (
exec,system,shell_exec, file/fs/network/process functions, etc.) - blocks dangerous language constructs (
eval,require/include,global, backticks) - executes through generated temp file in
compiler/temp/ - hard limits: short max execution time + memory cap
robots.txt: disallows crawling core content and sensitive routes, allows selected routes.sitemap.xml: lists public pages.dumbcli/: public installer docs and shell/PowerShell installer scripts for a separate CLI tool.
Largest file types in repo (count):
pdf(268)php(131)cpp(109)docx(45)java(28)html(26)- plus many binaries/artifacts from lab/codeblocks outputs (
.exe,.o,.obj, etc.)
- Install dependencies:
composer install- Create
.envin project root with DB values. - Ensure DB/tables exist (
courses,feedback,ip_addresses). - Ensure writable folders:
uploads/output/allFiles/compiler/temp/(created automatically by compiler if permissions allow)
- Serve via Apache (or PHP server with equivalent routing, but
.htaccessbehavior expects Apache).
.gitignoreexcludes.env,vendor/,uploads/,output/allFiles/, and some generated/binary paths.output/auto_deletion.phpis currently empty.- Some scripts use fallback DB include paths (
assets/components/db.php) that may not exist in this repo; primary DB path isconfig/db.php. - Admin and destructive file operations are not protected by visible auth checks.