Read POP3/IMAP attachment with PHP

用法:

<?

   //$ServerName = "{localhost:143/imap}INBOX"; // For a IMAP connection    (PORT 143)
   //$ServerName = "{localhost:110/pop3}INBOX"; // For a POP3 connection    (PORT 110)

require_once(“attachmentread.class.php”);
$host=”{my.mailserver.net:110/pop3}”; // pop3host
$login=”user1″; //pop3 login
$password=”passwd1″; //pop3 password
$savedirpath=”” ; // attachement will save in same directory where scripts run othrwise give abs path
$jk=new readattachment(); // Creating instance of class####
$jk->getdata($host,$login,$password,$savedirpath); // calling member function

?>

(continue reading…)


Writing a mail client that handles attachments with PHP

When you think about writing a mail client in PHP, beware it’s fuzzy because of missing documentation on the imap functions in PHP.
PHP uses the imap functions to fetch and handle mailboxes (also POP3) just a matter of how you connect to your mailaccount. (continue reading…)


html禁止选择文字的方法

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″ />
<title>测试</title>
</head>
<body>
<div onselectstart=”return false;” style=”-moz-user-select:none;” >你选不了我</div>
</body>
</html>

1 Comment more...

js 实现支持crtl与shift键的行多选

var lastObj = {}; //选中的当前行对象
var tableObj = {}; //表对象

//按键多选
function onTrClick(o) {
tableObj = document.getElementById(“Table1”);
var len = tableObj.rows.length;
for (var i = 1; i < len; i++) { tableObj.rows[i].rowNum = i; } if (event.ctrlKey) {//如果按下了ctrl键 if (o.style.backgroundColor == "#ffffff") { o.style.backgroundColor = '#e3e9f4'; lastObj = o; }else if (o.style.backgroundColor == "#e3e9f4") { o.style.backgroundColor = '#ffffff'; } }else if (event.shiftKey) {//如果按下了shift键 var beginNum, lastNum; if (lastObj.rowNum <= o.rowNum) { beginNum = lastObj.rowNum; lastNum = o.rowNum; }else { beginNum = o.rowNum; lastNum = lastObj.rowNum; } for (var i = 0; i < len; i++) { if (i >= beginNum && i <= lastNum) { tableObj.rows[i].style.backgroundColor = "#e3e9f4"; }else{ tableObj.rows[i].style.backgroundColor = "#ffffff"; } } lastObj = o; }else { for (var i = 1; i < len; i++) { tableObj.rows[i].style.backgroundColor = "#ffffff"; } o.style.backgroundColor = '#e3e9f4'; lastObj = o; } }


uniqid

uniqid
产生只一的值。
语法: string uniqid(string prefix);
返回值: 字符串
函数种类: 编码处理
内容说明 
本函数会依据当时的毫秒以及指定的前置字符串产生一个独一无二的字符串。参数 prefix 为前置的字符串,最多可达 114 字符。

echo uniqid();可以看到uniqid始终是一个不断变化的长度为13的十六进制数。
<?php
echo hexdec(uniqid())/(time()+microtime()); 
?>
输出基本上在1048576左右。
可以断定,uniqid就是当前时间精确到微秒再乘以1048576(2的20次幂)最后转换为十六进制得到的。

 

1 Comment more...

typo3 feuser md5

  1. if (TYPO3_MODE == ‘BE’) {
    $TCA[‘fe_users’][‘columns’][‘password’][‘config’][‘eval’] = ‘md5,nospace,required,password’;
    }
  2. class.t3lib_userauth.php  1189行 $loginData[‘uident’] = md5($loginData[‘uident_text’]);

typo3用户自动登录

Typo3 4,5,6

$loginData = array(
'uname' => $user['username'], //usernmae
'uident' => $user['password'], //password (加密后)
'status' => 'login'
);
$GLOBALS['TSFE']->fe_user->checkPid=0; //do not use a particular pid
$info= $GLOBALS['TSFE']->fe_user->getAuthInfoArray();
$user2=$GLOBALS['TSFE']->fe_user->fetchUserRecord($info['db_user'],$loginData['uname']);
//print_r($user2);
$ok=$GLOBALS['TSFE']->fe_user->compareUident($user2,$loginData);
if($ok) {
//login successfull
$GLOBALS['TSFE']->fe_user->createUserSession($user2);
$GLOBALS["TSFE"]->fe_user->loginSessionStarted = TRUE;
$GLOBALS["TSFE"]->fe_user->user = $GLOBALS["TSFE"]->fe_user->fetchUserSession();
}

Typo3 7

$GLOBALS['TSFE']->fe_user->createUserSession($userinfo);
$GLOBALS['TSFE']->fe_user->setAndSaveSessionData('login', 'success');
1 Comment more...

CSV export length

CSV field’s value will be cut to 100 length. It’s fixed in /typo3/class.db.list.extra.inc, line 732, so you can write a XCLASS to change it. good luck!

1 Comment more...

phpExcel常用方法详解

操作excel

1.header

header(“Content-Type:application/vnd.ms-excel”);
header(“Content-Disposition:attachment;filename=product.xls”);
header(“Pragma:no-cache”);
header(“Expires:0”); (continue reading…)


Record tree for TCA

Extension Key: cps_tcatree required plugin: Developer library ( cps_devlib )

Installation / Quick start

Changes in ext_tables.php

For each table you want to display as a tree you have to define a new key “treeParentField” which defines the field in which the relation is stored. This field can be either a comma separated list of uids or a mm-relation field.
(continue reading…)


Copyright © 1996-2010 Add Lives. All rights reserved.
iDream theme by Templates Next | Powered by WordPress