<?php

$r = array();
require_once __DIR__ . '/db_config.php';
require_once __DIR__ . '/encrypt.php';

if (isset($_POST["email"])) {
        
$con = mysqli_connect(DB_SERVER, DB_USER, DB_PASSWORD,DB_DATABASE) or die(mysql_error());

$email = $_POST['email'];
$time = $_POST['time'];
$version_code = $_POST['version_code'];
$version_name = $_POST['version_name'];
$installed_on = $_POST['installed_on'];
$updated_on = $_POST['updated_on'];

$pass=new encryptdecrypt;
$decoded_password=$pass->encrypt($password);

$query="UPDATE signupdetails 
SET version_code='$version_code',version_name='$version_name',installed_on='$installed_on',updated_on='$updated_on',lastlogin='$time'
WHERE emailid='$email'";

    $result = mysqli_query($con,$query);
    if(!empty($result)){
        $r["s"] = 1;
        $r["m"] ="Details Updated";
    }else{
        $r["s"] = 0;
        $r["m"] ="Check your email";
    }
mysqli_close($con);               
echo json_encode($r);
}
?>