PHP邮件专项论题_php基本功_脚本之家,我常用的多

作者:云顶集团线路检测

自身常用的多少个类更正自hk的PHP代码:--------------------------------------------------------------------------------/*效能:获得自由字符串参数: 1、$length = 32 #任性字符长度,默以为32 2、$mode = 0 #私行字符类型,0为大小写韩文和数字,1为数字,2为小写子木,3为大写字母,4为大小写字母,5为大写字母和数字,6为小写字母和数字再次回到:得到的字符串使用: $code = new activeCodeObj; $str = $code->getCode;*/class activeCodeObj{ function getCode ($length = 32, $mode = 0) { switch { case '1': $str = '1234567890'; break; case '2': $str = 'abcdefghijklmnopqrstuvwxyz'; break; case '3': $str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; break; case '4': $str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; break; case '5': $str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; break; case '6': $str = 'abcdefghijklmnopqrstuvwxyz1234567890'; break; default: $str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890'; break; } $result = ''; $l = strlen; for($i = 0;$i < $length;$i ++){ $num = rand; $result .= $str[$num]; } return $result; }}PHP代码:--------------------------------------------------------------------------------/*功用:得到客商端音信参数:重返:钦命的材质使用: $code = new clientGetObj; 1、浏览器:$str = $code->getBrowse(State of Qatar; 2、IP地址:$str = $code->getIP(State of Qatar; 4、操作系统:$str = $code->getOS(卡塔尔国;*/class clientGetObj{ function getBrowse() { global $_SERVER; $Agent = $_SERVER['HTTP_USER_AGENT']; $browser = ''; $browserver = ''; $Browser = array('Lynx', 'MOSAIC', 'AOL', 'Opera', 'JAVA', 'MacWeb', 'WebExplorer', 'OmniWeb'); for($i = 0; $i <= 7; $i ++){ if(strpos($Agent, $Browsers[$i])){ $browser = $Browsers[$i]; $browserver = ''; } } if(ereg && !ereg{ $temp = explode; $Part = $temp[0]; $temp = explode; $browserver = $temp[1]; $temp = explode; $browserver = $temp[0]; $browserver = preg_replace/', '1', $browserver); $browserver = $browserver; $browser = 'Netscape Navigator'; } if(ereg && ereg { $temp = explode; $Part = $temp[1]; $temp = explode; $browserver = $temp[1]; $temp = explode; $browserver = $temp[2]; $browserver = preg_PHP邮件专项论题_php基本功_脚本之家,我常用的多少个类_php根底_脚本之家。replace/', '1', $browserver); $browserver = $browserver; $browser = 'Opera'; } if(ereg && ereg{ $temp = explode; $Part = $temp[1]; $temp = explode; $Part = $temp[1]; $temp = explode; $browserver = $temp[2]; $browserver = preg_replace/','1',$browserver); $browserver = $browserver; $browser = 'Internet Explorer'; } if{ $browseinfo = $browser.' '.$browserver; } else { $browseinfo = false; } return $browseinfo; } function getIP () { global $_SERVER; if (getenv { $ip = getenv; } else if (getenv('HTTP_X_FORWARDED_FOR')) { $ip = getenv('HTTP_X_FORWARDED_FOR'); } else if ) { $ip = getenv; } else { $ip = $_SERVER['REMOTE_ADDR']; } return $ip; } function getOS () { global $_SERVER; $agent = $_SERVER['HTTP_USER_AGENT']; $os = false; if && strpos{ $os = 'Windows 95'; } else if (eregi && strpos{ $os = 'Windows ME'; } else if && ereg{ $os = 'Windows 98'; } else if && eregi{ $os = 'Windows XP'; } else if && eregi{ $os = 'Windows 2000'; } else if && eregi{ $os = 'Windows NT'; } else if && ereg{ $os = 'Windows 32'; } else if (eregi{ $os = 'Linux'; } else if ){ $os = 'Unix'; } else if && eregi{ $os = 'SunOS'; } else if && eregi{ $os = 'IBM OS/2'; } else if && eregi{ $os = 'Macintosh'; } else if (eregi{ $os = 'PowerPC'; } else if { $os = 'AIX'; } else if ){ $os = 'HPUX'; } else if (eregi{ $os = 'NetBSD'; } else if { $os = 'BSD'; } else if { $os = 'OSF1'; } else if { $os = 'IRIX'; } else if (eregi{ $os = 'FreeBSD'; } else if (eregi{ $os = 'teleport'; } else if (eregi{ $os = 'flashget'; } else if (eregi{ $os = 'webzip'; } else if (eregi{ $os = 'offline'; } else { $os = 'Unknown'; } return $os; }}PHP代码:--------------------------------------------------------------------------------class cnStrObj{ function substrGB ($str = '', $start = '', $len = ''){ if($start == 0 $start == ''){ $start = 1; } if($str == '' $len == ''){ return false; } for($i = 0; $i < $start + $len; $i ++){ $tmpstr = >= 161 && ord <= 247&& ord >= 161 && ord?$str[$i].$str[++$i]:$tmpstr = $str[$i]; if ($i >= $start && $i < { $tmp .=$tmpstr; } } return $tmp; } function isGB { $strLen = strlen; $length = 1; for($i = 0; $i < $strLen; $i ++) { $tmpstr = ord; $tmpstr2 = ord); if(($tmpstr <= 161 $tmpstr >= 247) && ($tmpstr2 <= 161 $tmpstr2 >= 247)){ $legalflag = false; } else { $legalflag = true; } } return $legalflag; }}PHP代码:-------------------------------------------------------------------------------- ** pass - Password for authentication Default: ** timeout - The timeout in seconds for the call Default: 5 ** to fsockopen() ***************************************/ function smtp{ if define; $this->timeout = 5; $this->status = SMTP_STATUS_NOT_CONNECTED; $this->host = 'localhost'; $this->port = 25; $this->helo = 'localhost'; $this->auth = FALSE; $this->user = ''; $this->pass = ''; $this->errors = array(); foreach($params as $key => $value){ $this->$key = $value; } } /*************************************** ** Connect function. This will, when called ** statically, create a new smtp object, ** call the connect function ** and return it. When not called statically, ** it will connect to the server and send ** the HELO command. ***************************************/ function connect{ if){ $obj = new smtp; if{ $obj->status = SMTP_STATUS_CONNECTED; } return $obj; }else{ $this->connection = fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout); socket_set_timeout($this->connection, 0, 250000); $greeting = $this->get_data(); if(is_resource{ return $this->auth ? $this->ehlo; }else{ $this->errors[] = 'Failed to connect to server: '.$errstr; return FALSE; } } } /*************************************** ** Function which handles sending the mail. ** Arguments: ** $params - Optional assoc array of parameters. ** Can contain: ** recipients - Indexed array of recipients ** from - The from address. (used in MAIL FROM云顶集团线路检测 1, ** this will be the return path ** headers - Indexed array of headers, one header per array entry ** body - The body of the email ** It can also contain any of the parameters from the connect() ** function ***************************************/ function send{ foreach($params as $key => $value){ $this->set; } if){ // Do we auth or not? Note the distinction between the auth variable and auth() function if{ if return FALSE; } $this->mail; if(is_array foreach($this->recipients as $value) $this->rcpt; else $this->rcpt; if return FALSE; // Transparency $headers = str_replace(CRLF.'.', CRLF.'..', trim(implode)); $body = str_replace(CRLF.'.', CRLF.'..', $this->body); $body = $body[0] == '.' ? '.'.$body : $body; $this->send_data; $this->send_data; $this->send_data; $this->send_data; return (substr(trim, 0, 3) === '250'); }else{ $this->errors[] = 'Not connected!'; return FALSE; } } /*************************************** ** Function to implement HELO cmd ***************************************/ function helo(){ if(is_resource AND $this->send_data AND substr(trim($error = $this->get_data{ return TRUE; }else{ $this->errors[] = 'HELO command failed, output: ' . trim,3)); return FALSE; } } /*************************************** ** Function to implement EHLO cmd ***************************************/ function ehlo(){ if(is_resource AND $this->send_data AND substr(trim($error = $this->get_data{ return TRUE; }else{ $this->errors[] = 'EHLO command failed, output: ' . trim,3)); return FALSE; } } /*************************************** ** Function to implement AUTH cmd ***************************************/ function auth(){ if(is_resource AND $this->send_data AND substr(trim($error = $this->get_data === '334' AND $this->send_data(base64_encode // Send username AND substr(trim($error = $this->get_data === '334' AND $this->send_data(base64_encode // Send password AND substr(trim($error = $this->get_data{ return TRUE; }else{ $this->errors[] = 'AUTH command failed: ' . trim,3)); return FALSE; } } /*************************************** ** Function that handles the MAIL FROM: cmd ***************************************/ function mail{ if AND $this->send_data('MAIL FROM:') AND substr(trim, 0, 2) === '250' ){ return TRUE; }else return FALSE; } /*************************************** ** Function that handles the RCPT TO: cmd ***************************************/ function rcpt{ if AND $this->send_云顶娱乐送6元救济官网金,data AND substr(trim($error = $this->get_data{ return TRUE; }else{ $this->errors[] = trim, 3)); return FALSE; } } /*************************************** ** Function that sends the DATA cmd ***************************************/ function data(){ if AND $this->send_data AND substr(trim($error = $this->get_data{ return TRUE; }else{ $this->errors[] = trim, 3)); return FALSE; } } /*************************************** ** Function to determine if this object ** is connected to the server or not. ***************************************/ function is_connected(){ return (is_resource AND ($this->status === SMTP_STATUS_CONNECTED)); } /*************************************** ** Function to send a bit of data ***************************************/ function send_data{ if(is_resource{ return fwrite($this->connection, $data.CRLF, strlen; }else return FALSE; } /*************************************** ** Function to get data. ***************************************/ function &get_data(){ $return = ''; $line = ''; if(is_resource{ while === FALSE OR substr{ $line = fgets($this->connection, 512); $return .= $line; } return $return; }else return FALSE; } /*************************************** ** Sets a variable ***************************************/ function set{ $this->$var = $value; return TRUE; } } // End of class?>用 PHP 动态成立 Flash 动漫 小编: unknow 公布时间: 2000-7-11 小说类型: 转发 阅读次数: 1贰14次 来自: unknow Macromedia 公司出品的 Flash 动漫软件现已经济体改成Web页面上十分流行的显现工具,网址开辟者利用它引起浏览者的兴趣。但是不幸的是,仅仅使用ActionScript创设动漫受到非常的大的范围,Macromedia已经发布,打算扬弃Flash Generator产物,转而选拔援救Flash MX的Cold Fusion,大家的网址将向哪儿去吗?以后,大家能够使用Ming PHP库来轻便地动态创设Flash动漫,并且和我们的代码无缝集成。大家能够依照数据Curry的数额创立出各类不一样功能的卡通片。Ming 动画库最早出未来PHP4.05版本里,代替了原先版本的LibSwf模块。Ming 库选取C编写,辅助三种语言,下边先看一下什么样运用PHP来营造动漫。该库使用简便,和 PHP 紧集中成,不过,该库仍处试验阶段,近些日子的本子是0.2a,在线的科目、例子、和襄帮手册能够让大家有利地球科学习,Ming里的函数协会的很有系统,方便PHP和Flash开垦者查找。使用 PHP和Ming库,不但让大家的网站有华侈的装饰,况且可以收缩支出Flash动画的开销和积重难返的麻烦。使用Ming库有三种方法,咱们能够内嵌到PHP里,也足以把它看成叁个PHP模块来运维,里面包车型客车函数帮助具有的阳台,使用时也无需实例化。借使大家把Ming库作为PHP模块来运作以来,大家必须通晓地调用Ming库,和行使别的模块相像,然后利用该Curry的函数。由于选拔前必得先加载模块,与把Ming作为内部函数编写翻译的办法对待,要有少数性质的骤降。Ming库是完全免费的,我们得以到创小编的网址下载,地址是:[url] Flash创立SWF格式的动漫片,大家先创建一些标识,Flash有三类别型的符号:图形、动漫剪辑、按键。一旦大家创立了那些标志,大家就可以把它们复制插足景里,每三个拷贝称为叁个实例,可以放自便多的实例到大家的情景里。接下来就可以定义那几个指标的行为了,也正是概念动作和活动轨迹,也能够定义动漫的参数,如尺寸大小和背景颜色,倘使急需,能够保存成.SWF文件。利用PHP的Ming库创造Flash动漫,和Macromedia Flash同样,必得先创建一些符号,那个标志正是PHP对象的实例,然后定义这么些目的在动漫场景里的地点和互相关系,接着定义对象在每一帧里的动作,最终定义动漫本人。我们得以平昔把SWF直接出口到浏览器,也足以保存成SWF格式的文书,以备后用。Flash的长处正是图形化的顾客接口,利用Ming库不但能够进一层简明的调整目的,何况装有无比的扩大性和再用性。上边大家就用一个平安无事的事例来寻访哪些使用Ming库:addFill;$square->setRightFill; $square->movePenTo;$square->drawLineTo;$square->drawLineTo;$square->drawLineTo;$square->drawLineTo; /* 在动漫剪辑里应用方面包车型地铁号子,并累计一些脚本 */$sqclip = new SWFSprite();$i = $sqclip->add;$i->setDepth;$sqclip->setframes;$sqclip->add;")); $sqclip->nextFrame();$sqclip->add;")); for {$i->rotate;$sqclip->nextFrame();}/* 下边创立按键 */function rect {$s = new SWFShape();$s->setRightFill($s->addFill;$s->drawLine;$s->drawLine;$s->drawLine;$s->drawLine;return $s;}$b = new SWFButton();$b->addShape, SWFBUTTON_UP | SWFBUTTON_HIT);$b->addShape, SWFBUTTON_OVER);$b->addShape, SWFBUTTON_DOWN); $b->addAction(new SWFAction; gotoandplay, SWFBUTTON_MOUSEDOWN);/* 下边创建动漫,并加上下边包车型大巴标记和按键 */$m = new SWFMovie();$m->setDimension;$i = $m->add;$i->setDepth;$i->moveTo;$i->setName;$i = $m->add;$i->moveTo;/* 最终,大家把它输出到浏览器 */header('Content-type: application/x-shockwave-flash');$m->output();?>

PHP4中的COM函数近年来一向在写excel转形成mysql,发掘一篇随笔,搜一下phpx论坛,未有那几个帖子,把它转帖如下:PHP4中的COM函数 介绍内置于PHP4里的COM函数对于大家在win32际遇下支付顺序是一对一有吸重力的,然而于今停止仍未有微微有关的技术文书档案。本文将以四个例证分别处理MS office 二〇〇〇 Word 、 Excel 、 Adobe Distiller 来声明什么在PHP中使用COM函数。 COM技艺是由Microsoft在数年前提议并支付的,本文中涉嫌的相关名词有OLE, OLE Automation, ActiveX, COM ,那一个词的意思都基本相仿,都意味用一段封装的代码来成功三个windows 应用程序的一部分效应。 PHP4 COM 函数能够接二连三三个对象实例,并动用它的方式与质量。 假若您想选用上边包车型地铁例子源码,请参见一下自家的布署。 Windows 98 - MS Office 二零零一 Apache 1.3.9 Windows PHP4.02 Dev Running as CGI PHP4中的COM标记现在让大家带头吧,用PHP4的COM来实例化一个组件,要求 new操作符和目的的 "OLE 程序标志": $instance = new COM; ?> 因为COM是多个PHP4的保留字,它传送这几个指标的标志给一个布局函数,现在到手了那些组件的一个实例,依照OOP类的属性,大家能够非常轻便地访谈它的艺术与品质。 举例: $instance->[Object]->[method1]->[method2]->..->[property]; ?> 就是这么简单! OOP的组织在PHP下不可能源办公室事,(由于PHP语法的主题素材,属性的名字.值是地下字符,如点和圆括号等),所以PHP4提供了三个关照的函数: bool com_set(class com_object, string property name, string property_value); mixed com_get(class com_object, string property_name卡塔尔; ?> 最终,PHP4也辅助DCOM本领,能够在长间距Computer创造八个目的实例。 $Instance = new COM(string "Component name", string "remote_server_address"卡塔尔(قطر‎; ?> 注意:那是用DCOM指令来设置PHP。在现在,PHP开辟者提供Unix下对DCOM的帮助。标志、方法和总体性 标志是三个之类的字串: MS Word: "Word.Application" or "Word.Application.9" MS Excel: "Excel.Application" or "Excel.Sheet" ADOBE Acrobat: "Exch.application" or "PdfDistiller.PdfDistiller" 对于最终三个标记,俺要指明的是,获得不错的对象标志名不是一件轻便的事。倘令你无法访谈VBA文书档案,你能够寻找一下windows的注册表,在 HKEY_CLASSES_ROOT 中追寻一下,你就可以赢得一些应用程序的名字。在您的机械上有效的对象标记放在 CLSID 子文件夹下。 应用程序日常会提供文档表达它的COM方法和性质。在office二零零二中,你能够运路程序,展开VBA编辑器 ,采用对象编辑器。输入应用程序库中的多少个艺术名或属性名,然后,在底下的窗口中用鼠标右键选取一个类或成员名称,点扶助,你就可以赢得关于那一个类或成员的叙说。你也得以参考MSDN。一个 Excel 的例证如下: [url]] 用COM函数操作 MS Word 以后,大家开始率先个例证吗: #********************************************************* # 本例来自Zend站点,略有改革 # 张开八个word实例,并新建二个文书档案Useless test.doc # 输入一行文字 "This is a test2..." #********************************************************* #实例化叁个目的 $word = new COM or die("Unable to instantiate Word"State of Qatar; #得到并呈现版本 print "Loaded Word, version {$word->Version}"; #另一种方式去得到版本 $testversion = com_get($word->application,version); print "Version using Com_get(): $testversion "; #使其可知 $word->Visible = 1; #创设新文件 $word->Documents->Add(State of Qatar; #写字符 $word->Selection->TypeText; #保存 $word->Documents[1]->SaveAs; #关闭 $word->Quit(卡塔尔国; ?> 你若是花几分钟来读这一个程序,并参考Word的OLE 能力文书档案,你将学到差异常少是你在自个儿程序中所需的整套的操作。 MS Excel在接受PHP的COM函数 仿佛上边的Word的例证相近,你应学习这几个例子的还要参谋Excel的Visual Basic 编辑器中的对象浏览器的声援文书档案。 #打开workbook和它的sheet, #本例使用三个石英钟格是Excel安装时自带的SOLVSAMP.XLS $workbook = "C:Program FilesMicrosoft officeOfficeSamplesSOLVSAMP.XLS"; $sheet = "Quick Tour"; #实例化叁个组件的靶子 $ex = new COM or Die ; #取程序名称和本子 print "Application name:{$ex->Application->value}" ; print "Loaded version: {$ex->Application->version}"; #开荒工作本使我们可选择它 $wkb = $ex->application->Workbooks->Open or Die ; #预保存原本的专门的学问本,创立贰个办事本的别本$ex->Application->ActiveWorkbook->SaveAs; #$ex->Application->Visible = 1; #本句去注释让Excel可见 # 读写叁个单元格在三个新的职业表中 # 大家能够读到这么些单元格 E11 (Advertising in the 4th. QuarterState of Qatar $sheets = $wkb->Worksheets; #Select the sheet $sheets->activate; #Activate it $cell = $sheets->Cells ; #Select the cell $cell->activate; #Activate the cell print "Old Value = {$cell->value} "; #Print the value of the cell:10000 $cell->value = 15000; #Change it to 15000 print "New value = {$cell->value}";#Print the new value=15000 #终极,用新值重新总计这一个单元格 $sheets->Calculate; #不得不的比如要计算,手动则是可选的 #可看出成效总价 $cell = $sheets->Cells ; #Select the cell $number = Number_format; print "New Total cost =$$number - was $47,732 before."; #依据计算公式,广告影响了铺面包车型客车开辟,这里将展现 $57,809 #使用Excel内建的函数 # PMT(percent/12 months,Number of payments,Loan amount) $pay = $ex->application->pmt; $pay = sprintf; print "Monthly payment for $10,000 loan @8% interest /10 months: $ $pay"; #Should print monthly payment = $ -1,037.03 #可选,保存 $ex->Application->ActiveWorkbook->SaveAs; #闭馆,不提问 $ex->application->ActiveWorkbook->Close; ?> 那些例子让您的PHP与Excel一起工作了,当然,也可以有更加的多的靶子能够利用,访问叁个自已写的OOP封装类也与访问excel同样轻巧。用PHP的COM访谈Adobe Distiller 那最终二个例证不是MS程序了,假如您的主次有叁个PostScript文件,你会对这么些风乐趣的,改写它产生二个PDF文书档案. Adobe 有一个主次叫 Distiller ,它能够生成二个实例。代码如下: $pdf = new COM("pdfdistiller.pdfdistiller.1"卡塔尔国; ?> 有好几要小心的,是在Distiller 的文书档案中提交的这么些OLE标志名 "pdfdistiller" 是船到江心补漏迟的。 蒸馏三个文件的最宗旨的法子是: $pdf->FileToPdf ($psfile, strOutputPDF '', strJobOptions ""卡塔尔(قطر‎; ?> 那 $psfile 是以此PostScript的文本名, strOutputPDF 是出口文件PDF的公文名。 StrJobOptions 是Distiller的参数文件名,最终五个参数是可选的,暗许是一致名字。 那PS文件名与PDF文件名,使用这些私下认可的Joboptions 文件。举个例子: $pdf->FileToPdf ; #此刻$psfile 能够是 Myfile.ps 将赶回 Myfile.pdf 文件。 ?> 在Distiller中有更加多的办法和属质量被用。要是你感兴趣,请参见一下Adobe的才具文书档案。 中止/或然的标题若是你的代码中发出了哪些错误,你大概会创制了二个实例,但尚无平常地关闭它。最糟的是,那一个应用程序也许被那么些实例所保障,结果,在你的次种类表中就存在多份那几个顺序的别本,固然你修改了这一个不分青红皂白也会干扰你的结果。解决办法是:更改叁个bug以来要马上扑灭它们在你再一次开头运转在此以前,用 并结束职责。同样的源委,在您的代码最终,也要立即关门这几个程序并剔除这么些实例。 你有局地技艺在拍卖 com_get 和 com_set的特别时。举个例子: $Version = Com_get($instance->Application,"Version"卡塔尔国; 将会在Word中行事但在Excel中会发生四个不当。 有部分对象在PHP4中是不能够实例化的,那是因为那么些顺序要三个自定义的接口,但PHP4不扶助。 为啥大家要用它? 作者愿意那多个例证能够给你某个合计的头脑,PHP的COM允许你在PHP的台本中拜访windows4的次第。那些代码比ASP轻松并且能集成任何的PHP对数据库强盛的支撑功用。Microsoft 在各种方面都全力贩卖这么些COM 技能,在分裂的称呼和布局下,如 COM+(Combine COM with Microsoft Transaction Server MTSState of Qatar, ADO, OLE DB, OWC, Windows DNA, 等等。 PHP 和 Apache的组合,提供了叁个开放源码的化解方案。

哪些界定媒体人的ipCode:sql_query{message_die(GENERAL_ERROR, "Couldn't obtain banlist information", "", __LINE__, __FILE__, $sql);}$current_banlist = $db->sql_fetchrowset;$db->sql_freeresult;$kill_session_sql = '';for($i = 0; $i < count{$in_banlist = false;for($j = 0; $j < count; $j++){if ( $user_list[$i] == $current_banlist[$j]['ban_userid'] ){$in_banlist = true;}}if {$kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . "session_user_id = " . $user_list[$i];$sql = "INSERT INTO " . BANLIST_TABLE . " VALUES (" . $user_list[$i] . ")";if ( !$db->sql_query{message_die(GENERAL_ERROR, "Couldn't insert ban_userid info into database", "", __LINE__, __FILE__, $sql);}}}for($i = 0; $i < count{$in_banlist = false;for($j = 0; $j < count; $j++){if ( $ip_list[$i] == $current_banlist[$j]['ban_ip'] ){$in_banlist = true;}}if {if |/is', chunk_split) ){$kill_ip_sql = "session_ip LIKE '" . str_replace('.', '', preg_replace/is', '%', chunk_split)) . "'";}else{$kill_ip_sql = "session_ip = '" . $ip_list[$i] . "'";}$kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . $kill_ip_sql;$sql = "INSERT INTO " . BANLIST_TABLE . " VALUES ('" . $ip_list[$i] . "')";if ( !$db->sql_query{message_die(GENERAL_ERROR, "Couldn't insert ban_ip info into database", "", __LINE__, __FILE__, $sql);}}}//// Now we'll delete all entries from the session table with any of the banned// user or IP info just entered into the ban table ... this will force a session// initialisation resulting in an instant ban//if ( $kill_session_sql != '' ){$sql = "DELETE FROM " . SESSIONS_TABLE . "WHERE $kill_session_云顶集团线路检测,sql";if ( !$db->sql_query{message_die(GENERAL_ERROR, "Couldn't delete banned sessions from database", "", __LINE__, __FILE__, $sql);}}for($i = 0; $i < count{$in_banlist = false;for($j = 0; $j < count; $j++){if ( $email_list[$i] == $current_banlist[$j]['ban_email'] ){$in_banlist = true;}}if {$sql = "INSERT INTO " . BANLIST_TABLE . " VALUES ('" . str_replace("'", "''", $email_list[$i]) . "')";if ( !$db->sql_query{message_die(GENERAL_ERROR, "Couldn't insert ban_email info into database", "", __LINE__, __FILE__, $sql);}}}$where_sql = '';if ( isset($HTTP_POST_VARS['unban_user']) ){$user_list = $HTTP_POST_VARS['unban_user'];for($i = 0; $i < count{if ( $user_list[$i] != -1 ){$where_sql .= ? ', ' : '' ) . $user_list[$i];}}}if ( isset($HTTP_POST_VARS['unban_ip']) ){$ip_list = $HTTP_POST_VARS['unban_ip'];for($i = 0; $i < count{if {$where_sql .= ? ', ' : '' ) . $ip_list[$i];}}}if ( isset($HTTP_POST_VARS['unban_email']) ){$email_list = $HTTP_POST_VARS['unban_email'];for($i = 0; $i < count{if ( $email_list[$i] != -1 ){$where_sql .= ? ', ' : '' ) . $email_list[$i];}}}if {$sql = "DELETE FROM " . BANLIST_TABLE . "WHERE ban_id IN ";if ( !$db->sql_query{message_die(GENERAL_ERROR, "Couldn't delete ban info from database", "", __LINE__, __FILE__, $sql);}}$message = $lang['Ban_update_sucessful'] . '

PHP邮件专项论题PHP SMTP类 /*********************************** PHP MIMESMTP ver 1.0 Powered by Boss_ch, Unigenius soft ware co. Ltd All rights reserved, Copyright 二〇〇一 ;本类用PHP通过smtp sock 操作发送MIME 类型的邮件,能够发送 HTML 格式的正文、附属类小零部件,选择base64 编码 本版本是针对性个人的出殡,与多人群发版本差异的是,每发送到一个人,就再也开展壹回编码,在选择端的顾客看来,只是发送给他一个人的。 针对几个人群发的场所,只发送叁回,通过七个RCPTTO命令发送到分歧的人信箱中, 表明: 请把$hostname 设为您有权力的暗中认可smtp 服务器或是在new 时指定把$charset 改成你的默许字符集 Html 正文中如有图片,请用相对路线的引用"httP://host/path/image.gif";并连上网,以保险程序能读取到图片的数目信息假若是通过表单提交过来的Html 正文,请先用StripSlashes把正文内容伸开预处理 Html 中用到的样式表文件,请不要用之类的援引,直接把体制表定义放在

I说PHP就非得提MySQL,而要讲MySQL,那么PHP也是应当要被聊起。PHP的飞跃崛起,离不开MySQL,而MySQL的普遍应用,也与PHP骨肉相连。上边详细剖析PHP4中与MySQL相关操作的函数:<1>. 连接数据库服务器的函数.mysql_connect()格式:int mysql_connect(string [hostname] [ort],string [username],string [password]卡塔尔(قطر‎;参数中的port参数表示数据库服务器的端口号,常常用它的暗中同意端口号就能够了。假如不填任何参数,则私下认可的hostname为localhost,username为root,password为空。函数实行成功,重返多个int 类型的连接号,实施停业,重临false值。例子:$connect = mysql_connect("localhost","user","password");if echo "Connect Successed!"; //连接成功,彰显Connect Successed!else echo "Connect Failed!"; //连接失利,呈现Connect Failed!?>在上例中,如mysql_connect(卡塔尔实施停业,将显得系统的乖谬提醒,而后继续往下实行。那,该怎么屏蔽那么些体系的错误提醒并在曲折后结束程序?在MySQL中,允许在数据库函数早前拉长@符号,屏蔽系统的不当提醒,同不经常候用die(State of Qatar函数给出更易驾驭的谬误提示,然后die(卡塔尔国函数将自动退出程序。上例能够改为:$connect = @mysql_connect("localhost","user","password") or die ("Unable to connect database server!");?>如mysql_connect(卡塔尔国试行倒闭,将显得 Unable to connect database server!后,退出程序。格式:int mysql_pconnect(string [hostname] [ort],string [username],string [password]State of Qatar;此函数与基本相仿,不同在于:--------- 当数据库操作甘休之后 ,由创设的总是将电动关闭,而树立的接连将三回九转存在,是一种稳定长久的连接。--------- 在,每一趟一而再前,都会检讨是否有利用同一的hostname,use,password的连天,假若有,则一直运用那一个连接号。--------- 建构的连续几天可以用mysql_close的mysql_pconnect来关闭。<2>.关闭数据库连接函数格式:int mysql_close;关闭由mysql_connect()函数创设的总是,执行成功,重返ture值,失败则赶回false值。例子如下:$connect = @mysql_connect("hostname","user","password") or die("Unable to connect database server!");$close = @mysql_close or die ("Unable to close database server connect!");?>注:mysql_close(卡塔尔不能够关闭由mysql_pconnect(State of Qatar函数建设构造的连年。<3>.选取数据库函数格式:int mysql_select_db(string database name , int link_identifier卡塔尔(قطر‎;选用内定的database name ,成功,再次回到1个真值,战败,则赶回1个False值例子1:$select = mysql_select_db;if{echo "connect db forum successed!";}else{echo "connect db forum failed!";}?>例子2:$select = mysql_select_db or die("Can not connect this DB!"卡塔尔国;?>注:此函数相当于在MySQL中的USE语句:如 USE forum<4>.SQL查询函数格式:int mysql_query(string sqlquery , int link_identifierState of Qatar;向服务器发一段正式SQL语句要求。假诺失利,则赶回一False值。例子:$connect = mysql_connect;$select = mysql_select_db;$query = mysql_query;if echo "Successed !";else echo "Failed !";?>此函数必定要与mysql_select_db(卡塔尔国函数协作使用,单独接受它就一点意义都没有了!2、mysql_db_query()格式:int mysql_db_query(string database , string sqlquery , int link_identifier卡塔尔(قطر‎;在这里函数中必需内定数据库名database和SQL语句sqlquery,如失利则赶回False。例子:$connect = mysql_connect($hostname , $user , $pwd);$query = mysql_db_query($dbname , $sql , $connect);if echo "Successed !";else echo "Failed !";?>mysql_db_query的分别就在于前边叁个能够毫无选拔mysql_select_db(卡塔尔国来采撷数据库database,而在施行SQL语句的同期,进行选取数据库。 <5>.数据库记录操作函数:1、mysql_fetch_array()格式:array mysql_fetch_array;试行成功,重临1个数组,该数组保存有下一条记下的值,如进行倒闭,则赶回False值。重返的数组既可以够用下标来代表,也足以用字段名来表示。例子:$query = mysql_query;while($arrary = mysql_fetch_array{echo $array[column1]." | ".$array[column2];//echo $array[0]." | ".$array[1];}?>Note : 数组的下标是从0初步的!2、mysql_fetch_row()格式:array = mysql_fetch_row;与1的mysql_fetch_array(State of Qatar函数作用基本相近。差别在于mysql_fetch_row(State of Qatar只可以以数组下标来代表。成功再次回到1个数组,退步重临False值。例子:$query = mysql_query;while($row = mysql_fetch_row{echo $row[0] . " | " . $row[1] . " ";}?>Note : mysql_fetch_row(卡塔尔(قطر‎函数只好用数组下标来表示,并从0开头。另:mysql_fetch_row实行进度快,并且都是对下一行数据实行读取。3、mysql_result()格式:int mysql_result(int query , int row , string filedname);在mysql_result(State of Qatar中,参数row必需从0开始,参数filedname必得是实在的字段名,不能够用下标来表示。实践成功,重临由数据库中抽出的字段的数值,战败则赶回False值。例子:$query = mysql_query;echo mysql_result($query , 0 , "column1")." ";echo mysql_result($query , 1, "column1")." ";echo mysql_result($query , 2, "column1"卡塔尔(قطر‎." ";?>Note : 此函数成效少,但使用方便。4、mysql_fetch_object()格式: object mysql_fetch_object能对点名的字段举行巡回读取,施行成功,将以对象object的花样重返数值,退步则赶回False值。例子:$query = mysql_query;while($object = mysql_fetch_object{echo $object->column1 . " ";echo $object->column2 . " ";echo $object->column3 . " ";}?>Note : mysql_fetch_object(卡塔尔函数推行成功后归来的是1个对象object !操作如下:$object->字段名5、mysql_data_seek()格式:int mysql_data_seek;移动游标到内定的行实行成功,重临真值,失败,重回False值。此函数能够与mysql_fetch_array合营使用,即在利用mysql_data_seek(卡塔尔函数之后,就足以用mysql_fetch_array函数来展现钦赐的行了。例子:$query = mysql_query;$seek = mysql_data_seek;$arrary = mysql_fetch_array;echo $array[column1]." ";echo $array[column2]." ";?><6>.数据库级database的操作函数:1、mysql_create_db()格式:int mysql_create_db(string database name , int link_identifier卡塔尔;通进程序来树立1个数据库database,当然你也足以用mysql_query函数来建设构造或删除database但大家能够用那个函数更为有利地创建1个database。成功重回1个真值,战败,则赶回1个false。例子:$connect = mysql_connect("$hostname","$user","$pwd");$create = mysql_create_db;if echo "create database dbtest successed!";else echo "create database dbtest failed!";?>2、mysql_drop_db()格式:int mysql_drop_db(string database name , int link_identifier卡塔尔国;通进度序来删除1个数据库database。但大家得以用这几个函数更为有利地删除1个database。成功重回1个真值,战败,则赶回1个false。例子:$connect = mysql_connect("$hostname","$user","$pwd");$create = mysql_drop_db;if echo "drop database dbtest successed!";else echo "drop database dbtest failed!";?>Note : 如用mysql_query,则SQL语句应该为:create database dbtestdrop database dbtest 7卡塔尔国 数据库音信函数:1、mysql_fetch_field()格式:object mysql_fetch_field(int query , int [field_offset]卡塔尔;重回1个目的,即一哈希表,下标有:table : 表名name : 字段名max_length : 该字段的最大尺寸not_null : 字段为not null则赶回1,不然再次回到0primary_key : 字段为primary key则赶回1,不然重临0unique_key : 字段为unique key则赶回1,不然再次来到0multiple_key : 字段为非unique key则赶回1,不然再次回到0numeric : 字段为numeric则赶回1,否则重回0blob : 字段为blob则赶回1,不然再次来到0type : 字段的品种unsigned : 字段为unsigned则赶回1,不然重返0zerofill : 字段为zero filled则赶回1,不然再次来到0引用格式为:对象名->下标名使用此函数能够赢得表名、字段名、类型.......例子:$query = mysql_query;while($object = mysql_fetch_field{echo "table name : ".$object->table." ";echo "field name : ".$object->name." ";echo "primary key : ".$object->primary_key." ";echo "not null : ".$object->not_null." ";echo "field type : ".$object->type." ";echo "field max length : ".$object->max_length." ";}?>Note : 哈希表的是从0坐标开端的,即首先个字段为哈希表中的0项。若是大家想直接获得哈希表的第三项即首个字段的音信,可用如下格式:$query = mysql_query;$object = mysql_fetch_field;echo "table name : ".$object->table." ";echo "field name : ".$object->name." ";echo "primary key : ".$object->primary_key." ";echo "not null : ".$object->not_null." ";echo "field type : ".$object->type." ";echo "field max length : ".$object->max_length." ";?>其实那也得以透过上边这几个函数来实现平等的指标。2、mysql_field_seek()格式:int mysql_field_seek(int $query , int field_offsetState of Qatar;将游标移到钦赐的字段上。例子:$query = mysql_query;$seek = mysql_field_seek;$object = mysql_fetch_field;echo "table name : ".$object->table." ";echo "field name : ".$object->name." ";echo "primary key : ".$object->primary_key." ";echo "not null : ".$object->not_null." ";echo "field type : ".$object->type." ";echo "field max length : ".$object->max_length." ";?>那样也完毕与上例相似的渴求。8卡塔尔国取数据库名和表名:1、mysql_list_dbs()格式: int mysql_list_dbs;得到具备可用的数量库名。例子:$connect = mysql_connect;$dbs = mysql_list_dbs;$rows = mysql_num_rows;echo "database total : ".$rows;$i = 0;while{$db_name[$i] = mysql_tablename;echo $db_name[$i];$i++;}?>就可以依次显示出MySQL中颇负的数据库名字。Note : 相当于MySQL中的 show databases命令2、mysql_list_tables()格式:int mysql_list_tables;显示该数据库下有所的表的名字Table name。例子:$connect = mysql_connect;$tables = mysql_list_tables;$rows = mysql_num_rows;echo "Table total : ".$rows;$i = 0;while{$table_name[$i] = mysql_tablename;echo $table_name[$i];$i++;}?>就能够依次呈现出mysql下具备的表的名字Note : 也就是MySQL中的 show tables命令(先要用 use mysql命令选中1个数据库State of Qatar

' . sprintf($lang['Click_return_banadmin'], '', '') . '

标签中 转发请保留此版权音讯,Bugs Report : [email]boss_ch@china.com[/email] *************************************/ if(!isset{$__smtp_class__=1;class smtp {var $hostname="";var $port=25;var $connection=0;var $debug=1;var $timeout=30;var $err_str;var $err_no;var $autocode=true;var $charset="??????";var $subject="";var $body="";var $attach="";var $temp_text_body;var $temp_html_body;var $temp_body_images;var $bound_begin="=====powered_by_boss_chen_";var $bound_end="_046484063883_=====";Function smtp($server="smtp.china.com",$port=25,$time_out=20) {$this->hostname=$server;$this->port=$port;$this->timeout=$time_out;return true;}Function outdebug{echo htmlspecialchars."
n";}function command($command,$return_lenth=1,$return_code='2') {if {$this->err_str="未有连接到此外服务器,请检查互联网连接";return false;}if $this->outdebug;if (!fputs($this->connection,"$command rn")) {$this->err_str="不或者发送命令".$command;return false;}else {$resp=fgets($this->connection,256卡塔尔国;if $this->outdebug;if (substr($resp,0,$return_lenth)!=$return_code) {$this->err_str=$command." 命令服务器再次来到无效:".$resp;return false;}else return true;}}Function open(卡塔尔 {if {$this->err_str="无效的主机名!!";return false;}if echo "$this->hostname,$this->port,&$err_no, &$err_str, $this->timeout
";if (!$this->connection=fsockopen($this->hostname,$this->port,&$err_no, &$err_str, $this->timeout)) {$this->err_str="连接到SMTP 服务器战败,错误消息:".$err_str."错误号:".$err_no;return false;}else {$resp=fgets($this->connection,256);if $this->outdebug;if !="2") {$this->err_str="服务器重回无效的音信:".$resp."请检查SMTP服务器是不是准确";return false;}return true;}}Function Close(卡塔尔国 {if {fclose;$this->connection=0;}}Function Buildhead($from_name,$to_name,$from_mail,$to_mail,$subject) {if $from_name=$from_mail;if $to_name=$to_mail;$this->subject="From: =?$this->charset?B?".base64_encode."?=rn";$this->subject.="To: =?$this->charset?B?".base64_encode."?=rn";$subject=ereg_replace;$this->subject.="Subject: =?$this->charset?B?".base64_encode."?=rn";if echo nl2br(htmlspecialchars;return true;}Function parse_html_body {$passed="";$image_count=0;$this->temp_body_images=array();while src[[:space:]]*=[[:space:]]*",$html_body,$reg)) {$pos=@strpos;$passed.=substr;$html_body=substr($html_body,$pos+strlen;$image_tag=$reg[2];$image_att=$reg[1];$tag_len=strlen;if ($image_tag[0]=="'" or $image_tag[0]=='"') $image_tag=substr;if (substr($image_tag,strlen=="'" or substr($image_tag,strlen=='"') $image_tag=substr($image_tag,0,strlen;//echo $image_tag."
";$cid=md5;$cid=substr."@unigenius.com";$passed.="temp_body_images[$image_count][name]=basename;$this->temp_body_images[$image_count][type]=$content_type;$this->temp_body_images[$image_count][cid]=$cid;$this->temp_body_images[$image_count][data]=$image_data;$image_count++;}$this->temp_html_body=$passed.$html_body;return true;}function build_content($bound_level=0,$text_body,$html_body,$hava_att=false) {if {if (eregi("body.="Content-Type: multipart/related;type="multipart/alternative";tboundary="";$this->body.=$this->bound_begin.$bound_level.$this->bound_end.""rnrn";}else {$this->body.="Content-Type: multipart/related;tboundary="";$this->body.=$this->bound_begin.$bound_level.$this->bound_end.""rnrn";}// 对于是或不是 text 正文 、 html正文 有未有,须有两样的 MIME 头 if $this->body.="This is a multi-part message in MIME format.rnrn";// 正文标记,借使是已经有附属类小零件的编码,则在正文 中无需这一句 $this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."rn";$this->parse_html_body;if {$this->body.="Content-Type: multipart/alternative;tboundary="";$bound_level++;$this->body.=$this->bound_begin.$bound_level.$this->bound_end.""rnrn";$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."rn";$this->body.="Content-Type: text/plain;rn";$this->body.="tcharset="$this->charset"rn";$this->body.="Content-Transfer-Encoding: base64rn";$this->body.="rn".chunk_split(base64_encode(StripSlashes."rn";$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."rn";$this->body.="Content-Type: text/html;rn";$this->body.="tcharset="$this->charset"rn";$this->body.="Content-Transfer-Encoding: base64rn";$this->body.="rn".chunk_split(base64_encode(StripSlashes($this->temp_html_body)))."rn";$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."--rnrn";$bound_level--;}else {$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."rn";$this->body.="Content-Type: text/html;rn";$this->body.="tcharset="$this->charset"rn";$this->body.="Content-Transfer-Encoding: base64rn";$this->body.="rn".chunk_split(base64_encode(StripSlashes($this->temp_html_body)))."rn";}//正文编码,有或还没text 部分,编成分裂的格式。 for ($i=0;$itemp_body_images);$i++) {$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."rn";$this->body.="Content-Type:".$this->temp_body_images[$i][type].";name="";$this->body.=$this->temp_body_images[$i][name].""rn";$this->body.="Content-Transfer-Encoding: base64rn";$this->body.="Content-ID: temp_body_images[$i][cid].">rn";$this->body.="rn".chunk_split(base64_encode(StripSlashes($this->temp_body_images[$i][data])))."rn";}$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."--rnrn";$bound_level--;}else // 有或从不图片,以上是有图片的拍卖,上面是未曾图片的管理{$this->temp_html_body=$html_body;if {$bound_level++;$this->body.="Content-Type: multipart/alternative;tboundary="";$this->body.=$this->bound_begin.$bound_level.$this->bound_end.""rnrn";if $this->body.="rnThis is a multi-part message in MIME format.rnrn";$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."rn";$this->body.="Content-Type: text/plain;rn";$this->body.="tcharset="$this->charset"rn";$this->body.="Content-Transfer-Encoding: base64rn";$this->body.="rn".chunk_split(base64_encode(StripSlashes."rn";$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."rn";$this->body.="Content-Type: text/html;rn";$this->body.="tcharset="$this->charset"rn";$this->body.="Content-Transfer-Encoding: base64rn";$this->body.="rn".chunk_split(base64_encode(StripSlashes($this->temp_html_body)))."rn";$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."--rnrn";$bound_level--;}else {$this->body.="Content-Type: text/html;rn";$this->body.="tcharset="$this->charset"rn";$this->body.="Content-Transfer-Encoding: base64rn";$this->body.="rn".chunk_split(base64_encode(StripSlashes($this->temp_html_body)))."rn";}//正文编码,有或从不text 部分,编成不一样的格式。 }// end else }else // 若无html 正文,只有text 正文 {$this->body.="Content-Type: text/plain;tcharset="$this->charset"rn";$this->body.="Content-Transfer-Encoding: base64rn";$this->body.="rn".chunk_split(base64_encode(StripSlashes."rn";}}// end function default Function Buildbody($text_body=null,$html_body=null,$att=null) {$this->body="MIME-Version: 1.0rn";if (null==$att or //若无附属类小零部件,查看正文的门类; {$encode_level=0;$this->build_content($encode_level,$text_body,$html_body卡塔尔国;}// 若无附属类小零器件, // ******************************************************** else //借使有附属类小零件, {$bound_level=0;$this->body.="Content-Type: multipart/mixed;tboundary="";$bound_level++;$this->body.=$this->bound_begin.$bound_level.$this->bound_end.""rnrn";$this->body.="This is a multi-part message in MIME format.rnrn";$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."rn";$this->build_content($bound_level,$text_body,$html_body,true卡塔尔国;// 编入正文部分 $num=count;for {$file_name=$att[$i][name];$file_source=$att[$i][source];$file_type=$att[$i][type];$file_size=$att[$i][size];if (file_exists {$file_data=addslashes(fread($fp=fopen, filesize;$file_data=chunk_split(base64_encode(StripSlashes;$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."rn";$this->body.="Content-Type: $file_type;rntname="$file_name"rnContent-Transfer-Encoding: base64rn";$this->body.="Content-Disposition: attachment;rntfilename="$file_name"rnrn";$this->body.=$file_data."rn";}}//end for $this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."--rnrn";}// end else if echo nl2br(htmlspecialchars;return true;}function send($from_name,$to_name,$from_mail,$to_mail,$subject,$text_body=false,$html_body=false,$att=false) {if or empty {$this->err_str="没有一点名正确的邮件地址:发送给外人:".$from_mail."接收人:".$to_mail;return false;}if !="array") $to_mail=split;//假使不是数组,调换到数组,哪怕独有二个发送对象;if !="array") $to_name=split;//假如不是数组,转换到数组,哪怕只有二个出殡和下葬对象;$this->Buildbody($text_body,$html_body,$att卡塔尔(قطر‎;// 全数信件的剧情是一律的,能够只编三遍,而对此分裂的收信人,须要分化的Head if return false;if (!$this->command("HELO $this->hostname",3,"250"卡塔尔国State of Qatar return false;// 与服务器创设链接 if return false;if (!$this->command("HELO $this->hostname",3,"250")) return false;for ($i=0;$iBuildhead($from_name,$to_name[$i],$from_mail,$to_mail[$i],$subject);if (!$this->command return false;if (!$this->command("MAIL FROM:".$from_mail,3,"250")) return false;if (!$this->command("RCPT TO:".$to_mail[$i],3,"250")) return false;if (!$this->command return false;// 计划发送邮件 if $this->outdebug;if (!fputs($this->connection,$this->subject)) {$this->err_str="发送邮件头时出错!";return false;}if $this->outdebug;if (!fputs($this->connection,$this->body)) {$this->err_str="发送正文时出错!";return false;}if (!fputs($this->connection,".rn")) {$this->err_str="发送正文时出错!";return false;}//正文发送达成,退出; $resp=fgets($this->connection,256卡塔尔国;if$this->outdebug;if !="2"){$this->err_str="发送完后,服务器没有响应!!";return false;}// 发送邮件 }if (!$this->command return false;$this->close();return true;}}//end class define }//end if(!isset ?>PHP SMTP类使用方法

' . sprintf($lang['Click_return_admin_index'], '', '');message_die(GENERAL_MESSAGE, $message);}else{$template->set_filenames(array('body' => 'admin/user_ban_body.tpl'));$template->assign_vars(array('L_BAN_TITLE' => $lang['Ban_control'],'L_BAN_EXPLAIN' => $lang['Ban_explain'],'L_BAN_EXPLAIN_WARN' => $lang['Ban_explain_warn'],'L_IP_OR_HOSTNAME' => $lang['IP_hostname'],'L_EMAIL_ADDRESS' => $lang['Email_address'],'L_SUBMIT' => $lang['Submit'],'L_RESET' => $lang['Reset'],'S_BANLIST_ACTION' => append_sid("admin_user_ban.$phpEx")));$template->assign_vars(array('L_BAN_USER' => $lang['Ban_username'],'L_BAN_USER_EXPLAIN' => $lang['Ban_username_explain'],'L_BAN_IP' => $lang['Ban_IP'],'L_BAN_IP_EXPLAIN' => $lang['Ban_IP_explain'],'L_BAN_EMAIL' => $lang['Ban_email'],'L_BAN_EMAIL_EXPLAIN' => $lang['Ban_email_explain']));$userban_count = 0;$ipban_count = 0;$emailban_count = 0;$sql = "SELECT b.ban_id, u.user_id, u.usernameFROM " . BANLIST_TABLE . " b, " . USERS_TABLE . " uWHERE u.user_id = b.ban_useridAND b.ban_userid <> 0AND u.user_id <> " . ANONYMOUS . "ORDER BY u.user_id ASC";if ( !($result = $db->sql_query{message_die(GENERAL_ERROR, 'Could not select current user_id ban list', '', __LINE__, __FILE__, $sql);}$user_list = $db->sql_fetchrowset;$db->sql_freeresult;$select_userlist = '';for($i = 0; $i < count{$select_userlist .= '' . $user_list[$i]['username'] . '';$userban_count++;}if( $select_userlist == '' ){$select_userlist = '' . $lang['No_banned_users'] . '';}$select_userlist = '' . $select_userlist . '';$sql = "SELECT ban_id, ban_ip, ban_emailFROM " . BANLIST_TABLE;if ( !($result = $db->sql_query{message_die(GENERAL_ERROR, 'Could not select current ip ban list', '', __LINE__, __FILE__, $sql);}$banlist = $db->sql_fetchrowset;$db->sql_freeresult;$select_iplist = '';$select_emaillist = '';for($i = 0; $i < count{$ban_id = $banlist[$i]['ban_id'];if ( !empty($banlist[$i]['ban_ip']) ){$ban_ip = str_replace('255', '*', decode_ip($banlist[$i]['ban_ip']));$select_iplist .= '' . $ban_ip . '';$ipban_count++;}else if ( !empty($banlist[$i]['ban_email']) ){$ban_email = $banlist[$i]['ban_email'];$select_emaillist .= '' . $ban_email . '';$emailban_count++;}}if ( $select_iplist == '' ){$select_iplist = '' . $lang['No_banned_ip'] . '';}if ( $select_emaillist == '' ) {$select_emaillist = '' . $lang['No_banned_email'] . '';}$select_iplist = '' . $select_iplist . '';$select_emaillist = '' . $select_emaillist . '';$template->assign_vars(array('L_UNBAN_USER' => $lang['Unban_username'],'L_UNBAN_USER_EXPLAIN' => $lang['Unban_username_explain'],'L_UNBAN_IP' => $lang['Unban_IP'],'L_UNBAN_IP_EXPLAIN' => $lang['Unban_IP_explain'],'L_UNBAN_EMAIL' => $lang['Unban_email'],'L_UNBAN_EMAIL_EXPLAIN' => $lang['Unban_email_explain'], 'L_USERNAME' => $lang['Username'], 'L_LOOK_UP' => $lang['Look_up_User'],'L_FIND_USERNAME' => $lang['Find_username'],'U_SEARCH_USER' => append_sid("search.$phpEx?mode=searchuser&popup=1&menu=1"), 'S_UNBAN_USERLIST_SELECT' => $select_userlist,'S_UNBAN_IPLIST_SELECT' => $select_iplist,'S_UNBAN_EMAILLIST_SELECT' => $select_emaillist,'S_BAN_ACTION' => append_sid("admin_user_ban.$phpEx")));}$template->pparse;include('./page_footer_admin.'.$phpEx);?>

debug = 0;$sender_name = "root";$sender_mail = "root@localhost";$to_name = "mm";$to_mail = "[email]mm@your.com[/email]";$subject = "i miss u";$content = "i miss u much.";$att[0]["name"] = "miss.jpg";$att[0]["source"] = "/path/to/your/miss.jpg";$att[0]["type"] = "image/jpeg";$att[0]["size"] = "10kb";$extra_subject = "To:".$to_mail." 主题:".$subject;if (!$mail->send($sender_name,$to_name,$sender_mail,$to_mail,$extra_subject,$content,false,$attState of QatarState of Qatar$err = 1;?> 重返文件的MIME类型的函数guessMIMEType(卡塔尔国 function guessMIMEType {//GUESS MIME TYPE$filename = basename;if(strrchr == false卡塔尔国{return("application/octet-stream"卡塔尔(قطر‎;}$ext = strrchr;switch {case ".gif":return "image/gif";break;case ".gz":return "application/x-gzip";case ".htm":case ".html":return "text/html";break;case ".jpg":return "image/jpeg";break;case ".tar":return "application/x-tar";break;case ".txt":return "text/plain";break;case ".zip":return "application/zip";break;default:return "application/octet-stream";break;}}检验Email地址的函数IsValidEmail(State of Qatarfunction IsValidEmail {if(!ereg("^[[:alnum:]_.]+@+[[:alnum:]][[:alnum:]][[:alnum:]]?$",$Email, $regs卡塔尔国卡塔尔国{$IsValidEmail = false;}else{$IsValidEmail = true;}return $IsValidEmail;} 贰个MIME MAIL类,请大家只顾什么协会八个邮件体

parts = array(); $this->to = ""; $this->from = ""; $this->subject = ""; $this->body = ""; $this->headers = ""; } /* * void add_attachment(string message, [string name], [string ctype]) * Add an attachment to the mail object */ function add_attachment($message, $name = "", $ctype = "application/octet-stream") { $this->parts[] = array ( "ctype" => $ctype, "message" => $message, "encode" => $encode, "name" => $name ); } /* * void build_message(array part= * Build message parts of an multipart mail */ function build_message { $message = $part["message"]; $message = chunk_split(base64_encode; $encoding = "base64"; return "Content-Type: ".$part["ctype"].($part["name"]?";ntname="".$part["name"].""" : "")."nContent-Transfer-Encoding: $encoding"."nContent-Disposition: attachment".($part["name"]?";ntfilename="".$part["name"].""" : "")."nn$messagen";}/* * void build_multipart() * Build a multipart mail */ function build_multipart() { $boundary = "b".md5; $multipart = "Content-Type: multipart/mixed;ntboundary="$boundary"nnThis is a MIME encoded message.nn--$boundary"; for($i = sizeof-1; $i >= 0; $i--) { $multipart .= "n".$this->build_message."--$boundary"; } return $multipart.= "--n"; } /* * void send() * Send the mail (last class-function to be called) */ function send() { $addtionheaders = ""; if $addtionheaders .= "From: ".$this->from."n"; if (!empty $addtionheaders .= $this->headers."n"; if $this->add_attachment($this->body, "", "text/plain");$addtionheaders .= "MIME-Version: 1.0n".$this->build_multipart();$fp = fopen;fputs;fclose;mail($this->to, $this->subject, "", $addtionheaders); } }; // end of class /* * Example usage * $attachment = fread(fopen, filesize; $mail = new mime_mail(); $mail->from = "[email]foo@bar.com[/email]"; $mail->headers = "Errors-To: [email]foo@bar.com[/email]"; $mail->to = "[email]bar@foo.com[/email]"; $mail->subject = "Testing..."; $mail->body = "This is just a test."; $mail->add_attachment("$attachment", "test.jpg", "image/jpeg"); $mail->send(); */ ?>myimap类,读取邮件

///////////////////////////////////////////////class myimap{var $username="";var $userpwd="";var $hostname="";var $port=0;var $connection=0; //是或不是连接var $state="DISCONNECTED"; //连接状态var $greeting="";var $must_update=0;var $inStream=0;var $num_msg_parts = 0;var $attach;var $num_of_attach = 0;function open(){if $this->inStream=imap_open("{".$this->hostname."/pop3:110}inbox",$this->username,$this->userpwd);else$this->inStream=imap_open("{".$this->hostname.":143}INBOX",$this->username,$this->userpwd卡塔尔;if {//echo "客商:$this->username 的信箱连接成功。
";return $inStream;}else{echo "顾客:$this->username 的信箱连接退步。
";return 0;}}Function close(){if(imap_close{//echo "


曾经与服务器 $this->hostname 断开连接。";return 1;}else{//echo "


与服务器 $this->hostname 断开连接退步。";return 0;}}function DeleteMail{if (@imap_delete($this->inStream,$msg_no))return true;elsereturn false; }function ExpungeMail(){if (@imap_expungereturn true;elsereturn false;}function CheckMailbox{$mboxinfo=@imap_mailboxmsginfo;//$mboxinfo=imap_check;if if {//echo "您邮箱:".$mboxinfo->Mailbox."
";echo $this->username."@wells.com的收件箱里共有邮件数:".$mboxinfo->Nmsgs."
n";echo "未读邮件数:".$mboxinfo->Unread."";echo "新邮件数:".$mboxinfo->Recent." ";echo "总共占用空间:".$mboxinfo->Size."字节
n";$last_page = ceil($mboxinfo->Nmsgs/$page_size);$cur_page = $page +1;$num_page = $last_page;echo "第".$cur_page."页,共".$last_page."页。n";}else{echo "您的邮箱里从未邮件。


n";}else{echo '错误:不能够赢得收件箱的音信。';return 0;}echo "

本文由云顶集团线路检测发布,转载请注明来源

关键词: