Skip to content

Commit

Permalink
Some Python files
Browse files Browse the repository at this point in the history
  • Loading branch information
AnkitMajee authored Aug 2, 2022
1 parent dba9408 commit 3cab1d7
Show file tree
Hide file tree
Showing 8 changed files with 910 additions and 0 deletions.
52 changes: 52 additions & 0 deletions contact.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!"C:/Users/Rahul1234/anaconda3/python.exe"
import cgi
import mysql.connector as conn
def htmlTop():
print("""Content-type:text/html\n\n
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta HTTP-EQUIV="REFRESH" content="3; url=index.html">
<title>Form Submit</title>
</head>
<body>""")

def htmlTail():
print("""</body>
</html>""")

def getData():
formData = cgi.FieldStorage()
name = formData.getvalue('Name')
eid = formData.getvalue('Email')
msg = formData.getvalue('Message')
return name,eid,msg

def connectDB():
db = conn.connect(host='localhost',user='root',passwd='',db='kph')
cursor = db.cursor()
return db,cursor

def createUserList(name,eid,msg):
user = []
user.append([name,eid,msg])
return user
def insertUser(db,cursor,user):
for each in user:
sql = "insert into contact(name,emailid,message) values('{0}','{1}','{2}')".format(each[0],each[1],each[2])
cursor.execute(sql)
db.commit()

if __name__ == "__main__":
try:
htmlTop()
db,cursor = connectDB()
name,eid,msg = getData()
user = createUserList(name,eid,msg)
insertUser(db,cursor,user)
print("<h1>Thank You for Contacting Us</h1><h2>Redirecting You to Home Page...</h2>")
htmlTail()
except:
cgi.print_exception()

191 changes: 191 additions & 0 deletions coupon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
#!"C:/Users/Rahul1234/anaconda3/python.exe"
import cgi
import mysql.connector as conn
db = conn.connect(host='localhost',user='root',passwd='',db='kph')
cursor = db.cursor()
print("""Content-type:text/html\n\n
<!DOCTYPE html>
<html lang="en">
<head>
<title>Kolkata Pizza Hub | Coupons</title>
<link rel="shortcut icon" href="images/favicon.png" type="image/x-icon">
<!-- for-mobile-apps -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="Kolkata Pizza Hub" />
<script type="application/x-javascript">
addEventListener("load", function() {
setTimeout(hideURLbar, 0);
}, false);
function hideURLbar() {
window.scrollTo(0, 1);
}
</script>
<!-- //for-mobile-apps -->
<link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/font-awesome.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<!--web-fonts-->
<link href="//fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet">
<link href="//fonts.googleapis.com/css?family=Lato:300,400,700" rel="stylesheet">
<link href="//fonts.googleapis.com/css?family=Tangerine:400,700" rel="stylesheet">
<link href="css/carousel.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!-- banner -->
<div class="banner inner-bg-w3" id="home">
<!-- header -->
<div class="banner-top">
<div class="social-bnr-agileits">
<ul>
<li><a href="#"><i class="fa fa-facebook" aria-hidden="true"></i></a></li>
<li><a href="#"><i class="fa fa-twitter" aria-hidden="true"></i></a></li>
<li><a href="#"><i class="fa fa-google-plus" aria-hidden="true"></i></a></li>
<li><a href="#"><i class="fa fa-linkedin" aria-hidden="true"></i></a></li>
</ul>
</div>
<div class="contact-bnr-w3-agile">
<ul>
<li><i class="fa fa-envelope" aria-hidden="true"></i><a href="mailto:[email protected]">[email protected]</a></li>
<li><i class="fa fa-phone" aria-hidden="true"></i>+91 (033)733-33-33</li>
<li>
<div class="search">
<input class="search_box" type="checkbox" id="search_box">
<label class="icon-search" for="search_box"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></label>
<div class="search_form">
<form action="#" method="post">
<input type="search" name="Search" placeholder="Search..." required="" />
<input type="submit" value="Send" />
</form>
</div>
</div>
</li>
</ul>
</div>
<div class="clearfix"></div>
</div>
<header>
<div class="container">
<!-- navigation -->
<div class="w3_navigation">
<nav class="navbar navbar-default">
<div class="navbar-header navbar-left">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="w3_navigation_pos">
<h1 style="text-align: center"><a href="index.html"><span>K</span>olkata <span>P</span>izza<br><span>H</span>ub</a></h1>
</div>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-right" id="bs-example-navbar-collapse-1">
<nav class="menu menu--miranda">
<ul class="nav navbar-nav menu__list">
<li class="menu__item"><a href="index.html" class="menu__link">Home</a></li>
<li class="menu__item"><a href="index.html#about" class=" menu__link">About</a></li>
<li class="menu__item"><a href="index.html#particles-js" class=" menu__link">Services</a></li>
<li class="menu__item menu__item--current"><a href="gallery.html" class=" menu__link">Gallery</a></li>
<li class="dropdown menu__item">
<a href="#" class="dropdown-toggle menu__link" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Offer<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="coupon.py">Coupon Codes</a></li>
<li><a href="coupon.py">Everyday Value</a></li>
</ul>
</li>
<li class="menu__item"><a href="index.html#contact" class=" menu__link">Contact</a></li>
</ul>
</nav>
</div>
</nav>
</div>
<div class="clearfix"></div>
<!-- //navigation -->
</div>
</header>
<!-- //header -->
</div>
<!-- Carousel
================================================== -->
<div class="introSection">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1 class="cntr">We are launching complete online food order system for restaurent and takeaway Only at the rate <br>&#8377;195 </h1>
</div>
</div>
</div>
</div>
<div class="container marketing">
<h2 class="itemsTitle">Best Buy Coupons</h2>
<div id="myCarousel1" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<div class="carousel-inner">
<div class="item active">
<div class="row">""")
sql='select * from coupon LIMIT 3'
cursor.execute(sql)
coupon=cursor.fetchall()
for each in coupon:
print(""" <div class="col-lg-4">
<img src="images/coupon.jpg" alt="Coupon Code" style="height: auto;width: 70%">
<h4>{0}</h4>
<p><a class="btn btn-default" href="#" rtitle="Copy the Code" data-toggle="popover" data-content="{1}">Copy &raquo;</a></p>
</div>""".format(each[0],each[1]))
print(""" </div></div>""")
sql='select * from coupon LIMIT 3,9'
cursor.execute(sql)
coupon=cursor.fetchall()
c = 0
for each in coupon:
#print(str(each))
if c%3==0:

print("""<div class="item">
<div class="row">""")
print(""" <div class="col-lg-4">
<img src="images/coupon.jpg" alt="Coupon Code" style="height: auto;width: 70%">
<h4>{0}</h4>
<p><a class="btn btn-default" href="#" title="Copy the Code" data-toggle="popover" data-content="{1}">Copy &raquo;</a></p>
</div>""".format(each[0],each[1]))
if c%3 ==2 :
print("""</div></div>""")
c+=1

print("""</div>
<a class="left carousel-control" href="#myCarousel1" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
<a class="right carousel-control" href="#myCarousel1" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
</div>
<!-- /.carousel -->
</div>
<!-- FOOTER -->
<footer>
<div class="copyright-wthree">
<p>&copy; 2017 Kolkata Pizza Hub . All Rights Reserved | Made with &hearts; in India</p>
</div>
</footer>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/holder.js"></script>
<script>
$(document).ready(function() {
$('[data-toggle="popover"]').popover();
});
</script>
</body>
</html>""")
Loading

0 comments on commit 3cab1d7

Please sign in to comment.