I'm trying to figure out what the best way to do this is.
I have a part on my website where people can search for a particular card based on multiple different factors. Like the name of the card, color, cost, etc. When the user types in the criteria, I send the information via ajax GET. So the url looks something like this:
http://sitename.dev/search?query=asdf&color=red&etc=
The good thing is, the above provides a url so the user can easily copy paste and share the results with friends. The not so good part is, it's not so good for search engine optimization.
First question: How do I make these type of links good for SEO and is this secure? It seems like it would be easy to inject code?
Second question:
After getting the corresponding input from the user, I have the following in my SearchController to deal with the input:
public function postSearchResults() {
$searchStr = Input::get('query');
$color = Input::get('color');
$etc = Input::get('etc');
$query = DB::connection('mysql')->table('cards')
->where('name', 'LIKE', '%'.$searchStr.'%')
->where('color', 'LIKE', '%'.$color.'%')
->where('etc', 'LIKE', '%'.$etc.'%')
->get();
return parent::ajaxView('results', compact('query'));
}
Is the above secure or is there something I should do in addition to make it secure?