ShikiProxy/FileToZipEmail.php

38 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2012-10-15 22:24:12 +02:00
<?php
/**
* Class for sending the hashed link into the given email
* @author Shikiryu
*/
class FileToZipEmail{
private $_email; // email obviously
private $_shortcut; // shortcut (uniqid)
public function __construct($email, $zip){
$this->_email = $email;
$this->_shortcut = $zip;
$this->_protection();
}
/**
* Prevent hackingn see php doc
*/
private function _protection(){
$email = trim($this->_email);
if ((strpos ($email,"\\r")!==false) ||
(strpos ($email,"\\n")!==false) ||
(stripos ($email,"Content-Transfer-Encoding")!==false) ||
(stripos ($email,"MIME-Version")!==false) ||
(stripos ($email,"Content-Type")!==false) ||
(empty($_SERVER['HTTP_USER_AGENT'])))
die('Incorrect request') ; //stop spammers
2013-05-21 15:05:56 +02:00
mail('email', '[SPAMMER] someone is trying to hack you.', "Hello, \n\n".$this->_email." tried to hack you.\n\nBye o/");
2012-10-15 22:24:12 +02:00
}
/**
* obvious
*/
public function send(){
mail($this->_email, 'A new file to download', "Hello, \n\nYou can download a new file here : ".BASE_URL."/".$this->_shortcut."\n\nBye o/");
}
2013-05-21 15:05:56 +02:00
}