Webmaster Blog

Webmaster Blog brought to you by Chuckun!

Archive for the ‘Featured’ Category

Scan all files for strings / variables using CMD.exe

Article written by Chuckun on the Webmaster / SEO Blog On October - 19 - 2011


How to scan all files in a directory and subdirectories for a string or variable name.

Okay so I needed to generate a list of files on my PC that contain the variable $license[xxxxx].  Whilst I knew I could write a PHP script to do this, I thought it’d be much quicker to let my PC do all the work using findstr.

First, let’s explain what FINDSTR is and how it works.

Findstr is a windows command you can use in the Windows Command Prompt (cmd / cmd.exe) to find out if a string exists in a defined file or in this case, list off all files containing a string.

So I came up with this:

Selec All Code:
1
C:\Windows\system32>findstr /m /s /i "$license" C:\dev\www\*

Just to explain what each of the toggles I used mean:

/m = Only display the filename of each file found matching the search.  (without this, it will quote the entire line and line number the string was found on)

/s = Includes all subdirectories as well as the defined directory

/i = Forces the search to be case insensitive.

This worked, but it also spat off reams of results I couldn’t do anything with.. Also, there were so many results, it exceeded the command prompt capacity and trimmed off about half of the results.  So, you want to dump the results to a .txt file, which will actually leave you with usable results.

To do this, you simply add > C:/path/to/result-file.txt (this file shouldn’t exist already! It will be created!)

So I ended up with this:

Selec All Code:
1
C:\Windows\system32>findstr /m /s /i "$license" C:\dev\www\* > C:\license-results.txt

Which worked perfectly!  I know I usually don’t blog about windows stuff, but I thought this would be very useful to my fellow webmasters icon smile Scan all files for strings / variables using CMD.exe You’re welcome!

Popularity: 6%

share save 171 16 Scan all files for strings / variables using CMD.exe

Securing downloadable files with PHP

Article written by Chuckun on the Webmaster / SEO Blog On June - 1 - 2011

Today, I’ll be showing you how you can easily protect your downloadable media.

Why would you want to do this? Well, often we want to hide the location of the downloads, to stop people leeching your content. And most measures can be easily swerved.

Here is a method I quite like. I have annotated everything for your convenience.

 

 

Filename: download.php

Selec All Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
$filename = "downloaded.zip"; // this is the fake name you want the downloaded file to be called.
$source = "/downloads/thefile.zip"; // this is the real name and location of the file.
 
if(file_exists($source)) { // check that the real file exists, if so do the following..
 
   header('Content-type: application/zip'); // set the content type of the current page to the type of file being downloaded
   header('Content-Disposition: attachment; filename="'.$filename.'"'); // Forge the download name by setting filename=
   readfile($source); // grab the real file to prompt download.
 
} else { // if the file doesn't exist
echo "Error: File not found!"; // display error message
}
?>

So how do we use this? going to the destination: mysite.com/download.php would grab the file ‘thefile.zip’ from the /downloads/ folder, and prompt you to download it, but with a new name of ‘downloaded.zip’

This is the simplest version of this method. Obviously with use of $_GET requests you can have download.php choose varying files from the /downloads/ folder. Example below:

Filename: download.php

Selec All Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
$id = $_GET['file'];
$filename = "downloaded-".$id.".zip"; // will forge the name downloaded-5.zip (if download.php?file=5 is requested)
$source = "/downloads/thefile-".$id.".zip"; // will pick the real file titled thefile-5.zip (if download.php?file=5 is requested)
 
if(file_exists($source)) { // check that the real file exists, if so do the following..
 
   header('Content-type: application/zip'); // set the content type of the current page to the type of file being downloaded
   header('Content-Disposition: attachment; filename="'.$filename.'"'); // Forge the download name by setting filename=
   readfile($source); // grab the real file to prompt download.
 
} else { // if the file doesn't exist
echo "Error: File not found!"; // display error message
}
?>

It gets even more advanced once you start playing with more and more security. When dealing with premium ($$$) content, it’s good to use a database and give all your files a masked name, by MD5 encoding the names, storing them in a database with an assigned ID, and having download.php retreive the filename from the database to know which file to retreive. But that’d look a little messy for this tutorial!

I hope you learned something by reading this..

Thanks for reading!

Popularity: 8%

share save 171 16 Securing downloadable files with PHP

[Coupon] 50% off AvArcade purchases!

Article written by Chuckun on the Webmaster / SEO Blog On December - 22 - 2010

Tis the season to be jolly, and a jolly season it is thanks to this coupon!

Receive 50% off your entire order this winter holiday using the coupon code: HOLIDAY

This is a great opportunity to start up your own arcade business and try to compete with the higher competition!  At these amazing prices, there’s no way you can lose!

Grab your copy now before the coupon expires!

Don’t thank me! Thank Andy!

A quote from Andy, owner of AvScripts:

Get a license for as little as $5 each (5 pack) with a 50% discount on the store. Offer is valid on all items apart from the script install service.
To take advantage of the offer, use coupon “HOLIDAY”



Popularity: 8%

share save 171 16 [Coupon] 50% off AvArcade purchases!

AdSense ‘Allowed Sites’ Whitelist (Exclusive Tips)

Article written by Chuckun on the Webmaster / SEO Blog On September - 22 - 2010

Making use of Google Adsense’s ‘Allowed Sites’ whitelist is becoming an increasingly useful tool to webmasters.

Why would anyone want to display your ads on their site? Surely they’d want to earn the cash themselves? Well, obviously there’s something more than the obvious going on.

