' . $lng_gifts['gift'] . ' ' . $lng_gifts['for'] . ' ' . $ank['name'] . ''; /* ----------------------------------------------------------------- Выводим верхнее меню ----------------------------------------------------------------- */ $gift = mysql_fetch_assoc(mysql_query("SELECT * FROM `gifts` WHERE `id` = '$id'")); $parent = mysql_fetch_assoc(mysql_query("SELECT * FROM `gifts` WHERE `id` = '$gift[cat]'")); if($id) { echo '
Folder ' . ($parent ? $parent['name'] : $lng_gifts['cats']) . '
'; } if($gift && !empty($gift['cost'])) { if(isset($_POST['submit'])) { // Принимаем и фильтруем данные $type = isset($_POST['type']) ? intval($_POST['type']) : 0; $text = !empty($_POST['text']) ? mysql_real_escape_string(substr($_POST['text'],0,56)) : null; if($_POST['type'] == 1) $cost = $gift['pcost']; else $cost = $gift['cost']; $newballs = ($datauser['balls'] - $cost); if($newballs > 0) { mysql_query("INSERT INTO `users_gifts` ( `id` , `name` , `user_id`, `text` , `time` , `image`, `from_id`, `type` ) VALUES ( NULL , '".$gift['name']."', '".$ank['id']."', '".$text."', '".time()."', '".$gift['image']."', '".$user_id."', '".$type."' ); ") or die(mysql_error()); $pid = mysql_insert_id(); $whom = $ank['id']; mysql_query("INSERT INTO `cms_mail` SET `user_id` = '$user_id', `from_id` = '" . $ank['id'] . "', `text` = '" . mysql_real_escape_string(($type != 0 ? $lng_gifts['new_gift_privat'] : $lng_gifts['new_gift']) . " [url=".$home."/gifts/?act=showall&user=$whom]$gift[name][/url] " . $lng_gifts['from'] . " " . $login) . "', `time` = '" . time() . "', `sys` = '1', `them` = '" . $lng_gifts['new_gift'] . "'"); mysql_query("update `users` set `balls` = '".$newballs."' where `id` = '".$user_id."'"); header("location: /users/profile.php?user=$ank[id]"); } else echo functions::display_error($lng_gifts['not_balls']); } else { $gift['pcost'] = $gift['pcost']; $gift['cost'] = $gift['cost']; echo '
' . (!empty($ank['name']) ? '
' . $lng_gifts['gift'] . ' ' . $lng_gifts['for'] . ' '.functions::check($ank['name']).'
' : '
' . $lng_gifts['whom'] . '
') . '
' . '
' . $lng_gifts['text_to_text'] . '
' . $lng_gifts['type'] . '
- ' . $lng_gifts['public'] . ', '. $gift['cost'].' ' . $lng_gifts['balls'] . '
- ' . $lng_gifts['privat'] . ', '.$gift['pcost'].' ' . $lng_gifts['balls'] . '
'; //Название директории с изображениями $dir='gifts'; //Задаем параметры ресайза, в нашем случае - ширина и высота $imageWidth='128'; $imageHeight='128'; $rgsdimg = $home .'/image.php?image=/images/'.$dir.'/'. $gift['image'] .'&width='. $imageWidth .'&height='. $imageHeight.'&cropratio=1:1'; $photo=''; echo $photo; echo '
'; echo '
'; } } else header("Location: index.php"); if($rights >= 7) { echo '
' . $lng_gifts['delgift'] . '
' . '
' . $lng_gifts['editgift'] . '
'; } ?>