Welcome Guest, Not a member yet? Register   Sign In
Dynamic form field evalutation
#1

(This post was last modified: 01-11-2021, 06:55 PM by bogus.)

Hello

I want to evaluate user form field input 'as she types' versus the database to check if the value already exists (ex. username).
If this is the case I want to inform her interactively below the form field. I guess you have a grasp of what I mean.

How can I accomplish that?
Any code examples?

Any help as always very appreciated.

Cheers

Gee
The only absolute knowledge attainable by man is that life is meaningless. (Tolstoi)
Reply
#2

Then you would need to use JavaScript or jQuery to do it.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

I was afraid so :-(

Don't like these technologies.
The only absolute knowledge attainable by man is that life is meaningless. (Tolstoi)
Reply
#4

You need to use Javascript to make an AJAX call to the database whenever your user types. However, it is not advisable to use that method on usernames and other sensitive information because it can be exploited by malicious people using brute force attacks.
Reply
#5

(This post was last modified: 01-12-2021, 03:05 PM by bogus.)

Interesting and a valid answer.
However, if someone wants to brute or map the db she can try.
As long the db is set up properly (escaping), the username and password inputs are sanitized and both have appropriate length the attacker can hack himself to death because Apache too does a pretty nice job to prevent things like that... correct?

The only remaining thing to fear here is a quantum computer or worse.... a cluster of it.
Then we are all through and you'll never know when it hits .-\
Sometimes totally paranoid I dream' about it in conjunction with nano-tech...

Nice scenario right?

I'd find it rather annoying to redirect the user every time he has chosen a username just to try again until he finally found some valid one.

Although I appreciate your engagement I don't like to ask for help to find a solution just to be confronted with another problem.
That's not very productive.

Any suggestions?
The only absolute knowledge attainable by man is that life is meaningless. (Tolstoi)
Reply
#6

(This post was last modified: 01-12-2021, 03:02 PM by includebeer.)

You can use the Throttler class to limit the number of request for that particular service. This way, brute force attack are somewhat disabled because they can’t call the service 100 times per second, you force them to wait a certain amount of time before they are allowed to call it again.

And like others have already said, you will need javascript to accomplish this. It’s easy to do if you know javascript. There are tons of example on the web. You just need to fire an event on your input field when a key is pressed, that will launch an ajax request to validate the input text.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#7

(01-12-2021, 03:01 PM)includebeer Wrote: You can use the Throttler class to limit the number of request for that particular service. This way, brute force attack are somewhat disabled because they can’t call the service 100 times per second, you force them to wait a certain amount of time before they are allowed to call it again.

And like others have already said, you will need javascript to accomplish this. It’s easy to do if you know javascript. There are tons of example on the web. You just need to fire an event on your input field when a key is pressed, that will launch an ajax request to validate the input text.


Nice.
Yes, I put an eye on it already a whole ago besides thinking about an own implementation.
Thumbs up!
The only absolute knowledge attainable by man is that life is meaningless. (Tolstoi)
Reply




Theme © iAndrew 2016 - Forum software by © MyBB