Searching for a text string in all files and directories recursively in PHP

Sometimes you need to edit some part of your website and unfortunately it isn’t made by you. You will, obviously, need to search for the file in which that particular part of site exists. In CMSs/forums/blogs, it get really hard to search it manually.

I was having a similar problem. I needed to edit the footer of my site but I didn’t know which file, out of 100s, had that particular part. I just made a script for that.



$query="find . -exec grep -l $query {} ;";



Save this file as textsearch.php in your root directory. Now visit the site

And voila! You get the results.


DisclaimerPlease note that this should be used only by webmasters as a quick tool to find specific strings within all files without having to download all the files to local computer. While this method is not recommended, this can be used as a temporary tool only. This file (textsearch.php) should be deleted as soon as your work is done with it for security reasons. I won’t be held responsible for any damages caused.

Moved my blog to new domain

You might be shocked but I moved my blog to a new domain –, just after one day at .
Actually, that blog was more of a general life-based blog. I felt it wasn’t suitable for a tech blog. Hence the new name.

It roughly took me 5 minutes to do the job. Thats the magic of wordpress. I just love it.

Thats all fellas.

Hope you like the new domain.

Got a new domain for my blog (How I moved my blog to new domain)

Just bought for my blog. As I consider myself insane (most of you will agree with that), I found this name suitable for my blog. I bought it in the same instant when I saw it was available.

