Posts Tagged ‘FTP’

Creating a Web Page Download Link

Monday, July 14th, 2008

If you have a file you would like to enable your visitors to download, most web servers will allow you to link directly to a download file.

<A HREF=”http://yourdomain.com/file.exe”>File</A>

If you have access to ftp, you can create a download link like this:

<A HREF=”ftp.yourdomain.com/file.zip”>File</A>

If you don’t have access to ftp, you can create a download link like this:

<A HREF=”http://yourdomain.com/file.zip”>File</A>

Instruct your visitors to hold the “shift” key down while they click on the download link.

Php:Adding an extension

Monday, June 30th, 2008

Problem

You need PHP’s built-in ftp functions for the ultra-cool script you are writing, but your service
provider does not have PHP compiled with the –enable-ftp option.

Solution

If you have a shell account on a system with the same operating system as your web server, grab the
PHP source tarball and build using:

–with-apxs –enable-ftp=shared
You can check which flags your provider used by putting a phpinfo() call in a script on your server.

<?phpinfo()?>
Once compiled, you will find a “modules/ftp.so” file which you can copy to your web server and
enable either by putting:

extension=ftp.so
in your php.ini file or by adding this to the top of your script:

<?php dl(”ftp.so”) ?>

PHP:Validate URL (FTP, HTTP) using regular expression ( regex )

Monday, June 30th, 2008

<?php
/**
* valid_url - validates supplied url with a regular expression ( regex ).
*
* URL can be FTP, HTTP secure
* @param $url String
* @return true if the address is valid
* @author RAJI
*
*/
function valid_url( $url )
{
if ( !preg_match( ‘!^((ht|f)tps?://)?[a-zA-Z]{1}([w-]+.)+([w]{2,5})/?$!i’, $url ) )
{
return false;
} else
{
return true;
}
}
if ( valid_url( “http://blog.tryangled.com” ) )
{
echo “URL OK”;
} else
{
echo “Invalid URL.”;
}
?>

Bandwidth

Thursday, June 26th, 2008

Bandwidth is a term that has several different meanings depending on the context. When talking about bandwidth in terms of Web Hosting it refers to the amount of data that transfers into and out of your web hosting account. Incoming data can include requests for web pages, email, FTP requests, and FTP uploads, while outgoing data includes file transfers, web pages, and email. Each hosting account is allocated a certain amount of bandwidth per month. Common figures for bandwidth range from 3 GB for small personal sites up to 200 GB for large business systems.

How much bandwidth do you need? This depends on the amount of traffic your website receives as well as the content. Web pages made up of text and a few pictures are very small in size but if you get thousands of visitors each day you may need a lot of bandwidth. On the other hand website content consisting of downloadable files such as software, music or video is much larger in size, so even if your traffic is fairly low you may need extra bandwidth.

The best way to calculate the amount of bandwidth you need is to calculate the size of your downloadable content and multiply by the number of visitors you receive each month. Add to that the number of emails sent and received and other content such as FTP uploads. The figure you come up with should be pretty accurate because it is unlikely that every visitor to your site is going to download every file or view every page. This will give you a bit of margin to play with.

As your web site grows and as you receive more traffic you may have to increase your bandwidth allotment accordingly. It is better to plan ahead and arrange with your web host for a larger hosting package rather than wait until you go over your limit. Check with your host to see what their policy is in regards to exceeding your bandwidth. Some will allow you to go over by a certain amount while others will shut down your site and demand that you upgrade your account before resuming service. It is always best to keep track of how much bandwidth you are using and anticipate when you need to upgrade.

If you feel that you have sufficient bandwidth and would prefer not to upgrade you may be able to ‘throttle’ traffic if you are approaching your monthly limit. Some hosts offer this service as a way to limit incoming requests or to exclude requests once a certain number has been reached.

There are several throttling options. You can limit the number of incoming requests by specifying an idle time between requests. This causes incoming requests to be delayed by a specified amount of time if too many are arriving at once. Other options are to impose a limit on data transfer within a certain time period or to limit the number of requests for a certain file. The speed of transfers can also be capped at a certain level. Throttling may not be a good idea if you depend on web traffic for your business. If your pages are slow to load or if users can’t access files they are looking for they may give up and move on to another site. If you have a lot of free content, though, throttling can be useful for keeping your hosting budget within a certain amount.

Website Monitoring Services

Thursday, June 26th, 2008

If you have gone through the trouble of building a web site and hosting it with a reliable company you obviously want your website to be available 24 hours a day 7 days a week. Downtime can result in lost sales and customer frustration.

Unfortunately, there are many technical problems beyond your control that can cause your web site to go down or become sluggish. Server hardware and software can fail and your host may schedule downtime for maintenance chores. Speedy recognition of failures is the best defence to getting things back on track, so many companies offer website monitoring services that automatically alert you if your site goes down.

There are hundreds of companies that provide monitoring services. Some are free while others charge anywhere from $5 to $60 per month. The paid services usually offer more features and allow you to use the same service with several different web sites. Web monitoring is not done continuously – time intervals range from every 3 minutes to every hour. The paid services usually offer the most comprehensive monitoring.

Monitoring works by sending an automatic request to your website and checking the response. These requests are the same as a web browser makes and the response to the request determines whether the site is up or down. Requests are usually sent from several different geographical locations to ensure that the site is available from various parts of the world.

If the response code is OK (200, 301, 302, 401, 403) nothing happens and the monitoring software waits for the next scheduled check. If the response code indicates that the web site is unreachable, there will be a second check a few seconds later from another location. There may be 3 or more of these checks before an alert is issued.

An alert can be sent to one or several email addresses or to a mobile device such as a pager or cell phone. This allows you to get in touch with your hosting company as soon as possible to ensure they are aware of the problem and are working to resolve it. As well as HTTP traffic, some website monitors can also check HTTPS, FTP, SMPT and POP3 so that all the functions of your website are covered.

Besides alerting you to downtime, these services can also provide useful statistics in the form of log files that indicate how often a site goes down. This third-party information can be used to demand better service from your web host or a refund in the case of severe amounts of downtime.

If you find that your site has an unacceptable amount of downtime, you should look for a more reliable hosting company.  The best way to find a good host is to ask for recommendations from other web site owners. If they are happy with their service they will usually be glad to direct more business to their host.

DreamHost Security Leak

Friday, June 20th, 2008

I was pretty amazed when I heard a company as prominent as DreamHost have a security leak as massive as 3,500 FTP accounts. Caydel was one of the unfortunate customers who had his account bypassed. Apparently he noticed a ton of spam links placed on his website, but didn’t think of anything at the time. Nevertheless, DreamHost still hasn’t discovered the security hole.