Diaspora* Pod

So, I’ve set up a Diaspora* pod. Diaspora* is a service similar to twitter/facebook, but it with (at least) one crucial difference. Rather than being run by one big company who has control over everyones data, many nodes (known as pods) are run by groups or individuals. Depending on how you see it, this could mean that your data is more secure – if you trust the owner of the pod, then you know that your information will not be sold or traded with anyone. I’m not expecting everyone in the world to abandon other social media sites – but it’s something you can try out if you’re interested. There is a lot more information about Diaspora* here.

I have recently acquired a few domain names, one of which is 23p.net. While this doesn’t really mean anything, I have decided to use it as the name of my Diaspora* pod because it is short, and easy to remember.

I hope to do a more technical writeup soon, but in the mean time, why not check it out? My Diaspora Username is josephredfern@23p.net.

Getting Current Page URL with PHP

If you would like to dynamically include a Facebook “like” button on your pages, then you will need to know the pages FULL url (rather than the file name of the page). There are, of course, other uses for knowing the full URL to page other than Facebook “Like” buttons – but that was what I personally needed the URL for.  This PHP Snippet:

[cc lang='php']function pageurl() {
if(isset($_SERVER['HTTPS'])){
$prefix = “https://”;
}else{
$prefix = “http://”;
}
$pageURL = $prefix.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
return $pageURL;
}
[/cc]

will return the URL of the page. The first six lines check to see if the server is communicating with the requesting machine over HTTP or HTTPS, and sets the prefix accordingly.

Line 7 then creates the URL string, combining the prefix, the server name (or the domain name), and the path to the requested files. Line 8 then returns the URL String, which can be echoed like so:

[cc lang='php']echo pageurl(); [/cc]