D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
u166148318
/
domains
/
avrd.org
/
public_html
/
admin
/
Filename :
update.php
back
Copy
<?php include '../components/connect.php'; $select_profile = $conn->prepare("SELECT * FROM `admin` WHERE id = '".$_GET['get_id']."'"); $select_profile->execute(); $fetch_profile = $select_profile->fetch(PDO::FETCH_ASSOC); if(isset($_POST['submit'])){ $name=$_POST['name']; $email=$_POST['email']; $ad_num=$_POST['ad_num']; $rec_pass= $fetch_profile['password']; $old_pass=$_POST['old_pass']; $old_pass2=crypt($old_pass, './0-9A-Za-z'); $new_pass=$_POST['new_pass']; $c_pass=$_POST['c_pass']; $c_pass2=crypt($c_pass, './0-9A-Za-z'); if($rec_pass != $old_pass2){ $warning_msg[] = 'Old Password is Wrong!'; }else{ if ($new_pass == $c_pass){ $UPDATE = "UPDATE admin SET username='$name', email='$email', password='$c_pass2', phone='$ad_num' WHERE id='".$_GET['get_id']."'"; $result = $conn->exec($UPDATE); if($result){ $success_msg[] = 'Admin updated successfully!'; }else{ $warning_msg[] = 'Ooopps Failed to Update!'; } }else{ $warning_msg[] = 'Your New Password And Confirm Password Dont match!'; } } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Update</title> <!-- font awesome cdn link --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css"> <!-- custom css file link --> <link rel="stylesheet" href="./css/admin_style.css"> </head> <body> <!-- header section starts --> <?php include '../components/admin_header.php'; ?> <!-- header section ends --> <!-- update section starts --> <section class="form-container"> <form action="" method="POST"> <h3>update profile</h3> <?php if (isset($_SESSION['aid'])) { ?> <input type="text" name="name" value="<?php echo $_SESSION["aname"]; ?>" maxlength="30" class="box"> <input type="text" name="email" value="<?php echo $_SESSION["aemail"]; ?>" maxlength="30" class="box"> <input type="text" name="ad_num" value="<?php echo $_SESSION["acontact"]; ?>" maxlength="30" class="box"> <?php } ?> <input type="password" name="old_pass" placeholder="enter old password" maxlength="20" class="box" oninput="this.value = this.value.replace(/\s/g, '')" required> <input type="password" name="new_pass" placeholder="enter new password" maxlength="20" class="box" oninput="this.value = this.value.replace(/\s/g, '')" required> <input type="password" name="c_pass" placeholder="confirm new password" maxlength="20" class="box" oninput="this.value = this.value.replace(/\s/g, '')" required> <input type="submit" value="update now" name="submit" class="btn"> </form> </section> <!-- update section ends --> <script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js"></script> <!-- custom js file link --> <script src="./js/admin_script.js"></script> <?php include '../components/message.php'; ?> </body> </html>