This commit is contained in:
dsyoon
2025-12-27 13:09:05 +09:00
commit f99bb2ba6b
133 changed files with 20073 additions and 0 deletions

33
php/functions.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
// Strips nasty tags from code..
function cleanEvilTags($data) {
$data = preg_replace("/javascript/i", "j&#097;v&#097;script",$data);
$data = preg_replace("/alert/i", "&#097;lert",$data);
$data = preg_replace("/about:/i", "&#097;bout:",$data);
$data = preg_replace("/onmouseover/i", "&#111;nmouseover",$data);
$data = preg_replace("/onclick/i", "&#111;nclick",$data);
$data = preg_replace("/onload/i", "&#111;nload",$data);
$data = preg_replace("/onsubmit/i", "&#111;nsubmit",$data);
$data = preg_replace("/<body/i", "&lt;body",$data);
$data = preg_replace("/<html/i", "&lt;html",$data);
$data = preg_replace("/document\./i", "&#100;ocument.",$data);
$data = preg_replace("/<script/i", "&lt;&#115;cript",$data);
return strip_tags(trim($data));
}
// Cleans output data..
function cleanData($data) {
$data = str_replace(' & ', ' &amp; ', $data);
return (get_magic_quotes_gpc() ? stripslashes($data) : $data);
}
function multiDimensionalArrayMap($func,$arr) {
$newArr = array();
if (!empty($arr)) {
foreach($arr AS $key => $value) {
$newArr[$key] = (is_array($value) ? multiDimensionalArrayMap($func,$value) : $func($value));
}
}
return $newArr;
}

48
php/mail.php Normal file
View File

@@ -0,0 +1,48 @@
<?php
include 'functions.php';
if (!empty($_POST)){
$data['success'] = true;
$_POST = multiDimensionalArrayMap('cleanEvilTags', $_POST);
$_POST = multiDimensionalArrayMap('cleanData', $_POST);
//your email adress
$emailTo ="yourmail@yoursite.com"; //"yourmail@yoursite.com";
//from email adress
$emailFrom ="contact@yoursite.com"; //"contact@yoursite.com";
//email subject
$emailSubject = "Mail from Porta";
$name = $_POST["name"];
$email = $_POST["email"];
$comment = $_POST["comment"];
if($name == "")
$data['success'] = false;
if (!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $email))
$data['success'] = false;
if($comment == "")
$data['success'] = false;
if($data['success'] == true){
$message = "NAME: $name<br>
EMAIL: $email<br>
COMMENT: $comment";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html; charset=utf-8" . "\r\n";
$headers .= "From: <$emailFrom>" . "\r\n";
mail($emailTo, $emailSubject, $message, $headers);
$data['success'] = true;
echo json_encode($data);
}
}

0
php/newslatter.txt Normal file
View File

21
php/newsletter.php Normal file
View File

@@ -0,0 +1,21 @@
<?php
if($_POST){
$fileName = 'newsletter.txt'; //set 777 permision for this file.
$error = false;
$email = $_POST['email'];
if (!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $email))
$error = true;
//If all ok, save emali adress in file
if($error == false){
$file = fopen($fileName, a);
fwrite($file, "$email,");
fclose($file);
echo 'OK';
}
}