query("SELECT username, sip_password, enabled FROM app_users WHERE BINARY username = '$username' AND enabled = 1"); $confdatafromdb = $querysel->fetch_assoc(); // Decrypt the SIP password fetched from the database if ($confdatafromdb['sip_password'] != '' && $confdatafromdb['sip_password'] != null && $confdatafromdb['sip_password'] != 'undefined') { $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: roundpin-login.php"); } ?>