If You want to learn web design and developing from 0 to 100% then this blog is only for you Here you will be also find source code of many web design and web developing source codes. html,css,javascript,php,mysql & database tutorial, projects, source code files and many blogging tips. Best css tips etc. html css javascript amazing creations

Subscribe Us

https://affiliate.fastcomet.com/scripts/2wc9ym?a_aid=5f4ca944dcb6d&a_bid=49785082

Breaking

Post Top Ad

Sunday, April 12, 2020

userrejistration and sign in system in php using mysql database with source code files

USERREGISTRATION PAGE AND USERSIGN IN PAGE SOURCECODE DOWNLOAD WITH PHP AND MYSQL DATABASE FOR BEGINEERS




It is very simple to make a userregistration or sign in page. These codes are very simple and short you will be not think so much to learn these codes.
If you are fresher or begneers then this artical will be very best for you. You can also use these codes for making user profiles system

What you will be find in this artical
1.userregistartion page
2. usersignin page
3. database

In this artical I will be teach you about user registration page or signup page and login page in php. You can also find the source codes with database.
So first We have to create a USERREJISTRATION page.
So make a database named by userprofile
and make a row named by signup. In this row select four columns.
'id', 'username','email', & 'password';

take id value int(11) autoincreatment, email value 'varchar(255)', password value 'varchar(255)' & username value 'varchar(255)'


1.USERREGISTRATION PAGE
 Make a php page named by userregistration.php use this php and html codes.In this page we have to write code about html css and php. By html codes we will be create a beautifull design. And by php codes we have to connect the data with database. The data which user input we redirect that in database signup row

<?php
  include('dbConnection.php');

  if(isset($_REQUEST['rSignup'])){
    // Checking for Empty Fields
    if(($_REQUEST['rName'] == "") || ($_REQUEST['rEmail'] == "") || ($_REQUEST['rPassword'] == "") || ($_REQUEST['rdesc'] == "") ||($_REQUEST['rmobile'] == "") ||($_REQUEST['rmarks'] == "") ||($_REQUEST['rvillage'] == "") ||($_REQUEST['rcity'] == "") ||($_REQUEST['rbirth'] == "")){
      $regmsg = '<div class="alert alert-warning mt-2" role="alert"> All Fields are Required </div>';
    } else {
      $sql = "SELECT r_email FROM requesterlogin_tb WHERE r_email='".$_REQUEST['rEmail']."'";
      $result = $conn->query($sql);
      if($result->num_rows == 1){
        $regmsg = '<div class="alert alert-warning mt-2" role="alert"> Email ID Already Registered </div>';
      } else {
      $filename = $_FILES["uploadfile"]["name"];
       $tempname = $_FILES["uploadfile"]["tmp_name"];
       $folder = "image/".$filename;
        move_uploaded_file($tempname,$folder);
        $rName = $_REQUEST['rName'];
        $rEmail = $_REQUEST['rEmail'];
        $rPassword = $_REQUEST['rPassword'];
        $rdesc = $_REQUEST['rdesc'];
        $rmobile = $_REQUEST['rmobile'];
        $rmarks = $_REQUEST['rmarks'];
        $option_course = $_REQUEST['option'];
         $rvillage = $_REQUEST['rvillage'];
        $rcity = $_REQUEST['rcity'];
        $rstate = $_REQUEST['rstate'];
        $rbirth = $_REQUEST['rbirth'];
        $sql = "INSERT INTO requesterlogin_tb(r_name, r_email, r_password, profile_image, r_desc, r_mobile, r_marks, r_village, r_city, r_state, r_birth, select_course) VALUES ('$rName','$rEmail', '$rPassword', '$folder', '$rdesc', '$rmobile', '$rmarks', '$rvillage', 'r_city', '$rstate', '$rbirth','$option_course')";
        if($conn->query($sql) == TRUE){
          $regmsg = '<div class="alert alert-success mt-2" role="alert"> Account Succefully Created </div>';
        } else {
          $regmsg = '<div class="alert alert-danger mt-2" role="alert"> Unable to Create Account </div>';
        }
      }
    }
  }
?>



<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">

  <!-- Bootstrap CSS -->
  <link rel="stylesheet" href="css/bootstrap.min.css">

  <!-- Font Awesome CSS -->
  <link rel="stylesheet" href="../css/all.min.css">

  <style>
    .custom-margin {
         margin-top: 8vh;
      }
   </style>
  <title>Login</title>
</head>

<body>
<div class="container pt-5" id="registration" >
  <h2 class="text-center">Create an Account</h2>
  <div class="row mt-4 mb-4">
    <div class="col-md-6 offset-md-3">
      <form action="" class="shadow-lg p-4" method="POST" enctype="multipart/form-data">
        <div class="form-group">
          <i class="fas fa-user"></i><label for="name" class="pl-2 font-weight-bold">Name</label><input type="text"
            class="form-control" placeholder="Name" name="rName">
        </div>
        <div class="form-group">
          <i class="fas fa-user"></i><label for="email" class="pl-2 font-weight-bold">Email</label><input type="email"
            class="form-control" placeholder="Email" name="rEmail">
          <!--Add text-white below if want text color white-->
          <small class="form-text">We'll never share your email with anyone else.</small>
        </div>

        <div class="form-group">
          <i class="fas fa-key"></i><label for="pass" class="pl-2 font-weight-bold">New
            Password</label><input type="password" class="form-control" placeholder="Password" name="rPassword">
        </div>

       <div class="form-group"  method="POST">
         <input type="file" name="uploadfile" value="UPLOAD IMAGE"></br></br>
        </div>

       <div class="form-group">
      <label for="inputRequestDescription"> Post Description</label>
      <textarea type="text" class="form-control" id="inputRequestDescription" placeholder="Write Description" name="rdesc"></textarea>
    </div>

         <div class="form-group">
          <i class="fas fa-key"></i><label for="pass" class="pl-2 font-weight-bold"> Mobile
            </label><input type="mobile" class="form-control" placeholder="mobile" name="rmobile">
        </div>
   
       <div class="form-group">
          <i class="fas fa-key"></i><label for="pass" class="pl-2 font-weight-bold"> 12th %
            </label><input type="marks" class="form-control" placeholder="marks" name="rmarks">
        </div>


          <div class="form-group">
             SELECT:  <select required name="option">
                <option value="">none</option>
                <option value="currentaffairs">ssc-cgl</option>
                <option value="notifications">ssc-chsl</option>
                <option value="papers">navy</option>
                 <option value="message">banking</option>
                <option value="teachers">airforce</option>
                <option value="result">nda</option>     
             </select>
            </div>
              <small class="form-text">select a course We'll give you all notification and exam suggestion</small>
            <br>
            <br>

       <div class="form-group">
          <i class="fas fa-key"></i><label for="pass" class="pl-2 font-weight-bold"> Village
            </label><input type="text" class="form-control" placeholder="village" name="rvillage">
        </div>

       <div class="form-group">
          <i class="fas fa-key"></i><label for="pass" class="pl-2 font-weight-bold"> City
            </label><input type="text" class="form-control" placeholder="City" name="rcity">
        </div>

      <div class="form-group">
          <i class="fas fa-key"></i><label for="pass" class="pl-2 font-weight-bold"> state
            </label><input type="text" class="form-control" placeholder="State" name="rstate">
        </div>
    <div class="form-group">
          <i class="fas fa-key"></i><label for="pass" class="pl-2 font-weight-bold"> date of birth
            </label><input type="date" class="form-control" placeholder="date of birth" name="rbirth">
        </div>

        <button type="submit" class="btn btn-danger mt-5 btn-block shadow-sm font-weight-bold" name="rSignup">Sign Up</button>
        <em style="font-size:10px;">Note - By clicking Sign Up, you agree to our Terms, Data
          Policy and Cookie Policy.</em>
        <?php if(isset($regmsg)) {echo $regmsg; } ?>
      </form>







    </div>
  </div>
</div>
 <div class="text-center"><a class="btn btn-info mt-3 shadow-sm font-weight-bold" href="index.php">Back
            to Home</a></div>

</body>
</html>






2.USERSIGNIN PAGE




make a file named by userlogin.php
After making userrejistration page we have to make a usersignin page. We will be used the userprofile database.
and use this code

<?php
include('../dbConnection.php');
session_start();
if(!isset($_SESSION['is_login'])){
  if(isset($_REQUEST['rEmail'])){
    $rEmail = mysqli_real_escape_string($conn,trim($_REQUEST['rEmail']));
    $rPassword = mysqli_real_escape_string($conn,trim($_REQUEST['rPassword']));
    $sql = "SELECT r_email, r_password FROM requesterlogin_tb WHERE r_email='".$rEmail."' AND r_password='".$rPassword."' limit 1";
    $result = $conn->query($sql);
    if($result->num_rows == 1){
   
      $_SESSION['is_login'] = true;
      $_SESSION['rEmail'] = $rEmail;
      // Redirecting to RequesterProfile page on Correct Email and Pass
      echo "<script> location.href='RequesterProfile.php'; </script>";
      exit;
    } else {
      $msg = '<div class="alert alert-warning mt-2" role="alert"> Enter Valid Email and Password </div>';
    }
  }
} else {
  echo "<script> location.href='RequesterProfile.php'; </script>";
}
?>

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">

  <!-- Bootstrap CSS -->
  <link rel="stylesheet" href="../css/bootstrap.min.css">

  <!-- Font Awesome CSS -->
  <link rel="stylesheet" href="../css/all.min.css">

  <style>
    .custom-margin {
         margin-top: 8vh;
      }
   </style>
  <title>Login</title>
</head>

<body>
  <div class="mb-3 text-center mt-5" style="font-size: 30px;">
    <i class="fas fa-stethoscope"></i>
    <span>Prudence Coaching Website</span>
  </div>
  <p class="text-center" style="font-size: 20px;"> <i class="fas fa-user-secret text-danger"></i> <span>Students
      Profile</span>
  </p>
  <div class="container-fluid mb-5">
    <div class="row justify-content-center custom-margin">
      <div class="col-sm-6 col-md-4">
        <form action="" class="shadow-lg p-4" method="POST">
          <div class="form-group">
            <i class="fas fa-user"></i><label for="email" class="pl-2 font-weight-bold">Email</label><input type="email"
              class="form-control" placeholder="Email" name="rEmail">
            <!--Add text-white below if want text color white-->
            <small class="form-text">We'll never share your email with anyone else.</small>
          </div>
          <div class="form-group">
            <i class="fas fa-key"></i><label for="pass" class="pl-2 font-weight-bold">Password</label><input type="password"
              class="form-control" placeholder="Password" name="rPassword">
          </div>
          <button type="submit" class="btn btn-outline-danger mt-3 btn-block shadow-sm font-weight-bold">Login</button>
          <?php if(isset($msg)) {echo $msg; } ?>
        </form>
         <div class="text-center"><a class="btn btn-info mt-3 shadow-sm font-weight-bold" href="../UserRegistration.php">
            create an account</a></div>
        <div class="text-center"><a class="btn btn-info mt-3 shadow-sm font-weight-bold" href="../index.php">Back
            to Home</a></div>
               </div>
    </div>
  </div>

 
</body>
</html>

No comments:

Post a Comment

thanks for your comments

Post Top Ad