仓酷云

标题: PHP教程之BBS(php & mysql)完全版(一) [打印本页]

作者: 小妖女    时间: 2015-2-4 00:06
标题: PHP教程之BBS(php & mysql)完全版(一)
没有人会喜欢和见异思迁的人交朋友,因为这种人太不安分,太不可靠,因此,你必须要强迫自己完成自己的目标,哪怕可能会很难受,也得坚持,毅力就是这么锻炼出来的。   //此页面为say.php
<?
include "signup/mysql.inc";
if($id1){
       $sql="select * from $table where id='$id1'";    //显示答复标题
       $result=mysql_query($sql)or die(mysql_error());
       $row=mysql_fetch_array($result);
       $title="RE:".$row["title"];

        }

$ip=$REMOTE_ADDR;
$sql="select * from user_stus where ip='$ip'";    //查询以后用户名
$result=mysql_query($sql)or die(mysql_error());
$row=mysql_fetch_array($result);

if(!$row)                                         //判别用户是不是上岸
{

echo "<html><div id=Layer2  align=center z-index:1><BR><BR><BR><BR>";
echo" <div id=Layer3  align=center z-index:2><img src=http://edu.cnzz.cn/NewsInfo/pic/3.gif width=15 height=15></div>";
echo"  <div align=center>";  
echo" <p><font size=2 color=#FF33CC>嘻嘻!! 请先上岸</font></p>";
echo"<p><font size=2 color=#FF33CC><a href='".$PHP_SELF."?p=1&&table=$table'>前往</a></font></p> </div> </html>";

exit();
}

else $userid=$row["userid"];


if($ok)
{

    if($title==""||$content=="")
    {
        echo "<BR>      请您添完全后提交";
         
    }
    else{
    $id=time();                                 //提交文章
    $date1=date("Y/m/d");
    $title=htmlspecialchars($title);
    $content=htmlspecialchars($content);

    $sql="select * from ".$table;
    $result=mysql_query($sql)or die(mysql_error());
    $row1=mysql_num_rows($result);
    $row1++;
     
    if($id1){
         
    $sql="insert into bbs_re (id,userid,date1,title,content)values('$id','$userid','$date1','$title','$content')";
    mysql_query($sql)or die(mysql_error());
    $sql="select * from ".$table." where id='$id1'";
    $result=mysql_query($sql)or die(mysql_error());
    $lin=mysql_fetch_array($result);
    for($i=1;$i<6;$i++)
        {
         $re="r".$i;
         if(!$lin["$re"])
         break;
        }
    $sql="update ".$table." set ".$re."='$id' where id='$id1'";

           }
    else   
    $sql="insert into ".$table." (id,userid,date1,title,content,row)values('$id','$userid','$date1','$title','$content','$row1')";
    $result=mysql_query($sql)or die(mysql_error());


    if($result)
       {
      
        header("Location:php3.php?p=1&&table=$table");
        exit ;
       }
    }
}


?>


<html>
<head>
<title>xiaoyang</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript1.2" src="js/menu_comment.js"></script>
<script language="JavaScript1.2" src="js/fw_menu.js"></script>
<script language="JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<div id="Layer1" style="position:absolute; left:31px; top:1px; width:560px; height:46px; z-index:10">
<script language="JavaScript1.2">fwLoadMenus();</script></div>




   
<div id="Layer6" style="position:absolute; left:409px; top:29px; width:118px; height:17px; z-index:6"></div>
<div id="Layer5" style="position:absolute; left:86px; top:63px; width:464px; height:303px; z-index:7">  
  <form name="form1" method="post" action="<? echo $PHP_SELF ?>">
    <table width="98%" border="1" cellspacing="0" cellpadding="0" bordercolor="#FF99FF">
      <tr>  
        <td width="26%" height="42">  
          <div align="center"><font size="2" color="#FF33FF">标题</font></div>
        </td>
        <td width="74%" height="42">  
          <input type="text" name="title" size="40" value="<?echo $title ;?>" >
          <input type="hidden" name="table" value="<?echo $table ;?>">
          <input type="hidden" name="id1" value="<? echo $id1 ;?>">
          <br>
        </td>
      </tr>
      <tr>  
        <td width="26%" height="172">  
          <div align="center"><font size="2" color="#FF33FF">内容</font></div>
        </td>
        <td width="74%" height="172">  
          <textarea name="content" cols="40" rows="10" wrap="physical" value="<?echo $content ;?>" ></textarea>
        </td>
      </tr>
      <tr>
        <td width="26%">
          <div align="center">
            <input type="reset" name="Submit2" value="重写">
          </div>
        </td>
        <td width="74%">
          <div align="center">
            <input type="submit" name="ok" value="宣布">
          </div>
        </td>
      </tr>
    </table>
    <p> </p>
  </form>
</div>
<div id="back" style="position:absolute; left:455px; top:30px; width:85px; height:3px; z-index:8">  
  <hr color="#ff9999" noshade>
