Skip to content

Instantly share code, notes, and snippets.

@SectionOne
SectionOne / gist:fd4e798cc32c04550242f134305bad3b
Created July 9, 2025 15:59
Script about anti sql injection
<?php
// Funció de filtrat universal
function f($d) {
if (is_array($d)) return array_map('f', $d);
return htmlspecialchars(strip_tags(trim($d)), ENT_QUOTES, 'UTF-8');
}
// Funció per camps numèrics
function fn($d) {
return ctype_digit($d) ? (int)$d : 0;
<?php
// Funció de filtrat universal
function f($d) {
if (is_array($d)) return array_map('f', $d);
return htmlspecialchars(strip_tags(trim($d)), ENT_QUOTES, 'UTF-8');
}
// Funció per camps numèrics
function fn($d) {
return ctype_digit($d) ? (int)$d : 0;
@SectionOne
SectionOne / latihan_login.php
Last active May 15, 2025 13:39 — forked from jankensword/latihan_login.php
Halaman Login (Login Page)
<?php
@session_start();
unset($_SESSION['NAMA_USER']);
$_SESSION['intentos'] = 0;
if(isset($_SESSION['NAMA_USER']))
{
header("location:index.php");
}
?>
<!DOCTYPE html>
@SectionOne
SectionOne / gist:e979bb95a4575a4e4207cb15267dfa08
Last active May 15, 2025 13:33
Script Anti SQL Injection
<?php
// Funció de filtrat universal
function f($d) {
if (is_array($d)) return array_map('f', $d);
return htmlspecialchars(strip_tags(trim($d)), ENT_QUOTES, 'UTF-8');
}
// Funció per camps numèrics
function fn($d) {
return ctype_digit($d) ? (int)$d : 0;
@SectionOne
SectionOne / gist:b7a43eacb057fa0470e7dd1923d90f5f
Created April 14, 2025 15:17
Script in PHP for prevent SQL Injection
<?php
// Funció de filtrat universal
function f($d) {
if (is_array($d)) return array_map('f', $d);
return htmlspecialchars(strip_tags(trim($d)), ENT_QUOTES, 'UTF-8');
}
// Funció per camps numèrics
function fn($d) {
return ctype_digit($d) ? (int)$d : 0;