<?php
ob_start();
//無時間限制
set_time_limit(0);

if (isset($_POST['ip'])) {
	$ip=$_POST['ip'];
}
$_self_path = ($_SERVER['PHP_SELF']) == "" ? $_SERVER['REQUEST_URI'] : ($_SERVER['PHP_SELF']) ;
$_path_array = explode("/",$_self_path);
$_path_count = count($_path_array);
$ROOT_PATH = "";
for ($i=0;$i<$_path_count-2;$i++) 
{
$ROOT_PATH = '../'.$ROOT_PATH;
}

include_once  '_dbdir.php';


if (getenv("HTTP_X_FORWARDED_FOR")) 
	$from_ip = getenv("HTTP_X_FORWARDED_FOR");
else 
	$from_ip = getenv("REMOTE_ADDR");

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  //$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

//CREATE TABLE config(ID integer primary key,sn,Name,type,EmpID,textWebEmailAddress,syncServerAdressReal,SwitchFillbyStock,SyncClient,showTotal,SwitchCategoryJump,indexShowAll,OrderByName2,Description1,Description2,Description3,Description4,Description5)
 function pushIOS($deviceToken='',$message='',$badge='',$showinfo=0,$times=1){

        $body = array("aps" => array("alert" => $message,"badge" => $badge,"sound"=>'default'));  //推送方式，包含内容和声音

        $ctx = stream_context_create();
        //如果在Windows的服务器上，寻找pem路径会有问题，路径修改成这样的方法：
        $pem = dirname(__FILE__) . '/sandbox-certificates/' . 'ck.pem';
        stream_context_set_option($ctx,"ssl","local_cert",$pem);
        //linux 的服务器直接写pem的路径即可
        //stream_context_set_option($ctx,"ssl","local_cert","apns-dev.pem");
        $pass = "916423330";
        stream_context_set_option($ctx, 'ssl', 'passphrase', $pass);
        //must select between two servers:if for testing，select sandbox server and Dev pem file ; if for relese，use Product pem and server
        //$fp = stream_socket_client("ssl://gateway.push.apple.com:2195", $err, $errstr, 60, STREAM_CLIENT_CONNECT, $ctx);
        $fp = stream_socket_client("ssl://gateway.sandbox.push.apple.com:2195", $err, $errstr, 60, STREAM_CLIENT_CONNECT, $ctx);
        if (!$fp) 
        {
            echo "Failed to connect $err $errstrn";
            return;
        }
        if ($showinfo) print date("Y-m-d H:i:s")." Connection OK<br>";
        $payload = json_encode($body);
/* 		echo str_pad('', 1024);//使缓冲区溢出
		//for ($x=0; $x<3000; $x++) echo "#";
		echo "<br>";
		for ($x=0; $x<$times; $x++) {
			//pushIOS($_POST['name'],$x.' - '.$_POST['message'],1);
			echo $x."#";
			ob_flush();
			flush(); //刷新并输出PHP缓冲数据
			sleep(1);
		}
		//ob_end_flush();//输出并关闭缓冲

 */ 
        $msg = chr(0) . pack("n",32) . pack("H*", str_replace(' ', '', $deviceToken)) . pack("n",strlen($payload)) . $payload;
        fwrite($fp, $msg);
        fclose($fp);
        if ($showinfo) echo date("Y-m-d H:i:s")." sending message :" . $payload ."<hr>";
   }
	
	
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "edit")) {
	echo "checkboxallpush : ".$_POST["checkboxallpush"]."<br>checkboxdel : ".$_POST["checkboxdel"]."<hr>";
	if ($_POST["checkboxallpush"] =='on') {
	
		$query_RecordsetCFG = "SELECT deviceToken  FROM users order by ID";
		//echo $query_RecordsetCFG;
		foreach ($orders->query($query_RecordsetCFG) as $row_RecordsetCFG)
		{ 
			$deviceToken= $row_RecordsetCFG['deviceToken'];
			pushIOS($deviceToken,$x.' - '.$_POST['message'],1);

		}
		
	}else if (strlen($_POST["message"])>0){
		
		pushIOS($_POST['deviceToken'],$_POST['message'],1,1);

	}else if ($_POST["checkboxdel"] =='on') {
		 $insertSQL =sprintf("delete from  users   WHERE ID=%s",
                        GetSQLValueString($_POST['ID'], "long")
					   );
			$orders->query($insertSQL);
			$insertok="[删除".$_POST['username']."成功]  ";
			echo $insertok;
	}else{
  $updateSQL = sprintf("UPDATE users SET sn=%s, GUID=%s, deviceToken=%s, username=%s,password=%s,CreateDate=%s,Lang=%s,prn_idVendor=%s,prn_idProduct=%s,prn_out_ep=%s,LCD_WIDTH=%s,LCD_LINE=%s,email=%s,last_operation=%s WHERE ID=%s",
                       GetSQLValueString($_POST['sn'], "text"),
                       GetSQLValueString($_POST['GUID'], "text"),
                       GetSQLValueString($_POST['deviceToken'], "text"),
                       GetSQLValueString($_POST['username'], "text"),
                       GetSQLValueString($_POST['password'], "text"),
                       GetSQLValueString($_POST['CreateDate'], "date"),
                       GetSQLValueString($_POST['Lang'], "text"),
                       GetSQLValueString($_POST['prn_idVendor'], "text"),
                       GetSQLValueString($_POST['prn_idProduct'], "text"),
                       GetSQLValueString($_POST['prn_out_ep'], "text"),
                       GetSQLValueString($_POST['LCD_WIDTH'], "long"),
                       GetSQLValueString($_POST['LCD_LINE'], "long"),
                       GetSQLValueString($_POST['email'], "text"),
                       "'edit'",
                       GetSQLValueString($_POST['ID'], "long")
					   );

			$orders->exec($updateSQL);
			echo $updateSQL."<br>";
			$insertok="EDIT [".$_POST['username']."成功]  ";
	}
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "add")) {
 		 $insertSQL = sprintf("INSERT INTO users (sn,GUID,deviceToken,username,password,CreateDate,Lang,prn_idVendor,prn_idProduct,prn_out_ep,LCD_WIDTH,LCD_LINE,email,last_operation,ver,ip) VALUES (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['sn'], "text"),
                       GetSQLValueString($_POST['GUID'], "text"),
                       GetSQLValueString($_POST['deviceToken'], "text"),
                       GetSQLValueString($_POST['username'], "text"),
                       GetSQLValueString($_POST['password'], "text"),
                       GetSQLValueString($_POST['CreateDate'], "date"),
                       GetSQLValueString($_POST['Lang'], "text"),
                       GetSQLValueString($_POST['prn_idVendor'], "text"),
                       GetSQLValueString($_POST['prn_idProduct'], "text"),
                       GetSQLValueString($_POST['prn_out_ep'], "text"),
                       GetSQLValueString($_POST['LCD_WIDTH'], "long"),
                       GetSQLValueString($_POST['LCD_LINE'], "long"),
                       GetSQLValueString($_POST['email'], "text"),
                       "'add'",
                       1,
                       "'admin'"
					   );

			$orders->query($insertSQL);
			$insertok="[添加".$_POST['username']."成功]  ";
			echo $insertSQL."<br>";
	 
}

