Jump to content

Recommended Posts

phpmailscript-lite-1.0.3  ---ISP has taken authors site down.

 

I put all the files in a directory on the server as directed.

 

Running "install.PHP" on the server installs it into mysql.

 

The page loads and asks for database names and passwords and more.  I tried every combination possible.

 

I keep getting "1) Unable to establish a connection to the MySQL server.

Lost connection to MySQL server during query".

 

I have attached the install file.

 

Is there someone who would load this file please walk me through it.

 

Newbie   

 

Link to comment
https://forums.phpfreaks.com/topic/53012-solved-install-php-email-on-server/
Share on other sites

Thanks for replying,ACE. :)

 

Here is the link for the code showing below:

 

http://melendy-mi.com/email/install.php

 

 

Install.PHP file:

<?php

// ############################# PHPMAILSCRIPT VERSION ############################

 

$phpmsversion = '1.0.3 Lite';

 

// ############################## STORE RANDOM COOKIE ############################

 

srand((float) microtime() * 10000000);

$input = array("a", "b", "c", "d", "e","f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z");

$rand_keys = array_rand($input, 15);

$rand .= $input[$rand_keys[0]];

$rand .= $input[$rand_keys[1]];

$rand .= $input[$rand_keys[2]];

$rand .= $input[$rand_keys[3]];

$rand .= $input[$rand_keys[4]];

$rand .= $input[$rand_keys[5]];

$rand .= $input[$rand_keys[6]];

$rand .= $input[$rand_keys[7]];

$rand .= $input[$rand_keys[8]];

$rand .= $input[$rand_keys[9]];

$rand .= $input[$rand_keys[10]];

 

$randc2 = "$rand";

 

// ############################## HEADER AND FOOTER ############################

 

echo '<html>

<head>

<title>Phpmailscript Admin Login</title>

<STYLE TYPE="text/css">

.border {

  border: 1px #FFFFFF solid

  }

.textinput  {

        color: #FFFFFF;

        font-size: 10px;

        background-color: #6C7BA7;

        border: 1px white solid;

  }

.link {

color: #FFFFFF;

}

</STYLE>

</head>

<body bgcolor="#6C7BA7">

<center>

<span style="font-size: 48px; color: rgb(255, 255, 255); font-family: georgia;">Phpmailscript</span><br>

<span style="font-size: 20px; color: rgb(255, 255, 255); font-family: georgia;">Installation</span>

</center>

<center>

<table width="500" height="500" class="border"><tr><td>

<center>

<span style="font-size: 12px; color: rgb(255, 255, 255); font-family: georgia;">

<br>';

 

// store the footer in a var since it will be used in different parts of this file

$footer = '</span>

  </td>

          </tr>

          </table>

          </body>

          </html>';

 

 

// ################# CHECK IF PHPMAILSCRIPT IS ALREADY INSTALLED ##################

 

@include('dbconnect.php');

 

if(defined('PHPMS_INSTALLED'))

{

  echo '<b>PHPmailscript Installed</b><br />

        PHPmailscript has already been installed, if you wish to erase your installation

        and start over then you will need to delete the contents of dbconnect.php

        (dbconnect.php).';

 

  echo $footer;

  exit();

}

 

 

// #################### CHECK DBCONNECT EXISTS AND IS WRITABLE ####################

 

if(!file_exists('dbconnect.php'))

{

  echo '<b>Could not find dbconnect.php</b><br/>

        Make sure to rename the file dbconnect.php.new to dbconnect.php<br />

        The file is located in the main directory.<br /><br />

 

        Once renamed, you must also CHMOD "dbconnect.php" to 766.<br />

        For security purposes, it is important to CHMOD back to 644 after installation.';

 

  echo $footer;

  exit();

}

else if(!is_writable('dbconnect.php'))

{

  @chmod("dbconnect.php", 0776);

 

  if(!is_writable('dbconnect.php'))

  {

    echo '<b>File dbconnect.php is not writable</b><br />

          Before installing you must CHMOD "dbconnect.php" to 766.<br />

          The file is located in the main directory.<br /><br />

 

          For security purposes, it is important to CHMOD back to 644 after installation.';

  }

 

  echo $footer;

  exit();

}

 

 

// ############################### GET POST VARS ###############################

 

$servername      = isset($_POST['install']) ? $_POST['servername']      : 'localhost';

$database        = isset($_POST['install']) ? $_POST['database']        : '';

$dbusername      = isset($_POST['install']) ? $_POST['dbusername']      : '';

$dbpassword      = isset($_POST['install']) ? $_POST['dbpassword']      : '';

 

$username        = isset($_POST['install']) ? $_POST['username']        : '';

$password        = isset($_POST['install']) ? $_POST['password']        : '';

