Example #1
0
def create_account():
    output = render_template("dashboard/register.html")
    if request.form.get("remail1"):
        output = redirect(url_for("index"))
        email = request.form.get("remail2")
        if request.form.get("rpw") != None:
            password = request.form.get("rpw")
        else:
            password = "******"

        user = User(nickname=request.form.get("username"),
                    email=email,
                    password=password,
                    email_confirmed=0)

        # Now we'll send the email confirmation link
        subject = "Confirm your email"

        token = ts.dumps(user.email, salt='email-confirm-key')

        confirm_url = url_for('confirm_email', token=token, _external=True)

        html = render_template('dashboard/email/activate.html',
                               confirm_url=confirm_url)

        db_session.add(user)
        db_session.commit()
        checkbox = request.form.get("remember")
        login_user(user, checkbox)
        drill(user.email, subject, html)
        output = redirect(url_for("dashboard"))

    return output
Example #2
0
def create_account():
    output = render_template("dashboard/register.html")
    if request.form.get("remail1"):
        output = redirect(url_for("index"))
        email = request.form.get("remail2")
        if request.form.get("rpw") != None:
            password = request.form.get("rpw")
        else:
            password = "******"

        user = User(nickname=request.form.get("username"), email=email, password=password, email_confirmed=0)

        # Now we'll send the email confirmation link
        subject = "Confirm your email"

        token = ts.dumps(user.email, salt='email-confirm-key')

        confirm_url = url_for(
            'confirm_email',
            token=token,
            _external=True)

        html = render_template(
            'dashboard/email/activate.html',
            confirm_url=confirm_url)


        db_session.add(user)
        db_session.commit()
        checkbox = request.form.get("remember")
        login_user(user, checkbox)
        drill(user.email, subject, html)
        output = redirect(url_for("dashboard"))

    return output
Example #3
0
def emails(srv):
    form = xForm()
    admin = None
    choice = 3
    sr = requests.get("http://freebieservers.com/api/SeekStats?user=testest&pass=testest")
    stats = sr.json()
    sl = requests.get("http://freebieservers.com/api/SeekServers?user=testest&pass=testest")
    sstats = sl.json()

    output = render_template('email.html',form=form,servers=sstats,emailsent=False,sselect=srv,page=choice)

    if 'user_id' in session:
        g.user = User.query.get(session['user_id'])
        #admin = g.user.admin

    if form.subject.data != None and form.body.data != None:
        s = form.subject.data
        b = form.body.data
        db = MySQLdb.connect("db.freebieservers.com","root","Fuc5M4n15!","gamecp")
        cursor = db.cursor()
        if srv == all:
            sql = "SELECT * FROM users WHERE active != '3'"
            cursor.execute(sql)
            results = cursor.fetchall()
            for row in results:
                email = row[2]
                drill(s,b,email)
            output = render_template('email.html',username=g.user,form=form,admin=admin,emailsent=True,servers=sstats,sselect=srv,page=choice)
        else:
            output = render_template('email.html',username=g.user,form=form,admin=admin,emailsent=False,servers=sstats,sselect=srv,page=choice)

    flash("errors")
    return output
