コード例 #1
0
 protected function send_mail_smtp($from_email, $from, $to, $subject, $hdr, $body)
 {
     $host = (conf_get('mail.smtp.ssl') ? 'ssl://' : '') . conf_get('mail.smtp.host');
     $sock = fsockopen($host, conf_get('mail.smtp.port'), $errno, $errstr, conf_get('mail.smtp.timeout'));
     if (!$sock) {
         return "SMTP: {$errstr} ({$errno})";
     }
     $this->get_smtp_response($sock);
     // get dummy response
     $hostname = _SERVER('SERVER_NAME', 'localhost');
     $this->smtp_puts($sock, 'EHLO ' . $hostname . "\r\n");
     if ($this->get_smtp_response_code($sock) != 250) {
         $this->smtp_puts($sock, 'HELO ' . $hostname . "\r\n");
         if ($this->get_smtp_response_code($sock) != 250) {
             fclose($sock);
             return 'SMTP: error while sending HELO request';
         }
     }
     if (strlen(conf_get('mail.smtp.user'))) {
         $this->smtp_puts($sock, "AUTH LOGIN\r\n");
         if ($this->get_smtp_response_code($sock) != 334) {
             fclose($sock);
             return 'SMTP: error while senging AUTH LOGIN request';
         }
         $this->smtp_puts($sock, base64_encode(conf_get('mail.smtp.user')) . "\r\n");
         if ($this->get_smtp_response_code($sock) != 334) {
             fclose($sock);
             return 'SMTP: error while senging AUTH LOGIN request (username not accepted)';
         }
         $this->smtp_puts($sock, base64_encode(conf_get('mail.smtp.pass')) . "\r\n");
         if ($this->get_smtp_response_code($sock) != 235) {
             fclose($sock);
             return 'SMTP: error while senging AUTH LOGIN request (invalid password)';
         }
     }
     $this->smtp_puts($sock, 'MAIL FROM: <' . $from_email . ">\r\n");
     if ($this->get_smtp_response_code($sock) != 250) {
         fclose($sock);
         return 'SMTP: error while senging MAIL FROM request';
     }
     $this->smtp_puts($sock, 'RCPT TO: <' . $to . ">\r\n");
     $code = $this->get_smtp_response_code($sock);
     if ($code != 250 && $code != 251) {
         fclose($sock);
         return 'SMTP: error while senging RCPT TO request';
     }
     $this->smtp_puts($sock, "DATA\r\n");
     if ($this->get_smtp_response_code($sock) != 354) {
         fclose($sock);
         return 'SMTP: error while senging DATA request';
     }
     $hdr .= 'Subject: ' . $subject . "\r\n";
     $hdr .= "\r\n";
     $this->send_smtp_data($sock, $hdr, true);
     $this->send_smtp_data($sock, $body, false);
     $this->smtp_puts($sock, "\r\n.\r\n");
     if ($this->get_smtp_response_code($sock) != 250) {
         fclose($sock);
         return 'SMTP: error while senging DATA request (data not accepted)';
     }
     $this->smtp_puts($sock, "QUIT\r\n");
     if ($this->get_smtp_response_code($sock) != 221) {
         fclose($sock);
         return 'SMTP: error while senging QUIT request';
     }
     fclose($sock);
     return '';
 }
コード例 #2
0
ファイル: u.php プロジェクト: huzhongchun/yaf_base
<td class="fl" style="text-align:center;">
<?php 
$able = get_loaded_extensions();
foreach ($able as $key => $value) {
    if ($key != 0 && $key % 13 == 0) {
        echo '<br />';
    }
    echo "{$value}&nbsp;&nbsp;&nbsp;&nbsp;";
}
?>
</td>
</tr>
</table>

<form method="post" action="<?php 
echo _SERVER('PHP_SELF');
?>
">
<table width="100%" class="info">
  <tr>
    <th colspan="4">MySQL 连接测试</th>
  </tr>
  <tr>
    <td class="er">MySQL 服务器</td>
    <td class="fl"><input type="text" name="mysqlHost" value="localhost" /></td>
    <td class="er">MySQL 数据库名</td>
    <td class="fl"><input type="text" name="mysqlDb" value="test" /></td>
  </tr>
  <tr>
    <td class="er">MySQL 用户名</td>
    <td class="fl"><input type="text" name="mysqlUser" value="root" /></td>
