
aess中记录用户ip的方法:
'获取访问者的IP
ip=Request(">
setrs=server("adodbrecordset")
sql="selectfromxiaoyewl_yzmwhereyzip='"&ip&"'andDATEDIFF('d',now(),sj)=0"'先查询数据库里有没有
rsopensql,conn,3,2
ifrseoforrsbofthen'数据库无当天IP则写入
rsaddnew
now_time=now'获取登陆时间(服务器时间)
rs("yzip")=""&ip&""
rs("yzcs")=1
rs("sj")=now_time
rsupdate
endif
rsclose
要获取数据库服务器IP,可通过xp_cmdshell 来获取信息,然后对信息进行筛选
xp_cmdshell 扩展存储过程将命令字符串作为 *** 作系统命令 shell 执行,并以文本行的形式返回所有输出。由于存在安全隐患,所以在SQL Server 中, xp_cmdshell 默认是关闭的。
实现代码如下:
--开启xp_cmdshell
exec sp_configure 'show advanced options', 1
reconfigure with override
exec sp_configure 'xp_cmdshell', 1
reconfigure with override
exec sp_configure 'show advanced options', 0
reconfigure with override
go
begin
declare @ipline varchar(200)
declare @pos int
declare @ip varchar(40)
set nocount on
set @ip = null
if object_id('tempdb#temp') is not null drop table #temp
create table #temp (ipline varchar(200))
insert #temp exec masterxp_cmdshell 'ipconfig'
select @ipline = ipline
from #temp
where upper (ipline) like '%IPv4 地址%'--这里需要注意一下,系统不同这里的匹配值就不同
if @ipline is not null
begin
set @pos = charindex (':',@ipline,1);
set @ip = rtrim(ltrim(substring (@ipline ,
@pos + 1 ,
len (@ipline) - @pos)))
end
select distinct(rtrim(ltrim(substring (@ipline ,
@pos + 1 ,
len (@ipline) - @pos)))) as ipaddress from #temp
drop table #temp
set nocount off
end
go
mysql 数据库的直接复制:
备份:mysqldump -uroot -p thisdatabase>/home/work/backup/testsql;
创建:mysql -uroot -p thatdatabases< /home/work/backup/testsql;
如果没有mysql 或者mysqldump 不好使
需要进入mysql/bin 用/mysql 进行 *** 作
这样子达到备份和拷贝数据库的目的
以上就是关于什么是存储在SQL服务器的IP地址最合适的数据类型全部的内容,包括:什么是存储在SQL服务器的IP地址最合适的数据类型、sql server 2008连接远程数据库怎么办入ip地址、数据库中怎么存储IP地址等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)