I speak from experience in recent months whereby my account was receiving a massive amount of invalid (£0) clicks from units with no channels; and since I keep check of all my ads via channels, I knew they were ‘outside’ clicks for whatever reason.

Following that, I also discovered that Shawn Hogan of DigitalPoint had experienced the same thing, where his AdSense account was unfairly suspended due to clicks from disallowed websites. So this brought my theory to proof; people are adding your Publisher ID to their adverts on their blacklisted websites as a form of attack!

So I cannot stress how important it is to use the Allowed Sites feature Google provide. It’s there for a reason, and let’s face it; who in their right mind is going to display your ads without contacting you first, unless it’s malicious? Well it’s unlikely to say the least. And if it was legit, they could let you know to add them to the whitelist – simple!

To access the whitelist simply login to your AdSense account, and navigate to AdSense Setup > Allowed Sites.

Exclusive Tips:
Many people view your websites using Google translate and other Google apps! Adding google.com to the list will not work as the translation program uses a different domain (googleusercontent.com) to access your website. So be sure to add googleusercontent.com to the list so you allow clicks via Google Translate and any other tools under subdomains on that domain!

Any more tips will be added as I discover them!

Popularity: 9%

share save 171 16 AdSense Allowed Sites Whitelist (Exclusive Tips)

Verify Domain Ownership on DigitalPoint

Article written by Chuckun on the Webmaster / SEO Blog On June - 29 - 2010

A lot of people are getting confused here, so I thought I’d offer a hand.

You will all have seen that due to recent scams going on on DigitalPoint Forums; you can now ‘Verify Domain Ownership’ when selling domains on the DigitalPoint Marketplace.

Whilst this sounds like a great idea, most people do not know about Total DNS control, or how to use it.  Which isn’t surprising – it can be confusing if you’ve never used it before!

So here’s a walk-through for verifying your domain on DigitalPoint.

Firstly, you need to set up your sales thread for your domain.   Be sure to enter your domain into the bidding system not just in your post otherwise you will not be able to verify your domain!

Once you have done this, view your sales thread.  You will see on the right hand side of the bidding section of your thread, a line that says “Verfied Owner: No“.  Click on it!

This will bring you to a page which says something like:

Add the following TXT record to your DNS configuration:    digitalpoint-site-verify:ab12345cd12345ef12345gh12345

How many people does this make sense to? – Not many.  Hence why nobody verifies!

So here’s what you do!

Go to your domain manager with whoever your domain registrar is.  Find your total DNS control panel.  This may be entitled MX control, or refer to C-Names, A-Names, MX management.

You should see a long list of names and values under different categories such as “A Names” “C Names” MX – Mail” etc.. Look for the one that is titled TXT.

You then want to click “Add TXT Record

This is where most people get stuck.  They don’t know where to put in the ‘code’ they got from digitalpoint!

Well here’s what you need to put in.

Name: @
Value: digitalpoint-site-verify:ab12345cd12345ef12345gh12345  (replaced with your actual DP verification)
TTL: Default (leave as it is)

And that’s it!  Now go back to the screen where you were given the code by DP, and click Verify!  It might take a few minutes (up to an hour actually but it wont take that long xD) to work..

If you need further assistance just leave a comment!


Popularity: 25%

share save 171 16 Verify Domain Ownership on DigitalPoint

Chuckun’s Webmaster Blog makes it to SERP 1 on Google!

Article written by Chuckun on the Webmaster / SEO Blog On June - 17 - 2010

Hooray! Today is a good day!

Why? I have reached page 1 on Google for the keywords: Webmaster Blog!

I have been straining to get on page 1 for a long time, and it seems all that effort has paid off. icon smile Chuckuns Webmaster Blog makes it to SERP 1 on Google!

Thanks to everyone who has linked to my best articles, I am sure this has no doubt helped a lot icon smile Chuckuns Webmaster Blog makes it to SERP 1 on Google!

As a celebration I feel I must do something.. So expect some big change or offer here over the coming week! icon smile Chuckuns Webmaster Blog makes it to SERP 1 on Google!

Thank you all!

Popularity: 6%

share save 171 16 Chuckuns Webmaster Blog makes it to SERP 1 on Google!

Apologies for my absence..

Article written by Chuckun on the Webmaster / SEO Blog On May - 15 - 2009

I would like to apologise for my recent absence. It was unfortunately beyond my control.

I am now back and ready to continue my quest to improve the quality of information on the blog, and provide easy to follow information, guides, and tips to all you webmasters.

I have another apology to webmasters looking for programming help which I cannot provide; my passion lies within PHP / MySQL programming. I apologise for not offering help with other programming languages!

I have a request too; if you know anyone who might find this forum useful, please let them know! In my recent absence I have paid a big price, loosing most of my visitors (thank you, everyone reading, for staying put!).

Thanks a lot people,
Jack

Popularity: 11%

share save 171 16 Apologies for my absence..

Hello World!

Article written by Chuckun on the Webmaster / SEO Blog On February - 12 - 2009

Hello world!

Welcome to my blog! icon smile Hello World!

There’s not much I can say here that I didnt already say over in the About page, other than I can’t wait to get this place active and serve the web with anything from random junk, to PHP tutorials and downloads..

I hope you like the place icon smile Hello World!   Bookmark me!

Popularity: 20%

share save 171 16 Hello World!

Hostgator Affiliate
Privacy Policy | Sitemap

We Compete Competitively for the Keywords: Webmaster Blog | SEO Blog