Automatically convert to and from Base64

I just finished a small, simple, yet interesting script for detecting whether code is base64 and encoding or decoding it based on the result. Let's be honest, PHP made it super easy for me with the base64_encode() and base64_decode() functions. I just wrapped it up in what I think is a pretty handy little tool that I know at least one person will get some use out of!

Try it out: Base64 Converter

How to view where DNS has propagated all over the world

I just wanted to quickly share a nice tool that I use all of the time when transferring sites to different servers or just changing DNS entries. Sometimes it's hard to tell how long or if the DNS for your domain has updated in other regions in the world. In this case, I use It's a neat tool that allows you to look up the current DNS listing for common entries (I really only ever need to use A or CNAME) in quite a few servers located around the world. Since DNS propagates differently by geographic region, this tool is a very good overview as to how users are accessing your site.

Also, if you're like me and constantly need to check your IP address and don't want to always search google for "whats is my ip", I'd recommend you bookmark whats my info, a simple, non-bloated site that gives you what just you're looking for.

PHP File-System Cache

I’m just sharing a couple of functions I created a while back to cache some resource-intensive processed dada for quick and easy access. This is pretty ideal for large amounts of data and it’s very simple to set up. The beauty of this is that you can store just about any data type – it doesn’t have to be a string.

Just setup the cache directory to have proper read/write permissions (preferably in a non-accessible from web directory). Then use the two functions.

Example usage:

