"Fossies" - the Fresh Open Source Software Archive

Member "proma-0.8.3/pages/register.inc.php" (25 Oct 2007, 2989 Bytes) of package /linux/privat/old/proma-0.8.3.tar.gz:


The requested HTML page contains a <FORM> tag that is unusable on "Fossies" in "automatic" (rendered) mode so that page is shown as HTML source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 <?php
    2 
    3 /* ProMA (ProFTPd MySQL Admin), Copyright (C) 2002-2007 Stein Magnus Jodal
    4  * ProMA comes with ABSOLUTELY NO WARRANTY.
    5  * This is free software, and you are welcome to redistribute it
    6  * under the terms of the GNU General Public License.
    7  * Read 'COPYING' for further information.
    8  */
    9 
   10 /* ProMA Register Account Page
   11  * $Id: register.inc.php,v 1.6 2007/10/25 19:13:35 jodal Exp $
   12  */
   13 
   14 ?>
   15 
   16 <h2>Register Account</h2>
   17 
   18 <?php
   19 
   20 if (!empty($_POST["submit"])) {
   21 // If the register form is submitted and should be processed
   22 
   23 $passwd1    = addslashes($_POST["passwd1"]);
   24 $passwd2    = addslashes($_POST["passwd2"]);
   25 $userid     = addslashes($_POST["userid"]);
   26 $name       = addslashes($_POST["name"]);
   27 $mail       = addslashes($_POST["mail"]);
   28 
   29 if ($userid == "" || $passwd1 == "") {
   30     print "<p>Username or password is empty. <a href=\"?page=register\">Try again</a></p>\n";
   31 } elseif ($passwd1 != $passwd2) {
   32     print "<p>The passwords are not identical. <a href=\"?page=register\">Try again</a></p>\n";
   33 } else {
   34     $query = "SELECT
   35             PASSWORD('$passwd1')";
   36     $result = mysql_query($query) or die("Database query failed.");
   37 
   38     $enc_passwd = mysql_fetch_array($result);
   39     // rot13 on the encrypted password disables access, and can be reversed to
   40     // open for access again. A bit dirty, but it works.
   41     $rot13_passwd = rot13($enc_passwd[0]);
   42 
   43     $query = "INSERT INTO
   44             $table_users
   45         SET
   46             $users_userid   = '$userid',
   47             $users_name = '$name',
   48             $users_mail = '$mail',
   49             $users_uid  = '$users_uid_default',
   50             $users_gid  = '$users_gid_default',
   51             $users_passwd   = '$rot13_passwd',
   52             $users_shell    = '$users_shell_default',
   53             $users_homedir  = '$users_homedir_default',
   54             $users_count    = 0,
   55             $users_admin    = 0,
   56             $users_closed   = 1";
   57     $result = mysql_query($query) or die("Database query failed.");
   58 
   59     if ($mail_notify_new_user) {
   60         mail(admin_mail(),
   61             "ProMA - $info_host - New user",
   62 "A new user has registered and is waiting for your authorization.
   63 
   64 Username: $userid
   65 Name: $name
   66 Mail: $mail
   67 
   68 -- 
   69 ProMA at $info_host",
   70             "From: $mail_from\n"
   71             ."X-Mailer: PHP/" . phpversion());
   72     }
   73 
   74     print "<p>You are registered. When an admin accepts your registration, you can connect using the information on the main page.</p>";
   75 }
   76 
   77 } else {
   78 // If the register form is not submitted, print it
   79 
   80 ?>
   81 
   82 <form action="?page=register" method="post">
   83 
   84 <table>
   85     <tr>
   86         <th class="thv">Username</th>
   87         <td><input type="text" name="userid" /> Your login</td>
   88     </tr>
   89     <tr>
   90         <th class="thv">Name</th>
   91         <td><input type="text" name="name" /> Your full real name</td>
   92     </tr>
   93     <tr>
   94         <th class="thv">Mail</th>
   95         <td><input type="text" name="mail" /> Your mail adress</td>
   96     </tr>
   97     <tr>
   98         <th class="thv">Password</th>
   99         <td><input type="password" name="passwd1" /></td>
  100     </tr>
  101     <tr>
  102         <th class="thv">Password</th>
  103         <td><input type="password" name="passwd2" /> And again</td>
  104     </tr>
  105 </table>
  106 
  107 <?php
  108 if (!empty($policy)) {
  109     print "<p>$policy</p>\n";
  110 }
  111 ?>
  112 
  113 <p><input type="submit" name="submit" value="Register" /></p>
  114 
  115 </form>
  116 
  117 <?php
  118 }
  119 ?>