<?php
 session_start();
require_once('admin/includes/config.php');
// Code for login 
if(isset($_POST['register']))
{
  $ppono=$_POST['ppono'];
  $ret= mysqli_query($con,"SELECT * FROM users WHERE ppono='$ppono'");
  $num=mysqli_fetch_array($ret);
  if($num > 0){
    $sid=$num['sid'];
    $name=$_POST['name'];
    $fname=$_POST['fname'];
    $dob=$_POST['dob'];
    $email=$_POST['email'];
    $mobile=$_POST['mobile'];
    $password=$_POST['password'];
    $passwordmd5=base64_encode($_POST['password']);
    
 //    date_default_timezone_set("Asia/Kolkata");
 // $times = date("Y/m/d");
    // $tallytimes = 'pack'.rand(100000,999999);

   

   $sql="UPDATE `users` SET `name`='$name',`fname`='$fname',`dob`='$dob',`mobile`='$mobile',`email`='$email',`password`='$passwordmd5' WHERE ppono = '$ppono'";
   $result = mysqli_query($con, $sql);
   
$subject = "RESS Login Details";

$message = 
"Thank You ".$name." For Register With RESS. Your User Id is ".$ppono." And Password is ".$password.". You can login to site now.";
        $headers = "From: no-reply@ressgov.online";
        // $headers .= "Content-type: text/html\r\n";
mail($email, $subject, $message,$headers );
      if($result){
      $message ="Sucess update";
    echo "<script>alert('Registration Success And Check your email');
 window.location='index.php';</script>";
 
   }else{
    $message = "Not Success";
    
   }
   
    
    


  }
  else{
    $message = "Not Success please check PPO/PF no";
    echo "<script>alert('Invalid PPO/PF no');
 window.location='register.php';</script>";
   }
}
else{
	header("location:register.php");

// echo "<script>alert('Invalid Sponsorid');
//  window.location='register.php';</script>";

// $extra="register.php";
// $info="Invalid";
// $host  = $_SERVER['HTTP_HOST'];
// $uri  = rtrim(dirname($_SERVER['PHP_SELF']),'/\\');
}
 
?>