Securing variable transfer from js to php | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Securing variable transfer from js to php

I was working on this project where I needed to send some variable values to a php script so that I can store the data in a text file on server side. The method I used was "$.post" which works just fine but now the thing that is bothering me is that anyone could send the values to that php script with this method which is not what I want because that can ruin the data I'm storing. So, is there any way to make php receive value from a specific JavaScript or Micro-controller (since I'm using the same method to send some sensor data to a php) so that other can't send data to it. I'm also open for any better alternative than this. Thank you.

31st Dec 2018, 12:46 PM
Mayank Dhillon
Mayank Dhillon - avatar
2 Réponses
+ 3
No there's not.
31st Dec 2018, 4:50 PM
Toni Isotalo
Toni Isotalo - avatar
0
I think I've phrased my question in a wrong manner and to avoid such possibility I asked for an alternative if possible. I was hoping for an easier solution but I guess I will have to go change my approach because this solution at stackoverflow makes more sense https://stackoverflow.com/questions/37912937/how-to-send-secure-ajax-requests-with-php-and-jquery
31st Dec 2018, 6:22 PM
Mayank Dhillon
Mayank Dhillon - avatar