Big thanks, Henri!

Monday, November 10, 2003, 5:58:21 PM, you wrote:

HB> -----BEGIN PGP SIGNED MESSAGE-----
HB> Hash: SHA1

HB> Greetings!

HB> Sergey N. Fefilatyev wrote:
HB> | User registration(means that entry of the user in Midgard system

HB> Here is user registration code from TownPortal. You will need to
HB> modify it a bit to fit your needs. For example, replace the
HB> tp_loc localization calls with some function your site provides
HB> etc.

HB> Check all the keys used here from the $TownPortal array. You will
HB> have to provide a bunch of them for correct settings, like admin
HB> user username and password.

HB> <?php
HB> /*
HB> TownPortal user self-registration form

HB> Copyright (c) 2002-2003 Nemein Oy, Finland <[EMAIL PROTECTED]>
HB> http://www.nemein.com/
HB> tel: +358-20-198 6030

HB> Henri Bergius, [EMAIL PROTECTED]

HB> Changes:
HB>         2003-02-03: Initially created (bergie)
HB> */
HB> $person_created = 0;

HB> if (isset($TownPortal['user_register'])) {
HB> ~  mgd_auth_midgard($TownPortal['admin_user'],$TownPortal['admin_pass'],0);
HB> ~  $midgard = mgd_get_midgard();

HB> ~  $person = mgd_get_person();
~  $person->>firstname = $firstname;
~  $person->>lastname = $lastname;
~  $person->>street = $street;
~  $person->>postcode = $postcode;
~  $person->>city = $city;
~  $stat = $person->>create();
HB> ~  $err = mgd_errstr();
HB> ~  if ($stat) {
HB> ~    $person = mgd_get_person($stat);
HB> ~    $stat = mgd_update_password_plain($person->id,$username,$password);
HB> ~    $err = mgd_errstr();
HB> ~    if ($stat) {
HB> ~      $stat =
HB> mgd_create_member($person->id,$TownPortal['users_group']->id,"self-register");
HB> ~      $err = mgd_errstr();
HB> ~      if ($stat) {
HB> ~        $person_created = 1;
HB> ~      } else {
HB> ~        echo "<p>".sprintf(tp_loc("Failed to add user into Users group,
HB> reason
HB> %s"),tp_loc($err,"/NemeinLocalization/Errors/",$TownPortal[language]))."</p>\n";
~        $person->>delete();
HB> ~      }
HB> ~    } else {
HB> ~      echo "<p>".sprintf(tp_loc("Failed to add user account, reason
HB> %s"),tp_loc($err,"/NemeinLocalization/Errors/",$TownPortal[language]))."</p>\n";
~      $person->>delete();
HB> ~    }
HB> ~  } else {
HB> ~    echo "<p>".sprintf(tp_loc("Failed to create person, reason
HB> %s"),tp_loc($err,"/NemeinLocalization/Errors/",$TownPortal[language]))."</p>\n";
HB> ~  }

HB> }

HB> if ($person_created) {
HB> ~  echo "<h1>".sprintf(tp_loc("Register into
HB> %s"),$TownPortal[site_title])."</h1>\n";

HB> ~  echo "<p>".tp_loc("User account has been created").".</p>\n";

HB> ~  echo "<p><a href=\"".$TownPortal['siteroot']."/my/\">".tp_loc("Go to
HB> My page")."</a>.</p>\n";

HB> } else {
HB> ~  echo "<h1>".sprintf(tp_loc("Register into
HB> %s"),$TownPortal['site_title'])."</h1>\n";

HB> ~  echo "<form method=\"POST\">\n";
HB> ~  echo "<table border=\"0\">\n";
HB> ~  echo "<tr><td>";
HB> ~  echo tp_loc("First name").": \n";
HB> ~  echo "</td><td>";
HB> ~  echo "<input type=\"text\" name=\"firstname\">\n";
HB> ~  echo "</td></tr><tr><td>";
HB> ~  echo tp_loc("Last name").": \n";
HB> ~  echo "</td><td>";
HB> ~  echo "<input type=\"text\" name=\"lastname\">\n";
HB> ~  echo "</td></tr><tr><td>";
HB> ~  echo tp_loc("Street").": \n";
HB> ~  echo "</td><td>";
HB> ~  echo "<input type=\"text\" name=\"street\">\n";
HB> ~  echo "</td></tr><tr><td>";
HB> ~  echo tp_loc("ZIP").": \n";
HB> ~  echo "</td><td>";
HB> ~  echo "<input type=\"text\" name=\"postcode\">\n";
HB> ~  echo "</td></tr><tr><td>";
HB> ~  echo tp_loc("City").": \n";
HB> ~  echo "</td><td>";
HB> ~  echo "<input type=\"text\" name=\"city\"
HB> value=\"".$TownPortal['site_title']."\">\n";
HB> ~  echo "</td></tr><tr><td>";
HB> ~  echo tp_loc("Username").": \n";
HB> ~  echo "</td><td>";
HB> ~  echo "<input type=\"text\" name=\"username\">\n";
HB> ~  echo "</td></tr><tr><td>";
HB> ~  echo tp_loc("Password").": \n";
HB> ~  echo "</td><td>";
HB> ~  echo "<input type=\"password\" name=\"password\">\n";
HB> ~  echo "</td></tr><tr><td colspan=\"2\">";
HB> ~  echo "<input type=\"submit\" name=\"TownPortal[user_register]\"
HB> value=\"".tp_loc("Register")."\">\n";
HB> ~  echo "</td></tr>";
HB> ~  echo "</table>\n";
HB> ~  echo "</form>\n";

HB> }
?>>

HB> /Bergie

HB> - --
HB> Henri Bergius                           [EMAIL PROTECTED]
HB> Consultant Partner                      Tel: +358-20-198 6032
HB> Nemein Oy                               http://www.nemein.com/

HB> Nemein.Net -- Project tracking solution for consulting companies
HB> http://www.nemein.com/en/nemeinnet/
HB> -----BEGIN PGP SIGNATURE-----
HB> Version: GnuPG v1.0.7 (GNU/Linux)
HB> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

HB> iD8DBQE/r7WcNkT8k497k9IRAv2nAKC0J/FsPMBnKx8MCC9QRrGWPVf2QQCfVQub
HB> SyB7+01Z81Iop1ffZkN0w50=
HB> =ZHYK
HB> -----END PGP SIGNATURE-----


HB> ---------------------------------------------------------------------
HB> To unsubscribe, e-mail: [EMAIL PROTECTED]
HB> For additional commands, e-mail: [EMAIL PROTECTED]



-- 
Best regards,
 Sergey                            mailto:[EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to