预览模式: 普通 | 列表

联想y470装XP蓝屏的解决办法

是模式没设置好。开机进入bios,找到Advanced 这个选项,然后选择Sata mode selection 改成IDE,然后保存退出。就可以开始安装了,不能说不支持,只是比较好的支持W7,XP很多支持没了,但还是可以找到的,你上网找下了!

分类:业界文摘 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 6332

原因:激活了小键盘,处理方法如下
      在你的笔记本键盘上找到Fn这个键 颜色应该与其他正常按键颜色不同
    这个Fn键就是激活小键盘的功能键,应该有一个灯是表示你的小键盘打开或者关闭的
    以我的笔记本为例,我的笔记本小键盘的字体颜色都是蓝色,Fn键位于左下方Ctrl键的左边。
    请找到跟小键盘颜色一样的标有Num LK的按键(小键盘的开关),我的这个键在F11的上方
按住Fn同时按住Num LK,这样就激活了小键盘,指示灯亮起,(同样操作也可以关闭小键盘)。
     这时候就可以按着Fn建同时按数字小键盘来使用了。
     我这个只是其中最常用的一种,根据网上的信息,我总结了常见的各种笔记本小键盘(数字键盘)切换快捷键:
     1.Fn+Num LK
         2.Fn+insert
         3.Fn +F11
         4.Num LK
        你自己琢磨一下,再试试自己的键盘。

分类:业界文摘 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 8857

ASP下常用正则表达式及字符串验证方法

'常用正则表达式模式
const z_Pat1="^\w+" '匹配有字母,数字,下滑线组成的字符串
const z_PatSW="^[\x00-\xff]+" '匹配所有单字节长度的字符组成的字符串
const z_PatDW="^[^\x00-\xff]+" '匹配所有双字节长度的字符组成的字符串
const z_PatDW2="[^\x00-\xff]+" '字符串是否含有双字节字
const z_PatFileName1="^((\w+)(\.{1})(\w+))" '验证一个文件名,他是由字母,数字,下滑线组成
const z_PatDate1="^19\d{2}-((0[1-9])|(1[0-2]))-((0[1-9])|([1-2][0-9])|(3([0|1])))" '匹配日期(1900-1999)
const z_PatDate2="^20\d{2}-((0[1-9])|(1[0-2]))-((0[1-9])|([1-2][0-9])|(3([0|1])))" '匹配日期(2000-2999)
const z_PatternDateTime="^(1|2\d{3}-((0[1-9])|(1[0-2]))-((0[1-9])|([1-2][0-9])|(3([0|1]))))( (\d{2}):(\d{2}):(\d{2}))?" '匹配日期时间

const z_PatInt="^\d+" '验证整数数字
const z_PatNum="^\d+(\.{1}\d+)?" '数字


'验证指定的字符串是否符合指定的模式
'利用正则表达式
function CheckPattern(str,pat)
set r=new regexp
r.Pattern=pat
r.IgnoreCase=false
r.Global=false
if r.Test(str) then
CheckPattern=true
else
CheckPattern=false
end if
end function

Tags: asp 正则表达式

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 3304

asp数组的使用

定义一个简单的数组

有两种方法在asp中定义数组,让我们看看每种的例子:

方法一:
MyArray = Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct", "Nov","Dec")

方法二:
Dim myArray(2)

查看更多...

Tags: asp

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 2471

php获得网站根目录

function GetRootPath()
{
$sRealPath = realpath( './' ) ;
$sSelfPath = $_SERVER['PHP_SELF'] ;
$sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ) ) ;
return substr( $sRealPath, 0, strlen( $sRealPath ) - strlen( $sSelfPath ) ) ;
}

Tags: php

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 5643

php使用smtp方式发邮件