コード例 #3
0
ファイル: u.php プロジェクト: lijingrun/breed
<tr>
<td class="er">PHP配置文件</td>
<td class="fl"><?php 
echo $Info['php_ini_file'];
?>
</td>
<td class="er">OpenSSL协议组件</td>
<td class="fc"><?php 
echo function_exists('openssl_open') ? YES : NO;
?>
</td>   
</tr>
<tr>
<td class="er">当前网站目录</td>
<td class="fl"><?php 
echo _SERVER('DOCUMENT_ROOT');
?>
</td>
<td class="er">Mcrypt加密处理组件</td>
<td class="fc"><?php 
echo function_exists('mcrypt_cbc') ? YES : NO;
?>
</td>    
</tr>
<tr>
<td class="er">服务器标准时</td>
<td class="fl">
<?php 
echo gmdate('Y-m-d H:i:s', time() + 3600 * 8);
?>
</td>
コード例 #4
0
function process()
{
    $cache_dir = conf('cache.path') . 'proxy';
    if (!file_exists($cache_dir)) {
        mkdir($cache_dir);
        chmod($cache_dir, 0777);
    }
    $files = array_filter(array_map(create_function('$v', 'return preg_replace("/[^a-z0-9\\-_]/i","",$v);'), explode('.', ltrim(_SERVER('PATH_INFO'), '/'))));
    if (count($files) < 2) {
        return;
    }
    $type = array_splice($files, -1, 1);
    $type = $type[0];
    if (!in_array($type, array('js', 'css'))) {
        return;
    }
    $base_path = BASE . "{$type}/";
    $cache_path = "{$cache_dir}/" . rawurlencode(join('.', $files)) . ".{$type}";
    if (is_readable($cache_path)) {
        $cache_mtime = filemtime($cache_path);
    } else {
        $cache_mtime = 0;
    }
    if ($cache_mtime) {
        $last_mtime = 0;
        foreach ($files as $name) {
            $last_mtime = max($last_mtime, filemtime("{$base_path}{$name}.{$type}"));
        }
        if ($last_mtime > $cache_mtime) {
            $cache_mtime = 0;
        }
    }
    if (!$cache_mtime) {
        $cached = array();
        foreach ($files as $name) {
            $body = file_get_contents("{$base_path}{$name}.{$type}");
            if ($type == 'css') {
                $body = preg_replace('@/\\*.*?\\*/@s', '', $body);
                $body = str_replace('{ROOT}', ROOT, $body);
            }
            // bug with stripping comments in js: { foo: "foo/*", bar: "bar*/" }
            $body = join("\n", array_filter(array_map(create_function('$v', 'return trim($v);'), explode("\n", str_replace("\r", "\n", $body)))));
            $cached[] = $body;
        }
        $cached = join("\n\n", $cached);
        file_put_contents($cache_path, $cached);
        chmod($cache_path, 0666);
        $cache_mtime = filemtime($cache_path);
    } else {
        $cached = file_get_contents($cache_path);
    }
    session_cache_limiter('public');
    header('Last-Modified: ' . gmdate('r', $cache_mtime));
    header('Pragma: public');
    if ($type == 'js') {
        header('Content-Type: application/x-javascript');
    } else {
        // css
        header('Content-Type: text/css');
    }
    echo $cached;
}
コード例 #5
0
<?php

require_once 's/s.php';
require_once BASE . 'inc/core/core.php';
Request::process(_SERVER('REQUEST_URI'));
if (LOG_DEBUG_INFO) {
    $debuglog_str = dflush_str();
    _log("[[ Info ]]\n\n{$debuglog_str}\n\n");
}
コード例 #6
0
ファイル: u.php プロジェクト: bozoyan/Bozo
</tr>
<tr>
<td class="fl" style="text-align:center;">
<?php
$able=get_loaded_extensions();
foreach ($able as $key=>$value) {
if ($key!=0 && $key%13==0) {
echo '<br />';
}
echo "$value&nbsp;&nbsp;&nbsp;&nbsp;";
}
?>
</td>
</tr>
</table>
<form method="post" action="<?=_SERVER('PHP_SELF')?>">
<table width="100%" class="inp">
<tr>
<th colspan="4" class="ec">MySQL 连接测试</th>
</tr>
<tr>
<td colspan="4" class="ft">请及时登录phpMyAdmin修改数据库默认用户名和密码</td>
</tr>
<tr>
<td width="25%" class="er">MySQL 服务器</td>
<td width="25%" class="fl"><input type="text" name="mysqlHost" value="localhost" /></td>
<td width="25%" class="er">MySQL 数据库名</td>
<td width="25%" class="fl"><input type="text" name="mysqlDb" value="test" /></td>
</tr>
<tr>
<td class="er">MySQL 用户名</td>