下面的代码用于初始化firebase,通过检查浏览器中的元素,每个firebase都可以看到它。人们可能会滥用我的firebase数据库。是否有任何方法可以使配置文件对public不可见,因此即使在浏览器中检查元素时,代码也不可见。我已经关注了关于堆栈溢出的相同问题的一些帖子,但我无法得到解决方案。
以下是配置文件的代码片段:
<script src="../js/jquery2.0.3.min.js"></script>
<script>
var text=[
{
"userid" : "dfhsfgdsjfghdjsghdjs",
"username" :"Md Mubarik",
"usermobile" : 9871492281,
"useremail" :"mdmubarik05@gmail.com",
"userpassword" : "#$md786"
}];
</script>
<?php
$data=array();
$url="http://localhost/restapi/user/insertuser.php";
$json_data=file_get_contents($url);
$data=json_decode($json_data);
$userid=$data->userid;
$username=$data->username;
$usermobile=$data->usermobile;
$useremail=$data->useremail;
$userpassword=$data->userpassword;
?>
<script>
var userid=<?php echo $userid;?>;
var username=<?php echo $username;?>;
var usermobile=<?php echo $usermobile;?>;
var useremail=<?php echo $useremail;?>;
var password=<?php echo $userpassword;?>;
$(document).ready(function(){
$.ajax({
type:'POST',
url:'insertuserdata.php',
data:{'userid':userid,'username':username,'usermobile':usermobile,'useremail':useremail,'password':password},
success: function(data){
alert(data);
}
});
});
</script>