⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 import.php

📁 泛微协同办公系统标准版E-office V5.5的源代码内含泛微办公系统V5.5自动注册文件。
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php

include_once( "inc/auth.php" );
include_once( "inc/conn.php" );
include_once( "inc/utility.php" );
include_once( "inc/csv.php" );
echo "<html>\r\n<head>\r\n<title>分组管理</title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n</head>\r\n<body class=\"bodycolor\" topmargin=\"5\">\r\n";
if ( $FILE_NAME == "" )
{
	echo "<s";
	echo "cript Language=\"JavaScript\">\r\nfunction CheckForm()\r\n{\r\n   if(document.form1.CSV_FILE.value==\"\")\r\n   { alert(\"请选择要导入的文件!\");\r\n     return (false);\r\n   }\r\n\r\n   if (document.form1.CSV_FILE.value!=\"\")\r\n   {\r\n     var file_temp=document.form1.CSV_FILE.value,file_name;\r\n     var Pos;\r\n     Pos=file_temp.lastIndexOf(\"\\\\\");\r\n     file_name=file_temp.substring(Pos+1,file_temp.length);\r\n     docume";
	echo "nt.form1.FILE_NAME.value=file_name;\r\n   }\r\n\r\n   return (true);\r\n}\r\n\r\n</script>\r\n<form name=\"form1\" method=\"post\" action=\"import.php\" enctype=\"multipart/form-data\" onsubmit=\"return CheckForm();\">\r\n<table border=\"0\" width=\"100%\" cellspacing=\"1\" cellpadding=\"0\">\r\n  <tr class=\"tablehead1\">\r\n  <td> <img src=\"/images/sys_config.gif\" align=\"absmiddle\">导入CSV通讯簿\r\n  </td>\r\n  </tr>\r\n  <tr class=\"tablehead2\"><td>\r";
	echo "\n  <input type=\"image\" src=\"/images/button/next.gif\">\r\n  <a href=\"javascript:location='index.php'\"><img title=\"返回\" src=\"/images/button/return.gif\" border=\"0\" accesskey=\"B\"></a>\r\n  </td>\r\n  </tr>\r\n</table>\r\n<br>\r\n<div align=\"center\">\r\n  请指定用于导入的CSV文件:\r\n  \r\n    <input type=\"file\" name=\"CSV_FILE\" size=\"30\">\r\n    <input type=\"hidden\" name=\"FILE_NAME\">\r\n    <input type=\"hidden\" name=\"GROUP_ID\" value=\"";
	echo $GROUP_ID;
	echo "\">\r\n</form>\r\n  \r\n";
	exit( );
}
if ( strtolower( substr( $FILE_NAME, -3 ) ) != "csv" )
{
	message( "错误", "只能导入CSV文件!" );
	button_back( );
	exit( );
}
$ID_STR = "PSN_NAME,SEX,NICK_NAME,BIRTHDAY,MINISTRATION,MATE,CHILD,DEPT_NAME,ADD_DEPT,POST_NO_DEPT,TEL_NO_DEPT,FAX_NO_DEPT,ADD_HOME,POST_NO_HOME,TEL_NO_HOME,MOBIL_NO,BP_NO,EMAIL,OICQ_NO,ICQ_NO,NOTES";
$csv = new csv( );
$csv->file = $CSV_FILE;
$csv->spot = "|";
$csv->open( 0 );
$rows = $csv->rows( );
$field = $csv->getfield( );
$i = 0;
for ( ;	$i <= count( $field ) - 1;	++$i	)
{
	$field[$i];
}
$optionlist = explode( ",", $field[0] );
$noptionlist = implode( ",", $optionlist );
$j = 0;
while ( $record = $csv->getrecord( ) )
{
	$i = 0;
	for ( ;	$i <= count( $record ) - 1;	++$i	)
	{
		$csvres[$i] = $record[$i];
	}
	++$j;
}
$csvres = implode( ",", $csvres );
$csv->close( );
mt_srand( ( double )microtime( ) * 1000000 );
$filecsv = mt_rand( );
$csvfile = $filecsv.".csv";
$FILENAME = getenv( "DOCUMENT_ROOT" )."attachment/".$csvfile;
copy( $CSV_FILE, $FILENAME );
unset( $csv );
echo "<s";
echo "cript>\r\n var rlist,pos;\r\n var mystr = new Array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','w');\r\n \r\n Array.prototype.indexOf=function(substr,start){\r\n\tvar ta,rt,d='\\0';\r\n\tif(start!=null){ta=this.slice(start);rt=start;}else{ta=this;rt=0;}\r\n\tvar str=d+ta.join(d)+d,t=str.indexOf(d+substr+d);\r\n\tif(t==-1)return -1;rt+=str.slice(0,t).replace(/[^\\0]/g,'').length;\r\n\tr";
echo "eturn rt;\r\n }\r\n Array.prototype.replace=function(reg,rpby){\r\n\tvar ta=this.slice(0),d='\\0';\r\n\tvar str=ta.join(d);str=str.replace(reg,rpby);\r\n\t\r\n\treturn str.split(d);\r\n }\r\n function replacePos(strObj, pos, replacetext) { \r\n   var str = strObj.substr(0, pos-1) + replacetext + strObj.substring(pos, strObj.length); \r\n   var str = strObj.substring(pos, strObj.length);\r\n   \r\n   return str; \r\n }\r\n functio";
echo "n setRecordList(a) {\r\n   rlist = document.getElementById(a).value;\r\n   mystr.splice(a,1, rlist);\r\n   document.csv.nlist.value = mystr;\r\n   \r\n }\r\n function check() {\r\n   document.csv.nlist.value = mystr;\r\n   return (true);\r\n }\r\n</script>\r\n<form name=\"csv\" method=\"post\" action=\"submit.php\" onsubmit=\"return check()\">\r\n<table border=\"0\" width=\"100%\" cellpadding=\"2\" cellspacing=\"1\" align=\"center\">\r\n<tr>\r\n ";
echo "   <td nowrap>\r\n\t <table border=\"0\" width=\"100%\" cellspacing=\"1\" cellpadding=\"0\">\r\n  <tr class=\"tablehead1\">\r\n  <td><img src=\"/images/menu/address.gif\" align=\"absmiddle\">导入通讯录\r\n  </td>\r\n  </tr>\r\n  <tr class=\"tablehead2\"><td>\r\n  <input type=\"image\" title=\"保存\" src=\"/images/button/save.gif\" accesskey=\"S\">\r\n  <a href=\"index.php?GROUP_ID=";
echo $GROUP_ID;
echo "\"><img src=\"/images/button/return.gif\" border=\"0\"></a>\r\n  </td>\r\n  </tr>\r\n  </table>\r\n<hr width=\"95%\" height=\"1\" align=\"left\" color=\"#ffffff\">\r\n<input type=\"hidden\" name=\"nlist\">\r\n<input type=\"hidden\" name=\"optionlist\" value=\"";
echo $noptionlist;
echo "\">\r\n<input type=\"hidden\" name=\"csvfile\" value=\"";
echo $csvfile;
echo "\">\r\n<input type=\"hidden\" name=\"GROUP_ID\" value=\"";
echo $_REQUEST['GROUP_ID'];
echo "\">\r\n <table border=\"0\" width=\"100%\" cellpadding=\"2\" cellspacing=\"1\" align=\"center\">\r\n    <tr>\r\n      <td nowrap class=\"TableHeader\" colspan=\"2\"><b>&nbsp;个人信息</b></td>\r\n    </tr>\r\n    <tr id>\r\n      <td nowrap class=\"TableLine2\"> 姓名:</td>\r\n      <td class=\"TableLine1\">\r\n         ";
echo "<s";
echo "elect name=\"PSN_NAME\" id=\"0\" onChange=\"setRecordList('0')\">\r\n\t\t <option>请选择</option>\r\n\t\t ";
$i = 0;
for ( ;	$i < count( $optionlist );	++$i	)
{
	echo "\t\t <option value=\"";
	echo $i;
	echo "\">";
	echo $optionlist[$i];
	echo "\t\t ";
}
echo "\t\t </select>\r\n\t\t \r\n      </td>\r\n    </tr>\r\n    <tr>\r\n      <td nowrap class=\"TableLine2\"> 性别:</td>\r\n      <td class=\"TableLine1\">\r\n\t    \r\n        ";
echo "<s";
echo "elect name=\"SEX\" id=\"1\" onChange=\"setRecordList('1')\">\r\n\t\t <option>请选择</option>\r\n\t\t ";
$i = 0;
for ( ;	$i < count( $optionlist );	++$i	)
{
	echo "\t\t <option value=\"";
	echo $i;
	echo "\">";
	echo $optionlist[$i];
	echo "\t\t ";
}
echo "\t\t </select>\r\n         \r\n      </td>\r\n    </tr>\r\n    <tr>\r\n      <td nowrap class=\"TableLine2\"> 昵称:</td>\r\n      <td class=\"TableLine1\">\r\n\t    <div id=\"NICK_NAME\">\r\n        ";
echo "<s";
echo "elect name=\"NICK_NAME\" id=\"2\" onChange=\"setRecordList('2')\">\r\n\t\t<option>请选择</option>\r\n\t\t ";
$i = 0;
for ( ;	$i < count( $optionlist );	++$i	)
{
	echo "\t\t <option value=\"";
	echo $i;
	echo "\">";
	echo $optionlist[$i];
	echo "\t\t ";
}
echo "\t\t </select>\r\n\t\t </div>\r\n      </td>\r\n    </tr>\r\n\t<tr>\r\n      <td nowrap class=\"TableLine2\">生日:</td>\r\n      <td class=\"TableLine1\">\r\n\t     ";
echo "<s";
echo "elect name=\"BIRTHDAY\" id=\"3\" onChange=\"setRecordList('3')\">\r\n\t\t <option>请选择</option>\r\n\t\t ";
$i = 0;
for ( ;	$i < count( $optionlist );	++$i	)
{
	echo "\t\t <option value=\"";
	echo $i;
	echo "\">";
	echo $optionlist[$i];
	echo "\t\t ";
}
echo "\t\t </select>\r\n\t\t \r\n      </td>\r\n    </tr>\r\n    \r\n    <tr>\r\n      <td nowrap class=\"TableLine2\"> 职务:</td>\r\n      <td class=\"TableLine1\">\r\n\t   \r\n     ";
echo "<s";
echo "elect name=\"select\" id=\"4\" onChange=\"setRecordList('4')\">\r\n\t <option>请选择</option>\r\n\t\t ";
$i = 0;
for ( ;	$i < count( $optionlist );	++$i	)
{
	echo "\t\t <option value=\"";
	echo $i;
	echo "\">";
	echo $optionlist[$i];
	echo "\t\t ";
}
echo "\t\t </select>\r\n\t\t \r\n      </td>\r\n    </tr>\r\n    <tr>\r\n      <td nowrap class=\"TableLine2\"> 配偶:</td>\r\n      <td class=\"TableLine1\">\r\n\t   <div id=\"MATE\">\r\n     ";
echo "<s";
echo "elect name=\"MATE\" id=\"5\" onChange=\"setRecordList('5')\">\r\n\t <option>请选择</option>\r\n\t\t ";
$i = 0;
for ( ;	$i < count( $optionlist );	++$i	)
{
	echo "\t\t <option value=\"";
	echo $i;
	echo "\">";
	echo $optionlist[$i];
	echo "\t\t ";
}
echo "\t\t </select>\r\n\t\t </div>\r\n      </td>\r\n    </tr>\r\n    <tr>\r\n      <td nowrap class=\"TableLine2\"> 子女:</td>\r\n      <td class=\"TableLine1\">\r\n\t   <div id=\"SEX\">\r\n     ";
echo "<s";
echo "elect name=\"select\" id=\"6\" onChange=\"setRecordList('6')\">\r\n\t <option>请选择</option>\r\n\t\t ";
$i = 0;
for ( ;	$i < count( $optionlist );	++$i	)
{
	echo "\t\t <option value=\"";
	echo $i;
	echo "\">";
	echo $optionlist[$i];
	echo "\t\t ";
}
echo "\t\t </select>\r\n\t\t </div>\r\n      </td>\r\n    </tr>\r\n\r\n    <tr>\r\n      <td nowrap class=\"TableHeader\" colspan=\"2\"><b>&nbsp;联系方式(单位)</b></td>\r\n    </tr>\r\n\r\n    <tr>\r\n      <td nowrap class=\"TableLine2\"> 单位名称:</td>\r\n      <td class=\"TableLine1\">\r\n\t  \r\n     ";
echo "<s";
echo "elect name=\"select\" id=\"7\" onChange=\"setRecordList('7')\">\r\n\t <option>请选择</option>\r\n\t\t ";
$i = 0;
for ( ;	$i < count( $optionlist );	++$i	)
{
	echo "\t\t <option value=\"";
	echo $i;
	echo "\">";
	echo $optionlist[$i];

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -