public function check_login($username, $password) { $encryption = new Encryption(); $password = $encryption->encode($password); $this->db->where('username', $username); $this->db->where('password', $password); $this->db->where('status', '1'); $this->db->where('backend_login', '1'); $results = $this->db->getOne("users"); if ($results) { $_SESSION['login'] = true; $_SESSION['user_logged_in_name'] = $results['name'] . " " . $results['lastname']; $_SESSION['user_id'] = $results['id']; create_log_action($_SESSION['user_id'], 'User Logged in!'); return true; } else { return false; } }
$allDataInSheet = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true); $arrayCount = count($allDataInSheet); // Here get total count of row in that Excel sheet for ($i = 1; $i <= $arrayCount; $i++) { $card_code = trim($allDataInSheet[$i]["A"]); $card_name = trim($allDataInSheet[$i]["B"]); $group_code = trim($allDataInSheet[$i]["C"]); $region = trim($allDataInSheet[$i]["D"]); $address = trim($allDataInSheet[$i]["E"]); $zip_code = trim($allDataInSheet[$i]["F"]); $city = trim($allDataInSheet[$i]["G"]); $mail_address = trim($allDataInSheet[$i]["H"]); $mail_zip_code = trim($allDataInSheet[$i]["I"]); $phone1 = trim($allDataInSheet[$i]["J"]); $phone2 = trim($allDataInSheet[$i]["K"]); $cellular = trim($allDataInSheet[$i]["L"]); $fax = trim($allDataInSheet[$i]["M"]); $contact_person = trim($allDataInSheet[$i]["N"]); $country = trim($allDataInSheet[$i]["O"]); $country_code = trim($allDataInSheet[$i]["P"]); $email = trim($allDataInSheet[$i]["Q"]); $block = trim($allDataInSheet[$i]["R"]); $insert = array("card_code" => $card_code, "card_name" => $card_name, "group_code" => $group_code, "region" => $region, "address" => $address, "zip_code" => $zip_code, "city" => $city, "mail_address" => $mail_address, "mail_zip_code" => $mail_zip_code, "phone1" => $phone1, "phone2" => $phone2, "cellular" => $cellular, "fax" => $fax, "contact_person" => $contact_person, "country" => $country, "country_code" => $country_code, "email" => $email, "block" => $block, "status" => "1", "date_created" => date("Y-m-d H:i:s")); $res = $db->insert("customer", $insert); } $action_msg = 'Customer List was successfully uploaded!'; $res ? $_SESSION['result'] = array('res' => 'success', 'msg' => $action_msg) : ($_SESSION['msg'] = array('res' => 'danger', 'msg' => 'There was an error! Please try again!')); create_log_action($_SESSION['user_id'], $action_msg); echo '<meta http-equiv="refresh" content="0;url=' . BASEURL . 'customer/search">'; unlink($storagename); }