Jump to content

number of times requested


The Little Guy

Recommended Posts

They call the PHP file from a javascript file that I have, I could put some javascript in that couldn't I?

 

Some thing like when the JS is called set a var to one, and if the var is already set to one don't let the php be included again.

 

Also could I do a require_once, or include_once in the PHP file?

I give them this code (past onto their server):

 

<script type="text/javascript">
var idNum = '1';
var projectID = '6';
var projectCode = 'eb7sv7vnwc'
</script><script type="text/javascript" src="http://superstats.phpsnips.com/javascripts/stats.js"></script>

 

If they edit it if they they want, but then then they wont be able to see their website's stats.

 

The code that it access looks like this (on my server):

// JavaScript Document
var width=screen.width;
var height=screen.height;
var ref=document.referrer;
var loca=document.location;


var to_str = 'location='+loca+'&width='+width+'&height='+height+'&ref='+ref+'&owner_id='+idNum+'&project_id='+projectID+'&projectCode='+projectCode;
if(!called){
document.writeln('<script language="JavaScript" src="http://superstats.phpsnips.com/javascripts/jsProcess.php?'+to_str+'"></script>');
}
var called = true;

The best thing I thought you could do is automatically run AJAX to post parameters to a PHP page about the details of the referrer, etc.. and update the database that way.

 

Since they use javascript to access YOUR javascript, anything you want to do must be written up in your javascript.

 

Hence, by using AJAX, you can:

 

1) update their information on how they've accessed your site

2) check to see if they've accessed too many times, etc...

I was actually able to write a .htaccess file, that take the request and runs it though a PHP file, that way I can check things using PHP....

 

Here is what I have so far...

 

header("Content-type: application/x-javascript");
if(basename(__FILE__) == basename($_SERVER['PHP_SELF'])){
//if($_SERVER['HTTP_REFERER'] == 'http://superstats.phpsnips.com/javascripts/stats.js'){
echo 'No Access!';
}else{
readfile('stats.js');
}

//print_r($_SERVER);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.