resellerwindowshosting

Reseller Windows Hosting US Product

ASP Script to Test MSSQL Database Connectivity

Provided below is a simple ASP script to test MSSQL database connectivity.

Sample Script


Set cn = Server.CreateObject("ADODB.Connection")
cn.Open "Provider=SQLOLEDB;Server=;Database=;UID=;PWD=;"
cn.CommandTimeout = 900
cn.Close
Response.write("Connected Successfully")
%>

Explanation about the variables used in the script:

  • Server: The MSSQL Server IP needs to be mentioned.

  • Database: Specify exact database name. For example, reseloaq_mssql.

  • UID: Mention the database user associated with the database.

  • PWD: Mention the password for the above database user.

PHP Script to Test MySQL Database Connectivity

Provided below is a simple PHP script to test MySQL database connectivity. The result of this script displays the names of the tables present within the specified database.

Sample Script



$connect=mysql_connect("dbserver","dbuser","dbpassword") or die("Unable to Connect");
mysql_select_db("dbname") or die("Could not open the db");
$showtablequery="SHOW TABLES FROM dbname";
$query_result=mysql_query($showtablequery);
while($showtablerow = mysql_fetch_array($query_result))
{
echo $showtablerow[0]." ";
}
?>

Explanation about the variables used in the script:

  • dbserver: Mention the value as localhost for Linux Hosting (cPanel). For Windows Hosting (Plesk), MySQL Server IP needs to be mentioned.

  • dbname: Specify complete database name including the prefix. For example, reseloaq_mysql.

  • dbuser: Mention the database user associated with the database.

  • dbpassword: Mention the password for the above database user.

Collaboration Data Objects (CDO)

Originally known as Active Messaging, the Collaboration Data Objects (CDO) library allows users to send mails through ASP Scripts.

Collaboration Data Objects (CDO) is Microsoft's technology for building messaging or collaboration applications or adding these capabilities to existing applications. Part of the Microsoft Exchange Server
product, CDO has evolved from what Microsoft formerly called Object Linking and Embedding Messaging and, more recently, Active Messaging.

You can use the sample script provided by and tweak it a bit to your requirements, to accept feedback from your website visitors and get
the results emailed to you.

You would need to change the Email Address in the field myMail.From to any Email Address on the domain name on which you are incorporating the script.

Example:

If your Domain Name is abc.com, then you would define the From Email Address as [email protected]. This Email Address need not be existing on the Mail Server of abc.com, however, the
domain name in the myMail.From field has to be yours. You may use an Email Address such as [email protected].

The Email Address in the myMail.To field needs to be changed to your Email Address, where you wish to receive Emails submitted through the form.

Sample Script



Note

