预览模式: 普通 | 列表

php插入mysql数据避免重复插入

关于IIS7.0出错的解决方案

 一、请求筛选模块被配置为拒绝包含双重转义序列的请求。HTTP 错误 404.11 - Not Found
1.单击 开始 。 在 开始搜索 框中, 键入 Notepad. 右击 记事本 , 然后单击 作为管理员运行 。

注意 如果提示用于管理员密码或用于确认, 键入密码, 或单击 继续 。
2.在 文件 菜单上, 单击 打开 。 在 文件名 框中, 键入 %windir%\system32\inetsrv\config\applicationhost.config然后单击 打开 。
3.在 ApplicationHost.config 文件, 定位 文件中的 configuration/system.webServer/security/requestFiltering/下
<requestFiltering> 节点。大约360行
将<requestFiltering>
改为
<requestFiltering allowDoubleEscaping="true">
即可

二、关于IIS7.0上传大文件出错的解决方案(描述: 请求筛选模块被配置为拒绝超过请求内容长度的请求)

使用IIS7.0的asp上传大文件时出现如下错误:

HTTP Error 404.13 - Not Found

查看更多...

Tags: iis7

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

ASP的URLDecode函数URLEncode解码函数

ASP/Visual Basic代码
  1. Function URLDecode(ByVal urlcode)   
  2. Dim start,final,length,char,i,butf8,pass   
  3. Dim leftstr,rightstr,finalstr   
  4. Dim b0,b1,bx,blength,position,u,utf8   
  5. On Error Resume Next  
  6. b0 = Array(192,224,240,248,252,254)   
  7. urlcode = Replace(urlcode,"+"," ")   
  8. pass = 0   
  9. utf8 = -1  
  10. length = Len(urlcode) : start = InStr(urlcode,"%") : final = InStrRev(urlcode,"%")   
  11. If start = 0 Or length < 3 Then URLDecode = urlcode : Exit Function   
  12. leftstr = Left(urlcode,start - 1) : rightstr = Right(urlcode,length - 2 - final)  
  13. For i = start To final   
  14. char = Mid(urlcode,i,1)   
  15. If char = "%" Then   
  16. bx = URLDecode_Hex(Mid(urlcode,i + 1,2))   
  17. If bx > 31 And bx < 128 Then   
  18. i = i + 2   
  19. finalstr = finalstr & ChrW(bx)   
  20. ElseIf bx > 127 Then   
  21. i = i + 2   
  22. If utf8 < 0 Then   
  23. butf8 = 1 : blength = -1 : b1 = bx   
  24. For position = 4 To 0 Step -1   
  25. If b1 >= b0(position) And b1 < b0(position + 1) Then   
  26. blength = position   
  27. Exit For   
  28. End If   
  29. Next   
  30. If blength > -1 Then   
  31. For position = 0 To blength   
  32. b1 = URLDecode_Hex(Mid(urlcode,i + position * 3 + 2,2))   
  33. If b1 < 128 Or b1 > 191 Then butf8 = 0 : Exit For   
  34. Next   
  35. Else   
  36. butf8 = 0   
  37. End If   
  38. If butf8 = 1 And blength = 0 Then butf8 = -2   
  39. If butf8 > -1 And utf8 = -2 Then i = start - 1 : finalstr = "" : pass = 1   
  40. utf8 = butf8   
  41. End If   
  42. If pass = 0 Then   
  43. If utf8 = 1 Then   
  44. b1 = bx : u = 0 : blength = -1   
  45. For position = 4 To 0 Step -1   
  46. If b1 >= b0(position) And b1 < b0(position + 1) Then   
  47. blength = position   
  48. b1 = (b1 xOr b0(position)) * 64 ^ (position + 1)   
  49. Exit For   
  50. End If   
  51. Next   
  52. If blength > -1 Then   
  53. For position = 0 To blength   
  54. bx = URLDecode_Hex(Mid(urlcode,i + 2,2)) : i = i + 3   
  55. If bx < 128 Or bx > 191 Then u = 0 : Exit For   
  56. u = u + (bx And 63) * 64 ^ (blength - position)   
  57. Next   
  58. If u > 0 Then finalstr = finalstr & ChrW(b1 + u)   
  59. End If   
  60. Else   
  61. b1 = bx * &h100 : u = 0   
  62. bx = URLDecode_Hex(Mid(urlcode,i + 2,2))   
  63. If bx > 0 Then   
  64. u = b1 + bx   
  65. i = i + 3   
  66. Else   
  67. If Left(urlcode,1) = "%" Then   
  68. u = b1 + Asc(Mid(urlcode,i + 3,1))   
  69. i = i + 2   
  70. Else   
  71. u = b1 + Asc(Mid(urlcode,i + 1,1))   
  72. i = i + 1   
  73. End If   
  74. End If   
  75. finalstr = finalstr & Chr(u)   
  76. End If   
  77. Else   
  78. pass = 0   
  79. End If   
  80. End If   
  81. Else   
  82. finalstr = finalstr & char   
  83. End If   
  84. Next   
  85. URLDecode = leftstr & finalstr & rightstr   
  86. End Function  
  87. Function URLDecode_Hex(ByVal h)   
  88. On Error Resume Next   
  89. h = "&h" & Trim(h) : URLDecode_Hex = -1   
  90. If Len(h) <> 4 Then Exit Function   
  91. If isNumeric(h) Then URLDecode_Hex = cInt(h)   
  92. End Function  

Tags: asp

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

北京联想调频科技有限公司

联想旗下网站:

主办单位名称 网站备案/许可证号 网站名称 网址
北京联想调频科技有限公司   京ICP备11035186号-1 联想MS管理系统门户  www.mspcloud.cn
北京联想调频科技有限公司   京ICP备11035186号-10 联想乐空间  www.lestorage.com
北京联想调频科技有限公司   京ICP备11035186号-11 联想乐活  www.idealife365.com
北京联想调频科技有限公司   京ICP备11035186号-12 联想旗下IT服务产品网站  www.ecare365.com
北京联想调频科技有限公司   京ICP备11035186号-13 联想旗下IT服务产品网站  www.lezhuli.com
北京联想调频科技有限公司   京ICP备11035186号-14 联想云加速  www.lenovocdn.com
北京联想调频科技有限公司   京ICP备11035186号-15 联想云存储  www.lenovostor.com
北京联想调频科技有限公司   京ICP备11035186号-16 联想网络服务  www.lenovows.com
北京联想调频科技有限公司   京ICP备11035186号-17 联想旗下IT服务产品网站  www.ekuaibang.com
北京联想调频科技有限公司   京ICP备11035186号-2 联想阳光在线  www.lenovo.net
北京联想调频科技有限公司   京ICP备11035186号-3 罗宝网  www.luobao365.com
北京联想调频科技有限公司   京ICP备11035186号-4 联想导航  www.idea123.cn
北京联想调频科技有限公司   京ICP备11035186号-5 乐商店  www.lenovomm.com
北京联想调频科技有限公司   京ICP备11035186号-6 联想网盘  www.vips100.com
北京联想调频科技有限公司   京ICP备11035186号-7 联想网盘  www.lenovodata.com
北京联想调频科技有限公司   京ICP备11035186号-8 联想中关村云平台  www.zgc-cloud.com
北京联想调频科技有限公司   京ICP备11035186号-9 联想网盘  www.qd-lenovodata.com
分类:业界文摘 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 3230

php连接mssql的一些方法总结

为了能让PHP连接MSSQL,系统需要安装MSSQL,PHP,且在PHP.ini中的配置中,将
;extension=php_mssql.dll前面的;去掉

1.连接MSSQL
$conn=mssql_connect("实例名或者服务器IP","用户名","密码");

//测试连接
if($conn)
{
echo "连接成功";
}

