← Back to Browse
Website Posted by

生成笔记系统提示词-PHP+MYSQL

★ 0.0 (0 reviews)

Description

Prompt Content

## ✅ **Optimized Prompt for AI Code Generation**

You are a senior full-stack developer. Build a complete, production-ready **Note-Taking Web Application** using **PHP (preferably PHP 8+) and MySQL**, with clean, modular, secure, and scalable code.

## 🎯 Project Requirements

### 1. Authentication System

* Create a **User Registration Page**

* Fields: username, email, password, confirm password
* Validate input (server-side + basic client-side)
* Hash passwords using `password_hash()`
* Create a **Login Page**

* Authenticate using email/username + password
* Use secure session handling
* Logout functionality
* Protect all authenticated routes

---

### 2. Database Design (MySQL)

Design normalized tables with proper relationships:

* users (id, username, email, password, created_at)
* categories (id, user_id, name, created_at)
* notes (id, user_id, category_id, title, content, is_public, share_token, created_at, updated_at)

Include:

* Foreign keys
* Index optimization
* SQL schema provided

---

### 3. Dashboard Page (Notes List)

* Show all notes for logged-in user
* Display:

* Title
* Category
* Last updated time
* Include:

* Search bar
* Filter by category
* Pagination
* Add **Quick Create Note Input (Fast Entry)**

* Title-only quick add (auto-create empty note)

---

### 4. Create Note Page

* Form with:

* Title
* Category (dropdown + create new category option)
* Rich text editor for content
* Save note to database

---

### 5. Single Note Page

Two modes:

#### View Mode

* Display formatted content (render HTML safely)
* Show category, timestamps

#### Edit Mode

* Editable title + content
* Save updates via POST or AJAX

---

### 6. Rich Text Editor (Important)

Integrate a modern editor such as:

* Quill.js OR TinyMCE OR CKEditor

Requirements:

* Toolbar (bold, italic, headings, lists, links)
* Support code blocks
* Syntax highlighting using a library like:

* highlight.js or Prism.js

---

### 7. Public Share Feature

* Generate unique `share_token` (UUID or secure random string)
* Public URL format:

* /share.php?token=xxxxx
* Public page:

* Read-only view
* No authentication required
* Ensure:

* Only notes marked `is_public = 1` are accessible

---

### 8. Category Module

* CRUD for categories:

* Create, rename, delete
* Assign category to notes
* Filter notes by category

---

### 9. Security Best Practices

* Use prepared statements (PDO or MySQLi)
* Prevent:

* SQL Injection
* XSS (escape output properly)
* CSRF (implement CSRF tokens)
* Validate all inputs

---

### 10. Project Structure

Use clean structure:

* /config (database connection)
* /auth (login, register, logout)
* /notes (CRUD logic)
* /categories
* /public (entry files)
* /assets (CSS, JS)
* /includes (header, footer, helpers)

---

### 11. UI / UX

* Clean, modern interface (use Bootstrap or Tailwind)
* Responsive design
* Dashboard layout:

* Sidebar (categories)
* Main content (notes list)

---

### 12. Additional Features (if possible)

* Auto-save note (AJAX)
* Toast notifications
* Dark mode toggle
* Markdown support (optional fallback)

---

## 📦 Output Requirements

* Provide FULL working code:

* PHP files
* SQL schema
* JS & CSS integration
* Explain:

* How to set up database
* How to run locally (XAMPP/LAMP)
* Keep code modular and well-commented

---

## 🚫 Constraints

* Do NOT use frameworks (no Laravel, no Symfony)
* Use plain PHP + MySQL + JS
* Keep dependencies minimal

---

## 🎯 Goal

Deliver a **clean, secure, and extensible note-taking system similar to a simplified Notion or Evernote**, suitable for real-world use.

---

## 💡 Pro Tips (Important)

* If the AI gives incomplete code, follow up with:

* “Continue from where you stopped”
* “Now generate the next module: notes CRUD”
* You can also break it into steps:

* First: database + auth
* Then: dashboard
* Then: editor + sharing