In my previous post about email validation one user pointed out that this will not actually validate if a website’s domain actually exists. Here is a simple function that will do just that, determine if a website exists using PHP and cURL. Edit: After searching a bit, I found another similar cURL solution that checks […]
Archive | PHP
Getting Upcoming Birthdays From MySQL
Assuming you have a table called users with birthday as bday for the column name, this will pull all users who are having a birthday in the next 7 days. This is very useful if you want to showcase your member’s birthdays on your website.
1 |
SELECT * FROM `users` WHERE DAYOFYEAR(curdate()) <= dayofyear(`bday`) AND DAYOFYEAR(curdate()) +7 >= dayofyear(`bday`) LIMIT 30; |
There is of course one small problem with this, […]
PHP5 Email Validation
In prior version of PHP you had to use some regex solution to validate an email address, now in PHP5 it’s as simple as:
1 2 3 4 5 6 7 8 9 |
function isValidEmail($email){ return filter_var(filter_var($email, FILTER_SANITIZE_EMAIL), FILTER_VALIDATE_EMAIL); } if(isValidEmail('email@domain.com')){ //valid } else { //not valid } |
I’ve been using PHP5 ever since it was released but didn’t look into the PECL Filter extension until recently. Pretty handy. Please note that I also added the FILTER_SANITIZE_EMAIL filter […]
Sphinx : A MySQL full-text search engine
This has got to be one of the coolest things I have come across in a long time. Sphinx a standalone MySQL full-text search engine. I’ve been working with it for a couple weeks now and I must say, this thing is blazin’ fast. I was most impressed by performance on large data sets (60+ […]