首页 \ 问答 \ 如何保护我的连接字符串?(How to secure my connection string? powershell + xml)

如何保护我的连接字符串?(How to secure my connection string? powershell + xml)

我将连接字符串存储在XML文件中。 然后我在PowerShell脚本中使用它。 有没有办法保护它/以某种方式加密它?


I store my connection-string in XML file. Then i use it in powershell script. Is there a way to secure it/to encrypt it somehow?


原文:https://stackoverflow.com/questions/2183433
更新时间:2023-04-23 16:04

最满意答案

你想要使用一个cookie,简单地将它设置为24小时后死亡,然后检查它是否已经过期如果它再次显示弹出窗口

//来自http://www.w3schools.com/的 Javascript版本示例

function setCookie(cname,cvalue,exdays)
{
var d = new Date();
d.setTime(d.getTime()+(exdays*24*60*60*1000));
var expires = "expires="+d.toGMTString();
document.cookie = cname + "=" + cvalue + "; " + expires;
}

function getCookie(cname)
{
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++) 
  {
  var c = ca[i].trim();
  if (c.indexOf(name)==0) return c.substring(name.length,c.length);
  }
return "";
}
if(getCookie('jquery_popup') ==""){
setCookie('jquery_popup','sessionexists',1);
//Add code to display popup here
}

PHP方法

if(!isset($_COOKIE['jquery_popup'])){
setcookie("jquery_popup", 'sessionexists', time()+3600*24); 
//Add code to display popup here
}

you would wanna use a cookie, simple set it to die after 24 hours and then check if it has expired if it has you show the popup again

//Javascript version example taken from http://www.w3schools.com/

function setCookie(cname,cvalue,exdays)
{
var d = new Date();
d.setTime(d.getTime()+(exdays*24*60*60*1000));
var expires = "expires="+d.toGMTString();
document.cookie = cname + "=" + cvalue + "; " + expires;
}

function getCookie(cname)
{
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++) 
  {
  var c = ca[i].trim();
  if (c.indexOf(name)==0) return c.substring(name.length,c.length);
  }
return "";
}
if(getCookie('jquery_popup') ==""){
setCookie('jquery_popup','sessionexists',1);
//Add code to display popup here
}

PHP Method

if(!isset($_COOKIE['jquery_popup'])){
setcookie("jquery_popup", 'sessionexists', time()+3600*24); 
//Add code to display popup here
}

相关问答

更多
  • http://jsfiddle.net/TGQXc/ var today = new Date(); var first = new Date(today.getFullYear(), 0, 1); var theDay = Math.round(((today - first) / 1000 / 60 / 60 / 24) + .5, 0); if (theDay == 298)alert("It is day 298! Yahtzee!") 使用此方法可以获取一年中的某一天并针对特定日期进行测试。 ...
  • 我会在$ .get()调用之后立即使用.done()方法来重新应用滑块。 $.get('http://yourajax.call').done(function(){ $("#persistence-slider").slider(); $("#spread-slider").slider() }); Found the problem. I had mistakenly created the /div/ for the popup box two times. This led to ...
  • 你能试试这个吗? 奥马尔的积分感谢纠正我:) Can you try this one ??