Sunteți pe pagina 1din 18

Home.

html

<html>

<head> {% load static %}

<title>The Capital Hill </title>

<link rel= "stylesheet" href= " { % static 'css/style.css '% } " >

</head>

<body>

<div class= "main-section" >

<nav class= " navbar navbar-expand-lg navbar-dark ftco navbar bg-dark ftco-navbar-light " >

<div class="container">

<a class="navbar-brand" href="book">Book Here</a>

<div class="collapse navbar-collapse" id="ftco-nav">

<ul class="navbar-nav ml-auto">

<li class="dropdown nav-item">

<a href="#" class="dropdown-toggle nav-link icon d-flex align-items-center">

<i class="ion-ios-apps mr-2"> </i>More<b class="caret"> </b> </a> </li>

<li class="nav-item cta"><a href="#" class="nav-link icon d-flex align-items-center">

<i class=" mr-2"></i>Contact Us</a></li></ul> </div> </div> </nav>

<section class="hero-wrap" style="background-image: url({% static 'images/bg_12.jpg' %});">

<div class="overlay"></div>

<div class="container">

<div class="row description align-items-center justify-content-center">

<div class="col-md-8 text-center">

<div class="text">

<h2 > Welcome to Capital Hill</h2>

<h4 class="mb-5"> A Chest Of The Best Hotels In The World. </h4>

<p><a href="login" class="btn btn-primary btn-round px-5 py-4 mb-2">

<i class="mr-2"> </i> Login </a> <a href= "sign_up" class= "btn btn-dark px-5 btn-round py-4 mb-2">

<i class=" mr-2"></i> Signup </a> </p> </div> </div> </div> </div>

</section>

</body>

</html>
Sign_up.html

<html lang="en">

<head>

<title>Signup Here</title>

{% load static %}

<link rel="stylesheet" type="text/css" href= "{ % static 'css1/util.css ' % }">

<link rel="stylesheet" type="text/css" href= "{ % static 'css1/main.css' % }">

</head>

<body>

<div class="limiter">

<div class="container-login100">

<div class="login100-more" style="background-image: url('{% static 'images/bg-011.jpg' %}');"></div>

<div class="wrap-login100 p-l-50 p-r-50 p-t-72 p-b-50">

<form class="login100-form validate-form" action="signup" method="post"> { % csrf_token % }

<span class="login100-form-title p-b-59"> Sign Up </span>

<div class="wrap-input100 validate-input">

<span class="label-input100"> First Name </span>

<input class="input100" type="text" name="fname" placeholder="FirstName..." required/>

<span class="focus-input100"></span></div>

<div class="wrap-input100 validate-input">

<span class="label-input100">Last Name</span>

<input class="input100" type="text" name="lname" placeholder="LastName..." required/>

<span class="focus-input100"></span></div>

<div class="wrap-input100 validate-input">

<span class="label-input100">Email</span>

<input class="input100" type="text" name="email" placeholder="Email addess..." required/>

<span class="focus-input100"></span></div>

<div class="wrap-input100 validate-input">

<span class="label-input100">Phone Number</span>

<input class="input100" type="text" name="phn" placeholder="Phone number..." required/>


<span class="focus-input100"></span></div>

<div class="wrap-input100 validate-input">

<span class="label-input100">Password</span>

<input class="input100" type="password" name="psw" placeholder="*************" required/>

<span class="focus-input100"></span></div>

<div class="wrap-input100 validate-input">

<span class="label-input100">Repeat Password</span>

<input class="input100" type="password" name="psw-repeat" placeholder="*************"required/>

<span class="focus-input100"></span></div>

<div class="flex-m w-full p-b-33">

<div class="contact100-form-checkbox">

<input class="input-checkbox100" id="ckb1" type="checkbox" name="remember-me">

<label class="label-checkbox100" for="ckb1">

<span class="txt1">I agree to the <a href="#" class="txt2 hov1">Terms of User</a></span></label></div></div>

<div class="container-login100-form-btn">

<div class="wrap-login100-form-btn">

<div class="login100-form-bgbtn"></div>

<button class="login100-form-btn" type="submit">Sign Up</button></div>

<a href="login">Login<i class="fa fa-long-arrow-right m-l-5"></i></a></div>

</form></div></div></div>

