Skip to main content

How Create Login Page with Database and Session Module In PHP

*  Create Login Page With Database *

-> First Download Wamp Server or Xamp Server and Setup Your Drive And Check Avaiblity Of Xamp or Wamp.

-> Create Database in mysql database. and Create New Table and Insert New Record Like User name, Password, Full name, And extra Details....

-> and next Step is Create new page login.php or index.php

-> Write Code on Creating File.

->Establish Connection of Your Databse.

->create new file like config or connection... like(dbuser,dbpassword, and connection details..)

->The Following Code write in your index or Login Page.


<?php

    //old path

    //include('config/connection.php');

    //new path

    include('../../db/connection.php');

    if(isset($login))

    {

        $str="select*from admin where status='active' and user_name='$username' and password='$password';";

        $data=mysqli_query($conn,$str);

        $search=mysqli_num_rows($data);

        if($search>0)

        {

            $_SESSION['user_name']=$username;

            ?><script>window.location='<?php echo $domain_path; ?>dashboard.php';</script><?php

        }

        else

        {

           $error="Incorrect Username or Password...";

        }

    }

?>


Comments

Popular posts from this blog

How To Declare Variable and hello word in php ?

    Hii Guys Today We are Talking about of php variable Declaration and sinple print message and calculate simple sum of two numbers. php is very powerfull language to compare other language. so. lests start and see full tutorial. 1.0 Start PHP           * PHP code always start <?php word throw start and close php code ?> keyword. the following                          syntax throw start php working.                         ------------------------------------------------------------------------------                        |              <?php // start php                                   ...

Download PHP Full Source Code Free Template. How to Download Free Responsive Website Templates

  * Important Note To Download Templates * 1. Conceptual Simplicity :  As the information is represented in form of tree structure, it is easy to view, understand, and retrieve the data. This helps the database designer to obtain conceptual clarity of relationship.  2.. Database security :  Security is provided by DBMS. Thus Programming effort is decreased as compared to file system in which programmer has to write the programs for implementing security.  3. Data independence :  If changes are made in design of database, DBMS takes care of cascading it throughout the system. There is no need to make change in system. * Limitation of Download Templates * 1. Complexity :  To implement the database using hierarchical model. programmer needs to have detailed knowledge of how the data is’ stored has to traverse entire tree for the same.  2. Data Redundancy :  To implement many to many ‘relationships amongst data repeatition of data is required. T...

Advantage and Disadvantage Of PHP Limitation of PHP

               *  ADVANTAGE OF PHP HIERARCHICAL DATATABLE MODELS * 1. Conceptual Simplicity :  As the information is represented in form of tree structure, it is easy to view, understand, and retrieve the data. This helps the database designer to obtain conceptual clarity of relationship.  2.. Database security :  Security is provided by DBMS. Thus Programming effort is decreased  compared to file system in which programmer has to write the programs for implementing security.  3. Data independence :  If changes are made in design of database, DBMS takes care of cascading it throughout the system. There is no need to make change in system.  * DISADVANTAGE OF PHP HIERARCHICAL DATABASE MODELS  * 1. Complexity :  To implement the database using hierarchical model. programmer needs to have detailed knowledge of how the data is’ stored has to traverse entire tree for the same.  2. Data Redundan...