ok

Mini Shell

Direktori : /home/u528428458/domains/jinews.co.in/public_html/
Upload File :
Current File : /home/u528428458/domains/jinews.co.in/public_html/save_news.php

<?php

include("dbconfig.php");

session_start();
if(isset($_POST['uploadnews'])){
    $name = $_SESSION['kheti'];
     ini_set("error_reporting", 1);
	function compress($source, $destination, $quality) {
		$info = getimagesize($source);
		if ($info['mime'] == 'image/jpeg') 
			$image = imagecreatefromjpeg($source);
		elseif ($info['mime'] == 'image/gif') 
			$image = imagecreatefromgif($source);
		elseif ($info['mime'] == 'image/png') 
			$image = imagecreatefrompng($source);
		imagejpeg($image, $destination, $quality);
		return $destination;
	}
	
	
		if ($_FILES["file"]["error"] > 0) 
		{
            $error = $_FILES["file"]["error"];
        }
        else if (($_FILES["file"]["type"] == "image/gif") ||
            ($_FILES["file"]["type"] == "image/jpeg") ||
            ($_FILES["file"]["type"] == "image/png") ||
            ($_FILES["file"]["type"] == "image/pjpeg")) 
		{
			
			$fil = $_FILES["file"]["name"];
            $fil1 = preg_replace('/\s+/', '', $fil);
     		$name = strtolower($fil1);
            $destination_url = "cadmin/news/$name";
			$source_img = $_FILES["file"]["tmp_name"];
			
			$fianl_file = compress($source_img, $destination_url, 50);
			$error = "Image Compressed successfully";
			
        }else {
            $error = "Uploaded image should be jpg or gif or png";
        }
    
	 
	$flag = True;
	while($flag){
		$newsid = 'news'.rand(999, 999999);
		$sql5 = $MySQLiconn->query('select * from news where newsid="' . $newsid . '"');
		$count = $sql5->num_rows;
		if($count==0){
			break;
		}
	}
	
	date_default_timezone_set('Asia/Kolkata');
	$date = date('Y-m-d');
	$time = date('h:i'); 
	
	$headline = $_POST['headline'];
	$subheading = $_POST['subheading'];
	$des =$MySQLiconn ->real_escape_string($_POST['summernoteEditor']);
	$bite = $_POST['bite'];
	$bitename = $_POST['bitename'];
	$url = $_POST['url'];
	$category = $_POST['category'];
	
	$sql = 'INSERT INTO news(newsid, headline, subheading, des, bite, bitename, url, pic, category, date, time) VALUES ("' . $newsid . '", "' . $headline . '", "' . $subheading . '", "' . $des . '", "' . $bite . '", "' . $bitename . '", "' . $url . '", "' . $name . '", "' . $category . '", "' . $date . '", "' . $time . '")';
	if ($MySQLiconn->query($sql)){
		header("location:upload_news.php?c=1");
	}
	else{
		header("location:upload_news.php?c=2");
	}
}
?>

Zerion Mini Shell 1.0