Erika_I_Garner
Oct 13, 2017Altostratus
parse username
I am trying to get only the UserID with the following iRule, but I end up getting it and also the password and I only want the UserID. Can someone help me, this is driving me crazy!
when HTTP_REQUEST_DATA { if {([HTTP::payload] contains "UserID")} { set UserID "unknown" foreach x [split [[HTTP::payload]] "&"] { if { $x starts_with "UserID=" } { set UserID [lindex [split $x "="] 1] } }
log local0. "User $UserID attempted login from [IP::client_addr] and referer: [HTTP::header "Referer"]"
} }
And I get the following result:
TCL error: /Common/LOG-User - invalid command name "UserID=abcdef&Password=password1234&destination=&saveDestination=false" while executing "[HTTP::payload]"