( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?php
include("../includes/limittext.php");
include('../Connections/videoondemand.php');
require("../DbSql.inc.php");
require("../NewsSql.inc.php");
require("../const.inc.php");
$db = new NewsSQL($DBName);
function filter($arr) {
global $link;
return array_map(array($link, 'real_escape_string'), $arr);
}
$_GET = filter($_GET);
$_POST = filter($_POST);
$valid_extensions = array('json'); // valid extensions
$path = 'uploads/json/'; // upload directory
if(!empty($_POST['name']) || !empty($_POST['email']) || $_FILES['image'])
{
$img = $_FILES['image']['name'];
$tmp = $_FILES['image']['tmp_name'];
// get uploaded file's extension
$ext = strtolower(pathinfo($img, PATHINFO_EXTENSION));
// can upload same image using rand function
$final_image = rand(1000000,1000000000).$img;
$final_image = strtolower($final_image);
$final_image =str_replace(" ","",$final_image);
// check's valid format
if(in_array($ext, $valid_extensions))
{
$path = $path.strtolower($final_image);
if(move_uploaded_file($tmp,$path))
{
$realtheme = $_POST['realtheme'];
$themeid = $_POST['themeid'];
$catalogid = $_POST['catalogid'];
$mytheme = $_POST['mytheme'];
$width = $_POST['width'];$height = $_POST['height'];
$title = $_POST['title'];
$alias =str_replace(" ","","$title").rand(10,100);
//$campaign = $db->addRss($catalogid,$themeid,$mytheme,$title,$hashtag,$type);
$id = $db->addJson($catalogid,$title,$final_image,$alias,$width,$height);
exit($id);
//include database configuration file
//insert form data in the database
/*$insert = $videoondemand2->query("INSERT mydata (name,email,file_name) VALUES ('".$name."','".$email."','".$path."')");*/
//echo $insert?'ok':'err';
}
}
else
{
echo 'invalid';
}
}
?>