Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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