Hacked By AnonymousFox
<?php
if(isset($_POST['add']))
{
$name = mysqli_real_escape_string($cn,$_POST['name']);
$mobile = mysqli_real_escape_string($cn,$_POST['mobile']);
$email = mysqli_real_escape_string($cn,$_POST['email']);
$gst = $_POST['gst'];
$address = mysqli_real_escape_string($cn,$_POST['address']);
$sqlSubject = mysqli_query($cn, "insert into `tbl_dealer` set `name`='$name', `mobile`='$mobile', `email`='$email', `gst`='$gst', `address`='$address'");
if ($sqlSubject){
echo '<div class="alert alert-success"><strong>Success!</strong> Dealer Added Successfully.</div>';
}
else
{
echo '<div class="alert alert-danger"><strong>Danger!</strong> Dealer Not Added. Try Again.</div>';
}
}
if(isset($_POST['edit']))
{
$edit_id = $_POST['edit_id'];
$name = mysqli_real_escape_string($cn,$_POST['name']);
$mobile = mysqli_real_escape_string($cn,$_POST['mobile']);
$email = mysqli_real_escape_string($cn,$_POST['email']);
$gst = $_POST['gst'];
$address = mysqli_real_escape_string($cn,$_POST['address']);
$sqlSubject = mysqli_query($cn, "update `tbl_dealer` set `name`='$name', `mobile`='$mobile', `email`='$email', `gst`='$gst', `address`='$address' where `id`='".$edit_id."'");
if ($sqlSubject){
echo '<div class="alert alert-success"><strong>Success!</strong> Dealer Update Successfully.</div>';
}
else
{
echo '<div class="alert alert-danger"><strong>Danger!</strong> Dealer Not Update. Try Again.</div>';
}
}
if(isset($_GET['edit_id']))
{
$id = $_GET['edit_id'];
$sql = mysqli_query($cn, "select * from `tbl_dealer` where id='$id'");
$sqlData = mysqli_fetch_array($sql);
}
if(isset($_GET['delete_id']))
{
$id = $_GET['delete_id'];
$sql = mysqli_query($cn, "update `tbl_dealer` SET `status`=0 where id='$id'");
echo '<div class="alert alert-danger"><strong>Danger!</strong> Dealer Deleted Successfully.</div>';
}
?>
<div class="col-md-12">
<div class="card">
<div class="card-body">
<h4 class="card-title"><?php if(isset($_GET['edit_id'])){ echo "Edit Online Dealer";}else{ echo "Online Dealer";}?></h4>
<form class="forms-sample" method="post" enctype="multipart/form-data">
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputCity1">Dealer Name</label>
<input type="hidden" name="edit_id" value="<?php if(isset($_GET['edit_id'])) {echo $sqlData['id'];}?>">
<input type="text" class="form-control" name="name" value="<?php if(isset($_GET['edit_id'])) { echo $sqlData['name'];}?>" placeholder="Dealer Name" required>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputCity1">Mobile No.</label>
<input type="text" class="form-control" name="mobile" value="<?php if(isset($_GET['edit_id'])) { echo $sqlData['mobile'];}?>" placeholder="Mobile" required>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputCity1">Email</label>
<input type="text" class="form-control" name="email" value="<?php if(isset($_GET['edit_id'])) { echo $sqlData['email'];}?>" placeholder="Email" required>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputCity1">GST </label>
<input type="text" class="form-control" name="gst" value="<?php if(isset($_GET['edit_id'])) { echo $sqlData['gst'];}?>" placeholder="GST" required>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="exampleInputCity1">Address</label>
<textarea class="form-control" name="address" placeholder="Dealer Address" required><?php if(isset($_GET['edit_id'])) {echo $sqlData['address'];}?></textarea>
</div>
</div>
</div>
<button type="submit" class="btn btn-success mr-2" name="<?php if(isset($_GET['edit_id'])) {echo "edit";}else{ echo "add";}?>">Submit</button>
</form>
</div>
</div>
</div>
<br><br>
<div class="col-lg-12 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<h4 class="card-title">Online Dealer List</h4>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>S.No.</th>
<th>Name</th>
<th>Email</th>
<th>Mobile No.</th>
<th>Address</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$i = 1;
$sqlEmployee = mysqli_query($cn,"SELECT * FROM `tbl_dealer` where `status`=1 order by name");
while($sqlEmployeeData = mysqli_fetch_array($sqlEmployee))
{?>
<tr>
<td><?php echo $i++;?></td>
<td><?php echo $sqlEmployeeData['name'];?></td>
<td><?php echo $sqlEmployeeData['email'];?></td>
<td><?php echo $sqlEmployeeData['mobile'];?></td>
<td><?php echo $sqlEmployeeData['address'];?></td>
<td>
<div class="btn-group dropdown">
<button type="button" class="btn btn-success dropdown-toggle btn-sm" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Action</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="?pages=onlineDealer&edit_id=<?php echo $sqlEmployeeData['id'];?>"><i class="icon-eye"></i> Edit</a>
<a class="dropdown-item" href="?pages=onlineDealer&delete_id=<?php echo $sqlEmployeeData['id'];?>"><i class="icon-eye-blocked"></i>Delete</a>
</div>
</div>
</td>
</tr>
<?php }?>
</tbody>
</table>
</div>
</div>
</div>
</div>
Hacked By AnonymousFox1.0, Coded By AnonymousFox