$db = "shinhwa";
$table = "board_free";
$conn = mysql_connect("localhost","guest","") or die("µ¥ÀÌŸ ¼¹ö¿¡ Á¢±Ù ÇÒ ¼ö ¾ø½À´Ï´Ù.");
mysql_select_db("$db",$conn);
function cutstr( $text , $cut_length ){
$text_len = strlen( $text );
$trim_len = strlen( substr( $text, 0, $cut_length ) );
If( $text_len > $trim_len ){
for( $jj = 0; $jj < $trim_len; $jj++ ){
$uu = ord( substr( $text, $jj, 1) );
if( $uu > 127 ){
$jj++;
}
}
$text2=substr($text,0,$jj)."..";
}else{
$jj=100;
$text2=substr($text,0,$jj);
}
return $text2;
}
?>
AVR
|
|
|
|
|
| |
 |
 |
|
|
|
|
|
|
|
|
if($mode == "write_form"){
?>
|
|
|
|
|
|
|
|
|
|
mysql_close($conn);
exit;
}
if($mode == "write_insert" ){
if ($Theme=="") {
echo " ";
exit;
}
if ($Contents=="") {
echo " ";
exit;
}
if ($Name=="") {
echo " ";
exit;
}
if ($Passwd=="") {
echo " ";
exit;
}
$query1 = "select Tot_No from $table order by Tot_No desc";
$result1 = mysql_query($query1,$conn);
if(!$result1){
$Tot[0] = 0;
}
else {
$Tot = mysql_fetch_row($result1);
}
$Tot_No=$Tot[0] + 1;
}
$dbresult = mysql_query("select Tot_No from $table order by Tot_No desc",$conn);
$totalnumber = mysql_num_rows($dbresult);
$dbresult1 = mysql_query("select Class_No from $table order by Class_No desc",$conn);
if($mode == "write_insert"){
if (!$totalnumber) {
$Tot_No=1;
$Class_No=1;
} else {
$maxnumber = mysql_result($dbresult,0,"Tot_No");
$maxrefnum = mysql_result($dbresult1,0,"Class_No");
$Tot_No = $maxnumber + 1;
$Class_No = $maxrefnum +1;
}
}
if($mode == "write_insert") {
$query2="INSERT INTO $table VALUES('$Tot_No','$Class_No','$ansnum',now(),'$Theme','$Name','$E_mail','$Contents','$Passwd','0')";
$result2=mysql_query($query2,$conn);
if(!$result2) {
echo " ";
}
}
if($mode == "reply_form"){
$query1 = "select Tot_No,Class_No,ansnum,Theme,Contents from $table where Tot_No='$No'";
$result1 = mysql_query($query1,$conn);
$bbs_value = mysql_fetch_row($result1);
$OutTot_No = $bbs_value[0];
$Class_No = $bbs_value[1];
$ansnum = $bbs_value[2];
$OutTheme = "[RE]$bbs_value[3]";
$OutCont = "\n \n \n";
$OutCont .= "========== ¿øº» ±Û ==========";
$OutCont .= "\n";
$OutCont .= ereg_replace("\n","\n",$bbs_value[4]);
$OutContents = "$OutCont";
mysql_free_result($result1);
mysql_close($conn);
}
if($mode == "reply_form"){
echo "