pop mail 类 很简单的功能(自家用)

 更新时间:2016年11月25日 16:14  点击:1698
<?php
class popMail
{
var $user='sanshi0815@tom.com';
var $pwd='1234';
var $popFp;
var $msg;
var $welcome = '欢迎使用叁石pop 接收邮件!';
function popMail($popHost='pop.tom.com',$popPort=110)
{
$this->msg = array();
$this->msg[] = $this->welcome;
if ( $this->openPop($popHost,$popPort))
{
$this->msg[] = 'pop server connect success!';
}else{
print_r( $this->msg );
}
}
function checkCommon($com,$msg)
{
echo $cod = empty($com)? $this->getServerMsg() : $this->putServerMsg( $com );
$this->msg[] = ereg( "^ OK" ,$cod )? $msg : $com .' exec is fauiler!error:'.$cod ;
if( !ereg( "^ OK" ,$cod ) )
{
echo $cod;
print_r($this->msg);
$this->closeStmp();
exit(0);
}
}
function init()
{
$greeting='';
$rn=' ';
//$this->checkCommon('',"connect");
//echo $this->putServerMsg("APOP ".$this->user ." ".$this->pwd.$rn);
// $this->checkCommon("USER ",'user');
echo $this->putServerMsg("USER $this->user".$rn);
echo $this->putServerMsg("PASS $this->pwd".$rn);
print_r( $this->msg );
}
function openPop($popHost,$popPort=110)
{
if( empty($popHost) )
{
$this->msg[] = 'pop host is null!';
return false;
}
if( $fp = fsockopen($popHost,$popPort))
{
$this->popFp = $fp;
//echo $this->getServerMsg();
return true;
}
$this->msg[] = 'pop server connect failure';
return false;
}
function getServerMsg()
{
if( empty( $this->popFp ) )
{
$this->msg[] = 'popFp is null!';
print_r($this->msg);
return false;
}
return fgets( $this->popFp,512);
<?php
/***
hit_count表只一个字段hit_count
page_visit_record表是用来控制一个IP一天内只产生一个计数器跳动
CREATE TABLE page_visit_record (
visit_time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
remote_addr char(15) NOT NULL,
visit_page char(60) NOT NULL,
KEY visit_time (visit_time, visit_page),
PRIMARY KEY (visit_time)
);
***/
include("config.inc.php3");
$query="select count(*) as tong from page_visit_record where remote_addr='$REMOTE_ADDR' and date_format(visit_time,'%Y-%m-%d')=curdate()";
$result=@mysql_query($query,$dbconnect);
$has_count=@mysql_result($result,0,"tong");
@mysql_query("lock tables hit_count write",$dbconnect);
$query="select * from hit_count";
$result=@mysql_query($query,$dbconnect);
if(@mysql_num_rows($result)>0){
$cur_count=@mysql_result($result,0,"hit_count");
if($has_count==0){
$cur_count++;
$query="update hit_count set hit_count='$cur_count'";
@mysql_query($query,$dbconnect);
}
@mysql_query("unlock tables",$dbconnect);
}
else{
$cur_count=1;
$query="insert into hit_count (hit_count) values ('$cur_count')";
@mysql_query($query,$dbconnect);
@mysql_query("unlock tables",$dbconnect);
}
while(strlen($cur_count)<8)
$cur_count="0$cur_count";
$visit_time=date("Y-m-d H:i:s");
$query="insert into page_visit_record (visit_time,remote_addr,visit_page) values ('$visit_time','$REMOTE_ADDR','$page')";
@mysql_query($query,$dbconnect);
Header("Content-type: image/gif");
$im = imagecreate(56,16);
$black = ImageColorAllocate($im, 0,0,0);
$blue = ImageColorAllocate($im, 0,0,255);
$white = ImageColorAllocate($im, 255,255,255);
$yellow = ImageColorAllocate($im, 255,255,0);
imagerectangle($im, 0, 0, 54, 14, $blue);
//imagestring($im, 2, 4, 1, $cur_count, $yellow);
imagestring($im, 2, 4, 1, $cur_count, $yellow);
ImageGif($im);
ImageDestroy($im);
?>   
<?php
class CreateHtml
{
function mkdir( $prefix= 'article' )
{
$y = date('Y');
$m = date('m');
$d = date('d');
$p=DIRECTORY_SEPARATOR;
$filePath='article'.$p.$y.$p.$m.$p.$d;
$a=explode($p,$filePath);
foreach ( $a as $dir)
{
$path.=$dir.$p;
if(!is_dir($path))
{
//echo '没有这个目录'.$path;
mkdir($path,0755);
}
}
return $filePath.$p;
}
function start()
{
ob_start();
}
function end()
{
$info = ob_get_contents();
$fileId = '12345';
$postfix = '.html';
$path = $this->mkdir($prefix= 'article');
$fileName = time().'_'.$fileId.$postfix;
$file=fopen($path.$fileName,'w ');
fwrite($file,$info);
fclose($file);
ob_end_flush();
}
}
?>
<?php
$s=new CreateHtml();
$s->start();
?>
<html>
<body>
asdfasdfasdfasdfasdfasdfasdfasdfasdf<br>
adfasdfasdf<br>
</body>>
</html>
<?php
$s->end();
?>

这个类不安全,需要修改
<?php
/**
*HttpDownLoad
*
*@author sanshi
QQ:35047205
Email:sanshi0815@tom.com
MSN:sanshi0815@tom.com
*
*@version 1.0.0 2005/07/10
*
*@deprecated
1.http协议下载

*/
class HttpDownLoad
{
var $rootDom="D:/jsp/";//设定下载目录,需要绝对路径
var $openDir; //打开绝对的路径
var $open; //将要打开的目录
var $enter=3; //设置换行
var $table_w=800; //设置表格宽度
var $div=array(); //设置目录存放数组
var $file=array(); //设置文件存放数组
var $link=array(); //设置连接文件数组
//构造函数
function HttpDownLoad()
{
$this->getAll();
$this->head();
$this->printArray($this->dir,"目录");
$this->printArray($this->file,"文件");
$this->foot();
}
//设置输出标题头
function head()
{
echo "<table width='".$this->table_w."' align='center'><tr><td height='20%'>&nbsp;</td></tr><tr>".
"<td align='center'><FONT SIZE='8' COLOR=''>www.litou.com 专用版</FONT></td>".
"</tr><tr><td>作&nbsp;&nbsp;&nbsp;&nbsp;者:&nbsp;叁&nbsp;&nbsp;石</td></tr>".
"<tr><td>联系方式:sanshi0815@tom.com</td></tr>".
"<tr><td>&nbsp&nbsp;Q&nbsp;&nbsp;Q&nbsp;&nbsp;:&nbsp;35047205</td></tr></table>";
}
//设置结束尾
function foot()
{
}
//取得将要打开的目录
function getOpen()
{
$open=$_GET["dir"];
$this->open=$open;
if(!isset($open)||empty($open))
{
<?
$arr=getimagesize("images/album_01.gif");
echo $arr[3];
$strarr=explode(""",$arr[3]);
echo $strarr[1];
?>
<HTML>
<HEAD>
<TITLE>演示图片等比例缩小</TITLE>
<script>
function Wa_SetImgAutoSize(img)
{
//var img=document.all.img1;//获取图片
var MaxWidth=200;//设置图片宽度界限
var MaxHeight=100;//设置图片高度界限
var HeightWidth=img.offsetHeight/img.offsetWidth;//设置高宽比
var WidthHeight=img.offsetWidth/img.offsetHeight;//设置宽高比
alert("test" img.offsetHeight img.fileSize);
if(img.offsetHeight>1) alert(img.offsetHeight);
if(img.readyState!="complete"){
return false;//确保图片完全加载
}
if(img.offsetWidth>MaxWidth){
img.width=MaxWidth;
img.height=MaxWidth*HeightWidth;
}
if(img.offsetHeight>MaxHeight){
img.height=MaxHeight;
img.width=MaxHeight*WidthHeight;
}
}
function CheckImg(img)
{
var message="";
var MaxWidth=1;//设置图片宽度界限
var MaxHeight=1;//设置图片高度界限

if(img.readyState!="complete"){
return false;//确保图片完全加载
}
if(img.offsetHeight>MaxHeight) message ="高度超额:" img.offsetHeight;
if(img.offsetWidth>MaxWidth) message ="宽度超额:" img.offsetWidth;
if(message!="") alert(message);
}
</script>
</HEAD>
<BODY>
<img src="images/frequency.gif" border=0 id="img1" onload="CheckImg(this);">
<br>
<input id=inp type="file" onpropertychange="img1.src=this.value;">
</BODY>
</HTML>


[!--infotagslink--]

相关文章

  • php svn操作类

    以前我们开发大型项目时都会用到svn来同步,因为开发产品的人过多,所以我们会利用软件来管理,今天发有一居然可以利用php来管理svn哦,好了看看吧。 代码如下 ...2016-11-25
  • PHP 数据库缓存Memcache操作类

    操作类就是把一些常用的一系列的数据库或相关操作写在一个类中,这样调用时我们只要调用类文件,如果要执行相关操作就直接调用类文件中的方法函数就可以实现了,下面整理了...2016-11-25
  • php简单数据操作的实例

    最基础的对数据的增加删除修改操作实例,菜鸟们收了吧...2013-09-26
  • JS+CSS实现分类动态选择及移动功能效果代码

    本文实例讲述了JS+CSS实现分类动态选择及移动功能效果代码。分享给大家供大家参考,具体如下:这是一个类似选项卡功能的选择插件,与普通的TAb区别是加入了动画效果,多用于商品类网站,用作商品分类功能,不过其它网站也可以用,...2015-10-21
  • Php文件上传类class.upload.php用法示例

    本文章来人大家介绍一个php文件上传类的使用方法,期望此实例对各位php入门者会有不小帮助哦。 简介 Class.upload.php是用于管理上传文件的php文件上传类, 它可以帮...2016-11-25
  • PHP实现无限级分类(不使用递归)

    无限级分类在开发中经常使用,例如:部门结构、文章分类。无限级分类的难点在于“输出”和“查询”,例如 将文章分类输出为<ul>列表形式; 查找分类A下面所有分类包含的文章。1.实现原理 几种常见的实现方法,各有利弊。其中...2015-10-23
  • PHP实现递归无限级分类

    在一些复杂的系统中,要求对信息栏目进行无限级的分类,以增强系统的灵活性。那么PHP是如何实现无限级分类的呢?我们在本文中使用递归算法并结合mysql数据表实现无限级分类。 递归,简单的说就是一段程序代码的重复调用,当把...2015-10-23
  • C#类中static变量用法分析

    这篇文章主要介绍了C#类中static变量用法,实例分析了static变量使用技巧与相关注意事项,需要的朋友可以参考下...2020-06-25
  • mybatis-plus实体类主键策略有3种(小结)

    这篇文章主要介绍了mybatis-plus实体类主键策略有3种(小结),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2020-08-27
  • ecshop商品无限级分类代码

    ecshop商品无限级分类代码 function cat_options($spec_cat_id, $arr) { static $cat_options = array(); if (isset($cat_options[$spec_cat_id]))...2016-11-25
  • PHP 一个完整的分页类(附源码)

    在php中要实现分页比起asp中要简单很多了,我们核心就是直接获取当前页面然后判断每页多少再到数据库中利用limit就可以实现分页查询了,下面我来详细介绍分页类实现程序...2016-11-25
  • 详解ES6实现类的私有变量的几种写法

    这篇文章主要介绍了详解ES6实现类的私有变量的几种写法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2021-02-10
  • c#各种Timer类的区别与用法介绍

    System.Threading.Timer 是一个简单的轻量计时器,它使用回调方法并由线程池线程提供服务。在必须更新用户界面的情况下,建议不要使用该计时器,因为它的回调不在用户界面线程上发生...2020-06-25
  • C#学习笔记整理_浅谈Math类的方法

    下面小编就为大家带来一篇C#学习笔记整理_浅谈Math类的方法。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧...2020-06-25
  • ES5和ES6中类的区别总结

    这篇文章主要给大家介绍了ES5和ES6中类的区别的相关资料,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2020-12-21
  • Java匿名内部类的写法示例

    这篇文章主要给大家介绍了关于Java匿名内部类的相关资料,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2020-08-31
  • C#实现图片放大功能的按照像素放大图像方法

    这篇文章主要介绍了C#实现图片放大功能的按照像素放大图像方法,功能非常实用,需要的朋友可以参考下...2020-06-25
  • php无限分类使用concat如何实现

    一、数据库设计 -- -- Table structure for table `category` -- CREATE TABLE `category` ( `id` int(11) NOT NULL auto_increment, `catpath` varchar(255) default NULL, `name` varchar(255) default NULL...2015-11-08
  • 适用于初学者的简易PHP文件上传类

    本文实例讲述了PHP多文件上传类,分享给大家供大家参考。具体如下:<&#63;phpclass Test_Upload{ protected $_uploaded = array(); protected $_destination; protected $_max = 1024000; protected $_messages =...2015-10-30
  • JPA如何使用nativequery多表关联查询返回自定义实体类

    这篇文章主要介绍了JPA如何使用nativequery多表关联查询返回自定义实体类,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教...2021-11-18