[pmwiki-users] Retricting passwords to IPs
Petko Yotov
5ko at 5ko.fr
Wed Dec 9 09:27:08 CST 2009
On Wednesday 09 December 2009 15:33:41, Knud Jahnke wrote :
> Dear all!
>
> I'm trying to do the following: For an institute-internal Wiki I want
> everyone with a certain IP (base) to be able to edit the Wiki without a
> password, but everyone else outside only with a password.
>
> The Wiki is part of a farm and I tried to follow the example in
>
> http://www.pmwiki.org/wiki/PmWiki/Security#wikivandalism
...
> preg_match("^90.68.", $_SERVER['REMOTE_ADDR'])
>
> always seems to return false, no matter what I do
Now correctedin the page, thanks!
There was an error in the regular expression, it should be :
## Allow passwordless editing from own turf, pass for others.
if ($action=='edit'
&& !preg_match("/^90\\.68\\./", $_SERVER['REMOTE_ADDR']) )
{ $DefaultPasswords['edit'] = crypt('foobar'); }
The reg-exp is the part "/^90\\.68\\./" and, inside the quotes, it starts and
ends with slashes which were missing, and the dots are prepended with \\.
Thanks,
Petko
More information about the pmwiki-users
mailing list