// The 2nd argument, $hours is how long to retain data before getting new
$contents = get_cache('TEST_KEY', 24);
if ($contents === false) {
	// This is where you'd get data from an API, DB or whatever
	$contents = 'Just some example contents';
	set_cache('TEST_KEY', $contents);
echo $contents;


define('CACHE_DIR', 'cache/'); // Include trailing slash

function get_cache($key, $hours) {
	$file = CACHE_DIR . md5($key) . '.cache';
	if (!file_exists($file) || filemtime($file) < time() - $hours * 3600)
		return false;
	return unserialize(file_get_contents($file));

function set_cache($key, $value) {
	$file = CACHE_DIR . md5($key) . '.cache';
	file_put_contents($file, serialize($value));

ASP File_Get_Contents and File_Put_Contents

As I've become more of a PHP developer than an ASP developer, one thing I've noticed is that it is 10x easier to read/write text files with PHP. Simply use file_get_contents() and be done. ASP isn't so nice. But it can be done, so I'm creating those for simplicity here:

Function File_Get_Contents(strFile)
	' Remote File
	If Left(strFile, 7) = "http://" Or Left(strFile, 8) = "https://" Then
		Set objXML = Server.CreateObject("Microsoft.XMLHTTP")
		' Use this line if above errors
		'Set objXML = Server.CreateObject("MSXML2.ServerXMLHTTP")
		objXML.Open "GET", strFile, False
		File_Get_Contents = objXML.ResponseText()
		Set objXML = Nothing
	' Local File
		Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
		Set objFile = objFSO.OpenTextFile(strFile, 1)
		File_Get_Contents = objFile.ReadAll()
		Set objFile = Nothing
		Set objFSO = Nothing
	End If
End Function

Function File_Put_Contents(strFile, strContents, blnAppend)
	If blnAppend Then
		intMode = 8
		intMode = 2
	End If
	Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
	Set objFile = objFSO.OpenTextFile(strFile, intMode, True)
	Set objFile = Nothing
	Set objFSO = Nothing
End Function

Of course this file_get_contents doesn't support remote URLs, but it can easily be added.

EDIT: I just added remote URL support.

Useful SEO tools, etc.

Estibot LogoI consider myself somewhat of a domainer, so I’m always trying to keep a good overall look over the industry so I know what’s going to happen before others card” do. Rich When I find domains or sites I might be interested in, I typically do some quick research on them. I also wholesale jerseys like to keep a good handle on the statistics for my sites and how their keywords are operating.

The following is a list of random web tools I use nearly on a day-to-day basis in no particular order.

  • Estibot
    • This is a nice tool for evaluating the potential value of a domain. It uses several techniques including keyword value and frequency, domain length, TLD (top-level-domain) value, domain registration length, Google PageRank, etc. to produce a se handy (generally somewhat realistic) domain valuation. Keep in mind that a domain or site is always worth what someone is willing to pay for it, so make sure you wholesale MLB jerseys do far more research than just this.
  • DNScoop
    • This tool is very similar to estibot, except that it uses a slightly different algorithm to determine the valuation and has a slightly wholesale jerseys nicer interface, though Estibot is faster.
  • Nameboy
    • Again, this tool is similar to the other two. I would use it more, but it delivers the results via email which sometimes can take a while and be a pain. Oh well, it’s still free!
  • Dope Domains
    • This site has a very simple idea to it. It automatically spiders sites like TDNAM (GoDaddy’s domain after-market) and Sedo for the latest and greatest expiring domains. The filters are nice so that you are able to spot out domains you’re interested in by TLD and/or categories like domains with traffic, short domains, dictionary domains, etc.
  • DigitalPoint Forums
    • This site is a very large, active community with a small proportion of helpful people. They will give you their insight on the good, the bad, and the ugly of your domains and sites (sometimes whether you want it or not). It’s also a good place to buy and sell domains, sites, and services.
  • NamePros Forums
    • This site is very similar to No. DP (DigitalPoint). I have lost interest in it because it seems to be less active and people seem less helpful.

Freelance “time card” calculator

I don’t know how many others will find this handy, but I’ve found it handy myself. It’s tools like this that make this site “Random Web Tools.” 🙂

The script is very simple. I just basically created a format for logging the time you work in a text file, so that you can copy and paste in your “time card” and it will spit out your total time worked. The script could easily be modified to your liking. I threw up an example here. I originally wrote the script and also ported it to PHP.

Enter the times in the following format, separated by new lines or whatever. Whitespace does not matter. The number in the parenthesis is what counts. That’s the total hours:minutes worked during that period of work. The script could be improved by just counting up from the times themselves, but there are lots of problems that could run into unless you included dates, and for personal reasons, I chose not to do that. Don’t forget to change the hourly_rate variable if you want it to tell you how much you get owed.

1:27 PM - 2:08 PM		(0:41)
12:09 AM - 1:12  ENCIERROS  AM		(1:03)


HTML form:

Enter the times, separated by new lines or whatever. Whitespace does not matter.

PHP source code:

 0) {
		$pos2 = strpos($str, ')');
		$arr[$x] = substr($str, $pos + 1, $pos2 - $pos - 1);
		$str = substr($str, $pos2 + 2, strlen($str));
		$pos = strpos($str, '(');
	$hours = 0;
	$minutes = 0;

	for ($x = 0; $x = 60) {
			$hours = $hours + 1;
			$minutes  ПЕРЕДЕРЖКА  -= 60;
		$hours +=  Windows  $arr2[0];

	$total = $hours * 15 + $minutes / 60 * 15;

	echo "

Worked $hours hours and $minutes minutes (" . number_format($hours + $minutes / 60, 2, '.', '') . ")
That's $" . cheap nba jerseys number_format(($hours + $minutes / 60) * $hourly_rate, 2, '.', '') . "

"; } ?>

ASP source code:

		ReDim Preserve arr(x)
		pos2 = InStr(str, ")")
		arr(x) = Mid(str,  cheap jerseys  pos + 1, pos2 - pos - 1)
		str = Mid(str, pos2 + 2, Len(str))
		pos = InStr(str, "(")
		x = x + 1
	hours = 0
	minutes = 0

	For x = 0 To UBound(arr)
		arr2 = Split(arr(x), ":")

		minutes = minutes + CInt(arr2(1))

		If minutes >= 60 Then
			hours = hours + 1
			minutes = minutes - 60
		End If

		hours = hours + CInt(arr2(0))

	total = hours * 15 + minutes / 60 * 15


Worked " & hours & " hours and " & minutes & " minutes (" & FormatNumber(hours + cheap jerseys minutes / 60, 2) & ")
That's " & FormatCurrency((hours + minutes / 60), 2) & "

") End If %>