4 Replies - 1109 Views - Last Post: 15 November 2009 - 05:47 AM

#1 krizjaz   User is offline

  • D.I.C Head
  • member icon

Reputation: 20
  • View blog
  • Posts: 99
  • Joined: 07-October 07

Is this for Javascript-PHP-MySQL?

Posted 12 November 2009 - 10:27 AM

Hi everyone. I would like to ask if this problem is good or recommended to use Javascript-PHP-MySQL.
* The problem here is:
- I have 2 HTML textfield. The first one for the username input and the other one for password input. If the user inputs his username, at the right side of the username textfield there should appear a text "Username found!" if the username is found. If not, "Username not found". And at the password textfield, if the user inputs the correct password, it would automatically be logged-in to the site. If not, at the right side of the password textfield there would appear a text "Incorrect Password!". There is no longer a button to be pressed for log-in. Should I use onkeyup for this? My plan is when the user press a key (letters) on the keyboard, it would then query the letters or the formed letters in the database. Successive strokes from the keys should stop the querying and only when the user stops pressing, it would then query. Also, this is implemented to the password textfield. Does anyone give me any piece of advice for this?

----> This is not my assignment :). It's just a challenge in my mind and i just don't know how to implement this. I know the PHP and the querying stuffs. . I just have no idea about Javascript. But i know Java a lot. I think Javascript and Java are not quite the same in terms of the code. Is it? :P
I'm a newbie in Javascript, can anyone help me with this simple problem? I'm not interested with the whole code. Just the idea. . :) Thanks in advance!

This post has been edited by krizjaz: 12 November 2009 - 10:28 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Is this for Javascript-PHP-MySQL?

#2 thehat   User is offline

  • awake ? web();
  • member icon

Reputation: 106
  • View blog
  • Posts: 951
  • Joined: 28-February 08

Re: Is this for Javascript-PHP-MySQL?

Posted 12 November 2009 - 10:43 AM

Technically this is definitely something you could achieve with AJAX, that is to say javascript->php->mysql. The only thing I would be wary of this that users expect to have a button to click, or a requirement to press enter. Having the application sign in as soon as it detects the correct information could be considered to act against usability. Whether that is something that should concern you entirely depends on the nature of the application and it's target audience.
Was This Post Helpful? 1
  • +
  • -

#3 krizjaz   User is offline

  • D.I.C Head
  • member icon

Reputation: 20
  • View blog
  • Posts: 99
  • Joined: 07-October 07

Re: Is this for Javascript-PHP-MySQL?

Posted 12 November 2009 - 10:58 AM

Ahmm. . This is just for the satisfaction of my thirsty curiosity. The thing here is that it the world is ever-changing and flexible and it is very possible that this plan would be used. Obviously, with a human instinct, no button means there is a certain functionality or feature developed or added. A certain log-in, log-out website would not be considered a complete and finished product of fine coding if the log-in, log-out is not working. Also, a flash video can be embedded in the log-in window for tutorial if they don't know what to do. There are many ways to give the users the procedure. And i think, there is no need for a target audience. This is just my experiment. . :)
Thanks for the idea! I knew it! :)

This post has been edited by krizjaz: 12 November 2009 - 10:59 AM

Was This Post Helpful? 0
  • +
  • -

#4 forest51690   User is offline

  • D.I.C Regular
  • member icon

Reputation: 58
  • View blog
  • Posts: 340
  • Joined: 20-March 09

Re: Is this for Javascript-PHP-MySQL?

Posted 14 November 2009 - 08:05 PM

I agree. AJAX is the best way to do this. But you should be careful not to query the database too many times. If the user types, the db will be queried for every keystroke... But actually, I know they do this with google's autosuggest, etc. So is it actually feasible to do it this way? Either way, I don't think it should be for every keystroke.. I think it should have some sort of timer.

Also, on a note of security, this script can potentially be exploited to brute-force usernames and passwords. The hacker can look up the URL of the database and query his own usernames. So be careful. You should put in place a limit to the amount of queries.
Was This Post Helpful? 1
  • +
  • -

#5 krizjaz   User is offline

  • D.I.C Head
  • member icon

Reputation: 20
  • View blog
  • Posts: 99
  • Joined: 07-October 07

Re: Is this for Javascript-PHP-MySQL?

Posted 15 November 2009 - 05:47 AM

Yes, it was. When the user stops pressing, then it queries. A timer? Hmm. Yes, i think it would be needed. And ahmm. . What do you mean by this?:

Quote

The hacker can look up the URL of the database and query his own usernames. So be careful. You should put in place a limit to the amount of queries.

But i think, PHP is not that easy to be hacked. Or does anyone ever hacked it? Ehehehe! Just kinda curious. Coz in phpdev5, there's a phrase there that PHP is a powerful tool but i'm not kinda convinced.
Ahmmmm. First of all, could a PHP code and a Javascript code be mixed? Like making a function in javascript inside the php code? and vice-versa? I'm so noob about this. . Can anyone give me some links, tutorials about this? Please? I'm very much interested! :)

This post has been edited by krizjaz: 15 November 2009 - 05:52 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1