[pmwiki-users] creating a page and setting password in php
Ilja Livenson
ilja.livenson at gmail.com
Mon Jul 16 03:40:10 CDT 2007
Hi, All
I would like to achieve the following: have a user fill the form, create a
page populated with data from the form, set a edit/upload password and mail
them to the user. 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.
Basically, my code is like this:
$base = MakePageName($pagename, "Students.Invitation");
$basegroup = PageVar($base, '$Group');
$newpage = MakePageName($base, "$basegroup.$name");
$new['text'] = "smth template";
PostPage($newpage, $new, $new);
// --- setting password ---
Lock(2);
$auth = RetrieveAuthPage($newpage, 'attr', false);
$password = gen_password();
$auth['passwdedit'] = crypt($password);
$auth['passwdupload'] = crypt($password);
mail($email, 'password', "$password");
WritePage($page, $auth);
Lock(0);
// --- done setting password ----
Now, it works either with setting 'text' or with setting password. I know
that the error must be something very simple, but I cannot understand what.
Any ideas, please? Pmwiki version is 2.1.27 (latest stable).
thanks,
Ilja
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/pmwiki-users/attachments/20070716/c525a4bd/attachment.html
More information about the pmwiki-users
mailing list