0

I have an ajax for save address. I have some parameters like username, Address, Location. Now user can see all parameters and is not safe.

ajax code:

$.ajax({ 
        url: 'inc/saveAddress.php',
        data: {"username": window.username,
               "name": name,
               "address": address,
               "lat": window.lats,
               "lng": window.lngs,
               },
        type: 'post',
        success: function(result)
        {
            window.location.replace('https://example.com');
        }
    });

How can I check this requst is from what address by PHP? or anything to safe that.

Alireza
  • 171
  • 3
  • 15

1 Answers1

0

My idea is to create and send a unique key which can know only the server. If key is wrong send an error back.

Daniel Richter
  • 768
  • 5
  • 23
  • 2
    how is that going to help OP ? maybe a comment, but certainly not an answer. – YvesLeBorg Jul 07 '19 at 15:58
  • it helps OP to make it safe. Ok, safer as before. Thatswhy its my answer. btw, user with less then 50 reputations cant comment. ;) and as long users as u disvote my answers so i cant comment for a long time. – Daniel Richter Jul 07 '19 at 16:12