I added the domain in cPanel as addon domain but unfortunately it didn’t support second level directory ( So I copied all the files from the directory and pasted it in a directory on top level. I pointed the domain to it and it worked. I changed the Blog URL in admin panel and it worked.

Now, there was this problem of redirection. There always is a problem of 301 redirection with new domains. I had Page Rank and pages listed in search engines which I didn’t want to lose. So, I needed a 301 Permanently Moved redirect. I made a .htaccess file in my old directory and put this:

redirect 301 /blogs/

I figured this out after a dozen of commands including mod_rewrite. Finally, this worked like a charm.

Bluehost – the best host out there?

Before providing a review for Bluehost, I’ll take to back to the days when I knew nothing about web. When I say nothing, I just didn’t know anything except for normal browsing. Yeah, you heard it right. Through some googling and stumbling on an unknown page, I found out about adsense and its success stories. I made up my mind to do the same and start earning. I had big plans… like earning in thousands of dollars per month. Everything was set. I decided to create a forum but I didn’t have any hosting. I tried few simple scripts on free hosting and I was successful to install them. I forgot to mention – even though I wasn’t familiar with how web worked, I was still a tech savvy out of the web. I could program very well in C/C++ and could troubleshoot almost all of the software and hardware problems myself. So, I tried PHPBB on a free host and I needed a hosting account now to go professional.

After reading some reviews on internet, I found out that bluehost was quite good. Without a second thought, I asked my uncle for a credit card and registered for an account. The cPanel they provide is quite good – nicely organised into categories.

They offered:
UNLIMITED Hosting Space
UNLIMITED File Transfer
UNLIMITED Domains hosting
2,500 POP/Imap Email Accounts
SSH (Secure Shell), SSL, FTP, Stats
CGI, Ruby (RoR), Perl, PHP, MySQL
2000/2002 Front Page Extensions
One Free Domain Forever!
Free Site Builder

Not to mention, their excellent customer service and support.

All this was for 6.99$ per month. It was too cheap for what they had to offer. Its been 14 months since I purchased their hosting and I never had major problems. There was problem for about 10 days when their server went up and down all the time. I asked the support and they said that their was an upgrade being performed on my box. Since, then there hasn’t been any problem. Their 99% uptime guarantee stands out to be true.

If you wanna buy a shared hosting, this host is highly recommended. After all 0.9 million customers cannot be wrong!

This is an honest review from a satisfied customer, that is me.

If you wanna buy this hosting, please follow this link:
Buy your account here.

P.S: So far, I’ve learnt PHP, MySQL, Javascript, CSS, HTML (ofcourse) and I’ve been doing web development for various clients now. No more a newbie to web. xD

Recommended Firefox Plugins

When it comes to Firefox’s plugins, everyone have their own preferences. For me, these are the ones that I like and use the most and according to me are useful for all web-developers are:

1. Adblock Plus – Removes all kinds of ads from web pages. Saves bandwidth and page load times.
2. Add n edit cookies – Manage your cookies with this.
3. Amazing Media Browser – Find out all the embedded stuff on webpages including flv videos, swf animations, music etc. and download it with your favorite download manager. Flashgot plugin makes a great combo with this.
4. CookieSwap – To manage multiple accounts. Switch your account with just one click.
5. FEBE – Backup all your plugins, config, bookmarks, settings etc. with this plugin.
6. Flashblock – Partially solves Firefox memory leakage problems and also saves precious bandwidth by blocking flash. Replaces them with a button which when clicked loads the flash.
7. Flashgot – Integrates most of the download manager. Excellent plugin.
8. Greasemonkey – Use scripts on webpages to change appearance/functionalities etc.
9. Live HTTP Headers – View Request and Response Headers being sent/received.
10. User Agent Switcher – Change User Agent.
11. Web Developer – Extremely useful plugin for a web developers.

Feel free to add to the list!

Permanently moved to my new web address

After buying new domain, my older domain was still accessible. I had completely abandoned its usage, but two days ago, I visited it just to check and was amazed to see its page rank had gone to 2. I was shocked and spellbound. I admit that I had done some intense SEO myself, for it. But still I hadn’t expected its page rank to go up in such a short span.

I wanted that page rank on my new domain. But page rank didn’t transfer. Although, and pointed to same domain, google treated them individually. I set up mod_rewrite for my old address. It forwarded my old address to new address and now typing old address in address bar forwards it to newer address. It also sends a 301 MOVED PERMANENTLY header to search engines telling then that my older domain has moved to newer domain. This way PR (page rank) gets transferred too.

Here was the code that I used in .htaccess:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^techmindz\.com$ [NC]
RewriteRule ^(.*)$$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^techmindz\.co\.cc$ [NC]
RewriteRule ^(.*)$$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^www\.techmindz\.co\.cc$ [NC]
RewriteRule ^(.*)$$1 [L,R=301]

Its been two days since I made this change. I expect results within 2-3 weeks for my PR to go up. At the same time, my SEO will also be done.

Waiting for next month to see the changes. I hope I get what I expect.

Spent some bucks on my forum

So, I had collected around 100$ in my paypal and was planning to collect it and buy a good laptop. But, I also wanted to invest it on my forum’s marketing and SEO (search engine optimization). I thought to myself that it would take a long while to collect for laptop. So, I decided to spent some money on my forum’s promotion. I found out one search engine optimization who provided 8200 Directory submissions for 50$ along with 1 article submission to 25 high PR sites. I liked this package. I contacted him and sent him the money.

I was hesitant in spending the money but it was not spending after all, it was investment. I would get the result back in form of popularity and more traffic which would eventually be converted into more money.

I sent him payment yesterday. He said, he would extract information from my forum in 48 hours and then report it to me if it’s correct. After my confirmation, it would take around 20 days for all the submission work to be done. Now, in a month I expect a major growth of traffic on my forum. Hopefully, I’ll be able to make my forum a huge one with lots of quality content.

Will update the blog as the SEO process proceeds.

An alternative to cross-domain AJAX, sort of

Recently, I got a project to make an ad system for a website. The ad system was such that, when the page displaying ad was loaded for the first time, it would create a random link and store them in database. From then on, it would display the same link on same page.

So, I made a javascript file which would create and xmlobject for AJAX request. It would query php file on a server and get the link. But cross domain AJAX just doesn’t work. I tried to edit some parts of it, but it just wouldn’t work. Cross domain ajax requests aren’t allowed for security purposes.

So I had to think of something else. First I thought of renaming php file to js and then addind a code to .htaccess to make it behave like php. Then I thought of making image links dynamically using php’s GD library.

So, I was just surfing the net, procrastinating the job when I stumbled across:

It just solved all my problems. So I just added a header for executing it as javascript and modified the echo commands to display javascript commands. Now I needed a client-side code for displaying the links. That was problematic too. I needed the source of the javascript file to be dynamic. It was just not working. But I finally found a solution by posting it on,251815.0.html

There you go.

If you want to know more details, just add a comment here.

Freed up some MBs, finally!

My computer was infested with more than 150 softwares, majority of which were used only once or twice and hadn’t been in use since then. I was just too lazy to uninstall them. I was not facing any performance issues despite of so many programs installed on computer but today my notebook was really lagging. I was also struggling with free HDD space. Let me tell you that I am a download freak. I feel incomplete when my download manager is empty and I search for something to download. I just don’t like my download manager sitting idle in the task bar which was the main reason I was struggling with low HDD space. My D: drive had 2 GBs free and E: drive had 5 GBs free. My C: drive had just 57 MB free (I moved some files to D: drive, it had 0 bytes free previously.

I want to buy a new HDD coz my 160GB HDD is just too small tostore all my massive software, songs, movies collection. I’ve even burnt 30-40 dvds, still I am struggling with downloading problems.

So, after all the problems I finally decided to kick my laziness and plunge into the task of cleaning up some mess.

I uninstalled about 20-25 softwares and now, it my start menu is starting to look normal again (Previously it went out of the screen with huge list of softwares). My C: drive has 600MB free space now. Its feeling like I’ve removed a huge burden from above my head. I’ve still many softwares to go. I would love to format my computer but since it is heavily modifies and tweaked by me, I think I wouldn’t uninstall until a major problem compels me to.

Will post an update on how much I freed my hard drive and how is my computer doing now.