'.print_r($_POST,1).''; //$debug .= '
'.print_r($_FILES,1).''; $fio = htmlspecialchars(addslashes($_POST['fio'])); $tel = htmlspecialchars(addslashes($_POST['tel'])); $pred_obraz = $_POST['pred_obraz']; $obraz_uchr = htmlspecialchars(addslashes($_POST['obraz_uchr'])); $diplom_seriya = htmlspecialchars(addslashes($_POST['diplom_seriya'])); $diplom_nomer = htmlspecialchars(addslashes($_POST['diplom_nomer'])); if($_POST['diplom_data']!=''){ $t=explode('.',$_POST['diplom_data']); $diplom_data = mktime(0,0,0,$t[1],$t[0],$t[2]); }else $diplom_data = time(); $pret_naprav = $_POST['pret_naprav']; $pret_kurs = $_POST['pret_kurs']; $pret_fo = $_POST['pret_fo']; if(isset($_POST['status'])) $status = '-1'; else $status=0; $pret_format = htmlspecialchars(addslashes($_POST['pret_format'])); if($perevod==1) $tperevod=1; elseif ($perevod==2) $tperevod = 2; else $tperevod=0; } $id_studentzayavks=0; if(isset($_POST['iup_student_save'])||isset($_POST['perevod_student_save'])){ $sql = 'INSERT INTO `'.$TB['iup_studentzayavks'].'` VALUES (0,'.time().','.$_SESSION['user']['id'].',"'.$fio.'","'.$pred_obraz.'","'.$obraz_uchr.'","'.$diplom_seriya.'","'.$diplom_nomer.'",'.$diplom_data.',"'.$pret_naprav.'","'.$pret_kurs.'","'.$pret_fo.'",'.$status.',"'.$tel.'","'.$pret_format.'",'.$tperevod.')'; $rez = $DB->QUR($sql); //echo '
'.print_r($rez,1).''; if(!$rez['err']){ $id_studentzayavks = mysql_insert_id(); send_email_iup($id_studentzayavks); $msg['msg'][]='Ваша заявка создана!'; }else{ $msg['err'][]='Ваша заявка не создана! Ошибка БД!!!'; } } if(isset($_POST['iup_student_edit'])||isset($_POST['perevod_student_edit'])){ $id = (int)$_POST['id']; $sql = 'UPDATE `'.$TB['iup_studentzayavks'].'` SET data_c='.time().',fio="'.$fio.'",pred_obraz="'.$pred_obraz.'",obraz_uchr="'.$obraz_uchr.'",diplom_seriya="'.$diplom_seriya.'",diplom_nomer="'.$diplom_nomer.'",diplom_data='.$diplom_data.',pret_naprav="'.$pret_naprav.'",pret_kurs="'.$pret_kurs.'",pret_fo="'.$pret_fo.'",status='.$status.',tel="'.$tel.'",pret_format="'.$pret_format.'" WHERE id='.$id.' AND id_user='.$_SESSION['user']['id'].' LIMIT 1'; $rez = $DB->QUR($sql); if($rez){ $msg['msg'][]='Ваша заявка отредактирована!'; $id_studentzayavks = $id; if(isset($_POST['del_file'])){foreach($_POST['del_file'] as $fid => $val){ $sql = 'SELECT * FROM '.$TB['iup_studentzayavks_files'].' WHERE id_user='.$_SESSION['user']['id'].' AND id='.$fid.''; $rez = $DB->QUR_SEL($sql); if($rez){ $val = $rez[1]; unlink($val['file']); $rez = $DB->QUR_SEL('DELETE FROM '.$TB['iup_studentzayavks_files'].' WHERE id_user='.$_SESSION['user']['id'].' AND id='.$fid.''); $msg['err'][]='Файл удален!'; }else{ $msg['err'][]='Файл не найден в базе данных.'; } }} } } if($id_studentzayavks){ //обходим загруженные файлы foreach($prilogens as $key => $val){ if(isset($_FILES[$val['name']])){ foreach($_FILES[$val['name']]['tmp_name'] as $k => $v){ if($v!=''){//загружаем файл $dir_dest = 'upload/iup/'.$_SESSION['user']['id'].'/'; if(!file_exists($dir_dest)) mkdir($dir_dest); $fil = $_FILES[$val['name']]['name'][$k]; $t = explode('.',$fil); $ext = $t[count($t)-1]; unset($t[count($t)-1]); $fn = implode('.',$t); $uploadfile = $dir_dest . basename(translit($fn).'.'.$ext); //$debug .= $v.' - '.$uploadfile.'
'.print_r($rez,1).''; if($rez){ foreach($rez as $key => $val)if($key){ $val['data_c'] = date('H:i:s d.m.Y',$val['data_c']); $zayavks[] = $val; } } $smarty->assign('zayavks',$zayavks); } $smarty->assign('page',$page); $smarty->assign('perevod',$perevod); $smarty->assign('des',$des); $smarty->assign('debug',$debug); $smarty->assign('prilogens',$prilogens); $smarty->assign('zd_students',$zd_students); $smarty->assign('msg',$msg); $maincontent = $smarty->fetch('tpl_iup_main.html');