Skip to content

Instantly share code, notes, and snippets.

@tylor
Created November 24, 2011 19:27
Show Gist options
  • Save tylor/1392072 to your computer and use it in GitHub Desktop.
Save tylor/1392072 to your computer and use it in GitHub Desktop.
Get an email anytime someone visits this page
<?php
if (!isset($_COOKIE['mailed'])) {
$to = 'email@example.com';
$subject = 'QR code was used!';
$body = print_r($_SERVER, true);
if (mail($to, $subject, $body)) {
setcookie("mailed", true);
}
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>You win!</title>
<style>
body { width: 320px; margin: auto; font-family: "Helvetica Neue", Helvetica, sans-serif; font-size: 0.8em; text-align:center; }
</style>
</head>
<body>
<h1>You used our QR code!</h1>
<img alt="Kitten!" src="http://placekitten.com/300/2<?php print rand(10,99); ?>" />
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment