[pmwiki-users] V2 SSL Mode? (was Re: Unable to save...)
H. Fox
haganfox at users.sourceforge.net
Thu Nov 16 23:11:22 CST 2006
On 11/16/06, H. Fox <haganfox at users.sourceforge.net> wrote:
> On 11/16/06, L. Bell <labellz at earthlink.net> wrote:
> > 2) Why doesn't the SwitchToSSLMode recipe appear in the V2 cookbook?
>
> Many reasons, but it seems like now is a good time to add it, so I just did.
>
> http://www.pmwiki.org/wiki/Cookbook/SwitchToSSLMode
I reworked the code that switches to SSL only to avoid sending
passwords in the clear. How's this?
## Switch to SSL mode to avoid sending passwords in the clear.
if($action=='login'
|| $action=='edit'
|| $action=='post'
|| $action=='postattr'
|| $action=='attr'
|| $action=='upload'
|| $action=='loginadmin')
{
$ScriptUrl = 'https://www.example.com/path-to-wiki';
$PubDirUrl = 'https://www.example.com/path-to-wiki/pub';
if (!$_SERVER['HTTPS'] == 'on')
{
# Copy all GET request parameters and avoid
# a problem with empty filename on upload page.
$getparms = array();
reset($_GET);
while(list($name,$value) = each($_GET))
if(!empty($value))
$getparms[$name] = $name."=".urlencode($value);
Redirect($pagename,'$PageUrl?'.implode("?",$getparms));
}
} else {
$ScriptUrl = 'http://www.example.com/path-to-wiki';
$PubDirUrl = 'http://www.example.com/path-to-wiki/pub';
}
Hagan
More information about the pmwiki-users
mailing list