• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 用戶數據集中寫入

    發表于:2007-07-04來源:作者:點擊數: 標簽:
    以前看到小石榴寫的一個用戶數據集中讀寫的帖子,看了好幾遍,沒看懂,實在對不起,又沒看懂。沒看懂就自己寫,下面是個我寫的集中寫入用戶數據的過程。 代碼: -------------------------------------------------------------------------------- sub upme


    以前看到小石榴寫的一個用戶數據集中讀寫的帖子,看了好幾遍,沒看懂,實在對不起,又沒看懂。沒看懂就自己寫,下面是個我寫的集中寫入用戶數據的過程。

    代碼:
    --------------------------------------------------------------------------------

    sub upmemberdate {
    my $membernametemp = shift;
    my %userinfo = @_;

    my $filetoopen = "$lbdir$memdir/$membernametemp.cgi";
    if (-e $filetoopen) {
    open (FILE,$filetoopen);
    my $filedata=<FILE>;
    close(FILE);
    chomp $filedata;
    local ( $membername, $password, $membertitle, $membercode, $numberofposts, $emailaddress, $showemail, $ipaddress, $homepage, $oicqnumber, $icqnumber, $location, $interests, $joineddate, $lastpostdate, $signature, $timedifference, $privateforums, $useravatar, $userflag, $userxz, $usersx, $personalavatar, $personalwidth, $personalheight, $rating, $lastgone, $visitno, $addjy, $meili, $mymoney, $postdel, $sex, $education, $marry, $work, $born, $chatlevel, $chattime, $jhmp, $useradd3, $useradd4, $onl.netime, $userquestion, $useradd6, $useradd7, $useradd8) = split(/\t/,$filedata);
    local($numberofposts,$numofreplys)=split(/\|/,$numberofposts);
    foreach my $info (keys %userinfo) {
    if ($userinfo{$info}=~/^[\+\-][0-9]+$/) {
    $$info += $userinfo{$info};
    }
    else {
    $userinfo{$info} =~ s/^\\(\-|\+)/$1/;
    $userinfo{$info} =~ s/^\\\\/\\/;
    $$info = $userinfo{$info};
    }
    #print "$info $$info\n";
    }
    open(FILE,">$filetoopen");
    print FILE "$membername\t$password\t$membertitle\t$membercode\t$numberofposts\|$numberofreplys\t$emailaddress\t$showemail\t$ipaddress\t$homepage\t$oicqnumber\t$icqnumber\t$location\t$interests\t$joineddate\t$lastpostdate\t$signature\t$timedifference\t$privateforums\t$useravatar\t$userflag\t$userxz\t$usersx\t$personalavatar\t$personalwidth\t$personalheight\t$rating\t$lastgone\t$visitno\t$addjy\t$meili\t$mymoney\t$postdel\t$sex\t$education\t$marry\t$work\t$born\t$chatlevel\t$chattime\t$jhmp\t$useradd3\t$useradd4\t$onlinetime\t$userquestion\t$useradd6\t$useradd7\t$useradd8\t\n";
    close(FILE);
    }
    }


    所傳遞的參數,第一個是所要寫入的用戶名,后面是一個哈希表,哈希表的關鍵字是要被改變的變量名,值是增減的值或被改為的值。
    如果哈希表的值以 + - 開頭,則是對相應的用戶數據增減,否則就將相應的用戶數據設為哈希表的值。
    如果要將一個以 + - 開頭的字串付給一個變量的話,就要用 \ 對其進行一次轉義,如果以 \ 開頭還要進行一次轉義。
    例如,將用戶 test 的發貼數加1 ,威望設為 -6 ,可以這樣調用過程。
    &upmemberdate('test',numofposts,'+1',rating,'\-6');

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>