Using php to record length of stay
Posted: Fri Sep 09, 2011 2:50 pm
Hi,
I have a webpage that when opened contains a jukebox written in flash. Whenever a user opens this page the html triggers a php script that sends me an e-mail with the users ip address. I would like to know how to go about including the length of time that the user spent on the page, actually on the jukebox. Can that be done via php? If so do you think that using php is the best option to do this? If not what suggestions might you have? Really appreciate anyone's help....
Here is basically what the HTML code for the Jukebox page looks like:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Jukebox</title>
<script type="text/javascript" src="audio_player_files/flashdetect.js"></script>
<style type="text/css"></style>
</head>
<body>
</div>
<script type="text/javascript">
var so = new SWFObject("audio_player_files/audioPlayer.swf", "player", "400", "180", "6", "#666666");
so.addVariable("xmlPath", "audio_player_files/data.xml");
so.write("flashcontent");
</script>
<iframe src="siteHitEmail.php" HEIGHT="0" WIDTH="0"></iframe>
</body>
</html>
Here is my php script: (referenced by <iframe src= in the html above)
Thanks!
I have a webpage that when opened contains a jukebox written in flash. Whenever a user opens this page the html triggers a php script that sends me an e-mail with the users ip address. I would like to know how to go about including the length of time that the user spent on the page, actually on the jukebox. Can that be done via php? If so do you think that using php is the best option to do this? If not what suggestions might you have? Really appreciate anyone's help....
Here is basically what the HTML code for the Jukebox page looks like:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Jukebox</title>
<script type="text/javascript" src="audio_player_files/flashdetect.js"></script>
<style type="text/css"></style>
</head>
<body>
</div>
<script type="text/javascript">
var so = new SWFObject("audio_player_files/audioPlayer.swf", "player", "400", "180", "6", "#666666");
so.addVariable("xmlPath", "audio_player_files/data.xml");
so.write("flashcontent");
</script>
<iframe src="siteHitEmail.php" HEIGHT="0" WIDTH="0"></iframe>
</body>
</html>
Here is my php script: (referenced by <iframe src= in the html above)
Code: Select all
<?php
if (getenv(HTTP_X_FORWARDED_FOR)) {
$ipaddress = getenv(HTTP_X_FORWARDED_FOR);
} else {
$ipaddress = getenv(REMOTE_ADDR); }
$to = "danshirl@aol.com";
$subject = "Jukebox accessed";
$email = $ipaddress;
$message = "";
mail($to,$subject,$message, $email);
?>