[pmwiki-users] Using IP's in PmWiki
Michael Brenner
mik.admin at nurfuerspam.de
Tue Sep 19 12:45:35 CDT 2006
Hi there,
lately I had an idea for an ip-based authentication. This might be userful for
Intranet's also having webwide access. There are two useful ways in using
IP's (see below). My questions are, is this worth added to the cookbook and
will it work that fine like I'm thinking?
--code for local/config.php--
// Visitors from subnet have authenticated status via IP
// All Visitor can login
//hint: (:if !enabled AuthPw)[[{$Title}?action=login|Login]](:endif:) to make
// login link still works for user-based authorisation
/*
if((ip2long($_SERVER['REMOTE_ADDR'])&ip2long('255.255.255.0'))==ip2long('192.168.10.0'))
{
//local ip
SDV($AuthId, $_SERVER['REMOTE_ADDR']);//don't set if visitor isauthenticated
}
$Author=$AuthId;
*/
/*
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// --Plan B--
// Only visitors from local net are able to login
// in Site.AuthForm: change (:if:)$[Password]: (:input password name=authpw:)
// to (:if enabled EnableAuthUser:)$[Password]: (:input password name=authpw:)
// and add (:if !enabled EnableAuthUser:)Sorry, login disabled(:ifend:)
// hint: Use (:if expr !enabled AuthPw and enabled EnableAuthUser:)
// [[{$Title}?action=login|Login]](:ifend:)
$Author=$AuthId;
if((ip2long($_SERVER['REMOTE_ADDR'])&ip2long('255.255.255.0'))==ip2long('192.168.10.0'))
{
//local ip
$EnableAuthUser=1;
} else {
$EnableAuthUser=0;
}
*/
More information about the pmwiki-users
mailing list