0

I've read about MySQL injection and how it's done. I have a doubt, how could a login code be attacked if it doenst get data from a database?

This is what my login code looks like:

if($_GET['login'] == "myname" && $_GET['password'] == "mypass"){
     echo 'welcome, admin.';
else
     echo 'login failed.'

ps: this is for practice sake only, I know hardcoded passwords shouldnt be used.

1
  • 2
    That is completely fine and impossible to get around. :) Commented Apr 30, 2012 at 4:54

1 Answer 1

3

If there's no SQL database, there is no SQL injection.

The other common thing to watch out for is potential for XSS. This can be handled by simply escaping any user output. Since you don't output anything from the user at all in your example code, then I see no problem.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.