prepare("SELECT username, sip_password, enabled FROM app_users WHERE BINARY username = ? AND enabled = ?"); $querysel->bind_param("si", $username, $enabled); $querysel->execute(); $confdatafromdbinit = $querysel->get_result(); $confdatafromdb = $confdatafromdbinit->fetch_assoc(); // Decrypt the SIP password fetched from the database // if ($confdatafromdb['sip_password'] != '' && $confdatafromdb['sip_password'] != null && $confdatafromdb['sip_password'] != 'undefined') { if ($confdatafromdb['sip_password']) { $psswdaddedkey = file_get_contents('../restr/'.$username.'/pwdkey'); $componentsippsswd = explode(':', $confdatafromdb['sip_password']); $encpwdin = $componentsippsswd[0]; $ivkey = $componentsippsswd[1]; $sippassworddec = openssl_decrypt($encpwdin, 'AES-256-CBC', $psswdaddedkey, false, $ivkey); $sipdatafromdb = $sippassworddec; } else { $sipdatafromdb = ''; } echo json_encode($sipdatafromdb); } else { header("Location: ../login.php"); } ?>