How do I check if a string contains a specific word?

You can use the strpos() function which is used to find the occurrence of one string inside another one: Note that the use of !== false is deliberate (neither != false nor === true will return the desired result); strpos() returns either the offset at which the needle string begins in the haystack string, or the boolean false if the needle isn’t found. Since 0 is a … Read more

Get the full URL in PHP

Have a look at $_SERVER[‘REQUEST_URI’], i.e. (Note that the double quoted string syntax is perfectly correct) If you want to support both HTTP and HTTPS, you can use Editor’s note: using this code has security implications. The client can set HTTP_HOST and REQUEST_URI to any arbitrary value it wants.

How do I resolve a HTTP 414 “Request URI too long” error?

Under Apache, the limit is a configurable value, LimitRequestLine. Change this value to something larger than its default of 8190 if you want to support a longer request URI. The value is in /etc/apache2/apache2.conf. If not, add a new line (LimitRequestLine 10000) under AccessFileName .htaccess. However, note that if you’re actually running into this limit, you are probably … Read more

S_SESSION variable (user role) not recognised

Session login and start, with Session variables declaration and store: Variable $_SESSION[‘estado’] works fine as it loads content if it is activo, and if not locates to other directory: But it does not seem to recognise $_SESSION[‘us_type’], as even when Database has correct fieldname and value *(us_type, 1)* php does not load under this conditional, locating user as if … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)