city.', '.$log_location_details->region.', '.$log_location_details->country; $log_action_id = 2; $log_action = 'Login By Cookie'; $log_cookie_set = 0; $log_action_by_id = 1; $log_action_by = 'Web Portal'; $log_time = date('Y-m-d H:i:s'); if ($log_location == ', , '){ $log_location = ''; } $sql = 'insert into log_in_out_log( username, user_id, pagename, ip_address, mobile_key, location, action_id, action, cookie_set, action_by_id, action_by, log_time) values("'.$log_username.'", '.$log_user_id.', "'.$log_pagename.'", "'.$log_ip_address.'", "'.$log_mobile_key.'", "'.$log_location.'", '.$log_action_id.', "'.$log_action.'", '.$log_cookie_set.', '.$log_action_by_id.', "'.$log_action_by.'", "'.$log_time.'")'; db__select($sql, ''); } $_SESSION['login_UserId']=$result[0]['id']; if($result[0]['sys_parent_user']!=1) { $queryForMaingroupId="select sys_parent_group_id from `group` where `group`.id=".$_SESSION['sys_group_id']; $condition = ""; $resultParentId = db__select($queryForMaingroupId, $condition); $_SESSION['sys_group_id_parent']=$resultParentId[0]["sys_parent_group_id"]; } if (in_array($_SESSION['sys_group_id'], $marketVehicleMapview)) { if( $_SESSION['sys_group_id']=="7013" || $_SESSION['sys_group_id']=="7014") { $VehicleidQry="select sys_service_id from mapped_market_vehicle where sys_subuser_id=".$_SESSION['UserId']." and unmapped_time is null"; } else { $VehicleidQry="select sys_service_id from mapped_market_vehicle where sys_user_id=".$_SESSION['UserId']." and unmapped_time is null"; } //$VehicleidQry="select * from group_services where group_services.active=true and sys_group_id=".$_SESSION['sys_group_id']; $VehicleId = db__select($VehicleidQry, ""); $_SESSION['Total_vehicle']=count($VehicleId); if(count($VehicleId)>0){ foreach($VehicleId as $key=>$value){ $_SESSION['vehId'].=$value['sys_service_id'].","; } $_SESSION['vehId']=substr($_SESSION['vehId'],0,strlen($_SESSION['vehId'])-1); } } else { $_SESSION['vehId']=""; if( $_SESSION['sys_group_id_parent'] == 6173) { $VehicleidQry="select * from group_services where group_services.active=true and sys_group_id=".$_SESSION['sys_group_id']." and sys_Service_id in (select sys_Service_id from group_services where group_services.active=true and sys_group_id=".$_SESSION['sys_group_id_parent']." )"; } else if( $_SESSION['sys_group_id'] == 1998) { $VehicleidQry="select sys_service_id from matrix.group_services left join matrix.services on group_services.sys_service_id=services.id where group_services.active=true and sys_group_id=1998 and services.veh_type=1 "; } else if($_SESSION['sys_group_id'] == 54173 || $_SESSION['sys_group_id'] == 54174 || $_SESSION['sys_group_id'] == 54175) { $getVehicle="select * from group_services where group_services.active=true and sys_group_id=".$_SESSION['sys_group_id']; $getVehId = db__select($getVehicle, ""); if(count($getVehId)>0){ foreach($getVehId as $keyId=>$valueId){ $getSysSerId.=$valueId['sys_service_id'].","; } $getSysSerId=substr($getSysSerId,0,strlen($getSysSerId)-1); } if($_SESSION['sys_group_id'] == 54173) { $VehicleidQry = "select sys_service_id,vehicle_no,trip_status from matrix.client_veh_trip_status where sys_service_id IN (".$getSysSerId.") and is_active=1 and trip_status='Break Down' group by sys_service_id "; } else if($_SESSION['sys_group_id'] == 54174) { $VehicleidQry = "select sys_service_id,vehicle_no,trip_status from matrix.client_veh_trip_status where sys_service_id IN (".$getSysSerId.") and is_active=1 and trip_status in('Repair','Break Down') group by sys_service_id "; } else if($_SESSION['sys_group_id'] == 54175) { $VehicleidQry = "select sys_service_id,vehicle_no,trip_status from matrix.client_veh_trip_status where sys_service_id IN (".$getSysSerId.") and is_active=1 and trip_status in ('Tyre Change','Tyre burst') group by sys_service_id "; } } else { $VehicleidQry="select * from group_services where group_services.active=true and sys_group_id=".$_SESSION['sys_group_id']; } $VehicleId = db__select($VehicleidQry, ""); $_SESSION['Total_vehicle']=count($VehicleId); if(count($VehicleId)>0){ foreach($VehicleId as $key=>$value){ $_SESSION['vehId'].=$value['sys_service_id'].","; } $_SESSION['vehId']=substr($_SESSION['vehId'],0,strlen($_SESSION['vehId'])-1); } if (in_array($_SESSION['sys_group_id'], $stoppagetrueclient)) { //$VehicleId1 = db__select("SELECT DISTINCT sys_service_id as sys_service_id FROM matrix.`temperature_alert_vhl` WHERE temperature_alert_vhl.show_stoppage=1 ", ""); //echo "SELECT DISTINCT SYS_SERVICE_ID as sys_service_id FROM `temperature_alert_vhl` WHERE temperature_alert_vhl.show_stoppage=1 "; //print_r( $VehicleId1); //die(); $VehicleId1 = db__select("SELECT DISTINCT sys_service_id as sys_service_id FROM matrix.`temperature_alert_vhl` WHERE temperature_alert_vhl.show_stoppage=1 and sys_user_id in ('6347') and sys_service_id in (".$_SESSION['vehId'].")", ""); $_SESSION['Total_vehicle_stoppage']=count($VehicleId1); if(count($VehicleId1)>0) { foreach($VehicleId1 as $key=>$value){ $_SESSION['stoppage_vehId'].=$value['sys_service_id'].","; } $_SESSION['stoppage_vehId']=substr($_SESSION['stoppage_vehId'],0,strlen($_SESSION['stoppage_vehId'])-1); //die(); } if($_SESSION['stoppage_vehId']!="") { $VehicleId2 = db__select("select * from group_services where group_services.active=true and sys_Service_id not in(".$_SESSION['stoppage_vehId'].") and sys_group_id=".$_SESSION['sys_group_id']); } else { $VehicleId2 = db__select("select * from group_services where group_services.active=true and sys_group_id=".$_SESSION['sys_group_id']); } if(count($VehicleId2)>0) { foreach($VehicleId2 as $key=>$value){ $_SESSION['withoutstoppage_vehId'].=$value['sys_service_id'].","; } $_SESSION['withoutstoppage_vehId']=substr($_SESSION['withoutstoppage_vehId'],0,strlen($_SESSION['withoutstoppage_vehId'])-1); //die(); } // $emptyVehicleId = db__select("SELECT DISTINCT sys_service_id as sys_service_id FROM matrix.`client_vehicle_information` WHERE current_status like '%Empty%' and trip_end=0 ", ""); $emptyVehicleId = db__select("SELECT DISTINCT sys_service_id as sys_service_id FROM matrix.`client_vehicle_information` WHERE current_status like '%Empty%' and trip_end=0 and sys_user_id='".$_SESSION['UserId']."' and sys_service_id in (".$_SESSION['vehId'].")", ""); $_SESSION['Total_vehicle_empty']=count($emptyVehicleId); if(count($emptyVehicleId)>0) { foreach($emptyVehicleId as $keyempty=>$emptyvalue){ $_SESSION['empty_vehId'].=$emptyvalue['sys_service_id'].","; } $_SESSION['empty_vehId']=substr($_SESSION['empty_vehId'],0,strlen($_SESSION['empty_vehId'])-1); } $vendorvhlist = db__select("select id as sys_service_id from matrix.services where veh_reg like '%_SL%' and id in (select sys_service_id from group_services where sys_group_id=6255 and group_services.active=1)", ""); $_SESSION['Total_vendor']=count($vendorvhlist); if(count($vendorvhlist)>0) { foreach($vendorvhlist as $keyempty=>$vendorvalue){ $_SESSION['vendor'].=$vendorvalue['sys_service_id'].","; } $_SESSION['vendor']=substr($_SESSION['vendor'],0,strlen($_SESSION['vendor'])-1); } } } if (in_array($_SESSION['sys_group_id'], $ecomvehicle) || in_array($_SESSION['sys_group_id_parent'], $ecomvehicle)) { $_SESSION['vehIdLH']=""; $_SESSION['vehIdMR']=""; $_SESSION['vehIdLO']=""; $sys_group_idLH=51969; $sys_group_idMR=51968; $sys_group_idLO=51971; $VehicleidQryLH="select * from group_services where group_services.active=true and sys_Service_id in (".$_SESSION['vehId'].") and sys_group_id=".$sys_group_idLH; $VehicleidQryMR="select * from group_services where group_services.active=true and sys_Service_id in (".$_SESSION['vehId'].") and sys_group_id=".$sys_group_idMR; $VehicleidQryLO="select * from group_services where group_services.active=true and sys_Service_id in (".$_SESSION['vehId'].") and sys_group_id=".$sys_group_idLO; $VehicleIdLH = db__select($VehicleidQryLH, ""); $VehicleIdMR = db__select($VehicleidQryMR, ""); $VehicleIdLO = db__select($VehicleidQryLO, ""); $_SESSION['Total_vehicleLH']=count($VehicleIdLH); $_SESSION['Total_vehicleMR']=count($VehicleIdMR); $_SESSION['Total_vehicleLO']=count($VehicleIdLO); if(count($VehicleIdLH)>0){ foreach($VehicleIdLH as $key=>$value){ $_SESSION['vehIdLH'].=$value['sys_service_id'].","; } } $_SESSION['vehIdLH']=substr($_SESSION['vehIdLH'],0,strlen($_SESSION['vehIdLH'])-1); if(count($VehicleIdMR)>0){ foreach($VehicleIdMR as $key=>$value){ $_SESSION['vehIdMR'].=$value['sys_service_id'].","; } } $_SESSION['vehIdMR']=substr($_SESSION['vehIdMR'],0,strlen($_SESSION['vehIdMR'])-1); if(count($VehicleIdLO)>0){ foreach($VehicleIdLO as $key=>$value){ $_SESSION['vehIdLO'].=$value['sys_service_id'].","; } } $_SESSION['vehIdLO']=substr($_SESSION['vehIdLO'],0,strlen($_SESSION['vehIdLO'])-1); // ecom total active vehicles session data $_SESSION['total_active_vehicle_ecom'] = $_SESSION['vehIdLH'].','.$_SESSION['vehIdMR'].','.$_SESSION['vehIdLO']; } /**** Maintain Session For Session Master in dot net */ $key=session_id(); $qry="delete from session_master where logintime < date_add(now(),interval -5 hour)"; mysql_query($qry); $qry="insert into session_master(userid,session_key,session_value) values('".$_SESSION['UserId']."','".$key."','".$_SESSION['clientid']."')"; mysql_query($qry); $_SESSION['Session_Key']=$key; mysql_query("insert into login_attempts(sys_user_name,sys_password,ip) values('".$user_name."','".$password."','".$_SERVER['REMOTE_ADDR']."')"); $login_attempt_id=mysql_insert_id(); /**** Maintain Session For Session Master *** in dot net */ //$_SESSION['TimeZoneDiff']= $result[0]['timezone_minute']; // $_SESSION['TimeZoneDiff']="Asia/Kolkata"; } } else { header("Location: ".$base_url."index.php?msg=1"); } } catch(exception $e) { } } $REQUEST_URI = explode('?', $_SERVER['REQUEST_URI'], 2)[0]; $current_page_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$REQUEST_URI"; if (($current_page_url == $base_url) or ($current_page_url == $base_url.'index.php')) { if (isset($_SESSION['UserId'])) { if (in_array($_SESSION['sys_group_id'], $OnlyGoogleMap)) { header("Location: ".$base_url."reports/map_view.php"); } else if (in_array($_SESSION['sys_group_id'], $vimalaccount)) { header("Location: ".$base_url."reports/map_viewinternal.php"); } else if (in_array($_SESSION['sys_group_id'], $DTCReport) or in_array($_SESSION['sys_group_id_parent'], $DTCReport)) { header("Location: ".$base_url."myaccount_dtc.php"); } else if($result[0]['only_dashboard']=="123") { header("Location: ".$base_url."myaccount_onlydash.php"); } else if (in_array($_SESSION['sys_group_id'], $onlydash)) { header("Location: ".$base_url."myaccount_onlydash.php"); } else if (in_array($_SESSION['sys_group_id_parent'], $onlydashsub)) { header("Location: ".$base_url."myaccount_onlydash.php"); } else if (in_array($_SESSION['sys_group_id'], $warehouse)) { header("Location: ".$base_url."reports/temp_dashboard.php"); } else if (in_array($_SESSION['sys_group_id'], $omlogistic11)) { header("Location: ".$base_url."clientview/vehicle_status.php"); } else if (in_array($_SESSION['sys_group_id'], $omlogisticsub11)) { header("Location: ".$base_url."clientview/vehicle_status_subuser.php"); } else if (in_array($_SESSION['sys_group_id'], $mahaveeraParty)) { header("Location: ".$base_url."clientview/vehicle_status_maha.php"); } else if (in_array($_SESSION['sys_group_id'], $AllvehicleDashboard)) { header("Location: ".$base_url."allvehdashboard.php"); } else if (in_array($_SESSION['sys_group_id'], $RunningDashboard)) { header("Location: ".$base_url."rvehdashboard.php"); } else if (in_array($_SESSION['sys_group_id'], $apmDashboard)) { header("Location: ".$base_url."myaccount_apm.php"); } else if (in_array($_SESSION['sys_group_id'], $gpsapisimDashboard)) { header("Location: ".$base_url."myaccount_all.php"); } else if (in_array($_SESSION['sys_group_id'], $gpsapisimDashboardjio)) { header("Location: ".$base_url."myaccount_allj.php"); } else if (in_array($_SESSION['sys_group_id'], $machinedash)) { header("Location: ".$base_url."myaccount_machine.php"); } else if (in_array($_SESSION['sys_group_id'], $Swachfeedbackid)) { header("Location: ".$base_url."myaccount_feedback.php"); } else if (in_array($_SESSION['sys_group_id'], $tempsnowmandash)) { header("Location: ".$base_url."myaccount_tempdash.php"); } else if (in_array($_SESSION['sys_group_id'], $SNOWMANbranchlogin)) { header("Location: ".$base_url."arrival_vehtrip_snowman.php"); } else if (in_array($_SESSION['sys_group_id'], $gatewaydashboard)) { header("Location: ".$base_url."myaccountgateway.php"); } else if (in_array($_SESSION['sys_group_id'], $ChamberCustom)) { header("Location: ".$base_url."reports/temp_dashboard_customize.php"); } else if (in_array($_SESSION['sys_group_id'], $atc18hourreport)) { header("Location: ".$base_url."myaccountatc.php"); } else if (in_array($_SESSION['sys_group_id'], $ecomvehicle) || in_array($_SESSION['sys_group_id_parent'], $ecomvehicle)) { header("Location: ".$base_url."myaccountecom.php"); } else if($_SESSION['sys_group_id']==51962) { header("Location: ".$base_url."reports/poireport_ecombike.php"); } else if($_SESSION['sys_group_id']==52791 or $_SESSION['sys_group_id']==51959) { header("Location: ".$base_url."reports/vehicle_status_simplex.php"); } else if (in_array($_SESSION['sys_group_id'], $ankurcarriersdashboard)) { header("Location: ".$base_url."myaccount_ankurcarriers.php"); } else if (in_array($_SESSION['sys_group_id'], $Simtracking)) { header("Location: ".$base_url."reports/vehicle_status_sim.php"); $_SESSION['UserId']=$_SESSION['UserId']; } else if (in_array($_SESSION['sys_group_id'], $poscosteeldashboard)) { header("Location: ".$base_url."myaccountposco.php"); } else if (in_array($_SESSION['sys_group_id'], $ServicePortalOlafleet)) { header("Location: ".$base_url."clientservice/client_service_req.php"); } else if (in_array($_SESSION['sys_group_id'], $sonomac)) { header("Location: ".$base_url."myaccount_sonomac.php"); } else if (in_array($_SESSION['sys_group_id'], $OnlyViewSelectedReport)) { header("Location: ".$base_url."selectedview/myaccount.php"); } else if (in_array($_SESSION['sys_group_id'], $poiaccuratewithoutredis) || in_array($_SESSION['sys_group_id_parent'], $poiaccuratewithoutredis)) { header("Location:".$base_url."myaccountpl.php"); } else { //https://gtrac.in/newtracking/reports/map_view.php header("Location: ".$base_url."myaccount.php"); } exit; } } else { if (!isset($_SESSION['UserId'])) { header('Location: '.$base_url); exit; } } bypass_cookie_page: ?>