...EGO ALPHA ET OMEGA, PRIMUS ET NOVISSIMUS, PRINCIPIUM ET FINIS...
...EGO PRAETERITUS, ET NUNC, ET POSTERUS: ET IN SEMPER...
...EGO TOTUS, UNUS IN SAECULA SAECULORUM...
Ronde des Lutins, La

 

 

 

 

單篇文章鎖碼 | 密碼:1234 網路技術 - TT


使用Javascript結合資料庫,讓Tatter Tools可獨立鎖碼單篇文章,適用於0.9X

本文同時做為範例
如果密碼輸入正確則可看到此內容
輸入錯誤則自動跳回主頁



修改方法

1.將下列語法加入mysql database

ALTER TABLE `t3_(你的前綴)` ADD `article_pass` VARCHAR(20) NOT NULL;

2.打開index.php

尋找以下語法:

$sql = "
  select
    no, category1, category2, title, body
    , user_id, image_file_path1, image_file_path2, regdate
    , rp_cnt, tb_cnt, view_cnt, is_sync, is_public
    , perm_rp, perm_tb
  from
    t3_".$dbid."

加入粗體部份:

$sql = "
  select
    no, category1, category2, title, body
    , user_id, image_file_path1, image_file_path2, regdate
    , rp_cnt, tb_cnt, view_cnt, is_sync, is_public
    , perm_rp, perm_tb, article_pass
  from
    t3_".$dbid."

尋找以下語法:

