php邮件的收
php邮件读取:
程序开发的思路:mail文件:先连接到pop3,读取用户的邮件列表,判断邮件是否读取过,如果没读取过就把邮件加到中转的数据库中。get_mail()函数,读取数据库中的邮件列表,读完后对数据库进行清除。以便能一直读取的都是新的邮件。
代码程序:mail文件:
header("content-type:text/html; charset=utf-8");
include 'config.php';
include 'Pop3.php';
include 'mail_config.php';
$conn=mysql_connect($db_host,$db_user,$db_pass);
mysql_query("set names utf8");
mysql_select_db("$mail_data",$conn);
$pop3=new Net_POP3();
if ($pop3->connect($host,110)=="true"){
$bool=$pop3->login($user,$password);
if ($bool=="ture"){
$list=$pop3->_cmdList();
$sum=$pop3->_cmdStat();
echo "<br>";
for ($j=0;$j<$sum[0];$j++){
$head=$pop3->getParsedHeaders($list[$j]['msg_id']);
preg_match("/([a-z0-9A-Z\s]+):([0-9]+):([0-9]+)/",$head['Date'],$rt);
echo "<br>";
$int_time=strtotime($rt[0]);//时间戳
$from=(imap_mime_header_decode($head['from']));
$string='';
for ($i=0;$i<count($from);$i++){
$string="$string".$from[$i]->text;
}
preg_match("/([a-z0-9A-Z_]+)@([a-z0-9A-Z\.]+).([a-z0-9A-Z]+)/",$string,$rg);
$subject=imap_mime_header_decode($head['Subject']);
$title='';
for ($i=0;$i<count($subject);$i++){
$title="$title".$subject[$i]->text;
}
$title=iconv("GB2312","UTF-8",$title);
//判断邮件是否存在,备份邮件
$sql_time="SELECT * from $mail_table_all WHERE timestamp=$int_time";
mysql_query($sql_time)or die(mysql_error());
if (mysql_affected_rows()==0){
$sql="INSERT
相关文档:
<?php
//作者:梁文平 http://www.tyasp.net
session_start();
if($_SESSION["username"]!="admin")
{
echo("<mce:script type="text/javascript"><!--
alert("操作超时!请重新登陆...");window.location.href="../index.php";
// --></mce:script>");
//header("refresh:0;url=../"); ......
/**
* 获得当前时间的毫秒数,用户检测页面的执行时间
*
* @author cjz
* @date Thu Apr 09 15:05:55 CST 2009
*
* @return float(毫秒数)
*/
function myGetMicrotime()
{
list($usec,$sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
......
因为最近做一个DIY的设计器,需要让用户选择某个字体,并且支持旋转,拖拉等操作。直接使用文本框是不行的,因为flex不支持字体的直接旋转,大家可以尝试一下,如果选择了text控件,文字就看不到了,有个办法是把文字embed嵌入到swf中去,这样就支持了。
但是英文还好,字体文件不大,中文的话动辄几个M,这个做法很不现实 ......
最近一年来一直在使用fedora,发现linux真是太适合我了,喜欢写程序,自己瞎倒腾,唉windows误我大好年华……
用PHP写了一段程序用于提取网页中的数据,相信搜索引擎也是差不多的想法,只不过他们数据多,算法好些,呵呵
[php]
<?php
/*
*此文件的目标是自动搜集存储8684上的深圳市公交数据
*
*由 ......
<?php
header("content-type:image/png");
$img=ImageCreate(100,35);
$bgcolor=ImageColorAllocate($img,0,0,0);
$red=ImageColorAllocate($img,255,0,0);
$bgcolortrans=ImageColorTransparent($img,$bgcolor);
ImageString($img,5,10,10,"PNG PHP",$red);
ImagePng($img);
ImageDestro ......