multidomainwindowshostingin

Multi Domain Windows Hosting India 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";
}
?>