[eluser]Fierymind[/eluser]
I have solved the issue, let me explain again the problem and solution .. may be this solve someone issue (or someone come with better solution).
tracking controller is part of larger software, we need to track visitors on static websites, from where the visitor come and what pages his visited and how often he come back.
my solution is embed the following code in each page of such static websites, its [removed]
Code:
page = document.location.href;
from = document.referrer;
if (from == '') from = 'unknown';
document.wrte("<img style='display:none' src='http://www.domain.com/CI_installation/track/visit/"+page+"/"+from+"'>");
like you see, I pass the wanted info from Javascript to CI installation, but what if
from variable equal to this:
Code:
http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=something
obviously such string on CI URI will not work, escape() and encodeURIComponent() will not work too.
so what I can do? .. if I used $_SERVER[‘HTTP_REFERER’] on track/visit .. it will not return the correct value I'm looking for.
and here is my solution:
In Javascript, I'll convert every character of current URL and referrer URL to the equivalent ASCII code, separated by a dash.
Code:
function toASCII(input) {
var output = '';
for(i=0; i<input.length; ++i)
{
if(output != "") output += "-";
output += input.charCodeAt(i);
}
return output;
}
page = document.location.href;
from = document.referrer;
if (from == '') from = 'unknown';
page = toASCII(page);
from = toASCII(from);
document.wrte("<img style='display:none' src='http://www.domain.com/CI_installation/track/visit/"+page+"/"+from+"'>");
then in my PHP part, I'll take this string (will be something like 75-46-21-67-..) and return the ASCII chars into readable text.