|
Server IP : 2a02:4780:3:1493:0:3736:a38e:7 / Your IP : 216.73.216.60 Web Server : LiteSpeed System : Linux sg-nme-web1393.main-hosting.eu 4.18.0-553.77.1.lve.el8.x86_64 #1 SMP Wed Oct 8 14:21:00 UTC 2025 x86_64 User : u926327694 ( 926327694) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF Directory (0755) : /home/u926327694/domains/smsoft.in/public_html/demo/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
include "config/config.php";
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$Section=$_POST["Section"];
$Head1=$_POST["Head1"];
$Head2=$_POST["Head2"];
$Head3=$_POST["Head3"];
if($Head1!="" && $Head1!="")
{
mysqli_query($con,"INSERT INTO `Receipt_Head` (`ID`, `Section`, `Head1`, `Head2`, `Head3`) VALUES (NULL, '$Section', '$Head1', '$Head2', '$Head3')");
}
?>
<?php
// /home/username/domains/yourdomain.tld/public_html
//$target_dir = "/home/u926327694/domains/smsoft.in/public_html/".$code."/school_logos/";
$target_dir = "school_logos/";
$fileinfo=PATHINFO($_FILES["image"]["name"]);
$fileinfo_voucher=PATHINFO($_FILES["imgVoucherHeader"]["name"]);
$fileinfo_certificate=PATHINFO($_FILES["imgCertificate"]["name"]);
$schoolcode=$_SESSION['code'];
$newFilename="logo_".$schoolcode.".jpg";
$newFilename_voucher=$schoolcode."_voucher.jpg";
$newFilename_certificate=$schoolcode."_certificate.jpg";
$target_file = $target_dir . $newFilename;
$target_file_voucher = $target_dir . $newFilename_voucher;
$target_file_certificate = $target_dir . $newFilename_certificate;
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
// Check if image file is a actual image or fake image
if(isset($_POST["image"])) {
$check = getimagesize($_FILES["image"]["tmp_name"]);
if($check !== false) {
// echo "File is an image - " . $check["mime"] . ".";
$uploadOk = 1;
} else {
echo "File is not an image.";
$uploadOk = 0;
}
}
$uploadOk1 = 1;
if(isset($_POST["imgVoucherHeader"])) {
$check = getimagesize($_FILES["imgVoucherHeader"]["tmp_name"]);
if($check !== false) {
// echo "File is an image - " . $check["mime"] . ".";
$uploadOk1 = 1;
} else {
echo "File is not an image.";
$uploadO1k = 0;
}
}
$uploadOk2 = 1;
if(isset($_POST["imgCertificate"])) {
$check = getimagesize($_FILES["imgCertificate"]["tmp_name"]);
if($check !== false) {
// echo "File is an image - " . $check["mime"] . ".";
$uploadOk2 = 1;
} else {
echo "File is not an image.";
$uploadOk2 = 0;
}
}
// Check if file already exists
// Check file size
// Allow certain file formats
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0 || $uploadOk1 == 0 || $uploadOk2 == 0) {
echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
//unlink($target_file);
//echo"Done"; exit;
$up1=0;
if($_FILES["image"]["name"]!="")
{
if(move_uploaded_file($_FILES["image"]["tmp_name"], __DIR__ ."/".$target_file))
{
$up1=1;
}
}
if($_FILES["imgVoucherHeader"]["name"]!="")
{
move_uploaded_file($_FILES["imgVoucherHeader"]["tmp_name"], __DIR__ ."/".$target_file_voucher);
}
if($_FILES["imgCertificate"]["name"]!="")
{
move_uploaded_file($_FILES["imgCertificate"]["tmp_name"], __DIR__ ."/".$target_file_certificate);
}
/*echo "The file ". basename( $_FILES["image"]["name"]). " has been uploaded.";*/
$url_path=$burl.'/'.$newFilename;
$sql="UPDATE `schools` SET `logo` = '$url_path' WHERE `schools`.`schoolCode` = '$code'";
if(mysqli_query($rootcon,$sql)){
?> <script>
alert("Data has been updated...");
document.location="Receipt_head_create.php";
</script><?php
}else{
?> <script>
alert("<?= mysqli_error($rootcon) ?>");
document.location="Receipt_head_create.php";
</script><?php
}
}
}
?>