Dynamic JavaScript with PHP
Early this morning, I released Top 10 – A Page Counter and Popular Posts plugin for WordPress. I detailed my experience while designing this plugin. The major problem that I faced while working with this plugin was with WP Super Cache. WP Super Cache creates a static file of your post and displays this to the viewer. As a result, any PHP code that is present in your WordPress blog template is executed only once and the cached file is then served to your visitor.
The initial version of Top 10 used PHP to record the page views as well as display them and so using WP Super Cache ensured that both of these would never increment.
This is where JavaScript with PHP comes in. I ended up using AJAX to record the page views. However, for displaying the count I chose to do so by serving the PHP file as a JavaScript file.
Here’s how you go about it.
About Ajay
A die-hard blogger, web developer, biker, singer, geek, non-stop talker, foodie, movie freak are just some of the words that begin to describe me.
FTP blocked on your connection? Use net2ftp
A few years ago, I faced a major problem with uploading and downloading files via FTP. My internet connection blocked a lot of ports, FTP among them and switching ISPs wasn’t an option.
It was an extremely frustrating situation, until I stumbled upon net2ftp.
net2ftp is a web based FTP client with features that rival several desktop based FTP clients.
- Navigate the FTP server
- Upload files
- Download files individually or via ZIP files
- Zip/Unzip files
- Install software
- Copy, move and delete
- Copy or move to a 2nd FTP server
- Rename and chmod
- View code with syntax highlighting
- Plain text editor
- HTML editors
- Code editor
- Search for words or phrases
- Calculate size
And, the best part about net2ftp is that you can download and install it on your own servers. Installing this on your own servers ensures that you can change the upload / download limits, the execution time of the php scripts.
This is something I have done personally. I have net2ftp installed on my own VPS and pushed the limits of the files to a high level allowing me to upload big files and unzip them.
Have you tried net2ftp? Do you have it installed on your own server or do you use net2ftp.com?
About Ajay
A die-hard blogger, web developer, biker, singer, geek, non-stop talker, foodie, movie freak are just some of the words that begin to describe me.
Fix the Windows Live Writer and WordPress stripping tags issue
I’ve been using Windows Live Writer to write posts for several months now. This has primarily been for my blog posts at Weblog Tools Collection. I decided to start using WLW for Techtites and AjayDSouza.com.
I was able to add both the blogs properly and made my first blog post. Uploaded the post to my website and noticed gibberish. On closer observation, I realized that the < and > were stripped out completely. As a result, code like <p><a href="http://techtites.com/">Techtites</a></p> became pa href="http://techtites.com/"Techtites/a/p. I manually had to edit the post to correct this post. I noticed the problem at both the blogs which are running WordPress 2.7. I initially suspected this to be the reason, and so decided to search.
Came across this article by Joseph Scott. Joseph is one of the developers of WordPress. He writes:
A gradually growing list of people have run into a very odd problem using XML-RPC methods in WordPress, where the left angle bracket ( < ) gets stripped. There’s been a fair bit of discussion about this on ticket #7771. The bottom line: the behavior of the PHP XML extension when built against newer versions of libxml2 changed, such that left angle brackets get stripped when parsing XML.
There’s been some back and forth between libxml2 folks (email list) and the PHP folks (bug 45996), with no real solution for those using the tainted versions of libxml2. So what are your options if you’ve got this problem?
There are currently two solutions to this problem.
- Downgrade to a lower version of libxml2. v2.6.30 has been known to work.
- Build PHP with expat parser instead of libxml2
Unfortunately, both solutions require you to have root access to your server. If you don’t you can write to your host and point them to this solution.
I decided to go ahead with option 1. Codehead has a good tutorial on downgrading to libxml v2.6.30 for users running cPanel. Non-cPanel users can check out the tutorial by Pete.
The procedure is rather simple. All I had to do was copy-paste the code into the Linux command prompt, edit two files and I was good to go. It’s been running fine for nearly a week now.
If you don’t have root access, you’ll have to just wait it out before the libxml2 and PHP folks sort their differences out!
Update: HooFoo.net has published a possible fix by editing three WordPress files. I haven’t tested this out myself. If any of you try it let me know. The following code has been added to the files:
if(LIBXML_DOTTED_VERSION == ’2.7.0′ ||
LIBXML_DOTTED_VERSION == ’2.7.1′ ||
LIBXML_DOTTED_VERSION == ’2.7.2′) {
$xml =str_replace("&lt;","&lt;",$xml );
$xml =str_replace("&gt;","&gt;",$xml );
$xml =str_replace("&amp;","&amp;",$xml );
}
//end Fix
I’ve modified the files myself and made them available for you. Download the zip and extract the files in your WordPress 2.7 root directory. The zip file maintains the necessary directory structure, so zipping in the root directory is sufficient. The files should work with only WordPress 2.7 and are not meant to be installed on any other version.
Update: Users have reported mixed results with the attached fix. It works for some and doesn’t for others. If it’s not working for you check if the files have been uploaded in the right place. Alternatively, try making the changes manually as listed in the tutorial by Hoofoo.
Download WordPress 2.7 XML Strip-tag Fix.zip from DivShare [25KB]
About Ajay
A die-hard blogger, web developer, biker, singer, geek, non-stop talker, foodie, movie freak are just some of the words that begin to describe me.
Tip Thursday: Top 10 PHP Coder’s Mistakes

This one is for PHP developers out there. I started getting my hands dirty with PHP about a year and half back when I started developing WordPress plugins and themes.
Given my little exposure, I’ve still got a long way to go to even call myself a “PHP Developer”. And hence this article is ideal for me. Not just me, but I think even experienced PHP coders need to keep the 10 points listed there in mind.
To summarize, the top 10 mistakes are:
- Not escaping entities
- Not Escaping SQL input
- Wrong use of HTTP-header related functions: header(), session_start(), setcookie()
- Requiring and including files using untrusted data
- Syntax errors
- No or little use of Object Orientation
- Not using a framework
- Not knowing about existing functionality
- Using old PHP versions
- Double escaping quotes
Read the article for more details »
About Ajay
A die-hard blogger, web developer, biker, singer, geek, non-stop talker, foodie, movie freak are just some of the words that begin to describe me.
PHP-Nuke Vulnerability
The Neo Security Team reports a new vulnerability in PHP-Nuke for all versions of 7.9 and below. This was discovered by Paisterist.
In /modules/Journal/search.php the “forwhat” variable is not sanitized correctly
The vulnerability is reported to be Mildly Critical. However, it is best to get this patched.
PHP-Nuke has released version 8.0 for paid members. So if you are a free user then you will need to apply the patch.
Patch details are on the advisory page.
About Ajay
A die-hard blogger, web developer, biker, singer, geek, non-stop talker, foodie, movie freak are just some of the words that begin to describe me.








(4.93 out of 5)
(3.69 out of 5)