Ask Question - Get Answer

6 Ans PHP log in form code download from here

Asked by Birds of the sky (2 Golds) Thursday, 30 Dec 2021, 07:05 AM at (Technology Computer)

Please log in to answer, like and save
0
Save 1

<<< Previous
Log in to Answer Next >>>

Answer(s):

logout.php file


<?php

include_once 'config.php';

?>

<a href="index.php"> Add Data </a> <br>

<a href="login.php"> Log In Data </a> <br>

<a href="logout.php"> Log Out </a> <br>

<?php

if(session_destroy())

{

    echo 'Logged Out Successfully! ';

}


?>


Answered by Birds of the sky (2 Golds) Thursday, 30 Dec 2021, 07:11 AM

Please log in to Upvote, Downvote and Report

login.php

<?php
include_once 'config.php';
?>
<a href="index.php"> Add Data </a> <br>
<a href="login.php"> Log In Data </a> <br>
<a href="logout.php"> Log Out </a> <br>
<?php
if (isset($_POST['submit']) & !empty($_POST['submit'])) {
    $sql = "SELECT * FROM test WHERE name = '$_POST[name]' AND dob = '$_POST[dob]'";
    $result = mysqli_query($conn, $sql);
    if ($result) {
        if ($row = mysqli_fetch_assoc($result) > 0) {
            $name = $row['name'];
            $pass = $row['password'];
            $dob = $row['dob'];

            $_SESSION['logged'] = 'yes';

            echo 'Logged in successfully!';
            echo $name;
            echo $pass;
            echo $dob;
        } else {
            echo 'Name, Password, DOB not Matched! ';
        }
    }
}
?>
<h2> Log In Database </h2>
<form method="POST" action="login.php" enctype="multipart/form-data">
    <input type="text" name = "name" placeholder="Enter Name"/>
    <input type="password" name = "password" placeholder="Enter Password"/>
    <input type="date" name="dob"/>
    <input type="submit" name="submit" value="Log In"/>
</form>
<?php

Answered by Birds of the sky (2 Golds) Thursday, 30 Dec 2021, 07:10 AM

Please log in to Upvote, Downvote and Report

action.php (Data is inserted by this page)

<?php

include_once 'config.php';

?>

<a href="index.php"> Add Data </a> <br>

<a href="login.php"> Log In Data </a> <br>

<a href="logout.php"> Log Out </a> <br>

<?php

if (isset($_POST['submit']) & !empty($_POST['submit'])) {

    $sql = "INSERT INTO test(name, password, dob) VALUES('$_POST[name]', '$_POST[password]', '$_POST[dob]')";

    if (mysqli_query($conn, $sql)) {

        echo 'Data Inserted Successfully! ';

    }

}

Answered by Birds of the sky (2 Golds) Thursday, 30 Dec 2021, 07:09 AM

Please log in to Upvote, Downvote and Report

index.php file


<?php

include_once 'config.php';

?>

<html>

    <head>

        <title>

            PHP LOG IN FORM

        </title>

    </head>

    <body>

        

        <a href="index.php"> Add Data </a> <br>

        <a href="login.php"> Log In Data </a> <br>

        <a href="logout.php"> Log Out </a> <br>

         

        

        <h2> Add Data into Database </h2>

        <form method="POST" action="action.php" enctype="multipart/form-data">

            <input type="text" name = "name" placeholder="Enter Name"/>

            <input type="password" name = "password" placeholder="Enter Password"/>

            <input type="date" name="dob"/>

            <input type="submit" name="submit" value="Add Data"/>

        </form>


        <br>

        <br>

    </body>

</html>

<?php

?>

Answered by Birds of the sky (2 Golds) Thursday, 30 Dec 2021, 07:09 AM

Please log in to Upvote, Downvote and Report

config.php  ( Database Connection and Configuration File )

<?php

if (session_status() == PHP_SESSION_NONE) {
    session_start();
}

$server = "localhost";
$user = "root";
$pass = "";
$dbname = "bpsc";
$conn = mysqli_connect($server, $user, $pass, $dbname);
if ($conn) {
    //echo 'Connected';
}

/* At first Create Table with this Query 
CREATE TABLE `test` (
 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
 `name` varchar(255) NOT NULL,
 `password` varchar(255) NOT NULL,
 `dob` date NOT NULL,
 UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
 * 
 */

Answered by Birds of the sky (2 Golds) Thursday, 30 Dec 2021, 07:08 AM

Please log in to Upvote, Downvote and Report

PHP login form creation is very easy. Just copy and paste this on your IDE (Ex: Netbeans...) and XAMPP , MYSQL etc and get output.

Thanks.  

Answered by Birds of the sky (2 Golds) Thursday, 30 Dec 2021, 07:06 AM

Please log in to Upvote, Downvote and Report
           

Related Q/A:

1 Ans Computers on everything: How much risk we actually have

1 Ans What is the difference between application software and system software?

1 Ans Write about various operating systems of Computer?

1 Ans Why happened if I capture picture on mobile it's right and left not positioned accurately?

1 Ans Difference between Save and Save As?

1 Ans Who is the father of modern computers?

0 Ans Authorized Cisco Distributor and Partner in India for Enterprise Solutions As a business aiming to strengthen IT networks, partnering with an authorized Cisco distributor in India is crucial for deploying efficient and scalable solutions. Cisco’s enterprise-grade products and services require expert handling and certified support—something only authorized Cisco partners in India can provide. We are proud to be an official Cisco partner, offering full-spectrum enterprise networking solutions across India. Our product portfolio includes Cisco routers, switches, Meraki wireless solutions, security firewalls, and collaboration tools. By working with a Cisco certified partner, you get direct access to the latest Cisco innovations, software updates, and genuine hardware. Our strength lies in providing customized Cisco networking solutions for government departments, large enterprises, financial institutions, and data centers. We’re not just a Cisco supplier in India but your long-term IT transformation partner. Whether you need a small LAN setup or a large WAN architecture, our expert team ensures deployment with minimal downtime and high efficiency. We also offer annual maintenance contracts, remote management, and scalable licensing options for long-term continuity. Reach out to us today and experience the reliability and performance of working with a Cisco-authorized technology provider in India.

2 Ans What is a computer?

2 Ans How to unblock a phone number on Samsung mobile phone?

3 Ans NESCO Assistant Manager (ICT) full Question with solution 2021 Exam Taker BUET on 31 December, 2021