</body>

</html>
Login.html

<html lang="en">

<head> {% load static %}

<title>Login Here</title>

<link rel="stylesheet" type="text/css" href="{%static 'fonts/font-awesome-4.7.0/css/font-


awesome.min.css'%}">

<link rel="stylesheet" type="text/css" href="{%static 'fonts/iconic/css/material-design-iconic-


font.min.css'%}">

<link rel="stylesheet" type="text/css" href="{% static 'vendor/animate/animate.css'%}">

<link rel="stylesheet" type="text/css" href="{% static 'vendor/select2/select2.min.css'%}">

<link rel="stylesheet" type="text/css" href="{% static 'css/util.css'%}">

<link rel="stylesheet" type="text/css" href="{% static 'css/main.css'%}">

</head>

<body>

<div class="limiter">

<div class="container-login100" style="background-image: url('{% static 'images/bg-01.jpg' %}');">

<div class="wrap-login100">

<form class="login100-form validate-form" action="logged_in" method="post">

{%csrf_token %}

<span class="login100-form-logo">

<i class="zmdi zmdi-landscape"></i></span>

<span class="login100-form-title p-b-34 p-t-27">Log in</span>

<div class="wrap-input100 validate-input">

<input class="input100" type="text" name="uname1" placeholder="Username">

<span class="focus-input100" data-placeholder="&#xf207;"></span></div>

<div class="wrap-input100 validate-input">

<input class="input100" type="password" name="psw1" placeholder="Password">

<span class="focus-input100 btn-show-pass" data-placeholder="&#xf191;"></span></div>

<div class="contact100-form-checkbox">

<input class="input-checkbox100" id="ckb1" type="checkbox" name="remember-me">

<label class="label-checkbox100" for="ckb1">Remember me</label></div>

<div class="container-login100-form-btn">

<button class="login100-form-btn" type="submit">Login</button></div>


<div class="text-center p-t-57 p-b-20">

<span class="txt1">Or login with</span></div>

<div class="flex-c p-b-112">

<a href="#" class="login100-social-item">

<i class="fa fa-facebook-f"></i></a>

<a href="#" class="login100-social-item">

<img src="{% static 'images/icon-google.png' %}" alt="GOOGLE"></a></div>

<div class="text-center p-t-90">

<a class="txt1" href="forgot">Forgot Password?</a></div>

</form><</div></div></div>

</body>

</html>
Book.html

<html >

<head>{% load static %}

<title>Book Here</title>

<link type="text/css" rel="stylesheet" href=" {% static 'css1/style.css' %} " />

<link type='text/css' rel='stylesheet' href=" {% static 'css1/bootstrap.min.css' %}"/>

</head>

<body> <div id="booking">

<div class="booking-form"><div class="form-header">

<h1>Make your reservation</h1></div>

<form action ='booked' method='post'> {% csrf_token %}

<div class="row"> <div class="col-md-6"><div class="form-group">

<input class="form-control" type="text" placeholder="Firstname" name ='fname' required></div></div>

<div class="col-md-6"><div class="form-group">

<input class="form-control" type="text" placeholder="Lastname" name='lname' required></div></div></div>

<div class='row'><div class="col-md-6"><div class="form-group">

<input class="form-control" type="text" placeholder="State & Country" name='state' required></div></div>

<div class="form-group"><div class="col-md-6">

<input class="form-control" type="text" placeholder="City" name='city' required></div></div></div>

<div class='row'><div class='col-md-6'><div class="form-group">

<input class="form-control" type="text" placeholder="Address..." name='add' required></div></div>

<div class='col-md-6'><div class="form-group">

<input class="form-control" type="text" placeholder="Zip-code" name='zp'required></div></div></div>

<div class="row"><div class="col-md-6"><div class="form-group">

<input class="form-control" type="email" name='email' placeholder="Your Email">

<span class="form-label">Email</span></div></div>

<div class="col-md-6"><div class="form-group">

<input class="form-control" type="tel" name='phn' placeholder="Phone Number"></div></div></div>

<div class="row"><div class="col-md-6"><div class="form-group">

<input class="form-control" type="date" name='cind' required>

<span class="form-label"> Check In </span> </div> </div>

<div class="col-md-6"> <div class="form-group">


