Hi all. I have an html form, created to remind club members of a forgotten members' area password. That is not the issue though. The issue is that I have member's information in an external .js file. The members' data is obscured and appears like this array snippet {mno:"54",Llast4:"9748",Mlast4:"3752",pc:"149"},
{mno:"56",Llast4:"",Mlast4:"5829",pc:"149"},
{mno:"57",Llast4:"4483",Mlast4:"1983",pc:"148"},
{mno:"59",Llast4:"4798",Mlast4:"7501",pc:"70"},
{mno:"61",Llast4:"1204",Mlast4:"1204",pc:"148"}, and I want to create a .php file, so that prying eyes or bots cannot see this data and my html file will interrogate the .php file to gain confidence of membership authenticty. Where do I go from here. Help someone please. Thanks. idarpe.
Top comments (2)
Hi idarpe,
You're on the right track by moving the member data out of the JavaScript file. Anything included in JavaScript sent to the browser can be viewed or downloaded, even if the data is obscured.
However, there's an important distinction: the PHP file should validate the submitted information, not return the member records to the browser.
A simple approach would be:
POST.For example, your JavaScript could submit the form data like this:
On the PHP side, you could start with something like:
This is only a starting point, not a complete password recovery implementation.
One more important point: The last four digits of personal information are not strong authentication credentials. Someone may be able to guess or discover them.
For password recovery, I'd strongly recommend sending a short-lived, single-use reset link to the email address already registered for that member, rather than displaying or returning their password.
You should also add rate limiting to prevent automated guessing, and avoid revealing whether a particular membership number exists.
So yes, PHP is a good solution here. The key is to keep verification and password recovery entirely on the server.
Hope this helps! A little more detail about how your current form checks those fields would make it easier to suggest the smallest safe change.
Many thanks