Web Security
การโจมตีเว็บไซต์เกิดขึ้นทุกวินาที

1. SQL Injection

ผู้โจมตีแทรก SQL code เข้าไปใน input เพื่อดึง/แก้ไข/ลบข้อมูล

// Safe - Parameterized Query
$stmt = $pdo->prepare("SELECT * FROM users WHERE username = ?");
$stmt->execute([$username]);

2. Cross-Site Scripting (XSS)

// Safe - Escape output
echo htmlspecialchars($_GET["name"], ENT_QUOTES, "UTF-8");

3. Password Security

$hash = password_hash($password, PASSWORD_BCRYPT, ["cost" => 12]);
$valid = password_verify($password, $hash);
รายการสถานะ
ใช้ Parameterized Queryต้องทำ
Escape outputต้องทำ
CSRF Token ทุก formต้องทำ
bcrypt สำหรับ passwordต้องทำ