[ Index ]

PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09)

title

Body

[close]

/include/inc_tmpl/ -> admin.newuser.tmpl.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2009 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
   6   
   7     This script is part of PHPWCMS. The PHPWCMS web content management system is
   8     free software; you can redistribute it and/or modify it under the terms of
   9     the GNU General Public License as published by the Free Software Foundation;
  10     either version 2 of the License, or (at your option) any later version.
  11    
  12     The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
  13     A copy is found in the textfile GPL.txt and important notices to the license 
  14     from the author is found in LICENSE.txt distributed with these scripts.
  15    
  16     This script is distributed in the hope that it will be useful, but WITHOUT ANY 
  17     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  18     PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  19   
  20     This copyright notice MUST APPEAR in all copies of the script!
  21  *************************************************************************************/
  22  
  23  // ----------------------------------------------------------------
  24  // obligate check for phpwcms constants
  25  if (!defined('PHPWCMS_ROOT')) {
  26     die("You Cannot Access This Script Directly, Have a Nice Day.");
  27  }
  28  // ----------------------------------------------------------------
  29  
  30  
  31  $new_login             = genlogname();
  32  $new_password         = generic_string(8);
  33  $new_email            = '';
  34  $new_name            = '';
  35  $set_user_aktiv     = 0;
  36  $set_user_admin     = 0;
  37  $set_user_fe        = 0;
  38  $send_verification    = 1;
  39  $user_err            = '';
  40                  
  41  if(isset($_POST["form_aktion"]) && $_POST["form_aktion"] == "create_account") {
  42      //Create Account Daten verarbeiten
  43      $new_login             = slweg($_POST["form_newloginname"]);
  44      $new_password         = slweg($_POST["form_newpassword"]);
  45      $new_email             = clean_slweg($_POST["form_newemail"]);
  46      $new_name             = clean_slweg($_POST["form_newrealname"]);
  47      $set_user_aktiv     = isset($_POST["form_active"]) ? 1 : 0;
  48      $set_user_admin     = isset($_POST["form_admin"]) ? 1 : 0;
  49      $set_user_fe         = isset($_POST["form_feuser"]) ? intval($_POST["form_feuser"]) : 0;
  50      if($set_user_admin) {
  51          $set_user_fe     = 2;
  52      }
  53      $send_verification     = isset($_POST["verification_email"]) ? 1 : 0;
  54      if(isEmpty($new_login)) {
  55          $user_err = $BL['be_admin_usr_err2']."\n";
  56      } else {
  57          $sql = "SELECT COUNT(*) AS anzahl FROM ".DB_PREPEND."phpwcms_user WHERE usr_login='".aporeplace($new_login)."'";
  58          if($result = mysql_query($sql, $db)) {
  59              if($check_anzahl = mysql_fetch_array($result)) {
  60                  if($check_anzahl["anzahl"]) $user_err .= $BL['be_admin_usr_err1']."\n";
  61              }
  62              mysql_free_result($result);
  63          }
  64      }
  65      if(isEmpty($new_password)) $user_err .= $BL['be_admin_usr_err3']."\n";
  66      if(MailVal($new_email, 2) && $send_verification) $user_err .= $BL['be_admin_usr_err4']."\n";
  67      if(empty($user_err)) { //Insert new User
  68          $sql =    "INSERT INTO ".DB_PREPEND."phpwcms_user (usr_login, usr_pass, usr_email, ".
  69                  "usr_admin, usr_aktiv, usr_name, usr_wysiwyg, usr_fe ) VALUES ('".
  70                  aporeplace($new_login)."', '".
  71                  aporeplace(md5($new_password))."', '".
  72                  aporeplace($new_email)."', '".
  73                  $set_user_admin."', '".
  74                  $set_user_aktiv."', '".
  75                  aporeplace($new_name)."', '".
  76                  $GLOBALS['phpwcms']['wysiwyg_editor']."', '".
  77                  $set_user_fe."')";
  78          if(mysql_query($sql, $db) or die('error while creating new user')) {
  79              $new_user_id = mysql_insert_id($db);
  80              $user_ok = 1;
  81              if($send_verification) {
  82                  $emailbody = str_replace('{LOGIN}',    $new_login,       $BL['be_admin_usr_mailbody']);
  83                  $emailbody = str_replace('{PASSWORD}', $new_password,    $emailbody);
  84                  $emailbody = str_replace('{SITE}',     PHPWCMS_URL, $emailbody);
  85                  $emailbody = str_replace('{LOGIN_PAGE}',     PHPWCMS_URL.get_login_file(), $emailbody);
  86  
  87                  sendEmail(    array(
  88                      'recipient'    => $new_email,
  89                      'toName'    => $new_name,
  90                      'subject'    => $BL['be_admin_usr_mailsubject'],
  91                      'isHTML'    => 0,
  92                      'text'        => $emailbody,
  93                      'from'        => $phpwcms["admin_email"],
  94                      'sender'    => $phpwcms["admin_email"]
  95                          ));
  96                  //@mail($new_email,$BL['be_admin_usr_mailsubject'],$emailbody, "From: ".$phpwcms["admin_email"]."\nReply-To: ".$phpwcms["admin_email"]."\n");
  97              }
  98          }                    
  99      }                
 100  }
 101                  
 102  if(empty($user_ok)) {
 103          
 104  ?><form action="phpwcms.php?do=admin&amp;s=1" method="post" name="edituser"><table border="0" cellpadding="0" cellspacing="0" summary="">
 105            <tr> 
 106              <td colspan="2"><table border="0" cellpadding="0" cellspacing="0" summary="">
 107                  <tr>
 108                    <td><img src="img/usricon/usr_add.gif" alt="" width="19" height="16"></td>
 109                    <td class="title">&nbsp;<?php echo $BL['be_admin_usr_title'] ?></td>
 110                  </tr>
 111                </table></td>
 112            </tr>
 113            <tr> 
 114              <td><img src="img/leer.gif" alt="" width="105" height="1"></td>
 115              <td><img src="img/leer.gif" alt="" width="1" height="5"></td>
 116            </tr>
 117            <?php
 118            if(!empty($user_err)) {
 119            ?>
 120            <tr valign="top">
 121              <td align="right"><strong style="color:#FF3300"><?php echo $BL['be_admin_usr_err'] ?>:</strong>&nbsp;</td>
 122              <td><strong style="color:#FF3300"><?php echo nl2br(chop($user_err)) ?></strong></td>
 123            </tr>
 124            <tr valign="top"><td colspan="2" align="right" class="chatlist"><img src="img/leer.gif" alt="" width="1" height="7"></td></tr>
 125            <?php
 126            } //Ende Fehler New User
 127            ?>
 128            <tr> 
 129              <td align="right" class="chatlist"><?php echo $BL["login_username"]  ?>:&nbsp;</td>
 130              <td><input name="form_newloginname" type="text" id="form_newloginname" style="font-family: Verdana, Arial, Helvetica, sans-serif; width:250px; font-size: 11px; font-weight: bold;" value="<?php echo $new_login ?>" size="30" maxlength="30"></td>
 131            </tr>
 132            <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="1"></td></tr>
 133            <tr> 
 134              <td align="right" class="chatlist"><?php echo $BL["login_userpass"] ?>:&nbsp;</td>
 135              <td><input name="form_newpassword" type="text" id="form_newpassword" style="font-family: Verdana, Arial, Helvetica, sans-serif; width:250px; font-size: 11px; font-weight: bold;" value="<?php echo $new_password ?>" size="30" maxlength="20"></td>
 136            </tr>
 137            <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="1"></td></tr>
 138            <tr> 
 139              <td align="right" class="chatlist"><?php echo $BL['be_profile_label_email'] ?>:&nbsp;</td>
 140              <td><input name="form_newemail" type="text" id="form_newemail" style="font-family: Verdana, Arial, Helvetica, sans-serif; width:250px; font-size: 11px; font-weight: bold;" value="<?php echo $new_email ?>" size="30" maxlength="150"></td>
 141            </tr>
 142            <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="1"></td></tr>
 143            <tr> 
 144              <td align="right" class="chatlist"><?php echo $BL['be_admin_usr_realname'] ?>:&nbsp;</td>
 145              <td><input name="form_newrealname" type="text" id="form_newrealname" style="font-family: Verdana, Arial, Helvetica, sans-serif; width:250px; font-size: 11px; font-weight: bold;" value="<?php echo $new_name ?>" size="30" maxlength="80"></td>
 146            </tr>
 147            
 148            <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="6"></td></tr>
 149            <tr> 
 150              <td align="right" class="chatlist"><?php echo $BL['be_admin_usr_issection']  ?>:&nbsp;</td>
 151              <td><table border="0" cellpadding="0" cellspacing="0" bgcolor="#E7E8EB" summary="">
 152                  <tr> 
 153                    <td><input name="form_feuser" type="radio" id="form_feuser0" value="0"<?php is_checked($set_user_fe, 0); ?>></td>
 154                    <td><label for="form_feuser0"><?php echo $BL['be_admin_usr_ifsection0'] ?></label>&nbsp;&nbsp;</td>
 155                    <td><input name="form_feuser" type="radio" id="form_feuser1" value="1"<?php is_checked($set_user_fe, 1); ?>></td>
 156                    <td><label for="form_feuser1"><?php echo $BL['be_admin_usr_ifsection1'] ?></label>&nbsp;&nbsp;</td>
 157                    <td><input name="form_feuser" type="radio" id="form_feuser2" value="2"<?php is_checked($set_user_fe, 2); ?>></td>
 158                    <td><label for="form_feuser2"><?php echo $BL['be_admin_usr_ifsection2'] ?></label></td>
 159                    <td><img src="img/leer.gif" alt="" width="4" height="21"></td>
 160                  </tr>
 161                </table></td>
 162            </tr>    
 163            
 164            <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="6"></td></tr>
 165            <tr> 
 166              <td align="right" class="chatlist"><?php echo $BL['be_admin_usr_setactive'] ?>:&nbsp;</td>
 167              <td><table border="0" cellpadding="0" cellspacing="0" summary="">
 168                  <tr> 
 169                    <td><input name="form_active" type="checkbox" id="form_active" value="1"<?php is_checked($set_user_aktiv, 1); ?>></td>
 170                    <td><label for="form_active"><?php echo  $BL['be_admin_usr_iflogin'] ?></label></td>
 171                  </tr>
 172                </table></td>
 173            </tr>
 174            
 175            <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="1"></td></tr>
 176            <tr> 
 177              <td align="right" class="chatlist" style="color:#FF0000"><?php echo $BL['be_admin_usr_isadmin']  ?>:&nbsp;</td>
 178              <td><table border="0" cellpadding="0" cellspacing="0" summary="">
 179                  <tr> 
 180                    <td><input name="form_admin" type="checkbox" id="form_admin" value="1"<?php is_checked($set_user_admin, 1); ?>></td>
 181                    <td><label for="form_admin"><?php echo  $BL['be_admin_usr_ifadmin'] ?> <strong style="color:#FF0000">!!!</strong></label></td>
 182                  </tr>
 183                </table></td>
 184            </tr>
 185            
 186            
 187            
 188            
 189            <tr> 
 190              <td align="right" class="chatlist"><?php echo $BL['be_admin_usr_verify'] ?>:&nbsp;</td>
 191              <td><table border="0" cellpadding="0" cellspacing="0" summary="">
 192                  <tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="6"></td></tr>
 193                  <tr bgcolor="#E7E8EB"> 
 194                    <td><input name="verification_email" type="checkbox" id="verification_email" value="1"<?php is_checked($send_verification, 1); ?>></td>
 195                    <td><label for="verification_email"><?php echo $BL['be_admin_usr_sendemail'] ?></label></td>
 196                    <td><img src="img/leer.gif" alt="" width="4" height="21"></td>
 197                  </tr>
 198                  <tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="6"></td></tr>
 199                </table></td>
 200            </tr>
 201            <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="6"><input name="form_aktion" type="hidden" value="create_account"></td></tr>
 202            <tr> 
 203              <td>&nbsp;</td>
 204              <td><input name="Submit" type="submit" class="button10" value="<?php echo $BL['be_admin_usr_button'] ?>"></td>
 205            </tr>
 206            <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="15"></td></tr>
 207        </table></form><img src="img/lines/l538_70.gif" alt="" width="538" height="1"><br /><img src="img/leer.gif" alt="" width="1" height="5"><?php
 208  } else {
 209      echo "<script language=\"JavaScript\" type=\"text/JavaScript\">\n<!--\n";
 210      echo "timer=setTimeout(\"self.location.href='phpwcms.php?do=admin'\", 0);\n";
 211      echo "//-->\n</script>\n";
 212  }
 213  ?>


Generated: Wed Dec 30 05:55:15 2009 Cross-referenced by PHPXref 0.7