Email Quiz Results -> sendmail + XAMPP +LAN

Feb 20, 2012

Hey,

after I made sendmail + XAMPP  + local lan network

I have results in txt file on .../htdocs of XAMPP. So I make delphi programm and it is OK.

How can I take IP address of LAN PC which is send results in txt file?

results.txt

  Mreza i Internet
Status, Raw Score, Passing Score, Max Score, Min Score, Time

passed,21,10,21,0,19:23:59

Date, Time, Score, Interaction ID, Objective Id, Interaction Type, Student Response, Result, Weight, Latency

2/19/2012,19:19:34,0,I98dd4754-4554-4859-a4cc-7d03233a37cd,Question1_1,fillin,Krajnik Kraj,neutral,1,8469
2/19/2012,19:19:39,0,I6ef78c22-dfa9-4c78-bd06-6997dc588a2e,Question2_1,fillin,1k,neutral,1,4363
......

I want IPAddress insted  Weight ?????

Something like:

<html>
<head>
<title>What Is Your Ip</title>

<script type="text/javascript">
var macAddress = "";
var ipAddress = "";
var computerName = "";
var wmi = GetObject("winmgmts:{impersonationLevel=impersonate}");
e = new Enumerator(wmi.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True"));
for(; !e.atEnd(); e.moveNext()) {
var s = e.item();
macAddress = s.MACAddress;
ipAddress = s.IPAddress(0);
computerName = s.DNSHostName;
}
</script>

</script>

<input type="text" id="txtMACAdress" />
<input type="text" id="txtIPAdress" />
<input type="text" id="txtComputerName" />


<script type="text/javascript">
document.getElementById("txtMACAdress").value = unescape(macAddress);
document.getElementById("txtIPAdress").value = unescape(ipAddress);
document.getElementById("txtComputerName").value = unescape(computerName);
</script>



</body>
</html>

2 Replies
dras pero

I find solution !

TNX any way.

 I was change sendmail.php and now look like:



ob_start(); // Turn on output buffering
system('ipconfig /all'); //Execute external program to display output
$com_result=ob_get_contents(); // Capture the output into a variable
ob_clean(); // Clean (erase) the output buffer

$findme = "IPv4 Addres";
$str_pos = strpos($com_result, $findme); // Find the position of "IP Address" text
$ip_addres=substr($com_result,($str_pos+36),15); // Get Full line of "IP Address"


$email = $_REQUEST['email'];
$QuizResults = $_REQUEST['QuizResults'];
$Replace = "\\\"";
$QuizResults = str_replace($Replace, "", $QuizResults);

$RT = "\n"; //return

$myFile = "rezultati-testa2.txt";
$fh = fopen($myFile, 'a') or die("can't open file");

$stringData = $ip_addres.$RT.$QuizResults; //add IP Address to Quiz Results in first line

fwrite($fh, $stringData);
$stringData = "\n";
fwrite($fh, $stringData);
fclose($fh);

print "Cestitam! Uspjesno si poslao test";
?>

This discussion is closed. You can start a new discussion or contact Articulate Support.