Hi Nick,
It's triggered by the php code inside the *.php page. I have done a tiny bit with php and Nettalk and it works quite well.
Here's an example of a *.php file updating an MS SQL database using php and Nettalk (the *.php file is placed in the 'web' folder:
<!-- NetWebServer -->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>kwiklook Online - Induction Result Processing</title>
</head>
<body>
<?php
function get_only_numbers($string){
return preg_replace("/\D+/", "", $string);
}
$spOldType = $_GET["type"];
$spOldID = $_GET["id"];
$spMidType = get_only_numbers($spOldType);
$spMidID=(int)$spOldID;
if($spMidType=="12")
{
$spType="SP";
$spID=($spMidID/17);
}
if($spMidType=="9071")
{
$spType="SPS";
$spID=($spMidID/22);
}
$myServer = "MYSQLSERVERNAME";
$myUser = "USERNAME";
$myPass = "PASSWORD";
$myDB = "DATABASENAME";
//connection to the database
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer. Please press back and try again.");
//select a database to work with
$selected = mssql_select_db($myDB, $dbhandle)
or die("Couldn't open database $myDB. Please press back and try again.");
//get today's date in Clarion format
date_default_timezone_set('Australia/Adelaide');
$unixTime = time();
$clarionDate = $unixTime / 86400 + 61730;
//declare the SQL statement that will query the database
$query = "SELECT OPT_InductionCredentialProfileID AS credProfileID FROM Options";
//execute the SQL query
$result = mssql_query($query);
$numRows = mssql_num_rows($result);
//display the results
while($row = mssql_fetch_array($result))
{
$credProID = $row["credProfileID"];
}
$credProID = trim($credProID," ");
//declare the SQL statement that will query the database
$query = "UPDATE Credential ";
$query .= "SET CRE_Status = 'Pending', CRE_AttainmentDate = " . $clarionDate . " ";
$query .= "WHERE CRE_OwnerType = '" . $spType . "' AND CRE_OwnerID = " . $spID . " AND CRE_CredentialID = " . $credProID;
echo $query."\n";
//execute the SQL query
mssql_query($query);
////get name of Contractor
if ($spType=="SP")
{
$query = "SELECT PRO_GivenNames AS givenName, PRO_FamilyName AS familyName FROM ServiceProvider WHERE PRO_ProviderID = " . $spID;
}
else
{
$query = "SELECT VIS_FirstName AS givenName, VIS_LastName AS familyName FROM Visitor WHERE VIS_VisitorID = " . $spID;
}
//execute the SQL query
$result = mssql_query($query);
$numRows = mssql_num_rows($result);
//display the results
while($row = mssql_fetch_array($result))
{
$spGivenName = $row["givenName"];
$spFamilyName = $row["familyName"];
}
$spName = trim($spGivenName," ") ." ". trim($spFamilyName," ");
$spName = rawurlencode($spName);
//close the connection
mssql_close($dbhandle);
?>
<script language="JavaScript" type="text/javascript">
var myName = "<?php print($spName); ?>";
window.location = 'InductionComplete.html?myName=' + myName;
</script>
</body>
</html>
Regards,
Trent