菜鳥的PHP筆記(4)

來源:互聯網
上載者:User
今天開始讀add.php,add的代碼比index長一點。
<?
include("config.php");
include("function.php");
$rand=rand(0,9999); //隨機數。
if($HTTP_POST_VARS['action']=="提交"){ //不太明白這個變數?可以直接寫中文?
$randc=$_REQUEST[randc];
$namecc=$_REQUEST[$randc];
$content=$_REQUEST[content];//以上3句暫時不知道是幹什麼的。
$result.=checkuser($namecc);
$result.=checkemail($HTTP_POST_VARS['email']);//$_POST['email']??
$result.=checkqq($HTTP_POST_VARS['oicq']);///////////
$result.=checkcontent($HTTP_POST_VARS['message']);///////////
$result.=checkkw($noword,$HTTP_POST_VARS['message']);////////////
if($result){
error($result);//利用funtion.php中定義好的函數確認使用者資訊。
}
if(file_exists($dbtable)){
$fp=file($dbtable);
$num=count($fp)+1;
}else{
$num=1;
}

$ip=getenv("REMOTE_ADDR");
$addtime=date("Y-m-d H:i:s");
$fp=fopen("$dbtable","a+");
$message=htmlspecialchars($HTTP_POST_VARS['message']);///////////
if($ubb==1){
$message=ubb($message);
}
//echo $message;
$all="$num|chjia_com|$_POST[namecc]|chjia_com|$_POST[email]|chjia_com|$_POST[sex]|chjia_com|$_POST[oicq]|chjia_com|";
$all.="$_POST[homepage]|chjia_com|$ip|chjia_com|$addtime|chjia_com|$_POST[phone]|chjia_com|$_POST[pw]|chjia_com|$message\n";
@fputs($fp,$all) or die(error('寫入資訊時出錯!'));
isok("添加留言成功!請稍等...");

}

?>

以上就是菜鳥的PHP筆記(4)的內容,更多相關內容請關注topic.alibabacloud.com(www.php.cn)!

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.