I have this script in my header:
if (isset($_COOKIE['username'])) {$_SESSION['username'] = $_COOKIE['username'];}
if (isset($_COOKIE['is_logged_in'])) {$_SESSION['is_logged_in'] = $_COOKIE['is_logged_in'];}
Should I protect my cookies from injections?
like stripslashes etc.
First and foremost you should rethink your authentication system. Because currently, anyone who knows how to alter cookies can impersonate any user without proper authentication. That’s a way more actual security flaw.
Injection vulnerabilities depend on the actual context the values are inserted into and without providing information about that, we won’t be able to help you.