| Server IP : 208.122.213.31 / Your IP : 216.73.216.45 Web Server : Apache System : Linux msd6191.mjhst.com 4.18.0-553.137.1.el8_10.x86_64 #1 SMP Wed Jun 24 11:40:24 UTC 2026 x86_64 User : WHMCS_MIA_382 ( 1001) PHP Version : 7.4.33 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/httpd/html/baberankings.com.bak/members/modules/rating/ |
Upload File : |
<?
/* K-Rate
(C) Rinalds Uzkalns, 2003-2004. All Rights Reserved
http://turn-k.net
Version: 1.00 (22.09.04)
*/
?>
<?
global $picstable;
//delete functions
include_once 'modules/rating/image_funcs.php';
//set main picture
if ($en['act'] == 'setmain') {
sql_query("UPDATE $picstable SET i_status=1 WHERE i_status=2 AND i_user=$en[m_id]");
sql_query("UPDATE $picstable SET i_status=2 WHERE i_id=$en[id] AND i_user=$en[m_id]");
}
else if ($en['act'] == 'setmainvideo') {
sql_query("UPDATE $picstable SET i_video_status=1 WHERE i_video_status=2 AND i_user=$en[m_id]");
sql_query("UPDATE $picstable SET i_video_status=2 WHERE i_id=$en[id] AND i_user=$en[m_id]");
}
//save changes
//update descriptions
if (is_array($_POST['descr']))
foreach ($_POST['descr'] as $key => $value)
sql_query("UPDATE $picstable SET i_name='".sql_escape_string(htmlentities(stripslashes($value),ENT_QUOTES))."' WHERE i_id=$key AND i_user=$en[m_id]");
//delete images
if (is_array($_POST['del']))
foreach ($_POST['del'] as $key => $value)
if ($value == 'ON') {
//verify that user has at least one image uploaded
$rs = sql_fetch_assoc(sql_query("SELECT COUNT(*) AS cnt FROM $picstable WHERE i_user=$en[m_id]"));
if ($rs['cnt'] > 1) {
del_pic($key, $en['m_id'], true);
} else {
echo '<div class=err>'._need_picture.'</div>';
}
}
//upload new image
if ($_FILES['img']['tmp_name'] != '') {
$tmp = md5($en['m_user']);
$temp = $tmp.'.'.fileext($_FILES['img']['name']);
move_uploaded_file($_FILES['img']['tmp_name'],'images/pictures/'.$temp);
$s = getimagesize('images/pictures/'.$temp);
if ($s[0] == 0) $err .= '<Br>'._upload_valid;
if (!in_array($s[2], array(IMAGETYPE_GIF, IMAGETYPE_PNG, IMAGETYPE_JPEG)))
{
$err .= '<Br>'._upload_valid;
}
$maximg = ($en['m_daysleft'] > 0 ? paid_max_images : max_images);
if ($maximg > 0) {
$line = sql_fetch_assoc(sql_query("SELECT COUNT(*) AS cnt FROM $picstable WHERE i_user=$en[m_id] AND i_video=0"));
if ($line['cnt'] >= $maximg)
$err .= '<Br>'._already_max;
}
if (!$err) {
$img = 'images/pictures/temp_'.$tmp.'.jpg';
$result = create_thumbnail(pic_img_w,pic_img_h,'images/pictures/'.$temp,$img,pic_q);
if ($result) {
$id = $en['m_id'];
sql_query("INSERT INTO $picstable (i_user, i_status, i_time, i_ip, i_admin,i_name,i_type)
VALUES ($id, ".(image_auto_appr == 'Yes' ? 1 : 0).", ".time().", '$en[ip]',0,'".sql_escape_string(htmlentities(stripslashes($en['descr']),ENT_QUOTES))."',".(allow_more_cats == 'Yes' && isset($en['type']) ? (int)$en['type'] : $en['m_type'] ).")");
$iid = sql_insert_id();
$nimg = 'images/pictures/'.$id.'-'.$iid.'.jpg';
rename($img,$nimg);
create_thumbnail(thm_img_w,thm_img_h,$nimg,'images/thumbnails/'.$id.'-'.$iid.'.jpg',pic_q);
create_thumbnail(sma_img_w,sma_img_h,$nimg,'images/small/'.$id.'-'.$iid.'.jpg',pic_q);
//add watermark
watermark_img($nimg);
echo "<b>"._img_uploaded."</b><br><br>";
}
} else {
echo "<font color=red><b>$err</b></font><br><Br>";
}
unlink('images/pictures/'.$temp);
}
// upload new image
/**
* Created by : Nevil Jose
* Date : 12 May 2008
*/
if ($en['youtube_video_link'] != "") {
$tmp = md5($en['m_user']);
// check whether this is a valid youtube video link
$avail = strstr($en['youtube_video_link'], 'youtube.com/watch?v=');
if ($avail) {
$link_exp = explode('youtube.com/watch?v=', $en['youtube_video_link']);
if ( strstr($link_exp[1],'&') ) {
$link_exp_code = explode('&', $link_exp[1]);
$en['youtube_code'] = $link_exp_code[0];
} else {
$en['youtube_code'] = $link_exp[1];
}
}
else {
$err .= '<Br>'._upload_a_valid_video.'<BR>http://www.youtube.com/watch?v=FI76sKLMkMU<BR>';
}
if ($en['youtube_code']) {
// Function to get the thumbnail of a youtube video from the youtube code
$en['youtube_thumb_link'] = get_youtube_thumbnail($en['youtube_code']);
$path_to_wget = '/usr/bin/wget';
$q_thumbnail = $path_to_wget.' -q -b -nv --output-file=./temp/wget.log --user-agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)" --output-document=./images/thumbnails/'.$tmp.'.jpg "'.$en['youtube_thumb_link'].'"';
exec($q_thumbnail);
// sleeping the application to wait for downloading the thumbnail
usleep(3000000);
// image path to the thumbnail downloaded from youtube server
$img = 'images/thumbnails/'.$tmp.'.jpg';
if ( !file_exists($img) ) {
$err .= _issue_with_youtube_video;
}
$s = getimagesize($img);
if ($s[0] == 0) $err .= '<BR>'._upload_valid_video;
//if ($s[0] <= 120 || $s[1] <= 90) {
//$err .= _doubt_video_not_available;
//}
}
$maximg = ($en['m_daysleft'] > 0 ? paid_max_videos : max_videos);
if ($maximg > 0) {
$line = sql_fetch_assoc(sql_query("SELECT COUNT(*) AS cnt FROM $picstable WHERE i_user=$en[m_id] AND i_video=1"));
if ($line['cnt'] >= $maximg)
$err .= '<Br>'._already_max_vid;
}
if ($err == '') {
$id = $en['m_id'];
// Function to get the full viewable link to a youtube video from encrypted code
$en['youtube_video_full_link'] = getFullYoutubeVideoLink($en['youtube_code']);
// SQL query to insert the youtube video into the pictures table
sql_query("INSERT INTO $picstable (i_user, i_video_status, i_time, i_ip, i_admin,i_name,i_type, i_video,i_video_link)
VALUES ($id, ".(video_auto_appr == 'Yes' ? 1 : 0).", ".time().", '$en[ip]',0,'".sql_escape_string(htmlentities(stripslashes($en['descr']),ENT_QUOTES))."',".(allow_more_cats == 'Yes' && isset($en['type']) ? (int)$en['type'] : $en['m_type'] ).",1,'".$en['youtube_video_full_link']."')");
$iid = sql_insert_id();
$nimg = 'images/thumbnails/'.$id.'-'.$iid.'.jpg';
rename($img,$nimg);
// there is no need for thumbnail resizing since the youtube thumbnail is in a 130 x 97 resolution
// create_thumbnail(thm_img_w,thm_img_h,$nimg,'images/thumbnails/'.$id.'-'.$iid.'.jpg',pic_q);
create_thumbnail(sma_img_w,sma_img_h,$nimg,'images/small/'.$id.'-'.$iid.'.jpg',pic_q);
// add watermark feature will not be avilable for video
// watermark_img($nimg);
if ( file_exists($img) ) {
unlink($img);
}
} else {
echo "<font color=black><b>$err</b></font><br><Br>";
}
}
$line = sql_fetch_assoc(sql_query("SELECT COUNT(*) AS cnt FROM $picstable WHERE i_user=$en[m_id] AND i_status=2"));
if ($line['cnt'] == 0)
sql_query("UPDATE $picstable SET i_status=2 WHERE i_status=1 AND i_user=$en[m_id] LIMIT 1");
?>