Call db_connect(TRUE) instead of db_pconnect() + some style changes
Add  parameter to CI_Input::user_agent()