Created
November 26, 2013 09:18
-
-
Save abdallah/7655537 to your computer and use it in GitHub Desktop.
email tracking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_URI} !\.(png|css)$ | |
RewriteRule (.*) n.php [L,QSA] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('recaptchalib.php'); | |
if (array_key_exists('act', $_POST)){ | |
$privatekey = "ThisIsMyPrivateRecaptchaKey-jos888Qo"; | |
$resp = recaptcha_check_answer ($privatekey, | |
$_SERVER["REMOTE_ADDR"], | |
$_POST["recaptcha_challenge_field"], | |
$_POST["recaptcha_response_field"]); | |
if (!$resp->is_valid) { | |
// What happens when the CAPTCHA was entered incorrectly | |
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . | |
"(reCAPTCHA said: " . $resp->error . ")"); | |
} else { | |
echo "Here's the link to use: <a href='http://tracker.example.com/n.php?tag=".$_POST['tag']."&myemail=".$_POST['myemail']."&myip=".$_POST['myip']."'>copy link</a>"; | |
exit; | |
} | |
} | |
$name = './ok.png'; | |
$fp = fopen($name, 'rb'); | |
header("Content-Type: image/png"); | |
header("Content-Length: " . filesize($name)); | |
fpassthru($fp); | |
if (array_key_exists('myemail', $_GET)) { | |
$recipient = $_GET['myemail']; | |
} else { | |
$recipient = 'default.address@example.com'; | |
} | |
if ($_GET['myip']==$_SERVER['REMOTE_ADDR']) { | |
exit; | |
} | |
/* requesting info: | |
REMOTE_ADDR | |
QUERY_STRING | |
REQUEST_TIME | |
*/ | |
$from = 'TrackerPic <tracker@example.com>'; | |
$subject = 'Your mail was read'; | |
$message = "Hi, | |
Your email with the following tracking code was read: ". | |
"\nTag: ".$_GET['tag']. | |
"\nRemote Address: ".$_SERVER['REMOTE_ADDR']. | |
"\nRequest Time: ".date('l, F j, Y g:i a', $_SERVER['REQUEST_TIME']). | |
"\ndebug: ".$_SERVER['QUERY_STRING']. | |
" | |
Sincerely, | |
TrackerPic"; | |
mail($recipient, $subject, $message, "From: $from\r\n"); | |
exit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action="n.php" method="post"> | |
Tag: <input type="text" name="tag" /><br /> | |
My email: <input type="text" name="myemail" /><br /> | |
<input type="hidden" name="myip" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>" /> | |
<?php | |
require_once('recaptchalib.php'); | |
$publickey = "ThisIsMyPublicRecaptchaKey_38U2XXX_e"; | |
echo recaptcha_get_html($publickey); | |
?> | |
<input type="submit" name="act" value="generate" /> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment