3 ms·
Um.. Ok wow. I know we're supposed to not be negative. So.. let me be clear I'm not trying to discourage you, so think of this as constructive criticism. First
by stephenr 10y ago
Um.. Ok wow. I know we're supposed to not be negative. So.. let me be clear I'm not trying to discourage you, so think of this as constructive criticism.
Firstly. Get a template system. It doesn't need to be complex. I use a simple object that accepts variables, stores them in an associative array, and then when you call it's render() method, it uses extract() to make those local variables and does an include of the template file - which can then have whatever template logic you require (loops, ifs, etc).
Next up. Your DB connection is using hard-coded strings. Use some kind of configuration for this. I'm very partial to environment variables, but it could also be an ini file, an environment-specific PHP file, etc.
Um.. 3? I don't know where Im up to now. Anyway, your DB query in the search results file is extremely naive and insecure. Look into parameterised queries.
4 I guess. Just looking a the above referenced query indicates that any given site is limited to just 13 keywords. I realise this is likely a learning experience but basically that isn't going to work for any meaningful sort of results.
5? You have a cron script, and then make a http request to call something else. Why? Just execute the script you need to run.
I think that'll do for now..