$resultArray = array(); if (isset($_GET['username'])) { header('Content-type: application/json'); if ($_GET['_unit'] == 2) { /* $host='10.249.91.207'; $usr='******'; $pwd='larrabee'; $db_name="avg8-13"; */ $host = 'localhost'; $usr = '******'; $pwd = '010535546'; $db_name = "ais"; } $xuser = chk_login($_GET['username'], $_GET['passwd']); if ($xuser) { $_user = explode(",", $xuser); // print_r($_user); $arrCol["author"] = 1; $arrCol["egat_id"] = $_user[0]; $arrCol["fullname"] = TIStoUTF($_user[1]); $arrCol["unit"] = $_GET['_unit']; } else { $arrCol["author"] = 0; } array_push($resultArray, $arrCol); echo json_encode($resultArray); } else { echo "Used : Login.php?username=egat_id&passwd=password&_unit=(1=unit 4-7,2=unit 8-13)<br><br>"; echo "Return Value :<br>";
public function edit_cms() { chk_login(); $this->data = ''; //<!-------------------code----------------> $cms_id = $this->uri->segment(3, 0); $page = $this->uri->segment(4, 0); if ($this->input->get_post('action') == 'Process') { $this->form_validation->set_rules('cms_title', 'CMS Title', 'trim|required|callback_is_name_exists'); //$this->form_validation->set_rules('cms_content', 'CMS Content', 'trim|required'); $this->form_validation->set_rules('meta_title', 'Meta Title', 'trim|required'); $this->form_validation->set_rules('meta_keys', 'Meta keys', 'trim|required'); $this->form_validation->set_rules('meta_description', 'Meta description', 'trim|required'); if ($this->form_validation->run() == FALSE) { } else { $cms_title = addslashes(trim($this->input->get_post('cms_title'))); $cms_slug = url_title(strtolower($cms_title)); $cms_content = addslashes($this->input->post('cms_content')); $cms_meta_title = addslashes($this->input->post('meta_title')); $cms_meta_key = addslashes($this->input->post('meta_keys')); $cms_meta_description = addslashes($this->input->post('meta_description')); $updArr = array('cms_title' => $cms_title, 'cms_slug' => $cms_slug, 'cms_content' => $cms_content, 'cms_meta_title' => $cms_meta_title, 'cms_meta_key' => $cms_meta_key, 'cms_meta_desc' => $cms_meta_description); $idArr = array('cms_id' => $cms_id); //$cms_image = ''; //if ($_FILES['cms_image']['name'] != "") //{ // // $upload_config['field_name'] = 'cms_image'; // $upload_config['file_upload_path'] = 'cms/'; // $upload_config['max_size'] = ''; // $upload_config['max_width'] = ''; // $upload_config['max_height'] = ''; // $upload_config['allowed_types'] = 'jpg|jpeg|gif|png'; // $thumb_config['thumb_create'] = true; // $thumb_config['thumb_file_upload_path'] = 'thumb/'; // $thumb_config['thumb_marker'] = ''; // $thumb_config['thumb_width'] = '304'; // $thumb_config['thumb_height'] = '138'; // $sUploaded = image_upload($upload_config, $thumb_config); // // $arr_user_image_old = $this->model_cms->get_single($cms_id); // $user_image_old = $arr_user_image_old[0]['cms_image']; // // if($sUploaded == '') // { // $this->nsession->set_userdata('errmsg', $sUploaded); // redirect(BACKEND_URL."cms/index/".$page."/"); // return false; // } // else // { // $cms_image = $sUploaded; // // $updArr = array( // 'cms_title' => $cms_title, // 'cms_slug' => $cms_slug, // 'cms_content' => $cms_content, // 'cms_meta_key' =>$cms_meta_key, // 'cms_meta_desc' =>$cms_meta_description, // 'cms_image' => $cms_image // ); // // if(file_exists(file_upload_absolute_path().'cms/'.stripslashes($user_image_old)) && stripslashes($user_image_old) != "") // { // unlink(file_upload_absolute_path().'cms/'.stripslashes($user_image_old)); // unlink(file_upload_absolute_path().'cms/thumb/'.stripslashes($user_image_old)); // } // // $ret = $this->model_basic->updateIntoTable(CMS,$idArr, $updArr); // if($ret) // { // $this->nsession->set_userdata('succmsg', "CMS updated successfully."); // } // else // { // $this->nsession->set_userdata('errmsg', "Unable to update. Please try again later."); // } // redirect(BACKEND_URL."cms/index/".$page."/"); // return true; // } //} //else { $ret = $this->model_basic->updateIntoTable(CMS, $idArr, $updArr); if (isset($ret)) { $this->nsession->set_userdata('succmsg', "CMS updated successfully."); } else { $this->nsession->set_userdata('errmsg', "Unable to update. Please try again later."); } redirect(BACKEND_URL . "cms/index/" . $page . "/"); return true; //} } } $row = array(); $Condition = " cms_id = '" . $cms_id . "'"; $rs = $this->model_basic->getValues_conditions(CMS, '', '', $Condition); $row = $rs[0]; if ($row) { $this->data['arr_cms'] = $row; } else { $this->nsession->set_userdata('errmsg', "Record does not exist."); redirect(BACKEND_URL . $this->data['controller'] . "/edit_cms/" . $page . "/"); return false; } //<!------------------code-----------------> //$this->data['brdLink']=''; //For breadcrump.......... $this->data['brdLink'][0]['logo'] = 'fa fa-file'; $this->data['brdLink'][0]['name'] = 'CMS'; $this->data['brdLink'][0]['link'] = 'javascript:void(0)'; $this->data['brdLink'][1]['logo'] = 'fa fa-file'; $this->data['brdLink'][1]['name'] = 'CMS Listing'; $this->data['brdLink'][1]['link'] = BACKEND_URL . "cms/index"; $this->data['brdLink'][2]['logo'] = 'fa fa-file'; $this->data['brdLink'][2]['name'] = 'Edit CMS Page'; $this->data['brdLink'][2]['link'] = 'javascript:void(0)'; //........................ $this->data['controller'] = 'cms'; $this->data['edit_link'] = BACKEND_URL . "cms/edit_cms/" . $cms_id . "/" . $page . "/"; $this->data['base_url'] = BACKEND_URL . "cms/index"; $this->data['add_url'] = BACKEND_URL . $this->data['controller'] . "/add_cms/0/" . $page . "/"; $this->data['succmsg'] = $this->nsession->userdata('succmsg'); $this->data['errmsg'] = $this->nsession->userdata('errmsg'); $this->nsession->set_userdata('succmsg', ""); $this->nsession->set_userdata('errmsg', ""); $this->templatelayout->get_topbar(); $this->templatelayout->get_leftmenu(); $this->templatelayout->get_footer(); $this->elements['middle'] = 'cms/edit'; $this->elements_data['middle'] = $this->data; $this->layout->setLayout('layout'); $this->layout->multiple_view($this->elements, $this->elements_data); }
private function faqbatchstatus($status, $idArray) { chk_login(); if ($status == '') { return false; } $return = $this->model_basic->changeStatus(FAQ, $idArray, 'faq_status', $status, 'faq_id'); if ($return == 'noitem') { $this->nsession->set_userdata('errmsg', "Please select atleast one item to change status."); } elseif ($return == 'noact') { $this->nsession->set_userdata('errmsg', "Please select an action to apply."); } elseif ($return == 'deactive') { $this->nsession->set_userdata('succmsg', "Selected faq status Activated successfully."); } elseif ($return == 'active') { $this->nsession->set_userdata('succmsg', "Selected faq status Inactivated successfully."); } return true; }
public function index() { chk_login(); $this->load->view('welcome_message'); }
public function edit() { chk_login(); $tabId = $this->uri->segment(5); $sitesettingsId = $this->uri->segment(3, 0); $page = $this->uri->segment(4, 0); $this->data['controller'] = "site_setting"; //$this->data['return_link'] = BACKEND_URL.$this->data['controller']."/index/".$page."/"; //$this->data['do_cancel_link'] = BACKEND_URL.$this->data['controller']."/index/".$page."/"; //$this->data['action'] = "Edit"; if ($this->input->get_post('action') == 'Process') { if ($tabId == '') { $this->form_validation->set_rules('sitesettings_value', 'Sitesettings Value', 'trim|required|valid_email'); } else { $this->form_validation->set_rules('sitesettings_value', 'Sitesettings Value', 'trim|required'); } if ($this->form_validation->run() == FALSE) { $this->nsession->set_userdata('errmsg', "Mandatory fields can not be blank or wrong."); redirect(BACKEND_URL . "site_setting/edit/" . $sitesettingsId . "/" . $page . "/" . $tabId); return true; } else { $this->model_sitesettings->updateOption($sitesettingsId); $this->nsession->set_userdata('succmsg', "Settings Updated successfully."); redirect(BACKEND_URL . "site_setting/index/" . $tabId); return true; } } $row = array(); $rs = $this->model_sitesettings->getSingle($sitesettingsId); $row = $rs[0]; if ($row) { //$this->data['setting_info'] = $row; foreach ($row as $key => $val) { if (!is_numeric($key)) { $this->data[$key] = $val; } } } else { $this->nsession->set_userdata('errmsg', "Record does not exist."); redirect(BACKEND_URL . $this->data['controller'] . "/index/" . $tabId . "/" . $page . "/"); return false; } $this->data['base_url'] = BACKEND_URL . "site_setting/index/" . $tabId; $this->data['succmsg'] = $this->nsession->userdata('succmsg'); $this->data['errmsg'] = $this->nsession->userdata('errmsg'); $this->nsession->set_userdata('succmsg', ""); $this->nsession->set_userdata('errmsg', ""); $this->data['edit_link'] = BACKEND_URL . "site_setting/edit/" . $sitesettingsId . "/" . $page . "/"; //For breadcrump.......... $this->data['brdLink'][0]['logo'] = 'fa fa-cogs'; $this->data['brdLink'][0]['name'] = 'Site Setting'; $this->data['brdLink'][0]['link'] = BACKEND_URL . "site_setting/index/"; $this->data['brdLink'][1]['logo'] = ''; $this->data['brdLink'][1]['name'] = 'Edit Site Settings'; $this->data['brdLink'][1]['link'] = 'javascript:void(0)'; //........................ $this->templatelayout->get_topbar(); $this->templatelayout->get_leftmenu(); $this->templatelayout->get_footer(); $this->elements['middle'] = 'sitesettings/edit'; $this->elements_data['middle'] = $this->data; $this->layout->setLayout('layout'); $this->layout->multiple_view($this->elements, $this->elements_data); }
public function edit_template() { chk_login(); $this->data = ''; $this->data['base_url'] = BACKEND_URL . "email_template"; $this->data['controller'] = "email_template"; $this->data['return_link'] = BACKEND_URL . $this->data['controller'] . "/index/"; $template_id = $this->uri->segment(3, 0); $page = $this->uri->segment(4, 0); if ($this->input->get_post('action') == 'Process') { $this->form_validation->set_rules('template_title', 'Template Title', 'trim|required'); $this->form_validation->set_rules('responce_email', 'Responce Email', 'trim|required'); $this->form_validation->set_rules('email_subject', 'Email Subject', 'trim|required'); $this->form_validation->set_rules('email_content', 'Email Content', 'trim|required'); if ($this->form_validation->run() == FALSE) { } else { $template_title = addslashes($this->input->post('template_title')); $from_email = addslashes($this->input->post('responce_email')); $email_content = addslashes($this->input->post('email_content')); $email_subject = addslashes($this->input->post('email_subject')); $template_status = addslashes($this->input->post('template_status')); $updArr = array('template_name' => $template_title, 'responce_email' => $from_email, 'email_subject' => $email_subject, 'email_content' => $email_content, 'template_status' => $template_status); //pr($updArr); $idArr = array('template_id' => $template_id); $ret = $this->model_basic->updateIntoTable(EMAILTEMPLATE, $idArr, $updArr); if (isset($ret)) { $this->nsession->set_userdata('succmsg', "Template updated successfully."); } else { $this->nsession->set_userdata('errmsg', "Unable to update. Please try again later.hhh"); } redirect(BACKEND_URL . "email_template/index/" . $page . "/"); return true; } } $row = array(); $Condition = " template_id = '" . $template_id . "'"; $rs = $this->model_basic->getValues_conditions(EMAILTEMPLATE, '', '', $Condition); $row = $rs[0]; if ($row) { $this->data['arr_template'] = $row; } else { $this->nsession->set_userdata('errmsg', "Record does not exist."); redirect(BACKEND_URL . $this->data['controller'] . "/edit_template/" . $page . "/"); return false; } //For breadcrump.......... $this->data['brdLink'][0]['logo'] = 'fa fa-envelope-o'; $this->data['brdLink'][0]['name'] = 'Email Template'; $this->data['brdLink'][0]['link'] = BACKEND_URL . "email_template/index"; $this->data['brdLink'][1]['logo'] = 'fa fa-envelope-o'; $this->data['brdLink'][1]['name'] = 'Edit Email Template'; $this->data['brdLink'][1]['link'] = 'javascript:void(0)'; //........................ $this->data['succmsg'] = $this->nsession->userdata('succmsg'); $this->data['errmsg'] = $this->nsession->userdata('errmsg'); $this->nsession->set_userdata('succmsg', ""); $this->nsession->set_userdata('errmsg', ""); $this->templatelayout->get_topbar(); $this->templatelayout->get_leftmenu(); $this->templatelayout->get_footer(); $this->elements['middle'] = 'email/edit_email_template'; $this->elements_data['middle'] = $this->data; $this->layout->setLayout('layout'); $this->layout->multiple_view($this->elements, $this->elements_data); }
function login() { global $url, $host, $port, $path, $_user, $_pwd, $_verbose; $url = "http://{$host}:{$port}" . $path . "users.php"; $out = _s($url, "", 1, "loginname={$_user}&passwd={$_pwd}&bb2_screener_="); chk_login($out); $tmp = explode("\r\n\r\n", $out); $tmp = explode("glf_session=", $tmp[0]); $tmp = explode(";", $tmp[1]); $sessid = (int) $tmp[0]; !$sessid ? die("[!] Unable to login ...") : nil; if ($_verbose) { print "[?] sessid->" . $sessid . "\n"; } return $sessid; }
public function edit_banner() { chk_login(); $this->data = ''; //<!------------code-------------------> $banner_id = $this->uri->segment(3, 0); $page = $this->uri->segment(4, 0); $this->data['controller'] = "banner"; $this->data['return_link'] = BACKEND_URL . $this->data['controller'] . "/index/" . $page; $this->data['lastOrderLimit'] = $this->model_banner->lastOrderLimit(); if ($this->input->get_post('action') == 'Process') { $this->form_validation->set_rules('banner_title', 'Alt Tag', 'trim|required|callback_is_name_exists'); if ($this->form_validation->run() == FALSE) { } else { //if(file_exists($_FILES['banner_image']['tmp_name'])) //{ // $imageDim = getimagesize($_FILES['banner_image']['tmp_name']); // if(($imageDim[0]<1680)||($imageDim[1]<773)) // { // // $this->nsession->set_userdata('errmsg', "Image dimensions do not match please upload image with dimentions 1680x773."); // redirect(base_url()."banner/index/".$page."/"); // } //} $banner_image = ''; if ($_FILES['banner_image']['name'] != "") { $upload_config['field_name'] = 'banner_image'; $upload_config['file_upload_path'] = 'banner/'; $upload_config['max_size'] = ''; $upload_config['max_width'] = '1920'; $upload_config['max_height'] = '580'; $upload_config['allowed_types'] = '*'; $thumb_config['thumb_create'] = true; $thumb_config['thumb_file_upload_path'] = 'thumb/'; $thumb_config['thumb_width'] = ''; $thumb_config['thumb_height'] = ''; $isUploaded = image_upload($upload_config, $thumb_config); $banner_image = $isUploaded; $currentFile = $this->input->post('currentFile'); $arr_banner_image_old = $this->model_banner->get_single($banner_id); $banner_image_old = $arr_banner_image_old[0]['banner_image']; if ($isUploaded == '') { $this->nsession->set_userdata('errmsg', $this->nsession->userdata('upload_err')); $this->nsession->set_userdata('upload_err', ''); redirect(base_url() . "banner/"); return false; } else { if (file_exists(FILE_UPLOAD_ABSOLUTE_PATH . 'banner/' . stripslashes($banner_image_old)) && stripslashes($banner_image_old) != "") { unlink(FILE_UPLOAD_ABSOLUTE_PATH . 'banner/' . stripslashes($banner_image_old)); unlink(FILE_UPLOAD_ABSOLUTE_PATH . 'banner/thumb/' . stripslashes($banner_image_old)); } $banner_title = addslashes($this->input->post('banner_title')); $banner_image = !$isUploaded ? $currentFile : $banner_image; $banner_order = addslashes($this->input->post('banner_order')); $banner_status = addslashes($this->input->post('banner_status')); $banner_updated_on = date('Y-m-d H:i:s'); $insertArr = array('banner_title' => $banner_title, 'banner_image' => $banner_image, 'banner_order' => !$banner_order ? '-999' : $banner_order, 'banner_status' => $banner_status, 'banner_updated_on' => $banner_updated_on); $idArr = array('banner_id' => $banner_id); $ret = $this->model_basic->updateIntoTable(BANNER_MASTER, $idArr, $insertArr); if ($ret) { $this->nsession->set_userdata('succmsg', "Banner updated successfully."); } else { $this->nsession->set_userdata('errmsg', "Unable to update. Please try again later."); } redirect(BACKEND_URL . "banner/index/" . $page . "/"); return true; } } else { $banner_title = addslashes($this->input->post('banner_title')); $banner_order = addslashes($this->input->post('banner_order')); $banner_status = addslashes($this->input->post('banner_status')); $banner_updated_on = date('Y-m-d H:i:s'); $insertArr = array('banner_title' => $banner_title, 'banner_order' => !$banner_order ? '-999' : $banner_order, 'banner_status' => $banner_status, 'banner_updated_on' => $banner_updated_on); $idArr = array('banner_id' => $banner_id); $ret = $this->model_basic->updateIntoTable(BANNER_MASTER, $idArr, $insertArr); if ($ret) { $this->nsession->set_userdata('succmsg', "Banner updated successfully."); } else { $this->nsession->set_userdata('errmsg', "Unable to update. Please try again later."); } redirect(BACKEND_URL . "banner/index/" . $page . "/"); return true; } } } $row = array(); // Prepare Data $Condition = " banner_id = '" . $banner_id . "'"; $rs = $this->model_basic->getValues_conditions(BANNER_MASTER, '', '', $Condition); $row = $rs[0]; if ($row) { $this->data['arr_banner'] = $row; } else { $this->nsession->set_userdata('errmsg', "Record does not exist."); redirect(BACKEND_URL . $this->data['controller'] . "/edit_banner/" . $page . "/"); return false; } //For breadcrump.......... $this->data['brdLink'][0]['logo'] = 'fa fa-file'; $this->data['brdLink'][0]['name'] = 'CMS'; $this->data['brdLink'][0]['link'] = 'javascript:void(0)'; $this->data['brdLink'][1]['logo'] = 'fa fa-picture-o'; $this->data['brdLink'][1]['name'] = 'Banner Listing'; $this->data['brdLink'][1]['link'] = BACKEND_URL . "banner/index"; $this->data['brdLink'][2]['logo'] = ''; $this->data['brdLink'][2]['name'] = 'Edit Banner'; $this->data['brdLink'][2]['link'] = 'javascript:void(0)'; //........................ //<!------------code-------------------> //$this->data['brdLink']=''; $this->data['base_url'] = BACKEND_URL . $this->data['controller'] . "/index/0/1/"; $this->data['edit_url'] = BACKEND_URL . $this->data['controller'] . "/edit_banner/" . $banner_id . "/" . $page . "/"; $this->data['succmsg'] = $this->nsession->userdata('succmsg'); $this->data['errmsg'] = $this->nsession->userdata('errmsg'); $this->nsession->set_userdata('succmsg', ""); $this->nsession->set_userdata('errmsg', ""); $this->templatelayout->get_topbar(); $this->templatelayout->get_leftmenu(); $this->templatelayout->get_footer(); $this->elements['middle'] = 'banner/edit'; $this->elements_data['middle'] = $this->data; $this->layout->setLayout('layout'); $this->layout->multiple_view($this->elements, $this->elements_data); }
function is_email_exists($email) { chk_login(); $logged_id = $this->nsession->userdata('admin_id'); $type = $this->nsession->userdata('role'); $bool = $this->model_adminuser->get_email_existence($email, $logged_id, $type); if (!$bool) { $this->form_validation->set_message('is_email_exists', 'The %s already exists'); return FALSE; } else { return TRUE; } }