</div>
<div id="goback" style="position:absolute; left:461px; top:23px; width:120px; height:16px; z-index:9">  
  <div align="center"><a href="php3.php?p=1&&table=<?echo $table ;?>" target="_self" ><font size="2" color="#FF33FF">前往</font></a></div>
</div>
<p> </p>
<p> </p>
</body>
</html>
毕业设计作品自己个人还是觉得比较满意的,尽管有些功能考虑的不全面,也没有很好的实现。
作者: 精灵巫婆    时间: 2015-2-4 08:50
真正的方向了,如果将来要去开发团队,你一定要学好smarty ,phplib这样的模板引擎,
作者: 爱飞    时间: 2015-2-5 00:31
有位前辈曾经跟我说过,phper 至少要掌握200个函数 编起程序来才能顺畅点,那些不熟悉的函数记不住也要一拿手册就能找到。所以建议新手们没事就看看php的手册(至少array函数和string函数是要记牢的)。
作者: 小妖女    时间: 2015-2-6 15:24
个人呢觉得,配wamp 最容易漏的一步就是忘了把$PHP$目录下的libmysql.dll拷贝到windows系统目录的system32目录下,还有重启apache。
作者: 透明    时间: 2015-2-7 01:08
没接触过框架的人,也不用害怕,其实框架就是一种命名规范及插件,学会一个框架其余的框架都很好上手的。
作者: 变相怪杰    时间: 2015-2-13 17:28
先学习php和mysql,还有css(html语言很简单)我认为现在的效果比以前的方法好。
作者: 冷月葬花魂    时间: 2015-3-2 22:25
在我安装pear包的时候老是提示,缺少某某文件,才发现 那群extension 的排列是应该有一点的顺序,而我安装的版本的排序不是正常的排序。没办法我只好把那群冒号加了上去,只留下我需要使用的扩展。
作者: 分手快乐    时间: 2015-3-5 23:55
因为blog这样的可以让你接触更多要学的知识,可以接触用到类,模板,js ,ajax
作者: 只想知道    时间: 2015-3-12 16:37
对于懒惰的朋友,我推荐php的集成环境xampp或者是wamp。这两个软件安装方便,使用简单。但是我还是强烈建议自己动手搭建开发环境。
作者: 飘飘悠悠    时间: 2015-3-14 23:52
首先我是坚决反对新手上来就用框架的,因为对底层的东西一点都不了解,造成知识上的真空,会对以后的发展不利。我的观点上手了解下框架就好,代码还是手写。当然啦如果是位别的编程语言的高手的话,这个就另当别论啦。
作者: 活着的死人    时间: 2015-3-21 14:56
Apache不是非得用80或者8080端口的,我刚开始安得时候就是80端口老占用,就用了个 81端口,结果照常,就是输localhost的时候,应该输入为 localhost:81
作者: 小女巫    时间: 2015-3-26 19:09
,熟悉html,能用div+css,还有javascript,优先考虑linux。我在开始学习的时候,就想把这些知识一起学习,我天真的认为同时学习能够互相呼应,因为知识是相通的。
作者: 若相依    时间: 2015-3-27 21:11
当然这种网站的会员费就几十块钱。
作者: 第二个灵魂    时间: 2015-4-2 12:29
对于懒惰的朋友,我推荐php的集成环境xampp或者是wamp。这两个软件安装方便,使用简单。但是我还是强烈建议自己动手搭建开发环境。
作者: 柔情似水    时间: 2015-4-3 00:17
Apache不是非得用80或者8080端口的,我刚开始安得时候就是80端口老占用,就用了个 81端口,结果照常,就是输localhost的时候,应该输入为 localhost:81
作者: 愤怒的大鸟    时间: 2015-4-10 22:37
使用zendstdio 写代码的的时候,把tab 的缩进设置成4个空格是很有必要的
作者: 小魔女    时间: 2015-4-12 09:49
最后祝愿,php会给你带来快乐的同时 你也会给他带来快乐。
作者: 飘灵儿    时间: 2015-4-12 20:07
学习php的目的往往是为了开发动态网站,phper就业的要求也涵盖了很多。我大致总结为:精通php和mysql
作者: 蒙在股里    时间: 2015-5-7 20:20
学习php的目的往往是为了开发动态网站,phper就业的要求也涵盖了很多。我大致总结为:精通php和mysql
作者: 山那边是海    时间: 2015-6-3 21:26
这些中手常用的知识,当你把我说的这些关键字都可以熟练运用的时候,你可以选择自己
作者: 灵魂腐蚀    时间: 2015-6-17 14:09
Apache不是非得用80或者8080端口的,我刚开始安得时候就是80端口老占用,就用了个 81端口,结果照常,就是输localhost的时候,应该输入为 localhost:81




欢迎光临 仓酷云 (http://ckuyun.com/) Powered by Discuz! X3.2