当前位置: 移动技术网 > IT编程>开发语言>.net > asp制作显示IP图片

asp制作显示IP图片

2018年10月03日  | 移动技术网IT编程  | 我要评论

兰州新闻,白鹿原 完整版,飞信号查手机号

本程序采用动网格式,可从动网论坛的data目录找到 数据库文件为:ipaddress.mdb
------------------------------------
file: ip.

<!--#include file="conn.asp"-->
<!--#include file="inc/config.asp"-->
<%response.contenttype = "image/gif"
conndatabase
dim tempip,myipnumeber,sql,rs1
dim country,city
tempip=reqip
tempip = split(tempip,".")
if ubound(tempip)=3 then
     for i=0 to ubound(tempip)
         tempip(i)=left(tempip(i),3)
         if isnumeric(tempip(i)) then
             tempip(i)=cint(tempip(i))
         else
             tempip(i)=0
         end if
     next
     myipnumeber=tempip(0)*256*256*256+tempip(1)*256*256+tempip(2)*256+tempip(3)
end if
sql="select country,city from dv_address where ip1<="&myipnumeber&" and ip2>="&myipnumeber
set rs1=conn.execute(sql)
if not rs1.eof then
     country = rs1(0)
     city = rs1(1)
else
     country = "51tiao.com"
     city = ""
end if
rs1.close : set rs1 = nothing
closedatabase

dim localfile,targetfile
localfile = server.mappath("ip.gif")
dim jpeg
set jpeg = server.createobject("persits.jpeg")
if -2147221005=err then
response.write "没有这个,请安装!" 检查是否安装aspjpeg组件
response.end()
end if
jpeg.open (localfile) 打开图片
if err.number then
response.write"打开图片失败,请检查路径!"
response.end()
end if
dim aa
aa=jpeg.binary 将原始数据赋给aa

=========加文字水印====http://www.devdao.com/=============
jpeg.canvas.font.color = &h000000 水印文字颜色
jpeg.canvas.font.family = "宋体" 字体
jpeg.canvas.font.bold = false 是否加粗
jpeg.canvas.font.size = 12 字体大小
jpeg.canvas.font.shadowcolor = &hffffff 阴影色彩
jpeg.canvas.font.shadowyoffset = 1
jpeg.canvas.font.shadowxoffset = 1
jpeg.canvas.brush.solid = false
jpeg.canvas.font.quality = 4 输出质量
jpeg.canvas.printtext 30,30,"-------------------------------------" 水印位置及文字
jpeg.canvas.printtext 30,50,"   你的ip: "& reqip
jpeg.canvas.printtext 30,70,"   你的位置: "&country&" "&city
jpeg.canvas.printtext 30,90,"   操作: "&clientinfo(0)
jpeg.canvas.printtext 30,110,"   浏 览 器: "&regexpfilter("microsoft<sup>®</sup> ", clientinfo(1), 0, "")
jpeg.canvas.printtext 30,130,"-------------------------------------"
jpeg.canvas.printtext 30,145,"个性签名来自风易在线 "
bb=jpeg.binary 将文字水印处理后的值赋给bb,这时,文字水印没有不透明度


============调整文字透明度================
set myjpeg = server.createobject("persits.jpeg")
myjpeg.openbinary aa

set logo = server.createobject("persits.jpeg")
logo.openbinary bb
myjpeg.drawimage 0,0, logo, 0.9 0.3是透明度
cc=myjpeg.binary 将最终结果赋值给cc,这时也可以生成目标图片了
response.binarywrite cc 将二进输出给
set aa=nothing
set bb=nothing
set cc=nothing
jpeg.close : set jpeg = nothing
myjpeg.close : set myjpeg = nothing
logo.close : set logo = nothing
%>

--------------------------------------------------
file: conn.asp

<%dim conn,dbpath,userip
sub conndatabase
     on error resume next
     set conn=server.createobject("adodb.connection")
     dbpath = server.mappath("ip.mdb")
     conn.open "provider=microsoft.jet.oledb.4.0;data source=" & dbpath
     if err then
             err.clear
             set conn = nothing
             response.write "数据库正在更新中,请稍后再试!"
             response.end
     end if
end sub

sub closedatabase
     conn.close
     set conn = nothing
end sub%>

-------------------------------------------------
file: config.asp

<%
dim user_agent
user_agent = request.servervariables("http_user_agent")
   
============================================
获取客户端配置
============================================
public function clientinfo(stype)
     if stype = 0 then
         if instr(user_agent, "windows 98") then
             clientinfo = "windows 98"
         elseif instr(user_agent, "win 9x 4.90") then
             clientinfo = "windows me"
         elseif instr(user_agent, "windows nt 5.0") then
             clientinfo = "windows 2000"
         elseif instr(user_agent, "windows nt 5.1") then
             clientinfo = "windows xp"
         elseif instr(user_agent, "windows nt 5.2") then
             clientinfo = "windows 2003"
         elseif instr(user_agent, "windows nt") then
             clientinfo = "windows nt"
         elseif instr(user_agent, "unix") or instr(user_agent, "linux")   or instr(user_agent, "sunos")   or instr(user_agent, "bsd") then
             clientinfo = "unix & linux"
         else
             clientinfo = "other"
         end if
     elseif stype = 1 then
         if instr(user_agent, "msie 7") then
             clientinfo = "microsoft<sup>®</sup> internet explorer 7.0"
         elseif instr(user_agent, "msie 6") then
             clientinfo = "microsoft<sup>®</sup> internet explorer 6.0"
         elseif instr(user_agent, "msie 5") then
             clientinfo = "microsoft<sup>®</sup> internet explorer 5.0"
         elseif instr(user_agent, "msie 4") then
             clientinfo = "microsoft<sup>®</sup> internet explorer 4.0"
         elseif instr(user_agent, "netscape") then
         &n

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网