That login script isn't ideal as a web service login script.  On top of
that it has some problems in general.  Some of these general problems
include:

1. Your SQL query to check for a match is open to an SQL injection attack.
2. This same query will match any username that ends with the provided
username, and contains the provided password.  Therefore I can login using
a blank username and password, and the login will work.
3. You should call exit after sending your redirect header.

Generally for a web service login script, I prefer to output some XML or
JSON that can be parsed easily.  That said, you could still make this work
by just looking for patterns in the HTTP response to determine whether the
login worked.   Your session is managed PHP, and it will return a phpsessid
cookie.  If you include this cookie in all future requests, then it would
retain the session for its lifetime.

Steve


On Sun, May 29, 2016 at 9:25 PM, Shai Almog <[email protected]> wrote:

> I'm afraid I don't know PHP so I can't really tell what you are trying to
> accomplish. I suggest defining what you need from the server?
> Cookie? Token?
> Something else?
>
> --
> You received this message because you are subscribed to the Google Groups
> "CodenameOne Discussions" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> Visit this group at
> https://groups.google.com/group/codenameone-discussions.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/codenameone-discussions/f609db51-8e87-41b5-b37e-965b4877099d%40googlegroups.com
> <https://groups.google.com/d/msgid/codenameone-discussions/f609db51-8e87-41b5-b37e-965b4877099d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Steve Hannah
Software Developer
Codename One
http://www.codenameone.com

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/CAGOYrKWmn5U_QOY40BMdB9M2dUPbJXCqOMj7zXnwovUeFMmYQw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to