doushai7225 2014-06-30 04:04
浏览 97
已采纳

加密PHP的JSON编码

I'm currently trying to make a email verification sender in case an individual didn't receive the email to verify their account. Where my issue comes in is that I have to echo the individuals email into javascript (along with their name and other things). I don't want individuals to open the source code and see that their email is there within javascript, is there a way that I can encrypt this json encode? Here is my script for Verification.php

<script type="text/javascript">
$(document).ready(function() {
    $("#cliq").click(function() { 
        //get input field values
        var ndxr = <?php $to_Email = $_SESSION['SESS_CONTROL_EMAIL']; echo json_encode($to_Email); ?>;
        var fvje = <?php $vcode = $_SESSION['SESS_CONTROL_VCODE']; echo json_encode($vcode); ?>;
        var name = <?php $name = $_SESSION['SESS_CONTROL_FIRST']; echo json_encode($name); ?>;
        var proceed = true;
        if(proceed) 
        {
            post_data = {'ndxr':ndxr, 'fvje':fvje, 'name':name};
            $.post('verifye.php', post_data, function(response){  
                if(response.type == 'error')
                {
                    output = '<div class="error">'+response.text+'</div>';
                }else{
                    output = '<div class="success">'+response.text+'</div>';
                }
                $("#result").hide().html(output).slideDown();
            }, 'json');
        }
    });

});
</script>

And here is the verification page Verifye.php

$name        = filter_var($_POST["name"], FILTER_SANITIZE_STRING);
$user_Email       = filter_var($_POST["ndxr"], FILTER_SANITIZE_EMAIL);
$vcode       = filter_var($_POST["fvje"], FILTER_SANITIZE_STRING);

Any way of preventing the user's email from displaying?

  • 写回答

2条回答 默认 最新

  • dongpo2014 2014-06-30 04:21
    关注

    Don't display it at all! If all this data is present in your session, there's no need to pass it to the user in the first place — the script that you're POSTing to from AJAX can pull that data out of the session itself.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 phython如何实现以下功能?查找同一用户名的消费金额合并—
  • ¥15 孟德尔随机化怎样画共定位分析图
  • ¥18 模拟电路问题解答有偿速度
  • ¥15 CST仿真别人的模型结果仿真结果S参数完全不对
  • ¥15 误删注册表文件致win10无法开启
  • ¥15 请问在阿里云服务器中怎么利用数据库制作网站
  • ¥60 ESP32怎么烧录自启动程序
  • ¥50 html2canvas超出滚动条不显示
  • ¥15 java业务性能问题求解(sql,业务设计相关)
  • ¥15 52810 尾椎c三个a 写蓝牙地址