**jlink接口定义 Warning: T-bit of XPSR is 0 but should be 1. Changed to 1.

所属子分类:
注册时间: 15:37
回复数: 112
主题数: 45
论坛积分:247
我自己写了一个程序,用的例程里一模一样的驱动。就是应用程序不一样,怎么会出现这种情况呢???
注册时间: 10:41
回复数: 51568
主题数: 369
酷贴数:27
论坛积分:55375
来自: 湖南
回复【楼主位】&Julius007&:
-------------------------------
没遇到过.
用串口先下载一个标准的例程,看看是否还会报错吧.
我的淘宝小店:
注册时间: 15:37
回复数: 112
主题数: 45
论坛积分:247
回复【1楼】&正点原子&:
-------------------------------
FileTemp=F_Search(fcluster,(unsigned&char&*)myfolder[0],T_FILE);//查找LIU文件夹
&&&if(FileTemp.F_StartCluster==0)return&1;
&&//系统文件夹丢失
&&
&&&&&&&&&&&&&&&{
&&&&&&fcluster=FileTemp.F_StartC&&&&&&//字体文件夹簇号 &&&&
&&&&&&&&&&&&&&FileTemp=F_Search(fcluster,(unsigned&char&*)myfile[0],T_TXT);//在LIU文件夹下查找LIANG文件
&&F_Open(&FileTemp);//打开该文件
&&while(F_Read(&FileTemp,temp0))//成功读出512个字节
&&&&&&&&&&&&&&&{
&&&&&&&&&&&&&if(i&FileTemp.F_Size)//不超过文件大小
&&&&&&&&&&&&&&&{
&&&&&&&&&&&&&&LCD_ShowString(32,150,temp0);&
&&delay_ms(1000);&&
&&&&&&&&&&&&&&i+=512;//增加512个字节
&&&&&&&&&&&&&&&}
在你写的基础上加了这一段,然后就进不去了,总到
HardFault_Handler\
&&&&&&&&&&&&&&&&PROC
&&&&&&&&&&&&&&&&EXPORT&&HardFault_Handler&&&&&&&&&[WEAK]
&&&&&&&&&&&&&&&&B&&&&&&&.
&&&&&&&&&&&&&&&&ENDP
这里执行,不知道那个Fault有问题?????????
注册时间: 15:37
回复数: 112
主题数: 45
论坛积分:247
回复【1楼】&正点原子&:
-------------------------------
elay_ms(1000);
&&& //得到根目录的簇号
&&&&&&&&&&if(FAT32_Enable)fcluster=FirstDirC&//将根目录首簇给cluster&从根目录开始查找
&&&&&&&&&&&&else&fcluster=0;
O(∩_∩)O哈哈~&&我终于弄出来了,原来是没有给她根目录的簇号,然后就出项错误了,不过还是不知道问什么会进入Hardhander里面???
请选择一个版面...
STM32-F0/F1/F2专区
STM32-F3/F4专区
MSP430专区
ARM7/ARM9/ARM11专区
其他Cortex系列
uCOS & uCGUI & Emwin
trochili(飞鸟)操作系统
中国RTOS联盟
FPGA/CPLD/DSP专区
数字,模拟,高频电路
编程语言学习
蓝牙/WIFI/Zigbee等通信技术
开发工具专栏
UOL 单片机面向对象语言
DIY大赛专区
DIY项目资料专区
论坛建设区
二手交易专栏
& 开源电子网() |Welcome to CHEESESLAVE Q and A!
Every Sunday, I answer your questions. I’ll answer as many questions as I can each week. If I didn’t answer your question this week, please check back next week.
Be sure to sign up for my email updates so you never miss a post:
1. Question: Will The GAPS Diet Heal Hypoglycemia?
I am 46 years old and was on a low carb diet for several years mostly to help with my hypoglycemia. I, too, experienced strange side effects with regard to my cycle while following the low carb diet, etc…
I followed the diet outlined in Fertility Cycles and Nutrition for three months including flax seed oil and opti-vite supplements. While I was only seeking to regulate my cycle, HAPPY SURPRISE, we ended up pregnant! There is a five year gap between this child and my previous one. This is my 10th child and am due in May.
Now, I am purchasing the GAPS book and plan to try the diet to the best of my ability at this stage. (I’ve tried similar things for the short term). While I would love to include grains in my diet my gut still has a lot of healing to do to be able to continue due to the hypoglycemia.
In your opinion, do you think the GAPS diet will heal hypoglycemia?
I’m not a doctor so I can’t prescribe treatment for anything.
I haven’t heard of anyone doing GAPS for hypoglycemia. I think the answer for hypoglycemia is just eating regular meals at regular intervals, making sure you don’t skip meals.
2. Question: Thoughts About Hair Loss?
My hair has been falling out and this is extremely distressing to me. It’s been going on for years, possibly started by going on the pill (back in 2005, I was on it for around 2 years), or possibly caused by thyroid. Or who knows what. Any suggestions here?
Best wishes and thank you again.
I’m not a doctor, so I can’t say. However, hair loss is often caused by hypothyroidism. I’d look into thyroid function if I were you.
3. Question: Help With Making Homemade Yogurt?
I am sure you had a step-by-step guide on making yogurt, but i can’t find it. Can you point me in the right direction?
I have a video on making yogurt in my
I don’t think I’ve ever published anything on this blog.
4. Question: Suggestions To Help Husband With GAPS Diet?
I just wanted to say that I am a huge fan of your blog and videos! I follow both you and Nourished Kitchen, and I just learn so much from you ladies!
Unfortunately, I am worried about my dear husband’s health. He and I are both overweight, but he also has major digestive issues and possible food allergies. The doctor says he has IBS, but all they do is prescribe a muscle relaxer to make bowel movements less painful. I think the problem goes deeper. He can’t digest lettuce, and just this morning, (sorry if this gets TMI) I found four whole peas in the toilet, and they were cooked when we ate them! We had them with dinner two nights ago! It really freaked me out.
I’m trying my best to acclimate us to eating better food, but I’m having to go incredibly slow. We drink some form of kefir everyday (he won’t drink kombucha on principle, lol), and we’ve been doing that for a couple of months now. I also bought a grinder to grind our own sprouted wheat flour and am planning to use it 50/50 with white flour to make the change gradually. I’m just afraid that’s not enough.
I talked to him about doing GAPS, but he’s veeeerrrryyyy resistant to that. I just want to do what’s best for us without getting bossy. If slow and steady will win the race, I’ll keep it up, but can his gut heal without GAPS? Any advice is appreciated…
Thank you so much!!
Digestive problems can be caused by leaky gut/gut dysbiosis, but there can be other root causes such as hypothyroidism. I’d work with a holistic practitioner if I were you. I would not do GAPS unless you find that you really need it (i.e. nothing else works). GAPS is a tough diet and it’s not easy to get family members on board.
I’d personally start just by taking a quality probiotic and increasing the fermented foods (yay for the kefir!).
5. Question: Advice On Adrenal Fatigue?
Hi Ann Marie!
I just finished reading your post on Lunaception. This is a fascinating article and I’m going to give it a try too. I was struck by a comment you made (in the comments section) about adrenal fatigue and temperatures. I decided to email you rather than reply there as this gets off the topic of lunaception.
I’ve been recovering from adrenal fatigue for years as well and am doing fairly well, although still have a ways to go. I started tracking my temp about 8 months ago and noticed that my BBT was chronically low. No one could tell me why and just suggested that it was “my norm”.
(on fertility charting) I read that this is an indication of low thyroid function. I should mention that I started a paleo-style just over a year ago, and have been on full GAPS since September (and GAPS intro for 6 weeks).
I’m 43 and, like you, am hoping to have a (my first) baby this year. About 2 months ago my BBT came up nearly .5C and has remained stable at this higher level. My doc suggested that my rise in temperature was a shift towards menopause. Not the news I wanted to hear! But I take conventional medicine with a grain of salt. I am encouraged by your comment that a rise in your temperature is a sign of improved health. This is how I interpreted my own temperature shift too, but no one I know has any idea what I am talking about. Not even my holistic practitioners seem to know what to say! I think it’s a pretty big deal and want to understand what’s going on, but when I talk about it, I just get looked at like I have two heads.
So I’m writing to you to ask where you have learned about the connection between temperature, adrenals and so on. I really want to learn more as I have to be the chief advocate of my own health. If you know of any great books or websites that you could direct me to, or if you just have personal experience to share, I’d be very grateful! It’s been a long, lonely road figuring this all out and it’s exciting to come across someone else who’s on that same road. I hope lunaception works well for you and wish you the best of luck in your baby efforts! Now I’m off to duct tape garbage bags to my window…
Warmest regards,
I recommend Matt Stone’s book
Matt’s the one who taught me the most about thyroid function, body temperature, hormonal balance, etc.
I also recommend
by Dr. Mark Starr.
I don’t recommend low carb if you are trying to raise your body temperature and balance your hormones. Increasing my carbs and overeating as Matt Stone suggests is what really helped me over this past few months.
See my post:
6. Question: Suggestions For Helping With Depression And Increasing Serotonin?
I’ve been following your blog and wondered if you knew of natural remedies for depression and increase serotonin. I’m currently nursing but need something for my mood swings and depression.
I would avoid caffeine — that depletes serotonin. Make sure you eat balanced meals — 3 squares a day, plus snacks if you need them.
Please don’t do low carb or anything like that. Eat balanced meals with adequate amounts of protein, complex carbs like whole grains and potatoes, fruit, etc. and good fats.
Get plenty of rest (10-12 hours per night if you can swing it — if you can’t, then sleep when the baby sleeps during the day).
Julia Ross recommends an amino acid blend for mothers who are nursing. I’m not sure if
— you could call her office and ask.
You should also read Ross’ book,
7. Question: Recommendations For Cookware?
You mentioned in a post about nickel leaching out of stainless steel when cooking acid foods. I currently use Pampered Chef non-stick cookware and I’m sure that is not the best cookware to use. Is stainless steel cookware not safe either? What recommendation do you have for cookware?
Stainless steel is fine. I have a set of stainless steel cookware, and I also use Le Creuset enameled cast iron, and regular cast iron.
Got a Question?
Please submit your questions to questions AT cheeseslave DOT com. I’ll answer your questions every Sunday in the order I receive them.
Photo credit:
Disclosure:
PAID ENDORSEMENT DISCLOSURE: In order for me to support my blogging activities,
I may receive monetary compensation or other types of remuneration for my endorsement, recommendation, testimonial and/or link to any products or services from this blog.
AMAZON DISCLOSURE: The owner of this website is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon properties including, but not limited to, , , , , .
Leave a Comment
FOLLOW ME ON FACEBOOK
MOST POPULAR POSTS
Eating dessert in Paris.#!/usr/bin/perl
#┌─────────────────────────────────
#│ CLIP BOARD v1.41 ()
#│ Copyright(C) Kent Web 2001
#│ webmaster@
#│ http://www./
#└─────────────────────────────────
$ver = 'ClipBoard v1.41';
#┌─────────────────────────────────
#│ [注意事項]
#│ 1. このスクリプトはフリーソフトです。このスクリプトを使用した
いかなる損害に対して作者は一切の責任を負いません。
#│ 2. 設置に関する質問はサポート掲示板にお願いいたします。
直接メールによる質問は一切お受けいたしておりません。
#│ 3. このスクリプトは、method=POST 専用です。
#│ 4. 同梱のアイコンは再配布で著作権者は以下のとおりです。
home.gif : mayuRinさん
clip.gif : 牛飼いとアイコンの部屋さん
#└─────────────────────────────────
# [ 設置構成例 ] : かっこ内はパーミッション値
public_html / index.html (ホームページなど)
+-- clip / clip.cgi
cgi-lib.pl [644]
+-- img [777] / clip.gif
+-- lock [777] /
#============#
#============#
# ライブラリ取り込み
require './jcode.pl';
require './cgi-lib.pl';
# タイトル名
$title = "松江のお得情報";
# タイトル文字の色
$t_color = "#800000";
# タイトル文字のタイプ
$t_face = "MS Pゴシック";
# タイトル文字サイズ(スタイルシートで有効)
$t_point = '20pt';
# 本文文字サイズ(スタイルシートで有効)
$b_size = '10pt';
# 記事題名の色
$sub_color = "green";
# スクリプト名
# → 絶対パスなら http:// からのURLパス
$script = './clip.cgi';
# ログファイル名
# → 絶対パスなら / から始まるパス(http://からではないので注意)
$logfile = './clip.log';
# 管理用パスワード
$pass = '220020';
# 最大記事数(これを超える記事は古い順に削除されます)
$max = 30;
$home = "http://www./";
# bodyタグ
$body = '';
# URLの自動リンク (0=no 1=yes)
# → タグ許可の場合は no とすること。
$autolink = 1;
# 1ページあたりの記事表示件数
$p_log = 10;
# ロックファイル機構 (0=no 1=symlink関数 2=mkdir関数)
$lockkey = 0;
# ロックファイル名
# → 絶対パスなら / から始まるパス(http://からではないので注意)
$lockfile = './lock/clip.lock';
# アップロードディレクトリ
# → パスの最後は / で終わること
# → フルパスだと / から記述する
$ImgDir = "./img/";
# アップロードディレクトリのURLパス
# → パスの最後は / で終わること
#$ImgUrl = "http://www.xxx.xxx/clip/img/";
$ImgUrl = "./img/";
# 画像管理者チェック機能 (0=no 1=yes)
# → アップロード「画像」は管理者がチェックしないと表示されない機能です
# → チェックされるまで「画像」は「COMMING SOON」のアイコンが表示されます
$ImageCheck = 1;
# 投稿処理の権限
0: 誰でも投稿可能
1: 管理者のみが投稿
$PostMode = 1;
# 添付ファイルのアップロードに失敗したとき
0 : 添付ファイルは無視し、記事は受理する
1 : エラー表示して処理を中断する
$clip_err = 1;
# タグ許可 (0=no 1=yes)
$tagkey = 0;
# メール通知機能
1: yes:自分の投稿記事もメール通知する
2: yes:自分の投稿記事はメール通知しない
$mailing = 0;
# sendmailのパス(メール通知する場合)
$sendmail = '/usr/lib/sendmail';
# メール通知先アドレス(メール通知する場合)
$mailto = 'xxx@xxx.xxx';
# タグ広告挿入オプション (FreeWebなど)
の代わりに「広告タグ」を挿入する。
# → 広告タグ以外に、MIDIタグ や LimeCounter等のタグにも使用可能です。
$banner1 = '';
# 表示部上部に挿入
$banner2 = '';
# 表示部下部に挿入
# アクセス制限(ホスト名を記述)
"cache*.*.",
# リンク元チェック (0=no 1=yes)
# → いたずら投稿防止に「リンク元」チェックを行う場合
$LinkCheck = 0;
# 同一ホストからの連続投稿を制限
# → 秒数を記述するとその時間以上を経過しないと連続投稿できない
# → 投稿を管理者限定にする場合 ($PostMode=1;) はこの設定は無視されます
$w_regist = '60';
# タイトル画像を使う場合 (http://から画像を指定)
$ImgT = "";
# タイトル画像を使う場合に「横幅」「縦幅」をそれぞれピクセル数で記述
$ImgW = 300;
$ImgH = 70;
# アップロードを許可するファイル形式
= 1; # GIFファイル
= 1; # JPEGファイル
= 1; # PNGファイル
= 1; # TEXTファイル
= 0; # LHAファイル
= 0; # ZIPファイル
= 1; # PDFファイル
= 1; # MIDIファイル
= 0; # WORDファイル
$excel = 0; # EXCELファイル
= 0; # POWERPOINTファイル
= 0; # RAMファイル
= 0; # RMファイル
= 0; # MPEGファイル
= 0; # MP3ファイル
# 投稿受理最大サイズ (bytes)
# → 例 : 102400 = 100KB
$cgi_lib'maxdata = '51200';
# 画像ファイルの最大表示の大きさ(単位:ピクセル)
# → これを超える画像は縮小表示します
$MaxW = 550; # 横幅
$MaxH = 200; # 縦幅
# アイコン画像ファイル名 (ファイル名のみ)
$IconHome = "home.gif";
$IconClip = "clip.gif";
# クリップ
$IconSoon = "soon.gif";
# COMINIG SOON
# サブメッセージ
# → タイトルの下にサブメッセージを記述できます
# → HTMLタグなどを使ってご自由にどうぞ
$SubMsg = <<'_SUB_MSG_';
#============#
#============#
if ($ImgDir !? /?/$/) { $ImgDir .= "/"; }
if ($ImgUrl !? /?/$/) { $ImgUrl .= "/"; }
if ($mode eq 'regist') { & }
elsif ($mode eq 'find') { & }
elsif ($mode eq 'admin') { & }
elsif ($mode eq 'usrdel') { & }
elsif ($mode eq 'note') { & }
elsif ($mode eq 'check') { & }
#----------------#
アクセス制限
#----------------#
sub axs_check {
# ホスト名を取得
foreach (@deny) {
if (!$_) { }
s/?*/?.?*/g;
if ($host =? /$_/i) { $flag=1; }
if ($flag) { &error("アクセスを許可されていません"); }
#----------------#
記事表示処理
#----------------#
sub html {
# レス処理
if ($mode eq 'resmsg') {
open(IN,"$logfile") || &error("Open Error : $logfile");
while () {
($no,$date,$name,$mail,$sub,$com,$url) = split(//);
if ($in{'no'} eq "$no") { $flag=1; }
close(IN);
if ($flag == 0) { &error("該当記事が見つかりません"); }
=? s/^Re://g;
$r_sub = "Re:[$no] $sub";
$r_com = "& $com";
$r_com =? s/&/?&/g;
$r_com =? s/&//g;
$r_com =? s//?r& /
$r_com =? s/]
# 投稿フォーム
if (!$PostMode) { & }
# ページ区切り処理
$start = $in{'page'} + 1;
= $in{'page'} + $p_
open(IN,"$logfile") || &error("Open Error : $logfile");
while () {
($no,$date,$name,$mail,$sub,$com,$url,
$host,$pw,$tail,$W,$H,$time2,$chk) = split(//);
if ($mail) { $name = ""; }
if ($url) { $url = ""; }
print "[$no] $sub ";
print "投稿者:$name 投稿日:$date ";
# 返信のリンク
if (!$PostMode) {
print "[] ";
print "& $url ?n?n";
# 添付ファイルが存在する場合
if (-e "$ImgDir$no$tail") {
if ($tail eq ".gif" || $tail eq ".jpg" || $tail eq ".png") {
if ($ImageCheck && $chk != 1) {
print "?n";
} elsif ($W && $H) {
print "?n";
print "?n";
print "$com?n";
print "$com $no$tail?n";
} else { print "$com?n"; }
print "?n";
close(IN);
$next_page = $in{'page'} + $p_
$back_page = $in{'page'} - $p_
print "?n";
if ($back_page >= 0) {
print "?n";
print "?n";
print "?n";
print "?n";
if ($next_page < $i) {
print "?n";
print "?n";
print "?n";
print "?n";
print "?n";
# 削除フォーム
if (!$PostMode) {
print "?n";
print "?n";
print "?n";
print "記事No?n";
print "削除キー?n";
print "?n";
print "?n";
# 著作権表示(削除?改変は禁止)
print "$banner2?n";
print "?n?n?n";
#----------------#
書きこみ処理
#----------------#
sub regist {
# POSTチェック
if (!&MethPost()) { &error("METHOD形式が POST でありません"); }
# パスワードチェック
if ($PostMode && $in{'pass'} ne $pass) { &error("パスワードが認証できません"); }
# リンク元チェック
if ($LinkCheck) {
$FullUrl = &MyFullUrl();
$ref = $ENV{'HTTP_REFERER'};
$ref =? s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/
if ($ref !? /$FullUrl/i)
{ &error("リンク元が不正のため投稿が受理できません"); }
# フォーム内容をチェック
if ($in{'name'} eq "") { &error("名前が入力されていません"); }
if ($in{'comment'} eq "") { &error("コメントが入力されていません"); }
# ロック処理
if ($lockkey) { & }
open(IN,"$logfile") || &error("Open Error : $logfile");
@lines = ;
close(IN);
($tno,$tdate,$tname,$tmail,$tsub,$tcom,
$turl,$thost,$tpw,$ttail,$tw,$th,$ttime) = split(//, $lines[0]);
if ($in{'name'} eq "$tname" && $in{'comment'} eq "$tcom")
{ &error("二重投稿は禁止です"); }
if (!$PostMode && $w_regist && $times - $ttime < $w_regist)
{ &error("連続投稿はもうしばらく時間を置いてからお願い致します"); }
# 記事Noを採番
$no = $tno + 1;
# 削除キーを暗号化
if ($in{'pwd'} ne "") { $PW = &encrypt($in{'pwd'}); }
# URL自動リンク
if ($autolink) { &auto_link($in{'comment'}); }
# 最大記事数処理
while ($max <= @lines) {
$del = pop(@lines);
local($no,$date,$name,$mail,$sub,$com,$url,$host,$pw,$tail)
= split(//, $del);
if (-e "$ImgDir$no$tail") { unlink("$ImgDir$no$tail"); }
# ファイル添付処理
if ($in{'upfile'}) { &UpF }
unshift(@lines,"$no$date$in{'name'}$in{'email'}$in{'sub'}$in{'comment'}$in{'url'}$host$PW$tail$W$H$times?n");
open(OUT,">$logfile") || &error("Write Error : $logfile");
print OUT @
close(OUT);
# ロック解除
if ($lockkey) { & }
# クッキー格納処理
if ($in{'cook'} eq 'on') { &set_ }
# メール通知処理
if ($mailing == 1) { &mail_ }
elsif ($mailing == 2 && $in{'email'} ne "$mailto") { &mail_ }
# 管理者限定投稿の完了画面
if ($PostMode && $in{'action'} eq "regist") {
print "?n";
print "記事は正常に登録できました?n";
print "?n?n";
print "?n";
print "?n";
print "?n";
print "?n";
print "?n";
print "?n";
print "?n?n?n";
#--------------------#
画像アップロード
#--------------------#
sub UpFile {
# 画像処理
$macbin=0;
foreach (@in) {
if ($_ =? /(.*)Content-type:(.*)/i) { $tail=$2; }
if ($_ =? /(.*)filename=(.*)/i) { $fname=$2; }
if ($_ =? /application?/x-macbinary/i) { $macbin=1; }
$tail =? s/?r//g;
$tail =? s/?n//g;
# $fname =? s/?"//g;
$fname =? tr/?"?x0D?x0A//d;
# ファイル形式を認識
if ($tail =? /image?/gif/i && $gif) { $tail=".gif"; $flag=1; }
if ($tail =? /image?/jpeg/i && $jpeg) { $tail=".jpg"; $flag=1; }
if ($tail =? /image?/x-png/i && $png) { $tail=".png"; $flag=1; }
if ($tail =? /text?/plain/i && $text) { $tail=".txt"; $flag=1; }
if ($tail =? /lha/i && $lha) { $tail=".lzh"; $flag=1; }
if ($tail =? /zip/i && $zip) { $tail=".zip"; $flag=1; }
if ($tail =? /pdf/i && $pdf) { $tail=".pdf"; $flag=1; }
if ($tail =? /audio?/.*mid/i && $midi) { $tail=".mid"; $flag=1; }
if ($tail =? /msword/i && $word) { $tail=".doc"; $flag=1; }
if ($tail =? /ms-excel/i && $excel) { $tail=".xls"; $flag=1; }
if ($tail =? /ms-powerpoint/i && $ppt) { $tail=".ppt"; $flag=1; }
if ($tail =? /audio?/.*realaudio/i && $ram) { $tail=".ram"; $flag=1; }
if ($tail =? /application?/.*realmedia/i && $rm) { $tail=".rm"; $flag=1; }
if ($tail =? /video?/.*mpeg/i && $mpeg) { $tail=".mpg"; $flag=1; }
if ($tail =? /audio?/.*mpeg/i && $mp3) { $tail=".mp3"; $flag=1; }
if (!$flag) {
if ($fname =? /?.gif$/i && $gif) { $tail=".gif"; $flag=1; }
if (($fname =? /?.jpe?g$/i && $jpeg)) { $tail=".jpg"; $flag=1; }
if ($fname =? /?.png$/i && $png) { $tail=".png"; $flag=1; }
if ($fname =? /?.lzh$/i && $lha) { $tail=".lzh"; $flag=1; }
if ($fname =? /?.txt$/i && $text) { $tail=".txt"; $flag=1; }
if ($fname =? /?.zip$/i && $zip) { $tail=".zip"; $flag=1; }
if ($fname =? /?.pdf$/i && $pdf) { $tail=".pdf"; $flag=1; }
if ($fname =? /?.mid$/i && $midi) { $tail=".mid"; $flag=1; }
if ($fname =? /?.doc$/i && $word) { $tail=".doc"; $flag=1; }
if ($fname =? /?.xls$/i && $excel) { $tail=".xls"; $flag=1; }
if ($fname =? /?.ppt$/i && $ppt) { $tail=".ppt"; $flag=1; }
if ($fname =? /?.ram$/i && $ram) { $tail=".ram"; $flag=1; }
if ($fname =? /?.rm$/i && $rm) { $tail=".rm"; $flag=1; }
if ($fname =? /?.mpe?g$/i && $mpeg) { $tail=".mpg"; $flag=1; }
if ($fname =? /?.mp3$/i && $mp3) { $tail=".mp3"; $flag=1; }
# アップロード失敗処理
if (!$flag && !$clip_err) { }
elsif (!$flag && $clip_err) {
&error("アップロードできないファイル形式です");
$upfile = $in{'upfile'};
# マックバイナリ対策
if ($macbin) {
$length = substr($upfile,83,4);
$length = unpack("%N",$length);
$upfile = substr($upfile,128,$length);
# 添付データを書き込み
$ImgFile = "$ImgDir$no$tail";
if (!open(OUT,"> $ImgFile")) {
if ($clip_err) { &error("画像のアップロードに失敗しました"); }
binmode(OUT);
binmode(STDOUT);
print OUT $
close(OUT);
chmod (0666,$ImgFile);
# 画像サイズ取得
if ($tail eq ".jpg") { ($W, $H) = &JpegSize($ImgFile); }
elsif ($tail eq ".gif") { ($W, $H) = &GifSize($ImgFile); }
elsif ($tail eq ".png") { ($W, $H) = &PngSize($ImgFile); }
# 画像表示縮小
if ($W > $MaxW || $H > $MaxH) {
$W2 = $MaxW / $W;
$H2 = $MaxH / $H;
if ($W2 < $H2) { $key = $W2; }
else { $key = $H2; }
$W = int ($W * $key) || 1;
$H = int ($H * $key) || 1;
#--------------#
ワード検索
#--------------#
sub find {
print <<"EOM";
ワード検索
検索したいキーワードを入力し「検索」ボタンを押してください。
キーワードは「半角スペース」で区切って複数指定することができます。
キーワード
foreach ("AND", "OR") {
if ($in{'cond'} eq $_) {
print "$_?n";
print "$_?n";
print "?n?n?n";
# ワード検索の実行と結果表示
if ($in{'word'} ne "") {
# キーワードを配列化
$in{'word'} =? s/ / /g;
@pairs = split(/?s+/, $in{'word'});
# 検索処理
print "?n";
open(IN,"$logfile") || &error("Open Error : $logfile");
while () {
foreach $pair (@pairs) {
if (index($_,$pair) >= 0) {
if ($in{'cond'} eq 'or') { }
if ($in{'cond'} eq 'and') { $flag=0; }
if ($flag == 0) { }
# 結果を表示
($no,$date,$name,$mail,$sub,$com,$url,$host,$pw) = split(//);
if ($mail) { $name = ""; }
if ($url) { $url = ""; }
print "[$no] $sub ";
print "投稿者:$name
投稿日:$date?n";
print "$com$url?n";
close(IN);
print "- 検索結果は $i件です -?n";
print "?n?n";
#--------------#
管理モード
#--------------#
sub admin {
if ($in{'pass'} ne "" && $in{'pass'} ne "$pass") {
&error("パスワードが違います");
if ($PostMode && $in{'action'} eq "form") { &PostF }
print "[]?n";
print "?n";
print "管理モード?n";
print "?n";
if ($in{'pass'} eq "") {
print "パスワードを入力して下さい?n";
print "?n";
print "?n";
if ($PostMode) {
print "ログ管理?n";
print "記事投稿?n";
print "?n";
# 画像許可
if ($in{'chk'}) {
@CHK = split(/?0/, $in{'chk'});
# ロック処理
if ($lockkey) { & }
# 画像情報をマッチングし更新
open(IN,"$logfile") || &error("Open Error : $logfile");
@lines = ;
close(IN);
foreach (@lines) {
($no,$date,$name,$mail,$sub,$com,$url,
$host,$pw,$tail,$w,$h,$time2,$chk) = split(//);
foreach $xx (@CHK) {
if ($no eq "$xx") {
$_="$no$date$name$mail$sub$com$url$host$pw$tail$w$h$time21?n";
push(@new,$_);
open(OUT,">$logfile") || &error("Write Error : $logfile");
print OUT @
close(OUT);
# ロック解除
if ($lockkey) { & }
# 削除処理
if ($in{'del'}) {
@DEL = split(/?0/, $in{'del'});
# ロック処理
if ($lockkey) { & }
# 削除情報をマッチングし更新
open(IN,"$logfile") || &error("Open Error : $logfile");
@lines = ;
close(IN);
foreach (@lines) {
($no,$date,$name,$mail,$sub,
$com,$url,$host,$pw,$tail) = split(//);
foreach $del (@DEL) {
if ($no eq "$del") {
if (-e "$ImgDir$no$tail")
{ unlink("$ImgDir$no$tail"); }
if ($flag == 0) { push(@new,$_); }
open(OUT,">$logfile") || &error("Write Error : $logfile");
print OUT @
close(OUT);
# ロック解除
if ($lockkey) { & }
# 削除画面を表示
print "?n";
print "?n";
print "?n";
print "?n?n";
print "記事を削除する場合は「削除」のチェックボックスにチェックを入れ「送信する」を押して下さい。?n";
if ($ImageCheck) { print "画像許可を行なう場合は「画像許可」のチェックボックスにチェックを入れ「送信する」を押して下さい。?n"; }
print "?n?n";
print "?n";
print "削除記事No投稿日題名";
print "投稿者コメントホスト名添付(Bytes)";
if ($ImageCheck) { print "画像許可"; }
print "?n";
open(IN,"$logfile") || &error("Open Error : $logfile");
while () {
$img_flag=0;
($no,$date,$name,$mail,$sub,$com,$url,
$host,$pw,$tail,$w,$h,$time,$chk) = split(//);
($date,$dmy) = split(/?(/, $date);
if ($mail) { $name=""; }
$com =? s///
$com =? s//&/g;
if (length($com) > 40) {
$com = substr($com,0,38);
$com .= "..";
if (-e "$ImgDir$no$tail") {
if ($tail eq ".gif" || $tail eq ".jpg" || $tail eq ".png") {
$img_flag = 1;
$File = "画像";
} else { $File = "File"; }
$clip = "";
$size = -s "$ImgDir$no$tail";
$clip = "";
$size = 0;
print "$no$date$sub";
print "$name$com";
print "$host$clip($size)?n";
# 画像許可
if ($ImageCheck) {
if ($img_flag == 1 && $chk == 1) {
print "OK";
} elsif ($img_flag == 1 && $chk != 1) {
print "?n";
close(IN);
print "?n";
print "?n";
$all = int ($all / 1024);
print "【添付データ総数 : $all KB】?n";
print "?n?n?n";
#------------------#
ユーザ記事削除
#------------------#
sub usrdel {
if ($in{'no'} eq '' || $in{'pwd'} eq '')
{ &error("削除Noまたは削除キーが入力モレです"); }
# ロック処理
if ($lockkey) { & }
open(IN,"$logfile") || &error("Open Error : $logfile");
@lines = ;
close(IN);
foreach (@lines) {
($no,$date,$name,$mail,$sub,$com,$url,$host,$pw,$tail) = split(//);
if ($in{'no'} eq "$no") { $flag=1; $PWD=$ $upfile="$no$tail" }
else { push(@new,$_); }
if ($flag == 0) { &error("該当記事が見当たりません"); }
if ($PWD eq '') { &error("該当記事には削除キーが設定されていません"); }
# 削除キーを照合
$match = &decrypt("$in{'pwd'}","$PWD");
if ($match ne 'yes') { &error("削除キーが違います"); }
# ログを更新
open(OUT,">$logfile") || &error("Write Error : $logfile");
print OUT @
close(OUT);
# 添付ファイルがあれば削除
unlink("$ImgDir$upfile") if (-e "$ImgDir$upfile");
# ロック解除
if ($lockkey) { & }
#----------------#
投稿フォーム
#----------------#
sub form {
# ブラウザ/クッキー情報を取得
print <<"EOM";
メッセージ
if (!$PostMode) {
print "削除キー?n";
print "?n";
print "(記事の削除用。英数字で8文字以内)?n";
print <<"EOM";
クッキー情報を保存
#------------------------#
管理者用投稿フォーム
#------------------------#
sub PostForm {
print "[]?n";
print "?n";
print "管理者用投稿フォーム?n";
print "?n?n";
#----------------#
デコード処理
#----------------#
sub decode {
while (($key,$val) = each %in) {
if ($key ne "upfile") {
# シフトJISコードに変換
&jcode'convert(*val, "sjis", "", "z");
# タグ処理
if ($tagkey) {
$val =? s//&&/g;
$val =? s//&/g;
# 改行処理
if ($key eq "comment") {
$val =? s/?r?n//g;
$val =? s/?r//g;
$val =? s/?n//g;
$val =? s/?r//g;
$val =? s/?n//g;
$in{$key} = $
$mode = $in{'mode'};
$in{'url'} =? s/^http?:?/?///;
if ($in{'sub'} eq "") { $in{'sub'} = "無題"; }
# 日時の取得
$ENV{'TZ'} = "JST-9";
($sec,$min,$hour,$mday,$mon,$year,$wday) = localtime($times);
# 日時のフォーマット
@week = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
$date = sprintf("%04d/%02d/%02d(%s) %02d:%02d",
$year+1900,$mon+1,$mday,$week[$wday],$hour,$min);
#--------------#
HTMLヘッダ
#--------------#
sub header {
$head_flag = 1;
print "Content-type: text/html?n?n";
print <<"EOM";
#----------------------#
ブラウザ情報を取得
#----------------------#
sub get_agent {
$agent = $ENV{'HTTP_USER_AGENT'};
if ($agent =? /MSIE 4/i || $agent =? /MSIE 5/i) {
$f_name = 28;
$f_cols = 54;
$f_name = 20;
$f_cols = 55;
#--------------#
エラー処理
#--------------#
sub error {
if ($lockflag) { & }
&header if (!$head_flag);
print "ERROR !?n";
print "$_[0]?n";
print "?n?n?n";
#------------------#
クッキーの発行
#------------------#
sub set_cookie {
($secg,$ming,$hourg,$mdayg,$mong,$yearg,$wdayg) = gmtime(time + 60*24*60*60);
@mons = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
$date_g = sprintf("%s?, %02d-%s-%04d %02d:%02d:%02d GMT",
$week[$wdayg],$mdayg,$mons[$mong],$yearg+1900,$hourg,$ming,$secg);
$cook="name$in{'name'}?,email$in{'email'}?,url$in{'url'}?,pwd$in{'pwd'}";
print "Set-Cookie: IMGBBS=$ expires=$date_g?n";
#------------------#
クッキーを取得
#------------------#
sub get_cookie {
$ck = $ENV{'HTTP_COOKIE'};
@ck = split(/; /, $ck);
foreach (@ck) {
if ($_ =? /IMGBBS=(.*)/) { $cookdata=$1; }
@pairs = split(/,/, $cookdata);
foreach (@pairs) {
local($key,$val) = split(//);
$COOKIE{$key} = $
= $COOKIE{'name'};
$c_email = $COOKIE{'email'};
= $COOKIE{'url'};
= $COOKIE{'pwd'};
if ($in{'cook'} eq 'on') {
if ($in{'name'})
= $in{'name'}; }
if ($in{'email'}) { $c_email = $in{'email'}; }
if ($in{'url'})
= $in{'url'}; }
if ($in{'pwd'})
= $in{'pwd'}; }
#----------------#
ホスト名取得
#----------------#
sub get_host {
$host = $ENV{'REMOTE_HOST'};
$addr = $ENV{'REMOTE_ADDR'};
if ($host eq "" || $host eq $addr) {
$host = gethostbyaddr(pack("C4", split(/?./, $addr)), 2) || $
#----------------------#
パスワード暗号処理
#----------------------#
sub encrypt {
local($inpw) = $_[0];
local(@SALT, $salt, $encrypt);
@SALT = ('a'..'z', 'A'..'Z', '0'..'9', '.', '/');
$salt = $SALT[int(rand(@SALT))] . $SALT[int(rand(@SALT))];
$encrypt = crypt($inpw, $salt) || crypt ($inpw, '$1$' . $salt);
#----------------------#
パスワード照合処理
#----------------------#
sub decrypt {
local($inpw, $logpw) = @_;
local($salt, $key, $check);
$salt = $logpw =? /^?$1?$(.*)?$/ && $1 || substr($logpw, 0, 2);
$check = "no";
if (crypt($inpw, $salt) eq "$logpw" || crypt($inpw, '$1$' . $salt) eq "$logpw")
{ $check = "yes"; }
#--------------#
ロック処理
#--------------#
sub lock {
# 1分以上古いロックは削除する
if (-e $lockfile) {
local($mtime) = (stat($lockfile))[9];
if ($mtime < time - 60) { & }
local($retry) = 5;
# symlink関数式ロック
if ($lockkey == 1) {
while (!symlink(".", $lockfile)) {
if (--$retry <= 0) { &error('Lock is busy'); }
# mkdir関数式ロック
} elsif ($lockkey == 2) {
while (!mkdir($lockfile, 0755)) {
if (--$retry <= 0) { &error('Lock is busy'); }
$lockflag=1;
#--------------#
ロック解除
#--------------#
sub unlock {
if ($lockkey == 1) { unlink($lockfile); }
elsif ($lockkey == 2) { rmdir($lockfile); }
$lockflag=0;
#--------------#
メール送信
#--------------#
sub mail_to {
= "[$title : $no] $in{'sub'}";
= $in{'sub'};
$m_name = $in{'name'};
= $in{'comment'};
$m_com =? s//?n/
$m_com =? s/&//g;
&jcode'convert(*m_sub,'jis');
&jcode'convert(*m_ttl,'jis');
&jcode'convert(*m_name,'jis');
&jcode'convert(*m_com,'jis');
if (!open(MAIL,"| $sendmail -t")) { &error("メール送信に失敗しました"); }
print MAIL "To: $mailto?n";
print MAIL "Errors-To: $mailto?n";
# メールアドレスがない場合はダミーメールに置き換え
if ($in{'email'} eq "") { $email = 'nomail@xxx.xxx'; }
else { $email = $in{'email'}; }
print MAIL "From: $email?n";
print MAIL "Subject: $m_sub?n";
print MAIL "MIME-Version: 1.0?n";
print MAIL "Content-type: text/ charset=ISO-2022-JP?n";
print MAIL "Content-Transfer-Encoding: 7bit?n";
print MAIL "X-Mailer: $ver?n?n";
print MAIL "--------------------------------------------------------?n";
print MAIL "TIME : $date?n";
print MAIL "HOST : $host?n";
print MAIL "CLIP : $no$tail?n" if ($in{'upfile'});
print MAIL "NAME : $m_name?n";
print MAIL "EMAIL: $in{'email'}?n";
print MAIL "URL
: http://$in{'url'}?n" if ($in{'url'});
print MAIL "TITLE: $m_ttl?n?n";
print MAIL "$m_com?n";
print MAIL "--------------------------------------------------------?n";
close(MAIL);
#--------------#
自動リンク
#--------------#
sub auto_link {
$_[0] =? s/([^=^?"]|^)(http?:[?w?.???-?/???&?=?@?;?#?:?%]+)/$1$2/g;
#------------------#
JPEGサイズ認識
#------------------#
sub JpegSize {
local($jpeg) = @_;
local($t, $m, $c, $l, $W, $H);
open(JPEG, "$jpeg") || return (0,0);
binmode JPEG;
read(JPEG, $t, 2);
while (1) {
read(JPEG, $t, 4);
($m, $c, $l) = unpack("a a n", $t);
if ($m ne "?xFF") { $W = $H = 0; }
elsif ((ord($c) >= 0xC0) && (ord($c) <= 0xC3)) {
read(JPEG, $t, 5);
($H, $W) = unpack("xnn", $t);
read(JPEG, $t, ($l - 2));
close(JPEG);
return ($W, $H);
#-----------------#
GIFサイズ認識
#-----------------#
sub GifSize {
local($gif) = @_;
local($data);
open(GIF,"$gif") || return (0,0);
binmode(GIF);
sysread(GIF,$data,10);
close(GIF);
if ($data =? /^GIF/) { $data = substr($data,-4); }
$W = unpack("v",substr($data,0,2));
$H = unpack("v",substr($data,2,2));
return ($W, $H);
#-----------------#
PNGサイズ認識
# WWWis (/wwwis/) より引用
#-----------------#
sub PngSize {
local($PNG) = @_;
local($head, $a, $b, $c, $d, $e, $f, $g, $h);
open(PNG,"$PNG") || return (0,0);
binmode(PNG);
if (defined(PNG) && read(PNG, $head, 8) == 8 &&
$head eq "?x89?x50?x4e?x47?x0d?x0a?x1a?x0a" &&
read(PNG, $head, 4) == 4 && read(PNG, $head, 4) == 4 &&
$head eq "IHDR" && read(PNG, $head, 8) == 8) {
($a,$b,$c,$d,$e,$f,$g,$h) = unpack("C"x8, $head);
else { return (0,0); }
close(PNG);
return ($a<<24|$b<<16|$c<<8|$d, $e<<24|$f<<16|$g<<8|$h);
#----------------#
留意事項表示
#----------------#
sub note {
print <<"EOM";
ファイル添付時の留意事項
$MaxData = int ($cgi_lib'maxdata / 1024);
if ($gif) { $FILE .= "GIF, "; }
if ($jpeg) { $FILE .= "JPEG, "; }
if ($png) { $FILE .= "PNG, "; }
if ($text) { $FILE .= "TEXT, "; }
if ($lha) { $FILE .= "LHA, "; }
if ($zip) { $FILE .= "ZIP, "; }
if ($pdf) { $FILE .= "PDF, "; }
if ($midi) { $FILE .= "MIDI, "; }
if ($word) { $FILE .= "WORD, "; }
if ($excel) { $FILE .= "EXCEL, "; }
if ($ppt) { $FILE .= "POWERPOINT, "; }
if ($rm) { $FILE .= "RM, "; }
if ($ram) { $FILE .= "RAM, "; }
if ($mpeg) { $FILE .= "MPEG, "; }
if ($mp3) { $FILE .= "MP3, "; }
$FILE =? s/?, $//;
print "投稿時にファイルを添付する事ができます。?n";
print "ただし、ブラウザはインターネットエクスプローラ4 またはネットスケープ4 以上である必要があります。?n";
print "添付可能?ファイル → $FILE?n";
print "最大投稿データ量は $MaxData KB までです。?n";
print "画像は横 $MaxWピクセル、縦 $MaxHピクセルを超えると縮小表?示されます。?n";
if ($ImageCheck) {
print "画像に限り管理者が許可するまで「COMING SOON」が仮表?示されます。?n";
print "?n?n";
print "?n?n";
#------------------#
チェックモード
#------------------#
sub check {
print "Check Mode?n";
print "?n";
# ログファイル
if (-e $logfile) { print "ログファイル:パスOK!?n"; }
else { print "ログファイルのパスが不正です: $logfile?n"; }
if (-r $logfile && -w $logfile) { print "ログパーミッション:OK!?n"; }
else { print "ログパーミッションが不正です。?n"; }
# 画像ディレクトリ
if (-d $ImgDir) { print "アップロードディレクトリ:パスOK!?n"; }
else { print "アップロードディレクトリのパスが不正です: $ImgDir?n"; }
if (-r $ImgDir && -w $ImgDir && -x $ImgDir)
{ print "アップロードディレクトリのパーミッション:OK!?n"; }
else { print "アップロードディレクトリのパーミッションが不正です。?n"; }
# ロックディレクトリ
print "ロック形式:";
if ($lockkey == 0) { print "ロック設定なし?n"; }
if ($lockkey == 1) { print "symlink?n"; }
else { print "mkdir?n"; }
($lockdir) = $lockfile =? /(.*)[???/].*$/;
print "ロックディレクトリ:$lockdir?n";
if (-d $lockdir) { print "ロックディレクトリのパス:OK?n"; }
else { print "ロックディレクトリのパス:NG → $lockdir?n"; }
if (-r $lockdir && -w $lockdir && -x $lockdir) {
print "ロックディレクトリのパーミッション:OK?n";
print "ロックディレクトリのパーミッション:NG → $lockdir?n";
print "?n?n?n";

我要回帖

更多关于 jlink clone 的文章

 

随机推荐