vpslinuxus

Reseller should be signed up for VPS Linux US Product

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.

Customizing the Upsell Modal

During the Domain Registration process, the SuperSite 2 displays a modal which upsells Linux Hosting by default. Through your SuperSite 2 Admin Area, you may select a different product to sell in the Upsell Modal.

How do I Select a Product to Sell in the Upsell Modal?

Step 1: Login to your SuperSite 2 Admin Area. Learn how.

Step 2: Navigate to the Upsell settings page.

  • In the Menu, click on the Settings link.


  • Click on the Change Product button under Customize Upsell Modal.

Step 3: Select a product to Upsell.

  • You may choose to upsell either a Combo Plan or any other product. Click on Upsell a Combo Plan or Upsell a Product as required.


  • If you have selected a Combo Plan, you can select a single plan to upsell from the drop down list under Upsell a Combo Plan.


  • In case you wish to upsell a different product, you can select it from the drop down list under Upsell a Product.


  • If you wish to disable the Upsell Modal, you can select None from the list under Upsell a Product.


  • Click on the Save button to submit the changes.

Note

  • The drop-down menu will display only those Products which you have chosen to sell. Products set to No New Orders or Do Not Sell will not be listed here.

  • This process will customize the Upsell Modal for every Language SuperSite that you have created.

  • Your SuperSite 2 will not display the modal if you choose to sell only Domain Names. Hence, the Customize Upsell Modal section will not be visible in your SuperSite 2 Admin Area in this case.

  • If you have chosen to upsell a Combo Plan, the Upsell Modal will be displayed to the customer only if they select a TLD available with the Combo Plan.

Perl-based Form Mail (Feedback) Script

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

Sample Script


#!/usr/bin/perl
print "Content-type: text/html\n\n";
#
$title='Perl Mail demo';
$to='TO_Email';
$from= '[email protected]';
$subject='perl mail';

open(MAIL, "|/usr/sbin/sendmail -t");

## Mail Header
print MAIL "To: $to\n";
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n\n";
## Mail Body
print MAIL "This is a test message
mail body text here\n";

close(MAIL);

print "

$title\n\n\n";

print "

$title

A message has been sent from $from to $to

";
#

Note
  • The .pl file containing the script needs to be uploaded to your web server in ASCII mode only.

  • The .pl file needs to have execute permissions for the normal web user. For example, the .pl file can have permissions 755 or 765.

Sample HTML Feedback Form

The following code needs to be added in the form which connects to the above script:

Below is the explanation about the variables in the code:

  • recipient: This would be the email address, where the email containing the data submitted through the form needs to be delivered.

  • email: You would need to change the email address in the email field to any email address on the domain name, on which you are incorporating this script. For example, if you are deploying this script on 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 email field has to be yours. This implies that you may use an email address such as [email protected]. This email address will appear as the From email address in the email sent by the script.

  • realname: The value here indicates the name mentioned in the From section of the email, that will be sent upon submission of this form. This can be modified as per your requirement.

  • subject:The value in this field can be changed to indicate an appropriate subject for the mail to be sent. For example, you may set this as YourDomain.com Feedback Form or any other subject that would allow you to uniquely identify from which form on your website this data has been received.

  • redirect: Once the visitor provides feedback, he/she can then be redirected to another page on your website. In order to achieve this, you need to mention the path to the HTML file in the redirect field. Alternately, you can display a message to the visitor thanking him/her for the feedback. Such messages can be displayed in a new page like thanks.htm. Such a page can also contain other information as deemed necessary.

Note

In an attempt to keep a check on abuse from firstfoot Interactive Pvt Ltd.'s Hosting Servers, the following conditions have been set for mail scripts on firstfoot Interactive Pvt Ltd.'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 firstfoot Interactive Pvt Ltd..

    Example: yourdomain.com is hosted with firstfoot Interactive Pvt Ltd. 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
    firstfoot Interactive Pvt Ltd..

    Example: yourdomain.com is hosted with firstfoot Interactive Pvt Ltd. 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]:

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 firstfoot Interactive Pvt Ltd. 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 firstfoot Interactive Pvt Ltd.'s Hosting Servers, the following conditions have been set for mail scripts on firstfoot Interactive Pvt Ltd.'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 firstfoot Interactive Pvt Ltd..

    Example: yourdomain.com is hosted with firstfoot Interactive Pvt Ltd. 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
    firstfoot Interactive Pvt Ltd..

    Example: yourdomain.com is hosted with firstfoot Interactive Pvt Ltd. 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.