NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

<?php
session_start();
include_once("sfm_inc/db_config.php");
include_once("sfm_inc/sql_func.php");
$con = db_connect();

//var_dump($con);
//exit;

print_r($_REQUEST);

if($_REQUEST['login']=='true')
{

$rec=singRec("SELECT c.LOGIN_ID,c.EMP_ID,c.FLAG
from epplive.BCS_USERS a
inner join sfm_employee_info b on a.emp_code = b.emp_code
inner join sfm_users c on b.id = c.emp_id
where a.CODE='".addslashes(strtoupper($_REQUEST['username']))."'
AND a.PASS_WD= '".encodel(strtoupper($_REQUEST['userpass']))."'
and a.status='A'
and c.status='A'");

$succ = 'N';

print_r($rec);
if ($rec['EMP_ID'])
{
if($rec['FLAG']=='E')
{
$emp=singRec("SELECT EMP_CODE, (FNAME||' '||MNAME||' '||LNAME) empname,
LEVEL_ID, PICS,MANAGER_ID,COM_EMAIL
FROM SFM_EMPLOYEE_INFO
WHERE id ='".$rec['EMP_ID']."' ");

$sqlDiv=multiRec("SELECT DIVSN_ID
FROM SFM_EMP_DIVISIONS
WHERE EMP_ID ='".$rec['EMP_ID']."'
AND trunc(sysdate) BETWEEN EFFEC_FROM AND nvl(EFFEC_TO,'01-Jan-3000')
ORDER BY DIVSN_ID",1);

$divsArr=singDymention($sqlDiv);

$_SESSION['loginId'] = $rec['LOGIN_ID'];
$_SESSION['loginType'] = 'E';
$_SESSION['empId'] = $rec['EMP_ID'];
$_SESSION['empCode'] = $emp['EMP_CODE'];
$_SESSION['empName'] = $emp['EMPNAME'];
$_SESSION['empLevel'] = $emp['LEVEL_ID'];
$_SESSION['empMgrId'] = $emp['MANAGER_ID'];
$_SESSION['empComEmail'] = $emp['COM_EMAIL'];
$_SESSION['empPic'] = $emp['PICS'];
$_SESSION['empDivision'] = $divsArr;

$empGeo=singRec("SELECT HQ_ID,GEO_SCOPE,
get_geo_name(HQ_ID,decode(GEO_SCOPE,'Country','C','Zone','Z','Region','R','District','D','HQ','H'),'".$divsArr[0]."',trunc(sysdate)) GOONM
FROM SFM_EMP_HQ
WHERE emp_id='".$rec['EMP_ID']."'
AND trunc(sysdate) BETWEEN EFFEC_FROM AND nvl(EFFEC_TO,'01-Jan-3000') ",1);

$_SESSION['empGeoId'] = $empGeo['HQ_ID'];
$_SESSION['empGeoScope'] = $empGeo['GEO_SCOPE'];
$_SESSION['empGeoName'] = $empGeo['GOONM'];

if($emp['LEVEL_ID']==5)
{
$hq=singRec("SELECT get_empid_hqlbl('".$_SESSION['empId']."',SYSDATE) HQ
FROM dual ");

$_SESSION['empHqLabel'] = $hq['HQ'];
}

$fy=singRec("SELECT LABEL,to_char(FROM_DT,'dd-Mon-yyyy') FROMDATE,
to_char(TO_DATE,'dd-Mon-yyyy') TODATE
FROM SFM_FINYEAR
WHERE trunc(sysdate) BETWEEN FROM_DT AND TO_DATE ",1);

$_SESSION['fyLabel']=$fy['LABEL'];
$_SESSION['fyFromDate']=$fy['FROMDATE'];
$_SESSION['fyToDate']=$fy['TODATE'];

$succ='Y';
}
else if($rec['FLAG']=='C')
{
$cust=singRec("SELECT party_code, party_NAME
FROM sfm_party_master
WHERE id='".$rec['EMP_ID']."' ");

$_SESSION['loginId'] = $rec['LOGIN_ID'];
$_SESSION['custId'] = $rec['EMP_ID'];
$_SESSION['custCode'] = $cust['PARTY_CODE'];
$_SESSION['empName'] = $cust['PARTY_NAME'];
$_SESSION['loginType'] = 'C';
$succ='Y';
}
}

$loginnid = strtoupper($_REQUEST['username']);
$loginpass = encodel(strtoupper($_REQUEST['userpass']));
echo $succ;
if($succ=='Y')
{
$CheckExp="SELECT a.ID
FROM BCS_USERS a
WHERE a.STATUS = 'A'
AND a.EMP_CODE = '".$loginnid."'
AND a.PASS_WD = '".$loginpass."'
AND trunc(a.VALID_UPTO) < trunc(SYSDATE)";

$CheckExp =oci_parse($con,$CheckExp);

oci_execute($CheckExp);

$chkRes = oci_fetch_array($CheckExp);

if($chkRes['ID'] && $_SESSION['nonemp']!='C')
{
session_destroy();
header("HTTO/1.1 301 Moved Permanently");
header("location: mdt_users_edit.php?loginId=".@base64_encode($loginnid).'&olp='.@base64_encode($loginpass));
exit;
}

startQry();

$sqllg=executeQry("Insert into SFM_LOGIN_LOG (ID,LOGIN_ID,EMP_ID,LOGIN_DT,CLIENT_IP)
values (null,'".$_SESSION['loginId']."',nvl('".$_SESSION['empId']."',
'".$_SESSION['custId']."'),sysdate,'".$_SERVER['REMOTE_ADDR']."')returning ID into :nid",'nid');

$_SESSION['userSessionId'] = $sqllg ;

endQry();

header("HTTP/1.1 301 Moved Permanently");
header("location: dashboard.php");
}
else
{
header("HTTP/1.1 301 Moved Permanently");
header("location: index.php?login=invalid");
}
}
else if($_REQUEST['logout']=='true')
{
startQry();

if($_SESSION['userSessionId'])
executeQry("update SFM_LOGIN_LOG set logout_dt = sysdate where id = '".$_SESSION['userSessionId']."' " );

endQry();

foreach (glob("reports/output/".$_SESSION['empId']."_*") as $filename) {
unlink($filename);
}

session_destroy();
echo "<script type='text/javascript'>sessionStorage.removeItem('#popupModal');window.location.href = 'index.php';</script>";

//header("HTTP/1.1 301 Moved Permanently");
///header("location: index.php");
exit();
}
else if($_REQUEST['remoteLogin']=='true')
{
$rec=singRec("SELECT c.LOGIN_ID,c.EMP_ID,c.FLAG
from epplive.BCS_USERS a
inner join sfm_employee_info b on a.emp_code = b.emp_code
inner join sfm_users c on b.id = c.emp_id
where a.CODE='".addslashes(strtoupper($_REQUEST['uname']))."'
AND a.PASS_WD= '".$_REQUEST['upass']."'
and a.status='A'
and c.status='A'");

$succ = 'N';

if ($rec[EMP_ID])
{
if($rec['FLAG']=='E')
{
$emp=singRec("SELECT EMP_CODE, (FNAME||' '||MNAME||' '||LNAME) empname,
LEVEL_ID, PICS,MANAGER_ID
FROM SFM_EMPLOYEE_INFO
WHERE id ='".$rec['EMP_ID']."' ");

$sqlDiv=multiRec("SELECT DIVSN_ID
FROM SFM_EMP_DIVISIONS
WHERE EMP_ID ='".$rec['EMP_ID']."'
AND trunc(sysdate) BETWEEN EFFEC_FROM AND nvl(EFFEC_TO,'01-Jan-3000')
ORDER BY DIVSN_ID");

$divsArr=singDymention($sqlDiv);

$_SESSION['loginId'] = $rec['LOGIN_ID'];
$_SESSION['loginType'] = 'E';
$_SESSION['empId'] = $rec['EMP_ID'];
$_SESSION['empCode'] = $emp['EMP_CODE'];
$_SESSION['empName'] = $emp['EMPNAME'];
$_SESSION['empLevel'] = $emp['LEVEL_ID'];
$_SESSION['empMgrId'] = $emp['MANAGER_ID'];
$_SESSION['empPic'] = $emp['PICS'];
$_SESSION['empDivision'] = $divsArr;

$empGeo=singRec("SELECT HQ_ID,GEO_SCOPE,
get_geo_name(HQ_ID,decode(GEO_SCOPE,'Country','C','Zone','Z','Region','R','District','D','HQ','H'),'".$divsArr[0]."',trunc(sysdate)) GOONM
FROM SFM_EMP_HQ
WHERE emp_id='".$rec['EMP_ID']."'
AND trunc(sysdate) BETWEEN EFFEC_FROM AND nvl(EFFEC_TO,'01-Jan-3000') ");

$_SESSION['empGeoId'] = $empGeo['HQ_ID'];
$_SESSION['empGeoScope'] = $empGeo['GEO_SCOPE'];
$_SESSION['empGeoName'] = $empGeo['GOONM'];

if($emp['LEVEL_ID']==5)
{
$hq=singRec("SELECT get_empid_hqlbl('".$_SESSION['empId']."',SYSDATE) HQ
FROM dual ");

$_SESSION['empHqLabel'] = $hq['HQ'];
}

$fy=singRec("SELECT LABEL,to_char(FROM_DT,'dd-Mon-yyyy') FROMDATE,
to_char(TO_DATE,'dd-Mon-yyyy') TODATE
FROM SFM_FINYEAR
WHERE trunc(sysdate) BETWEEN FROM_DT AND TO_DATE ");

$_SESSION['fyLabel']=$fy['LABEL'];
$_SESSION['fyFromDate']=$fy['FROMDATE'];
$_SESSION['fyToDate']=$fy['TODATE'];

$succ='Y';
}
else if($rec['FLAG']=='C')
{
$cust=singRec("SELECT party_code, party_NAME
FROM sfm_party_master
WHERE id='".$rec['EMP_ID']."' ");

$_SESSION['loginId'] = $rec['LOGIN_ID'];
$_SESSION['custId'] = $rec['EMP_ID'];
$_SESSION['custCode'] = $cust['PARTY_CODE'];
$_SESSION['empName'] = $cust['PARTY_NAME'];
$_SESSION['loginType'] = 'C';
$succ='Y';
}
}

$loginnid = strtoupper($_REQUEST['uname']);
$loginpass = strtoupper($_REQUEST['upass']);

if($succ=='Y')
{
$CheckExp="SELECT a.ID
FROM BCS_USERS a
WHERE a.STATUS = 'A'
AND a.EMP_CODE = '".$loginnid."'
AND a.PASS_WD = '".$loginpass."'
AND trunc(a.VALID_UPTO) < trunc(SYSDATE)";

$CheckExp =oci_parse($con,$CheckExp);

oci_execute($CheckExp);

$chkRes = oci_fetch_array($CheckExp);

if($chkRes['ID'] && $_SESSION['nonemp']!='C')
{
session_destroy();
header("HTTO/1.1 301 Moved Permanently");
header("location: mdt_users_edit.php?loginId=".@base64_encode($loginnid).'&olp='.@base64_encode($loginpass));
exit;
}

startQry();

$sqllg=executeQry("Insert into SFM_LOGIN_LOG (ID,LOGIN_ID,EMP_ID,LOGIN_DT,CLIENT_IP)
values (null,'".$_SESSION['loginId']."',nvl('".$_SESSION['empId']."',
'".$_SESSION['custId']."'),sysdate,'".$_SERVER['REMOTE_ADDR']."')returning ID into :nid",'nid');

$_SESSION['userSessionId'] = $sqllg ;

endQry();

header("HTTP/1.1 301 Moved Permanently");
header("location: dashboard.php");
}
else
{
header("HTTP/1.1 301 Moved Permanently");
header("location: index.php?login=invalid");
}
}

function decodel($str)
{
for($i=0;$i<5;$i++)
{
$str = base64_decode(strrev($str));
}

return $str;
}

function encodel($str)
{
for($i=0;$i<5;$i++)
{
$str=strrev(base64_encode($str));
}
return $str;
}


?>
     
 
what is notes.io
 

Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 14 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.