ok
Direktori : /home2/selectio/public_html/salemgovtitialumni.in/dashboard/admin/ |
Current File : /home2/selectio/public_html/salemgovtitialumni.in/dashboard/admin/paid_member_edit.php |
<?php require_once('header.php'); ?> <?php if(isset($_POST['form1'])) { $valid = 1; if(empty($_POST['status'])) { $valid = 0; $error_message .= 'Status can not be empty<br>'; } if(empty($_POST['name'])) { $valid = 0; $error_message .= 'Name can not be empty<br>'; } if(empty($_POST['mobile_no'])) { $valid = 0; $error_message .= 'Mobile can not be empty<br>'; } $path = $_FILES['photo']['name']; $path_tmp = $_FILES['photo']['tmp_name']; if($path!='') { $ext = pathinfo( $path, PATHINFO_EXTENSION ); $file_name = basename( $path, '.' . $ext ); } if($valid == 1) { $statement = $pdo->prepare("UPDATE tbl_membership_payment SET name=?,mobile_no=?, status=? WHERE id=?"); $statement->execute(array($_POST['name'],$_POST['mobile_no'],$_POST['status'],$_REQUEST['id'])); if(isset($_POST['current_photo']) && ($_POST['current_photo'] != '')){ unlink('../assets/uploads/important/'.$_POST['current_photo']); $final_name = 'service-'.$_REQUEST['id'].'.'.$ext; move_uploaded_file( $path_tmp, '../assets/uploads/important/'.$final_name ); $image_path ='assets/uploads/important/'.$final_name; $statement = $pdo->prepare("UPDATE tbl_important_links SET image=? WHERE id=?"); $statement->execute(array($image_path,$_REQUEST['id'])); } $success_message = 'Paid membershi is updated successfully!'; } } ?> <?php if(!isset($_REQUEST['id'])) { header('location: logout.php'); exit; } else { // Check the id is valid or not $statement = $pdo->prepare("SELECT * FROM tbl_membership_payment WHERE id=?"); $statement->execute(array($_REQUEST['id'])); $total = $statement->rowCount(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); if( $total == 0 ) { header('location: logout.php'); exit; } } ?> <section class="content-header"> <div class="content-header-left"> <h1>Edit Paid Members</h1> </div> <div class="content-header-right"> <a href="paid_member.php" class="btn btn-primary btn-sm">View All</a> </div> </section> <?php $statement = $pdo->prepare("SELECT * FROM tbl_membership_payment WHERE id=?"); $statement->execute(array($_REQUEST['id'])); $result = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($result as $row) { $status = $row['status']; $name = $row['name']; $mobile_no = $row['mobile_no']; $photo = $row['photo']; } ?> <section class="content"> <div class="row"> <div class="col-md-12"> <?php if($error_message): ?> <div class="callout callout-danger"> <p> <?php echo $error_message; ?> </p> </div> <?php endif; ?> <?php if($success_message): ?> <div class="callout callout-success"> <p><?php echo $success_message; ?></p> </div> <?php endif; ?> <form class="form-horizontal" action="" method="post" enctype="multipart/form-data"> <div class="box box-info"> <div class="box-body"> <?php if($result[0]['type']==2){ ?> <div class="form-group"> <label for="" class="col-sm-2 control-label">Name <span>*</span></label> <div class="col-sm-6"> <input type="text" autocomplete="off" class="form-control" name="name" value="<?=$name?>" required> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">Mobile No <span>*</span></label> <div class="col-sm-6"> <input type="number" autocomplete="off" class="form-control" name="mobile_no" value="<?=$mobile_no?>" required> </div> </div> <?php } ?> <div class="form-group"> <label for="" class="col-sm-2 control-label"> Status <span>*</span></label> <div class="col-sm-6"> <select name="status" class="form-control"> <option value="1" <?php if($status == '1') {echo 'selected';} ?>>Active</option> <option value="0" <?php if($status == '0') {echo 'selected';} ?>>In-Active</option> </select> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">Upload New Document </label> <div class="col-sm-9" style="padding-top:5px"> <input type="file" name="photo" class=""> <input type="hidden" name="current_photo" value="<?= $photo ?>" > <a target="_blank" href="https://www.salemgovtitialumni.in/dashboard/<?=$photo?>" class="btn btn-primary btn-xs" style="margin-top:4%;" >View Old Document</a> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label"></label> <div class="col-sm-6"> <button type="submit" class="btn btn-success pull-left" name="form1">Submit</button> </div> </div> </div> </div> </form> </div> </div> </section> <?php require_once('footer.php'); ?>