當前位置:編程學習大全網 - 編程語言 - 超好玩魔盒ios源代碼

超好玩魔盒ios源代碼

其實魔盒的源代碼還是挺簡單的,如下就是全部代碼:

<?php

require?'./libs/Smarty.class.php';

$smarty?=?new?Smarty();

$smarty->assign('title',?'博客正文');

if(!isset($_GET["blogid"])?||?!is_numeric($_GET["blogid"]))

{

$smarty->assign('info',?'您所查看的文章不存在或已經被刪除。');

$smarty->display('wrong.html');

exit();

}

$blogid?=?$_GET["blogid"];

$mysqli?=?new?mysqli("localhost","root","","herblog");

$sql?=?"select?id,datecreate,readcnt,commentcnt,title,blog?from?blog?where?id='"?.?$blogid?.?"'";

$rst?=?$mysqli->query($sql);

if(!$rst)

{

//數據查詢出錯?

$smarty->assign('info',?'服務器忙,請稍後重試');

$smarty->display('wrong.html');

$mysqli->close();

exit();

}

if($row?=?$rst->fetch_array())

{

$smarty->assign('blog',?array(

'id'?=>?$row[0],

'date'?=>?$row[1],

'readcnt'?=>?$row[2],

'commentcnt'?=>?$row[3],

'title'?=>?$row[4],

'blog'?=>?$row[5],

));

$hasComment?=?0;

$sql?=?"select?`id`,`date`,`ip`,`user`,`text`?from?comment?where?`blogid`='"?.?$blogid?.?"'";

$rst?=?$mysqli->query($sql);

if($rst)

{

$comments?=?array();

while($row?=?$rst->fetch_array())

{

$comments[]?=?array(

'date'?=>?$row[1],

'user'?=>?$row[3],

'text'?=>?$row[4]

);

$hasComment++;

}

$smarty->assign('comments',?$comments);

}

$smarty->assign('hasComment',?$hasComment);

$smarty->display('blog.html');

}

else

{

$smarty->assign('info',?'您所查看的文章不存在或已經被刪除。');

$smarty->display('wrong.html');

}

if($rst)

{

$rst->free();

}

$mysqli->close();

>

  • 上一篇:不銹鋼刨槽機臥式和立式哪個好用
  • 下一篇:求壹段VB操作數據庫查詢的代碼
  • copyright 2024編程學習大全網