Hi, Petko,<br><br>thank you for the quick reply!<br><br>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).<br><br>The code is a bit more complicated so I won't overwrite existing pages.
<br><br>Anyway, if I'm sure I will be _creating_ the page, can I still use PostPage safely?<br><br>Ilja<br><br><div><span class="gmail_quote">On 16/07/07, <b class="gmail_sendername">Petko Yotov</b> <<a href="mailto:5ko@free.fr">
5ko@free.fr</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On Monday 16 July 2007, Ilja Livenson wrote:<br>> I would like to achieve the following: have a user fill the form, create a
<br>> page populated with data from the form, set a edit/upload password and mail<br>> them to the user. But here's my problem - it seems pretty stupid, but I<br>> cannot' set password and populate page at the same time (in one
<br>> transaction) - it's either one or another.<br>><br>> Basically, my code is like this:<br>><br>> $base = MakePageName($pagename, "Students.Invitation");<br>> $basegroup = PageVar($base, '$Group');
<br>> $newpage = MakePageName($base, "$basegroup.$name");<br>><br>> $new['text'] = "smth template";<br>><br>> PostPage($newpage, $new, $new);<br>><br>> // --- setting password ---
<br>> Lock(2);<br>> $auth = RetrieveAuthPage($newpage, 'attr', false);<br>> $password = gen_password();<br>> $auth['passwdedit'] = crypt($password);<br>> $auth['passwdupload'] = crypt($password);
<br>> mail($email, 'password', "$password");<br>> WritePage($page, $auth);<br>> Lock(0);<br>> // --- done setting password ----<br><br>You should be able to do it at the same time:<br><br> $new['text'] = "smth template";
<br><br> $password = gen_password();<br> $new['passwdedit'] = crypt($password);<br> $new['passwdupload'] = crypt($password);<br><br> UpdatePage($newpage, $old, $new);<br> mail(whatever);<br><br>All data (text, passwords) is in the $new array. Use the UpdatePage()
<br>function, not PostPage().<br><br>Note that the code you posted, if it is that simple, it may allow someone to<br>overwrite existing pages (and by the occasion, change their passwords). You<br>should check to see if it is really a new page.
<br><br>See also:<br> <a href="http://pmwiki.org/wiki/PmWiki/Functions">http://pmwiki.org/wiki/PmWiki/Functions</a><br> <a href="http://pmwiki.org/wiki/Cookbook/DebuggingForCookbookAuthors">http://pmwiki.org/wiki/Cookbook/DebuggingForCookbookAuthors
</a><br><br>Thanks,<br>Petko<br><br><br>_______________________________________________<br>pmwiki-users mailing list<br><a href="mailto:pmwiki-users@pmichaud.com">pmwiki-users@pmichaud.com</a><br><a href="http://www.pmichaud.com/mailman/listinfo/pmwiki-users">
http://www.pmichaud.com/mailman/listinfo/pmwiki-users</a><br></blockquote></div><br>