Jump to content

javascript login

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
Demodog

Demodog

    Newbie

  • Members
  • Pip
  • 9 posts
I create a javascript that onload of page prints out two textboxes that let people put in username and password and when user press submit it uses ajax and calls a login.php page which compares name and pass to whats in the mysql database. If it exists it sends a "yes" back to the javascript along with users data. The login textboxes then disappears and the true page appears using new DIV contents (the page never reloads). If the name and pass does not exist in database then javascript simply prints "wrong username/pass" and let the login textboxes remain.

My question is, is this safe?

How can it be exploited in compare to a php session? As I understand you cant make an ajax call from another server so it should be safe from people making an own javascript? Ofcourse you can always see in code that ajaxcall is being made to login.php page and that page can be loaded directly but it will not echo any data without the right name and pass.

#2
Demodog

Demodog

    Newbie

  • Members
  • Pip
  • 9 posts
I understand now that sending variables with AJAX for storing in mysql is pretty much open for users to manipulate. If I have to send variables like move.php=?hej or with POST and GET it will be open for anyone to make an own page linking to mine and adding not legal values

#3
amrosama

amrosama

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 8,674 posts
use this in JS:

var escapedstr=escape("move.php=?hej")
then use it like a regular string
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
www.amrosama.com | the unholy methods of javascript

#4
Demodog

Demodog

    Newbie

  • Members
  • Pip
  • 9 posts
how does that help?