<?php session_start();
include("../config/config.php");
$alertType='1';// ADMIN=1 USER =0
$username		=	secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'emailid']);
$password_new	=	secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'newpassword']);
$role	=	secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'role']);
if($role=="user"){
$sql = "SELECT * FROM user_master WHERE emailid='$username'";
$myquery=$conn->query($sql);
$mydara= $myquery->fetchAll()  ;
$rows_found = $myquery->rowCount();
if($rows_found==0){
$_SESSION[ADD_TAG.'_unvalidate_user']=12;
$_SESSION[ADD_TAG.'_tologusername_user']='';
$pagename='Admin Login ';
$parameter='suspicious Login for Admin ';
$alertdisplay=' For Email ID '.$email_id  ;
header('Location: ../login-role/user');
}else{
foreach( $mydara as $row ) {
$userId		= $row['rowId'];
}
$hash = password_hash($password_new,PASSWORD_DEFAULT);
$sqls = "UPDATE user_master SET userpass = '$hash' WHERE rowId='$userId'";
$myquerys=$conn->query($sqls);
header('Location: ../login-role/user'); 
} }
if($role=="merchant"){
$sql = "SELECT * FROM vendor_master WHERE emailid='$username'";
$myquery=$conn->query($sql);
$mydara= $myquery->fetchAll()  ;
$rows_found = $myquery->rowCount();
if($rows_found==0){
$_SESSION[ADD_TAG.'_unvalidate_user']=12;
$_SESSION[ADD_TAG.'_tologusername_user']='';
$pagename='Admin Login ';
$parameter='suspicious Login for Admin ';
$alertdisplay=' For Email ID '.$email_id  ;
header('Location: ../login-role/user');
}else{
foreach( $mydara as $row ) {
$userId		= $row['rowId'];
}
$hash = password_hash($password_new,PASSWORD_DEFAULT);
$sqls = "UPDATE vendor_master SET userpass = '$hash' WHERE rowId='$userId'";
$myquerys=$conn->query($sqls);
header('Location: ../login-role/merchant'); 
}
}