خرید بک لینک

Vote count: 0

I have an html page and I need to load some usual information(can be seen by all people) from DB.

so I put this code in the html:

<script type="text/javascript">
    $(document).ready( function() {
        setTimeout( "getRate()", 100 );
    });

    function getRate() {
        $.ajax( {
            type: "GET",
            url: "api.php",
            dataType: "json",
            data: {call: 'getRate'},
            success: function(result){

               //set result to the DOM element....

            },
            error: function(){

            }
        });
    }
</script>

and I have a api.php file like this:

<?php

if($_SERVER['REQUEST_METHOD']=="GET") {
    $function = $_GET['call'];
    if($function == "getRate") {
       //get result from DB

        echo json_encode(result);
    }
}

but my code reviewer said that when put this url in the browser directly "https://****.com/api.php?call=getRate", it also retued the json result,is it safe??

well there is no secret information requested by the ajax call,so it's I think it's OK , but I'm not sure.

Is there any security risk for doing like this?

asked 3 mins ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 4 خرداد 1395 ساعت: 9:10

صفحه بندی