Example #4
0
def stripe():
    print '--- got stripe request ---'
    stripe.api_key = stripe_keys['secret_key']
    form = stripeform()
    output = render_template('stripe.html', key=stripe_keys['publishable_key'], form=form)
    if form.amount.data:
        drill("xTcR Donation","Thanks for donating to xTcR!",request.form["stripeEmail"])
        #stripe.api_key = "sk_test_KBnACrVyXtFPcHyGTd5cot9D"

        customer = Customer.create(
            email= request.form["stripeEmail"],
            card=request.form['stripeToken']
        )

        charge = Charge.create(
            customer=customer.id,
            amount=form.amount.data * 100,
            currency='usd',
            description='xTcR Donation'
        )

        amnt = form.amount.data * 100
        custom = '0'
        if request.form.has_key('custom'):
            custom = str(request.form['custom'])

        cb_data = {
             #'app': 'donate',
             #'do': 'payment',
             #'gateway': '1',
             'mc_gross': float(charge['amount']) / 100,
             'mc_currency': charge['currency'],
             'custom': custom,
             'payment_status': 'Completed' if charge['status'] == 'succeeded' else charge['status'],
             'business': charge['receipt_email'],
             'option_selection1': '',
             'option_selection2': '',
             'txn_id': charge['id'],
             'memo': 'stripe',
             'fees': (float(charge['amount']) / 100) * 0.029 + 0.30,
             'item_name': str(request.form['item_name']),
             'item_number': str(request.form['item_number'])
        }

        r = requests.post("http://192.3.130.131/index.php?app=donate&do=payment&gateway=1", data=cb_data)
        try:
            r = requests.get("http://kc1.freebieservers.com/1/donate.php?name=%s&amount=%s"%(g.user.nickname,amnt))
            print r
            print r.url
        except:
            print "Server Down"

        print ' ----- '
        cmd("echo '%s' >> stripe.log"%r.text)

        output = redirect("http://xtcr.net/success.html")


    return output
Example #5
0
def emails(srv):
    form = xForm()
    admin = None
    choice = 3
    sr = requests.get(
        "http://freebieservers.com/api/SeekStats?user=testest&pass=testest")
    stats = sr.json()
    sl = requests.get(
        "http://freebieservers.com/api/SeekServers?user=testest&pass=testest")
    sstats = sl.json()

    output = render_template('email.html',
                             form=form,
                             servers=sstats,
                             emailsent=False,
                             sselect=srv,
                             page=choice)

    if 'user_id' in session:
        g.user = User.query.get(session['user_id'])
        #admin = g.user.admin

    if form.subject.data != None and form.body.data != None:
        s = form.subject.data
        b = form.body.data
        db = MySQLdb.connect("db.freebieservers.com", "root", "Fuc5M4n15!",
                             "gamecp")
        cursor = db.cursor()
        if srv == all:
            sql = "SELECT * FROM users WHERE active != '3'"
            cursor.execute(sql)
            results = cursor.fetchall()
            for row in results:
                email = row[2]
                drill(s, b, email)
            output = render_template('email.html',
                                     username=g.user,
                                     form=form,
                                     admin=admin,
                                     emailsent=True,
                                     servers=sstats,
                                     sselect=srv,
                                     page=choice)
        else:
            output = render_template('email.html',
                                     username=g.user,
                                     form=form,
                                     admin=admin,
                                     emailsent=False,
                                     servers=sstats,
                                     sselect=srv,
                                     page=choice)

    flash("errors")
    return output
Example #6
0
def index():
    form = ContactForm()
    if request.method == 'POST':
        if form.validate() == False:
            flash('You must enter something into all of the fields')
            return render_template('index.html', form=form)
        else:
            sub = form.subject.data
            email = form.email.data
            message = form.message.data
            drill(sub, message, email)
            return render_template('index.html', success=True)
    elif request.method == 'GET':
        return render_template('index.html', form=form)
Example #7
0
def index():
    form = ContactForm()
    if request.method == 'POST':
        if form.validate() == False:
            flash('You must enter something into all of the fields')
            return render_template('index.html',form=form)
        else:
            sub = form.subject.data
            email = form.email.data
            message = form.message.data
            drill(sub,message,email)
            return render_template('index.html', success=True)
    elif request.method == 'GET':
        return render_template('index.html',form=form)
