Category: PHP

Great Links: Web Encryption without SSL

I have been working on getting data transfer encrypted for parts of my website, and I think I have a solution! Rather than encrypt all of the site with an expensive SSL certificate, I am just going to encrypt the AJAX calls.

Here are the resources that I am using:

Do you have any experience with this or anything similar? Comments are welcome!

Update: I am still trying to get it working… Check out my question here.

Update: Here’s a nice link to help with generating the key: madboa.com: OpenSSL Command-Line HOWTO — How do I generate an RSA key?

Update: I haven’t been able to get pidCrypt to work. I found another tool that looks very good called jCryption, but I can’t make it work because my host doesn’t provide the bcMath library. I found a couple more helpful pages here and here.

Sitemaps

I have been working with Google’s Webmaster Tools, and one of the things that it requires is a sitemap. It took me some tweaking to get it right, but here is what I learned.

First, I had to hand craft a sitemap php file for the main, parent site. The first thing that I struggled with was how to get the content type and XML heading in a php file. The solution was the header() command and to use the echo command.

Here is the heading of my sitemap page:
[sourcecode lauguage=”php”]
<?php
header("Content-Type: text/xml");

echo ‘<‘ . ‘?’ . ‘xml version="1.0" encoding="UTF-8" ‘ . ‘?’ . ‘>’
?>
[/sourcecode]

The next hurdle was to determine how to include the last modified field. I found the filemtime() command could read the last time the file was changed. Then, the date() command using the DATE_W3C format puts it in the correct format that the sitemap expects.

Here is what an entry looks like.
[sourcecode lauguage=”php”]
<url>
<loc>http://digitaleagle.net</loc>
<lastmod><? echo date (DATE_W3C, filemtime(‘index.html’)) ?></lastmod>
<priority>0.4</priority>
<changefreq>monthly</changefreq>
</url>
[/sourcecode]

Finally, I found a plugin that would generate the sitemap for the WordPress blogs. The plugin is called: “Google XML Sitemaps”:

This plugin adds a new settings page where you can configure different options regarding the sitemap:

I didn’t need to mess with any of the settings. I should have blogged this as I was doing it, but if I remember right, I had to visit this page the first time to generate the sitemap. From there, it takes over.

At the top of the settings, you can see stats such as when it last generated the XML. You can also force it to rebuild the sitemap.

Resources