程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> PHP編程 >> PHP綜合 >> 我的論壇源代碼(四)

我的論壇源代碼(四)

編輯:PHP綜合
POST.PHP發布主題的頁面,發布的信息提交到OKEY.PHP中去處理。

<html>
<head>
<title>論壇發帖</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<STYLE type=text/css>
P {FONT-FAMILY: normal; FONT-SIZE: 9pt; LINE-HEIGHT: 14pt}
DIV {FONT-FAMILY: normal; FONT-SIZE: 9pt; LINE-HEIGHT: 14pt}
</STYLE>
<?
include "linkfox.inc.php";
include "info.inc.php";
?>
<LINK href="js/cpcw.css" rel=stylesheet /LINK>
</head>

<body bgcolor="#FFFFFF">
<?
$tem=$HTTP_COOKIE_VARS[FlyFoxNet];          //取COOKIE信息
$temp=explode("|",$tem);
$cookiem=$temp[0];
$useinfo=cuser($cookiem,$action);
if ($useinfo[2]=="游客") $usename=1;
?>
<table width="100%" cellpadding="4" cellspacing="0" border="0">
  <tr>
    <td height="40" rowspan="2" width="60%">
      <div align="right"></div>
      <div align="right"></div>
    </td>
    <td height="20" width="10%"> </td>
    <td height="20" width="10%"> </td>
    <td height="20" width="10%"> </td>
    <td height="20" width="10%"> </td>
  </tr>
  <tr>
    <td height="20" width="10%">
     <div align="center"><a href="reguse.php?action=xy"><img src="images/top_register.gif" width="74" height="21" border="0"></a></div>
    </td>
    <td height="20" width="10%">
      <div align="center"><a href="useinfo.php?action=find"><img src="images/top_members.gif" width="74" height="21" border="0"></a></div>
    </td>
    <td height="20" width="10%"><a href="useinfo.php?action=edit"><img src="images/top_profile.gif" width="74" height="21" border="0"></a></td>
    <td height="20" width="10%"><a href="okey.php?d=q"><img src="images/top_logout.gif" width="74" height="21" border="0"></a></td>
  </tr>
  <tr>
    <td height="20">
      <div align="left">當前位置:<font color="#0000FF">狐網─>狐網論壇─>發布論題</font>  <? echo "<font color='00dd00'>".$useinfo[2]."</font>"; ?></div>
    </td>
    <td height="20">
      <div align="center"><a href="foxbbs.php"><img src="images/index.gif" width="70" height="20" border="0" align="middle"></a></div>
    </td>
    <td height="20" width="10%">
      <div align="center"><a href="superuse.php"><img src="images/super.gif" width="70" height="20" border="0" align="middle"></a></div>
    </td>
    <td height="20" width="10%">
      <div align="center"><a href="reguse.php?action=xy"><img src="images/dl.gif" width="70" height="20" border="0" align="middle"></a></div>
    </td>
    <td height="20" width="10%">
      <div align="center"><a href="../index.php"><img src="images/fox.gif" width="70" height="20" border="0" align="middle"></a></div>
    </td>
  </tr>
</table>
<script language="JavaScript">            //這段JS用來檢查表單內信息狀態,是不是有點眼熟?呵呵……OSO上CUT下來的了。
<!--
var submitcount=0;

function checkSubmit() {
    if (submitcount == 0) {
      submitcount++;
      return true;
    } else {
            if (submitcount>0){
            alert("帖子已成功提交了,別急,等等!");
            return false;
      }
    }
}

function check_com(){
   if(document.form.title.value.length ==0){
      submitcount--;
      alert("主題不能為空!快填上吧!");
      return false;
   }

   if(document.form.message.value.length == 0){
      submitcount--;
      alert("OH!SORRY!加貼內容不能為空!");
      return false;
   }
   return true;
}
//-->
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr bgcolor="#009999">
    <td height="20"><div align='center'><font color="ffffff">
    <?            //在前面檢查是否用戶時給$USEINFO[0]賦了用戶信息。
      if ($useinfo[0]) echo "<font color='00ff00'>[".$useinfo[2]."]</font> 你好!請在下面填寫你的貼子。";
      else echo "<font color='00ff00'>".$useinfo[2]."</font>你好,請先登錄,再發帖,如果你還未注冊,請先注冊吧!";
      ?></font></div>
      </td>
  </tr>
  <tr>
    <td height="20">  </td>
  </tr>
  <tr>
    <td height="20" class="bott">
      <table width="65%" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr>
          <td height="100">
            <div align="left">
              <form name="form" method="post" onSubmit="return check_com()" ACTION='okey.php'>
                              <? if ($usename==1)       //前面檢查時如果沒找到信息,則給$usename賦值為1,這裡,用來判斷是否需要用戶身份校驗。
                       {
                  echo "用戶名:<input style='BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #000000 1px dashed; BORDER-LEFT: #000000 1px dashed; BORDER-RIGHT: #000000 1px dashed; BORDER-TOP: #000000 1px dashed; type='text' name='username' maxlength='8' size='20'>    如果你還未注冊,就來<a href='reguse.php?action=xy'>這裡注冊</a><br>";
                  echo "密 碼:<input style='BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #000000 1px dashed; BORDER-LEFT: #000000 1px dashed; BORDER-RIGHT: #000000 1px dashed; BORDER-TOP: #000000 1px dashed; type='password' name='userpass' size='20' maxlength='8'>    忘了密碼來這裡<a href='useinfo.php?c=pass'>取回密碼</a>!<p>";
                       }
                  ?>
                <div align="center">主 題:<input style="BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #000000 1px dashed; BORDER-LEFT: #000000 1px dashed; BORDER-RIGHT: #000000 1px dashed; BORDER-TOP: #000000 1px dashed;" type="text" name="title" size="40" maxlength="20"></div><br>
                <div align="center">帖子內容<br>
                  <textarea style="BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #000000 1px dashed; BORDER-LEFT: #000000 1px dashed; BORDER-RIGHT: #000000 1px dashed; BORDER-TOP: #000000 1px dashed;" name="message" wrap="VIRTUAL" cols="75" rows="10"></textarea>
                  <input type="submit" class="bott" name="Submit" value="好了!提交" onClick="return checkSubmit()">             <input type="reset" class="bott" name="Submit2" value="擦了!重寫">
                </div>
              </form>
            </div>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr bgcolor="#009999">
    <td height="20"> </td>
  </tr>
</table>
</body>
</html> 
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved