1. Connecting to Database
2. Login(Session Start)
3. Logout(Session End)
4. Session Check
5. Login Form
6. CSS
1. Connecting to Database
$DatabaseServer = "localhost";
$DatabaseUsername = "root";
$DatabasePassword = "root";
$DatabaseName = "demo";
$Connection = mysqli_connect($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName);
if ($Connection === false) {
die("ERROR: Could not connect. " . mysqli_connect_error());
}
2. Login
session_start();
if (isset($_POST['username']) and isset($_POST['password'])) {
$Username = $_POST['username'];
$Password = $_POST['password'];
$query = "SELECT * FROM `user` WHERE FirstName='$Username' and Password='$Password'";
$result = mysqli_query($Connection, $query) or die(mysqli_error($connection));
$count = mysqli_num_rows($result);
if ($count == 1) {
$_SESSION['username'] = $Username;
} else {
$fmsg = "Invalid Login Credentials.";
}
}
3. Logout
session_start();
session_destroy();
header('Location: login.php');
4. Session Check
if (isset($_SESSION['username'])) {
echo "<div class='session-box'>";
echo 'Welcome Mr.'.$Username = $_SESSION['username'];
echo "<br><a href='logout.php'>Logout</a>";
echo "</div>";
}else{
echo "<div class='session-box'>";
echo "You are logged out.";
echo "</div>";
}
5. Login Form
<form method="POST" class="login-box">
<div class="form-header">Please Login</div>
<div class="col-md-12">
<label>Username</label>
<input type="text" name="username" class="form-control" placeholder="Username" required>
</div>
<div class="col-md-12">
<label>Password</label>
<input type="password" name="password" class="form-control" placeholder="Password" required>
</div>
<div class="col-md-6">
<button class="btn btn-primary" type="submit">Login</button>
</div>
</form>
6.CSS
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<style>
.login-box{
position: absolute;
width: 300px;
height: 270px;
z-index: 15;
top: 50%;
left: 50%;
margin: -100px 0 0 -150px;
border: 1px solid #8080804a;
border-radius: 5px;
background: #8080804a;
}
.session-box{
position: absolute;
width: 300px;
height: 100px;
z-index: 15;
top: 10%;
left: 50%;
margin: 0px 0 0 -150px;
border: 1px solid #8080804a;
border-radius: 5px;
background: #8080804a;
padding: 30px;
}
.form-control{
padding: 10px;
margin-top: 5px;
}
.btn-primary{
margin-top: 20px;
}
.form-header{
width: 299px;
height:40px;
background: #004f61;
color:white;
text-align: center;
font-size: 20px;
margin-bottom: 20px;
padding: 5px;
}
</style>
</head>
Create Database Table
CREATE TABLE `user` (
`UserID` int(12) NOT NULL,
`FirstName` varchar(48) NOT NULL,
`LastName` varchar(48) NOT NULL,
`Email` varchar(128) NOT NULL,
`Password` varchar(20) NOT NULL,
`City` varchar(48) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `user` (`UserID`, `FirstName`, `LastName`, `Email`, `Password`, `City`) VALUES
(7, 'Rahul', 'Rajshekaran', 'Rahul@zzz.xxx', 'Rahul@123', 'Pune'),
(8, 'Mahesh', 'Krishna', 'Mahesh@xxx.xxx', 'Mahesh@123', 'Delhi');
Result
You can actively talk with our experts through Staples Chat Support. They will help you 24/7 to address all your device problems.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteBook Flights to Nashville. Get Cheap flights to Nashville Guaranteed on a huge option of flights deals to Nashville. Grab this attractive offer now.
ReplyDeleteHi there, just became aware of your blog through Google, and found that it's really informative. I’m going to watch out for brussels. I will be grateful if you continue this {in future}. Many people will be benefited from your writing. Cheers! nature's way Singapore
ReplyDeleteAir China Airlines Customer Service is available 24*7 to help you. Reach experts at Air China Airlines Customer Service Phone Number now for queries.
ReplyDeleteThis is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. app development services
ReplyDeleteWow! Thank you! I always needed to write on my website something like that. Can I implement a part of your post to my site? events backdrop
ReplyDeleteSweet blog! I found it while surfing around on Yahoo News. Do you have any suggestions on how to get listed in Yahoo News? I've been trying for a while but I never seem to get there! List of Accounting & Tax Companies in Singapore
ReplyDeleteIf you are QuickBooks user and getting QuickBooks error 2107 then you can read the post and fix it or Call Quickbooks Helpline Number 1-800-242-0792.
ReplyDeleteQuickBooks error 2107
Fix QuickBooks error
Quickbooks Helpline Number
Quickbooks Support Number
If you suddenly find yourself in Facebook jail and you don't even know how this happened, then here you will get detailed information on how to get yourself out of Facebook jail.
ReplyDeleteblocked from posting on Facebook
Facebook Jail
how long does Facebook block you
get out from Facebook Jail
Intuit has recommended some solutions which could correct the error with expert guidance from QuickBooks Error 15243 ProAdvisors. Stick to the resolution steps within the given sequence so your best results can be obtained.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteQuickBooks Error 6175 is an easy and trustworthy program for almost any business now each day. QuickBooks program can handle data that is employed by every business to produce their venture, track their records and in addition tracks their transaction.
ReplyDeleteThere are various other reasons as well that are mentioned below. Methods to resolve the QuickBooks Error 83 are mentioned you'll want to opt in accordance with the reason associated with problem.
ReplyDeleteUsing QuickBooks software, the user can simply create invoices in QuickBooks and invoice tax payments with the filing invoice tax returns of the organizations. So get proper and complete guidance on how to create many types of invoices by connecting to our amazing QuickBooks Support Phone Numberr services.
ReplyDeleteDespite being a technological invention, Big Data Analytics is an art that handled correctly can drive your business to success. Although it could be the most preferable and reliable way of taking important decisions there are challenges such as cultural barrier. data science course syllabus
ReplyDeleteAivivu - đại lý vé máy bay, tham khảo
ReplyDeletevé máy bay đi Mỹ
vé máy bay tết 2021 giá rẻ
giá vé máy bay đi toronto Canada
vé máy bay đi Pháp giá rẻ
giá vé máy bay từ Hà Nội đi Anh
vé máy bay giá rẻ uy tín
combo đà nẵng giá rẻ
combo quy nhơn tháng 7
visa trung quốc bao nhiêu ngày
Aivivu - đại lý vé máy bay, tham khảo
ReplyDeletevé máy bay đi Mỹ giá rẻ 2021
các chuyến bay từ mỹ về việt nam hiện nay
vé máy bay đi Los Angeles
chuyến bay thương mại từ canada về việt nam
Buy Online medicines without prescription, overnight delivery via FedEx at a discounted price in the United States. Top-quality Medicines
ReplyDeletebuy Percocet online
Order Xanax overnight delivery in USA
ReplyDeleteXanax is a medicine used to treat anxiety, panic disorders and depression induced anxiety. It is known to produce a calming effect on the brain and the nerves by normalizing the imbalance in certain nerves. It works on by reducing nervousness and thus improves energy levels as well. Misuse of this drug can lead to addiction, overdose & even death in some cases due to complications hence it is really necessary to read all about it before you buy xanax online for use.
Visit - Tramadol100mg.org
Order - Buy Xanax Online
Oxycodone is a synthetic opioid used for the treatment of mild to moderate pain. This opioid is used for around the clock treatment of pain and should not be used otherwise or it can prove to be very severe. Misuse of this medication may result in drug dependency.
ReplyDeleteBuy Xanax Online
Buy Adderall Online
Buy Oxycodone Online
ReplyDeleteOnline Medz Pharmacy is a website that provides various types of medications. We help the persons who are suffering from some severe diseases like sleep disorder, ADHD, Weight loss, pain relief and anxiety disorder by providing them Xanax, Vicodin, Tramadol, and other drugs. We have all types of Generics and brands of medications with several strengths.
Ambien 10mg Online
Buy Methadone Online
Buy Oxycontin Online
Buy Percocet Online
Buy Adderall Online
Buy Xanax Online
ReplyDeleteOnline Medz Pharmacy is a website that provides various types of medications. We help the persons who are suffering from some severe diseases like sleep disorder, ADHD, Weight loss, pain relief and anxiety disorder by providing them Xanax, Vicodin, Tramadol, and other drugs. We have all types of Generics and brands of medications with several strengths.
Buy Ativan 1mg Online
Buy Oxycontin Online
Buy Percocet Online
Buy Adderall Online
Buy Xanax Online
Medical Pharmacy USA
ReplyDelete* No Prescription Required (NO RX)
* Buy Direct and Save Time with Cryptocurrency
* Reshipment is offered if the package does not get to location or refunds
* High-Quality Pharmacy Grade Medicines.
* Best and Affordable prices
Buy Adderall Online | Buy Alprazolam 2mg Online | Buy Ambien 10mg Online | Buy Ativan Online Overnight Delivery | Buy Cheap Carisoprodol Online | Diazepam for Sale USA | Buy generic Fioricet Online | Best Place to Buy hydrocodone Online | Buy Lortab Online Legally | Buy Soma pills Online | Buy Cheap Xanax Online
Buy Medicine Online
Welcome to Research Chem Lab We are USA and Euro based company specializing in retails wholesale distribution of the best pain medications. Note: We don’t manufacture this products we buy them from a network of highly qualify and trusted manufacturers.
ReplyDeletebuy xanax 2mg online, buy Xanax online,Xanax For Sale On The Internet, Xanax For Sale
buy adderall 30mg online
buy rohypnol 2mg online
buy Valium 10mg online
buy percocet online
buy hydrocodone online
buy oxycodone online
buy klonopin online
Great with detailed information. It is really very helpful for us.
ReplyDeleteVillage Talkies a top-quality professional corporate video production company in Bangalore and also best explainer video company in Bangalore & animation video makers in Bangalore, Chennai, India & Maryland, Baltimore, USA provides Corporate & Brand films, Promotional, Marketing videos & Training videos, Product demo videos, Employee videos, Product video explainers, eLearning videos, 2d Animation, 3d Animation, Motion Graphics, Whiteboard Explainer videos Client Testimonial Videos, Video Presentation and more for all start-ups, industries, and corporate companies. From scripting to corporate video production services, explainer & 3d, 2d animation video production , our solutions are customized to your budget, timeline, and to meet the company goals and objectives.
As a best video production company in Bangalore, we produce quality and creative videos to our clients.
buy vicodin online is a combination of a narcotic and acetaminophen used to relieve moderate to severe pain. Buy Vicodin Online
ReplyDeleteBuy Lortab Online from Safemedionline Pharmacy the best online pharmacy and enjoy the best quality drugs you could ever have. Buy Lortab Online
ReplyDelete