if ((isset($_GET["MM_insert"])) && ($_GET["MM_insert"] == "addauto")) {
	$is_exist=0;
	if (!isset($_GET['deviceToken'])) $deviceToken=$_GET['name'];
	else $deviceToken=$_GET['deviceToken'];
	$query_RecordsetCFG = "SELECT top 1 sn  FROM users where GUID='". $_GET['GUID'] ."' order by ID ";
	//echo $query_RecordsetCFG;
	foreach ($orders->query($query_RecordsetCFG) as $row_RecordsetCFG)
	{ 
		$is_exist=1;
		$sn= $row_RecordsetCFG['sn'];
 		$updateSQL = sprintf("UPDATE users SET deviceToken=%s, username=%s,password=%s,Lang=%s,email=%s,last_operation=%s,ip=%s WHERE GUID=%s",
                       GetSQLValueString($deviceToken, "text"),
                       GetSQLValueString($_GET['username'], "text"),
                       GetSQLValueString($_GET['password'], "text"),
                       GetSQLValueString($_GET['Lang'], "text"),
                       GetSQLValueString($_GET['email'], "text"),
                       GetSQLValueString(date("Y-m-d H:i:s"),"date"),
 					   GetSQLValueString($_GET['ip'], "text"),
                      GetSQLValueString($_GET['GUID'], "text")
					   );

		$orders->exec($updateSQL);
		die ("EX".$sn);
		//die ($sn."@".$row_RecordsetCFG['username']."@".$row_RecordsetCFG['password']);
	}
	//echo "is_exist: ".$is_exist."</h>";
	if (!$is_exist) {
		$sn=md5(microtime());
		$insertSQL = sprintf("INSERT INTO users (sn,GUID,deviceToken,username,password,CreateDate,last_operation,ver,ip,Lang,email) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
		GetSQLValueString($sn,"text"),
		GetSQLValueString($_GET['GUID'], "text"),
		GetSQLValueString($deviceToken, "text"),
		GetSQLValueString($_GET['username'], "text"),
		GetSQLValueString($_GET['password'], "text"),
		GetSQLValueString(date("Y-m-d H:i:s"),"date"),
		"'smart-add'",
		"1",
		GetSQLValueString($_GET['ip'], "text"),
		GetSQLValueString($_GET['Lang'], "text"),
		GetSQLValueString($_GET['email'], "text")
	);
	$orders->query($insertSQL);
	$insertok="[添加".$_POST['username']."成功]  ";
	}
	die ($sn);

	//if ($_REQUEST["return"]!="true") die($_REQUEST["return"]);
}


    $rcon_a=1000;
	if (isset($_GET['class1'])) $class1=$_GET['class1'];else $class1='';
	if (isset($_GET['groupname'])) $groupname=$_GET['groupname'];else $groupname='';
  	if (isset($_GET['Factorymain'])) $Factorymain=$_GET['Factorymain'];else $Factorymain='';
  	if (isset($_GET['class2'])) $class2=$_GET['class2'];else $class2='';
  	if (isset($_POST['searchcontent2'])) $searchcontent2=$_POST['searchcontent2'];else $searchcontent2='';
  	if (isset($_GET['searchcontent2'])) $searchcontent3=$_GET['searchcontent2'];else $searchcontent3='';
	if (empty($searchcontent2)) $searchcontent2=$searchcontent3;
  	if (isset($_GET['showtype'])) $showtype=$_GET['showtype'];else $showtype='';
  	if (isset($_GET['obj_id'])) $obj_id=$_GET['obj_id'];else $obj_id='';
  	if (isset($_POST['one_page_no_customer'])) $one_page_no_customer=$_POST['one_page_no_customer'];else $one_page_no_customer='';
  	if (isset($_GET['offset_a'])) $offset_a=$_GET['offset_a'];else $offset_a='';
	if ($_POST["MM_insert"] == "add") $offset_a='';

