<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<!--start login-->
<?php
session_start();
$db=mysqli_connect("localhost","ani","123","anirudha");
if (isset($_POST['login'])){
$email=$_POST['email'];
$pword=$_POST['pass'];
//$s="SELECT * FROM register WHERE username='$email' AND password='$pword'";
$s = "INSERT INTO register (username, password)VALUES('$email', '$pword')";
$sq=mysqli_query($db,$s);
//$row_count=mysqli_num_rows($db,$sq);
//if ($row_count==1) {
echo "Login success";
header("location:home.php");
}
?>
<!--end login-->
<!--start register-->
<?php
// initializing variables
$errors = array();
// connect to the database
$db = mysqli_connect('localhost', 'ani', '123', 'anirudha');
// REGISTER USER
if (isset($_POST['registration'])) {
// receive all input values from the form
$username = mysqli_real_escape_string($db, $_POST['username']);
$password = mysqli_real_escape_string($db, $_POST['password']);
// form validation: ensure that the form is correctly filled ...
// by adding (array_push()) corresponding error unto $errors array
if (empty($username)) { array_push($errors, "Username is required"); }
if (empty($password)) { array_push($errors, "Password is required"); }
/*if (empty($password_1)) { array_push($errors, "Password is required"); }
if ($password_1 != $password_2) {
array_push($errors, "The two passwords do not match");
}*/
// first check the database to make sure
// a user does not already exist with the same username and/or email
$user_check_query = "SELECT * FROM `login` WHERE `username`='$username' LIMIT 1";
$result = mysqli_query($db, $user_check_query);
$user = mysqli_fetch_assoc($result);
if ($user) { // if user exists
if ($user['username'] === $username) {
array_push($errors, "Username already exists");
}
}
// Finally, register user if there are no errors in the form
if (count($errors) == 0) {
$password = md5($password);//encrypt the password before saving in the database
$query = "INSERT INTO `login` (username, password)
VALUES('$username', '$password')";
mysqli_query($db, $query);
$_SESSION['username'] = $username;
$_SESSION['success'] = "You are now logged in";
echo "<script>alert('Inserted');</script>";
/*header('location: login.php');*/
}
}
for($i=0;$i<count($errors);$i++){
echo $errors[$i];
}
?>
<!--end register-->
<!--start different login code -->
<?php
$con=mysqli_connect("localhost","ani","123","anirudha");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// escape variables for security
$firstname = mysqli_real_escape_string($con, $_POST['username']);
$lastname = mysqli_real_escape_string($con, $_POST['password']);
$sql="INSERT INTO login (username, password)
VALUES ('$firstname', '$lastname')";
if (!mysqli_query($con,$sql)) {
die('Error: ' . mysqli_error($con));
}
echo "1 record added";
mysqli_close($con);
?>
<!--end different login code-->
<!doctype html>
<htm>
<head>
<title>login</title>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="viewport" content="width=device-width,initial-scale=1">
<!--bootsttrap-->
<link rel="stylesheet" href="css/bootstrap/css/bootstrap.min.css" type="text/css">
<!--custom css-->
<link rel="stylesheet" href="css/style.css" type="text/css">
<!--flex slider-->
<link rel="stylesheet" href="css/flexslider/css/flexslider.css">
<!--font-awesome-->
<link rel="stylesheet" href="css/font-awesome/css/font-awesome.min.css" type="text/css">
<!--jquery-->
<script src="js/jquery-3.2.1.min.js" type="text/javascript"></script>
<script src="css/flexslider/js/jquery.flexslider.js"></script>
<!--bootstrp js-->
<script src="css/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<!--start scroll down button-->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
</head>
<body>
<!--start register-->
<div class="container">
<form method="post" action="login.php">
<input type="text" name="email" id="user" class="form-control in" placeholder="Email" style="width: 20%;">
<input type="password" name="pass" id="pass" class="form-control" placeholder="Password" style="width: 20%; margin-top:10px;">
<input type="submit" value="submit" name="login" style="width: 20%; margin-top:10px;">
</form>
</div>
<!--end register-->
<!--start login-->
<form action = "login.php" method = "post">
<label>UserName :</label><input type = "text" name = "username" class = "box"/><br /><br />
<label>Password :</label><input type = "password" name = "password" class = "box" /><br/><br />
<input type = "submit" value = " Submit " name="registration"/><br />
</form>
<!--end register-->
<div class="error"><?php for($i=0;$i<count($errors);$i++){
echo $errors[$i];
}?></div>
</body>
</htm>
<!--log in code er details-->
database name:-anirudha
table name:- login
username r password ta database e predefined
kora hoeche..
username:-ani
password:-123
if (isset($_POST['login'])):- "login" ta button name.
<!--login code er details-->
<!--loader link-->
https://www.jqueryscript.net/blog/Best-Loading-Spinner-Indicator-jQuery-Plugins.html
<!--loader link-->
<!--wordpress install-->
1) run xampp control
2) to download wordpress type wordpress.org in google
3) copy and paste wordpress in xampp-htdocs
4) type "localhost/wordpress/wp-admin" in google
5) continue install process..localhost database e predefined username and password ta wordpress install er somoy ditay hobe..gmail tao original ditay hobe
<!--wordpress install-->