|
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/staticcss/../ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
// First we execute our common code to connection to the database and start the session
require("common.php");
// At the top of the page we check to see whether the user is logged in or not
if(empty($_SESSION['user']))
{
// If they are not, we redirect them to the login page.
header("Location: login.php");
// Remember that this die statement is absolutely critical. Without it,
// people can view your members-only content without logging in.
die("Redirecting to login.php");
}
// Everything below this point in the file is secured by the login system
// We can display the user's username to them by reading it from the session array. Remember that because
// a username is user submitted content we must use htmlentities on it before displaying it to the user.
?>
<?php
ini_set('error_reporting', E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
require_once './config/config.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$sub_id=$_POST["sub_id"];
$Sub_Head=$_POST["Sub_Head"];
$Sub_Amount=$_POST["Sub_Amount"];
$sql=mysqli_query($con,"select Name from sub_head where Sub_Id != '$sub_id' ");
$sql1=mysqli_num_rows($sql);
while($subn1=mysqli_fetch_array($sql)){
$list[] = $subn1['Name'];
}
//print_r($list);
/*if(in_array($Sub_Head, $list))
{
?>
<script>
document.location="Sub_Head.php";
alert("Sub Head Name Already Exist");
</script>
<?php
}else
{*/
$subn_res=mysqli_query($con,"select `Name` from `sub_head` where `Sub_Id` = '$sub_id'");
$subn=mysqli_fetch_array($subn_res);
if($Sub_Head!="")
{
mysqli_query($con,"UPDATE `sub_head` SET `Name` = '$Sub_Head', `Amount` = '$Sub_Amount' WHERE `sub_head`.`Sub_Id` = '$sub_id'");
mysqli_query($con,"UPDATE `ledger` SET `Name` = '$Sub_Head' WHERE `Name` = '$subn[0]'") or die(mysqli_error($con));
mysqli_query($con,"UPDATE `vochers` SET `Cr_Ledger` = '$Sub_Head' WHERE `Cr_Ledger`= '$subn[0]'") or die(mysqli_error($con));
mysqli_query($con,"UPDATE `vochers` SET `Dr_Ledger` = '$Sub_Head' WHERE `Dr_Ledger`= '$subn[0]'") or die(mysqli_error($con));
}
else
{
mysqli_query($con,"UPDATE `sub_head` SET `Amount` = '$Sub_Amount' WHERE `sub_head`.`Sub_Id` = '$sub_id'");
}
include "head_amount_calcu.php";
?>
<script>
document.location="Sub_Head.php";
alert("Update Successful");
</script>
<?php
//}
}
else{
header('location: dashboard.php');
}
?>