-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrypton.php
More file actions
34 lines (32 loc) · 1.18 KB
/
crypton.php
File metadata and controls
34 lines (32 loc) · 1.18 KB
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
<!--Developed by SAHIL G. KALYANI and SHUBHAM GUPTA-->
<?php
session_start();
include "dbconnect.php";
if(isset($_SERVER["HTTP_X_REQUESTED_WITH"])){
if(isset($_SESSION['email'])){
$ad = isset($_POST['ardor'])? $_POST['ardor'] : 0;
$de = isset($_POST['design'])? $_POST['design'] : 0;
$ig = isset($_POST['imitation'])? $_POST['imitation'] : 0;
$stmt = $db->prepare("UPDATE users SET ardor = :ad, design = :de, imitation = :ig WHERE email = :email");
$stmt->bindParam(':ad', $ad, PDO::PARAM_INT);
$stmt->bindParam(':de', $de, PDO::PARAM_INT);
$stmt->bindParam(':ig', $ig, PDO::PARAM_INT);
$stmt->bindParam(':email', $_SESSION['email'], PDO::PARAM_STR);
$stmt->execute();
$affected_rows = $stmt->rowCount();
if($affected_rows == 1){
echo json_encode(['code'=>200, 'email'=>$_SESSION['email'], 'name'=>$_SESSION['name'], 'ardor'=>$ad,
'design'=>$de, 'imitation'=>$ig]);
exit;
}
else{
json_encode(['code'=>400]);
exit;
}
}
else{
echo json_encode(['code'=> 300]);
}
}
?>
<!--Developed by SAHIL G. KALYANI and SHUBHAM GUPTA-->