Skip to content

Commit

Permalink
Now also uses last 32 bytes of ipv6 addr
Browse files Browse the repository at this point in the history
  • Loading branch information
pjb304 committed Jul 18, 2016
1 parent 5b5e8bc commit 8ec0db4
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions reciever/test-upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ function lastIPv6Group($ipv6) {
return false;
$ipv6_long = ExpandIPv6Notation($ipv6);
$tokens = explode(":", $ipv6_long);
return str_pad($tokens[7], 4, "0", STR_PAD_LEFT);
$ip_str = "";
for($i = 4; $i < 8; $i++){ //We want the last 4 sections of the IP address
$ip_str .= str_pad($tokens[$i], 4, "0", STR_PAD_LEFT);
}
error_log("IP = ".$ip_str);
return $ip_str;
# return str_pad($tokens[7], 4, "0", STR_PAD_LEFT);
}

//echo $_GET["ip"];
Expand Down Expand Up @@ -51,8 +57,16 @@ function lastIPv6Group($ipv6) {
VALUES (?, FROM_UNIXTIME(?), ?)");

$stmt->bind_param("sis", $id, $timestamp, $contents);
$stmt->execute();
if($stmt->execute() === TRUE){
header("HTTP/1.0 200");
echo "SUCCESS";
}else{
header("HTTP/1.0 500");
echo "Query failure";
error_log($stmt->error);
}
$stmt->close();
exit();

?>

0 comments on commit 8ec0db4

Please sign in to comment.