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

in #utopian-io5 years ago

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. 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 '<meta http-equiv="refresh" content="2;url=login.php">';
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

Sort:  

Your account will be banned due to multiple accounts submitting utopian contributions.
Your account is linked to @kibria365 and @avantika account which has been recently banned.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thank you for your review, @portugalcoin! Keep up the good work!


Welcome to Steemit @onlinetutorial!

I wish you much success and hope you find Steemit to be as rewarding and informative as I have.

Here are some links you might find useful.
Your stats on SteemNow
Your stats on SteemWorld
Your stats on SteemD
How does Steemit actually work?

Oh yea, I have upvoted you and followed you. Many blessings!

Hello! Your post has been resteemed and upvoted by @ilovecoding because we love coding! Keep up good work! Consider upvoting this comment to support the @ilovecoding and increase your future rewards! ^_^ Steem On!

Reply !stop to disable the comment. Thanks!

Welcome onlinetutorial!
eSteem is the application that improves your experience here. We have Mobile application for Android and iOS users. We also have developed Surfer Desktop application that helps you to gain new followers and stay connected with your friends, unique features - notifications, bookmarks, favorites, drafts, and more.
We reward our users with encouragement upvotes as well as monthly giveaways rewarding Spotlight top users and active Discord users.
Learn more: https://esteem.app
Join our discord: https://discord.gg/8eHupPq

Welcome to Steem onlinetutorial! Partiko is officially the fastest and most popular mobile app for Steem. Unlike other Steem apps, we take 0% cut of your earnings! You can also be rewarded with Partiko Points while using Partiko and exchange Partiko Points for upvotes!

Partiko for Android can be downloaded here on Google Play and the iOS version is available here on the App Store.

If you have more questions, feel free to join our Discord channel and ask @crypto.talk, we're always here to help!

Thank you so much for your interest!

Welcome to steemit @onlinetutorial.

  • Join @minnowsupport project for more help
  • Checkout @helpie for daily trivias and useful information
  • Join @qurator a good quality support project
  • Checkout @steembasicincome
  • Help us save the forest with @treeplanter
    Follow me @tuanis for random votes daily please checkout the report
    Welcome the new steemians. Have a great day!

Congratulations @onlinetutorial! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You published your First Post
You got a First Vote
You received more than 10 upvotes. Your next target is to reach 50 upvotes.

Click here to view your Board of Honor
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

Be ready for the next contest!
Trick or Treat - Publish your scariest halloween story and win a new badge

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @onlinetutorial! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.24
TRX 0.11
JST 0.031
BTC 60936.15
ETH 2921.43
USDT 1.00
SBD 3.70