Easiest Way to Have a USA IP Address

Free and Legal Method for Acquiring a Reliable USA IP Address For Testing and Surfing While Outside the USA.

Q. You’re located outside the USA and need to test what your website looks like to your USA visitors.  What’s the easiest way to accomplish this for free an without pesky and unstable ip cloaks and expensive ip proxy address forwarders.

A. If you have a server already located in the USA, all you need to do is to connect via SSH to your server with a port tunnel and then configure your browser to access all non local internet connections through that port.

Step by Step Guide to SSH Tunnel:

Continue reading “Easiest Way to Have a USA IP Address”

Unable to open HTML href link in iOS iPhone

URL’s opening to the same page on your iOs, iPhone, iPad development HTML.

The Problem – href links open to the same page, sometimes with a dot or grey plus sign appearing on the page.

If you’re developing an html page for iOS devices such as the iPhone, iPad, and iPod, and you’re wondering why the href links all open back to the same page, then I think I have a simple solution for you. There’s an explanation for why this is happening, but that’s beyond the scope of this post. I’ve seen others suggest to build your entire website into one index page, but that’s not feasable for more than a very simple static website.

The Solution
Add target=self to the “a” tag and that should bypass the navigation issues.

example:

< a target=”_self” href=”page2.html” class=”ui-btn ui-shadow ui-btn-corner-all ui-btn-up-c btn-showpg list-bttn” id=”showpg”>Link Description

PHP Script – Show Google Search Term That Brought Visitor to Your Website

Find the Google Search Term Keywords That Landed the Visitor on Your Website

I always wanted to know when displaying the webpage what search brought the user to this page.  You can always look at Google Analytics, or whatever statistics package you have on your server (Urchin, Webalizer, etc…), but that is after the fact.  So, I wrote a simple PHP script (all server-side) that gives you that information.

Code Example: Full script – Copy & Paste

Continue reading “PHP Script – Show Google Search Term That Brought Visitor to Your Website”

Programming: IE8 and PHP $ SERVER[‘HTTP REFERER’]

IE Does Not Behave Like Firefox for Many PHP Variables
Forget it, IE doesn’t pass on the PHP referer variable.  You cannot rely on IE for the referer variable.

What’s really frustrating for LAMP programmers is that we often test in Firefox and things look great, and then you jump over to a Windows machine for QA and find out that IE doesn’t behave the same way.

Recently, I had to open a new window with a link from a page on website I was developing.  In order to validate that the new page opened had come from the same domain, I thought to use the referer code that PHP so conveniently keeps as a global session variable  ($ SERVER[‘HTTP REFERER’]).

However, this variable actually is reading from the Apache log of info that was sent in the header from the visitor.  Alas, not all browsers are alike, and hence you cannot rely on this variable to be populated.

Workaround:

It’s messy, but you can always rely on the PHP $_SESSION[‘id’] variable, since that is a server-side variable. It should always perform the same way regardless of the OS or browser that is using the site.

A simple way to check that the page opened has come from the page you sent it would look like this:

Origin page:

1. Populate the session variable:

session_start();
$_SESSION[‘id’] = session_id( );

Link by tagging on the session variable:

LINK to 2nd PAGE ?x= ECHO SESSION ID HERE

2. Next page

session_start(); //make sure to check that session is started
if (isset($_GET[‘x’])){$x=$_GET[‘x’];} //populate the get variable
if($x!=$_SESSION[‘id’]){
//test if the session variable sent from the first page, matches session here
//this area matches, do your things here
}else{
//no match, tell them to try again, etc…
}