⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 write.php

📁 php写的论坛,代码精简到极点 请相看说明文件。是从英文翻译过来的:)
💻 PHP
字号:
<?
//////////////////////////////////ready
include "connect.php";
include "lib.php";
include "set_top.php";
include "header.inc";

//////////////////////////////////check
chk_bd($bd);
if(!$mode){$mode="write";}
if(($mode=="reply" || $mode=="edit") && !$no){error($error.'wrong access');}

//////////////////////////////////Competence check
$chk_admin=chk_admin_return($bd);
if(!$chk_admin){
if($mode=="write"){chk_level($set[auth_write],"no competence to write",0);}
if($mode=="reply"){chk_level($set[auth_reply],"no competence to reply",0);}
}

//////////////////////////////When make out writing and reply writing, variable establishment
if($mode=="write" || $mode=="reply"){
$name_value=$HTTP_COOKIE_VARS[$name_cookie];
$mail_value=$HTTP_COOKIE_VARS[$mail_cookie];
$home_value=$HTTP_COOKIE_VARS[$home_cookie];
$html_value="";
$link1_value="http://";
$link2_value="http://";
}

////////////////////////////////////////////////////////////////////set default content
if($mode=="write"){
$memo_value=$set[default_text];
}

/////////////////////////////////////////////////////////varialbe establishment when modify
if($mode=="edit"){
$article=selects($board_table.$bd,"and no=$no");
if(!$article){error($error.'wrong access');}
$name_value=stripslashes($article[name]);$name_readonly="readonly";
$mail_value=$article[mail];
$home_value=$article[home];
$title_value=stripslashes($article[title]);
$memo_value=stripslashes($article[memo]);

//////////////////////////////////check button
if($article[remail]){$remail_value="checked";}else{$remail_value="";}
if($article[html]){$html_value="checked";}else{$html_value="";}
if($article[secret]){$secret_value="checked";}else{$secret_value="";}
if($article[abs]==-2147483648){$notice_value="checked";}else{$notice_value="";}

//////////////////////////////////appended file+link
if($article[attach_name]){
$attach_value="&nbsp;".$article[attach_name];
$attach_del="<input type=checkbox name=attach_del value=1 id=attach_del> <label for=attach_del>Del</label>";
}
if($article[attach2_name]){
$attach2_value="&nbsp;".$article[attach2_name];
$attach2_del="<input type=checkbox name=attach2_del value=1 id=attach2_del> <label for=attach2_del>Del</label>";
}
if($article[link]){$link1_value=$article[link];}else{$link1_value="http://";}
if($article[link2]){$link2_value=$article[link2];}else{$link2_value="http://";}
}

////////////////////////////////////////////////////////////////////check and estaglish when reply
if($mode=="reply"){
$article=selects($board_table.$bd,"and no=$no");
if(!$article){error($error.'wrong access');}
if($mode=="reply" && $article[abs]==-2147483648){error($error.'Can`t reply from notice');}
$re_mark="RE ";
$title_value=stripslashes($article[title]);
if($article[secret]){$secret_value="checked";}else{$secret_value="";}
if($article[html]){$html_value="checked";}else{$html_value="";}
$article[date]=date('Y-m-d H:i:s',$article[date]);
$memo_=explode("\n",$article[memo]);
$memo_length=sizeof($memo_);
for($i=0;$i<$memo_length;$i++){$memo_value=$memo_value.">".$memo_[$i]."\n";}
$memo_value="\n\n\nMessage by $article[name] at $article[date]\n\n".stripslashes($memo_value);
}

//////////////////////////////////notice competence check
$notice_enable=0;
if($mode=="write" && ($chk_admin || $member[level]==1)){$notice_enable=1;}
if($mode=="reply"){$notice_enable=0;}
if($mode=="edit" && $article[step]==0 && ($chk_admin || $member[level]==1)){$notice_enable=1;}

//////////////////////////////////secret check
if(($mode=="reply" || $mode=="edit") && $article[secret]){
$secret=$HTTP_COOKIE_VARS[secret];
if(!$secrets[$bd][$no]){error($error.'=(');}
}

//////////////////////////////////variable to send
$send="bd=$bd&no=$no&cat_no=$cat_no&search_word=$search_word&search_title=$search_title&search_memo=$search_memo&search_name=$search_name&search_and=$search_and&";
?>

<div id="upload_layer" style="position:absolute; left:1px; top:1px; width:10; height:10; z-index:1; visibility:hidden">
<table width=10 height=10 style="filter:Alpha(Opacity=70);" bgcolor=white>
<tr><td><img src=image/upload.gif></td></tr>
</table>
</div>

<script language=javascript>
function chk(){
if(!memo.name.value){alert('<?=$error?>what is your name?');memo.name.focus();return false;}
if(!memo.title.value){alert('<?=$error?>what is the subject?');memo.title.focus();return false;}
if(!memo.memo.value){alert('<?=$error?>what is the content?');memo.memo.focus();return false;}
if(memo.secret.checked && !memo.pass.value){alert('n@boardX error :\n\nwhat is the password?');memo.pass.focus();return false;}
<?if(!$HTTP_COOKIE_VARS[$member_cookie]){echo"if(!memo.pass.value){alert('${error}what is the password?');memo.pass.focus();return false;}";}?>
if(memo.reply.checked && !memo.mail.value){alert('<?=$error?>what is your email address?');memo.mail.focus();return false;}
if(!memo.html.checked){memo.br.value=1;}
else{chk_br();}
<?if($set[attach]){echo "if(memo.attach.value){upload();}";}?>
<?if($set[attach2]){echo "if(memo.attach2.value){upload();}";}?>
}
function chk_br(){
if(!confirm('<?=$warning?>useing auto <br> function?')){memo.br.value=0;}
else{memo.br.value=1;}
}
function upload() {
upload_layer.style.posLeft=document.body.clientWidth/2+document.body.scrollLeft-150;
upload_layer.style.posTop=document.body.clientHeight/2+document.body.scrollTop-120;
upload_layer.style.visibility="visible";
}
</script>

<table width=100% height=100% align=center>
<form method="post" action=write_ing.php onsubmit="return chk()" name=memo enctype=multipart/form-data autocomplete="off">
<input type=hidden name=bd value="<?=$bd?>">
<input type=hidden name=mode value="<?=$mode?>">
<input type=hidden name=no value="<?=$no?>">
<input type=hidden name=pagenum value="<?=$pagenum?>">
<input type=hidden name=br value=0>

<tr><td valign=top>	
<?
//////////////////////////////////skin
include"$skin/write.php";
?>
</td></tr>
</form>
</table>

<?
//////////////////////////////////end
include"set_bottom.php";
mysql_close($connect);
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -