[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: edit_apartment.php
<?php include 'header.php';?> <style> .col-md-3,.col-md-4,.col-md-6,.col-md-1{ display:inline-block !important; } </style> <div class="main-panel"> <div class="content"> <div class="container-fluid"> <div class="row"> <div class="col-md-12"> <div class="card"> <div class="card-header"> <div class="card-title">Edit Apartment/PG/House</div> </div> <form method="post" id="exampleValidation" data-toggle="validator" enctype="multipart/form-data" > <div class="card-body"> <?php $count=1; $sr='apartment'; $stmt =$show->readwithdata($sr,'id',$_REQUEST['id']); $num = $stmt->rowCount(); if($num>0){ $count=1; while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){ extract($row); $id=$row['id']; $aid=$row['apartment_id']; $category=$row['category']; $amen=array();$flat=array();$nearby=array();$tenant=array(); $st_amn=$show->readwithdata_clause('apartment_amenity','apart_id',$row['apartment_id'],'order by id asc'); while ($row_amn = $st_amn->fetch(PDO::FETCH_ASSOC)){ $amen .=":".$row_amn['amenity']; } $amn=explode(':',$amen); print_r($amn); $st_flat=$show->readwithdata_clause('apartment_flatmate','apart_id',$row['apartment_id'],'order by id asc'); while ($row_flt = $st_flat->fetch(PDO::FETCH_ASSOC)){ $flat .=":".$row_flt['amenity']; } $flatment_profile=explode(':',$flat); $st_near=$show->readwithdata_clause('apartment_nearby','apart_id',$row['apartment_id'],'order by id asc'); while ($row_near = $st_near->fetch(PDO::FETCH_ASSOC)){ $nearby .=":".$row_near['amenity']; } $near=explode(':',$nearby); $st_tenant=$show->readwithdata_clause('apartment_tenant','apart_id',$row['apartment_id'],'order by id asc'); while ($row_tenant = $st_tenant->fetch(PDO::FETCH_ASSOC)){ $tenant .=":".$row_tenant['amenity']; } $tenant_profile=explode(':',$tenant); // echo $row['image1']; ?> <div class="form-group form-show-validation row"> <label for="name" class="col-lg-1 col-md-3 col-sm-3 col-xs-6 mt-sm-2 ">Apartment Id <span class="required-label">*</span></label> <div class="col-lg-3 col-md-3 col-sm-3 col-xs-6 "> <input type="text" value="<?=$row['apartment_id']?>" name="apartment_id" class="form-control" placeholder="apartment_id" readonly> </div> <label for="name" class="col-lg-1 col-md-3 col-sm-3 col-xs-6 mt-sm-2 "> Name <span class="required-label">*</span></label> <div class="col-lg-3 col-md-3 col-sm-3 col-xs-6 "> <input type="text" name="name" value="<?=$row['name']?>" class="form-control" placeholder="Name"> </div> <label for="name" class="col-lg-1 col-md-3 col-sm-3 col-xs-6 mt-sm-2 "> Sex <span class="required-label">*</span></label> <div class="col-lg-2 col-md-3 col-sm-3 col-xs-6 "> <input type="text" name="gender" value="<?=$row['gender']?>" class="form-control" placeholder="Name"> </div> </div> <div class="form-group form-show-validation row"> <label for="name" class="col-lg-1 col-md-1 col-sm-2 col-xs-6 mt-sm-2 ">Phone <span class="required-label">*</span></label> <div class="col-lg-3 col-md-3 col-sm-2 col-xs-6 "> <input type="text" name="phone" value="<?=$row['phone']?>" class="form-control" placeholder="Year Sponsored"> </div> <label for="name" class="col-lg-1 col-md-1 col-sm-2 col-xs-6 mt-sm-2 ">Email <span class="required-label">*</span></label> <div class="col-lg-3 col-md-3 col-sm-2 col-xs-6 "> <input type="text" name="email" value="<?=$row['email']?>" class="form-control" placeholder="DOB"> </div> <label for="name" class="col-lg-1 col-md-1 col-sm-2 col-xs-6 mt-sm-2 ">Address <span class="required-label">*</span></label> <div class="col-lg-3 col-md-3 col-sm-2 col-xs-6 "> <input type="text" name="address" value="<?=$row['address']?>" class="form-control" placeholder="School & Board"> </div> </div> <div class="form-group form-show-validation row"> <label for="name" class="col-lg-1 col-md-1 col-sm-2 col-xs-6 mt-sm-2 ">City <span class="required-label">*</span></label> <div class="col-lg-3 col-md-3 col-sm-2 col-xs-6 "> <select name="city" class="form-control" required> <option value="">Choose City</option> <?php $stmt_city =$show->readwithdata_clause('city','status','ACTIVE','order by id asc'); $num = $stmt_city->rowCount(); if($num>0){ $count=1; while ($rowc = $stmt_city->fetch(PDO::FETCH_ASSOC)){ extract($rowc); ?> <option value="<?=$rowc['city']?>" <?php if($rowc['city']==$row['city']) echo "selected"; ?>><?=$rowc['city']?></option> <?php } }?> </select> </div> <label for="name" class="col-lg-1 col-md-1 col-sm-2 col-xs-6 mt-sm-2 ">Pincode <span class="required-label">*</span></label> <div class="col-lg-3 col-md-3 col-sm-2 col-xs-6 "> <input type="text" name="pincode" value="<?=$row['pincode']?>" class="form-control" placeholder="Pincode"> </div> <label for="name" class="col-lg-1 col-md-1 col-sm-2 col-xs-6 mt-sm-2 ">State <span class="required-label">*</span></label> <div class="col-lg-3 col-md-3 col-sm-2 col-xs-6 "> <input type="text" name="state" value="<?=$row['state']?>" class="form-control" placeholder="State"> </div> </div> <div class="form-group form-show-validation row"> <label for="name" class="col-lg-2 col-md-1 col-sm-4 mt-sm-2 ">Property Type <span class="required-label">*</span></label> <div class="col-lg-2 col-md-12 col-sm-12"> <?php $interests = array('Apartment','House','PG','Shared Accomodation'); ?> <select name="property_type" class="form-control"> <?php foreach( $interests as $interest ): ?> <option value="<?php echo $interest ?>"<?php if( $interest==$row['property_type']): ?> selected="selected"<?php endif; ?>><?php echo $interest ?></option> <?php endforeach; ?> </select> </div> <label for="name" class="col-lg-1 col-md-1 col-sm-4 mt-sm-2 ">Rent/Month <span class="required-label">*</span></label> <div class="col-lg-3 col-md-12 col-sm-12"> <input type="text" name="rent" value="<?=$row['rent']?>" class="form-control" placeholder="Rent/Month"> </div> <label for="name" class="col-lg-2 col-md-1 col-sm-4 mt-sm-2 ">Total Bedroom <span class="required-label">*</span></label> <div class="col-lg-2 col-md-12 col-sm-12"> <?php $interests = array('1','2','3','4','5'); ?> <select name="total_bedroom" class="form-control"> <?php foreach( $interests as $interest ): ?> <option value="<?php echo $interest ?>"<?php if( $interest==$row['total_bedroom']): ?> selected="selected"<?php endif; ?>><?php echo $interest ?></option> <?php endforeach; ?> </select> </div> </div> <div class="form-group form-show-validation row"> <label for="name" class="col-lg-2 col-md-3 col-sm-4 mt-sm-2 ">Total Bathroom<span class="required-label">*</span></label> <div class="col-lg-2 col-md-12 col-sm-12"> <?php $interests = array('1','2','3','4','5'); ?> <select name="total_bathroom" class="form-control"> <?php foreach( $interests as $interest ): ?> <option value="<?php echo $interest ?>"<?php if( $interest==$row['total_bathroom']): ?> selected="selected"<?php endif; ?>><?php echo $interest ?></option> <?php endforeach; ?> </select> </div> <label for="name" class="col-lg-2 col-md-3 col-sm-4 mt-sm-2 ">Furnishing<span class="required-label">*</span></label> <div class="col-lg-2 col-md-12 col-sm-12"> <?php $interests = array('Furnished','Semi Furnished','Unfurnished'); ?> <select name="furnishing" class="form-control"> <?php foreach( $interests as $interest ): ?> <option value="<?php echo $interest ?>"<?php if( $interest==$row['furnishing']): ?> selected="selected"<?php endif; ?>><?php echo $interest ?></option> <?php endforeach; ?> </select> </div> </div> <div class="form-group form-show-validation row"> <label for="name" class="col-lg-12 col-md-12 col-sm-12 mt-sm-2 ">Amenities <span class="required-label">*</span></label> <div class="col-lg-12 col-md-12 col-sm-12"> <?php $sr2='amenities'; $stmt2 =$show->readAll_clause($sr2,'order by id asc'); $num = $stmt2->rowCount(); $count=1; while ($row2 = $stmt2->fetch(PDO::FETCH_ASSOC)){ extract($row2); $id=$row2['id']; if (in_array($row2['amenity'], $amn)) {?> <div class="apartment-check-block-content col-md-2"> <input type="checkbox" value="<?=$row2['amenity']?>" checked="checked" name="amenities[]" id="flatmate-preference1"> <label for="flatmate-preference1"> <input type="hidden" value="<?=$row1['image']?>" name="img[]" > <img src="<?=$pic_img?>/<?=$row2['image']?>" width="50px"> <h6><?=$row2['amenity']?></h6> </label> </div> <?php } else { ?> <div class="apartment-check-block-content col-md-2"> <input type="checkbox" value="<?=$row2['amenity']?>" name="amenities[]" id="flatmate-preference1"> <input type="hidden" value="<?=$row1['image']?>" name="img[]" > <label for="flatmate-preference1"> <img src="<?=$pic_img?>/<?=$row2['image']?>" width="50px"> <h6><?=$row2['amenity']?></h6> </label> </div> <?php } ?> <?php } ?> </div> </div> <div class="form-group form-show-validation row"> <div class="col-lg-12 col-md-12 col-sm-12"> <label for="name" class="col-lg-12 col-md-12 col-sm-12 mt-sm-2 ">Nearby Amenities <span class="required-label">*</span></label> <?php $sr1='amenities_nearby'; $stmt1 =$show->readAll_clause($sr1,'order by id asc'); $num = $stmt1->rowCount(); $count=1; while ($row1 = $stmt1->fetch(PDO::FETCH_ASSOC)){ extract($row1); $id=$row1['id']; if (in_array($row1['amenity'], $near)) {?> <div class="apartment-check-block-content col-md-2"> <input type="checkbox" value="<?=$row1['amenity']?>" checked="checked" name="nearby_amenity[]" id="flatmate-preference1"> <label for="flatmate-preference1"> <input type="hidden" value="<?=$row2['image']?>" name="img1[]" > <img src="<?=$pic_img?>/<?=$row1['image']?>" width="50px"> <h6><?=$row1['amenity']?></h6> </label> </div> <?php } else { ?> <div class="apartment-check-block-content col-md-2"> <input type="checkbox" value="<?=$row1['amenity']?>" name="nearby_amenity[]" id="flatmate-preference1"> <label for="flatmate-preference1"> <input type="hidden" value="<?=$row2['image']?>" name="img1[]" > <img src="<?=$pic_img?>/<?=$row1['image']?>" width="50px"> <h6><?=$row1['amenity']?></h6> </label> </div> <?php } ?> <?php } ?> </div> </div> <?php if($row['category']=='tenant'){?> <div class="form-group form-show-validation row"> <div class="col-lg-12 col-md-12 col-sm-12"> <label for="name" class="col-lg-12 col-md-12 col-sm-12 mt-sm-2 ">Tenant Preference <span class="required-label">*</span></label> <?php // print_r($tenant_profile); $sr3='tenant_category'; $stmt3 =$show->readAll_clause($sr3,'order by id asc'); $num3 = $stmt3->rowCount(); $count=1; while ($row3 = $stmt3->fetch(PDO::FETCH_ASSOC)){ extract($row3); if (in_array($row3['amenity'], $tenant_profile)) {?> <div class="apartment-check-block-content col-md-2"> <input type="checkbox" value="<?=$row3['amenity']?>" checked="checked" name="tenant_profile[]" id="flatmate-preference1"> <label for="flatmate-preference1"> <input type="hidden" value="<?=$row3['image']?>" name="img2[]" > <img src="<?=$pic_img?>/<?=$row3['image']?>" width="50px"> <h6><?=$row3['amenity']?></h6> </label> </div> <?php } else { ?> <div class="apartment-check-block-content col-md-2"> <input type="checkbox" value="<?=$row3['amenity']?>" name="tenant_profile[]" id="flatmate-preference1"> <label for="flatmate-preference1"> <input type="hidden" value="<?=$row3['image']?>" name="img2[]" > <img src="<?=$pic_img?>/<?=$row3['image']?>" width="50px"> <h6><?=$row3['amenity']?></h6> </label> </div> <?php } ?> <?php } ?> </div> </div> <?php }else{ ?> <div class="form-group form-show-validation row"> <div class="col-lg-12 col-md-12 col-sm-12"> <label for="name" class="col-lg-12 col-md-12 col-sm-12 mt-sm-2 ">Flatmate Preference <span class="required-label">*</span></label> <?php $sr4='flatmate_category'; $stmt4 =$show->readAll_clause($sr4,'order by id asc'); $count=1; while ($row4 = $stmt4->fetch(PDO::FETCH_ASSOC)){ extract($row4); if (in_array($row4['amenity'], $flatment_profile)) {?> <div class="apartment-check-block-content col-md-2"> <input type="checkbox" value="<?=$row4['amenity']?>" checked="checked" name="flatment_profile[]" id="flatmate-preference1"> <label for="flatmate-preference1"> <input type="hidden" value="<?=$row4['image']?>" name="img3[]" > <img src="<?=$pic_img?>/<?=$row4['image']?>" width="50px"> <h6><?=$row4['amenity']?></h6> </label> </div> <?php } else { ?> <div class="apartment-check-block-content col-md-2"> <input type="checkbox" value="<?=$row4['amenity']?>" name="flatment_profile[]" id="flatmate-preference1"> <label for="flatmate-preference1"> <input type="hidden" value="<?=$row4['image']?>" name="img3[]" > <img src="<?=$pic_img?>/<?=$row4['image']?>" width="50px"> <h6><?=$row4['amenity']?></h6> </label> </div> <?php } ?> <?php } ?> </div> </div> <?php } ?> <div class="form-group form-show-validation row"> <label for="name" class="col-lg-12 col-md-12 col-sm-12 mt-sm-2 ">Images<span class="required-label">*</span></label> <div class="col-md-3"> <?php if($row['image1']!=""){?> <img src="<?=$pic_img?>/<?=$row['image1']?>" width="100px"> <?php } ?> <input type="file" name="image1"> </div> <div class="col-md-3"> <?php if($row['image2']!=""){?> <img src="<?=$pic_img?>/<?=$row['image2']?>" width="100px"> <?php } ?> <input type="file" name="image2"> </div> <div class="col-md-3"> <?php if($row['image3']!=""){?> <img src="<?=$pic_img?>/<?=$row['image3']?>" width="100px"> <?php } ?> <input type="file" name="image3"> </div> </div> <div class="form-group form-show-validation row"> <div class="col-md-3"> <?php if($row['image4']!=""){?> <img src="<?=$pic_img?>/<?=$row['image4']?>" width="100px"> <?php } ?> <input type="file" name="image4"> </div> <div class="col-md-3"> <?php if($row['image5']!=""){?> <img src="<?=$pic_img?>/<?=$row['image5']?>" width="100px"> <?php } ?> <input type="file" name="image5"> </div> </div> <div class="form-group form-show-validation row"> <label for="name" class="col-lg-12 col-md-12 col-sm-12 mt-sm-2 ">Description<span class="required-label">*</span></label> <div class="col-lg-12"> <textarea class="form-control"><?=$row['description']?></textarea> </div> </div> <div class="card-action"> <div class="row"> <div class="col-md-12"> <input class="btn btn-success" type="submit" name="sub" value="Submit"> </div> </div> </div> <?php } } ?> </div> </form> <?php if(isset($_POST['sub'])){ $table="apartment"; if(isset($_POST['amenities'])){ foreach($_POST['amenities'] as $key=>$value){ $data=array( 'apart_id'=>$aid, 'amenity'=>$_POST['amenities'][$key], 'img'=>$_POST['img'][$key], ); $r1=$show->insert('apartment_amenity',$data); } } foreach( $_POST['nearby_amenity'] as $key=>$value){ // $amenities .=$amn.":"; $data=array( 'apart_id'=>$aid, 'amenity'=>$_POST['nearby_amenity'][$key], 'img'=>$_POST['img1'][$key], ); $r1=$show->insert('apartment_nearby',$data); } foreach( $_POST['tenant_profile'] as $key=>$value){ // $amenities .=$amn.":"; $data=array( 'apart_id'=>$aid, 'amenity'=>$_POST['tenant_profile'][$key], 'img'=>$_POST['img2'][$key], ); $r1=$show->insert('apartment_tenant',$data); } foreach( $_POST['flatment_profile'] as $key=>$value){ // $amenities .=$amn.":"; $data=array( 'apart_id'=>$aid, 'amenity'=>$_POST['flatment_profile'][$key], 'img'=>$_POST['img3'][$key], ); $r1=$show->insert('apartment_flatmate',$data); } $allowed = ["name","phone","email","address","city","pincode","state","property_type","rent","total_bedroom","total_bathroom","furnishing","description"]; $params = []; $setStr = ""; foreach ($allowed as $key) { if (isset($_POST[$key]) && $key != "uid") { $setStr .= "`$key` = :$key,"; $params[$key] = htmlspecialchars($_POST[$key]); } } if(file_exists($_FILES['image1']['tmp_name']) || is_uploaded_file($_FILES['image1']['tmp_name'])) { $setStr .= "`image1` = :image1,"; $img=$show->imageEdit($_FILES['image1']['name']); move_uploaded_file($_FILES['image1']['tmp_name'],"../product_img/".$img); $params['image1'] =$img; } if(file_exists($_FILES['image2']['tmp_name']) || is_uploaded_file($_FILES['image2']['tmp_name'])) { $setStr .= "`image2` = :image2,"; $img=$show->imageEdit($_FILES['image2']['name']); move_uploaded_file($_FILES['image2']['tmp_name'],"../product_img/".$img); $params['image2'] =$img; } if(file_exists($_FILES['image3']['tmp_name']) || is_uploaded_file($_FILES['image3']['tmp_name'])) { $setStr .= "`image3` = :image3,"; $img=$show->imageEdit($_FILES['image3']['name']); move_uploaded_file($_FILES['image3']['tmp_name'],"../product_img/".$img); $params['image3'] =$img; } if(file_exists($_FILES['image4']['tmp_name']) || is_uploaded_file($_FILES['image4']['tmp_name'])) { $setStr .= "`image4` = :image4,"; $img=$show->imageEdit($_FILES['image4']['name']); move_uploaded_file($_FILES['image4']['tmp_name'],"../product_img/".$img); $params['image4'] =$img; } if(file_exists($_FILES['image5']['tmp_name']) || is_uploaded_file($_FILES['image5']['tmp_name'])) { $setStr .= "`image5` = :image5,"; $img=$show->imageEdit($_FILES['image5']['name']); move_uploaded_file($_FILES['image5']['tmp_name'],"../product_img/".$img); $params['image5'] =$img; } $setStr = rtrim($setStr, ","); $params['apartment_id'] =$_POST['apartment_id']; $show->table ='apartment'; $show->cols =$setStr; $show->id_name ='apartment_id'; $show->params =$params; //print_r($params); if($show->update_all()){ echo '<script> setTimeout(function() { swal({ title: "Thank You ", text: "for Updating!", type: "success" }, function() { window.location = "'.$_SERVER['REQUEST_URI'].'"; }); }, 1000); </script>'; } else{ echo "ss"; } }?> </div> </div> </div> </div> </div> <?php include 'footer.php'; ?>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server05.hostinghome.co.in
Server IP: 192.168.74.40
PHP Version: 7.4.33
Server Software: Apache
System: Linux server05.hostinghome.co.in 3.10.0-962.3.2.lve1.5.81.el7.x86_64 #1 SMP Wed May 31 10:36:47 UTC 2023 x86_64
HDD Total: 1.95 TB
HDD Free: 692.14 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Disabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: itsweb
User ID (UID): 1619
Group ID (GID): 1621
Script Owner UID: 1619
Current Dir Owner: 1619