--- /tmp/pmwiki-2.0.beta54/pmwiki.php 2005-07-29 22:13:47.000000000 +0100 +++ pmwiki.php 2005-08-21 12:06:07.000000000 +0100 @@ -550,10 +550,13 @@ return @$page; } function write($pagename,$page) { - global $Now,$Version,$Newline; + global $Now,$Version,$Newline,$UseHttpXForwardedFor; $page['name'] = $pagename; $page['time'] = $Now; - $page['host'] = $_SERVER['REMOTE_ADDR']; + if (@$UseHttpXForwardedFor) + $page['host'] = $_SERVER['HTTP_X_FORWARDED_FOR']; + else + $page['host'] = $_SERVER['REMOTE_ADDR']; $page['agent'] = @$_SERVER['HTTP_USER_AGENT']; $page['rev'] = @$page['rev']+1; unset($page['version']); unset($page['newline']); @@ -1091,7 +1094,7 @@ function PostPage($pagename, &$page, &$new) { global $DiffKeepDays, $DiffFunction, $DeleteKeyPattern, $EnablePost, - $Now, $Author, $WikiDir, $IsPagePosted, $Newline; + $Now, $Author, $WikiDir, $IsPagePosted, $Newline, $UseHttpXForwardedFor; SDV($DiffKeepDays,3650); SDV($DeleteKeyPattern,"^\\s*delete\\s*$"); $IsPagePosted = false; @@ -1100,7 +1103,10 @@ if ($new['text']==@$page['text']) { $IsPagePosted=true; return; } $new["author"]=@$Author; $new["author:$Now"] = @$Author; - $new["host:$Now"] = $_SERVER['REMOTE_ADDR']; + if (@$UseHttpXForwardedFor) + $new["host:$Now"] = $_SERVER['HTTP_X_FORWARDED_FOR']; + else + $new["host:$Now"] = $_SERVER['REMOTE_ADDR']; $diffclass = preg_replace('/\\W/','',@$_POST['diffclass']); if ($page["time"]>0 && function_exists(@$DiffFunction)) $new["diff:$Now:{$page['time']}:$diffclass"] = --- /tmp/pmwiki-2.0.beta54/sample-config.php 2005-04-25 00:12:09.000000000 +0100 +++ sample-config.php 2005-08-21 12:13:29.000000000 +0100 @@ -136,3 +136,8 @@ # '||border=1 width=80%\\n||!Hdr ||!Hdr ||!Hdr ||\\n|| || || ||\\n|| || || ||\\n', '', '', # '$GUIButtonDirUrlFmt/table.gif"$[Table]"'); +## When you put your PmWiki behind a proxy, the webserver will see +## the request as originating from the proxy IP. Uncomment the following +## line to make PmWiki use the HTTP Header X-Forwarded-For: to fill in +## the correct IP for the Page History. +#$UseHttpXForwardedFor = 1;