Last active
August 29, 2015 14:02
-
-
Save adactio/2af1b8aa4b6ac5b41d27 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication | |
# http://creativecommons.org/publicdomain/zero/1.0/ | |
$labels = array( | |
"What’s on your mind?", | |
"Hey Joe, what do you know?", | |
"Speak your brains", | |
"Share what you know", | |
"Status report", | |
"What’s new?" | |
); | |
?> | |
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> | |
<h1><label for="note"><?php echo $labels[array_rand($labels)]; ?></label></h1> | |
<textarea cols="40" rows="3" id="note" name="note" maxlength="140"><?php | |
if (isset($_POST['note'])) { | |
echo htmlspecialchars($_POST['note']); | |
}?></textarea> | |
<br /> | |
<input type="file" name="photo" accept="image/*" /> | |
<p> | |
<input type="hidden" name="latitude" id="latitude" value="" /> | |
<input type="hidden" name="longitude" id="longitude" value="" /> | |
<input type="submit" value="Post" /> | |
</p> | |
</form> | |
<br /> | |
<script> | |
(function (win, doc) { | |
if (navigator.geolocation) { | |
navigator.geolocation.getCurrentPosition(function (pos) { | |
doc.getElementById('latitude').value = pos.coords.latitude; | |
doc.getElementById('longitude').value = pos.coords.longitude; | |
}); | |
} | |
}(this, this.document)); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment