public function ax_set_answer() { // {{{ $member = $this->session->userdata('loginmember'); self::manager($member); $que_srl = $this->input->post('question', true); $answer = trim(strip_tags($this->input->post('answer', true))); if (empty($answer)) { echo json_encode(error_result()); die; } $hashtag = hashtag($answer); $result = $this->answerbiz->answer($answer, $hashtag, $member['mem_srl'], $member['level'], $member['mem_picture'], $que_srl); if ($result['result'] == 'ok') { echo json_encode(ok_result()); die; } echo json_encode(error_result()); }
public function ax_set_question() { // {{{ $member = $this->session->userdata('loginmember'); self::manager($member); $question = trim(strip_tags($this->input->post('question', true))); $start = $this->input->post('start', true); $main_start = $this->input->post('main_start', true); if (!empty($main_start)) { $main_start .= " 00:00:00"; } $main_end = $this->input->post('main_end', true); if (!empty($main_end)) { $main_end .= " 23:59:59"; } $que_srl = $this->input->post('que_srl', true); if (empty($question)) { echo json_encode(error_result('질문을 입력하세요.')); die; } $hashtag = hashtag($question); if (!empty($que_srl) && $que_srl > 0) { if ($member['level'] === 'manager') { $result = $this->questionbiz->update_question($que_srl, $question, $hashtag, $member['mem_srl'], $start, $main_start, $main_end); } else { $result = $this->questionbiz->update_question($que_srl, $question, $hashtag, $member['mem_srl']); } } else { if ($member['level'] === 'manager') { $result = $this->questionbiz->save_question($question, $hashtag, $member['mem_srl'], $member['mem_name'], $member['level'], $member['mem_picture'], $main_start, $main_end, $start); } else { $result = $this->questionbiz->save_question($question, $hashtag, $member['mem_srl'], $member['mem_name'], $member['level'], $member['mem_picture']); } } if ($result['result'] == 'ok') { echo json_encode(ok_result()); die; } else { echo json_encode(error_result($result['msg'])); } }
<div id="main" class="clearfix"> <div id="content" class="col"> <div id="grid"> <?php foreach ($nick as $value) { $date = generate_tanggal($value->date); $isi = hashtag(strip_tags(substr($value->text, 0, 200))); $pecah = explode(".", $value->image); $alt = $pecah[0]; ?> <div id="post-<?php echo $value->idtutorial; ?> " class="col-md-6"> <div class="article-grid"> <a class="article-img" href="<?php echo base_url(); ?> show/detail/<?php echo $value->slug; ?> "><img width="1200" height="500" src="<?php echo base_url(); ?> assets/uploads/<?php echo $value->image; ?> " class="img-responsive wp-post-image" alt="<?php echo $alt; ?> "/></a>
// show warning text $connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); // throw error exception $connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // don't colose connecion on script end $connection->setAttribute(PDO::ATTR_PERSISTENT, false); // set utf8mb4 or utf8 for connection and results $connection->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8mb4' COLLATE 'utf8mb4_unicode_ci'"); return $connection; } // połącz do bazy danych PDO $db = Conn(); // text $srt = "#ForexHolyGrail graj na #GBPJPY #US30 #WTI poziomy #500Pips (np. 105,110,115 gbpjpy) lub poziomy #WeekOpen, #MonthOpen. Maksymalnie pozycja 0.01 na każde 100\$. And do not stress just relax :]. Have a good fun ..."; // use hashtag($str, 'id456', $db); function hashtag($str = '', $postid, $PDO = 'PDO connection', $pl = '1') { if ($pl == '1') { // hashtag z polskimi literami preg_match_all("/#[^\\s]*/i", $str, $tagall); } else { // hashtag bez polskich liter preg_match_all("/#(\\w+[0-9-_a-zA-Z]\\w+)/", $str, $tagall); } // zamień hastagi na linki foreach (array_unique($tagall[0]) as $v) { $out .= str_replace($v, '<a class="hashtag" href="//hashtag.php?hash=' . $v . '" >' . $v . '</a>', $str); } echo $out; // zapisz hashtagi do bazy danych
<?php require_once '../../../wp-load.php'; switch ($_GET['show']) { case 'documentation': $title = 'Documentation'; documentation($title); break; case 'hashtag': $hashtag = $_GET['hashtag']; $title = 'Hashtag Search: ' . $hashtag; hashtag($title, $hashtag); break; default: $title = 'Documentation'; documentation($title); break; } function documentation($title) { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title><?php echo $title; ?> </title> <style type="text/css"> body {