<input class="form-control" type="date" name='coud' required>

<span class="form-label"> Check out </span> </div> </div> </div>

<div class="row"><div class="col-md-4"><div class="form-group">

<input class="form-control" type="text" placeholder="No. of Adults" name='nofa' required></div></div>

<div class="col-md-4"><div class="form-group">

<input class="form-control" type="text" placeholder="No. of Children" name='nofc' required></div></div>

<div class="col-md-4"><div class="form-group"><div class="form-group">

<input class="form-control" type="text" placeholder="No. Of Rooms (At Max. 5)" name='rooms'


required></div>

</div></div></div>

<div class="row"><div class="col-md-4"><div class="form-group">

<select class="form-control" required name='rt1'>

<option value="" selected hidden>Room-1 Type</option>

<option value="SBNAC">1. Single Bed Non-AC @ $49</option>

<option value="SBAC">2. Single Bed AC @ $79</option>

<option value="DBNAC">3. Double Bed Non-AC $99</option>

<option value="DBAC">4. Double Bed AC @ $120</option> </select> </div> </div>

<div class="col-md-4"><div class="form-group">

<select class="form-control" name='rt2'>

<option value="" selected hidden>Room-2 Type</option>

<option value="SBNAC">1. Single Bed Non-AC @ $49</option>

<option value="SBAC">2. Single Bed AC @ $79</option>

<option value="DBNAC">3. Double Bed Non-AC $99</option>

<option value="DBAC">4. Double Bed AC @ $120</option> </select> </div> </div>

<div class="col-md-4"><div class="form-group">

<select class="form-control" name='rt3'>

<option value="" selected hidden>Room-3 Type</option>

<option value="SBNAC">1. Single Bed Non-AC @ $49</option>

<option value="SBAC">2. Single Bed AC @ $79</option>

<option value="DBNAC">3. Double Bed Non-AC $99</option>

<option value="DBAC">4. Double Bed AC @ $120</option> </select> </div> </div> </div>

<div class="form-btn"><button class="submit-btn">Book Now</button></div></form>

</form>

</body>

</html>
Logged_in.html
<html>

<head> {% load static %}

<link rel='stylesheet' href= "{% static 'css/sty.css' %}">

<title> Welcome </title>

</head>

<div style="text-align :center">

<body> <h1>You Have Logged In Successfully </h1> </body>

To Book A Room, Click On The button below :- <br> <br>

<a href="book" target="_self">CLick On This To Visit The Booking Page</a>

<h1> -----OR----- </h1>

Click On The Link Below To Check Your Booking History <br> <br>

<a href="#" target="_self">Click Here To Check History </a> </div>

</html>

Signup.html
<html>

<head>

<title> Successfully Signed Up </title>

</head>

<div style= " text – align : center ; font-family:Lucida sans; " >

<strong> Your Data Has Been Successfully Added To Our Server . Please Go To The <a href ="login"

target="_self">Login Page</a> And Login To Continue. </strong>

</html>

Forgot.html
<head>

<title> FORGOT PASSWORD </title>

<body>

<h1 style = " color : black ">Sorry Can't Do Anything For Your Mistake</>

<p>GO BACK TO THE <a href="home" style=" color : dodgerblue " > HOME PAGE </a> TO SIGNUP AGAIN BY NEW
CREDENTIALS</p></body>
Log_error.html
<html>

<head>

<title> Unsuccessful LOGIN </title>

</head>

<div style="text-align: center ; font-family:Lucida sans;">

<strong> The Data You Entered Didn't Match Any Of Our Records. Please Go Back To The

<a href ="login" target="_self">Login Page </a> And Re-Try .

</strong>

</html>

Email_error.html
<html>

<head>

<title>Unsuccessful Sign Up</title>

</head>

<div style= " text-align : center ; font-family:Lucida sans; " >

<strong> The E-mail You Entered Already Exists . Please Go Back To The

<a href ="sign_up" target="_self">Signup Page</a> And Try With A

Different E-mail .

</strong>

</html>

Error.html
<html>

<head>

<title>Unsuccessful Sign Up</title>

</head>

<div style= " text – align : center ; font-family:Lucida sans;">

<strong> The Passwords You Entered Didn't Match . Please Go Back To The

