UserInfo – A jQuery Plugin

UserInfo is a plugin for jQuery which is designed to aid in user filtering, banning, session control, or other situations where you need a little more information without using server-side scripting.

UserInfo basically grabs ip address, user agent, timestamp, date, and time. It also sets the data in cookies and detects if cookies are already present. This information is inserted in whatever object userinfo() is called on.

Note: The user data is retrieved from JasonLau.biz via an ajax request.

You can view a working demo at this webpage. You can also download the source-code by following the download link below.

Download: Git The Source Code

Changelog:

  • 1.0.0 – 8.15.10 – Initial release

Example Use:

$('#user-info').userinfo({
output: 'time,date,time_stamp,ip,user_agent,token,token_time',
dateFormat: 'M d, Y',
timeFormat: 'g:i A',
serialize: true
});

Call userinfo() on any object that can hold HTML. The desired data will be inserted in the object or sent to your custom callback function for processing.


Available Options:

UserInfo has the following options available for customization.

Name Type Default
cookieTime Number Default: 60*15
The expiration time for the server token cookie. Calculated in seconds from the time_stamp. Can be a number or math. 60*60*24*365 is 1 year.
custom String Default: null
A custom cookie field which can be used to hold any additional data.
dateFormat String Default: ‘M d, Y’
The output date format. Uses the same format as PHP. See http://php.net/manual/en/function.date.php for documentation.
delimiter String Default: ‘,’
The character that separates each output value.
jsCookieName String Default: ‘userinfo’
The name for the cookie which is set by javascript.
jsCookieOptions String Default: ‘{expires:365}’
The options for the cookie which is set by javascript.
jsCookieValue Boolean Default: false
Reads and outputs only the value for the cookie which is set by javascript if one exists.
output String Default: ‘time,date,time_stamp,ip,user_agent,token,token_time’
Defines which items are output.
Available Options:

  • time – The current time.
  • date – The current date.
  • time_stamp – The current unix timestamp.
  • ip – The user’s IP address.
  • user_agent – The user’s User Agent.
  • token – If the user already has a token cookie set this will return true; else false.
  • token_time – The timestamp when the token cookie was set.
  • custom – Returns the custom cookie value
pluggable Function Default: false
A custom callback function.
serialize Boolean Default: false
Serializes the output data instead of outputting a list of values.
Example: time=8:06 AM&date=Aug 15, 2010&time_stamp=1281877615&ip=255.255.255.255&token=false
timeFormat String Default: ‘g:i A’
The output time format. Uses the same format as PHP. See http://php.net/manual/en/function.date.php for documentation.
value Boolean Default: false
Outputs as form text field value instead of plain html text. Use this if you want the data output to a form field as a field value.

  • Karmrajsinh

    from where i can download code of datepicker in your page >???

  • http://jasonlau.biz Jason Lau

    You can get datepicker from here with jQuery UI – http://jqueryui.com/download