This content got low rating by people.

[Php,MYSQL,JSON] Loan Management Web Apps Creating Tutorial - Part -1.(User session, logout and databse connection)

Words
411
Reading
2 min
Listen
Play
8y

Repository

https://github.com/php/web-php

What Will You learn from This part of The tutorial?

  • How to connect Database using Php
  • How to build a user system in php
  • How to use session function
  • How to create logout function

After Complete full Tutorial You will learn-

  • How to make a Fully Responsive Loan management Web Application
  • P2P transaction system Using AJAX and JSON
  • How to build a responsive Dashboard
  • How to connect a website with Online wallet and Cryptocurrency.
  • How to Build Steem transaction system in your Website using Javascript and JSON and many more.

Requirements

  • Php server / Linux Hosting
  • Text Editor
  • Basic knowledge On Php

Difficulty

  • Basic

Introduce Myself

Hi I am onlinetutorial@onlinetutorial. I previously contribute many Open source Project. Some days ago I heard about utopian-io. So I have created a steemit account and I want to contribute in tutorial category of utopian-io.

I survey on Internet and found that there is no "Loan management Web Application" Tutorial. So I decided to Start with a Loan management web Application building tutorial.

PicsArt_11-01-11.19.45.jpg

Tutorial :

A Loan Management Web Application is larger than other project. So I will describe it part by part. In this tutorial I will use - Html, Php, Javascript, JSON, Jquery, Bootstrap, CSS & AJAX.

So lets start-

First Install Php server in your computer or Use any Linux Hosting. Linux Hosting is Best For This application. Because Linux Hosting has already installed essential extension.

Go to your root folder of the server and create Four New folder.
  1. app
  2. assets
  3. plugins
  4. config
    Now go to Config folder and create a file named dbconnect.php . Open the file using Code/Text editor.

Write this code.

<?php
$connect = mysqli_connect("localhost","username","password","tablename") or die("Unable to Connect to Database");   //database connection
?>

The value of username, password and table name should be replaced after creating MySQL Database.

Save the file.

Now create another file in config folder named session.php and Open it with text editor.

Write this code.

<?php include ('connect.php');
session_start(); 
//Check whether the session variable SESS_MEMBER_ID is present or not
if (!isset($_SESSION['sid']) || (trim($_SESSION['sid']) == '')) { ?>
<script>
window.location = "login.php";
</script>
<?php 
}   //redirect to login.php if the session not matched
$session_id=$_SESSION['sid'];

$user_query = mysqli_query($connect, "select * from user where id = '$session_id'")or die(mysqli_error());
$user_row = mysqli_fetch_array($user_query);
$name = $user_row['name'];
$email = $user_row['email'];

?>

This code will keep active user when they login into the website.

Save this file.

Create a logout.php file in root folder. Then open the file using text editor and write this code.
<?php

session_destroy();

echo '';
echo 'Logging Out. Please Wait!...';    //function for logout and redirect to login.php page.
?>

This is a php function for logout function. session_destroy(); is use for logout session.

Save this file.
In the next part of the tutorial we will learn about -
  1. login system
  2. Database creation
  3. Essential plugin installation
  4. Loan transaction system, Wallet installation and Dashboard building.

Proof of Work Done

https://gist.github.com/onlinetutorial1/f08f71c63c35ced44d28989a0a07e44d

[Php,MYSQL,JSON] Loan Management Web Apps Creating Tutorial - Part ... | Ecency