$confirmpassword = isset($_POST['install']) ? $_POST['confirmpassword'] : '';

 

// ############################ INSTALL PHPMAILSCRIPT #############################

 

if(isset($_POST['install']))

{

  // check for errors

 

  if(strlen($dbusername) == 0)

    $installerrors[] = 'Please enter a username for your database to be able to connect.';

 

  if(strlen($dbpassword) == 0)

    $installerrors[] = 'Please enter a password for your database to be able to connect.';

 

    if(strlen($username) == 0)

    $installerrors[] = 'Please enter a username for your PHPmailscript Admin account.';

 

  if(strlen($password) == 0)

    $installerrors[] = 'Please enter a password for your PHPmailscript Admin account.';

 

  if($password != $confirmpassword)

    $installerrors[] = 'The entered confirm password does not match the original password.'; 

 

  // attempt to connect to the database

  if($connection = @MYSQL_CONNECT($servername, $dbusername, $dbpassword))

  {

    // connected, now lets select the database

    if(!@MYSQL_SELECT_DB($database, $connection))

    {

      // The database does not exist... try to create it:

      if(!@MYSQL_QUERY("CREATE DATABASE $database"))

      {

        $installerrors[] = 'The database "' . $database . '" does not exist.<br />' . mysql_error();

      }

      else

      {

        // Success! Database created

        MYSQL_SELECT_DB($database, $connection);

      }

    }

  }

  else

  {

    // could not connect

    $installerrors[] = 'Unable to establish a connection to the MySQL server.<br />' . mysql_error();

  }

 

 

  if(!isset($installerrors))

  {

  // write config file

  $dbconnectfile="<"."?php

 

\$dbtype      = 'mysql';

 

\$servername  = '$servername';

\$database      = '$database';

\$dbusername  = '$dbusername';

\$dbpassword  = '$dbpassword';

\$randc = '$randc2';

 

define('PHPMS_INSTALLED', true);

 

\$connection = mysql_connect(\$servername,\$dbusername,\$dbpassword);

@mysql_select_db(\$database, \$connection)or die(\"MySQL Error: Could not connect to database\"); 

?".">";

 

  // write the config file

  $filenum = fopen ("dbconnect.php","w");

  ftruncate($filenum, 0);

  fwrite($filenum, $dbconnectfile);

  fclose($filenum);

 

 

  // ############################### MYSQL QUERY ################################

 

 

  MYSQL_QUERY("DROP TABLE IF EXISTS pageinfo");

  MYSQL_QUERY("DROP TABLE IF EXISTS pagetext");

  MYSQL_QUERY("DROP TABLE IF EXISTS users");

  MYSQL_QUERY("DROP TABLE IF EXISTS words");

  MYSQL_QUERY("DROP TABLE IF EXISTS errors");

  MYSQL_QUERY("DROP TABLE IF EXISTS emails");

  MYSQL_QUERY("DROP TABLE IF EXISTS captcha");

  MYSQL_QUERY("DROP TABLE IF EXISTS ads");

  MYSQL_QUERY("DROP TABLE IF EXISTS ip"); 

 

  MYSQL_QUERY ("CREATE TABLE ads (

  id          INT(6)        NOT NULL AUTO_INCREMENT,

  border      VARCHAR(6)    NOT NULL DEFAULT '',

  bg          VARCHAR(6)    NOT NULL DEFAULT '',

  link        VARCHAR(6)    NOT NULL DEFAULT '',

  url          VARCHAR(6)    NOT NULL DEFAULT '',

  text        VARCHAR(6)    NOT NULL DEFAULT '',

  PRIMARY KEY (id)

  )")  or die(mysql_error());   

 

  MYSQL_QUERY("CREATE TABLE ip (

  id                  INT(99) NOT NULL AUTO_INCREMENT,

  ip       TEXT    NOT NULL DEFAULT '',

  PRIMARY KEY (id)

  )") or die(mysql_error());

 

  MYSQL_QUERY("CREATE TABLE captcha (

  id                  INT(6)      NOT NULL AUTO_INCREMENT,

  captcha_choose      TEXT    NOT NULL DEFAULT '',

  captcha_text        TEXT    NOT NULL DEFAULT '',

  captcha_error        TEXT    NOT NULL DEFAULT '',

  PRIMARY KEY (id)

  )") or die(mysql_error()); 

 

  MYSQL_QUERY("CREATE TABLE pagetext (

  id                  INT(6)      NOT NULL AUTO_INCREMENT,

  mail_email_size      TEXT  NOT NULL DEFAULT '',

  mail_name_size      TEXT  NOT NULL DEFAULT '',

  mail_subject_size    TEXT  NOT NULL DEFAULT '',

  mail_message_cols    TEXT  NOT NULL DEFAULT '',

  mail_message_rows    TEXT  NOT NULL DEFAULT '',

  mail_message_value  TEXT  NOT NULL DEFAULT '',

  mail_submit_value    TEXT  NOT NULL DEFAULT '',

  mail_to              TEXT  NOT NULL DEFAULT '',

  PRIMARY KEY (id)

  )") or die(mysql_error());

 

  MYSQL_QUERY("CREATE TABLE errors (

  id                  INT(6)      NOT NULL AUTO_INCREMENT,

  error_wait_message  TEXT  NOT NULL DEFAULT '',

  error_wait_time      TEXT  NOT NULL DEFAULT '',

  error_iea_message    TEXT  NOT NULL DEFAULT '',

  error_ns_message    TEXT  NOT NULL DEFAULT '',

  error_nm_message    TEXT  NOT NULL DEFAULT '',

  error_nn_message    TEXT  NOT NULL DEFAULT '', 

  error_gb_text    TEXT NOT NULL DEFAULT '',

  error_ty_message    TEXT  NOT NULL DEFAULT '',

  PRIMARY KEY (id)

  )") or die(mysql_error());

 

    MYSQL_QUERY("CREATE TABLE emails (

  id                  INT(99)        NOT NULL AUTO_INCREMENT,

  email_choose        TEXT NOT NULL DEFAULT '',

  email_to            TEXT NOT NULL DEFAULT '',

  email_subject        TEXT NOT NULL DEFAULT '',

  email_message        TEXT NOT NULL DEFAULT '',

  email_name          TEXT NOT NULL DEFAULT '',

  email_email          TEXT NOT NULL DEFAULT '',

  PRIMARY KEY (id)

  )") or die(mysql_error());

 

  MYSQL_QUERY("CREATE TABLE pageinfo(

  id              INT(6)        NOT NULL AUTO_INCREMENT,

  title            TEXT NOT NULL DEFAULT '',

  head1            TEXT NOT NULL DEFAULT '',

  headtitle_start  TEXT NOT NULL DEFAULT '',

  headtitle        TEXT NOT NULL DEFAULT '',

  headtitle_end    TEXT NOT NULL DEFAULT '',

  headcss_start    TEXT NOT NULL DEFAULT '',

  headcss          TEXT          NOT NULL DEFAULT '',

  headcss_end      TEXT NOT NULL DEFAULT '',

  header          TEXT          NOT NULL DEFAULT '',

  footer          TEXT          NOT NULL DEFAULT '',

  footer1          TEXT NOT NULL DEFAULT '',

  PRIMARY KEY (id)

  )") or die(mysql_error());

 

  MYSQL_QUERY("CREATE TABLE words(

  id              INT(6)      NOT NULL AUTO_INCREMENT,

  words_email      TEXT  NOT NULL DEFAULT '',

  words_name      TEXT  NOT NULL DEFAULT '',

  words_subject    TEXT  NOT NULL DEFAULT '',

  words_message    TEXT  NOT NULL DEFAULT '',

  PRIMARY KEY (id)

  )") or die(mysql_error()); 

 

  MYSQL_QUERY ("CREATE TABLE users (

  id          INT(6)        NOT NULL AUTO_INCREMENT,

  username    VARCHAR(30)  NOT NULL DEFAULT '',

  password    VARCHAR(32)  NOT NULL DEFAULT '',

  PRIMARY KEY (id)

  )")  or die(mysql_error()); 

 

  MYSQL_QUERY ("INSERT INTO ads VALUES('','FFFFFF','6C7BA7','FFFFFF','FFFFFF','FFFFFF')") or die(mysql_error());

 

    MYSQL_QUERY ("INSERT INTO emails VALUES('','y','main_settings','main_settings','main_settings','main_settings','main_settings')") or die(mysql_error());

 

    MYSQL_QUERY ("INSERT INTO captcha VALUES('','y','<br>Code:','<center><h4>The code you entered was incorrect or did not match the case of the letters.</h4></center>')") or die(mysql_error());

 

  MYSQL_QUERY ("INSERT INTO errors VALUES(

  '','<center><h4>Cannot send your email. You can send an email only once in 10 minutes.</h4></center>','600','<center><h4>Invalid email address</h4></center>','<center><h4>No Subject</h4></center>','<center><h4>No Message</h4></center>','<center><h4>No Name</h4></center>','Go Back','<center><h4>Thank you for sending email.</h4></center>')") or die(mysql_error());

 

  MYSQL_QUERY ("INSERT INTO users VALUES('','".$username."','".md5($password)."')") or die(mysql_error());

 

  MYSQL_QUERY ("INSERT INTO words VALUES('','<b>Email:</b>','<b>Name:</b>','<b>Subject:</b>','<b>Message:</b>')") or die(mysql_error()); 

 

  MYSQL_QUERY ("INSERT INTO pageinfo VALUES ('1','Phpmailscript','<html><head>','<title>','Phpmailscript','</title>','<style type=\"text/css\">','

BODY { background-color: #6C7BA7}     

.border {

        border: 1px #FFFFFF solid

  }

.link {

    color: #FFFFFF;

}

.name  {

        color: #FFFFFF;

        font-size: 10px;

        background-color: #6C7BA7;

        border: 1px white solid;

  }

.message {

        color: #FFFFFF;

        font-size: 12px;

        background-color: #6C7BA7;

        border: 1px white solid;

  }

.email  {

        color: #FFFFFF;

        font-size: 10px;

        background-color: #6C7BA7;

        border: 1px white solid;

  }

.subject  {

        color: #FFFFFF;

        font-size: 10px;

        background-color: #6C7BA7;

        border: 1px white solid;

  }

','</style></head><body>','

<center>

<span style=\"font-size: 48px; color: rgb(255, 255, 255); font-family: georgia;\">Phpmailscript</span><br>

</center>

<center>

<br> 

<table width=\"500\" height=\"500\" class=\"border\"><tr><td>

<center>

<span style=\"font-size: 12px; color: rgb(255, 255, 255); font-family: georgia;\">

','</span></center></td></tr></table></center>','</body></html>')");

  MYSQL_QUERY ("INSERT INTO pagetext VALUES ('1','20','20','20','50','20','Message Value','Send','support@yourdomain.com')");

 

  echo 'Installation Successfull!

        <br /><br />

        <a href="index.php" class="link"><b>Click here to view your Phpmailscript!</b></a>';

  }

}      // if !isset($installerrors)

 

 

 

 

 

// ############################### INSTALL FORM ################################

 

if(!isset($_POST['install']) OR isset($installerrors))

{

  if(isset($installerrors))

  {

    echo '<table width="100%" border="0" cellpadding="5" cellspacing="6">

          <tr>

            <td style="border: 1px solid #FF0000; font-size: 12px;" bgcolor="#6C7BA7"><font color = "FFFFFF">

              <u>Installation Errors</u><br /><br />

              The following Errors were found:<br /><br />';

 

    for($i = 0; $i < count($installerrors); $i++)

    {

      echo '<b>' . ($i + 1) . ') ' . $installerrors[$i] . '</b><br /><br />';

    }

 

    echo '  </td>

          </tr>

          </table><br /><br />';

  }

 

  echo '<b>1.) Create a database for PHPmailscript.</b>

        <form method="post" action="install.php">

        <center><table>

        <tr>

    <td ><span style="font-size: 12px; color: rgb(255, 255, 255); font-family: georgia;">Database server hostname:</span></td>

          <td ><input class="textinput" type="text" name="servername" value="' . $servername . '"></td>

        </tr><br>

        <tr>

          <td ><span style="font-size: 12px; color: rgb(255, 255, 255); font-family: georgia;">Database name:</span></td>

          <td ><input class="textinput" type="text" name="database" value="' . $dbname . '"></td>

        </tr><br>

        <tr>

          <td ><span style="font-size: 12px; color: rgb(255, 255, 255); font-family: georgia;">Database username:</span></td>

          <td><input class="textinput" type="text" name="dbusername" value="' . $dbusername . '"></td>

        </tr><br>

        <tr>

          <td ><span style="font-size: 12px; color: rgb(255, 255, 255); font-family: georgia;">Database password:</span></td>

          <td ><input class="textinput" type="password" name="dbpassword"></td>

        </tr><br>

        </table></center>

        <br><br>

  <b>2.) Create your admin account for PHPmailscript:</b>

        <center><table>

        <tr>

          <td ><span style="font-size: 12px; color: rgb(255, 255, 255); font-family: georgia;">Username:</span></td>

          <td ><input class="textinput" type="text" name="username" value="' . $username . '"></td>

        </tr><br>

        <tr>

          <td><span style="font-size: 12px; color: rgb(255, 255, 255); font-family: georgia;">Password:</span></td>

          <td><input class="textinput" type="password" name="password"></td>

        </tr><br>

        <tr>

          <td><span style="font-size: 12px; color: rgb(255, 255, 255); font-family: georgia;">Confirm Password:</span></td>

          <td><input class="textinput" type="password" name="confirmpassword"></td>

        </tr><br>

        </table></center><br>

  <center><input type="submit" name="install" value="Install PHPmailscript"></center>

        <br /><br />

        </form>';

}

 

 

 

// ############################### PRINT FOOTER ################################

 

echo $footer;

 

?>

 

 

???

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.