public function ajax_checkduplicate() { try { $posted = array(); ///is the primary key,used for checking duplicate in edit mode $posted["id"] = decrypt($this->input->post("h_id")); /*don't change*/ $posted["duplicate_value"] = get_formatted_string($this->input->post("h_duplicate_value")); if ($posted["duplicate_value"] != "") { $qry = " Where " . (intval($posted["id"]) > 0 ? " ut.id!=" . intval($posted["id"]) . " And " : "") . " ut.s_user_type='" . $posted["duplicate_value"] . "'"; $info = $this->obj_mod->fetch_multi($qry, $start, $limit); /*don't change*/ if (!empty($info)) { echo "Duplicate exists"; } else { echo "valid"; /*don't change*/ } unset($qry, $info); } } catch (Exception $err_obj) { show_error($err_obj->getMessage()); } }
public function edit_info($info, $i_id) { try { $i_ret_ = 0; ////Returns false if (!empty($info)) { $s_qry = "UPDATE " . $this->tbl . " SET "; $s_qry .= " s_user_name=? "; $s_qry .= " ,s_avatar=? "; $s_qry .= " ,s_email=? "; $s_qry .= " ,s_contact_number=? "; $s_qry .= " ,s_chat_im=? "; if (isset($info["s_password"]) && !empty($info["s_password"])) { $s_password = md5(trim($info["s_password"]) . $this->conf["security_salt"]); $s_qry .= ", s_password= '******' "; } $s_qry .= " WHERE i_id=? "; $i_ret_ = $this->db->query($s_qry, array(get_formatted_string($info["s_user_name"]), get_formatted_string($info["s_avatar"]), get_formatted_string($info["s_email"]), get_formatted_string($info["s_contact_number"]), get_formatted_string($info["s_chat_im"]), intval($i_id))); //$i_ret_=$this->db->affected_rows(); if ($i_ret_) { $logi["msg"] = "Updating " . $this->tbl . " "; $logi["sql"] = serialize(array($s_qry, array(get_formatted_string($info["s_user_name"]), get_formatted_string($info["s_avatar"]), get_formatted_string($info["s_email"]), get_formatted_string($info["s_contact_number"]), get_formatted_string($info["s_chat_im"]), intval($i_id)))); $this->log_info($logi); unset($logi, $logindata); } } unset($s_qry, $info, $i_id); return $i_ret_; } catch (Exception $err_obj) { show_error($err_obj->getMessage()); } }
public function edit_info($info, $i_id) { try { $i_ret_ = 0; ////Returns false if (!empty($info)) { $s_qry = "Update " . $this->tbl . " Set "; $s_qry .= " s_admin_email=? "; /*$s_qry.=", s_smtp_host=? "; $s_qry.=", s_smtp_password=? "; $s_qry.=", s_smtp_userid=? ";*/ $s_qry .= ", i_records_per_page=? "; $s_qry .= ", i_project_posting_approval=? "; $s_qry .= ", i_banner_speed=? "; $s_qry .= ", i_featured_slider_speed=? "; $s_qry .= ", i_auto_slide_control=? "; $s_qry .= ", i_featured_project_auto_slide_control=? "; $s_qry .= ", s_facebook_url=? "; $s_qry .= ", s_g_plus_url=? "; $s_qry .= ", s_linked_in_url=? "; $s_qry .= ", s_twitter_url=? "; $s_qry .= ", s_rss_feed_url=? "; $s_qry .= " Where i_id=? "; $i_ret_ = $this->db->query($s_qry, array(get_formatted_string($info["s_admin_email"]), intval($info["i_records_per_page"]), intval($info["i_project_posting_approval"]), intval($info["i_banner_speed"]), intval($info["i_featured_slider_speed"]), intval($info["i_auto_slide_control"]), intval($info["i_featured_project_auto_slide_control"]), get_formatted_string($info["s_facebook_url"]), get_formatted_string($info["s_g_plus_url"]), get_formatted_string($info["s_linked_in_url"]), get_formatted_string($info["s_twitter_url"]), get_formatted_string($info["s_rss_feed_url"]), intval($i_id))); //$i_ret_=$this->db->affected_rows(); if ($i_ret_) { $logi["msg"] = "Updating " . $this->tbl . " "; $logi["sql"] = serialize(array($s_qry, array(get_formatted_string($info["s_admin_email"]), intval($info["i_records_per_page"]), intval($info["i_project_posting_approval"]), intval($info["i_banner_speed"]), intval($info["i_featured_slider_speed"]), intval($info["i_auto_slide_control"]), intval($info["i_featured_project_auto_slide_control"]), get_formatted_string($info["s_facebook_url"]), get_formatted_string($info["s_g_plus_url"]), get_formatted_string($info["s_linked_in_url"]), get_formatted_string($info["s_twitter_url"]), get_formatted_string($info["s_rss_feed_url"]), intval($i_id)))); $this->log_info($logi); unset($logi, $logindata); } } unset($s_qry, $info, $i_id); return $i_ret_; } catch (Exception $err_obj) { show_error($err_obj->getMessage()); } }
public function username_exists($email, $i_user_id = '') { try { $ret_ = 0; if ($i_user_id == '') { $s_qry = "SELECT COUNT(*) i_count FROM " . $this->tbl . " WHERE "; $s_qry .= " BINARY `s_email`=? "; $this->db->trans_begin(); ///new $rs = $this->db->query($s_qry, array(get_formatted_string($email))); $this->db->trans_commit(); ///new } else { $s_qry = "SELECT COUNT(*) i_count FROM " . $this->tbl . " WHERE "; $s_qry .= " binary `s_email`=? "; $s_qry .= " AND id!=? "; $this->db->trans_begin(); ///new $rs = $this->db->query($s_qry, array(get_formatted_string($email), intval($i_user_id))); $this->db->trans_commit(); ///new } if (is_array($rs->result())) { foreach ($rs->result() as $row) { $ret_ = intval($row->i_count); } $rs->free_result(); } if ($ret_ == 0) { return false; } else { return true; } } catch (Exception $err_obj) { show_error($err_obj->getMessage()); } }