PHP代码
  1. <?php  
  2. class smtp  
  3. {  
  4. var $smtp_port;  
  5. var $time_out;  
  6. var $host_name;  
  7. var $log_file;  
  8. var $relay_host;  
  9. var $debug;  
  10. var $auth;  
  11. var $user;  
  12. var $pass;  
  13. var $sock;  
  14. function smtp($relay_host = ""$smtp_port = 25,$auth = false,$user,$pass)  
  15. {  
  16. $this->debug = true;  
  17. $this->smtp_port = $smtp_port;  
  18. $this->relay_host = $relay_host;  
  19. $this->time_out = 30;  
  20. $this->auth = $auth;  
  21. $this->user = $user;  
  22. $this->pass = $pass;  
  23. $this->host_name = "localhost";  
  24. $this->log_file ="";  
  25. $this->sock = FALSE;  
  26. }  
  27. function sendmail($to$from$subject = ""$body = ""$mailtype$cc = ""$bcc = ""$additional_headers = "")  
  28. {  
  29. $mail_from = $this->get_address($this->strip_comment($from));  
  30. $body = ereg_replace("(^|(\r\n))(\\.)""\\1.\\3"$body);  
  31. $header .= "MIME-Version:1.0\r\n";  
  32. if($mailtype=="HTML")  
  33. {  
  34. $header .= "Content-Type:text/html\r\n";  
  35. }  
  36.  $header .= "To: ".$to."\r\n";  
  37. if ($cc != "")  
  38. {  
  39. $header .= "Cc: ".$cc."\r\n";  
  40. }  
  41. $header .= "From: $from<".$from.">\r\n";  
  42. $header .= "Subject: ".$subject."\r\n";  
  43. $header .= $additional_headers;  
  44. $header .= "Date: ".date("r")."\r\n";  
  45. $header .= "X-Mailer:By Redhat (PHP/".phpversion().")\r\n";  
  46. list($msec$sec) = explode(" ", microtime());  
  47. $header .= "Message-ID: <".date("YmdHis"$sec).".".($msec*1000000).".".$mail_from.">\r\n";  
  48. $TO = explode(","$this->strip_comment($to));  
  49.    
  50. if ($cc != "") {  
  51. $TO = array_merge($TOexplode(","$this->strip_comment($cc)));  
  52. }  
  53. if ($bcc != "") {  
  54. $TO = array_merge($TOexplode(","$this->strip_comment($bcc)));  
  55. }  
  56.   
  57.    
  58. $sent = TRUE;  
  59. foreach ($TO as $rcpt_to) {  
  60. $rcpt_to = $this->get_address($rcpt_to);  
  61. if (!$this->smtp_sockopen($rcpt_to)) {  
  62. $this->log_write("Error: Cannot send email to ".$rcpt_to."\n");  
  63. $sent = FALSE;  
  64. continue;  
  65. }  
  66. if ($this->smtp_send($this->host_name, $mail_from$rcpt_to$header$body)) {  
  67. $this->log_write("E-mail has been sent to <".$rcpt_to.">\n");  
  68. else {  
  69. $this->log_write("Error: Cannot send email to <".$rcpt_to.">\n");  
  70. $sent = FALSE;  
  71. }  
  72. fclose($this->sock);  
  73. $this->log_write("Disconnected from remote host\n");  
  74. }  
  75. //echo "<br>";  
  76. //echo $header;  
  77. return $sent;  
  78. }  
  79.    
  80. /* Private Functions */  
  81.    
  82. function smtp_send($helo$from$to$header$body = "")  
  83. {  
  84. if (!$this->smtp_putcmd("HELO"$helo)) {  
  85. return $this->smtp_error("sending HELO command");  
  86. }  
  87. #auth  
  88. if($this->auth){  
  89. if (!$this->smtp_putcmd("AUTH LOGIN"base64_encode($this->user))) {  
  90. return $this->smtp_error("sending HELO command");  
  91. }  
  92.    
  93. if (!$this->smtp_putcmd(""base64_encode($this->pass))) {  
  94. return $this->smtp_error("sending HELO command");  
  95. }  
  96. }  
  97. if (!$this->smtp_putcmd("MAIL""FROM:<".$from.">")) {  
  98. return $this->smtp_error("sending MAIL FROM command");  
  99. }  
  100.    
  101. if (!$this->smtp_putcmd("RCPT""TO:<".$to.">")) {  
  102. return $this->smtp_error("sending RCPT TO command");  
  103. }  
  104.    
  105. if (!$this->smtp_putcmd("DATA")) {  
  106. return $this->smtp_error("sending DATA command");  
  107. }  
  108.    
  109. if (!$this->smtp_message($header$body)) {  
  110. return $this->smtp_error("sending message");  
  111. }  
  112.    
  113. if (!$this->smtp_eom()) {  
  114. return $this->smtp_error("sending <CR><LF>.<CR><LF> [EOM]");  
  115. }  
  116.    
  117. if (!$this->smtp_putcmd("QUIT")) {  
  118. return $this->smtp_error("sending QUIT command");  
  119. }  
  120.    
  121. return TRUE;  
  122. }  
  123.    
  124. function smtp_sockopen($address)  
  125. {  
  126. if ($this->relay_host == "") {  
  127. return $this->smtp_sockopen_mx($address);  
  128. else {  
  129. return $this->smtp_sockopen_relay();  
  130. }  
  131. }  
  132.   
  133.    
  134. function smtp_sockopen_relay()  
  135. {  
  136. $this->log_write("Trying to ".$this->relay_host.":".$this->smtp_port."\n");  
  137. $this->sock = @fsockopen($this->relay_host, $this->smtp_port, $errno$errstr$this->time_out);  
  138. if (!($this->sock && $this->smtp_ok())) {  
  139. $this->log_write("Error: Cannot connenct to relay host ".$this->relay_host."\n");  
  140. $this->log_write("Error: ".$errstr." (".$errno.")\n");  
  141. return FALSE;  
  142. }  
  143. $this->log_write("Connected to relay host ".$this->relay_host."\n");  
  144. return TRUE;;  
  145. }  
  146.   
  147.    
  148. function smtp_sockopen_mx($address)  
  149. {  
  150. $domain = ereg_replace("^.+@([^@]+)$""\\1"$address);  
  151. if (!@getmxrr($domain$MXHOSTS)) {  
  152. $this->log_write("Error: Cannot resolve MX \"".$domain."\"\n");  
  153. return FALSE;  
  154. }  
  155. foreach ($MXHOSTS as $host) {  
  156. $this->log_write("Trying to ".$host.":".$this->smtp_port."\n");  
  157. $this->sock = @fsockopen($host$this->smtp_port, $errno$errstr$this->time_out);  
  158. if (!($this->sock && $this->smtp_ok())) {  
  159. $this->log_write("Warning: Cannot connect to mx host ".$host."\n");  
  160. $this->log_write("Error: ".$errstr." (".$errno.")\n");  
  161. continue;  
  162. }  
  163. $this->log_write("Connected to mx host ".$host."\n");  
  164. return TRUE;  
  165. }  
  166. $this->log_write("Error: Cannot connect to any mx hosts (".implode(", "$MXHOSTS).")\n");  
  167. return FALSE;  
  168. }  
  169.    
  170. function smtp_message($header$body)  
  171. {  
  172. fputs($this->sock, $header."\r\n".$body);  
  173. $this->smtp_debug("> ".str_replace("\r\n""\n"."> "$header."\n> ".$body."\n> "));  
  174.    
  175. return TRUE;  
  176. }  
  177.    
  178. function smtp_eom()  
  179. {  
  180. fputs($this->sock, "\r\n.\r\n");  
  181. $this->smtp_debug(". [EOM]\n");  
  182.    
  183. return $this->smtp_ok();  
  184. }  
  185.    
  186. function smtp_ok()  
  187. {  
  188. $response = str_replace("\r\n"""fgets($this->sock, 512));  
  189. $this->smtp_debug($response."\n");  
  190.    
  191. if (!ereg("^[23]"$response)) {  
  192. fputs($this->sock, "QUIT\r\n");  
  193. fgets($this->sock, 512);  
  194. $this->log_write("Error: Remote host returned \"".$response."\"\n");  
  195. return FALSE;  
  196. }  
  197. return TRUE;  
  198. }  
  199.    
  200. function smtp_putcmd($cmd$arg = "")  
  201. {  
  202. if ($arg != "") {  
  203. if($cmd==""$cmd = $arg;  
  204. else $cmd = $cmd." ".$arg;  
  205. }  
  206.   
  207.    
  208. fputs($this->sock, $cmd."\r\n");  
  209. $this->smtp_debug("> ".$cmd."\n");  
  210.    
  211. return $this->smtp_ok();  
  212. }  
  213.    
  214. function smtp_error($string)  
  215. {  
  216. $this->log_write("Error: Error occurred while ".$string.".\n");  
  217. return FALSE;  
  218. }  
  219.    
  220. function log_write($message)  
  221. {  
  222. $this->smtp_debug($message);  
  223.    
  224. if ($this->log_file == "") {  
  225. return TRUE;  
  226. }  
  227.    
  228. $message = date("M d H:i:s ").get_current_user()."[".getmypid()."]: ".$message;  
  229. if (!@file_exists($this->log_file) || !($fp = @fopen($this->log_file, "a"))) {  
  230. $this->smtp_debug("Warning: Cannot open log file \"".$this->log_file."\"\n");  
  231. return FALSE;  
  232. }  
  233. flock($fp, LOCK_EX);  
  234. fputs($fp$message);  
  235. fclose($fp);  
  236.    
  237. return TRUE;  
  238. }  
  239.    
  240. function strip_comment($address)  
  241. {  
  242. $comment = "\\([^()]*\\)";  
  243. while (ereg($comment$address)) {  
  244. $address = ereg_replace($comment""$address);  
  245. }  
  246.    
  247. return $address;  
  248. }  
  249.    
  250. function get_address($address)  
  251. {  
  252. $address = ereg_replace("([ \t\r\n])+"""$address);  
  253. $address = ereg_replace("^.*<(.+)>.*$""\\1"$address);  
  254.    
  255. return $address;  
  256. }  
  257.    
  258. function smtp_debug($message)  
  259. {  
  260. if ($this->debug) {  
  261. echo $message."<br>";  
  262. }  
  263. }  
  264.    
  265. function get_attach_type($image_tag) { //  
  266.    
  267. $filedata = array();  
  268.    
  269. $img_file_con=fopen($image_tag,"r");  
  270. unset($image_data);  
  271. while ($tem_buffer=AddSlashes(fread($img_file_con,filesize($image_tag))))  
  272. $image_data.=$tem_buffer;  
  273. fclose($img_file_con);  
  274.    
  275. $filedata['context'] = $image_data;  
  276. $filedata['filename']= basename($image_tag);  
  277. $extension=substr($image_tag,strrpos($image_tag,"."),strlen($image_tag)-strrpos($image_tag,"."));  
  278. switch($extension){  
  279. case ".gif":  
  280. $filedata['type'] = "image/gif";  
  281. break;  
  282. case ".gz":  
  283. $filedata['type'] = "application/x-gzip";  
  284. break;  
  285. case ".htm":  
  286. $filedata['type'] = "text/html";  
  287. break;  
  288. case ".html":  
  289. $filedata['type'] = "text/html";  
  290. break;  
  291. case ".jpg":  
  292. $filedata['type'] = "image/jpeg";  
  293. break;  
  294. case ".tar":  
  295. $filedata['type'] = "application/x-tar";  
  296. break;  
  297. case ".txt":  
  298. $filedata['type'] = "text/plain";  
  299. break;  
  300. case ".zip":  
  301. $filedata['type'] = "application/zip";  
  302. break;  
  303. default:  
  304. $filedata['type'] = "application/octet-stream";  
  305. break;  
  306. }  
  307.    
  308.    
  309. return $filedata;  
  310. }  
  311.  }  
  312. $smtpserver = "smtp.qq.com";//SMTP服务器  
  313. $smtpserverport =25;//SMTP服务器端口  
  314. $smtpusermail = "";//SMTP服务器的用户邮箱  
  315. $smtpemailto = "";//发送给谁  
  316. $smtpuser = "";//SMTP服务器的用户帐号  
  317. $smtppass = "";//SMTP服务器的用户密码  
  318. $mailsubject = "";//邮件主题  
  319. $mailbody = '';//邮件内容  
  320. $mailtype = "HTML";//邮件格式(HTML/TXT),TXT为文本邮件  
  321. $smtp = new smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass);  
  322. $smtp->debug = false;//是否显示发送的调试信息  
  323. $smtp->sendmail($smtpemailto$smtpusermail$mailsubject$mailbody$mailtype);  
  324. if($smtp==true){  
  325. echo '发送成功!';  
  326. }  
  327. else{  
  328. echo '发送失败!';  
  329. }  
  330. ?>  

Tags: php

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 2808

PHP正则验证表单类

纯英文
if(preg_match("/^[a-zA-Z]+$/",$str))
                   {
                     return true;
                   }else{
                     return false;
                   }
英文数字
if(preg_match("/^[a-zA-Z0-9]+$/",$str))
                   {
                     return true;
                   }else{
                     return false;
                   }
所有允许的字符
if(preg_match("/^[\|\-\_a-zA-Z0-9]+$/",$str))
                   {
                     return true;
                   }else{
                     return false;
                   }
字符长度2-10之间
if(strlen($str)>=2 && strlen($str)<=10)
       {
         return true;
       }else{
         return false;
       }

验证email地址
 if(preg_match("/^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.){1,2}[a-z]{2,4}$/i",$str))
       {
         return true;
       }else{
         return false;
       }
验证china身份证
 if(preg_match("/^([0-9]{15}|[0-9]{17}[0-9a-z])$/i",$str))
       {
         return true;
       }else{
         return false;
       }
验证国内电话号码
if(preg_match("/^([0-9]{3}|0[0-9]{3})-[0-9]{7,8}$/",$str))
            {
                   return true;
            }else{
                   return false;
            }
验证电话号码
 if(preg_match("/^[0-9]{4}-([0-9]{3}|0[0-9]{3})-[0-9]{7,8}$/",$str))
            {
                   return true;
            }else{
                   return false;
            }

Tags: php

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 3401

 广告位

↑返回顶部↑