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.p hp", 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:
on (release) {
_root.sendAndLoad("visit.p
}
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");
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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!