Revision [17683]

This is an old revision of FudLogin made by MreimeR on 2007-10-29 15:38:37.

 

FudLogin Mod


This is a try for an advanced "Single Login System" for Wikka Wiki in combination with an FUDForum based forum installation. It will allow anyone to log in with his forum login and password. On the first login, a user has to choose his WikiName, he likes to use.

I had the following goals in mind, when developing this mod:

To install this mod, you at first have to specify the path to your forum in your wikka.config.php in the following way:
  1. "fudlogin_forumpath" => "../FUDForum"  // Replace with relative path to your "non HTTP reachable" forum files (backend).


Then replace the file actions/usersettings.php with the version at the end of this page.

After doing so, any user is immediately able to login with his forum login data. Users, which already had a WikiName, will be able to enter the old WikiName on the first login. This will migrate the old WikiName to the new login system.
Users, which didn't already have a WikiName, will just choose a new one, which hasn't been already taken by someone else and isn't already in use as name for a page on your wiki.



This is the replacement for actions/usersettings.php:
  1. <?php
  2. // Modded usersettings.php to login against the FUDForum user database
  3. // Copyright (C) Manuel Reimer (Manuel _dot_ Reimer _at_ gmx _dot_ de)
  4. // This program is free software; you can redistribute it and/or
  5. // modify it under the terms of the GNU General Public License
  6. // version 2 as published by the Free Software Foundation
  7.  
  8. /* !!!!!!!! THIS IS A MODDED FILE AND NOT PART OF WIKKA WIKI !!!!!!!!! */
  9. /*     More infos on this mod here: http://wikkawiki.org/FudLogin      */
  10.  
  11. // defaults
  12. if (!defined('REVISION_DISPLAY_LIMIT_MIN')) define('REVISION_DISPLAY_LIMIT_MIN', "0"); // 0 means no limit, 1 is the minimum number of revisions
  13. if (!defined('REVISION_DISPLAY_LIMIT_MAX')) define('REVISION_DISPLAY_LIMIT_MAX', "20"); // keep this value within a reasonable limit to avoid an unnecessary long lists
  14. if (!defined('RECENTCHANGES_DISPLAY_LIMIT_MIN')) define('RECENTCHANGES_DISPLAY_LIMIT_MIN', "0"); // 0 means no limit, 1 is the minimum number of changes
  15. if (!defined('RECENTCHANGES_DISPLAY_LIMIT_MAX')) define('RECENTCHANGES_DISPLAY_LIMIT_MAX', "50"); // keep this value within a reasonable limit to avoid an unnecessary long list
  16. if (!defined('INPUT_ERROR_STYLE')) define('INPUT_ERROR_STYLE', 'class="highlight"');
  17.  
  18. // i18n strings
  19. if (!defined('USER_SETTINGS_HEADING')) define('USER_SETTINGS_HEADING', "User settings");
  20. if (!defined('USER_LOGGED_OUT')) define('USER_LOGGED_OUT', "You have successfully logged out.");
  21. if (!defined('USER_SETTINGS_STORED')) define('USER_SETTINGS_STORED', "User settings stored!");
  22. if (!defined('USER_EMAIL_LABEL')) define('USER_EMAIL_LABEL', "Your email address:");
  23. if (!defined('DOUBLECLICK_LABEL')) define('DOUBLECLICK_LABEL', "Doubleclick Editing:");
  24. if (!defined('SHOW_COMMENTS_LABEL')) define('SHOW_COMMENTS_LABEL', "Show comments by default:");
  25. if (!defined('RECENTCHANGES_DISPLAY_LIMIT_LABEL')) define('RECENTCHANGES_DISPLAY_LIMIT_LABEL', "RecentChanges display limit:");
  26. if (!defined('PAGEREVISION_LIST_LIMIT_LABEL')) define('PAGEREVISION_LIST_LIMIT_LABEL', "Page revisions list limit:");
  27. if (!defined('UPDATE_SETTINGS_INPUT')) define('UPDATE_SETTINGS_INPUT', "Update Settings");
  28. if (!defined('QUICK_LINKS_HEADING')) define('QUICK_LINKS_HEADING', "Quick links");
  29. if (!defined('QUICK_LINKS')) define('QUICK_LINKS', "See a list of pages you own (MyPages) and pages you've edited (MyChanges).");
  30.  
  31. if (!defined('ERROR_INVALID_REVISION_DISPLAY_LIMIT')) define('ERROR_INVALID_REVISION_DISPLAY_LIMIT', "The number of page revisions should not exceed %d.");
  32. if (!defined('ERROR_INVALID_RECENTCHANGES_DISPLAY_LIMIT')) define('ERROR_INVALID_RECENTCHANGES_DISPLAY_LIMIT', "The number of recently changed pages should not exceed %d.");
  33. if (!defined('WIKINAME_LABEL')) define('WIKINAME_LABEL', "Your <abbr title=\"A WikiName is formed by two or more capitalized words without space, e.g. JohnDoe\">WikiName</abbr>:");
  34. if (!defined('LOGIN_BUTTON_LABEL')) define('LOGIN_BUTTON_LABEL', "Login");
  35. if (!defined('LOGOUT_BUTTON_LABEL')) define('LOGOUT_BUTTON_LABEL', "Logout");
  36.  
  37. if (!defined('FUD_LOGIN_HEADING')) define('FUD_LOGIN_HEADING', "===Login===");
  38. if (!defined('FUD_REGISTER_HEADING')) define('FUD_REGISTER_HEADING', "===Register===");
  39. if (!defined('FUD_REGISTER_LABEL')) define('FUD_REGISTER_LABEL', "Any forum login may be used to login here. If you don't have one, then <a href=\"%s\"> get one for free</a>");
  40. if (!defined('FUD_REGISTERED_USER_LOGIN_LABEL')) define('FUD_REGISTERED_USER_LOGIN_LABEL', "You may use your Forum login data, to log in here.");
  41. if (!defined('FUD_LOGINNAME_LABEL')) define('FUD_LOGINNAME_LABEL', "Your Forum Login Name:");
  42. if (!defined('FUD_PASSWORD_LABEL')) define('FUD_PASSWORD_LABEL', "Password:");
  43. if (!defined('FUD_NEW_USER_REGISTER_LABEL')) define('FUD_NEW_USER_REGISTER_LABEL', "If you log in in for the first time, then you have to set your WikiName here. The WikiName will be used instead of your login name, to identify changes and contributions with you. It may be the best to just \"reformat\" your login name, to be in valid WikiName syntax.");
  44. if (!defined('FUD_ERROR_WRONG_LOGIN_PASSWORD')) define('FUD_ERROR_WRONG_LOGIN_PASSWORD', "You entered a wrong username or password");
  45. if (!defined('FUD_ERROR_UNCONFIRMED_ACCOUNT')) define('FUD_ERROR_UNCONFIRMED_ACCOUNT', "Your account has not been activated by an administrator, so far.");
  46. if (!defined('FUD_ERROR_UNCONFIRMED_MAIL')) define('FUD_ERROR_UNCONFIRMED_MAIL', "You have not confirmed your account via mail, so far.");
  47. if (!defined('FUD_ERROR_WIKINAME')) define('FUD_ERROR_WIKINAME', "Username must be formatted as a ##\"\"WikiName\"\"##, e.g. ##\"\"JohnDoe\"\"##.");
  48. if (!defined('FUD_ERROR_EMPTY_WIKINAME')) define('FUD_ERROR_EMPTY_WIKINAME', "This is your first Wiki login, so you have to choose a valid \"\"WikiName\"\".");
  49. if (!defined('FUD_ERROR_RESERVED_PAGENAME')) define('FUD_ERROR_RESERVED_PAGENAME', "Sorry, this \"\"WikiName\"\" is reserved for a page. Please choose a different name.");
  50. if (!defined('FUD_ERROR_RESERVED_WIKINAME')) define('FUD_ERROR_RESERVED_WIKINAME', "Sorry, this WikiName is already taken by someone else.");
  51.  
  52. //initialize variables
  53. $params = '';
  54. $url = '';
  55. $email = '';
  56. $wikkauser = '';
  57. $doubleclickedit = '';
  58. $show_comments = '';
  59. $revisioncount = '';
  60. $changescount = '';
  61. $username_highlight = '';
  62. $wikiname_highlight = '';
  63. $revisioncount_highlight = '';
  64. $changescount_highlight = '';
  65.  
  66.  
  67. //
  68. // "Installation" of FUDLogin. This will create the DB table, if not
  69. // already there
  70. //
  71.  
  72.   "CREATE TABLE ".$this->config["table_prefix"]."fudlogintranslate (".
  73.   "wikkauser varchar(75) NOT NULL default '',".
  74.   "fuduser varchar(50) NOT NULL default '',".
  75.   "PRIMARY KEY (fuduser),".
  76.   "UNIQUE (wikkauser)" .
  77.   ") TYPE=MyISAM;", $this->dblink
  78. );
  79. $err = mysql_errno();
  80. // Ignore error "Table already exists", but exit for all other errors!
  81. if ($err && $err != 1050)
  82.  
  83. //
  84. // Start of FUDForum connection code.
  85. //
  86.  
  87. // Returns the FUDForum configuration settings by parsing "GLOBALS.php". The
  88. // settings are returned as array, so we don't get into conflict with other
  89. // variables.
  90. function fudforum_get_cfg($wikkaref) {
  91.     if (!isset($wikkaref->config["fudlogin_forumpath"]))
  92.         die('Please set "fudlogin_forumpath" in your "wikka.config.php" file');
  93.     $cfg_path = $wikkaref->config["fudlogin_forumpath"];
  94.     $cfg_path .= "/include/GLOBALS.php";
  95.     if (!file_exists($cfg_path))
  96.         die('Path in "fudlogin_forumpath" seems to be invalid! The file "' . $cfg_path . '" doesn\'t exist!');
  97.     $code = file_get_contents($cfg_path);
  98.     $tokens = token_get_all($code);
  99.     $fudcfg = array();
  100.     $varname = false;
  101.     foreach ($tokens as $token) {
  102.         if (!is_array($token)) continue;
  103.         switch($token[0]) {
  104.         case(T_VARIABLE):
  105.             $varname = $token[1];
  106.             $varname = str_replace("$", "", $varname);
  107.             break;
  108.         case(T_CONSTANT_ENCAPSED_STRING):
  109.             // Drop the quotes on string values
  110.             $token[1] = substr($token[1], 1, strlen($token[1]) - 2);
  111.         case(T_LNUMBER):
  112.             if ($varname) {
  113.                 $fudcfg[$varname] = $token[1];
  114.                 $varname = false;
  115.             }
  116.             break;
  117.         }
  118.     }
  119.     return $fudcfg;
  120. }
  121.  
  122. // Returns a data object for valid login, returns "false" for invalid login.
  123. function fudforum_fetch_user($wikkaref, $login, $passwd) {
  124.     $fudcfg = fudforum_get_cfg($wikkaref);
  125.  
  126.     // Connect to the forum DB. PHP will reuse "$this->dblink", if forum and
  127.     // wiki are on the same DB!
  128.     $fud_dblink = mysql_connect($fudcfg["DBHOST"], $fudcfg["DBHOST_USER"], $fudcfg["DBHOST_PASSWORD"]);
  129.     if (!$fud_dblink ||
  130.         !mysql_select_db($fudcfg["DBHOST_DBNAME"], $fud_dblink))
  131.         die("Failed to open forum database!");
  132.  
  133.     // Query for user data. Use the password in the query, so a wrong password
  134.     // will return an empty query
  135.     $result = mysql_query(sprintf(
  136.       "SELECT id, email, users_opt FROM %s WHERE login = '%s' AND passwd = '%s'",
  137.       $fudcfg["DBHOST_TBL_PREFIX"] . "users",
  138.       mysql_real_escape_string($login),
  139.       md5($passwd)
  140.     ), $fud_dblink);
  141.     if (mysql_num_rows($result) != 1) return false;
  142.  
  143.     $data = mysql_fetch_object($result);
  144.  
  145.     // MySQL-Part is now finished, so it's time to clean up
  146.     // We *don't* close the connection on "$fud_dblink", as this is the same as
  147.     // "$this->dblink", if forum and wiki are on the same DB!
  148.     // The only thing, we do, is to re-select the right DB for "$this->dblink".
  149.     mysql_select_db($wikkaref->config['mysql_database'], $wikkaref->dblink);
  150.  
  151.     // Anonymous users may not log in!
  152.     if ($data->id < 2) return false;
  153.     unset($data->id);
  154.  
  155.     // Decode the parts of "users_opt", we need.
  156.     $flags = $data->users_opt;
  157.     $data->mailconfirmed = ($flags & 131072);
  158.     $data->banned = ($flags & 65536);
  159.     $data->acctconfirmed = !($flags & 2097152);
  160.     unset($data->users_opt);
  161.  
  162.     return $data;
  163. }
  164.  
  165. // Returns link to forum
  166. function fudforum_get_forumlink($wikkaref) {
  167.     $fudcfg = fudforum_get_cfg($wikkaref);
  168.     return $fudcfg["WWW_ROOT"] . "index.php";
  169. }
  170.  
  171. //
  172. // End of FUDForum connection code.
  173. //
  174.  
  175.  
  176. //create URL
  177. $url = $this->config['base_url'].$this->tag;
  178.  
  179. // append URL params depending on rewrite_mode
  180. $params = ($this->config['rewrite_mode'] == 1) ? '?' : '&';
  181.  
  182. // BEGIN *** Logout ***
  183. // is user trying to log out?
  184. if (isset($_POST['logout']) && $_POST['logout'] == LOGOUT_BUTTON_LABEL)
  185. {
  186.     $this->LogoutUser();
  187.     $params .= 'out=true';
  188.     $this->Redirect($url.$params);
  189. }
  190. // END *** Logout ***
  191.  
  192. // BEGIN *** Usersettings ***
  193. // user is still logged in
  194. else if ($user = $this->GetUser())
  195. {
  196.     // is user trying to update user settings?
  197.     if (isset($_POST['action']) && ($_POST['action'] == 'update'))
  198.     {
  199.         // get POST parameters
  200.         $doubleclickedit = $this->GetSafeVar('doubleclickedit', 'post');
  201.         $show_comments = $this->GetSafeVar('show_comments', 'post');
  202.         $revisioncount = (int) $this->GetSafeVar('revisioncount', 'post');
  203.         $changescount = (int) $this->GetSafeVar('changescount', 'post');
  204.  
  205.         // validate form input
  206.         switch (TRUE)
  207.         {
  208.             case (($revisioncount < REVISION_DISPLAY_LIMIT_MIN) || ($revisioncount > REVISION_DISPLAY_LIMIT_MAX)): //invalid revision display limit
  209.                 $error = sprintf(ERROR_INVALID_REVISION_DISPLAY_LIMIT, REVISION_DISPLAY_LIMIT_MAX);
  210.                 $revisioncount_highlight = INPUT_ERROR_STYLE;
  211.                 break;
  212.             case (($changescount < RECENTCHANGES_DISPLAY_LIMIT_MIN) || ($changescount > RECENTCHANGES_DISPLAY_LIMIT_MAX)): //invalid recentchanges display limit
  213.                 $error = sprintf(ERROR_INVALID_RECENTCHANGES_DISPLAY_LIMIT, RECENTCHANGES_DISPLAY_LIMIT_MAX);
  214.                 $changescount_highlight = INPUT_ERROR_STYLE;
  215.                 break;
  216.             default: // input is valid
  217.                 $this->Query('UPDATE '.$this->config['table_prefix'].'users SET '.
  218.                     "doubleclickedit = '".mysql_real_escape_string($doubleclickedit)."', ".
  219.                     "show_comments = '".mysql_real_escape_string($show_comments)."', ".
  220.                     "revisioncount = '".mysql_real_escape_string($revisioncount)."', ".
  221.                     "changescount = '".mysql_real_escape_string($changescount)."' ".
  222.                     "WHERE name = '".$user['name']."' LIMIT 1");
  223.                 $this->SetUser($this->LoadUser($user["name"]));
  224.            
  225.                 // forward
  226.                 $params .= 'stored=true';
  227.                 $this->Redirect($url.$params);
  228.         }
  229.     }
  230.     //user just logged in
  231.     else
  232.     {
  233.         // get stored settings
  234.         $email = $user['email'];
  235.         $doubleclickedit = $user['doubleclickedit'];
  236.         $show_comments = $user['show_comments'];
  237.         $revisioncount = $user['revisioncount'];
  238.         $changescount = $user['changescount'];
  239.     }
  240.  
  241.     // display user settings form
  242.     echo '<h3>'.USER_SETTINGS_HEADING.'</h3>';
  243.     echo $this->FormOpen();
  244. ?>
  245.     <input type="hidden" name="action" value="update" />
  246.     <table class="usersettings">
  247.         <tr>
  248.             <td>&nbsp;</td>
  249.             <td>Hello, <?php echo $this->Link($user['name']) ?>!</td>
  250.         </tr>
  251. <?php
  252.  
  253.     // create confirmation message if needed
  254.     switch(TRUE)
  255.     {
  256.         case (isset($_GET['stored']) && $_GET['stored'] == 'true'):
  257.             $success = USER_SETTINGS_STORED;
  258.             break;
  259.     }
  260.  
  261.     // display error or confirmation message
  262.     switch(TRUE)
  263.     {
  264.         case (isset($error)):
  265.             echo '<tr><td></td><td><em class="error">'.$this->Format($error).'</em></td></tr>'."\n";
  266.             break;
  267.         case (isset($success)):
  268.             echo '<tr><td></td><td><em class="success">'.$this->Format($success).'</em></td></tr>'."\n";       
  269.             break;
  270.         default:
  271.     }
  272. ?>
  273.         <tr>
  274.             <td align="right"><?php echo USER_EMAIL_LABEL ?></td>
  275.             <td><?php echo $this->htmlspecialchars_ent($email) ?></td>
  276.         </tr>
  277.         <tr>
  278.             <td align="right"><?php echo DOUBLECLICK_LABEL ?></td>
  279.             <td><input type="hidden" name="doubleclickedit" value="N" /><input type="checkbox" name="doubleclickedit" value="Y" <?php echo $doubleclickedit == 'Y' ? 'checked="checked"' : '' ?> /></td>
  280.         </tr>
  281.         <tr>
  282.             <td align="right"><?php echo SHOW_COMMENTS_LABEL ?></td>
  283.             <td><input type="hidden" name="show_comments" value="N" /><input type="checkbox" name="show_comments" value="Y" <?php echo $show_comments == 'Y' ? 'checked="checked"' : '' ?> /></td>
  284.         </tr>
  285.         <tr>
  286.             <td align="right"><?php echo PAGEREVISION_LIST_LIMIT_LABEL ?></td>
  287.             <td><input <?php echo $revisioncount_highlight; ?> name="revisioncount" value="<?php echo $this->htmlspecialchars_ent($revisioncount) ?>" size="40" /></td>
  288.         </tr>
  289.         <tr>
  290.             <td align="right"><?php echo RECENTCHANGES_DISPLAY_LIMIT_LABEL ?></td>
  291.             <td><input <?php echo $changescount_highlight; ?> name="changescount" value="<?php echo $this->htmlspecialchars_ent($changescount) ?>" size="40" /></td>
  292.         </tr>
  293.         <tr>
  294.             <td>&nbsp;</td>
  295.             <td><input type="submit" value="<?php echo UPDATE_SETTINGS_INPUT ?>" /><!-- <input type="button" value="<?php echo LOGOUT_BUTTON_LABEL; ?>" onclick="document.location='<?php echo $this->href('', '', 'action=logout'); ?>'" /></td>-->
  296.                 <input id="logout" name="logout" type="submit" value="<?php echo LOGOUT_BUTTON_LABEL; ?>" /><!--#353,#312-->
  297.             </td>
  298.         </tr>
  299.     </table>
  300. <?php  
  301.     echo $this->FormClose(); //close user settings form
  302.     echo '<hr />'."\n";
  303.     echo '<h5>'.QUICK_LINKS_HEADING.'</h5>'."\n";
  304.     echo $this->Format(QUICK_LINKS);
  305. }
  306. // user is not logged in
  307. else
  308. {
  309.     // print confirmation message on successful logout
  310.     if (isset($_GET['out']) && ($_GET['out'] == 'true'))
  311.     {
  312.         $success = USER_LOGGED_OUT;
  313.     }
  314.  
  315.     // is user trying to log in?
  316.         $email = false;
  317.         if (isset($_POST['name']) && isset($_POST['password'])) {
  318.             $data = fudforum_fetch_user($this, trim($_POST['name']), $_POST['password']);
  319.             if (!$data) {
  320.                 $error = FUD_ERROR_WRONG_LOGIN_PASSWORD;
  321.                 $username_highlight = INPUT_ERROR_STYLE;
  322.             }
  323.             else if (!$data->mailconfirmed)
  324.                 $error = FUD_ERROR_UNCONFIRMED_MAIL;
  325.             else if (!$data->acctconfirmed)
  326.                 $error = FUD_ERROR_UNCONFIRMED_ACCOUNT;
  327.             else
  328.                 $email = $data->email;
  329.         }
  330.  
  331.         // Valid Login (means, we fetched a valid email for the user from
  332.         // FUDForum login DB)
  333.         if ($email) {
  334.             $in_name = trim($_POST['name']);
  335.             $in_wikiname = trim($_POST["wikiname"]);
  336.  
  337.             // Try to fetch wiki name for user. If there is none in our DB and
  338.             // the user-supplied wikiname is valid, then store the wikiname to
  339.             // the DB and continue with it.
  340.             $wikkauser = false;
  341.             $result = $this->Query(sprintf(
  342.               "SELECT wikkauser FROM %s WHERE fuduser = '%s'",
  343.               $this->config["table_prefix"]."fudlogintranslate",
  344.               mysql_real_escape_string($in_name)
  345.             ));
  346.             if (mysql_num_rows($result) == 1) {
  347.                 $obj = mysql_fetch_object($result);
  348.                 $wikkauser = $obj->wikkauser;
  349.             }
  350.             else {
  351.                 switch(TRUE) {
  352.                 case (strlen($in_wikiname) == 0):
  353.                     $error = FUD_ERROR_EMPTY_WIKINAME;
  354.                     $wikiname_highlight = INPUT_ERROR_STYLE;
  355.                     break;
  356.                 case (!$this->IsWikiName($in_wikiname)):
  357.                     $error = FUD_ERROR_WIKINAME;
  358.                     $wikiname_highlight = INPUT_ERROR_STYLE;
  359.                     break;
  360.                 // Don't match for UserPages
  361.                 case ($this->ExistsPage($in_wikiname) && !$this->LoadUser($in_wikiname)):
  362.                     $error = FUD_ERROR_RESERVED_PAGENAME;
  363.                     $wikiname_highlight = INPUT_ERROR_STYLE;
  364.                     break;
  365.                 default: //valid input
  366.                     // Query for the newly chosen Wiki name
  367.                     $result = $this->Query(sprintf(
  368.                       "SELECT wikkauser FROM %s WHERE wikkauser = '%s'",
  369.                       $this->config["table_prefix"]."fudlogintranslate",
  370.                       mysql_real_escape_string($in_wikiname)
  371.                     ));
  372.                     // If the name is taken, then send error
  373.                     if (mysql_num_rows($result) == 1) {
  374.                         $error = FUD_ERROR_RESERVED_WIKINAME;
  375.                         $wikiname_highlight = INPUT_ERROR_STYLE;
  376.                     }
  377.                     // Name not taken -> link it to the login name
  378.                     else {
  379.                         $this->Query(sprintf(
  380.                           "INSERT INTO %s SET wikkauser = '%s', fuduser = '%s'",
  381.                           $this->config["table_prefix"]."fudlogintranslate",
  382.                           mysql_real_escape_string($in_wikiname),
  383.                           mysql_real_escape_string($in_name)
  384.                         ));
  385.                         $wikkauser = $in_wikiname;
  386.                     }
  387.                 }
  388.             }
  389.  
  390.             // If we have a valid Wikka user now, then create an account for
  391.             // the WikiName or update the existing one
  392.             if ($wikkauser) {
  393.                 $existingUser = $this->LoadUser($wikkauser);
  394.                 if (!$existingUser) {
  395.                     $this->Query(sprintf(
  396.                       "INSERT INTO %s SET
  397.                        signuptime = now(),
  398.                        name = '%s',
  399.                        email = '%s',
  400.                        password = '%s'",
  401.                       $this->config['table_prefix']."users",
  402.                       mysql_real_escape_string($wikkauser),
  403.                       mysql_real_escape_string($email),
  404.                       md5($_POST['password'])
  405.                     ));
  406.                 }
  407.                 else {
  408.                     $this->Query(sprintf(
  409.                       "UPDATE %s SET
  410.                        email = '%s',
  411.                        password = '%s'
  412.                        WHERE name = '%s'",
  413.                       $this->config['table_prefix']."users",
  414.                       mysql_real_escape_string($email),
  415.                       md5($_POST['password']),
  416.                       mysql_real_escape_string($wikkauser)
  417.                     ));
  418.                 }
  419.                 $this->SetUser($this->LoadUser($wikkauser));
  420.         $this->Redirect($url, '');
  421.             }
  422.         }
  423.  
  424.     // BEGIN ***  Login/Register ***
  425.     print($this->FormOpen());
  426. ?>
  427.     <input type="hidden" name="action" value="login" />
  428.     <table class="usersettings">
  429.     <tr>
  430.         <td colspan="2"><?php echo $this->Format(FUD_LOGIN_HEADING) ?></td>
  431.         <td>&nbsp;</td>
  432.     </tr>
  433.     <tr>
  434.         <td>&nbsp;</td>
  435.         <td><?php echo $this->Format(FUD_REGISTERED_USER_LOGIN_LABEL); ?></td>
  436.     </tr>
  437. <?php
  438.     switch (true)
  439.     {
  440.         case (isset($error)):
  441.             echo '<tr><td></td><td><em class="error">'. $this->Format($error) .'</em></td></tr>'."\n";
  442.             break;
  443.         case (isset($success)):
  444.             echo '<tr><td></td><td><em class="success">'. $this->Format($success) .'</em></td></tr>'."\n";
  445.             break;
  446.     }
  447. ?>
  448.     <tr>
  449.         <td align="right"><?php echo FUD_LOGINNAME_LABEL ?></td>
  450.         <td><input <?php echo $username_highlight; ?> name="name" size="40" value="<?php echo $this->GetSafeVar('name', 'post'); ?>" /></td>
  451.     </tr>
  452.     <tr>
  453.         <td align="right"><?php echo FUD_PASSWORD_LABEL ?></td>
  454.         <td><input <?php echo $username_highlight; ?> type="password" name="password" size="40" /></td>
  455.     </tr>
  456.     <tr>
  457.         <td>&nbsp;</td>
  458.         <td><input type="submit" value="<?php echo LOGIN_BUTTON_LABEL ?>" size="40" /></td>
  459.     </tr>
  460.     <tr>
  461.         <td>&nbsp;</td>
  462.         <td width="500"><?php echo FUD_NEW_USER_REGISTER_LABEL; ?></td>
  463.     </tr>
  464.     <tr>
  465.         <td align="right"><?php echo WIKINAME_LABEL ?></td>
  466.         <td><input  <?php echo $wikiname_highlight; ?> name="wikiname" size="40" /></td>
  467.     </tr>
  468.     <tr>
  469.         <td>&nbsp;</td>
  470.         <td><input type="submit" value="<?php echo LOGIN_BUTTON_LABEL ?>" size="40" /></td>
  471.     </tr>
  472.     <tr>
  473.         <td colspan="2"><?php echo $this->Format(FUD_REGISTER_HEADING) ?></td>
  474.         <td>&nbsp;</td>
  475.     </tr>
  476.     <tr>
  477.         <td>&nbsp;</td>
  478.         <td><?php printf(FUD_REGISTER_LABEL, fudforum_get_forumlink($this));?></td>
  479.     </tr>
  480.  
  481.     </table>
  482. <?php
  483.     print($this->FormClose());
  484.     // END *** Login/Register ***
  485. }
  486. ?>
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki