*ユーザーデータのバグ [#e5a3a17d]
-ページ: [[罪罰改造板2]]
-投稿者: [[じょるじゅ]]
-優先順位: 緊急
-状態: 完了
-カテゴリー: エラーが出ます
-投稿日: 2006-10-30 (月) 00:05:13
-バージョン:
**内容 [#a104b737]
普通usrdataを開くと、一行目にキャラデータ、二行目に最終ログイン、IPアドレス、ホスト、ブラウザが表示されますよね?
それが何故か一度管理ページからキャラデータを編集すると、一行目にキャラデータ、最終ログイン、IPアドレス、ホスト、ブラウザが全て表示されます。そして二行目にも最終ログイン、IP、ホスト、ブラウザが書き込まれ、さらに行動する度に最終ログイン、IPアドレス、ホスト、ブラウザが下に書き込まれ続けます。
最近、迷宮で敵を倒した回数を追加しました。これを追加してから発生したので何か関係があると思うのですが…ちなみにキャラデータを編集すると、本来迷宮回数が書き込まれる部分に最終ログイン等が書き込まれてしまいます。
日本語下手ですいません。
是非解決方法をお願いします。
----
-管理画面に何か追加する場合は必ず4箇所追加、1箇所変更します。-- [[たぬたぬ]] &new{2006-10-30 (月) 016:30:02};
# キャラデータ変更
# 書き換え画面
sub usr_regist{
〜〜〜〜〜〜〜〜〜〜〜〜
<td nowrap>
<select name="camp">
EOM
foreach(0 .. $#cmp){
print "<option value=$_";
print " selected" if($camp==$_);
print ">$_:$cmp[$_]\n";
}
print <<"EOM";
</select>
</td>
</tr>
</table>
<br>
<table border="0" cellspacing="2" cellpadding="2" align="center">
<tr>
<th nowrap>HP</th>
<th nowrap>MP</th>
<th nowrap>UA</th>
<th nowrap>UD</th>
<th nowrap>LR</th>
<th nowrap>AG</th>
<th nowrap>GOLD</th>
<th nowrap>階級</th>
<th nowrap>称号</th>
<th nowrap>称号2</th>
<th nowrap>討伐回数</th>
<th nowrap>追加した回数名</th> #←ここを追加
</tr>
<tr>
</td>
<td nowrap><input type="text" name="max_hp" value="$max_hp" style="width:40px"></td>
<td nowrap><input type="text" name="max_mp" value="$max_mp" style="width:40px"></td>
<td nowrap><input type="text" name="ua" value="$ua" style="width:30px"></td>
<td nowrap><input type="text" name="ud" value="$ud" style="width:30px"></td>
<td nowrap><input type="text" name="lr" value="$lr" style="width:30px"></td>
<td nowrap><input type="text" name="ag" value="$ag" style="width:30px"></td>
<td nowrap><input type="text" name="gold" value="$gold" style="width:80px"></td>
<td nowrap>
<select name="rank">
EOM
foreach(0 .. $#cl){
print "<option value=$_";
print " selected" if($rank==$_);
print ">$_:$cl[$_]\n";
}
print <<"EOM";
</select>
</td>
<td nowrap>
<select name="sogo">
EOM
foreach(0 .. $#sogo_p){
print "<option value=$_";
print " selected" if($sogo==$_);
print ">$_:$sogo_p[$_]\n";
}
print <<"EOM";
</select>
</td>
<td nowrap>
<select name="sogo2">
EOM
foreach(0 .. $#sogo_p){
print "<option value=$_";
print " selected" if($sogo2==$_);
print ">$_:$sogo_p[$_]\n";
}
print <<"EOM";
</select>
</td>
<td nowrap><input type="text" name="we" value="$we" style="width:30px"></td>
<td nowrap><input type="text" name="xxx" value="$xxx" style="width:30px"></td> #ここを追加;追加した変数を$xxxにするとこんな感じです
</tr>
</table>
〜〜〜〜〜〜〜〜〜〜〜〜〜
# 書き換え処理&結果
sub usr_regist2{
&admin_head;
# ファイルロック(rename式)
$lock = &lock if $lock_check;
# 参加者データ一括読み込み
open(IN,"$usrdata$in{'id_old'}\.cgi") || &error("Open Error : $usrdata$in{'id_old'}\.cgi",1);
@dat = <IN>;
close(IN);
%DAT = '';
my @prats = split(/,/,$dat[0]);
foreach (0 .. $#prats){
my ($key,$v) = split(/;/,$prats[$_]);
$DAT{$key} = $v;
}
# ハッシュ読み込み
&hash_data;
$dat[0] = "xxx;$in{'xxx'},fel_vit;$in{'fel_vit'},<中略>dis_con;$dis_con,\n"; #ここに追加した変数を$inで囲みます。
open (OUT,">$usrdata$in{'id_old'}\.cgi") || &error("キャラデータが開けません[$in{'id_old'}]",1);
print OUT @dat;
close(OUT) or die "Can't close : $!";
if($in{'id_old'} ne $in{'id'}){rename("$usrdata$in{'id_old'}\.cgi","$usrdata$in{'id'}\.cgi") || &error("ファイル名をID名に変更できません。",1);}
# ファイルアンロック(rename式)
&unlock($lock) if $lock_check;
〜〜〜〜〜〜〜〜〜〜〜〜〜
<table border="0" cellspacing="2" cellpadding="2" align="center">
<tr>
<th nowrap>HP</th>
<th nowrap>MP</th>
<th nowrap>UA</th>
<th nowrap>UD</th>
<th nowrap>LR</th>
<th nowrap>AG</th>
<th nowrap>GOLD</th>
<th nowrap>階級</th>
<th nowrap>称号</th>
<th nowrap>称号2</th>
<th nowrap>討伐回数</th>
<th nowrap>追加した回数名</th> #←ここを追加
</tr>
<tr>
<td nowrap>$in{'max_hp'}</td>
<td nowrap>$in{'max_mp'}</td>
<td nowrap>$in{'ua'}</td>
<td nowrap>$in{'ud'}</td>
<td nowrap>$in{'lr'}</td>
<td nowrap>$in{'ag'}</td>
<td nowrap>$in{'gold'}</td>
<td nowrap>$in{'rank'}</td>
<td nowrap>$in{'sogo'}</td>
<td nowrap>$in{'sogo2'}</td>
<td nowrap>$in{'we'}</td>
<td nowrap>$in{'xxx'}</td> #追加した変数を$xxxにするとこんな感じです
</tr>
-こんな感じでどうでしょう?どこか間違っていたら言ってください。-- [[たぬたぬ]] &new{2006-10-30 (月) 016:30:02};
-上のは自分の管理画面ですので、いくつか違う部分があると思いますが、だいたいあってると思うので・・・ -- [[たぬたぬ]] &new{2006-10-30 (月) 16:42:26};
-素早い対応ありがとう御座います。解決いたしました。が、$dat[0] = "xxx;$in{'xxx'},fel_vit;$in{'fel_vit'},<中略>dis_con;$dis_con,\n"; だとできたのですが、$dat[0] = "fel_vit;$in{'fel_vit'},<中略>dis_con;$dis_con,xxx;$in{'xxx'},\n";のように、最後に xxx;$in{'xxx'},を持ってくると駄目でした。これはどうしてなのでしょう?もしよろしければ教えて下さい。 -- [[じょるじゅ]] &new{2006-10-30 (月) 16:49:03};
-自分はずっと先頭に追加してきたのでその理由はわからないです。すみませんm(_ _)m -- [[たぬたぬ]] &new{2006-10-31 (火) 08:27:41};
-お返事ありがとう御座いました!!とりあえず直りましたし^^もう大丈夫です。自分もこれからは先頭に追加しますね。では失礼します。 -- [[じょるじゅ]] &new{2006-10-31 (火) 11:37:32};
#comment