I've tried multiple javascript and jquery methods for limiting the lines but mostly either there is a bug on it or there is an issue with copy/paste and etc. Please let me know how it should be for client side .. mostly patched from copy/paste, restrict additional line if you dont press enter but keep writing and etc ...
Also, that's my server side check only at the moment, so please let me know if i can improve it as well?
$lines = array_slice(explode("\n", trim( $_POST['description'])), 0, 10); // max 10 lines
foreach ($lines as $key => $value)
{
$lines[$key] = substr(trim($value), 0, 100); // max 100 chars
}
$insert['teams_descr'] = implode("\n", $lines);
$this->db->update( 'teams', $insert, array( 'teams_id' => $this->user->leader_team_id() ) );