1
0
mirror of https://github.com/cottow/6paster.git synced 2024-05-19 06:50:10 +00:00

changed IP storage to SHA-256 hash instead of actual address

This commit is contained in:
Christiaan Ottow
2020-02-16 14:47:18 +01:00
parent a11a517629
commit 4e575e5fdf

View File

@@ -225,7 +225,8 @@ function do_paste()
// it's OK now, let's post it
$ident = generate_ident();
$stmt = $dbh->prepare("INSERT INTO `pastes` SET `ident`= ?, `ip`=?, `date`=NOW(), `text`=?, `mimetype`=?, `expires` = TIMESTAMPADD( SECOND, ?, NOW())");
$stmt->bind_param('ssssi', $ident, $_SERVER['REMOTE_ADDR'], $_POST['content'], $mime_type, $ttl );
$ip = hash('sha256',$_SERVER['REMOTE_ADDR']);
$stmt->bind_param('ssssi', $ident, $ip, $_POST['content'], $mime_type, $ttl );
$stmt->execute();
header("Location: ".BASEURL."p/".$ident);
@@ -280,7 +281,8 @@ function _limit_exceeded( $type, $limit )
{
die("Couldn't perform throttle check");
}
$stmt->bind_param("s", $_SERVER['REMOTE_ADDR'] );
$ip = hash('sha256',$_SERVER['REMOTE_ADDR']);
$stmt->bind_param("s", $ip);
$stmt->execute();
$stmt->bind_result( $count );
$stmt->fetch();