Example #8
0
def success():
    g.user = None
    if 'user_id' in session:
        g.user = User.query.get(session['user_id'])


    if g.user.ptype == 1:
        html = "<p>You will be receiving a friend request in steam from a user named xTcR | Tournament [IN]. You will need to accept this friend request to be verified on the date of the tournament.</p><p>The tournament will be on August 15th, 2015 at 1:00pm EST. You and your team will need to be in xTcR's teamspeak (ts3.xtcr.net > INS Tournament Waiting Room) 1 hour before the starting time in order to be verified.</p>"
    else:
        html = "<p>You will be receiving a friend request in steam from a user named xTcR | Tournament [IN]. You will need to accept this friend request to be verified on the date of the tournament.</p><p>The tournament will be on August 15th, 2015 at 1:00pm EST.  You will need to be in teamspeak (ts3.xtcr.net > INS Tournament Waiting Room) 1 and a half hours before the starting time to allow time for teaming up.</p>"
    drill(g.user.email,html)
    print "email %s sent to %s"%(html,g.user.email)
    output = render_template('success.html',username=g.user)

    return output
Example #9
0
def create_account():
    output = render_template("dashboard/register.html")
    if request.form.get("email"):
        output = redirect(url_for("index"))
        email = request.form.get("email")
        if request.form.get("password") != None:
            password = request.form.get("password")
        else:
            password = "******"
        exists = User.query.filter_by(email=email).first()
        if current_user.is_authenticated():
            user = User(nickname=request.form.get("username"),
                        email=email,
                        password=password,
                        vpoints=0,
                        email_confirmed=0,
                        oauth_token=current_user.token,
                        oath_secret=current_user.secret)
        else:
            user = User(nickname=request.form.get("username"),
                        email=email,
                        password=password,
                        vpoints=0,
                        email_confirmed=0)

        # Now we'll send the email confirmation link
        subject = "Confirm your email"

        token = ts.dumps(user.email, salt='email-confirm-key')

        confirm_url = url_for('confirm_email', token=token, _external=True)

        html = render_template('dashboard/email/activate.html',
                               confirm_url=confirm_url)

        if exists == None:
            db_session.add(user)
            db_session.commit()
            login_user(user, True)
            drill(user.email, subject, html)
        else:
            print "x is %s"
            db_session.merge(user)
            db_session.commit()
            login_user(user, True)
            output = redirect(url_for("index"))

    return output
Example #10
0
def create_account():
    output = render_template("dashboard/register.html")
    if request.form.get("email"):
        output = redirect(url_for("index"))
        email = request.form.get("email")
        if request.form.get("password") != None:
            password = request.form.get("password")
        else:
            password = "******"
        exists = User.query.filter_by(email=email).first()
        if current_user.is_authenticated():
            user = User(
                nickname=request.form.get("username"),
                email=email,
                password=password,
                vpoints=0,
                email_confirmed=0,
                oauth_token=current_user.token,
                oath_secret=current_user.secret,
            )
        else:
            user = User(
                nickname=request.form.get("username"), email=email, password=password, vpoints=0, email_confirmed=0
            )

        # Now we'll send the email confirmation link
        subject = "Confirm your email"

        token = ts.dumps(user.email, salt="email-confirm-key")

        confirm_url = url_for("confirm_email", token=token, _external=True)

        html = render_template("dashboard/email/activate.html", confirm_url=confirm_url)

        if exists == None:
            db_session.add(user)
            db_session.commit()
            login_user(user, True)
            drill(user.email, subject, html)
        else:
            print "x is %s"
            db_session.merge(user)
            db_session.commit()
            login_user(user, True)
            output = redirect(url_for("index"))

    return output