$sql_select="select count(*) as total from users";
	foreach ($orders->query($sql_select) as $arrayTotal)
	{
		$rcon_a= $arrayTotal[total];
	}
	$one_page_no_a=200;    //每页显示记录数
   $form_number_limit_a=1; //obj number
   $pages_a=ceil($rcon_a/$one_page_no_a); //$pages_a变量现在总的页数  
   if (empty($offset_a))  {
       $offset_a=1;  
       $curline = 0;
    } else
      $curline = ($offset_a - 1) * $one_page_no_a;
 if ($ln=="spa") {$back="Anterior";$more="Siguiente";}
    else if (empty($ln) or $ln=="chn")  {$back="前页";$more="下页";}
	else if ($ln=="eng")  {$back="Back";$more="More";}
	else if ($ln=="prt")  {$back="";$more="";}


$query_Recordset1 = "";//SELECT * FROM ddns ";

 

	switch ($_REQUEST["type"]){
		case 'write':
			$write_log="INSERT INTO analytics ([ddns],[OrderDate],[times],[ip]) VALUES (". $_REQUEST["ddns"].",'".date("Y-m-d H:i:s")."','".$_GET['sql']."',". $from_ip.")";
			$orders->query($write_log);
			//echo $write_log."<br>";
			if ($_REQUEST["return"]=="true") die($cid."");
			break;
		case 'check':
			if (isset($_REQUEST["id"])&&!empty($_REQUEST["id"]))$query_Recordset1 = $query_Recordset1 . " where Description1 like '%".$_REQUEST["id"]."%' or name like '%".$_REQUEST["id"]."%' ";
			break;
		default:
			//die ();
			break;
}

