/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public function InjectionSafe($TestString, $RemoveLinks = false){ $regex = '/\b^to+(?=:)\b|^content-type:|^cc:|^bcc:|^from:|^subject:|^mime-version:|^content-transfer-encoding:/im'; // Don't allow any of these strings in here // Illegal characters return false; } else{ if(true === $RemoveLinks) { $regex2 = '/http:\/\/|https:\/\/|href=|mailto:/i'; { // Illegal characters return false; } } // No nasties found, we cool return true; } }