Файл: dating/new.photo.php
Строк: 160
<?php
###################################################
# Знакомства под dcms 6.6.4 и 6.7.7 #
# Автор: Nort, он же Lns #
# icq: 484014288, сайт: http://inwap.org #
# #
# Вы не имеете права продавать, распростронять, #
# давать друзьям даный скрипт. #
# #
# Даная версия являет платной, и купить #
# можно только у автора. #
###################################################
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
$set['title']= 'Знакомства';
include_once '../sys/inc/thead.php';
include_once 'function.php';
title();
aut();
only_reg();
# ===================================================================
function files_get($in)
{
$trans1 = array("Ё","Ж","Ч","Ш","Щ","Э","Ю","Я","ё","ж","ч","ш","щ","э","ю","я","А","Б","В","Г","Д","Е","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","Ь","Ы","а","б","в","г","д","е","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ь","ы"," ");
$trans2 = array("JO","ZH","CH","SH","SCH","JE","JY","JA","jo","zh","ch","sh","sch","je","jy","ja","A","B","V","G","D","E","Z","I","J","K","L","M","N","O","P","R","S","T","U","F","H","C","'","Y","a","b","v","g","d","e","z","i","j","k","l","m","n","o","p","r","s","t","u","f","h","c","'","y","+");
return str_replace($trans1,$trans2,$in);
}
echo $div_name;
echo $Inform.' <a href="/dating?">Знакомства</a> '.$Raquo.' <a href="my.album.php?">Мои фотоальбомы</a> '.$Raquo.' <a href="new.photo.php">Добавить фотографию</a><br/>';
echo '</div>';
if ($user['id']<1) { echo $div_link.'Извените, но для Вас этот раздел не доступен. Пожалуйста, зарегистрируйтесь или зайдите под своим ником.</div>'; include_once '../sys/inc/tfoot.php'; exit; }
if ($user['dating_city_id'] == 0) { echo $div_link.'Извените, но чтобы пользоваться сервисом знакомств - Вам необходимо установить город.</div>'; include_once '../sys/inc/tfoot.php'; exit; }
if ($user['DatingAnketa'] == 0) { echo $div_link.'Извените, но чтобы пользоваться сервисом знакомств - Вам необходимо создать анкету.</div>'; include_once '../sys/inc/tfoot.php'; exit; }
$N = mysql_num_rows(mysql_query("select * from `dating_album` WHERE `user_id` = '".$user['id']."'"));
$photo = mysql_fetch_array(mysql_query("select * from `dating_photo` WHERE `user_id` = '".$user['id']."' order by time desc"));
$t = time() - $DatingTimes;
$L = mysql_query("select * from `dating_album` WHERE `user_id` = '".$user['id']."'");
if ($N == 0) { echo $div_link.'Извените, но чтобы была возможность добавлять фотографии - необходимо создать хотя бы один фотоальбом.</div>'; include_once '../sys/inc/tfoot.php'; exit; }
if ($photo['time'] > $t) { echo $div_link.'Извените, но не стоит добавлять фотографии так часто. Пожалуйста подождите '.$DatingTimes.' секунд.</div>'; include_once '../sys/inc/tfoot.php'; exit; }
if (strlen($_POST['name'])>0 && !empty($_FILES['foto']['name']))
{
$type = end(explode('.', $_FILES['foto']['name']));
if ($type!='gif' && $type!='png' && $type!='jpg' && $type!='jpeg') echo $div_link.'Извените, но выбраный Вами файл - не фотография.</div>';
else
{
$name = my_esc($_POST['name']);
mysql_query("INSERT INTO `dating_photo` (`user_id`, `name`, `photo`, `time`, `album_id`, `18`, `opis`) VALUES ('".$user['id']."', '".$name."', '".my_esc(files_get($_FILES['foto']['name']))."', '".time()."', '".abs(intval($_POST['album_id']))."', '".abs(intval($_POST['18']))."', '".my_esc($_POST['opis'])."');");
$id = mysql_insert_id();
####################################################
$file = $id.'_'.files_get($_FILES['foto']['name']);
####################################################
move_uploaded_file($_FILES['foto']['tmp_name'], 'photo/original/'.$file);
copy('photo/original/'.$file, 'photo/wiev_small/'.$file);
copy('photo/original/'.$file, 'photo/128x160/'.$file);
copy('photo/original/'.$file, 'photo/176x220/'.$file);
copy('photo/original/'.$file, 'photo/240x320/'.$file);
####################################################
$imgc = @imagecreatefromstring(file_get_contents('photo/wiev_small/'.$file));
$img_x = imagesx($imgc);
$img_y = imagesy($imgc);
if ($img_x==$img_y) { $dstW = 50; $dstH = 50; }
elseif ($img_x>$img_y) { $prop = $img_x/$img_y; $dstW = 50; $dstH = ceil($dstW/$prop); }
else { $prop = $img_y/$img_x; $dstH = 50; $dstW = ceil($dstH/$prop); }
$screen = imagecreatetruecolor($dstW, $dstH);
imagecopyresampled($screen, $imgc, 0, 0, 0, 0, $dstW, $dstH, $img_x, $img_y);
imagedestroy($imgc);
imagegif($screen,'photo/wiev_small/'.$file);
imagedestroy($screen);
####################################################
$imgc = @imagecreatefromstring(file_get_contents('photo/128x160/'.$file));
$img_x = imagesx($imgc);
$img_y = imagesy($imgc);
if ($img_x==$img_y) { $dstW = 128; $dstH = 160; }
elseif ($img_x>$img_y) { $prop = $img_x/$img_y; $dstW = 128; $dstH = ceil($dstW/$prop); }
else { $prop = $img_y/$img_x; $dstH = 160; $dstW = ceil($dstH/$prop); }
$screen = imagecreatetruecolor($dstW, $dstH);
imagecopyresampled($screen, $imgc, 0, 0, 0, 0, $dstW, $dstH, $img_x, $img_y);
imagedestroy($imgc);
imagegif($screen,'photo/128x160/'.$file);
imagedestroy($screen);
####################################################
$imgc = @imagecreatefromstring(file_get_contents('photo/176x220/'.$file));
$img_x = imagesx($imgc);
$img_y = imagesy($imgc);
if ($img_x==$img_y) { $dstW = 176; $dstH = 220; }
elseif ($img_x>$img_y) { $prop = $img_x/$img_y; $dstW = 176; $dstH = ceil($dstW/$prop); }
else { $prop = $img_y/$img_x; $dstH = 220; $dstW = ceil($dstH/$prop); }
$screen = imagecreatetruecolor($dstW, $dstH);
imagecopyresampled($screen, $imgc, 0, 0, 0, 0, $dstW, $dstH, $img_x, $img_y);
imagedestroy($imgc);
imagegif($screen,'photo/176x220/'.$file);
imagedestroy($screen);
####################################################
$imgc = @imagecreatefromstring(file_get_contents('photo/240x320/'.$file));
$img_x = imagesx($imgc);
$img_y = imagesy($imgc);
if ($img_x==$img_y) { $dstW = 240; $dstH = 320; }
elseif ($img_x>$img_y) { $prop = $img_x/$img_y; $dstW = 240; $dstH = ceil($dstW/$prop); }
else { $prop = $img_y/$img_x; $dstH = 320; $dstW = ceil($dstH/$prop); }
$screen = imagecreatetruecolor($dstW, $dstH);
imagecopyresampled($screen, $imgc, 0, 0, 0, 0, $dstW, $dstH, $img_x, $img_y);
imagedestroy($imgc);
imagegif($screen,'photo/240x320/'.$file);
imagedestroy($screen);
####################################################
echo $div_link.'Фотография успешно добавлена.</div>';
include_once '../sys/inc/tfoot.php'; exit;
}
}
echo $div_link;
echo '<form method="post" enctype="multipart/form-data">
Название (2 - 128 симв.)<br/>
<input type="text" name="name" value=""/><br/>
Описание (не обязательно)<br/>
<textarea name="opis" cols="25" rows="3"></textarea><br/>
Выберите фотографию<br/>
<input type="file" name="foto"/><br/>
В какой фотоальбом?<br/>
<select name="album_id">';
while ($list = mysql_fetch_array($L)) { echo '<option value="'.$list['id'].'">'.$list['name'].'</option>'; }
echo '</select><br/>
<input type="checkbox" name="18" value="1"/> Фото эротического характера <font color="red">18+</font><br/>
<input type="submit" value="Добавить"/></form>';
echo '</div>';
# ===================================================================
include_once '../sys/inc/tfoot.php';
?>