Source for file new_user.php
Documentation is available at new_user.php
* Access resctricted to administrators and members of group "Management"
* @author Gabriele Droege, DNA Bank Network <contact@dnabank-network.org>
* @copyright Copyright © 2011 DNA Bank Network http://www.dnabank-network.org<br>The contents of this file are subject to the Mozilla Public License Version 1.1
* @license http://www.mozilla.org/MPL/ MPL
* @see start.inc.php|RandPass
/********************************************************************************************
* login as administrator or manager is required *
* password will be generated automatically (line 35) *
* @see start.inc.php|RandPass *
*********************************************************************************************/
if (!isset
($_SESSION['admin']) & !$_SESSION['admin'] & !isset
($_SESSION['management']) & !$_SESSION['management']) {
$sql=
"SELECT ID_User FROM user";
echo
"<tr><td colspan='3'><span class='error'>Sorry, you have no permission for editing connection parameters! Please login as administrator or contact an admin.</span></td></tr>"; }
if($Test ==
"true" or (isset
($_SESSION['admin']) ||
$_SESSION['admin'] || isset
($_SESSION['management']) ||
$_SESSION['management'])) {
if($formSubmitSaveUser) {
$Signature =
$_POST['signature'];
$Username =
$_POST['username'];
$Password =
md5($randomstring);
$Email =
$_POST['email'];
$Group =
$_POST['group'];
$sqltest =
"SELECT * FROM user WHERE Signature = '$Signature' OR Login = '$Username'";
echo
"<tr><td colspan='3'><span class='error'>User name '".
$Username.
"' or real name '".
$Signature.
"' already exist in database!</span></td></tr>";
$sql =
"INSERT INTO user (Signature, Login, Password, Email, ID_Group, Created_Who) VALUES ('$Signature','$Username','$Password','$Email','$Group','$log')";
$msg =
"<font size='2' face='Arial'><table width='80%'><tr><td align='justify'>Dear ".
utf8_decode($Signature).
"<br/><br/>Welcome to the DNA Module! Please keep this email. It contains your current password. You can change your password at any time.<br/><br/><b>Login name: ".
utf8_decode($Username).
"<br>Password: ".
$randomstring.
"</b></td></tr>";
$msg .=
"<tr><td><hr></td></tr>";
$msg .=
"<tr><td>Sincerely,</td></tr>";
$msg .=
"<tr><td>Administrator DNA Module</td></tr>";
/********************************************************************************************
* sending email to new user with generated password *
*********************************************************************************************/
$from =
"From: contact@dnabank-network.org\n";
$from .=
"Content-Type: text/html\n";
echo
"<tr><td colspan='3'><span class='fine'>An email with current password has been sent to ".
$Email.
"</td></tr>";
<td colspan='3' valign='top'>
<table border='0' id='table2'>";
echo
"<tr><td colspan='4'><h3>Add new user:</h3> Password will be generated automatically and can be changed after first login.</td></tr>";
echo
"<tr><td id='DescriptionGreen'>Signature</td><td><input type='text' name='signature' id='InputLong' ";
if($Exist ==
"true") { echo
"value='".
$Signature.
"'"; }
echo
"/></td><td colspan='2'>Real Name/Signature.</td></tr>";
echo
"<tr><td id='DescriptionGreen'>User name</td><td><input type='text' name='username' id='InputLong' ";
if($Exist ==
"true") { echo
"value='".
$Username.
"'"; }
echo
"/></td><td colspan='2'>Login Name.</td></tr>";
echo
"<tr><td id='DescriptionGreen'>Email</td><td><input type='text' name='email' id='InputLong' ";
if($Exist ==
"true") { echo
"value='".
$Email.
"'"; }
echo
"/></td><td colspan='2'>Enter user's email address. The user will receive an email with his or her password.</td></tr>";
echo
"<tr><td id='DescriptionGreen'>Group</td><td> <select name='group' id='InputLong'><option value=''>-------</option>
if($Test ==
"true") { echo
" selected"; }
echo
">Administrator</option>
<option value='2'>DNA Bank Team</option>
<option value='3'>Project</option>
<option value='4'>Guest</option>
</select></td><td colspan='2'>Group for this user.</td></tr>";
echo
'<tr><td id="DescriptionBlack"></td><td><input type="submit" name="formSubmitSaveUser" value="Save new user" id="InputLong" onClick="return CheckGroup();"/></td><td colspan="2"></td></tr>';
echo
"</table></td></tr>";}
Documentation generated on Tue, 29 Nov 2011 10:44:58 +0100 by phpDocumentor 1.4.3