GoWebsite.com's Website Hosting Features

CONTENTS
1  Java Hosting
2  PHP Support
3  MySQL Database Support
4  SQL Server Database Support
5  Microsoft Access Database Support
6  Windows file DSN
7  Hosting Path


Java Hosting

The Java hosting server is running Tomcat 5.0.27, which is automatically restarted each day at 1:00a.m., Arizona Time.

  • All Java hosting accounts share one JVM.
  • All Java hosting accounts support both PHP and CGI.
  • Jk2-2.0.4 is used to connect Apache 1.3.31 to Tomcat 5.0.27.

jdom.jar, dom.jar, mysql-connector-j.jar, mailapi.jar, smtp.jar, and activation.jar are all installed in the share class path. You may add extra jars under /WEB-INF/lib folder, or you may package the jar files into a war file. Note: To update a war file, you must first remove the exploded directory for the war file and then add the updated war file.

Website Applications Each Java hosting account comes with a default Web application that is located under your home directory. The /WEB-INF folder under the home directory contains the default application configuration information. You can also create Website applications by creating subdirectories under your home directory and create WEB-INF under it, or simply upload a war file into the home directory. The war file automatically expands into a subfolder of the same name under home directory. Website applications may only write into the /tmp folder.

servlets In order to deploy a servlet, you will need to first compile it at your local box and then uploaded the class file to the WEB-INF/classes directory. You should then be able to run it by entering the URL http://yourdomain/servlet/yourservletname. Alternately, you may package it into a jar file and upload the jar file to the WEB-INF/lib directory. However, if you choose to use a jar file, you must wait for Tomcat to restart at its scheduled time before you see the servlet.

Java Mail Java mail is only allowed to connect to the smtp server: relay-app.secureserver.net. To protect against spam, we allow no more than 1000 emails sent from each email account.


PHP Support

PHP is a simple, yet powerful Web server scripting language used for embedding dynamic content into HTML Web pages. PHP stands for PHP: Hypertext Preprocessor.

Users who are not familiar with PHP and thus unable to write their own programming code can add PHP-controlled dynamic content to their Websites by downloading existing scripts and adding them to their sites. There are a multitude of free, downloadable PHP scripts already written and distributed on the Internet. There are also a large number of tutorial resources available, including the full-language documentation at http://www.php.net/

PHP can be used to connect to MySQL databases, generate dynamic data from XML files in your content directory or even generate dynamic images for your Web pages.
Using PHP with a MySQL database enables you to run such Website types as Web portals, Web services, bloggers, other types of informational sites and many more.

PHP is automatically enabled with all of the hosting accounts we offer. Once a hosting account is activated, you can create and upload PHP pages to your account. The uploaded pages will be functional instantly (as long as your PHP code is correct, of course!). There are several good (and many are free) PHP editors available for writing your PHP code, but technically you can use any text editor program to write a PHP file. After you have written the PHP code, name the file with a ".php" extension and upload it to your hosting account directory.
Our version of Linux PHP.
Our version of Windows PHP.

PHP Disabled Functions (Linux): All Posix functions disabled. Also, the following functions are disabled: fpassthru, file, mail, exec, system, passthru, popen, crack_check, crack_closedict, crack_getlastmessage, crack_opendict, fsockopen, psockopen, opendir, readdir, closedir, phpinfo.

PHP Mail Function Enabled (Non CGI Linux Plans ONLY):
(Only 50 email messages allowed every 24 hours) This will allow customers to send email, however, the preferred method is to use our form mailer PHP script that has already been written and tested.
Note: Windows users can use ASP/ASP.NET with CDONTS for sending mail.

PHP Disabled Functions (Windows):
fopen, fwrite, fread, fpassthru, file, mail, exec, system, passthru, popen, crack_check, crack_closedict, crack_getlastmessage, crack_opendict, fsockopen, psockopen, opendir, readdir, closedir, phpinfo.

PHP Libraries Supported:
MySQL, GD Image (with freetype), XML, GetText (multi-language support)

* Note: Curl is also enabled under Linux. When using Curl under linux to connect to a https server, you must use our https proxy. This is defined by using the curl options:

curl_setopt ($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE);
curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt ($ch, CURLOPT_PROXY, "http://64.202.165.130:3128");
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

More information can be obtained from http://www.php.net/ on exactly which features are disabled or restricted in "safe mode."


Simple PHP Examples:

Using Forms

<?php

if($_POST["name"] != "")
{
  echo "Hi ".$_POST["name"]."<br>";
  echo "You are ". $_POST["age"]." years old.";
}
?>

<form action="<?php $PHP_SELF;?>" method="POST">
Your name: <input type="text" name="name">
Your age: <input type="text" name="age">
<input type="submit">
</form>


Using Server Variables / Cookies

<?php

