Location: PHPKode > projects > PHD Help Desk > setup/eng/set_mail.php
<?PHP
/*
    Nombre: set_mail.php
    Autor: Julio Tuozzo - hide@address.com
    Función: Configura las variables para el envío del correo electrónico
    Ver: 2.00
*/

session_start();
require('phd.inc');

if (!isset($_SESSION['MAIL']))

    {include('setup_head.inc');
     echo "<p class='danger'>INVALID CALL</p>";
     exit();
    }

$path_phd="";
$a_include = explode( PATH_SEPARATOR, ini_get('include_path') );
$a_long=count($a_include);

for ($I=0; $I<$a_long; $I++)
    {$f_path=str_replace("\\","/",$a_include[$I]);
     if (substr($f_path,-1)!='/')
        {$f_path.='/';
        }
     if (is_readable($f_path."phd.inc"))
        { if (strlen($path_phd)>0)
                {include('setup_head.inc');
                 echo "<p class='danger'><b>ERROR - THERE ARE AT LEAST TWO FILES <i>phd.inc</i></p>
                 <p class='ok'>One is place in <i>$path_phd</i> and other in <i>$f_path</i>.<br />
                 Make sure that are only one accesible in the variable <i>include_path</i> of the file
                 phd.inc that are inicialy in <i>/phd_2_00/include/.</i></p>";
         exit();

                }
         else
                {$path_phd=$f_path;
                }
        }
    }

if (!is_writable($path_phd."phd.inc"))
    {include('setup_head.inc');
     echo "<p class='danger'><b>ERROR - IMPOSSIBLE TO WRITE THE FILE {$path_phd}phd.inc </b></p>
     <p class='ok'>Verify if the file exists and the access permission and try again.<br />
      The phd.inc file is placed in <b>/phd_2_00/include/.</b>
     </p>";
     exit();
    }


$a_phd = implode('', file($path_phd."phd.inc"));

if (!isset($_POST[b_mail]))
    {require('set_mail.inc');
     exit();
    }


if (get_magic_quotes_gpc())
    { foreach($_POST as $clave => $valor)
      {$_POST[$clave]=stripslashes($_POST[$clave]);
      }
    }

foreach($_POST as $clave => $valor)
     {$_POST[$clave]=trim(htmlentities($_POST[$clave],ENT_QUOTES));
     }

$a_phd=str_replace("\$Mail_host = '$Mail_host'","\$Mail_host = '$_POST[host]'",$a_phd);
$a_phd=str_replace("\$Mail_usuario = '$Mail_usuario'","\$Mail_usuario = '$_POST[usuario]'",$a_phd);
$a_phd=str_replace("\$Mail_clave = '$Mail_clave'","\$Mail_clave = '$_POST[clave]'",$a_phd);
$a_phd=str_replace("\$Mail_port = $Mail_port","\$Mail_port = $_POST[port]",$a_phd);
$fp = fopen ($path_phd."phd.inc", "w+");
fwrite($fp,$a_phd);
fclose($fp);

session_destroy();
header("Location: index.php");
?>
Return current item: PHD Help Desk