Example #11
0
def stripe2():
    g.user = None
    form = xForm()
    form2 = signForm()
    team = None
    emailz = None
    output = render_template("fail.html")
    if 'user_id' in session:
        g.user = User.query.get(session['user_id'])
        if g.user != None:
            team = g.user.ptype
            emailz = g.user.email

    stripe_token = request.form['stripeToken']
    email = request.form['stripeEmail']
    if team == 1:
        amnt = 5
        print amnt
    else:
        amnt = 20
        print amnt
    try:
        charge = Charge.create(
                amount=int(amnt * 100),
                currency='usd',
                card=stripe_token,
                description=email)
        g.user.paid = 1
        db_session.commit()

        output = render_template('success.html')
        if team == 2:
            html = "<p>You will be receiving a friend request in steam from a user named xTcR | Tournament [IN]. You will need to accept this friend request to be verified on the date of the tournament.</p><p>The tournament will be on August 15th, 2015 at 1:00pm EST. You and your team will need to be in xTcR's teamspeak (ts3.xtcr.net > INS Tournament Waiting Room) 1 hour before the starting time in order to be verified.</p><p>*If you do not recieve a friend request from xTcR | Tournament [IN] please add the user here: http://steamcommunity.com/id/xtcr-tournament/ . You will not be able to be verified for the tournament if you skip this step.</p>"
        else:
            html = "<p>You will be receiving a friend request in steam from a user named xTcR | Tournament [IN]. You will need to accept this friend request to be verified on the date of the tournament.</p><p>The tournament will be on August 15th, 2015 at 1:00pm EST.  You will need to be in teamspeak (ts3.xtcr.net > INS Tournament Waiting Room) 1 and a half hours before the starting time to allow time for teaming up.</p><p>*If you do not recieve a friend request from xTcR | Tournament [IN] please add the user here: http://steamcommunity.com/id/xtcr-tournament/ . You will not be able to be verified for the tournament if you skip this step.</p>"
        drill(g.user.email,html)
    except stripe.CardError, e:
        return render_template("fail.html")
Example #12
0
def stripe():
    print '--- got stripe request ---'
    stripe.api_key = stripe_keys['secret_key']
    form = stripeform()
    output = render_template('stripe.html',
                             key=stripe_keys['publishable_key'],
                             form=form)
    if form.amount.data:
        drill("xTcR Donation", "Thanks for donating to xTcR!",
              request.form["stripeEmail"])
        #stripe.api_key = "sk_test_KBnACrVyXtFPcHyGTd5cot9D"

        customer = Customer.create(email=request.form["stripeEmail"],
                                   card=request.form['stripeToken'])

        charge = Charge.create(customer=customer.id,
                               amount=form.amount.data * 100,
                               currency='usd',
                               description='xTcR Donation')

        amnt = form.amount.data * 100
        custom = '0'
        if request.form.has_key('custom'):
            custom = str(request.form['custom'])

        cb_data = {
            #'app': 'donate',
            #'do': 'payment',
            #'gateway': '1',
            'mc_gross':
            float(charge['amount']) / 100,
            'mc_currency':
            charge['currency'],
            'custom':
            custom,
            'payment_status':
            'Completed'
            if charge['status'] == 'succeeded' else charge['status'],
            'business':
            charge['receipt_email'],
            'option_selection1':
            '',
            'option_selection2':
            '',
            'txn_id':
            charge['id'],
            'memo':
            'stripe',
            'fees': (float(charge['amount']) / 100) * 0.029 + 0.30,
            'item_name':
            str(request.form['item_name']),
            'item_number':
            str(request.form['item_number'])
        }

        r = requests.post(
            "http://192.3.130.131/index.php?app=donate&do=payment&gateway=1",
            data=cb_data)
        try:
            r = requests.get(
                "http://kc1.freebieservers.com/1/donate.php?name=%s&amount=%s"
                % (g.user.nickname, amnt))
            print r
            print r.url
        except:
            print "Server Down"

        print ' ----- '
        cmd("echo '%s' >> stripe.log" % r.text)

        output = redirect("http://xtcr.net/success.html")

    return output
