Home | Looking for something? Sign In | New here? Sign Up | Log out
Showing posts with label Website. Show all posts
Showing posts with label Website. Show all posts

Monday, September 1, 2014

How to Host a Web Site from Your Computer

In the following article I am going to show you how to host a web site from your own computer. Why would you want to do this you might ask? Well for one, it’s free. It’s also great for hosting small web sites or sharing large files with friends. However, if you are planning on running a site with high traffic I would not recommend this. Just follow these simple steps and you will have your own web server up and running in no time.

Step 1: Go to http://www.snapfiles.com/get/hfs.html and download HFS (Http File Server).
Step 2: Double-click the hfs.exe file that you downloaded. If you have Windows Firewall enabled you will be prompted with a security warning. Click “Unblock” to allow HFS to pass through the firewall.
Step 3: This is the tricky part. The default port that HFS uses is port 80. If your ISP blocks port 80 then you will need to change it to something else. To change it you must turn HFS off. You can do so by clicking the “On” button in the upper left corner. When you are done, turn it back on. If you are behind a router or firewall then you will have to set up port forwarding. If you need help with this go to http://www.portforward.com/. Here you can choose the type of router you have and then choose the program you want to set up port forwarding for such as Http File Server-HFS. It will walk you through the exact steps to set up forwarding.
Step 4: Now you can test your settings to see if they work. Go to the menu and click “Self Test”. If it is successful then your settings are correct. You should now be able to point your web browser to your IP address to see files or pages you are sharing.
Step 5: Now I’m going to tell you how to assign a domain name for your web site. Since you don’t have a DNS server running on your computer, you will need to get DNS service from somewhere else. To do this, we are going to use a service called DynDNS. DynDNS offers a variety of subdomain names to use for free for your website. Go to https://www.dyndns.com/account/entrance/to create a DynDNS account. Login with the account you have created and click on the services button. If you have a dynamic IP address that changes, click on “Dynamic DNS” and then “Add Dynamic DNS”. Choose a subdomain and domain name. Then add the host. Now you have a domain name that you can use and give out instead of your IP address. If you would like to use your own domain name, DynDNS offers a custom DNS service for this as well for a yearly fee.
Step 6: Now go to https://www.dyndns.com/support/clients/ to download the DynDNS Updater. This is to automatically update your Dynamic DNS account in case your external IP address ever changes.
Now you can host a web site from your computer. If you want to change the default page that comes up when you browse to your site, right click on the little icon that looks like a house in the Virtual File System. Click “Default file mask…” and type the name of the file that you want to be served when someone browses to your website such as index.html. If you would like HFS to start automatically when you log into Windows, put a shortcut to it under Start – Programs – Startup. Also be sure to save your Virtual File System settings so HFS will remember the files you are hosting next time you open it up. If you have any more questions check out HFS’s

Friday, August 8, 2014

PHP Connect to the MySQL Server

Use the PHP mysqli_connect() function to open a new connection to the MySQL server.

Open a Connection to the MySQL Server

Before we can access data in a database, we must open a connection to the MySQL server.
In PHP, this is done with the mysqli_connect() function.

Syntax

mysqli_connect(host,username,password,dbname);

ParameterDescription
hostOptional. Either a host name or an IP address
usernameOptional. The MySQL user name
passwordOptional. The password to log in with
dbnameOptional. The default database to be used when performing queries
Note: There are more available parameters, but the ones listed above are the most important.
In the following example we store the connection in a variable ($con) for later use in the script:
<?php
// Create connection
$con=mysqli_connect("example.com","peter","abc123","my_db");

// Check connection
if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>


Close a Connection

The connection will be closed automatically when the script ends. To close the connection before, use the mysqli_close() function:
<?php
$con=mysqli_connect("example.com","peter","abc123","my_db");

// Check connection
if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

mysqli_close($con);
?>

Technology News

Online Money

Review

Motor