首页 \ 问答 \ 如何在网页中隐藏来自mandrillapp的私钥(How to hide my private key from mandrillapp in webpage)

如何在网页中隐藏来自mandrillapp的私钥(How to hide my private key from mandrillapp in webpage)

我已成功创建并在mandrill中添加了密钥,并可以从我在此处托管的javascript页面发送电子邮件:

http://goo.gl/2YSwj7

但我遇到的问题是我的mandrill键是公开可见的(在contact_me.js文件中)

我曾尝试使用mandrill密钥选项仅从某些IP地址启用密钥,但这不起作用! (我已经在关键选项限制中输入了github的ip,但实际上我们不是从那里发送它,而是从用户浏览器发送,对吧?)

如果有人有一些想法,如何解决这个问题,从浏览器发送电子邮件,并仅在该页面上限制它,我会很高兴听到它,

谢谢,oserk +


I have successfully created and added the key in mandrill and can send email from my javascript page hosted here:

http://goo.gl/2YSwj7

but I'm having the issue that my mandrill key is publicly visible (in contact_me.js file)

I have tried to use mandrill key option to enable key only from certain ip addresses but that does not work! ( I have entered github's ip's in key option restrictions but actually we are not sending it from there, but from users browser, right? )

If someone have some idea, how to workaround that, to send email from browser, and restrict it on that page only, I'd be very glad to hear it,

thanks, oserk+


原文:https://stackoverflow.com/questions/28503156
更新时间:2024-03-31 12:03

最满意答案

j循环之前,添加一个条件:

if (flag[i] == 0) 

另外,使用vectors和push_back动态构建storesymstorefreq数组

int flag[256];//this flag is to know if the alphabet is already counted or not.If counted that i set it to "1" other wise it is "0".Please see below in my code
int j = 0,i;
std::vector<char> storesym;
std::vector<int> storefreq;
for (i = 0; i < count; i++)
  flag[i] = {0};
int fcount1 = 0;
for (i = 0; i < count; i++) 
{
    if (flag[i] == 0)
    {
        for (j = i; j < count; j++) 
        {
           if (data[i].symbol == data[j].symbol && flag[j] == 0) 
           {
              fcount1++;
              flag[j] = 1;//**I am setting flag to 1 those alphabets to 1 so that they will not be counted again on next iteration**
           }
        }
        storesym.push_back( data[i].symbol );
        storefreq.push_back( fcount1 );
    }
    fcount1 = 0;
}
cout << endl;
for (i = 0; i < storesym.size(); i++) 
{
    cout << "storesym[i] :" << storesym[i] << endl;//it stores the symbol. 
    cout << "storefreq[i] :" << storefreq[i] << endl;//it stores the frequency.
}

Just before the j loop, add a condition:

if (flag[i] == 0) 

Also, build the storesym and storefreq arrays dynamically using vectors and push_back

int flag[256];//this flag is to know if the alphabet is already counted or not.If counted that i set it to "1" other wise it is "0".Please see below in my code
int j = 0,i;
std::vector<char> storesym;
std::vector<int> storefreq;
for (i = 0; i < count; i++)
  flag[i] = {0};
int fcount1 = 0;
for (i = 0; i < count; i++) 
{
    if (flag[i] == 0)
    {
        for (j = i; j < count; j++) 
        {
           if (data[i].symbol == data[j].symbol && flag[j] == 0) 
           {
              fcount1++;
              flag[j] = 1;//**I am setting flag to 1 those alphabets to 1 so that they will not be counted again on next iteration**
           }
        }
        storesym.push_back( data[i].symbol );
        storefreq.push_back( fcount1 );
    }
    fcount1 = 0;
}
cout << endl;
for (i = 0; i < storesym.size(); i++) 
{
    cout << "storesym[i] :" << storesym[i] << endl;//it stores the symbol. 
    cout << "storefreq[i] :" << storefreq[i] << endl;//it stores the frequency.
}

相关问答

更多

相关文章

更多

最新问答

更多
  • linux环境下怎么用maven编译一个已有的java项目?
  • Ionic2和IonicDeploy(Ionic2 and IonicDeploy)
  • 尝试分组和别名数据时出错(Error when Attempting to Group and Alias Data)
  • Facebook PHP API错误代码100:API中提供的appsecret_proof无效(Facebook PHP API Error code 100: Invalid appsecret_proof provided in the API)
  • 不用u盘和光盘怎么安装linux系统
  • 表名作为变量参数(Table name as variable parameter)
  • 我想学计算机 在望京花园住 附近那有这样的地方可以学
  • 删除原始记录的重复项(Removing duplicates with original records)
  • Pandas:使用.astype(str)时忽略空值?(Pandas: ignore null values when using .astype(str)?)
  • Python新手阵列 - 列表转换[重复](Python newbie array - list conversion [duplicate])
  • java.lang.String cannot be cast to java.lang.Float
  • 带参数的选择器(Selector with argument)
  • python中的for循环语法(for loop syntax in python)
  • Nunit - 无法检索类别属性(NUnit - Can't retrieve a category property)
  • python3 xpath无法到达子节点(AttributeError:'NoneType'对象没有属性'text')(python3 xpath can't reach a child node (AttributeError: 'NoneType' object has no attribute 'text'))
  • Android自动 - 如何启用开发人员模式(Android auto - how to enable developer mode)
  • java weka stringtowordvector没有正确计算单词出现次数(java weka stringtowordvector is not counting word occurences properly)
  • 如何解释DHT响应中的“节点”?(How to interpret 'nodes' in a DHT response?)
  • 什么是使用opencv和树莓相机模块进行人脸检测的最佳算法(What is the best algorithm for face detection using opencv and raspberry camera module)
  • 可以somone解释这两个问题的解决方案(c程序,mutex,线程)吗?(Can someone explain the solution of these two questions (c program,mutex,threads)?)
  • 如何解决SyntaxError:意想不到的令牌var gulp(How to fix SyntaxError: Unexpected token var in gulp)
  • 在满足R中的第一个实例后,在所有行中分配值(Assign value in all rows following satisfaction of first instance in R)
  • 如何记录Atk4 auth /登录事件(How to log Atk4 auth/login event)
  • 是否有必要在新的scala项目中添加我的自定义scala库依赖项?(is it necessary to add my custom scala library dependencies in new scala project?)
  • Java中对象类的继承(Inheritance of Object Class in Java)
  • 如何在jquery自动完成中获取当前元素?(How to get current element in jquery autocomplete?)
  • 学电子商务甚么大学好
  • @Override在java中(@Override in java)
  • 虚拟机中怎么给linux装office
  • Laravel邮件参数(sendmail / smtp)(Laravel mail parameters (sendmail/smtp))