| Server IP : 127.0.0.1 / Your IP : 216.73.216.48 Web Server : Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.2.12 System : Windows NT DESKTOP-3H4FHQJ 10.0 build 19045 (Windows 10) AMD64 User : win 10 ( 0) PHP Version : 8.2.12 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : D:/xampp/htdocs-coblaa/social/ |
Upload File : |
<?php
include('db.php');
session_start();
$status = $_GET['status'];
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$curr_day = date('d');
$curr_month = date('m');
$curr_year = date('Y');
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$user_ip = getenv('REMOTE_ADDR');
$geo = unserialize(file_get_contents("http://www.geoplugin.net/php.gp?ip=$user_ip"));
$city = $geo["geoplugin_city"];
$region = $geo["geoplugin_regionName"];
$country = $geo["geoplugin_countryName"];
/*echo"$user_ip";
echo "City: ".$city."<br>";
echo "Region: ".$region."<br>";
echo "Country: ".$country."<br>";
/*
geoplugin_request
geoplugin_status
geoplugin_credit
geoplugin_city
geoplugin_region
geoplugin_areaCode
geoplugin_dmaCode
geoplugin_countryCode
geoplugin_countryName
geoplugin_continentCode
geoplugin_latitude
geoplugin_longitude
geoplugin_regionCode
geoplugin_regionName
geoplugin_currencyCode
geoplugin_currencySymbol
geoplugin_currencySymbol_UTF8
geoplugin_currencyConverter
*/
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(isset($_SESSION['id']))
{
$my_id = $_SESSION['id'];
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if($status =='insert_post_main')
{
$cur_hour = $_GET['cur_hour'];
$cur_min = $_GET['cur_min'];
$cur_sec = $_GET['cur_sec'];
$cur_year = $_GET['cur_year'];
$cur_month = $_GET['cur_month'];
$cur_day = $_GET['cur_day'];
$new_post_text = $_GET['new_post_text'];
$fileName = $_FILES["post_file"]["name"]; // The file name
$tmp_file = $_FILES["post_file"]["tmp_name"]; // File in the PHP tmp folder
$file_type = explode('.',$fileName);
$file_type = end($file_type);
$random_name = rand();
$random_name = mysqli_real_escape_string($con,$random_name);
$file_type = mysqli_real_escape_string($con,$file_type);
$new_post_text = mysqli_real_escape_string($con,$new_post_text);
$insert_post ="insert into poststb(my_id,post_text,image_url,file_type,cur_day,cur_month,cur_year,cur_hour,cur_min,cur_sec)
values ('$my_id','$new_post_text','$random_name','$file_type','$cur_day','$cur_month','$cur_year','$cur_hour','$cur_min','$cur_sec' )";
$run_insert_post = mysqli_query($con,$insert_post);
if($file_type =="JPG" || $file_type =="jpg" || $file_type =="png" || $file_type =="PNG" || $file_type =="JPEG" || $file_type =="jpeg" || $file_type=="JFIF" || $file_type=="jfif"){
if(move_uploaded_file($tmp_file, "post_images/$random_name".'.'.$file_type)){
echo "$fileName upload is complete";
} else { echo "move_uploaded_file function failed";}
}elseif($file_type =="mp4" || $file_type =="MP4" || $file_type == "mpeg" || $file_type =="MPEG"){
if(move_uploaded_file($tmp_file, "post_videos/$random_name".'.'.$file_type)){
echo "$fileName upload is complete";
} else { echo "move_uploaded_file function failed";}
}elseif($file_type =="mp3" || $file_type =="MP3"){
if(move_uploaded_file($tmp_file, "post_audios/$random_name".'.'.$file_type)){
echo "$fileName upload is complete";
} else { echo "move_uploaded_file function failed";}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if($status =='insert_post_main_text')
{
$cur_hour = $_GET['cur_hour'];
$cur_min = $_GET['cur_min'];
$cur_sec = $_GET['cur_sec'];
$cur_year = $_GET['cur_year'];
$cur_month = $_GET['cur_month'];
$cur_day = $_GET['cur_day'];
$new_post_text = $_GET['new_post_text'];
$insert_post ="insert into poststb(my_id,post_text,cur_day,cur_month,cur_year,cur_hour,cur_min,cur_sec)
values ('$my_id','$new_post_text','$cur_day','$cur_month','$cur_year','$cur_hour','$cur_min','$cur_sec')";
$run_insert_post = mysqli_query($con,$insert_post);
}
?>