Link to home
Start Free TrialLog in
Avatar of ironpen45
ironpen45

asked on

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:
<?php
 
    include "config.php";
 
	$to 		= "info@mysite.com";
	$sFrom		= "info@mysite.com";
	$header 	= "From: MYSITE2010 Visit Tracker<" . $sFrom . ">\r\n";
 
	$sIp	= $_SERVER ['REMOTE_ADDR'];
 
	$sQuery = "SELECT IDREC FROM tblVisit ORDER BY IDREC DESC LIMIT 1";
	$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);
		
	echo("true");
?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of courtthree
courtthree

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of courtthree
courtthree

Nice one DerkArts, that looks wicked.
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.
Avatar of ironpen45

ASKER

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!