gest366/modules/utenti/add_user.php

60 lines
2.9 KiB
PHP
Raw Permalink Normal View History

2021-02-24 20:40:04 +00:00
<?php
include_once(__DIR__."/../../core.php");
// decido la lunghezza minima della password, e la lunghezza minima del nome utente
$min_length = 8;
$min_length_username = 4;
$idgruppo = intval(filter('idgruppo'));
echo '
<form id="link_form" action="' . $rootdir . '/editor.php?id_module=' . $modules_info['Utenti e permessi']['id'] . '&id_record=' . $idgruppo . '" method="post">
<input type="hidden" name="op" value="adduser">
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="min_length" value="' . $min_length . '">
<input type="hidden" name="min_length_username" value="' . $min_length_username . '">
<div class="row">
<div class="col-xs-12">
{[ "type": "text", "label": "' . _("Username") . '", "name": "username", "required": 1, "class": "", "value": "", "extra": "" ]}
</div>
</div>
<div class="row">
<div class="col-xs-12">
{[ "type": "password", "label": "' . _("Password") . '", "name": "password1", "required": 1, "class": "", "value": "", "extra": "" ]}
</div>
</div>
<div class="row">
<div class="col-xs-12">
{[ "type": "password", "label": "' . _("Ripeti la password") . '", "name": "password2", "required": 1, "class": "", "value": "", "extra": "" ]}
</div>
</div>
<div class="row">
<div class="col-xs-12">
{[ "type": "select", "label": "' . _("Collega ad una anagrafica") . '", "name": "idanag", "required": 0, "class": "", "values": "query=SELECT CONCAT(`an_tipianagrafiche`.`idtipoanagrafica`, \'-\', `an_anagrafiche`.`idanagrafica`) AS \'id\', `ragione_sociale` AS \'descrizione\', `descrizione` AS \'optgroup\' FROM `an_tipianagrafiche` INNER JOIN `an_tipianagrafiche_anagrafiche` ON `an_tipianagrafiche`.`idtipoanagrafica`=`an_tipianagrafiche_anagrafiche`.`idtipoanagrafica` INNER JOIN `an_anagrafiche` ON `an_anagrafiche`.`idanagrafica`=`an_tipianagrafiche_anagrafiche`.`idanagrafica` where deleted= 0 ORDER BY `descrizione` ASC", "value": "", "extra": "" ]}
</div>
</div>
<button type="button" onclick="do_submit()" class="btn btn-primary"><i class="fa fa-plus"></i> '._("Aggiungi").'</button>
</form>
<script type="text/javascript">
var min_length = ' . $min_length . ';
var min_length_username = ' . $min_length_username . ';
function do_submit(){
if( $(\'#password1\').val()==\'\' || $(\'#password2\').val()==\'\' )
alert( "Inserire una password valida." );
else if( $(\'#password1\').val() != $(\'#password2\').val() )
alert( "Le password non coincidono." );
else if( $(\'#password1\').val().length < min_length )
alert( "La password deve essere lunga minimo "+min_length+" caratteri!" );
else if( $(\'#username\').val().length < min_length_username )
alert( "Username deve essere lungo minimo "+min_length_username+" caratteri!" );
else
$(\'#link_form\').submit();
}
</script>
<script src="' . $rootdir . '/lib/init.js"></script>';
?>