<a href ="sign_up" target="_self"> Signup Page </a> And Re-enter The Details .

</strong>

</html>
Booked.html
<html>

<head>{% load static %}

<title>Booking Successful</title>

<link rel="stylesheet" href="{% static 'css/style.css'%}">

</head>

<body>

<section class="hero-wrap" style="background-image: url({% static 'images/bg_1.jpg' %});">

<div class="row description align-items-center justify-content-center">

<div class="col-md-8 text-center">

<div class="text">

<h2 class='mb-5'>Thank You For Booking With Us</h2>

<h3 class="mb-5">Please Visit Again.</h3>

</section>

</body>

</html>
Urls.py
from django.contrib import admin

from django.urls import path

from login import views

urlpatterns = [

path('home', views.home),

path('login',views.login),

path('logged_in', views.logged_in),

path('sign_up',views.sign_up),

path("signup",views.signup),

path("forgot",views.forgot),

path("book/",views.book),

path("book/booked",views.booked)

Settings.py
(Only Changed Parts Shown)

INSTALLED_APPS = [

'django.contrib.admin',

'django.contrib.auth',

'django.contrib.contenttypes',

'django.contrib.sessions',

'django.contrib.messages',

'django.contrib.staticfiles',

'login',

]
TEMPLATES = [

'BACKEND': 'django.template.backends.django.DjangoTemplates',

'DIRS': ['templates'],

'APP_DIRS': True,

'OPTIONS': {

'context_processors': [

'django.template.context_processors.debug',

'django.template.context_processors.request',

'django.contrib.auth.context_processors.auth',

'django.contrib.messages.context_processors.messages',

],

},

},

STATIC_URL = '/static/'

Views.py

from django.shortcuts import render

import mysql.connector as sqltor

mycon=sqltor.connect(host="localhost",user="root",passwd="sql",database="hotel")

cursor=mycon.cursor()

def home(request):

return render (request,"home.html")

def login(request):

return render (request,"login.html")

def sign_up(request):

return render(request,"sign_up.html")
def forgot(request):

return render(request,"forgot.html")

def signup(request):

d=request.POST

email=d['email']

st1="SELECT email from signup WHERE email LIKE '{}'".format(email)

cursor.execute(st1)

data=cursor.fetchall()

for email in data:

return render (request,'email_error.html')

else:

if d['psw']==d['psw-repeat']:

st="INSERT INTO signup(firstname,lastname,email,phone,password)VALUES('{}','{}','{}','{}','{}')"\

.format(d['fname'],d['lname'], d['email'],d['phn'],d['psw'])

cursor.execute(st)

mycon.commit()

return render(request,'signup.html')

else:

return render(request,'error.html')

def logged_in(request):

d=request.POST

s="SELECT email,password, phone FROM signup WHERE email LIKE '{}' && password LIKE

'{}'".format(d['uname1'],d['psw1'])

cursor.execute(s)

data=cursor.fetchall()

for (a,b,phn) in data:

break

count=cursor.rowcount

if count==1:

st="INSERT INTO login_info VALUES('{0}', NOW(),'{1}')".format(d['uname1'],phn)

cursor.execute(st)

mycon.commit()

return render(request,"logged_in.html")
else:

return render(request,"log_error.html")

def book(request):

return render(request,"book.html")

def booked(request):

d=request.POST

c="SELECT customer_id FROM reservation_info"

cursor.execute(c)

data=cursor.fetchall()

cid=cursor.rowcount

s="INSERT INTO reservation_info VALUES

('{}','{}','{}','{}','{}','{}','{}','{}','{}','{}','{}','{}')".format(d['fname'],d['lname'],d['add'],d['city'],d['zp']\

,d['state'],d['email'],d['phn'],d['rt1'],d['rt2'],d['rt3'],cid)

s1="INSERT INTO date_info VALUES('{}','{}','{}')".format(d['cind'],d['coud'],cid)

s2="INSERT INTO booking_info VALUES('{}','{}','{}','{}')".format(d['nofa'],d['nofc'],d['rooms'],cid)

cursor.execute(s)

mycon.commit()

cursor.execute(s1)

mycon.commit()

cursor.execute(s2)

mycon.commit()

return render(request,'booked.html')
SQL-TABLES

S-ar putea să vă placă și