The main problem I found is that control over the external information can only exist if there is allowScriptAccess in the html embed code of the , like this:
<param name="allowScriptAccess" value="always">
and
allowScriptAccess="always"
In the tag.
This is a bit late for me since I can't tell everyone who embeds my player to add those lines to their site, but from now on... Anyway, someone who wants to hide can easily just delete the lines. So I renamed the SWF file ... and now everyone who does the remote embed has to check back and get the new code.
Here's the AS2 code that worked:
function geturlhttp() {
//urlPath = ExternalInterface.call("window.location.href.toString");
urlPath = ExternalInterface.call("eval","document.location.href");
//both work, try which one is bet
}
geturlhttp();
var lv:LoadVars = new LoadVars();
lv.var1 = urlPath;
lv.var2 = title; //an internal variable, the name of the file
lv.sendAndLoad("http://www.somesite.test/tracker.php",lv,"POST");
So the tracking only works on my own site, not the external remote embedding sites which come up empty or "null" in sql.
And here's the PHP code I made with SQL. I've only made something for the insertion and I'm going to work on display and selection later...
<?php
//POST needs to be secured, this is just a test :)
$url = $_POST['var1'];
$title = $_POST['var2'];
$dbhost = "127.0.0.1"; // almost always localhost.
$dbname = "x"; // Database Name, In our case, its news
$dbuser = "x"; // Database Username
$dbpass = "x"; // Databse Password
$connect = mysql_connect("$dbhost","$dbuser","$dbpass");// Connecting to Database
mysql_select_db($dbname) or die (mysql_error()); // Selecting Database
$sql= "INSERT INTO tablename (urlrow, titlerow) VALUES ('$url','$title')";
$result = mysql_query($sql);
?>