15 lines
504 B
Python
15 lines
504 B
Python
# -*- coding: utf-8 -*-
|
|
from django.http import HttpResponse
|
|
from django.conf import settings
|
|
from main.forms import *
|
|
|
|
def MyIpView(request):
|
|
return HttpResponse(request.META['REMOTE_ADDR'], content_type="text/plain")
|
|
|
|
def UpdateIpView(request):
|
|
ip = request.META['REMOTE_ADDR']
|
|
if ':' in ip:
|
|
request.session['ipv6'] = request.META['REMOTE_ADDR']
|
|
if '.' in ip:
|
|
request.session['ipv4'] = request.META['REMOTE_ADDR']
|
|
return HttpResponse('OK', content_type="text/plain") |