前提・実現したいこと
HTMLのclass="name"から文字を読み取って日付、コメントの後に()のなかに表示したい。
いろいろ試したが、わからなかったので教えてほしいです。
PHP
PHP
1<?php 2 3<?php 4 5/* �ϐ��̒��` *///////////////////////////////////////////////////////////////////// 6 $setchar='UTF-8';/* ���{�ꕶ���Z�b�g UTF-8, Shift_JIS, EUC-JP,ISO-2022-JP */ 7 date_default_timezone_set('Asia/Tokyo'); 8 $pdate=$date=date("<b>Y/m/d H:i </b>");/* ���������L�������Ƃ��ݒ� */ 9 $lmt=100;/* ���e���������� */ 10 $kugiri='<hr style="border:1px solid #eee">';/* �L���̋��� */ 11/* �����܂� */////////////////////////////////////////////////////////////////////// 12 13 mb_language("Japanese"); 14 ini_set('mbstring.internal_encoding',$setchar); 15 if(preg_match('/utf/i',$setchar))$charcode='utf8'; 16 if(preg_match('/shift|sjis/i',$setchar))$charcode='sjis'; 17 if(preg_match('/euc/i',$setchar))$charcode='eucjp'; 18 if(preg_match('/^jis|2022/i',$setchar))$charcode='jis'; 19 mb_internal_encoding($charcode); 20 if(get_magic_quotes_gpc()){$process=array(&$_GET,&$_POST,&$_COOKIE,&$_REQUEST); 21 while(list($key,$val)=each($process)){ 22 foreach($val as $k=>$v){unset($process[$key][$k]); 23 if(is_array($v)){$process[$key][stripslashes($k)]=$v; 24 $process[]=&$process[$key][stripslashes($k)];} 25 else $process[$key][stripslashes($k)]=stripslashes($v);}} 26 unset($process);} 27 if(file_exists("hpcomment.msg"))$comment=file_get_contents("hpcomment.msg"); 28 $_POST['comment']=str_replace('�@',' ',$_POST['comment']); 29 if(!preg_match("/[\e\200-\377]/",$_POST['comment'])||mb_strlen($_POST['comment'])>$lmt)$_POST['comment']=""; 30 if($_POST['comment']){$_POST['comment']=preg_replace("/(\x20|<br>)+$/i","",$_POST['comment']); 31 $m1=array('&','"','#','$','%','\'','`','<','>','=','?','/'); 32 $m2=array('&','"','#','$','%',''','`','<','>','=','?','/'); 33 $_POST['comment']=str_replace($m1,$m2,$_POST['comment']); 34 $comment=$pdate.$_POST['comment']."\n".$comment; 35 file_put_contents("hpcomment.msg",$comment); 36 $btn="parent.document.getElementById('submit').disabled=true;";} 37 $comment=str_replace("\r","",rtrim($comment)); 38 $comment=str_replace("\n","$kugiri",rtrim($comment)); 39 if($_GET['rep']&&!$_POST['comment'])$comment=""; 40 header("cache-control: no-store, no-cache, must-revalidate"); 41 header("cache-control: post-check=0, pre-check=0"); 42 header("content-type: text/html; charset=UTF-8"); 43 if($comment){$comment=preg_replace("/&nbsp;/"," ",$comment); 44 $comment=preg_replace("/<br>/i","<br> ",$comment); 45 $comment=preg_replace("/<b>/i","<b>",$comment); 46 $comment=preg_replace("/</b>/i","</b>",$comment); 47$js="parent.document.getElementById('commentv').innerHTML='$comment'; 48parent.document.getElementById('commentv').style.display='block'; 49parent.document.getElementById('comment').value='';";} 50 else $js="return false;"; 51 print <<<HTM 52<html><head> 53<meta name="cache-control" content="No-cache"> 54<meta name="cache-control" content="Must-revalidate"> 55<meta http-equiv="content-type" content="text/html; charset=$setchar"> 56<script type="text/javascript"> 57function res(){{$js}{$btn}} 58</script> 59</head> 60<body onload="res()"> 61</body> 62</html> 63HTM; 64exit(); 65/*** 66(c)20011 Telecom Corporation.,http://bellcall.co.jp/ 67***/ 68?> 69 70
あなたの回答
tips
プレビュー