"; } if( $perm!='' ){ $allow_id=explode(',', '0,'.$perm); }else{ $allow_id='all'; } $output_categorylist.=""; return $output_categorylist; } function get_admin_id($input_username, $input_password){ //$publickey="19400rmutp"; //$input_password=md5($input_password.$publickey); $text_administrator=sprintf("SELECT * FROM administrator WHERE username='%s' AND password='%s'" ,mysql_real_escape_string($input_username) ,mysql_real_escape_string($input_password)); $query_administrator=mysql_query($text_administrator); $numrows_administrator=mysql_num_rows($query_administrator); if($numrows_administrator==1){ $result_administrator=mysql_fetch_array($query_administrator); $output_admin_id=$result_administrator[admin_id]; }else{ $output_admin_id=""; } return $output_admin_id; } function showdate($input_timestamp){ $output_showdate.=date("d/m/", $input_timestamp); /* $m=date("n",$input_timestamp); if($m==1){ $output_showdate.="มกราคม"; }elseif($m==2){ $output_showdate.="กุมภาพันธ์"; }elseif($m==3){ $output_showdate.="มีนาคม"; }elseif($m==4){ $output_showdate.="เมษายน"; }elseif($m==5){ $output_showdate.="พฤษภาคม"; }elseif($m==6){ $output_showdate.="มิถุนายน"; }elseif($m==7){ $output_showdate.="กรกฎาคม"; }elseif($m==8){ $output_showdate.="สิงหาคม"; }elseif($m==9){ $output_showdate.="กันยายน"; }elseif($m==10){ $output_showdate.="ตุลาคม"; }elseif($m==11){ $output_showdate.="พฤศจิกายน"; }elseif($m==12){ $output_showdate.="ธันวาคม"; } */ $en_year=date("Y", $input_timestamp); $th_year=$en_year+543; $output_showdate.="$th_year"; return $output_showdate; } function newslist($input_cat_id, $input_max_list, $input_full_newslist /* null=some list , 1=full list*/){ global $page; $text_query_category=sprintf("SELECT * FROM category WHERE cat_id='%s'", mysql_real_escape_string($input_cat_id)); $query_category=mysql_query($text_query_category); $result_category=mysql_fetch_array($query_category); $text_query_total_news=sprintf("SELECT * FROM news WHERE cat_id='%s' AND disable='' ", mysql_real_escape_string($input_cat_id)); $query_total_news=mysql_query($text_query_total_news); $numrows_news=mysql_num_rows($query_total_news); if($input_full_newslist==""){ if($numrows_news>$input_max_list){ $more_button=" \"More\"   "; }else{ $more_button=" "; } $limit="LIMIT 0, $input_max_list"; }else{ $maxrow=$input_max_list; if($page<1){ $page=1; $start=0; $show=$maxrow; }else{ $start=($page*$maxrow)-$maxrow; $show=$maxrow; } if(gettype($numrows_news/$maxrow)=="integer"){ $totalpage= floor($numrows_news/$maxrow); }else{ $totalpage= floor($numrows_news/$maxrow)+1; } $more_button="
$numrows_news ข่าว "; $more_button.="หน้า"; for($p=1 ; $p<=$totalpage ; $p++){ if($p==$page){ $more_button.=" $p "; }else{ $more_button.=" $p "; } } if($totalpage>1){ if($page==1){ $prev=0; $next=1; }elseif($page==$totalpage){ $prev=1; $next=0; }else{ $prev=1; $next=1; } } $more_button.=" \"Previous\"   \"Next\"
"; $limit="LIMIT $start, $show"; } $output_news=""; $output_news.="
\"$result_category[cat_name]\"
"; $text_query_news=sprintf("SELECT * FROM news WHERE cat_id='%s' AND disable='' ORDER BY news_id DESC $limit ", mysql_real_escape_string($input_cat_id)); $query_news=mysql_query($text_query_news); while($result_news=mysql_fetch_array($query_news)){ if($input_full_newslist==""){ $result_news[news_subject]=str_replace("'", "'", $result_news[news_subject]); $result_news[news_subject]=str_replace('"', """, $result_news[news_subject]); $output_news.=" "; //old script /**/ }else{ $search = array("", "", '', ""); $output_news.=" "; } } $output_news.=$more_button; $output_news.="
\"News ".showdate($result_news[news_date])." ".maxlength($result_news[news_subject],'100')."
".showdate($result_news[news_date])." $result_news[news_subject]
"; return $output_news; } function maxlength($text,$length){ if(strlen($text)>$length) { return $text=substr($text, 0, $length)."..."; } else { return $text; } } function read_file($input_pathfile){ $handle=@fopen($input_pathfile, "r"); if ($handle) { //copy($input_pathfile, $input_pathfile.".bak"); while (!feof($handle)) { $output_read_file.=fgets($handle, 4096); } fclose($handle); } return $output_read_file; } function author( $id='' ){ if( $id=='' ){ $out="Webmaster"; }else{ $q=mysql_query("select dep, url from administrator where admin_id=".$id); $rs=mysql_fetch_array($q); $out=''.$rs[dep].''; } return $out; } ?>
Fatal error: Uncaught Error: Call to undefined function mysql_real_escape_string() in /var/www/html/web2552/word.php:7 Stack trace: #0 {main} thrown in /var/www/html/web2552/word.php on line 7