-
Notifications
You must be signed in to change notification settings - Fork 29
/
editProfileHandle.php
39 lines (35 loc) · 1.02 KB
/
editProfileHandle.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
session_start();
$showerror=false;
if(isset($_SESSION['loggedin']) && $_SESSION['loggedin']==true){
if($_SERVER['REQUEST_METHOD']=="POST"){
$name=$_POST['name'];
$college=$_POST['clg'];
$phno=$_POST['phno'];
if(isset($_POST['changePass'])){
$password=$_POST['password'];
$hash=password_hash($password,PASSWORD_DEFAULT);
}
else{
$sql="SELECT * FROM `participant` where `InfId`='$infid'";
$result=mysqli_query($conn,$sql);
if ($result) {
$row=mysqli_fetch_assoc($result);
$hash = $row['Password'];
}
}
$sql = "UPDATE `participant` SET `Name` = '$name' , `Password`='$hash',`College`='$college',`Phone Number`='$phno' WHERE `InfId` = '$infid'";
$result=mysqli_query($conn,$sql);
if ($result) {
header("location:profile.php");
}
else{
$showerror="Error ! Please try again.";
}
}
}else{
header('location:signIn.php');
session_unset();
session_destroy();
}
?>