邮箱登录


def user():
    print('6~18个字符,可以使用字母,数字,下划线,需要以字母开头')
    usres = input('输入用户名:')
    Z = 'ZXCVBNMASDFGHJKLQWERTYUIOPzxcvbnmasdfghjklqwertyuiop@._'
    N = '1234567890'
    T = '*&^%$#!~'
    is_N = False
    is_Z = False
    is_T = False
    if len(usres) > 6 and len(usres) < 18:
        for i in usres:
            if i in Z:
                #字母
                is_Z = True
            if i in N:
                #数字
                is_N = True
                #字符
            if i not in T:
                is_T = True 
        if is_N and is_T and is_Z:
                password()
        else:
            print('账号必须含有数字和字母且不能含有(*&^%$#!~)')
    else:
        print('请输入正确的格式!')


def password():
    print('6~16个字符,区分大小写')
    passwords = input('输入密码:')
    if len(passwords) < 6 and len(passwords) > 16:
        print('密码格式必须大于六位,小于16位')

    else:
        password2()
    

def password2():
    passwords2 = input('确认密码:')
    if len(passwords2) < 6 and len(passwords2) > 16:
        print('密码格式不一致,请重新输入')
        password()
        
    else:
        auth_code()    


def auth_code():
    import random
    import time
    code = random.randint(1000,9999)
    print(code)
    num = int(input('输入验证码'))
    if num == code :
        phone()
    else:
        print('验证码错误请重新输入')
        time.sleep(5)
        auth_code()

def phone():
    print('请填写正确的手机号')
    phones = input('输入手机号')
    if len(phones) != 11:
        print('请输入正确的手机号')
        phone()
    else:
        print('验证码已发送')
        numbercode()
   

def numbercode():
    import random
    import time
    num = random.randrange(1000,9999)
    # start_time = time.time()
    print('验证码是:%d'%num)
    num_ = int(input('请输入验证码:'))
    # end_time = time.time()
    # sub_time = end_time - start_time
    # if sub_time > 10:
    #     print('验证码超时,即将重发..')
    #     time.sleep(2)
    #     numbercode()
    # else:
    if num == num_:
        print('注册成功')
    else:
        print('验证码错误')
        time.sleep(4)
        numbercode()

def start():
    user()
  
"""
#!/usr/local/bin/python
#-*- coding:utf-8 -*-

 
#查看用户名 登录用户中心->验证码通知短信>产品总览->API接口信息->APIID
# account  = "用户名"
# #查看密码 登录用户中心->验证码通知短信>产品总览->API接口信息->APIKEY
# password = "密码"
 
def send_sms(text, mobile):
    import httplib
    import urllib
 
    host  = "106.ihuyi.com"
    sms_send_uri = "/webservice/sms.php?method=Submit"
    params = urllib.urlencode({'account': account, 'password' : password, 'content': text, 'mobile':mobile,'format':'json' })
    headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
    conn = httplib.HTTPConnection(host, port=80, timeout=30)
    conn.request("POST", sms_send_uri, params, headers)
    response = conn.getresponse()
    response_str = response.read()
    conn.close()
    return response_str
 
if __name__ == '__main__':
 
    mobile = "138xxxxxxxx"
    text = "您的验证码是:121254。请不要把验证码泄露给其他人。"
 
    print(send_sms(text, mobile))
"""
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值