Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 18.118.126.51
<?php
require_once(__DIR__."/../aws/aws-autoloader.php");
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
header("Access-Control-Allow-Origin: *");
header('Content-Type: multipart/form-data');
header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");
header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With, x-auth-origin, x-auth-token, x-auth-type");
$ds = DIRECTORY_SEPARATOR;
$date = date("dmYhis");
$file_resp = "";
include ("database.php");
$databse = "logisys3_comexam";
$get_data = "select * from dbname where ifnull(fdeleted,'') <> 'T'";
$result1=mysqli_query($conn, $get_data);
// $row =mysqli_fetch_assoc($result1);
//
if (mysqli_num_rows($result1) > 0)
{
// output data of each row
$dbnames = array();
while($row = mysqli_fetch_assoc($result1))
{
$dbnames[$row['FUNIVCODE']] = $row['FDBNAME'];
$univname = $row['FUNIVNAME'];
$ffolder = $row['FFOLDER'];
}
}
mysqli_close($conn);
$user = $_GET['univcode'];
$year = $_GET['year'];
$examtype = $_GET['examtype'];
$qpcode = $_GET['qpcode'];
$dbname = $dbnames[$user];
$dbname = $_GET['filefield'];
if($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
die();
}
if (0 < $_FILES['file']['error']) {
echo 'Error: ' . $_FILES['file']['error'] . '<br>';
$file_resp = "Failed to upload file!";
} else {
include("/var/www/config.php");
$servername = SERVERNAME;
$username = USERNAME;
$password = PASSWORD;
$databse = $dbname;
$conn_db = new mysqli($servername,$username,$password,$databse);
if(!$conn_db)
{
die("Connection failed: " . mysqli_connect_error());
}
$name = $_FILES['filefield']['name'];
$name_split = explode(".", $name);
$qpnum = $name_split[3];
var_dump($name_split);
die();
// $qp_number = trim($qpnum, ".pdf");
// $FUNIVCODE = $name_split[0];
// $theCount = substr_count($name, '.') - 1; // count how many time the period occurs in the string
// $file_name = str_replace($_FILES['file']['name'], $name, $_FILES['file']['name']);
// $path = realpath($_FILES['file']['tmp_name']);
// $s3 = S3Client::factory(
// array(
// 'credentials' => array(
// 'key' => IAM_KEY,
// 'secret' => IAM_SECRET
// ),
// 'version' => "latest",
// 'region' => 'ap-south-1'
// )
// );
// $S3filepath = $file_name;
// $result = $s3->putObject(['Bucket' => 'university-question-paper', 'Key' => $S3filepath, 'SourceFile' => $path, 'ContentType' => $_FILES['file']['name']]);
$query = "insert ignore into tdvs_tabhead (fqpcode,fregcode,ffilepath,factive,fyear,fexamtype,fsysdate)
values('$qpcode','23100486','051/20231/ab/23100486.pdf','T','2023','1',now());";
$get_data = "insert ignore into tdvs_tabsum(FQPCODE,FPACKET,FREGCODE,FYEAR,FEXAMTYPE,FVALNO);
select FQPCODE,'10001' as FPACKET,FREGCODE,fyear fexamtype,'1' as FVALNO From tdvs_tabhead
where fqpcode = '$qpcode'";
var_dump($get_data);
die();
"insert into qparc(fqpcode, ffilename, fyear, fexamtype, fexamdate)
values('$qp_number','$name','$year','$examtype','$examdate')";
$result1=mysqli_query($conn_db, $get_data);
if($result) {
$arr = "Uploaded Successfully";
}else{
$arr = "Upload Failed";
}
echo $arr;
mysqli_close($conn);
}
?>
|