Example #13
0
def apply():
    form = xForm()
    g.user = None
    email = None
    if 'user_id' in session:
        g.user = User.query.get(session['user_id'])
        if g.user is not None:
            email = g.user.email
        output = render_template('apps/index.html',username=g.user,form=form,email=email)
    else:
        output = render_template('apps/index.html',username=g.user,form=form,email=email)

    if form.ign.data != None:
        g.user.ign = form.ign.data
        g.user.email = form.email.data
        g.user.community = form.community.data
        g.user.age = form.age.data
        g.user.div = request.form.get('div')
        g.user.time = request.form.get('time')
        g.user.skills = request.form.get('skills')
        g.user.bio = request.form.get('bio')
        g.user.stuff = request.form.get('industries')
        g.user.disciplines = request.form.get('disciplines')
        g.user.status = "Pending"
        g.user.voteye = 0
        g.user.voteno = 0
        g.user.voted = "0"
        now = timenow()
        g.user.date = str(now)


        cs = '10'
        tf2 = '12'
        ins = '86'
        gmod = '59'
        se = '82'
        mc = '71'
        pr = '101'
        xy = None

        drill(g.user.nickname,g.user.email)
        db_session.commit()


        if g.user.div == 'Counter-Strike':
            xy = cs
        if g.user.div == 'Insurgency':
            xy = ins
        if g.user.div == 'Team Fortress 2':
            xy = tf2
        if g.user.div == 'Garrys Mod':
            xy = gmod
        if g.user.div == 'Minecraft':
            xy = mc
        if g.user.div == 'Space Engineers':
            xy = se
        if g.user.div == 'Public Relations':
            xy = pr


        r = requests.get("http://108.61.149.51/1/info.php?div=%s&name=%s&steam_id=%s"%(xy,g.user.ign,g.user.steam_id))
        print r
        print r.url
        output = render_template('apps/success.html',username=g.user,form=form)

    return output
Example #14
0
def apply():
    form = xForm()
    g.user = None
    email = None
    if "user_id" in session:
        g.user = User.query.get(session["user_id"])
        if g.user is not None:
            email = g.user.email
        output = render_template("apps/index.html", username=g.user, form=form, email=email)
    else:
        output = render_template("apps/index.html", username=g.user, form=form, email=email)

    if form.ign.data != None:
        g.user.ign = form.ign.data
        g.user.email = form.email.data
        g.user.community = form.community.data
        g.user.age = form.age.data
        g.user.div = request.form.get("div")
        g.user.time = request.form.get("time")
        g.user.skills = request.form.get("skills")
        g.user.bio = request.form.get("bio")
        g.user.stuff = request.form.get("industries")
        g.user.disciplines = request.form.get("disciplines")
        g.user.status = "Pending"
        g.user.voteye = 0
        g.user.voteno = 0
        g.user.voted = "0"
        g.user.flag = 3
        g.user.admin = 0
        now = timenow()
        g.user.date = str(now)

        cs = "10"
        tf2 = "12"
        ins = "86"
        gmod = "59"
        se = "82"
        mc = "71"
        pr = "101"
        ut = "114"
        ark = "119"
        chi = "120"
        xy = None

        drill(g.user.nickname, g.user.email)
        db_session.commit()

        if g.user.div == "Counter-Strike":
            xy = cs
        if g.user.div == "Insurgency":
            xy = ins
        if g.user.div == "Team Fortress 2":
            xy = tf2
        if g.user.div == "Garrys Mod":
            xy = gmod
        if g.user.div == "Minecraft":
            xy = mc
        # if g.user.div == 'Space Engineers':
        #     xy = se
        if g.user.div == "Public Relations":
            xy = pr
        if g.user.div == "Unturned":
            xy = ut
        if g.user.div == "ARK":
            xy = ark
        if g.user.div == "Chivalry":
            xy = chi

        try:
            r = requests.get(
                "http://kc1.freebieservers.com/1/info.php?div=%s&name=%s&steam_id=%s"
                % (xy, g.user.ign, g.user.steam_id)
            )
            print r
            print r.url
        except:
            print "Server Down"
        output = render_template("apps/success.html", username=g.user, form=form)

    return output