New type hinting patch
Monday, March 31st, 2008This new type hinting patch includes support for objects with __toString methods, allowing them to pass a string type hint.
This new type hinting patch includes support for objects with __toString methods, allowing them to pass a string type hint.
This script allows a user X failed logins. After this, their account is locked for N minutes. After the lock ends, they are allowed X more failed logins, and the process starts from the beginning. All logins are logged with IP address and timestamp.
This script is specific to a site I recently made, so it will have to be adapted to your login system. I can do this if you are interested, charging for my time, or you can do it, just replace my site specific functions (alerts_add, app_redirect, and db_*) and create the tables.
Login Protection System Script
Login Protection System SQL Export
These are 3 functions that will match zip codes, alphanumeric strings, and email address.
Just something I was messing around with. I made a class that allows you to build your own queries, with full support for conditionals. Pretty interesting, take a look. It’s all done using object oriented.
These two functions escape data for sql queries, and apply backticks to table/column names. They can be used in conjunction with the mysql functions for easy updating, insertion, etc. that I will be posting soon.
Many of you may have heard of my Ubuntu Linux hardware compatibility site. For those that are not aware, I did a complete from-scratch rewrite a couple of weeks back, along with new hosting. You can check out the new site at ubuntuhcl.org.
Contribute!
Leave a review on your Ubuntu hardware and contribute to our database of hundreds of reviews.
Access the hardware review rss feed at ubuntuhcl.org/reviews/rss.
Attached is my more complete type hinting patch. It allows type hinting for int, float, string, bool, num (int or float), resource, object, and scalar.
Use these functions in place of fputcsv() if you are using an earlier version of php, or if you want to parse a CSV row but not write it directly to a file.
Nice function, I use it in pretty much every application I develop. I can’t guarantee that it’s safe but in all the time I’ve used it I’ve never had a problem.
I went on one of those CSS compression sites, and this function that I had wrote reduced my CSS file to 2506 bytes, exactly the same size as the most advanced compression the site offered.
function compressCss(scalar $string) {
$blank = array(”\r”, “\n”, “\t”);
$string = str_replace($blank, ”, $string);
$string = str_replace(’ {’, ‘{’, $string);
$string = str_replace(’;', ‘;’, $string);
$string = str_replace(’: ‘, ‘:’, $string);
$string = str_replace(’, ‘, ‘,’, $string);
$string = str_replace(’;}’, ‘}’, $string);
$string = str_replace(’ }’, ‘}’, $string);
$string = preg_replace(
array(’#/\*.*?\*/#s’), ”, $string
);
return trim($string);
}