From 72ed1089dd108f548e6b90c8422c985cd3b0f470 Mon Sep 17 00:00:00 2001 From: mjollnir_ Date: Wed, 7 Sep 2005 04:45:52 +0000 Subject: [PATCH] Further tidyup to the cleanremoteaddr function I added - some thing were getting through --- lib/moodlelib.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 9ca725c7b1b..34d3c9697c1 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -6101,7 +6101,10 @@ function unzip_show_status ($list,$removepath) { * Cleans a remote address ready to put into the log table */ function cleanremoteaddr($addr) { - return preg_replace('/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(.*)/','$1',$addr); + $addr = preg_replace('/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(.*)/','$1',$addr); + // just to make SURE, we strip off anything past a , + $addr = preg_replace('/(.*)\,(.*)/','$1',$addr); + return $addr; } /**