| 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:/Desktop/ns/ |
Upload File : |
<html>
<?php
session_start();
include('db.php');
//include('function.php');
?>
<?php
if(isset($_SESSION['id']))
{
//$_SESSION['email']=$user_email;
$my_id = $_SESSION['id'];
//echo"$my_id";
}
if(isset($_GET['db_id4'])){
$user_id = $_GET['db_id4'];
}
?>
<div style="display:none;">
<input type="text" id="my_id" class="helping_id" style="display:none;" value="<?php echo $my_id;?>">
<?php
$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
*/
?>
<input type="text" id="country_user" class="helping_id" style="display:none;" value="<?php echo $country;?>">
<input type="text" id="region_user" class="helping_id" style="display:none;" value="<?php echo $region;?>">
<input type="text" id="city_user" class="helping_id" style="display:none;" value="<?php echo $city;?>">
<input type="text" id="ip_user" class="helping_id" style="display:none;" value="<?php echo $user_ip;?>">
</div>
<head>
<title>sn real estate</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="main_css/add_water_receipt.css" />
</head>
<body id="body">
<button onClick="history.back();" class="back_bnt" >Back</button>
<a href="logout"><button class="logout_btn" >Logout</button></a>
<?php
//$select_tenant_receipt ="select * from";
?>
<div class="main_content_div" >
<div class="receipt_title_name" >SN REAL ESTATE</div>
<div class="receipt_title_location" >MAGERE</div>
<div class="receipt_title_contact" >TEL: +256751045153</div>
<div class="receipt_title_rent" >Add Water Bill</div>
<form method="post">
<?php
$get_sn_tenant = "select * from sn_tenanttb where id='$user_id'";
$run_sn_tenant= mysqli_query($con,$get_sn_tenant);
while($row_get_sn_tenant = mysqli_fetch_array($run_sn_tenant))
{
$rented_sn_unit = $row_get_sn_tenant['rented_sn_unit'];
$tenant_name = $row_get_sn_tenant['tenant_name'];
?>
<input name="rented_block" readOnly class="receipt_output_small_one" value="<?php echo"$rented_sn_unit"; ?>"/>
<input name="meter_reading_date" class="receipt_output_small_two" placeholder="Enter Date..."/>
<input name="tenant_name" readOnly class="receipt_output" value="<?php echo"$tenant_name"; ?>" />
<input name="cur_meter_reading" class="receipt_output" placeholder="Current Reading..." />
<input name="for_the_month" class="receipt_output" placeholder="For The Month of:"/>
<?php }
if(isset($_POST['add_water_bill_btn']))
{
$meter_reading_date = $_POST['meter_reading_date'];
$tenant_name = $_POST['tenant_name'];
$cur_meter_reading = $_POST['cur_meter_reading'];
$for_the_month = $_POST['for_the_month'];
$rented_block = $_POST['rented_block'];
$price_per_unit = 4220;
$service_charge = 2000;
if($meter_reading_date=="" OR $for_the_month=="" OR $cur_meter_reading==""){
echo"<div class='receipt_output' style='height:30px;line-height:30px;color:red;border:transparent;' >Fill All The Spaces</div>";
}else{
$get_previous_reading ="select * from previous_meter_readingtb where user_id='$user_id' ";
$run_previous_reading = mysqli_query($con,$get_previous_reading);
$check_previous_reading = mysqli_num_rows($run_previous_reading);
if($check_previous_reading >0){
$update_previous_reading ="UPDATE previous_meter_readingtb SET previous_reading='$cur_meter_reading' where user_id='$user_id' ";
$run_update_prev_reading = mysqli_query($con,$update_previous_reading);
}else{
$insert_prev_reading ="insert into previous_meter_readingtb(user_id,previous_reading,cur_date) values('$user_id','$cur_meter_reading',CURDATE() )";
$run_insert_prev_reading = mysqli_query($con,$insert_prev_reading);
}
while($row_previous_reading = mysqli_fetch_array($run_previous_reading))
{
$previous_m_reading = $row_previous_reading['previous_reading'];
//}
$insert_water_bill = "insert into sn_water_billingtb (my_id,user_id,tenant_name,cur_meter_reading,previous_m_reading,meter_reading_date,price_per_unit,service_charge,vat_charge,for_the_month_of,rented_block,cur_citty,cur_counrty,cur_date,cur_time)
values('$my_id','$user_id','$tenant_name','$cur_meter_reading','$previous_m_reading','$meter_reading_date','$price_per_unit','$service_charge','00','$for_the_month','$rented_block','$city','$country',CURDATE(),CURTIME() )";
$run_insert_water_bill = mysqli_query($con,$insert_water_bill);
echo"<div class='receipt_output' style='height:30px;line-height:30px;color:green;border:transparent;' >New Water Bill Added, Thanks</div>";
}
}
}
?>
<button name="add_water_bill_btn" class="main_dash" >Enter</button>
</form>
</div>
</body>
</html>