php access 留言板程式_PHP教程

來源:互聯網
上載者:User
php access 留言板程式這裡不是php與mysql的留言板程式,而是一款簡單實用的php access 留言板程式哦,利用了adodb來串連access資料庫哦。

php教程 access 留言板程式
這裡不是php與mysql教程的留言板程式,而是一款簡單實用的php access 留言板程式哦,利用了adodb來串連access資料庫教程哦。
*/

error_reporting(0);
$conn = new com("adodb.connection");
$conn->open("driver={microsoft access driver (*.mdb)}; dbq=" . realpath("db.mdb "));
$rs=new com("adodb.recordset");

$abc = $_get["abc"]; $webn = $_post["webn"]; $name = $_post["name"]; $pws = $_post["pws"]; $newpws = $_post["newpws"];
$rs->open("select * from [web]",$conn,1,1);
$adminname = $rs->fields(1)->value;
$adminpws = $rs->fields(2)->value;
$ll = $rs->fields(3)->value;
$webname = $rs->fields(4)->value;
$rs->close();
$admincookie = $adminname;

$conn->execute("update [web] set [ll] = '$ll'+1"); //$rs->close();
?>




<? echo $webname ?>


if ($abc=="admin"){
if ($name==$adminname && $pws==$adminpws){
setcookie("admin", $admincookie, time()+3600); header("location:./");
}else{echo "";}
}

if ($abc=="exit"){
setcookie("admin", "", time()-3600); header("location:./");
}

if ($abc=="editadmin"){
if (!$webname || !$name || !$pws){
echo "";
}
if ($pws!=$adminpws){
echo "";
}
if($newpws!=""){
$conn->execute("update [web] set [webname] = '$webname' , [name] = '$name' , [pws] = '$newpws'");
$conn->close(); //$conn=null;
echo "";
}else{
$conn->execute("update [web] set [webname] = '$webn' , [name] = '$name'");
$conn->close(); //$conn=null;
echo "";
}
}
?>

【 】
管理 修改資料 安全退出





$id=$_get['id'];
$sj=date('y-m-d');
if($abc=="add"){
$nr=$_post['nr'];
$ip=getenv("remote_addr");
if (!$nr){
echo "";
}else{
$conn->execute("insert into [txt] (nr,sj) values ('$nr','$sj')");
}
echo "";
$conn->close(); $conn=null;
}

if($abc=="del"){
$conn->execute("delete from [txt] where [id]=".$id);
$conn->close(); $conn=null; header("location:./");
}

if($abc=="edit"){
$nr=$_post['nr'];
$hf=$_post['hf'];
$conn->execute("update [txt] set [nr] = '$nr' , [hf] = '$hf' where [id]=".$id);
$conn->close(); $conn=null; header("location:./");
}

$zd=$_get['zd'];
if($zd!=""){
if($zd=="0")$zd=1; else $zd=0;
$conn->execute("update [txt] set [zd] = '$zd' where [id]=".$id);
$conn->close(); $conn=null; header("location:./");
}
?>





//分頁
$rs->open("select * from [txt] order by [zd] desc, [sj] desc",$conn,1,3);
$rs->pagesize=5;
$page=trim($_get['page']);
if($page=="" || is_numeric(intval($page))<=0){$page=1;}else if(intval($page)>$rs->pagecount){$page=$rs->pagecount;}
$page=intval($page);
if(!$rs->eof||$rs->bof){
$rs->absolutepage=$page; $mypagesize=$rs->pagesize; $i=$rs->recordcount()-($page-1)*$rs->pagesize;
while(!$rs->eof && $mypagesize>0 && $i>=$rs->recordcount()-1-$rs->pagesize*$page){
$id = $rs->fields(0)->value;
$nr = $rs->fields(1)->value;
$hf = $rs->fields(2)->value;
$sj = $rs->fields(3)->value;
$zd = $rs->fields(4)->value;
?>




 
操作: |
修改/回複 |
刪除



date:








$nr = str_replace("n","n".'
',$nr);
$nr = str_replace(" ",' ',$nr);
echo $nr."
";
?>
if ($hf!=""){
echo "回複:";
$hf = str_replace("n","n".'
',$hf);
$hf = str_replace(" ",' ',$hf);
echo $hf."";
}
?>

movenext; $mypagesize--; $i--; } } //分頁迴圈 ?>


留言數(recordcount(); ?>)
首頁
上頁
第/pagecount;?>頁
下頁
尾頁
訪問量()

close(); $rs=null; $conn->close(); $conn=null; ?>


資料庫結構
id name pws ll webname
1 abc abc 4 abc 留言本 php+acc

http://www.bkjia.com/PHPjc/630806.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/630806.htmlTechArticlephp access 留言板程式這裡不是php與mysql的留言板程式,而是一款簡單實用的php access 留言板程式哦,利用了adodb來串連access資料庫哦。 php教程...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.