The body of the mail should not have bare linefeeds (\n). If a bare linefeed is detected, the SMTP service of Microsoft IIS6 (the Web Server running on
's Windows servers) will stop delivering any mail and the mails will get struck in the SMTP queue. This is because Microsoft IIS6 strictly
follows Internet e-mail standards; and these standards forbid the presence of bare linefeed characters in e-mail messages.

Additional Information

Bare LineFeeds in SMTP

Example:

myMail.TextBody="Thank you for contacting us. We shall get back to you shortly.\n

Kind regards\n

abc.com"

In the above case, bare linefeeds (\n) are being used. Instead of \n, you need to use \r\n (carriage-return, line-feed). Hence, the correct usage would be:


myMail.TextBody="Thank you for contacting us. We shall get back to you shortly.\r\n

Kind regards\r\n

abc.com"

PHP-based Form Mail (Feedback) Script

Using a PHP script, you may accept feedback from your website visitors and get the results emailed to you. You can use the sample script provided
by and tweak it a bit to suit your requirements.

You would need to change the email address in the field $from to any email address on the domain name on which you are incorporating this script.

Example:

If your domain name is yourdomain.com, then you would define the From email address as [email protected].

This email address need not be existing on the mail server of yourdomain.com; however, the domain name in the $from field has to be yours.

You may use an email address such as [email protected].

The value in the $mailto field needs to be changed to the email address, where the email containing the data submitted through the form needs to be delivered.

Note

In an attempt to keep a check on abuse from 's Hosting Servers, the following conditions have been set for mail scripts on 's Linux Hosting Servers:

  • The domain name in either the To or the From email address used in the script should be your domain name hosted with .

    Example: yourdomain.com is hosted with and yourotherdomain1.com and yourotherdomain2.com are hosted with some other hosting provider.

  • For mail scripts with the From email address as <user>@<server_hostname>, the To email address compulsorily should be an email address on your domain name hosted with
    .

    Example: yourdomain.com is hosted with with parent user yourdo & server name cp-00.webhostbox.net and yourotherdomain1.com is hosted with some other hosting provider.

    With the From email address as [email protected]:

Once the visitor provides feedback, you can display a message to the visitor thanking them for their feedback.

Sample Script


$mailto="[email protected]";
$pcount=0;
$gcount=0;
$subject = "Mail from Enquiry Form";

$from="[email protected]";
while (list($key,$val)=each($_POST))
{
$pstr = $pstr."$key : $val \n ";
++$pcount;

}
while (list($key,$val)=each($_GET))
{
$gstr = $gstr."$key : $val \n ";
++$gcount;

}
if ($pcount > $gcount)
{
$message_body=$pstr;
mail($mailto,$subject,$message_body,"From:".$from);
echo "Mail has been sent";
}
else
{
$message_body=$gstr;
mail($mailto,$subject,$message_body,"From:".$from);
echo "Mail has been sent";
}
?>

FileZilla

To Upload Content/Files using FileZilla

  1. Open FileZilla and choose Site Manager under the File menu.

  2. Click the New Site button.

  3. Provide the following details, label the entry as yourdomainname.com and click the Connect button:

    Host: yourdomainname.com

    Port: 21

    Protocol: FTP - File Transfer Protocol

    Encryption: Require explicit FTP over TLS

    Logon Type: Normal

    User: FTP Username for yourdomainname.com

    Password: Password for the above FTP User

  4. Select the Always trust certificate in future sessions. option and then click the OK button.

  5. Once connected, open the relevant folder by double-clicking it:

    • cPanel - public_html

    • Plesk - httpdocs

    Note

    Depending upon the Directory/Folder structure of the Web Hosting package, you would need to upload your files to the relevant
    folder. See details

  6. In the left pane, select the files to upload. Right-click and choose Upload.

    The files will be transferred to the remote server.

To Enable Active/Passive Mode FTP (Anchor: ftpmode)

Different modes of data connection can be used during
FTP. See details

There are 2 ways in which the data connection mode can be modified.

Global Settings

  1. Choose Settings under the Edit menu.

  2. The Passive mode for data connection is set by default. Under the Connection section, click FTP and select
    the Active radio button to enable the
    Active mode.

  3. Click OK to save the changes. This change will affect all the sites for whom the data connection mode was set by default.

For Individual Sites

  1. Choose Site Manager under the File menu.

  2. Select yourdomainname.com and click the Transfer settings tab. Here, you can change the data connection
    mode to Active or
    Passive.

  3. Click OK to save the changes. The change is saved and active for future FTP sessions of this site.

WinSCP

To Upload Content/Files using WinSCP

  1. Open WinSCP.

  2. Provide the Host name, User name and Password information, set Port number to 21 and click the
    Save button.

    Uploading content is allowed only through FTPS on Port 21. Hence, besides File Protocol you need to select FTP in the first dropdown menu and
    TLS Explicit encryption in the next.

    Additional Information

    FTPS

  3. Confirm the entry as shown below.

  4. In the Stored sessions section, select yourdomainname.com and click the Login button.

  5. Once connected, open the Web folder by double-clicking it.

    Note

    Depending upon the Directory/Folder structure of the Web Hosting package, you would need to upload your files to the relevant
    folder. See details

  6. Select the desired files in the left window and from the Files menu, click Copy.

  7. Confirm the file transfer by clicking the Copy button.

    The files will be transferred to the remote server.

To Enable Active/Passive Mode FTP

Different modes of data connection can be used during FTP. See details

The data connection mode can be modified in WinSCP client as follows:

  1. Under Stored sessions, select yourdomainname.com and click the Edit button.

  2. Select the Advanced options check box.

  3. By default, the data connection mode is set to Active mode. Click Connection and select the Passive mode check box.

  4. Click the Save button. The change is saved and active for future FTP sessions of this site.