$result = @mysql_query($sql);
while(list(
  $no, $category1, $category2, $title, $body
  , $user_id, $image_file_path1, $image_file_path2, $regdate
  , $rp_cnt, $tb_cnt, $view_cnt, $is_sync, $is_public_set
  , $perm_rp, $perm_tb
  ) = @mysql_fetch_array($result)) {

加入粗體部份:

$result = @mysql_query($sql);
while(list(
  $no, $category1, $category2, $title, $body
  , $user_id, $image_file_path1, $image_file_path2, $regdate
  , $rp_cnt, $tb_cnt, $view_cnt, $is_sync, $is_public_set
  , $perm_rp, $perm_tb, $article_pass
  ) = @mysql_fetch_array($result)) {

尋找以下語法:

$category = get_category1_label($category1);
if ($category2) $category .= " - ".get_category2_label($category2);
if ($rp_cnt) $rp_cnt = "($rp_cnt)"; else $rp_cnt = "";
if ($tb_cnt) $tb_cnt = "($tb_cnt)"; else $tb_cnt = "";

加入粗體部份:


$category = get_category1_label($category1);
if ($category2) $category .= " - ".get_category2_label($category2);
if ($rp_cnt) $rp_cnt = "($rp_cnt)"; else $rp_cnt = "";
if ($tb_cnt) $tb_cnt = "($tb_cnt)"; else $tb_cnt = "";

if ($md != "pl") {
  if ($article_pass != "") $body = "<p><font color=ff0000>本文章需密碼觀看</font></p>"; // 可修改鎖碼標示字樣
  else $body = $body;
} else {
  if ($article_pass != "") {
    ?>
    <SCRIPT LANGUAGE="javascript">
    var password = prompt("請輸入密碼","")
    if (password != "<?=$article_pass?>") {
      alert('密碼錯誤,將自動移至主頁');
      window.location.href='./index.php';
    }
    </SCRIPT>
    <?
  }
}

3.打開admin/article_edit.php

尋找以下語法:

put_query("
  insert into t3_".$dbid." (
     title, body, user_id, image_file_path1, image_file_path2, regdate
    ) values (
    '輸入網誌文章主題', '輸入網誌文章內容', '$p_user_id', '$image_file_path1', '$image_file_path2', '".time()."'
    )
  ");

加入粗體部份:

put_query("
  insert into t3_".$dbid." (
    title, body, user_id, image_file_path1, image_file_path2, regdate, article_pass
    ) values (
    '輸入網誌文章主題', '輸入網誌文章內容', '$p_user_id', '$image_file_path1', '$image_file_path2', '".time()."', '$article_pass'
    )
  ");

尋找以下語法:

put_query("
  update t3_".$dbid." set
    category1 = '$category1'
    , category2 = '".$$category2."'
    , user_id = '$user_id'
    , title = '$title'
    , regdate = '$regdate'
    , body = '".trim($body)."'
    , subscription = '$subscription'
    , perm_rp = '$perm_rp'
    , perm_tb = '$perm_tb'
  where
    no = '$num'
  ");

加入粗體部份:

put_query("
  update t3_".$dbid." set
    category1 = '$category1'
    , category2 = '".$$category2."'
    , user_id = '$user_id'
    , title = '$title'
    , regdate = '$regdate'
    , body = '".trim($body)."'
    , subscription = '$subscription'
    , perm_rp = '$perm_rp'
    , perm_tb = '$perm_tb'
    , article_pass = '$article_pass'
  where
    no = '$num'
  ");

尋找以下語法:

$sql = "
  select
    category1, category2, title, body, user_id,
    image_file_path1, image_file_path2, regdate, is_public
    , subscription, perm_rp, perm_tb
  from
    t3_".$dbid."
  where
    no = $num
  ";
list (
  $category1, $category2, $title, $body, $user_id,
  $image_file_path1, $image_file_path2, $regdate, $is_public
  , $subscription, $perm_rp, $perm_tb
  ) = mysql_fetch_array(mysql_query($sql));

加入粗體部份:

$sql = "
  select
    category1, category2, title, body, user_id,
    image_file_path1, image_file_path2, regdate, is_public
    , subscription, perm_rp, perm_tb, article_pass
  from
    t3_".$dbid."
  where
    no = $num
  ";
list (
  $category1, $category2, $title, $body, $user_id,
  $image_file_path1, $image_file_path2, $regdate, $is_public
  , $subscription, $perm_rp, $perm_tb, $article_pass
  ) = mysql_fetch_array(mysql_query($sql));

尋找以下語法:

<table>
  <tr>
    <td width="75" align="right" style="padding-top:4">創建方式 :: </td>
    <td><input type="radio" value="0" name="subscription">手動操作 / 創建時間 <input type="radio" value="1" name="subscription">創建 <input type="radio" value="2" name="subscription">創建+引用傳送</td>
  </tr>
</table>

加入粗體部份:

<table>
  <tr>
    <td width="75" align="right" style="padding-top:4">創建方式 :: </td>
    <td><input type="radio" value="0" name="subscription">手動操作 / 創建時間 <input type="radio" value="1" name="subscription">創建 <input type="radio" value="2" name="subscription">創建+引用傳送</td>
  </tr>
</table>

<table style="margin-top:5">
  <tr>
    <td width="75" align="right">密碼 :: </td>
    <td><input type="text" class="text" maxlength="40" name="article_pass" value="<?=$article_pass?>" style="width:115"><br></td>
  </tr>
</table>

<? input_block(); ?>

尋找以下語法:

$sql = "
  select
    no, category1, category2, title, body, user_id, image_file_path1, image_file_path2, regdate, is_public, is_sync
  from
    t3_".$dbid."
  where
    no = $num
  ";
list ($no, $category1, $category2, $title, $body, $user_id, $image_file_path1, $image_file_path2, $regdate, $is_public, $is_sync) = mysql_fetch_array(mysql_query($sql));

加入粗體部份:

$sql = "
  select
    no, category1, category2, title, body, user_id, image_file_path1, image_file_path2, regdate, is_public, is_sync, article_pass
  from
    t3_".$dbid."
  where
    no = $num
  ";
list ($no, $category1, $category2, $title, $body, $user_id, $image_file_path1, $image_file_path2, $regdate, $is_public, $is_sync, $article_pass) = mysql_fetch_array(mysql_query($sql));
06/03/21 06:10
VIEWED (8898) TRACKBACK REPLIES (2)

Jovial 07/11/18 06:25
大人。第一步我就不知道咋做了。我不知道怎么添加第一步的数据。是用PhpMyAdmin管理登陆添加么?可是我找不到添加的地方。。。。T-T 求救来了~

Jovial 07/11/18 07:21
哈哈。搞定啦。原来看错意思了。= =/。

NAME
URL
CODE
PASS
SECRET

PAGE: 1 2 3  4  5 ...  7
TODAY: 618 | YESTERDAY: 1265 | TOTAL: 1086610