<?php if(!defined('ADMIN_INCLUDED')) { exit; } ?>
<?php
if(!m_authority(m_admin('authoritys'),'users'))
{
m_redirect(ADMIN_URL);
}
?>
<div class="card mt-2 mb-3">
<div class="card-header fw-bold">Yönetici Ekle</div>
<div class="card-body">
<?php
if($_POST)
{
$authoritys = '';
foreach ($_POST['authoritys'] as $key => $value)
{
$authoritys.='<'.$key.'>'.$value.'</'.$key.'>';
}
$data = [
'authoritys' => $authoritys,
'name' => m_u_p('name'),
'email' => m_u_p('email'),
'password' => m_password(m_u_p('password')),
'status' => 1
];
$query = $db->table('users')->insert($data);
if($query)
{
echo m_alert('Başarılı','İşleminiz başarıyla gerçekleştirildi.');
}
else
{
echo m_alert('Hata','İşlem gerçekleştirilirken bir hata oluştu.');
}
}
?>
<form action="" method="post" enctype="multipart/form-data">
<div class="mb-2">
<label class="form-label fw-bold">İsim</label>
<input type="text" class="form-control" name="name" required>
</div>
<div class="mb-2">
<label class="form-label fw-bold">Email</label>
<input type="text" class="form-control" name="email" required>
</div>
<div class="mb-2">
<label class="form-label fw-bold">Şifre</label>
<input type="password" class="form-control" name="password" required>
</div>
<?php
$authoritys = array();
$authoritys['settings'] = 'Genel Ayarlar';
$authoritys['reports'] = 'Raporlar';
$authoritys['products'] = 'Ürün Yönetimi';
$authoritys['users'] = 'Yöneticiler';
$authoritys['delete'] = 'Silme';
foreach($authoritys as $key => $value)
{
?>
<div class="mb-2">
<label class="form-label fw-bold">YETKİ - <?php echo $value; ?></label>
<div>
<div class="form-check form-check-inline">
<label class="form-check-label">
<input type="radio" class="form-check-input" name="authoritys[<?php echo $key; ?>]" value="1">
Aktif
</label>
</div>
<div class="form-check form-check-inline">
<label class="form-label fw-bold">
<input type="radio" class="form-check-input" name="authoritys[<?php echo $key; ?>]" value="0" checked>
Pasif
</label>
</div>
</div>
</div>
<?php
}
?>
<button class="btn btn-primary w-100" type="submit"><i class="fa fa-plus-circle"></i> Ekle</button>
</form>
</div>
</div> |