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&nbsp; would like to stick with the stable for now).<br><br>The code is a bit more complicated so I won&#39;t overwrite existing pages.
<br><br>Anyway, if I&#39;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> &lt;<a href="mailto:5ko@free.fr">
5ko@free.fr</a>&gt; 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>&gt; I would like to achieve the following: have a user fill the form, create a
<br>&gt; page populated with data from the form, set a edit/upload password and mail<br>&gt; them to the user. But here&#39;s my problem - it seems pretty stupid, but I<br>&gt; cannot&#39; set password and populate page at the same time (in one
<br>&gt; transaction) - it&#39;s either one or another.<br>&gt;<br>&gt; Basically, my code is like this:<br>&gt;<br>&gt; $base = MakePageName($pagename, &quot;Students.Invitation&quot;);<br>&gt; $basegroup = PageVar($base, &#39;$Group&#39;);
<br>&gt; $newpage = MakePageName($base, &quot;$basegroup.$name&quot;);<br>&gt;<br>&gt; $new[&#39;text&#39;] = &quot;smth template&quot;;<br>&gt;<br>&gt; PostPage($newpage, $new, $new);<br>&gt;<br>&gt; // ---&nbsp;&nbsp; setting password&nbsp;&nbsp; ---
<br>&gt; Lock(2);<br>&gt; $auth = RetrieveAuthPage($newpage, &#39;attr&#39;, false);<br>&gt; $password = gen_password();<br>&gt; $auth[&#39;passwdedit&#39;] = crypt($password);<br>&gt; $auth[&#39;passwdupload&#39;] = crypt($password);
<br>&gt; mail($email, &#39;password&#39;, &quot;$password&quot;);<br>&gt; WritePage($page, $auth);<br>&gt; Lock(0);<br>&gt; // --- done setting password ----<br><br>You should be able to do it at the same time:<br><br>&nbsp;&nbsp; $new[&#39;text&#39;] = &quot;smth template&quot;;
<br><br>&nbsp;&nbsp; $password = gen_password();<br>&nbsp;&nbsp; $new[&#39;passwdedit&#39;] = crypt($password);<br>&nbsp;&nbsp; $new[&#39;passwdupload&#39;] = crypt($password);<br><br>&nbsp;&nbsp; UpdatePage($newpage, $old, $new);<br>&nbsp;&nbsp; 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>&nbsp;&nbsp; <a href="http://pmwiki.org/wiki/PmWiki/Functions">http://pmwiki.org/wiki/PmWiki/Functions</a><br>&nbsp;&nbsp; <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>