$value = 'Well, this is a cookie';
setcookie ("TestCookie", $value,time()+3600); /* expire in 1 hour */
if (strstr($_SERVER["HTTP_USER_AGENT"], "MSIE"))
{
echo "You are using Internet Explorer<br>";
}
echo "http host: ".$_SERVER["HTTP_HOST"]."
";
echo "Your IP address: ".$_SERVER["REMOTE_ADDR"]."
";

// Print an individual cookie
if($_COOKIE)
{
echo $HTTP_COOKIE_VARS["TestCookie"];
}
?>


MySQL Databases

MySQL is a sophisticated and powerful relational database server. The MySQL databases are centrally located on our reliable, powerful and secure servers.
We are currently using MySQL Version 3.23.55. You can create a MySQL database by selecting a user name and password in the hosting management area of the website. The selected user name will also serve as the database name.

After the new MySQL database is activated you will be provided with a link to the MySQL management Website from which you will be able to perform all the necessary commands, including creating and deleting tables; and inserting, updating and deleting database records. You will be required to log in using the user name and password you selected during the database creation.

While utilizing this feature requires you to have at least a basic understanding of using a database in conjunction with a scripting language, you will be provided with basic examples of connecting and querying a MySQL database from a Website. You can access your MySQL database using PHP, ASP, ASP.NET or Perl. For the Windows hosting plans, in addition to PHP you can also use ASP/ASP.NET with ADO.

More information about MySQL and using MySQL can be found here: #

PHP MySQL Connection Example (Windows and Linux):

<?php
//Sample Database Connection Syntax for PHP and MySQL.

//Connect To Database

// please remember that localhost will not be the hostname to connect to
// replace mysql.secureserver.net with the hostname listed in your database settings screen
$hostname="mysql.secureserver.net";
$username="your_dbusername";
$password="your_dbpassword";
$dbname="your_dbusername";
$usertable="your_tablename";
$yourfield = "your_field";

mysql_connect($hostname,$username, $password) OR DIE ("<html><script language='JavaScript'<alert('Unable to connect to database! Please try again later.'),history.go(-1)</script></html>");
mysql_select_db($dbname);

# Check If Record Exists

$query = "SELECT * FROM $usertable";

$result = mysql_query($query);

if($result)
{
  while($row = mysql_fetch_array($result))
  {
    $name = $row["$yourfield"];
    echo "Name: ".$name."<br>";
  }
}
?>


ASP/ADO ASP.NET/ADO MYSQL CONNECTION EXAMPLE (Windows Only, DSN-Less connection):
<%
Dim oConn, oRs
Dim qry, connectstr
Dim db_name, db_username, db_userpassword
Dim db_server

db_server = "mysql.secureserver.net"
db_name = "your_dbusername"
db_username = "your_dbusername"
db_userpassword = "your_dbpassword"
fieldname = "your_field"
tablename = "your_table"

connectstr = "Driver={MySQL ODBC 3.51 Driver};SERVER=" & db_server & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr

qry = "SELECT * FROM " & tablename

Set oRS = oConn.Execute(qry)

if not oRS.EOF then
while not oRS.EOF
response.write ucase(fieldname) & ": " & oRs.Fields(fieldname) & "<br>"
oRS.movenext
wend
oRS.close
end if

Set oRs = nothing
Set oConn = nothing

%>


Perl MYSQL CONNECTION EXAMPLE (Linux, CGI Plans only):

#!/usr/bin/perl -T
print "ContentType: text/plain\n\n";

use DBI;

# Connecting to the database
# Replace DATABASENAME with the name of the database,
# HOSTNAME with the hostname/ip address of the MySQL server.
$drh = DBI->install_driver("mysql");
$dsn = "DBI:mysql:database=your_databasename;host=mysql.secureserver.net";
$dbh = DBI->connect($dsn,"your_dbusername","your_dbpassword");


# Select the data and display to the browser

my $sth = $dbh->prepare("SELECT * FROM customers");
$sth->execute();
while (my $ref = $sth->fetchrow_hashref()) {
print "Found a row: id = $ref->{'id'}, name = $ref->{'name'}\n";
}

$sth->finish();

# Disconnect from the database.

$dbh->disconnect();


Windows SQL Server Database support

Microsoft SQL Server 2000 databases are available to certain hosting plans. These databases are stored on a remote server, separate from the hosting server. You may manage your databases using the SQL Website Administration interface, including creating/deleting tables, stored procedures and manipulating data. The Website interface also provides a query tool, an import tool, and a way to generate insert scripts (to move data from one database to another).

ASP/ADO ASP.NET/ADO Microsoft SQL Server Database Connection Example (Currently Windows Only, DSN-Less Connection):
<%

'Sample Database Connection Syntax for ASP/ASP.NET and SQL Server.

Dim oConn, oRs
Dim qry, connectstr
Dim db_name, db_username, db_userpassword
Dim db_server