2.选择要连接的数据库
mssql_select_db("dbname");

查看更多...

Tags: php

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

PHP生成图片水印和文字水印

 文本水印

我们使用函数watermark_text()来生成文本水印,你必须先指定字体源文件、字体大小和字体文本,具体代码如下:

PHP代码
  1. $font_path = "GILSANUB.TTF"// Font file  
  2. $font_size = 30; // in pixcels  
  3. $water_mark_text_2 = "phpfuns"// Watermark Text  
  4.   
  5. function watermark_text($oldimage_name$new_image_name)  
  6. {  
  7. global $font_path$font_size$water_mark_text_2;  
  8. list($owidth,$oheight) = getimagesize($oldimage_name);  
  9. $width = $height = 300;  
  10. $image = imagecreatetruecolor($width$height);  
  11. $image_src = imagecreatefromjpeg($oldimage_name);  
  12. imagecopyresampled($image$image_src, 0, 0, 0, 0, $width$height$owidth$oheight);  
  13. $blue = imagecolorallocate($image, 79, 166, 185);  
  14. imagettftext($image$font_size, 0, 68, 190, $blue$font_path$water_mark_text_2);  
  15. imagejpeg($image$new_image_name, 100);  
  16. imagedestroy($image);  
  17. unlink($oldimage_name);  
  18. return true;  
  19. }  

图片水印
我们使用函数watermark_image()来生成图片水印,你必须先水银图片的源文件。具体代码如下:

PHP代码
  1. $image_path = "phpfuns.png";  
  2.   
  3. function watermark_image($oldimage_name$new_image_name)  
  4. /{  
  5. global $image_path;  
  6. list($owidth,$oheight) = getimagesize($oldimage_name);  
  7. $width = $height = 300;  
  8. $im = imagecreatetruecolor($width$height);  
  9. $img_src = imagecreatefromjpeg($oldimage_name);  
  10. imagecopyresampled($im$img_src, 0, 0, 0, 0, $width$height$owidth$oheight);  
  11. $watermark = imagecreatefrompng($image_path);  
  12. list($w_width$w_height) = getimagesize($image_path);  
  13. $pos_x = $width - $w_width;  
  14. $pos_y = $height - $w_height;  
  15. imagecopy($im$watermark$pos_x$pos_y, 0, 0, $w_width$w_height);  
  16. imagejpeg($im$new_image_name, 100);  
  17. imagedestroy($im);  
  18. unlink($oldimage_name);  
  19. return true;  
  20. }  

上传图片表单
我们使用下面的表单来上传图片:

PHP代码
  1. <?php  
  2. $demo_image"";  
  3. if(isset($_POST['createmark']) and $_POST['createmark'] == "Submit")  
  4. {  
  5. $path = "uploads/";  
  6. $valid_formats = array("jpg""bmp","jpeg");  
  7. $name = $_FILES['imgfile']['name'];  
  8. if(strlen($name))  
  9. {  
  10. list($txt$ext) = explode("."$name);  
  11. if(in_array($ext,$valid_formats) && $_FILES['imgfile']['size'] <= 256*1024)  
  12. {  
  13. $upload_status = move_uploaded_file($_FILES['imgfile']['tmp_name'], $path.$_FILES['imgfile']['name']);  
  14. if($upload_status){  
  15. $new_name = $path.time().".jpg";  
  16. // Here you have to user functins watermark_text or watermark_image  
  17. if(watermark_text($path.$_FILES['imgfile']['name'], $new_name))  
  18. $demo_image = $new_name;  
  19. }  
  20. }  
  21. else  
  22. $msg="File size Max 256 KB or Invalid file format.";  
  23. }  
  24. }  
  25. ?>  
  26. // HTML Code  
  27. <form name="imageUpload" method="post" enctype="multipart/form-data" >  
  28. Upload Image  
  29. Image :<input type="file" name="imgfile" /><br />  
  30. <input type="submit" name="createmark" value="Submit" />  
  31. <?php  
  32. if(!emptyempty($demo_image))  
  33. echo '<img src="'.$demo_image.'" />';  
  34. ?>  
  35. </form>  

