Forum Discussion
Here's the relevant snippets:
This is the GetVUserID.php file
<html>
<head>
<title>HTTP Post Handler</title>
<head>
<?php
//$StationName = $_REQUEST['FromStation'];
//print("Testing");
?>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>
<?php
function gen_uuid($len=8)
{
$hex = md5("yourSaltHere" . uniqid("", true));
$pack = pack('H*', $hex);
$tmp = base64_encode($pack);
$uid = preg_replace("#(*UTF8)[^A-Za-z0-9]#", "", strtoupper($tmp));
$len = max(4, min(128, $len));
while (strlen($uid) < $len)
$uid .= gen_uuid(22);
return substr($uid, 0, $len);
}
$ActionNeeded = $_REQUEST['TxAction'];
If ($ActionNeeded = "GetVUserID")
{
$a = gen_uuid(8);
print("User ID:$a<br>");
}
$con = mysql_connect("localhost", "root", ""); // or die('Error', mysql_error());
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("LoadCompleteTx");
$query="INSERT INTO `loadcompletetx`.`runlog` (`VUserID`, `TxAction`, `TimeIn`) VALUES ('$a', '$ActionNeeded', CURRENT_TIMESTAMP);";
/*
print("<p>");
print("Running query: $query");
print("<p>");
*/
if(!mysql_query($query, $con))
{
die ('Error updating database');
}
else
{
print("<p>Success: Logged");
}
mysql_close($con);
?>
<p>
</body>
</html>
Related Content
- 8 years ago
- 8 years ago
- 7 years ago
- 8 years ago
- 4 years ago
Recent Discussions
- 10 months ago
- 2 years ago
- 3 years ago
- 3 years ago