db_server = "whsql01.mesa1.secureserver.net"
db_name = "your_dbname"
db_username = "your_dbusername"
db_userpassword = "your_dbpassword"
fieldname = "your_field"
tablename = "your_table"

connectstr = "Driver={SQL Server};SERVER=" & db_server & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr

qry = "SELECT * FROM " & tablename

Set oRS = oConn.Execute(qry)

if not oRS.EOF then
while not oRS.EOF
response.write ucase(fieldname) & ": " & oRs.Fields(fieldname) & "
"
oRS.movenext
wend
oRS.close
end if

Set oRs = nothing
Set oConn = nothing

%>


Windows Access Database support

An Access database is a relational database contained in a single file stored in the local Website content directory.

Access database files are generally created using the Microsoft Access application.

The difference between an Access database and a MySQL database is that an Access database is a "local" file on the hosting server that the user uploads to his/her hosting directory. Microsoft Access databases can be used with or without FrontPage Servers Extensions. If you choose to use an Access database with FrontPage extensions, your FrontPage client software can create all the necessary settings in your Website hosting directory for the database to work properly. For this reason, you may either choose to use our version of Access database support or the FrontPage Server Extensions support for Access database, but not both. Microsoft Access database support is available with all Windows-based hosting accounts.

Please note: the ASP/ADO and ASP.NET/ADO examples also apply to Access databases, however, the database connection syntax will be slightly different.

ASP/ADO Access Database Connection Example (Windows Only, DSN-Less Connection):
<%
Dim oConn, oRs
Dim qry, connectstr
Dim db_path
Dim db_dir
db_dir = Server.MapPath("\access_db")
db_path = db_dir & "\yourdatabasefile.mdb"
fieldname = "your_field"
tablename = "your_table"

connectstr = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & db_path

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr

qry = "SELECT * FROM " & tablename

Set oRS = oConn.Execute(qry)

if not oRS.EOF then
  while not oRS.EOF
    response.write ucase(fieldname) & ": " & oRs.Fields(fieldname) & "<br>"
    oRS.movenext
  wend
oRS.close
end if

Set oRs = nothing
Set oConn = nothing

%>


Windows File DSN for Access databases, MySQL, and MsSQL databases

The purpose of the Windows file DSN (data source name) is to centrally store your database connection information. If you have many Web pages that require database access, this feature enables you to simply reference the path of the file DSN instead of having to provide the database connection details on every page. For security reasons, the file DSN is kept in a sub-directory of your hosting content directory that cannot be viewed by anonymous Web users. The file DSN works with ASP as well as ASP.NET using ADO to access a database.

ASP/ADO Connection Example (Windows Only, Using File DSN):
<%
Dim oConn, oRs
Dim qry, connectstr, sDSNDir
Dim db_name, db_username, db_userpassword
Dim db_server, dsn_name

dsn_name = "your_dsn_name"
fieldname = "your_fieldname"
tablename = "your_tablename"

sDSNDir = Server.MapPath("\_dsn")

connectstr = "filedsn=" & sDSNDir & "\" & dsn_name

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr

qry = "SELECT * FROM " & tablename

Set oRS = oConn.Execute(qry)

if not oRS.EOF then
while not oRS.EOF
response.write ucase(fieldname) & ": " & oRs.Fields(fieldname) & "<br>"
oRS.movenext
wend
oRS.close
end if

Set oRs = nothing
Set oConn = nothing

%>

Hosting Paths


Windows - ASP Hosting

Within ASP/ASP.NET, you can use the function: Server.MapPath("\") , which will return with the full path to your hosting account. If you create a directory called 'subdir', you could return the path to 'subdir' using: Server.MapPath("\subdir") .

Keep in mind that with ASP hosting, the root directory of a hosting account will never have write access via an ASP/ASP.NET script. If you wish to specify write access to a subfolder, you must define 'write' access to that folder through the 'Custom Directory Permissions' option in your hosting account settings. The 'Custom Directory Permissions' settings are also used to setup a "Virtual Root" in IIS by choosing the 'Set Root' option.

ASP Server Path Example:

<%
Dim thepath
thepath = Server.MapPath("\")
response.write thepath
%>


Linux - Economy/CGI/Perl/Java Hosting

The path below is your absolute or full path. The three letters you see towards the middle will vary by username. If your username were 'mruser' the three letters would be as follows: /home/content/m/r/u/mruser/html/ . In other words, the first three letters of the username define the /home/content/1/2/3/username/html/ of the path, where 1 is the first letter of the username, 2 is the second letter, and 3 is the third.

If you have a CGI/Perl or Java enabled account the system path to our Perl interpreter to use would be: #!/usr/bin/perl . Please note that CGI binaries must end in .cgi or .pl and must be in the /cgi directory for you to use. You cannot use /cgi-bin/ with our hosting system.

GoWebsite.com