using as2 and php to record ip addresses

i just wanna record the ip address of any clicking a button. can i simply use this?:

on (release) {
      _root.sendAndLoad("visit.php", this, "POST");      

there are no errors on this AS2 code. but i'm not getting anything sent via email nor loaded on my server. what am i doing wrong? thanks.

btw, the config.php works (got stuff working from before) and here's the php code:
    include "config.php";
	$to 		= "";
	$sFrom		= "";
	$header 	= "From: MYSITE2010 Visit Tracker<" . $sFrom . ">\r\n";
	$rResult = mysql_query ($sQuery, $link);
	$row = mysql_fetch_assoc($rResult);
	$IDREC  = 1;
	if (!empty($row)) {
		$IDREC = (int)$row['IDREC'] + 1;
	$sQuery = "INSERT INTO tblVisit SET IDREC=" . $IDREC . ", IPADDRESS='" . $sIp . "', DATETIME= '" . date(DATE_RFC822) . "'";
	mysql_query ($sQuery);
	$subject	= "MYSITE2010 Visit Made";
	$body 		= "New visit details : \n\nIP Address : " . $sIp . "\n\nDate :" . date(DATE_RFC822);
	mail ($to, $subject, $body, $header);

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I think your sendAndLoad call might be the problem.

I'm just gonna write a snippet for you to try:
// Put this on the root
var lvSend:LoadVars = new LoadVars();
var lvReceive:LoadVars = new LoadVars();
function callLV():Void {
	lvSend.sendAndLoad("visit.php", lvReceive, "POST");
// Amend your button script to this
on (release) {
// Also, check your file path in that the swf, its HTML container 
// and the script are all in the same directory

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
courtthree is right.

Secondly, you can log if the POST came in by using the attached code:

Thirdly, take a look at your mysql, not sure what your doing there, but i recommend a google search for "ON DUPLICATE KEY UPDATE" that will save you some unneeded lines.

Also, check that you have a smtp server running to send the email, check my snippet

$log = ob_get_clean();
error_log($log, 3, "./error.log");
//for the mail command, needs php 5
 if(!mail ($to, $subject, $body, $header)){
   $log = ob_get_clean();
   error_log($log, 3, "./error.log");

Open in new window

Nice one DerkArts, that looks wicked.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

I did a lot of flash<>php work, and its really hard to debug it because you dont get any info from you php. This is a simplified version but i ended op writing a specific error class/handler that posted al the errors back to flash, and logged them as wel. Only way to make any sort of progress in complex php<>flash stuff.
Well done mate.
ironpen45Author Commented:
the moneyshot was courtthree. Derk, my smtp setting are already working, but you reminded me of something else. thx to both of you! works like charm!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.