if (($_REQUEST['order']) == "username") { 	$query_Recordset1 = $query_Recordset1 . " order by  deviceToken";}
else if (($_REQUEST['order']) == "LastUpdateTime") { 	$query_Recordset1 = $query_Recordset1 . " order by  remark2 desc";}
else if (($_REQUEST['order']) == "LastAccessTime") { 	$query_Recordset1 = $query_Recordset1 . " order by  LastAccessTime desc";}
else	{ $query_Recordset1 = $query_Recordset1 . " order by ID desc";}


$query_Recordset1 = $query_Recordset1 ." LIMIT $curline,$one_page_no_a";
//echo $query_Recordset1;

$sql_select = "select count(*) as total from users". $query_Recordset1;
	foreach ($orders->query($sql_select) as $arrayTotal)
	{
		$rcon_a= $arrayTotal[total];
	}
 $query_Recordset1 = "SELECT * FROM users ". $query_Recordset1;


?><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>admin</title>
<link href="../../css/Level3_1.css" rel="stylesheet" type="text/css" />
</head>
<?php 
if (isset($_REQUEST['useraut'])) $user=md5($_REQUEST['useraut']);else $user=$_REQUEST['user1'];
//echo '$_REQUEST[user] : '.$_REQUEST['user'];
//echo '<hr>$_REQUEST[user1] : '.$_REQUEST['user1'];
echo '<hr>'.$user;
if (!$user<>"1558417b096b5d8e7cbe0183ea9cbf26") die ("
<form name='form1' method='post' action=''>
  <label>admin clave
  <input name='useraut' type='password' id='useraut' value=''>
  </label>
  <label>
  <input type='submit' name='Submit' value='Login'>
  </label>
</form>");
?>



<div align="center">
	<p>查找结果 &nbsp;<?php echo $rcon_a; ?>  　　v2015.5 <a href="#buttom">[页尾]</a> <a href="config.php">[配置文件]</a><a href="push.php">[推送消息]</a><br />
		
		<input name="user1" type="hidden" id="type" value="<?php echo $user; ?>" />
		<input name="type" type="hidden" id="type" value="check" />
		<input name="id" type="text" id="id"  style="background-color:<?php if ($ir==0) echo "#EAF2D3"; else echo "#DCDCDC"; ?>; border:1px solid #0066FF;" value="<?php echo $_REQUEST["id"]; ?>" />
		<input type="submit" value="查询" />
		<input type="button" name="sub2mit" id="sub2mit" value="点货"  onclick="document.formXXX.id.value='点货版';" />
		<?php 
   $heard_001="searchcontent2=$searchcontent2&class1=$class1&class2=$class2&groupname=$groupname&one_page_no_customer=$one_page_no_customer&user1=".$user;
  $Input_Start="<input type=\"button\" ";
   $Input_MoreLast=" style=\"BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; COLOR: #000000; BORDER-BOTTOM: 1px solid; BACKGROUND-COLOR: #f3f3f3\"  onMouseOut=\"this.style.backgroundColor='#f3f3f3'\" onMouseOver=\"this.style.backgroundColor='#FFC864'\" />";
   $Input_Normal=" style=\"width:22px;BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; COLOR: #000000; BORDER-BOTTOM: 1px solid; BACKGROUND-COLOR: #f3f3f3\"  onMouseOut=\"this.style.backgroundColor='#f3f3f3'\" onMouseOver=\"this.style.backgroundColor='#FFC864'\" />";
   $Input_Cur=" style=\"width:22px;BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; COLOR: #000000; BORDER-BOTTOM: 1px solid; BACKGROUND-COLOR: #FFC864\" />";
 
  if ($offset_a <> 1) { //如果偏移量是0，不显示前一页的链接  
     $newoffset_a=$offset_a - 1;  
     //print "<a href=?offset_a=$newoffset_a&$heard_001>&lt;-$back</a>";  
	 print $Input_Start."onClick=\"document.formXXX.action='?offset_a=$newoffset_a&$heard_001';javascript:formXXX.submit();\" value=\"&lt;-$back\" ".$Input_MoreLast;
   }  else {
     //print '&lt;-'.$back.'';
   }
     print "   ";
  //显示所有的页数  
 //for ($i=1; $i <= $pages_a; $i++)  {
	 if ($pages_a<16) {
		 
			  for ($i=1; $i <= $pages_a; $i++)  {
				if ($i==$offset_a) print $Input_Start."value=\"".$i."\" ".$Input_Cur;
				else  print $Input_Start."onClick=\"document.formXXX.action='?offset_a=$i&$heard_001';javascript:formXXX.submit();\" value=\"$i\" ".$Input_Normal;
				print "   ";
			  }  
  	 }else{
		 if ($offset_a-5>0) {$i=$offset_a-5;}else{ $i=1;}
		  for ($i; $i <= $offset_a+5; $i++)  {
			if ($i==$offset_a) print $Input_Start."value=\"".$i."\" ".$Input_Cur;
			else  print $Input_Start."onClick=\"document.formXXX.action='?offset_a=$i&$heard_001';javascript:formXXX.submit();\" value=\"$i\" ".$Input_Normal;
			print "   ";
		  }  
  
	}
  //检查是否是最后一页  
  if ($pages_a!=0 && $offset_a!=$pages_a)  {
     $newoffset_a=$offset_a+1;  
     //print "<a href=?offset_a=$newoffset_a&$heard_001>$more-&gt;</a>";  
	 print $Input_Start."onClick=\"document.formXXX.action='?offset_a=$newoffset_a&$heard_001';javascript:formXXX.submit();\" value=\"$more-&gt;\" ".$Input_MoreLast;
  }  else 	 
  print $Input_Start."onClick=\"javascript:formXXX.submit();\" value=\"末页\" ".$Input_MoreLast;

						?>
		<?php  echo $insertok. "  ".$query_Recordset1;
?></p>
	<p><br />
	</p>
</div>
<table  id="customers2"    width="843" height="100" border="1" align="center" cellpadding="1" cellspacing="0"  >
 <?php 
  foreach ($orders->query($query_Recordset1) as $row_Recordset1)
 { ?>
    <form action="<?php echo $editFormAction; ?><?php echo '#linkB'.$row_Recordset1['username'];?>" method="POST" name="edit" id="edit">
      <tr id="detalis"
        <?php if ($ir==1) {echo ' class="alt" ';$ir=0;}else $ir=1; ?>>
        <td> <div align="center"> <a name="<?php echo 'link'.$row_Recordset1['username'];?>" id="<?php echo 'link'.$row_Recordset1['username'];?>"><?php echo $row_Recordset1['ID']; ?>
          <input name="user1" type="hidden" id="user1" value="<?php echo $user; ?>" />
        </a>
            <input name="find" type="hidden" id="find" value="<?php echo $_REQUEST["find"]; ?>" />
          <input name="ID" type="hidden" id="ID" value="<?php echo $row_Recordset1['ID']; ?>" />
        </div></td>
        <td colspan="7"><table width="100%" border="0" cellpadding="1">
          <tr>
            <td width="19%">deviceToken</td>
            <td width="81%"><input name="deviceToken" type="text" id="deviceToken"  style="background-color:<?php if ($ir==0) echo "#EAF2D3"; else echo "#DCDCDC"; ?>; border:1px solid #0066FF;"  value="<?php echo $row_Recordset1['deviceToken']; ?>" size="40" /></td>
          </tr>
          <tr>
            <td>编号</td>
            <td><input name="sn" type="text" id="sn" style="background-color:<?php if ($ir==0) echo "#EAF2D3"; else echo "#DCDCDC"; ?>; border:1px solid #0066FF;" value="<?php echo $row_Recordset1['sn'];?>" size="40" />
            	*</td>
          </tr>
          <tr>
            <td> GUID</td>
            <td><input name="GUID" type="text" id="GUID" style="background-color:<?php if ($ir==0) echo "#EAF2D3"; else echo "#DCDCDC"; ?>; border:1px solid #0066FF;" value="<?php echo $row_Recordset1['GUID'];?>" size="40" />
            	*</td>
          </tr>
          <tr>
          	<td> Email</td>
          	<td>
          		<input name="email" type="text" id="email" style="background-color:<?php if ($ir==0) echo "#EAF2D3"; else echo "#DCDCDC"; ?>; border:1px solid #0066FF;" value="<?php echo $row_Recordset1['email'];?>" size="40" />
          		</td>
          	</tr>
          <tr>
          	<td>用户名</td>
          	<td><input name="username" type="text" id="username" style="background-color:<?php if ($ir==0) echo "#EAF2D3"; else echo "#DCDCDC"; ?>; border:1px solid #0066FF;" value="<?php echo $row_Recordset1['username'];?>" size="40" />
          		*</td>
          	</tr>
          <tr>
            <td>密码</td>
            <td><input name="password" type="password" id="password" style="background-color:<?php if ($ir==0) echo "#EAF2D3"; else echo "#DCDCDC"; ?>; border:1px solid #0066FF;" value="<?php echo $row_Recordset1['password'];?>" size="40" />
            	*</td>
          </tr>
          <tr>
            <td>建立日期</td>
            <td><input name="CreateDate" type="text" style="background-color:<?php if ($ir==0) echo "#EAF2D3"; else echo "#DCDCDC"; ?>; border:1px solid #0066FF;" id="CreateDate" value="<?php echo $row_Recordset1['CreateDate'];?>" size="40" /></td>
          </tr>
          <tr>
          	<td>语言</td>
          	<td><input name="Lang" type="text" style="background-color:<?php if ($ir==0) echo "#EAF2D3"; else echo "#DCDCDC"; ?>; border:1px solid #0066FF;" id="Lang" value="<?php echo $row_Recordset1['Lang'];?>" size="40" /></td>
          	</tr>
          <tr>
          	<td>最后修改日期</td>
          	<td><?php echo $row_Recordset1['last_operation']; ?>&nbsp;</td>
          	</tr>
          <tr>
          	<td>ver</td>
          	<td><?php echo $row_Recordset1['ver']; ?></td>
          	</tr>
          <tr>
          	<td>ip</td>
          	<td><?php echo $row_Recordset1['ip']; ?></td>
          	</tr>
        </table>
        </td>
        <td >
        	<p>
        		<input name="checkboxdel" type="checkbox" id="checkboxdel" value="on" />
        		<label for="checkbox">删除</label>
        	</p>
        	<p>
        		<input type="submit" name="Submit" value="EDIT" />
        		</p>
        	<p>
        		<input name="checkboxallpush" type="checkbox" id="checkboxallpush" value="on" />
        		ALL
        		<br />
        		<label for="message"></label>
        		<textarea name="message" id="message" cols="40" rows="10"></textarea>
        		<br />
        		<input type="submit" name="button" id="button" value="推送" />
        		</p>
        </td>
      </tr>
       <input type="hidden" name="MM_update" value="edit">
    </form>
    <?php } $row_Recordset1=''; ?>
    
    
  <form action="<?php echo $editFormAction; ?>" method="POST" name="add" id="add">

    <tr id="detalis" hidden="true"
        <?php if ($ir==1) {echo ' class="alt" ';$ir=0;}else $ir=1; ?>>
      <td width="11%"><div align="center">new
      	<input name="user1" type="hidden" id="user1" value="<?php echo $user;?>"  />
      </div></td>
      <td colspan="7">
      	<table width="100%" border="0" cellpadding="1">
      		<tr>
      			<td width="19%">deviceToken</td>
      			<td width="81%">
      				<input name="deviceToken" type="text" id="deviceToken"  style="background-color:<?php if ($ir==0) echo "#EAF2D3"; else echo "#DCDCDC"; ?>; border:1px solid #0066FF;"  value="<?php echo $row_Recordset1['deviceToken']; ?>" size="40" />
      			</td>
      			</tr>
      		<tr>
      			<td>编号</td>
      			<td>
      				<input name="sn" type="text" id="sn" style="background-color:<?php if ($ir==0) echo "#EAF2D3"; else echo "#DCDCDC"; ?>; border:1px solid #0066FF;" value="<?php echo md5(microtime());?>" size="40" />
      				*      				</td>
      			</tr>
      		<tr>
      			<td> GUID</td>
      			<td>
      				<input name="GUID" type="text" id="GUID" style="background-color:<?php if ($ir==0) echo "#EAF2D3"; else echo "#DCDCDC"; ?>; border:1px solid #0066FF;" value="<?php echo $row_Recordset1['GUID'];?>" size="40" />
      				*      				</td>
      			</tr>
      		<tr>
      			<td> Email</td>
      			<td>
      				<input name="email" type="text" id="email" style="background-color:<?php if ($ir==0) echo "#EAF2D3"; else echo "#DCDCDC"; ?>; border:1px solid #0066FF;" value="<?php echo $row_Recordset1['email'];?>" size="40" />
      				</td>
      			</tr>
      		<tr>
      			<td>用户名</td>
      			<td>
      				<input name="username" type="text" id="username" style="background-color:<?php if ($ir==0) echo "#EAF2D3"; else echo "#DCDCDC"; ?>; border:1px solid #0066FF;" value="<?php echo $row_Recordset1['username'];?>" size="40" />
      				*      				</td>
      			</tr>
      		<tr>
      			<td>密码</td>
      			<td>
      				<input name="password" type="password" id="password" style="background-color:<?php if ($ir==0) echo "#EAF2D3"; else echo "#DCDCDC"; ?>; border:1px solid #0066FF;" value="<?php echo $row_Recordset1['password'];?>" size="40" />
      				*      				</td>
      			</tr>
      		<tr>
      			<td>建立日期</td>
      			<td>
      				<input name="CreateDate" type="text" style="background-color:<?php if ($ir==0) echo "#EAF2D3"; else echo "#DCDCDC"; ?>; border:1px solid #0066FF;" id="CreateDate" value="<?php echo date("Y-m-d H:i:s");?>" size="40" />
      				</td>
      			</tr>
      		<tr>
      			<td>语言</td>
      			<td>
      				<input name="Lang" type="text" style="background-color:<?php if ($ir==0) echo "#EAF2D3"; else echo "#DCDCDC"; ?>; border:1px solid #0066FF;" id="Lang" value="<?php echo $row_Recordset1['Lang'];?>" size="40" />
      				</td>
      			</tr>
      		</table>
      </td>
      <td width="38%" ><input type="submit" name="Submit" value="ADD" /></td>
    </tr>
    <input type="hidden" name="MM_insert" value="add">
  </form>
</table>
<a name="buttom"> &nbsp</a>




</form>
< 
<?php echo $user;
?></html>