Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Help?

Name: Anonymous 2012-01-27 18:30

Don't know if you guys help round here but ill give it a go.

This is SQL

query = "UPDATE event_info"
        + "SET PLACES = PLACES   -1 "
        + "WHERE EID = '"+intID+"' ";
stmt.execute(query);

Whats wrong here? its a booking system When i book i want available places to go down by 1, Places is an int EID is also an int

Name: Anonymous 2012-01-27 18:37

Whats wrong here?
This code is vulnerable to SQL injection.

Name: Anonymous 2012-01-27 18:41

Let Me rephrase.

Why doesn't Places Get negated when i enter a valid ID to negate from

Name: Anonymous 2012-01-27 18:46

>>1
Ensure there is a space at the end of each "line" of your SQL.
As it is your string concatenates to
UPDATE event_infoSET PLACES = PLACES   -1 WHERE EID = $$
Also as >>2 says $$ (intID) is vulnerable to somehow become
'0; SELECT \'LISP\';'

Name: Anonymous 2012-01-27 18:56

>>4

Wow Jesus that makes me feel dumb, Im new to this SQL stuff and didn't realise a new line wouldn't have created a space.
Thanks

Don't change these.
Name: Email:
Entire Thread Thread List