Tags: php

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

 在编写PHP程序时,经常会需要对一些字符串进行大小写转换,下面是几个最常用的函数
strtolower() //将字符串转换为小写形式
strtoupper() //将字符串转换为大写形式
ucfirst() //将字符串的第一个字符转换为大写形式
ucwords() //将字符串中每一个单词的首字母转换为大写形式

Tags: php

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

 PHP下安装过GD库以后会自带一个imagecopymerge()函数,该函数功能相当的强大,完全可以实现我们日常所需要的大部分的图片处理工作,下面我们来说一下如果使用imagecopymerge()函数来给让一张原本没有水印的图片实时的显示有水印。

imagecopymerge() 函数用于拷贝并合并图像的一部分,成功返回 TRUE ,否则返回 FALSE 。

基本的语法

PHP代码
  1. bool imagecopymerge( resource dst_im, resource src_im, int dst_x,   

 

参数说明:
参数 说明
dst_im 目标图像
src_im 被拷贝的源图像
dst_x 目标图像开始 x 坐标
dst_y 目标图像开始 y 坐标,x,y同为 0 则从左上角开始
src_x 拷贝图像开始 x 坐标
src_y 拷贝图像开始 y 坐标,x,y同为 0 则从左上角开始拷贝
src_w (从 src_x 开始)拷贝的宽度
src_h (从 src_y 开始)拷贝的高度
pct 图像合并程度,取值 0-100 ,当 pct=0 时,实际上什么也没做,反之完全合并。

查看更多...

Tags: php

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

MSSQL备份移植到另一服务器还原时容易遇到的问题,尤其是从虚拟主机备份回来的数据库在本机还原的问题…

 --将下面的代码在查询分析器中执行,修改修改库名

use 你的库名
go

declare tb cursor local
for
select 'sp_changeobjectowner '
+quotename(
+quotename(user_name(uid))
+'.'+quotename(name),'''')
+',''dbo'''
from sysobjects
where objectproperty(id,N'isusertable')=1
and uid<>user_id('dbo')
declare @s nvarchar(4000)
open tb
fetch tb into @s
while @@fetch_status=0
begin
exec(@s)
fetch tb into @s
end
close tb
deallocate tb
执行完毕就可以删除改用户了

查看更多...

Tags: sqlserver

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

中文搜索引擎蜘蛛大全

搜索引擎 蜘蛛名称
百度 baiduspider
谷歌 googlebot
搜狗 Sogou+web+spider
Bing bingbot
搜搜 Sosospider
360 360Spider
Msn msnbot
即刻 JikeSpider
有道 YoudaoBot
雅虎中文 Yahoo!+Slurp+China

欢迎补充。

Tags: 搜索引擎研究

分类:随笔杂记 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 2805

php中eregi_replace()和ereg_replace()函数的功能一致,只是前者忽略大小写。

代码示例:

PHP代码
  1. <?php     
  2. $lines = file('source.php'); //将文件读入数组中    
  3. for($i=0; $i<count($lines); $i++)    
  4. {    
  5. //将行末以“\”或“#”开头的注释去掉    
  6. $lines[$i] = eregi_replace("(//|#).*$"""$lines[$i]);     
  7. //将行末的空白消除    
  8. $lines[$i] = eregi_replace("[ nrtvf]*$""rn"$lines[$i]);     
  9. }    
  10. //整理后输出到页面    
  11. echo htmlspecialchars(join("",$lines));    
  12. ?>   

Tags: php 正则表达式

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

.htaccess配置PHP错误显示

关闭错误显示:

php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
php_value docref_root 0
php_value docref_ext 0

只显示PHP错误:

php_flag display_errors on
php_flag display_startup_errors on
php_value error_reporting 2047

查看更多...

Tags: php

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

 广告位

↑返回顶部↑