20 lines
794 B
PHP
20 lines
794 B
PHP
<?php
|
|
session_start();
|
|
$user = $_SESSION['__SSOAuthenticatedUser'];
|
|
if ($user != null) {
|
|
$decodedData = json_decode($user, true);
|
|
if ($decodedData !== null) {
|
|
// preg_match_all('/\d+/', $decodedData['data'], $matches);
|
|
// $emp_code = implode('', $matches[0]);
|
|
$emp_code = trim($decodedData['data'], '{}');
|
|
if (preg_match('/^[a-zA-Z0-9]+$/', $emp_code)) {
|
|
$_SESSION['__SSOAuthenticated_BlueCollar_EmpCode'] = $emp_code;
|
|
echo "<script>location.replace('/')</script>";
|
|
} else {
|
|
// If $emp_code does not have a valid pattern, handle the error or display a message
|
|
$msg = "Unidentified user. Please connect your IT/OHC team for getting yourself registered!";
|
|
echo "<script>location.replace('access_denied.php?msg=$msg')</script>";
|
|
}
|
|
}
|
|
}
|