[pmwiki-users] creating a page and setting password in php

Petko Yotov 5ko at free.fr
Mon Jul 16 07:45:18 CDT 2007


On Monday 16 July 2007, Ilja Livenson wrote:
> UpdatePage is not really available in the stable version, only in beta (but
> I have other problems with beta so  would like to stick with the stable for
> now).
...
> Anyway, if I'm sure I will be _creating_ the page, can I still use PostPage
> safely?

I believe so. Just add the elements $new['passwdedit'] and 
$new['passwdupload'] before calling the PostPage() function. 

Note that this will not log the created page in the RecentChanges pages, but 
that's probably what you want.

Petko


> On 16/07/07, Petko Yotov <5ko at free.fr> wrote:
> > On Monday 16 July 2007, Ilja Livenson wrote:
> > > But here's my problem - it seems pretty stupid, but I
> > > cannot' set password and populate page at the same time (in one
> > > transaction) - it's either one or another.
...
> > You should be able to do it at the same time:
> >
> >    $new['text'] = "smth template";
> >
> >    $password = gen_password();
> >    $new['passwdedit'] = crypt($password);
> >    $new['passwdupload'] = crypt($password);
> >
> >    UpdatePage($newpage, $old, $new);
> >    mail(whatever);
> >
> > All data (text, passwords) is in the $new array. Use the UpdatePage()
> > function, not PostPage().
> >
> > Note that the code you posted, if it is that simple, it may allow someone
> > to
> > overwrite existing pages (and by the occasion, change their passwords).
> > You
> > should check to see if it is really a new page.
> >
> > See also:
> >    http://pmwiki.org/wiki/PmWiki/Functions
> >    http://pmwiki.org/wiki/Cookbook/DebuggingForCookbookAuthors




More information about the pmwiki-users mailing list