Question is How do I safely allow users to submit a url link or several url links in their bio,then output it to the view, similar to how Instagram allows in their bios. I'm thinking of maybe doing some sort of regular expression , search the bio text and output to view, but don't know how to safely do it without compromising my site's security:
I'm saving the bio in my users table as varchar with a length of 255
I'm validating then saving to my database like so :
$this->validate($request, [
'name' => 'http://regex:/^[\pL\s]+$/u|max:20', //change to allow numbers also July 14/16
'bio' => 'max:1000',
]);
then saving to db
if ($request->has('bio')) {
$user->bio= $request->input('bio');
$user->save();
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire