相互リンク利用規約

あなたのサイトに相互リンクが設置されているか自動で確認し、リンク集へ登録することができます。
そのため、リンク集へ登録するためには相互リンク必須となっております。
あなたのサイトへ下記のリンクタグを設置後、各カテゴリーから申請下さい。

'; // 注意書き2 var $caution2 = '

登録先と相互リンク設置先のドメインが違う場合は登録されません。

【利用規約:下記のサイトの登録はご遠慮ください】

相互リンク設置ページは管理人の方で簡単に確認できます。
階層が深いページや、検索エンジンが拾っていないページに相互リンクを設置されても、目視の上、削除させてもらいます。
悪質な場合は、ホスト毎登録拒否にさせてもらいます。
その他、管理者が不適切と判断したものは、相互リンク登録後も削除させていただく場合があります

'; // 広告表示 var $ad_mode = 0;// 「広告表示しない:0」「インデックスページのみ適用:1」「全HTMLに適用:2」 var $ad_top = '';// 上に表示 var $ad_mid = '';// 中間に表示(インデックスページのみ) var $ad_bot = '';// 下に表示 ////////////////////////////// 設定はここまで ////////////////////////////// // HTMLヘッダ function html_header($title) { $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "".$title."\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; return $html; } // HTMLフッタ function html_footer() { $html .= $this->html_powered(); $html .= "\n"; $html .= ""; return $html; } // 著作者リンク表示 function html_powered() { $html = "
\n著作 P-Link 1.01 - 改造 相互リンクSEO-P-Link ver1.2
\n"; return $html; } // 管理モードメイン画面(管理) function html_category() { $category_data = file($this->categoryfile); $all = 0; $color_flag = TRUE; foreach ($category_data as $value) { $html_pre .= "\n"; list($cate_name,$cate_url,$cate_item) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($color_flag) { $td_class = " class=\"no_border\""; $color_flag = FALSE; } else { $td_class = " class=\"no_border2\""; $color_flag = TRUE; } $html_pre .= "[".($all+1)."] self."?mode=admin&admin_mode=list_edit&id=".$cate_url."&pass=".$this->pass."\">".$cate_name." ".$cate_url." (".$cate_item.") self."?mode=admin&admin_mode=category_edit_form&id=".$cate_url."&pass=".$this->pass."\">編集 self."?mode=admin&admin_mode=category_delete&id=".$cate_url."&pass=".$this->pass."\" onClick='return confirm(\"カテゴリー【".$cate_name."】を削除します。よろしいですか?\")'>削除\n"; $html_pre .= "\n"; $all++; } $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "

".$this->title."(管理モード)

"; $html .= ""; $html .= "

\n"; $html .= "
self."?mode=admin&admin_mode=category_add&pass=".$this->pass."\">\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "
カテゴリー追加
\n"; $html .= "カテゴリー名(日本語) : 一覧等に表示される名称です
\n"; $html .= "カテゴリー名(半角英数) : HTMLファイル名等に使用されます
\n"; $html .= "表示順 : カテゴリー一覧表示の順番を指定します

\n"; $html .= " "; $html .= " "; $html .= "
\n"; $html .= "
\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n

    \n"; $html .= "
  • カテゴリーを削除すると、そこに登録されたデータも全てクリアされます。削除の際は充分に注意してください。
  • \n"; if ($this->html_unlink == 0) { $html .= "
  • カテゴリーを削除してもHTMLファイルだけは残ります。
  • \n"; } else { $html .= "
  • カテゴリーを削除すると、HTMLファイルも同時に削除されます。
  • \n"; } $html .= "

\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= $html_pre; if ($all == 0) { $html .= "\n"; $html .= "\n"; $html .= "\n"; } $html .= "
カテゴリー一覧
現在カテゴリーがありません。「カテゴリー追加」フォームで作成してください。
\n"; $html .= "\n"; return $html; } // 登録リスト編集画面(管理) function html_list_edit() { $page_cate_data = file($this->categoryfile); foreach ($page_cate_data as $value) { list($page_cate_name_j,$page_cate_url,$page_cate_item) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($page_cate_url == $this->id) { $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "

".$this->title."(管理モード)

\n"; $html .= "
【".$page_cate_name_j."】
"; $html .= "

\n"; $html .= "\n"; $html .= "\n"; $html .= "\n\n\n
\n"; $html .= "
\n"; $html .= "
\n"; $html .= "
カテゴリー一覧
\n"; // カテゴリー一覧 $cate_data = file($this->categoryfile); foreach ($cate_data as $value) { list($cate_name_j,$cate_url,$cate_item) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($cate_url == $page_cate_url) { $html .= "\n"; } else { $html .= "\n"; } } $html .= "

\n"; // 登録フォーム $html .= "
self."?mode=admin&admin_mode=regist&category=".$page_cate_url."&pass=".$this->pass."\">\n"; $html .= "admin_pass."\" />"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "
カテゴリー【".$page_cate_name_j."】に登録
\n"; $html .= "●サイト名(全角) :
\n"; $html .= "●URL(半角) :  末尾は必ず「/」で記入下さい。
\n"; $html .= "●説明文(全角) :
\n
\n"; $html .= "●相互リンク設置URL
\n"; $html .= "●パスワード : 管理パスワードが自動的に入力されます。\n"; $html .= "
※複数のカテゴリーに登録することはできませんのでご注意ください。
"; $html .= "
※管理モードでは、文字数の制限がありません。
"; $html .= "
\n"; $html .= " "; $html .= " "; $html .= "
\n"; $html .= "
\n"; // 登録サイト一覧 $list_data = file($this->listfile); $color_flag = TRUE; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; foreach ($list_data as $value) { list($l_cate_url,$url,$name,$caption,$time,$user_pass,$host,$relinkURL) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($l_cate_url != $page_cate_url) { continue; } if ($color_flag) { $td_class = " class=\"no_border\""; $color_flag = FALSE; } else { $td_class = " class=\"no_border2\""; $color_flag = TRUE; } $html .= "\n"; $html .= ""; $html .= "".$name.""; $html .= "\n"; $html .= ""; $html .= $caption; $html .= "\n
□ 最終更新時間[".date("y/m/d H:i:s",$time)."]
\n
□ 登録者ホスト[".$host."]
\n"; $html .= "
□ 相互リンク設置先[".$relinkURL."]
\n"; $html .= "
\n"; $html .= "\n"; } $html .= "
サイト名説明文 
"; $html .= "self."?mode=admin&admin_mode=edit_form&id=".$url."&pass=".$this->pass."\">編集
\n"; $html .= "self."?mode=admin&admin_mode=delete_form&id=".$url."&pass=".$this->pass."\">削除\n"; $html .= "
\n

\n"; $html .= "\n"; break; } } return $html; } // カテゴリー削除処理(管理) function category_delete() { $cate_data = file($this->categoryfile); $i = 0; foreach ($cate_data as $value) { list($cate_name,$cate_url,$cate_item) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($this->id == $cate_url) { unset($cate_data[$i]); } $i++; } $list_data = file($this->listfile); $i = 0; foreach ($list_data as $value) { list($l_cate_url,$url,$name,$caption,$time,$user_pass,$host) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($this->id == $l_cate_url) { unset($list_data[$i]); } $i++; } if ($this->html_unlink == 1) {// カテゴリーページHTML削除 unlink($this->id); } $fp_cate = fopen($this->categoryfile,"w"); flock($fp_cate,LOCK_EX); foreach ($cate_data as $value) { fputs($fp_cate,$value); } flock($fp_cate,LOCK_UN); fclose($fp_cate); $fp_list = fopen($this->listfile,"w"); flock($fp_list,LOCK_EX); foreach ($list_data as $value) { fputs($fp_list,$value); } flock($fp_list,LOCK_UN); fclose($fp_list); $this->html_index_restore();// インデックスページ再構築 $this->html_category_restore();// 全カテゴリーページ再構築 echo "self."?mode=admin&admin_mode=category&pass=".$this->pass."\">"; } // カテゴリー編集フォーム(管理) function html_category_edit() { $cate_data = file($this->categoryfile); $all = 0; foreach ($cate_data as $value) { list($cate_name,$cate_url,$cate_item) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($this->id == $cate_url) { $name = $cate_name; $url = $cate_url; $item = $cate_item; $num = $all + 1; } $all++; } $html .= "
self."?mode=admin&admin_mode=category_edit&pass=".$this->pass."\">\n"; $html .= "
\n"; $html .= "
\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "
カテゴリー編集 self."?mode=admin&admin_mode=list_edit&id=".$url."&pass=".$this->pass."\">".$url."
\n"; $html .= "カテゴリー名(日本語) : 一覧等に表示される名称です
\n"; $html .= "表示順 : カテゴリー一覧表示の順番を指定します

\n"; $html .= " "; $html .= " "; $html .= "
\n"; $html .= "戻る\n"; $html .= "
\n"; $html .= "
\n"; $html .= "\n"; return $html; } // カテゴリー追加編集処理(管理) function category_add() { $this->cate_name_j = $this->html_conv($this->cate_name_j); $cate_data = file($this->categoryfile); // 入力チェック if ($this->cate_name_j == "") { echo $this->html_err("カテゴリー名(日本語)を入力してください。"); exit; } if ($this->cate_name_e == "") { echo $this->html_err("カテゴリー名(半角英数)を入力してください。"); exit; } if (preg_match("/[^a-zA-Z0-9_~-]/",$this->cate_name_e) and $this->admin_mode != "category_edit") { echo $this->html_err("カテゴリー名(半角英数)に、使用できない文字が含まれています。(使用可能文字:a-z A-Z 0-9 - _ ~)"); exit; } if ($this->cate_name_e == "index") { echo $this->html_err("indexは使用できません。"); exit; } if ($this->admin_mode == "category_add") {// 新規追加時のみのチェック foreach ($cate_data as $value) { list($cate_name_j,$cate_url,$cate_item) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); list($cate_name_e) = explode(".",$cate_url); if ($this->cate_name_j == $cate_name_j) { $err_message = "

同じカテゴリー名(日本語)が既に存在します。

\n"; $err_flag = TRUE; } if ($this->cate_name_e == $cate_name_e) { $err_message .= "

同じカテゴリー名(半角英数)が既に存在します。

\n"; $err_flag = TRUE; } if ($err_flag) { echo $this->html_err($err_message); exit; } } } $fp = fopen($this->categoryfile,"w") or exit($this->html_err("カテゴリーファイルオープン失敗")); flock($fp,LOCK_EX) or exit($this->html_err("カテゴリーファイルロック失敗")); // カテゴリー新規追加 if ($this->admin_mode == "category_add") { $new_cate_url = $this->cate_name_e.".html"; $newstr = $this->cate_name_j."\t".$new_cate_url."\t0\t\n"; $i = 1; foreach ($cate_data as $value) { list($cate_name_j,$cate_url,$cate_item) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($this->num == $i) {// カテゴリー追加 fputs($fp,$newstr); $flag = TRUE; $i++; } fputs($fp,$value);// 既存カテゴリー $i++; } if (!$flag) {// 最後尾 fputs($fp,$newstr); } // カテゴリー編集 } elseif ($this->admin_mode == "category_edit") { $newstr = $this->cate_name_j."\t".$this->cate_name_e."\t".$this->item."\t\n"; $i = 1; foreach ($cate_data as $value) { list($cate_name_j,$cate_url,$cate_item) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($this->num == $i) {// カテゴリー更新 fputs($fp,$newstr); $flag = TRUE; $i++; } if ($cate_url != $this->cate_name_e) { fputs($fp,$value); $i++; } } if (!$flag) {// 最後尾 fputs($fp,$newstr); } } flock($fp,LOCK_UN); fclose($fp); $this->html_index_restore();// インデックスページ再構築 $this->html_category_restore();// 全カテゴリーページ再構築 echo "self."?mode=admin&admin_mode=category&pass=".$this->pass."\">"; } // インデックスページ再構築(管理) function html_index_restore() { $index_html .= "

".$this->title."

\n"; $index_html .= "
\n"; $index_html .= "return_url."\">".$this->mysitetitle."トップへ > "; $index_html .= "".$this->title."
\n"; $index_html .= "
"; // 広告(上) if (($this->ad_mode == 1 or $this->ad_mode == 2) and $this->ad_top != "") { $index_html .= "
".$this->ad_top."
\n"; } // 注意書き $index_html .= $this->caution1; $index_html .= "

<a href="".$this->return_url."" target="_blank">".$this->mysitetitle."</a>

"; $index_html .= $this->caution2; // カテゴリー一覧 $index_html .= "\n"; $index_html .= "\n"; $index_html .= "\n"; $cate_data = file($this->categoryfile); $i = 1; $color_flag = TRUE; foreach ($cate_data as $value) { list($cate_name_j,$cate_url,$cate_item) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($color_flag) { $td_class = " class=\"link_linkmap_even\""; $color_flag = FALSE; } else { $td_class = " class=\"link_linkmap_odd\""; $color_flag = TRUE; } if ((($i - 1) % 3) == 0) { $index_html .= "\n"; $index_html .= "\n"; } $index_html .= "".$cate_name_j." (".$cate_item.")\n"; $i++; } $index_html .= "\n"; $index_html .= "
カテゴリー一覧
\n"; // 広告(中) if (($this->ad_mode == 1 or $this->ad_mode == 2) and $this->ad_mid != "") { $index_html .= "
".$this->ad_mid."
\n"; } // 新着表示 $list_data = file($this->listfile); $color_flag = TRUE; $index_html .= "\n"; $index_html .= "\n"; $index_html .= "\n"; $index_html .= "\n"; $index_html .= "\n"; $index_html .= "\n"; $index_html .= "\n"; $index_html .= "\n"; $index_html .= "\n"; $i = 0; foreach ($list_data as $value) { if ($i >= $this->newsite) { break; } list($l_cate_url,$url,$name,$caption,$time,$user_pass,$host) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); foreach ($cate_data as $value) { list($cate_name_j,$cate_url,$cate_item) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($cate_url == $l_cate_url) { break; } } if ($color_flag) { $td_class = " class=\"link_log_even\""; $color_flag = FALSE; } else { $td_class = " class=\"link_log_odd\""; $color_flag = TRUE; } $index_html .= "\n"; $index_html .= ""; $index_html .= "".$name.""; $index_html .= "\n"; $index_html .= ""; $index_html .= $caption; $index_html .= "\n"; $index_html .= ""; $index_html .= "".$cate_name_j.""; $index_html .= "\n"; $index_html .= "\n"; $i++; } $index_html .= "
新着サイトTOP".$this->newsite."
サイト名説明文カテゴリー

\n"; // 広告(下) if (($this->ad_mode == 1 or $this->ad_mode == 2) and $this->ad_bot != "") { $index_html .= "
".$this->ad_bot."

\n"; } $index_html .= "\n"; $index_html .= "\n"; // インデックスページ生成 $fp_index = fopen("index.html","w"); flock($fp_index,LOCK_EX); fputs($fp_index,$this->html_header($this->title)); fputs($fp_index,$index_html); fputs($fp_index,$this->html_footer()); flock($fp_index,LOCK_UN); fclose($fp_index); } // 全カテゴリーページ再構築(管理) function html_category_restore() { $page_cate_data = file($this->categoryfile); foreach ($page_cate_data as $value) { list($page_cate_name_j,$page_cate_url,$page_cate_item) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); $newcate_html = $this->html_header($this->title."【".$page_cate_name_j."】"); $newcate_html .= "

".$this->title."【".$page_cate_name_j."】

\n"; // 広告(上) if ($this->ad_mode == 2 and $this->ad_top != "") { $newcate_html .= "
".$this->ad_top."

\n"; } $newcate_html .= "
"; $newcate_html .= "return_url."\">".$this->mysitetitle."トップへ > \n"; $newcate_html .= "return_url_link."\">".$this->title." > \n"; $newcate_html .= "".$page_cate_name_j."\n"; $newcate_html .= "
\n"; $newcate_html .= "
"; $newcate_html .= "
\n"; $newcate_html .= "
カテゴリー
\n"; $newcate_html .= "
    "; // カテゴリー一覧 $cate_data = file($this->categoryfile); foreach ($cate_data as $value) { list($cate_name_j,$cate_url,$cate_item) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($cate_url == $page_cate_url) { $newcate_html .= "
  • ".$cate_name_j." (".$cate_item.")
  • \n"; } else { $newcate_html .= "
  • ".$cate_name_j." (".$cate_item.")
  • \n"; } } $newcate_html .= "
"; $newcate_html .= "
"; $newcate_html .= "
"; // 登録フォーム $newcate_html .= "
".$page_cate_name_j."カテゴリーに登録
\n"; $newcate_html .= "
self."?mode=regist&category=".$page_cate_url."\">\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "
\n"; $newcate_html .= "サイト名(全角".$this->namelimit."文字以内)\n"; $newcate_html .= "\n"; $newcate_html .= ""; $newcate_html .= "
\n"; $newcate_html .= "URL(半角".$this->urllimit."文字以内)\n"; $newcate_html .= "\n"; $newcate_html .= "\n
末尾は必ず「/」で記入下さい。\n"; $newcate_html .= "
\n"; $newcate_html .= "説明文(全角".$this->captionlimit."文字".$this->rawlimit."行以内)\n"; $newcate_html .= "
\n"; $newcate_html .= "\n"; $newcate_html .= "
\n"; $newcate_html .= "相互リンク設置URL\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "
\n"; $newcate_html .= "パスワード\n
(半角10文字以内)\n"; $newcate_html .= "
\n"; $newcate_html .= "\n"; $newcate_html .= "
\n"; $newcate_html .= "リンクタグ
\n<a href="".$this->return_url."" target="_blank">".$this->mysitetitle."</a>
\n"; $newcate_html .= "複数のカテゴリーに登録することはできませんのでご注意ください。\n"; $newcate_html .= "
\n"; $newcate_html .= " "; $newcate_html .= " "; $newcate_html .= "
\n"; $newcate_html .= "
\n"; // 登録サイト一覧 $list_data = file($this->listfile); $color_flag = TRUE; $newcate_html .= "
".$page_cate_name_j."登録サイト一覧
\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "\n"; foreach ($list_data as $value) { list($l_cate_url,$url,$name,$caption,$time,$user_pass,$host) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($l_cate_url != $page_cate_url) { continue; } if ($color_flag) { $td_class = " class=\"link_log_even\""; $color_flag = FALSE; } else { $td_class = " class=\"link_log_odd\""; $color_flag = TRUE; } $newcate_html .= "\n"; $newcate_html .= ""; $newcate_html .= "".$name.""; $newcate_html .= "\n"; $newcate_html .= ""; $newcate_html .= $caption; $newcate_html .= "\n"; $newcate_html .= "\n"; $newcate_html .= "
"; $newcate_html .= "self."?mode=edit_form&id=".$url."\">編集
\n"; $newcate_html .= "self."?mode=delete_form&id=".$url."\">削除\n"; $newcate_html .= "
\n"; $newcate_html .= "\n"; $newcate_html .= "
\n"; } $newcate_html .= "\n"; $newcate_html .= "
"; // 広告(下) if ($this->ad_mode == 2 and $this->ad_bot != "") { $newcate_html .= "
".$this->ad_bot."
\n"; } $newcate_html .= "\n"; $newcate_html .= $this->html_footer(); $fp_newcate = fopen($page_cate_url,"w"); flock($fp_newcate,LOCK_EX); fputs($fp_newcate,$newcate_html); flock($fp_newcate,LOCK_UN); fclose($fp_newcate); } } // 全HTML再構築(管理) function all_restore() { $this->html_index_restore(); $this->html_category_restore(); echo "self."?mode=admin&admin_mode=category&pass=".$this->pass."\">"; } // リンク登録処理(管理兼用) function regist() { $list_data = file($this->listfile); $cate_data = file($this->categoryfile); // 入力チェック if ($this->webname == "") { $err_message .= "
  • サイト名を入力してください。
  • \n"; $err_flag = TRUE; } if ($this->weburl == "" or $this->weburl == "http://") { $err_message .= "
  • URLを入力してください。
  • \n"; $err_flag = TRUE; } if ($this->webcaption == "") { $err_message .= "
  • 説明文を入力してください。
  • \n"; $err_flag = TRUE; } if ($this->chklink == "") { $err_message .= "
  • 相互リンクURLを入力してください。
  • \n"; $err_flag = TRUE; } if ($this->user_pass == "") { $err_message .= "
  • パスワードを入力してください。
  • \n"; $err_flag = TRUE; } if ($this->mode != "admin") {// 管理モードではチェックなし if (strlen($this->webname) > ($this->namelimit * 2)) { $err_message .= "
  • サイト名が長すぎます。全角".$this->namelimit."文字以内にしてください。
  • \n"; $err_flag = TRUE; } if (strlen($this->weburl) > $this->urllimit) { $err_message .= "
  • URLが長すぎます。半角".$this->urllimit."文字以内にしてください。
  • \n"; $err_flag = TRUE; } if (strlen($this->webcaption) > ($this->captionlimit * 2)) { $err_message .= "
  • 説明文が長すぎます。全角".$this->captionlimit."文字以内にしてください。
  • \n"; $err_flag = TRUE; } if (ereg("(.*
    .*){".$this->rawlimit.",}",$this->html_conv($this->webcaption))) { $err_message .= "
  • 改行が多すぎます。".$this->rawlimit."行以内にしてください。
  • \n"; $err_flag = TRUE; } } foreach ($list_data as $value) { list($l_cate_url,$url,$name,$caption,$time,$user_pass,$host) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($url == $this->weburl) { foreach ($cate_data as $value) { list($cate_name_j,$cate_url,$cate_item) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($l_cate_url == $cate_url) { break; } } $err_message .= "
  • そのURLは既に登録されています。(カテゴリー【".$cate_name_j."】
  • \n"; $err_flag = TRUE; break; } } if ($err_flag) { echo $this->html_err("
      \n".$err_message."
    \n"); exit; } // リンクの設置を確認 $mysite = $this->return_url; $anchor = $this->mysitetitle; if ($this->mode != "admin") {// 管理モードではチェックなし $chklinktag = ''.$anchor.''; $linktag = '<a href="'.$mysite.'" target="_blank">'.$anchor.'</a>'; // フォームから相互リンク設置URLをゲット $linkURL = $this->chklink; // 相互リンク設置URLのhttp://を削除 $linkURL = str_replace("http://", "", $linkURL); // 相互リンク設置URLのHostをゲット $linkHost = substr($linkURL, 0, strpos($linkURL, "/")); // フォームから登録URLをゲット $weburlURL = $this->weburl; // 登録URLのhttp://を削除 $weburlURL = str_replace("http://", "", $weburlURL); // 登録URLのHostをゲット $weburlHost = substr($linkURL, 0, strpos($weburlURL, "/")); // 登録URLとリンク設置URLが同じか確認 if ($linkHost != $weburlHost) { echo "サイトURLと相互リンク設置URLのドメインが違います。
    あなたのサイト内へリンクタグ
    "."$linktag"."
    を設置してください。"; return false; } // 相互リンク設置URLのPathをゲット $Path = substr($linkURL, strpos($linkURL, "/")); // 80接続 $fp = fsockopen($linkHost, "80", $ErrNo, $ErrStr, 10); $aString = ""; if (!$fp) { echo "相互リンク先が見つかりません。"; return false; } else { // 読み込みのタイムアウト設定 socket_set_timeout($fp, 2); fputs($fp, "GET ". $Path . " HTTP/1.0\r\nHost:" . $linkHost . "\r\n\r\n"); while(!feof($fp)) $aString.=fgets($fp, 256); // タイムアウトしたか調べる $stat = socket_get_status($fp); if ($stat["timed_out"]) { $err_message .= "相互リンク設置先がタイムアウトしました。"; $err_flag = TRUE; return false; } } fclose($fp); $pos = strpos($aString, $mysite); } if ($this->mode == "admin") {// 管理モードでは常に相互リンク確認済み $pos =1; } // 相互リンク確認済み if ($pos > 0) { // 登録リストファイル更新 $new_time = time(); $new_str = $this->category."\t".$this->html_conv($this->weburl)."\t".$this->html_conv($this->webname)."\t". $this->html_conv($this->webcaption)."\t".$new_time."\t".md5($this->user_pass)."\t".$this->host."\t".$this->html_conv($this->chklink)."\t\n"; $fp_list = fopen($this->listfile,"w"); flock($fp_list,LOCK_EX); fputs($fp_list,$new_str); foreach ($list_data as $value) { fputs($fp_list,$value); } flock($fp_list,LOCK_UN); fclose($fp_list); // カテゴリーファイル更新 $i = 0; foreach ($cate_data as $value) { list($cate_name_j,$cate_url,$cate_item) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($cate_url == $this->category) { $cate_data[$i] = $cate_name_j."\t".$cate_url."\t".($cate_item + 1)."\t\n"; } $i++; } $fp_cate = fopen($this->categoryfile,"w"); flock($fp_cate,LOCK_EX); foreach ($cate_data as $value) { fputs($fp_cate,$value); } flock($fp_cate,LOCK_UN); fclose($fp_cate); } else { $err_message .= "相互リンクが完了していません。
    あなた様のサイトへ下記のリンクタグ
    "."$linktag"."
    をそのまま貼り付けてください。
    タグを改変するとリンクされません。"; $err_flag = TRUE; } $this->html_index_restore();// インデックスページ再構築 $this->html_category_restore();// 全カテゴリーページ再構築 if ($err_flag) { echo $this->html_err("
      \n".$err_message."
    \n"); exit; } if ($this->mode != "admin") { header("Location: ".$this->category); } else { echo "self."?mode=admin&admin_mode=list_edit&id=".$this->category."&pass=".$this->pass."\">"; } } // リンク削除画面(管理兼用) function html_delete() { $list_data = file($this->listfile); foreach ($list_data as $value) { list($l_cate_url,$url,$name,$caption,$time,$user_pass,$host) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($this->id == $url) { break; } } $cate_data = file($this->categoryfile); foreach ($cate_data as $value) { list($cate_name_j,$cate_url,$cate_item) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($l_cate_url == $cate_url) { break; } } if ($this->mode != "admin") { $html .= "
    self."?mode=delete&id=".$url."\">\n"; } else { $html .= "self."?mode=admin&admin_mode=delete&id=".$url."&pass=".$this->pass."\">\n"; } $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; if ($this->mode != "admin") { $html .= "\n"; $html .= "\n"; $html .= "\n"; } $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "
    削除
    カテゴリー".$cate_name_j."
    サイト名".$name."
    URL".$url."
    説明文".$caption."
    パスワード
    \n"; $html .= " "; $html .= " "; $html .= "
    \n"; $html .= "戻る\n"; $html .= "
    \n"; $html .= "
    \n"; if ($this->mode != "admin") { $html .= "\n"; } return $html; } // リンク削除処理(管理兼用) function delete(){ $list_data = file($this->listfile); $i = 0; foreach ($list_data as $value) { list($l_cate_url,$url,$name,$caption,$time,$user_pass,$host) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($this->id == $url) { if (md5($this->user_pass) != $user_pass and $this->mode != "admin") {// パスワードチェック echo $this->html_err("パスワードが違います。"); exit; } unset($list_data[$i]); break; } $i++; } $cate_data = file($this->categoryfile); $i = 0; foreach ($cate_data as $value) { list($cate_name_j,$cate_url,$cate_item) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($l_cate_url == $cate_url) { $cate_item--; $cate_data[$i] = $cate_name_j."\t".$cate_url."\t".$cate_item."\t\n"; break; } $i++; } $fp_list = fopen($this->listfile,"w"); flock($fp_list,LOCK_EX); foreach ($list_data as $value) { fputs($fp_list,$value); } flock($fp_list,LOCK_UN); fclose($fp_list); $fp_cate = fopen($this->categoryfile,"w"); flock($fp_cate,LOCK_EX); foreach ($cate_data as $value) { fputs($fp_cate,$value); } flock($fp_cate,LOCK_UN); fclose($fp_cate); $this->html_index_restore();// インデックスページ再構築 $this->html_category_restore();// 全カテゴリーページ再構築 if ($this->mode != "admin") { header("Location: ".$cate_url); } else { echo "self."?mode=admin&admin_mode=list_edit&id=".$cate_url."&pass=".$this->pass."\">"; } } // リンク編集画面(管理兼用) function html_edit() { $list_data = file($this->listfile); foreach ($list_data as $value) { list($l_cate_url,$url,$name,$caption,$time,$user_pass,$host) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($this->id == $url) { break; } } $cate_data = file($this->categoryfile); foreach ($cate_data as $value) { list($cate_name_j,$cate_url,$cate_item) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($l_cate_url == $cate_url) { break; } } if ($this->mode != "admin") { $html .= "
    self."?mode=edit&id=".$url."\">\n"; } else { $html .= "self."?mode=admin&admin_mode=edit&id=".$url."&pass=".$this->pass."\">\n"; } $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; if ($this->mode != "admin") { $html .= "\n"; $html .= "\n"; $html .= "\n"; } $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "
    編集
    サイト名
    (全角".$this->namelimit."文字以内)
    ".$name."
    URL
    (半角".$this->urllimit."文字以内)
    ".$url."
    説明文
    (全角".$this->captionlimit."文字".$this->rawlimit."行以内)
    ".$caption."
    カテゴリー".$cate_name_j."
    \n"; $html .= "
    パスワード
    \n"; $html .= " "; $html .= " "; $html .= "
    \n"; $html .= "戻る\n"; $html .= "
    \n"; $html .= "
    \n"; $html .= "\n"; return $html; } // リンク編集処理(管理兼用) function edit() { $list_data = file($this->listfile); $cate_data = file($this->categoryfile); // 入力チェック if ($this->webname == "") { $err_message .= "
  • サイト名を入力してください。
  • \n"; $err_flag = TRUE; } if ($this->weburl == "" or $this->weburl == "http://") { $err_message .= "
  • URLを入力してください。
  • \n"; $err_flag = TRUE; } if ($this->webcaption == "") { $err_message .= "
  • 説明文を入力してください。
  • \n"; $err_flag = TRUE; } if ($this->mode != "admin") {// 管理モードではチェックしない if (strlen($this->webname) > ($this->namelimit * 2)) { $err_message .= "
  • サイト名が長すぎます。全角".$this->namelimit."文字以内にしてください。
  • \n"; $err_flag = TRUE; } if (strlen($this->weburl) > $this->urllimit) { $err_message .= "
  • URLが長すぎます。半角".$this->urllimit."文字以内にしてください。
  • \n"; $err_flag = TRUE; } if (strlen($this->webcaption) > ($this->captionlimit * 2)) { $err_message .= "
  • 説明文が長すぎます。全角".$this->captionlimit."文字以内にしてください。
  • \n"; $err_flag = TRUE; } if (ereg("(.*
    .*){".$this->rawlimit.",}",$this->html_conv($this->webcaption))) { $err_message .= "
  • 改行が多すぎます。".$this->rawlimit."行以内にしてください。
  • \n"; $err_flag = TRUE; } } foreach ($list_data as $value) { list($l_cate_url,$url,$name,$caption,$time,$user_pass,$host) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($this->id == $url) { if (md5($this->user_pass) != $user_pass and $this->mode != "admin") {// パスワードチェック $err_message .= "
  • パスワードが違います。
  • \n"; $err_flag = TRUE; } $sub_user_pass = $user_pass; } if ($url == $this->weburl and $this->weburl != $this->id) { foreach ($cate_data as $value) { list($cate_name_j,$cate_url,$cate_item) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($l_cate_url == $cate_url) { break; } } $err_message .= "
  • そのURLは既に登録されています。(".$name."【".$cate_name_j."】
  • \n"; $err_flag = TRUE; } } if ($err_flag) { echo $this->html_err("
      \n".$err_message."
    \n"); exit; } // 登録リストファイル更新 $new_time = time(); $new_str = $this->cate_name_e."\t".$this->html_conv($this->weburl)."\t".$this->html_conv($this->webname)."\t". $this->html_conv($this->webcaption)."\t".$this->html_conv($this->chklink)."\t". $new_time."\t".$sub_user_pass."\t".$this->host."\t\n"; $fp_list = fopen($this->listfile,"w"); flock($fp_list,LOCK_EX); fputs($fp_list,$new_str); foreach ($list_data as $value) { list($l_cate_url,$url,$name,$caption,$time,$user_pass,$host) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($this->id != $url) { fputs($fp_list,$value); } } flock($fp_list,LOCK_UN); fclose($fp_list); // カテゴリーファイル更新 if ($this->cate_name_e != $this->old_cate) {// カテゴリーが変更された場合のみ $i = 0; foreach ($cate_data as $value) { list($cate_name_j,$cate_url,$cate_item) = explode("\t",mb_convert_encoding($value,"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS")); if ($cate_url == $this->old_cate) {// 古いカテゴリーの件数を-1 $cate_data[$i] = $cate_name_j."\t".$cate_url."\t".($cate_item - 1)."\t\n"; } if ($cate_url == $this->cate_name_e) {// 変更後のカテゴリーの件数を+1 $cate_data[$i] = $cate_name_j."\t".$cate_url."\t".($cate_item + 1)."\t\n"; } $i++; } $fp_cate = fopen($this->categoryfile,"w"); flock($fp_cate,LOCK_EX); foreach ($cate_data as $value) { fputs($fp_cate,$value); } flock($fp_cate,LOCK_UN); fclose($fp_cate); } $this->html_index_restore();// インデックスページ再構築 $this->html_category_restore();// 全カテゴリーページ再構築 if ($this->mode != "admin") { header("Location: ".$this->cate_name_e); } else { echo "self."?mode=admin&admin_mode=list_edit&id=".$this->cate_name_e."&pass=".$this->pass."\">"; } } // 特殊文字変換 function html_conv($str) { $str = htmlspecialchars($str); // $str = str_replace("'","'",$str); // $str = str_replace(" "," ",$str); // $str = str_replace(",",",",$str); $str = str_replace("\r\n","\n",$str); $str = str_replace("\r","\n",$str); $str = str_replace("<br>","\n",$str); $str = str_replace("\n","
    ",$str); return $str; } // 管理パスワード認証画面 function html_pass() { $html = "
    self."?mode=admin&admin_mode=category\" name=\"passform\" id=\"passform\">". "\n". "\n". "\n". "\n". "\n". "\n". "\n". "
    ※管理パスワードを入力してください
    \n". "
    \n". "戻る
    \n"; $html .= "\n"; return $html; } // 管理パスワード認証処理 function pass_check() { if (md5($this->admin_pass) != $this->pass) { echo $this->html_err("パスワードが違います"); exit; } } // エラー画面 function html_err($err_message) { $html = $this->html_header("エラー"); $html .= "\n"; $html .= "\n"; $html .= "\n\n"; $html .= "\n"; $html .= "\n\n"; $html .= "
    エラー

    ".$err_message."
    \n"; $html .= "


    \n戻る
    \n"; $html .= $this->html_footer(); return $html; } // コンストラクタ function plink_class() { if (phpversion() < "4.1.0") { $_POST = $HTTP_POST_VARS; $_GET = $HTTP_GET_VARS; $_SERVER = $HTTP_SERVER_VARS; $_COOKIE = $HTTP_COOKIE_VARS; } $this->num = $_POST["num"]; $this->item = $_POST["item"]; if (get_magic_quotes_gpc()) { $this->cate_name_j = mb_convert_encoding(stripslashes($_POST["cate_name_j"]),"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS"); $this->cate_name_e = mb_convert_encoding(stripslashes($_POST["cate_name_e"]),"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS"); $this->webname = mb_convert_encoding(stripslashes($_POST["webname"]),"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS"); $this->weburl = mb_convert_encoding(stripslashes($_POST["weburl"]),"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS"); $this->webcaption = mb_convert_encoding(stripslashes($_POST["webcaption"]),"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS"); $this->chklink = mb_convert_encoding(stripslashes($_POST["chklink"]),"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS"); $this->old_cate = mb_convert_encoding(stripslashes($_POST["old_cate"]),"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS"); } else { $this->cate_name_j = mb_convert_encoding($_POST["cate_name_j"],"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS"); $this->cate_name_e = mb_convert_encoding($_POST["cate_name_e"],"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS"); $this->webname = mb_convert_encoding($_POST["webname"],"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS"); $this->weburl = mb_convert_encoding($_POST["weburl"],"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS"); $this->webcaption = mb_convert_encoding($_POST["webcaption"],"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS"); $this->chklink = mb_convert_encoding($_POST["chklink"],"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS"); $this->old_cate = mb_convert_encoding($_POST["old_cate"],"SJIS","ASCII,JIS,UTF-8,EUC-JP,SJIS"); } $this->user_pass = $_POST["user_pass"]; $this->mode = $_GET["mode"]; $this->admin_mode = $_GET["admin_mode"]; $this->category = $_GET["category"]; $this->id = $_GET["id"]; $this->addr = getenv("REMOTE_ADDR"); $this->host = getenv("REMOTE_HOST"); if($this->host == "" or $this->host == $this->addr){ $this->host = gethostbyaddr($this->addr); } $this->self = $_SERVER["PHP_SELF"]; // 管理パスワード if ($_POST["in_pass"] != "") { $this->pass = md5($_POST["in_pass"]); } else { $this->pass = $_GET["pass"]; } } }// end of class // メイン $plink = new plink_class; switch ($plink->mode) { case "admin": if ($plink->pass != "") { $plink->pass_check(); } else { echo $plink->html_header($plink->title."(管理パスワード認証)"); echo $plink->html_pass(); echo $plink->html_footer(); break; } switch ($plink->admin_mode) { case "category": echo $plink->html_header($plink->title."(管理モード)"); echo $plink->html_category(); echo $plink->html_footer(); break; case "category_add": case "category_edit": $plink->category_add(); break; case "category_delete": $plink->category_delete(); break; case "category_edit_form": echo $plink->html_header($plink->title."(カテゴリー編集)"); echo $plink->html_category_edit(); echo $plink->html_footer(); break; case "list_edit": echo $plink->html_header($plink->title."(登録リスト編集)"); echo $plink->html_list_edit(); echo $plink->html_footer(); break; case "regist": $plink->regist(); break; case "delete_form": echo $plink->html_header($plink->title."(削除フォーム)"); echo $plink->html_delete(); echo $plink->html_footer(); break; case "delete": $plink->delete(); break; case "edit_form": echo $plink->html_header($plink->title."(編集フォーム)"); echo $plink->html_edit(); echo $plink->html_footer(); break; case "edit": $plink->edit(); break; case "all_restore": $plink->all_restore(); break; } break; case "regist": $plink->regist(); break; case "delete_form": echo $plink->html_header($plink->title."(削除フォーム)"); echo $plink->html_delete(); echo $plink->html_footer(); break; case "delete": $plink->delete(); break; case "edit_form": echo $plink->html_header($plink->title."(編集フォーム)"); echo $plink->html_edit(); echo $plink->html_footer(); break; case "edit": $plink->edit(); break; default; echo $plink->html_header($plink->title."(管理パスワード認証)"); echo $plink->html_pass(); echo $plink->html_footer(); break; } ?>