August 21st, 2007 in
MySQL,
PHP |
1 comment
From time to time problems appear. mySQL server crashes, some error in a sql query might think it’s time to show her ugly face and in top of all that, the all mighty Google comes to index your page. And when he does, he indexes a page that presents an error or a blank page. How can we stop him from indexing that page? With a header 500 error.
The header 500 error or “Internal Server Error” means that the server has a nasty indigestion and the search engine should come back later to see the page in all it’s splendor. And that’s exactly what it will do. So, how do we trigger that error?
Most scripts use the mysql_query(“some sql”)or die(mysql_error()) sintax. Well, that’s ok because in case of an error, the script stops and the error appears so the debug process can begin. The only problem is that if some error appears, it will be indexed by search engines. …view full post
August 20th, 2007 in
PHP |
14 comments
I was checking out the searches from this blog and one in particular caught my eye. It was something like “watermark images from folder“. I remember that not a long time ago I had the same problem.
One of the clients I work for, in the development stage, asked me not to watermark the images of his products because… I really don’t remember the reason. What I do remember is that at some later point, he changed his mind (the website was online with a few hundred products added) and now he wanted to watermark images to prevent theft (some of his competition borrowed them).
So, I came up with 2 solutions. The first one was to watermark the images and save them on his server (a bulk watermark, while reading the whole directory) and another one was to watermark on demand. …view full post
July 23rd, 2007 in
PHP |
12 comments
Do you need to watermark your images? If so, do it the smart way. Put your mark on them by resizing the watermark. If you upload images having different sizes, you’ll love this. Read on.
Over the time I had clients that wanted to put a watermark on their images for copyright purposes. But there was a little problem. The watermark was too small on bigger images and too big on smaller ones. What to do… what to do?! Resize the watermark of course! …view full post
July 21st, 2007 in
PHP |
1 comment
Some time ago, a client came and asked specifically that the headers (h1 stuff) should use his particular font specified in his identity manual. At that time I did now knew about the flash possibility to overwrite text (search for sIFR.js and you’ll see what I mean), so I chose to dynamically generate these titles using PHP and GD. The reason for this solution (instead of changing them using some image editing software) was that there was some dynamic data (a list of newsletters) that needed the same title styling. …view full post
If you are like myself, than you considered a long time ago that Firefox is the tool you need when it comes to web browsers. I used to be an IE user, but that was at least 5 years ago. What I like the most is the easy way you can install addons and that you can find A LOT of those. Well, below you can find the Firefox add-ons that are a must if you are a developer (at least in my opinion). …view full post
June 26th, 2007 in
Wordpress |
4 comments
Surfing the web today I’ve spotted a vulnerability about Wordpress that gives the attacker the possibility to find out your admin login username and the md5 hash of your password.
It uses the wp-admin/admin-ajax.php file to achieve that. How it works it’s not the point, but how you can protect from it is.
One solution to avoid this problem is to upgrade to the latest version but if you don’t want to do that, there are a few things you can do to avoid an attack. …view full post
June 22nd, 2007 in
PHP |
52 comments
There are tons of captcha scripts on the web. The problem is that, from the enthusiasm of making them more flexible, a lot of code and pages are added and instead of a simple solution one may end up with several files necessary to display the captcha image. I’m not saying that they are useless, but for most of the time, such complexity is not quite welcomed. I strongly believe that less is more and that things should be kept simple. Having that in mind, I want to share a way to protect your forms using a math captcha image that requires a single PHP file and a font file.
This is a very simple, easy to understand example that shows you how to display a math captcha image that requires the user to do a little thinking. Simple operation like subtraction or addition is displayed on the math captcha and the user needs to input the result. Math captcha result is stored in session and from the page doing the form validation you just need to compare the value from session with the value that the user inputed. …view full post
June 21st, 2007 in
PHP |
13 comments
If you need to secure a form from being automatically submitted by robots of by someone who wants to damage your server and/or scripts, it’s best that you use a captcha image.
For this one you’ll need PHP compiled with GD and the FreeType Support enabled (in order to use True Type fonts in your images). …view full post
June 19th, 2007 in
PHP |
no comments
I’m putting this in here because I’ve done it myself and I’ve seen it done by others.
NEVER EVER use mysql_query() in a loop (like while(), for(), foreach() … ). It will slow down your script and drive you nuts. It’s the wrong way of doing anything you have in mind. …view full post
If you ever need a graph generated with php, if you ask me you have 2 solutions: use GD or use Flash.
Here are the best two of them in my opinion:
1. jpgraph is a PHP-GD graphing tool
2. amCharts is a Flash developed chart solution.
Both offer the same thing with very different results. Go check them out.