ftp.techwiz.altervista.org Open in urlscan Pro
78.46.128.136  Public Scan

URL: https://ftp.techwiz.altervista.org/
Submission: On August 05 via api from US — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

from flask import Flask, render_template, redirect, url_for, request, flash
from datetime import datetime
from flask_bootstrap import Bootstrap
from database import Base, Computer 
from wtforms import BooleanField, SelectField, EmailField, StringField, IntegerField, SubmitField
from flask_wtf import FlaskForm
from wtforms.validators import DataRequired

from database import Computer, Base 
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import Column, Integer, String, Boolean 
from sqlalchemy.orm import DeclarativeBase 
import os

import time

app = Flask(__name__)
Bootstrap(app)
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///computer.db"
SECRET_KEY= os.urandom(32)
app.config["SECRET_KEY"] = SECRET_KEY

db = SQLAlchemy(model_class=Base)
db.init_app(app)


with app.app_context():
    db.create_all()

class Software(FlaskForm):
    email = EmailField(label="Email")
    typ = SelectField(label="Type of app", choices=[("Software Desktop GUI", "Software Desktop GUI"), ("Website", "Website"), ("Data Science", "Data Science"), ("AI", "AI"), ("Bot", "Bot")])
    name = StringField(label="Name")
    description = StringField(label="Description")
    submit = SubmitField(label="Enter")
    
class Hardware(FlaskForm):
    email = EmailField(label="Email")
    cpuType = SelectField(label="Cpu Type", choices=[("Intel", "Intel"), ("AMD", "AMD")])
    cpuName = StringField(label="Cpu Name")
    cpuFrequency = IntegerField(label="Cpu Frequency (Mhz)")
    cpuCore = IntegerField(label="Cpu Core")
    
    gpuType = SelectField(label="Gpu Type", choices=[("Nvidia", "Nvidia"), ("AMD", "AMD")])
    gpuName = StringField(label="Gpu Name")
    gpuFrequency = IntegerField(label="Gpu Frequency (Mhz)")
    
    ramType = SelectField(label="Ram Type", choices=[("DDR4", "DDR4"), ("DDR5", "DDR5")])
    ramName = StringField(label="Ram Name")
    ramFrequency = IntegerField(label="Ram Frequency (Mhz)")
    
    submit = SubmitField(label="Enter")

class BottleNeck(FlaskForm):
    email = EmailField(label="Email")
    cpuFrequency = IntegerField(label="Cpu Frequency (Mhz)")
    gpuFrequency = IntegerField(label="Gpu Frequency (Mhz)")
    submit = SubmitField(label="Enter")
    

@app.route("/")
def home():
    date = datetime.now()
    year = date.year
    wb = "Techwiz"
    return render_template("index.html", date=year, website=wb)

@app.route("/select", methods=["GET", "POST"])
def select():
    softwareForm = Software()  
    hardwareForm = Hardware() 

            
    if softwareForm.validate_on_submit():
                email = softwareForm.email.data
                typ = softwareForm.typ.data
                name = softwareForm.name.data
                description = softwareForm.description.data
                
                print(typ)

                new_computer = Computer(email=email, type=typ, name=name, description=description)
                db.session.add(new_computer)
                db.session.commit()
            
            # return redirect(url_for("home"))
            
    if hardwareForm.validate_on_submit():
                
                email = hardwareForm.email.data
                cpuType = hardwareForm.cpuType.data
                cpuName = hardwareForm.cpuName.data
                cpuFrequency = hardwareForm.cpuFrequency.data
                cpuCore = hardwareForm.cpuCore.data
                
                gpuType = hardwareForm.gpuType.data
                gpuName = hardwareForm.gpuName.data
                gpuFrequency = hardwareForm.gpuFrequency.data
                
                ramType = hardwareForm.ramType.data
                ramName = hardwareForm.ramName.data
                ramFrequency = hardwareForm.ramFrequency.data
                
                print(cpuType)
                
                new_computer = Computer(email=email, cpuType=cpuType,cpuName=cpuName, cpuFrequency=cpuFrequency, cpuCore=cpuCore, gpuType=gpuType, gpuName=gpuName, gpuFrequency=gpuFrequency, ramType=ramType, ramName=ramName, ramFrequency=ramFrequency)
                db.session.add(new_computer)
                db.session.commit()
                
            # return redirect(url_for("home"))
    return render_template("select.html", software=softwareForm, hardware=hardwareForm)

@app.route("/about")
def about():
    return render_template("about.html")

@app.route("/bottleneck", methods=["GET", "POST"])
def bottleneck():
    form = BottleNeck()
    email = form.email.data
    
    
    
    if form.validate_on_submit():
        content = db.session.query(Computer).where(Computer.email == email).one_or_none()
        
        if content and content.cpuFrequency != None and content.gpuFrequency != None:
            cpuFrequency = form.cpuFrequency.data
            gpuFrequency = form.gpuFrequency.data
            
            bottle_neck = (cpuFrequency / gpuFrequency) / 10
            
            content.bottleNeck=bottle_neck
            flash(f"Bottle Neck: {bottle_neck}%")
            db.session.commit()
            
            
            
        elif not content:
            # flash("Email not found in the database, please insert your email in the page Product!")
            # time.sleep(3)
            # return redirect(url_for("select"))
            cpuFrequency = form.cpuFrequency.data
            gpuFrequency = form.gpuFrequency.data
            
            bottle_neck = (cpuFrequency / gpuFrequency) / 10
            
            new_computer = Computer(email=email, bottleNeck=bottle_neck)
            db.session.add(new_computer)
            flash(f"Bottle Neck: {bottle_neck}%")
            db.session.commit()

        
    
    return render_template("bottleneck.html", bottleneck=form)


@app.route("/courses")
def courses():
    return render_template("courses.html")

if __name__ == "__main__":
    app.run(debug=True)