<?php

//////////////////////////////////////////////////
////// проверка размеров файлов и запись /////////
//////////////////////////////////////////////////

defined('_IN_JOHNCMS') or die('Error: restricted access');

echo '
<br/><br/>
<div class="profile-img card-artists music-name">
<center><h3>Aýdymçy goşmak</h3><br/>
';

if($_POST['goshmak']){
$surat = $_FILES['foto'];
$ady = $_POST['name'];
$info = $_POST['info'];
$sftp = $_POST['ftpfoto'];
$salgy = $_POST['linkfile'];


if(empty($surat)){
echo 'Aýdymçy suratyny saýlamadyňyz!';
require_once '../incfiles/end.php';
exit;
}
if(empty($ady)){
echo 'Aýdymçynyň adyny girizmediňiz! Meselem: Söhbet Jumaýew';
require_once '../incfiles/end.php';
exit;
}
if(empty($info)){
echo 'Aýdymçy barada girizmediňiz! Meselem: biografiýasy';
require_once '../incfiles/end.php';
exit;
}
if(empty($sftp)){
echo 'Aýdymçynyň suratynyň sewerdäki ornuny girizmediňiz! Meselem: sohbet_jumayew_foto.jpg';
require_once '../incfiles/end.php';
exit;
}
if(empty($salgy)){
echo 'Aýdymçy salgysy girizmediňiz! Meselem: Sohbet-Jumayew';
require_once '../incfiles/end.php';
exit;
}

$ssakla = '../uploads/artist/img/';
if ((move_uploaded_file($_FILES["foto"]["tmp_name"], $ssakla.$sftp)) == true) {
@chmod($ssakla.$sftp, 0777);

mysql_query("INSERT INTO `singers` SET
        `url` = '".$salgy."',
        `name` = '" .$ady. "',
        `desc` = '" .$info. "',
        `foto` = '" .$sftp. "';");

echo 'Aýdymçy üstünlikli goşuldy!';
}else{
echo 'Aýdymçy suratyny ýükläp bolmady!';
}


}else{

$gyzyl = '<b><font color="red">*</font></b>';
echo '
<form action="admin.php?act=addsinger" name="fileadd" method="post" enctype="multipart/form-data">
'.$gyzyl.' Aýdymçy suratyny saýla:<br/><input type="file" name="foto"/><br/>
<br/>
'.$gyzyl.' Aýdymçy ady:<br/><input type="text" name="name"/><br/>
<br/>
'.$gyzyl.' Aýdymçy barada:<br/><textarea rows="' . $set_user['field_h'] . '" name="info"/></textarea><br/>
<br/>
'.$gyzyl.' Skrinşot FTP ady:<br/><input type="text" name="ftpfoto"/><br/>
<br/>
'.$gyzyl.' Faýlyň linki:<br/><input type="text" name="linkfile"/><br/>
<br/>
<input type="submit" name="goshmak" value="Goşmak"/> - <a href="'.$home.'/yukleme/admin.php">Dolandyryş paneli</a>
</form>
';
}


echo '
<br/>
</div>
';
?>