Login   Register  
PHP Classes
elePHPant
Icontem

File: ex3.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Marcos Bezerra  >  Web Open Patch  >  ex3.php  >  Download  
File: ex3.php
Role: Example script
Content type: text/plain
Description: Example #3: Anti-SQL Injection and Mail Injection Combined
Class: Web Open Patch
Filter values to prevent security exploits
Author: By
Last change:
Date: 2010-01-12 11:59
Size: 544 bytes
 

Contents

Class file image Download
<?php

include_once("WebOpenPatch.php");

$wop = new WebOpenPatch();

$subject $wop->wopAntiSqlInjection($_POST['subject']);
$to      'faleconosco@dominio.com.br';
$msg     $wop->wopAntiSqlInjection($_POST['msg']);

if (
$wop->wopAntiMailInjection($_POST['from'])) {
    
$from $_POST['from'];
} else {
    die(
"Email do remetente inválido!");
}

if (
mail($to$subject$msg"From: {$from}\n")){
    echo 
"Sua mensagem foi encaminhada com sucesso para {$to}.";
} else {
    echo 
"Falha ao enviar a mensagem.";
}


?>