<!--#include virtual = "/common/lib/dbcon.asp" -->
<!--#include virtual = "/common/lib/func.asp" -->
<%
security_ad_cms()

Dim value, m_id, prepage

value		= inputValue( request.queryString("value") )
m_id		= inputValue( request.queryString("m_id") )
prepage		= inputValue( request.queryString("prepage") )

If value = "" Then value = "0"

If session("ss_m_id") <> "" Then


	sql = "update member set m_g_sms = m_g_sms + '" & value & "' where m_id = '" & m_id & "'"
	'Response.write sql
	'Response.end
	dbcon.execute sql

	sql = "select m_g_sms from member where m_id = '" & m_id & "'"
	Set rs = dbcon.execute( sql )
	If rs.bof Or rs.eof Then
		nowcount = 0
	Else
		nowcount = rs(0)
	End If
	Set rs = nothing

	Call managerJob(session("ss_m_id"), session("ss_m_name"), "sms충전 " & value & "건 (ID:" & m_id & ")")

	'충전내역 등록
	reg_date	= setDate("Y-m-d H:i:s")
	changeVal	= value
	field_type	= "1"
	write_id	= session("ss_m_id")
	write_ip	= remoteIp()
	afterVal	= nowcount
	r_fields_i = "m_id, reg_date, changeVal, field_type, write_id, write_ip, afterVal"
	Call InsertQuery( r_fields_i, "change_log" )

End if

dbcon.close
Set dbcon = nothing

Call goUrl( prepage )



Function remoteIp()
	Dim ip
	ip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
	if isnull( ip ) or ip = "" or ip = "unknown" then
		ip = Request.ServerVariables("Proxy-Client-IP")
	End if
	if isnull( ip ) or ip = "" or ip = "unknown" then
		ip = Request.ServerVariables("WL-Proxy-Client-IP")
	End if
	if isnull( ip ) or ip = "" or ip = "unknown" then
		ip = Request.ServerVariables("HTTP_CLIENT_IP")
	End if
	if isnull( ip ) or ip = "" or ip = "unknown" then
		ip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
	End If
	if isnull( ip ) or ip = "" or ip = "unknown" then
		ip = Request.ServerVariables("HTTP_SOURCEIP")
	End if
	if isnull( ip ) or ip = "" or ip = "unknown" then
		ip = request.ServerVariables("REMOTE_ADDR")
	End if
	remoteIp = ip
End function
%>