Files
2026-09-03 11:24:19 +02:00

104 lines
4.8 KiB
PHP

<?php
if (!empty($_SESSION['site801']))
{
?>
<?php
//reset hasła
if (!empty($_GET['usr']) && $_GET['rp']=='yes')
{
$newPass=substr(md5(date('Ymd').$_GET['usr'].date('His').$_SESSION['user'].$_SESSION['sys_typ']),10,6)."#".rand(10, 99);
mysql_query("UPDATE sys_users SET USR_PASSWORD='".md5($newPass)."' WHERE USR_ID=".$_GET['usr']);
echo"<div class='actionOK'>$lab_Field_site801_012</div>";
// dorobić wysyłanie hasła na maila
sendEmailNotification(sqlStringValue("select USR_MAIL from sys_users where USR_ID=".$_GET['usr'],"USR_MAIL"), "Reset hasla - ".sqlStringValue("select USR_USERNAME from sys_users where USR_ID=".$_GET['usr'],"USR_USERNAME"), "System wygenerowal nowe haslo dla <b>".sqlStringValue("select USR_USERNAME from sys_users where USR_ID=".$_GET['usr'],"USR_USERNAME")."</b> na <a href='http://10.0.0.98'>http://10.0.0.98</a><br/><br/>Nowe haslo: <b>$newPass</b>");
}
//dodawanie nowego użytkownika
if (!empty($_POST['inUserLogin']) && !empty($_POST['inUserMail']) && $_POST['subUserSave']==$lab_ButtonName_Save && sqlValue("select count(1) from sys_users where USR_USERNAME='".$_POST['inUserLogin']."'")==0)
{
$newPass=substr(md5(date('Ymd').$_POST['inUserLogin'].date('His')),10,8)."!".rand(10, 99);
mysql_query("INSERT INTO sys_users SET USR_USERNAME='".$_POST['inUserLogin']."',USR_PASSWORD='".md5($newPass)."',USR_FIRST_NAME='".$_POST['inUserFName']."',USR_LAST_NAME='".$_POST['inUserLName']."',USR_MAIL='".$_POST['inUserMail']."',USR_PHONE='".$_POST['inUserPhone']."',USR_STATUS='".$_POST['inUserStatus']."',USR_PRT_ID=1,USR_AUDIT_CU='".$_SESSION['user']."',USR_AUDIT_CD=now()");
$maxUserID=sqlValue("select max(USR_ID) from sys_users");
$wynik = mysql_query("select PRO_ID from sys_profiles");
if($wynik)while ($r = mysql_fetch_array($wynik))
{
$proID = $r["PRO_ID"];
if ($_POST['inUserProfile'][$proID]) mysql_query("INSERT INTO sys_user_profiles SET SUP_USR_ID=$maxUserID,SUP_PRO_ID=$proID");
}
echo"<div class='actionOK'>$lab_Field_site801_015 </br>Login: <b>".$_POST['inUserLogin']."</b></br>Hasło: <b>".$newPass."</b></div>";
// dorobić wysyłanie hasła na maila
//sendEmailNotification($_POST['inUserMail'], "Nowy uzytkownik - ".$_POST['inUserLogin'], "W systemie zostal stworzony nowy uzytkownik:<br/><br/> Login: <b>".$_POST['inUserLogin']."</b><br/>Haslo: <b>$newPass</b></br></br>Kliknij aby sie zalogowac: <a href='http://77.253.232.217/'>strona logowania</a>");
}
?>
<div class="tag100">
<div class="head_tag"><?php echo $lab_Tag_site801_001 ;?></div>
<div class="tag">
<table WIDTH="100%" class="tag">
<tr>
<td class="label"><?php echo $lab_Field_site801_001 ;?></td>
<td class="label"><?php echo $lab_Field_site801_002 ;?></td>
<td class="label"><?php echo $lab_Field_site801_003 ;?></td>
<td class="label"><?php echo $lab_Field_site801_004 ;?></td>
<td class="label"><?php echo $lab_Field_site801_005 ;?></td>
<td class="label"><?php echo $lab_Field_site801_006 ;?></td>
</tr>
<?php
$wynik = mysql_query("select USR_ID,USR_USERNAME,USR_FIRST_NAME,USR_LAST_NAME,USR_MAIL,USR_PHONE,USR_STATUS from sys_users order by USR_LAST_NAME,USR_FIRST_NAME");
if($wynik)while ($r = mysql_fetch_array($wynik))
{
$sql_1 = $r["USR_ID"];
$sql_2 = $r["USR_USERNAME"];
$sql_3 = $r["USR_FIRST_NAME"];
$sql_4 = $r["USR_LAST_NAME"];
$sql_5 = $r["USR_MAIL"];
$sql_6 = $r["USR_PHONE"];
$sql_7 = $r["USR_STATUS"];
if ($sql_7=='0') $sql_7=$lab_Field_site801_008;
else if ($sql_7=='1') $sql_7=$lab_Field_site801_007;
else if ($sql_7=='2') $sql_7=$lab_Field_site801_009;
echo"
<tr style='cursor: pointer;' onclick=".chr(34)."document.location.href='?pg=site801inf&usr=$sql_1'".chr(34).">
<td class='field_center'>$sql_2</td>
<td class='field_center'>$sql_3</td>
<td class='field_center'>$sql_4</td>
<td class='field_center'>$sql_5</td>
<td class='field_center'>$sql_6</td>
<td class='field_center'>$sql_7</td>
</tr>
";
}
?>
</table>
</div>
<?php
if (!empty($_SESSION['site801_edit']) && $_SESSION['user']=='admin')
echo"
<div class=tag_buttons>
<a href='?pg=site801A'> <INPUT class='btn btn-success btn-sm' TYPE='BUTTON' VALUE='$lab_ButtonName_Add'></A>
<a href='?pg=site801syn'> <INPUT class='btn btn-info btn-sm' TYPE='BUTTON' VALUE='$lab_ButtonName_Sync'></A>
</div>
";
?>
</div>
<?php
}
else showFooterWarningAccessNotification($lab_FooterWarningAccessNotification_001);
?>