Firefox怎么打开mht文件 <a href='help.mht' target="_blank" >打开</a>在ie中能打开,但在Firefox中就不行了。请问在Firefox怎么打开 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://baike.baidu.com/view/162995.htm看这里 安装 MAF 扩展 有个扩展叫UnMHT,可以让firefox支持mht的浏览参考:http://hi.baidu.com/asnahu/blog/item/e30ba78fd16b76f3513d92fd.html 1.<?php @header("content-type:text/html; charset=UTF-8"); 2. 3. //开启session 4. 5. session_start(); 6. 7. //得到用户输入的验证码,并转换成大写 8. 9. $imgId_req = $_REQUEST['imgId']; 10. 11. $imgId_req = strtoupper($imgId_req); 12. 13. //验证该字符串是否注册了session变量 14. 15. if (session_is_registered($imgId_req)) { 16. 17. echo "<font color=blue >通过验证!</font>"; 18. 19. } else { 20. 21. echo "<font color=red >验证错误!</font>"; 22. 23. } 24. 25. //关闭session,以清除所有注册过的变量 26. 27. session_destroy(); 28. 29.?> 1.<?php 2.header("Pragma: no-cache"); 3.header("Cache-Control: max-age=1, s-maxage=1, no-cache, must-revalidate"); 4.session_start(); 5.unset ($_SESSION['validate']); 6. 7.$strnum = 8; //产生密码的位数 8.$str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; //显示的字符范围 9. 10.$font_file = 'Fregne Myriad v2.ttf';//指定字体文件 11. 12.$disturbpiont = true; //是否显示干扰素 13.$disturbpiontnum = 600; //干扰素的点的数目 14.$disturbline = true; //是否有干扰条 15.$disturblinenum = 8; //干扰条的数目 16. 17.$l = strlen($str); 18. 19.$randStr = array (); 20.$validate; 21.for ($i = 0; $i < $strnum; ++ $i) { 22. $randStr[$i] = $str[rand(0, $l)]; 23.} 24. 25.for ($i = 0; $i < $strnum; ++ $i) { 26. if ($randStr[$i] == '') 27. $randStr[$i] = '*'; 28. $validate = $validate . $randStr[$i]; 29.} 30. 31. 32.function RgbToHsv($R, $G, $B) { 33. $tmp = min($R, $G); 34. $min = min($tmp, $B); 35. $tmp = max($R, $G); 36. $max = max($tmp, $B); 37. $V = $max; 38. $delta = $max - $min; 39. 40. if ($max != 0) 41. $S = $delta / $max; // s 42. else { 43. $S = 0; 44. return; 45. } 46. if ($R == $max) 47. $H = ($G - $B) / $delta; // between yellow & magenta 48. else 49. if ($G == $max) 50. $H = 2 + ($B - $R) / $delta; // between cyan & yellow 51. else 52. $H = 4 + ($R - $G) / $delta; // between magenta & cyan 53. 54. $H *= 60; // degrees 55. if ($H < 0) 56. $H += 360; 57. return array ( 58. $H, 59. $S, 60. $V 61. ); 62.} 63. 64.function HsvToRgb($H, $S, $V) { 65. if ($S == 0) { 66. // achromatic (grey) 67. $R = $G = $B = $V; 68. return; 69. } 70. 71. $H /= 60; // sector 0 to 5 72. $i = floor($H); 73. $f = $H - $i; // factorial part of h 74. $p = $V * (1 - $S); 75. $q = $V * (1 - $S * $f); 76. $t = $V * (1 - $S * (1 - $f)); 77. 78. switch ($i) { 79. case 0 : 80. $R = $V; 81. $G = $t; 82. $B = $p; 83. break; 84. case 1 : 85. $R = $q; 86. $G = $V; 87. $B = $p; 88. break; 89. case 2 : 90. $R = $p; 91. $G = $V; 92. $B = $t; 93. break; 94. case 3 : 95. $R = $p; 96. $G = $q; 97. $B = $V; 98. break; 99. case 4 : 100. $R = $t; 101. $G = $p; 102. $B = $V; 103. break; 104. default : // case 5: 105. $R = $V; 106. $G = $p; 107. $B = $q; 108. break; 109. } 110. return array ( 111. $R, 112. $G, 113. $B 114. ); 115.} 116. 117.$size = 30; 118.$width = $size * $strnum +10; 119.$height = $size +10; 120.$degrees = array (); 121.for ($i = 0; $i < $strnum; ++ $i) { 122. $degrees[$i] = rand(0, 35); 123.} // 生成数字旋转角度 124. 125.for ($i = 0; $i < $strnum; ++ $i) { 126. if (rand() % 2); 127. else 128. $degrees[$i] = - $degrees[$i]; 129.} 130. 131.$image = imagecreatetruecolor($size, $size); // 数字图片画布 132.$validatepic = imagecreatetruecolor($width, $height); // 最终验证码画布 133.$back = imagecolorallocate($image, 255, 255, 255); // 背景色 134.$border = imagecolorallocate($image, 0, 0, 0); // 边框 135.imagefilledrectangle($validatepic, 0, 0, $width, $height, $back); // 画出背景色 136. 137.// 数字颜色 138.for ($i = 0; $i < $strnum; ++ $i) { 139. // 考虑为使字符容易看清使用颜色较暗的颜色 140. $temp = RgbToHsv(rand(0, 255), rand(0, 255), rand(0, 255)); 141. 142. if ($temp[2] > 60) 143. $temp[2] = 60; 144. 145. $temp = HsvToRgb($temp[0], $temp[1], $temp[2]); 146. $textcolor[$i] = imagecolorallocate($image, $temp[0], $temp[1], $temp[2]); 147.} 148. 149.for ($i = 0; $i < $disturbpiontnum && $disturbpiont; ++ $i) //加入干扰象素 150. { 151. $randpixelcolor = ImageColorallocate($validatepic, rand(0, 255), rand(0, 255), rand(0, 255)); 152. imagesetpixel($validatepic, rand(1, $width -1), rand(1, $height -1), $randpixelcolor); 153.} 154. 155.// 干扰线使用颜色较明亮的颜色 156.$temp = RgbToHsv(rand(0, 255), rand(0, 255), rand(0, 255)); 157. 158.if ($temp[2] < 200) 159. $temp[2] = 255; 160. 161.$temp = HsvToRgb($temp[0], $temp[1], $temp[2]); 162.$randlinecolor = imagecolorallocate($image, $temp[0], $temp[1], $temp[2]); 163. 164.// 画干扰线 165.for ($i = 0; $i < $disturblinenum && $disturbline; $i++) 166. imageline($validatepic, rand(1, 239), rand(1, 39), rand(1, 239), rand(1, 39), $randpixelcolor); 167. 168.for ($i = 0; $i < $strnum; ++ $i) { 169. $image = imagecreatetruecolor($size, $size); // 刷新画板 170. imagefilledrectangle($image, 0, 0, $size, $size, $back); // 画出背景色 171. imagefttext($image, 13, 0, 5, 20, $textcolor[$i], $font_file, $randStr[$i]); 172. $image = imagerotate($image, $degrees[$i], $back); 173. imagecolortransparent($image, $back); 174. imagecopymerge($validatepic, $image, 5 + 30 * $i, 5, 0, 0, imagesx($image), imagesy($image), 100); 175.} 176.imagerectangle($validatepic, 0, 0, $width -1, $height -1, $border); // 画出边框 177. 178.header('Content-type: image/png'); 179.imagepng($validatepic); 180.imagedestroy($validatepic); 181.imagedestroy($image); 182.$_SESSION['code'] = $validate;//将验证码存入session,如果实际应用,请md5. 183.?> ajax请求导致局部变量和全局变量结果不统一 错误的参数个数或无效的参数属性值 请问childNodes是只能在xml中使用还是普通的HTML也行 window.location 不能定位到指定页面 帮忙看看 onMouseOver 怎么加? 请问我如何读取本地机器上的access数据库呀? 哪有DHTML编辑器下载!! 谢谢(就是像word那样可以选粗体等那样的) javascript有没有插入flash的execCommand命令? 高分请教! 求教:如何用Javascript自动开始一个文件下载? 事件监听反解 怎么刷新Ext.window的html的值
参考:http://hi.baidu.com/asnahu/blog/item/e30ba78fd16b76f3513d92fd.html
2.
3. //开启session
4.
5. session_start();
6.
7. //得到用户输入的验证码,并转换成大写
8.
9. $imgId_req = $_REQUEST['imgId'];
10.
11. $imgId_req = strtoupper($imgId_req);
12.
13. //验证该字符串是否注册了session变量
14.
15. if (session_is_registered($imgId_req)) {
16.
17. echo "<font color=blue >通过验证!</font>";
18.
19. } else {
20.
21. echo "<font color=red >验证错误!</font>";
22.
23. }
24.
25. //关闭session,以清除所有注册过的变量
26.
27. session_destroy();
28.
29.?>
2.header("Pragma: no-cache");
3.header("Cache-Control: max-age=1, s-maxage=1, no-cache, must-revalidate");
4.session_start();
5.unset ($_SESSION['validate']);
6.
7.$strnum = 8; //产生密码的位数
8.$str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; //显示的字符范围
9.
10.$font_file = 'Fregne Myriad v2.ttf';//指定字体文件
11.
12.$disturbpiont = true; //是否显示干扰素
13.$disturbpiontnum = 600; //干扰素的点的数目
14.$disturbline = true; //是否有干扰条
15.$disturblinenum = 8; //干扰条的数目
16.
17.$l = strlen($str);
18.
19.$randStr = array ();
20.$validate;
21.for ($i = 0; $i < $strnum; ++ $i) {
22. $randStr[$i] = $str[rand(0, $l)];
23.}
24.
25.for ($i = 0; $i < $strnum; ++ $i) {
26. if ($randStr[$i] == '')
27. $randStr[$i] = '*';
28. $validate = $validate . $randStr[$i];
29.}
30.
31.
32.function RgbToHsv($R, $G, $B) {
33. $tmp = min($R, $G);
34. $min = min($tmp, $B);
35. $tmp = max($R, $G);
36. $max = max($tmp, $B);
37. $V = $max;
38. $delta = $max - $min;
39.
40. if ($max != 0)
41. $S = $delta / $max; // s
42. else {
43. $S = 0;
44. return;
45. }
46. if ($R == $max)
47. $H = ($G - $B) / $delta; // between yellow & magenta
48. else
49. if ($G == $max)
50. $H = 2 + ($B - $R) / $delta; // between cyan & yellow
51. else
52. $H = 4 + ($R - $G) / $delta; // between magenta & cyan
53.
54. $H *= 60; // degrees
55. if ($H < 0)
56. $H += 360;
57. return array (
58. $H,
59. $S,
60. $V
61. );
62.}
63.
64.function HsvToRgb($H, $S, $V) {
65. if ($S == 0) {
66. // achromatic (grey)
67. $R = $G = $B = $V;
68. return;
69. }
70.
71. $H /= 60; // sector 0 to 5
72. $i = floor($H);
73. $f = $H - $i; // factorial part of h
74. $p = $V * (1 - $S);
75. $q = $V * (1 - $S * $f);
76. $t = $V * (1 - $S * (1 - $f));
77.
78. switch ($i) {
79. case 0 :
80. $R = $V;
81. $G = $t;
82. $B = $p;
83. break;
84. case 1 :
85. $R = $q;
86. $G = $V;
87. $B = $p;
88. break;
89. case 2 :
90. $R = $p;
91. $G = $V;
92. $B = $t;
93. break;
94. case 3 :
95. $R = $p;
96. $G = $q;
97. $B = $V;
98. break;
99. case 4 :
100. $R = $t;
101. $G = $p;
102. $B = $V;
103. break;
104. default : // case 5:
105. $R = $V;
106. $G = $p;
107. $B = $q;
108. break;
109. }
110. return array (
111. $R,
112. $G,
113. $B
114. );
115.}
116.
117.$size = 30;
118.$width = $size * $strnum +10;
119.$height = $size +10;
120.$degrees = array ();
121.for ($i = 0; $i < $strnum; ++ $i) {
122. $degrees[$i] = rand(0, 35);
123.} // 生成数字旋转角度
124.
125.for ($i = 0; $i < $strnum; ++ $i) {
126. if (rand() % 2);
127. else
128. $degrees[$i] = - $degrees[$i];
129.}
130.
131.$image = imagecreatetruecolor($size, $size); // 数字图片画布
132.$validatepic = imagecreatetruecolor($width, $height); // 最终验证码画布
133.$back = imagecolorallocate($image, 255, 255, 255); // 背景色
134.$border = imagecolorallocate($image, 0, 0, 0); // 边框
135.imagefilledrectangle($validatepic, 0, 0, $width, $height, $back); // 画出背景色
136.
137.// 数字颜色
138.for ($i = 0; $i < $strnum; ++ $i) {
139. // 考虑为使字符容易看清使用颜色较暗的颜色
140. $temp = RgbToHsv(rand(0, 255), rand(0, 255), rand(0, 255));
141.
142. if ($temp[2] > 60)
143. $temp[2] = 60;
144.
145. $temp = HsvToRgb($temp[0], $temp[1], $temp[2]);
146. $textcolor[$i] = imagecolorallocate($image, $temp[0], $temp[1], $temp[2]);
147.}
148.
149.for ($i = 0; $i < $disturbpiontnum && $disturbpiont; ++ $i) //加入干扰象素
150. {
151. $randpixelcolor = ImageColorallocate($validatepic, rand(0, 255), rand(0, 255), rand(0, 255));
152. imagesetpixel($validatepic, rand(1, $width -1), rand(1, $height -1), $randpixelcolor);
153.}
154.
155.// 干扰线使用颜色较明亮的颜色
156.$temp = RgbToHsv(rand(0, 255), rand(0, 255), rand(0, 255));
157.
158.if ($temp[2] < 200)
159. $temp[2] = 255;
160.
161.$temp = HsvToRgb($temp[0], $temp[1], $temp[2]);
162.$randlinecolor = imagecolorallocate($image, $temp[0], $temp[1], $temp[2]);
163.
164.// 画干扰线
165.for ($i = 0; $i < $disturblinenum && $disturbline; $i++)
166. imageline($validatepic, rand(1, 239), rand(1, 39), rand(1, 239), rand(1, 39), $randpixelcolor);
167.
168.for ($i = 0; $i < $strnum; ++ $i) {
169. $image = imagecreatetruecolor($size, $size); // 刷新画板
170. imagefilledrectangle($image, 0, 0, $size, $size, $back); // 画出背景色
171. imagefttext($image, 13, 0, 5, 20, $textcolor[$i], $font_file, $randStr[$i]);
172. $image = imagerotate($image, $degrees[$i], $back);
173. imagecolortransparent($image, $back);
174. imagecopymerge($validatepic, $image, 5 + 30 * $i, 5, 0, 0, imagesx($image), imagesy($image), 100);
175.}
176.imagerectangle($validatepic, 0, 0, $width -1, $height -1, $border); // 画出边框
177.
178.header('Content-type: image/png');
179.imagepng($validatepic);
180.imagedestroy($validatepic);
181.imagedestroy($image);
182.$_SESSION['code'] = $validate;//将验证码存入session,如果实际应用,请md5.
183.?>