zoukankan      html  css  js  c++  java
  • 抽奖代码

    elsif  (($recm =~/^抽奖$/)  and ($friend =~/赵xx/)){
    $xx="";
    		$recm =~ s/^s+//;
    		use DBI; 
    		my $dbName = 'oadb';  
    my $dbUser = 'query';  
    my $dbUserPass = 'query';
    my $dbh = DBI->connect("dbi:Oracle:$dbName", $dbUser, $dbUserPass) or die "can't connect to database " ;
    my $XDATE = strftime("%Y%m%d%H%M%S",localtime());
    $friend=encode("utf8",decode("gbk","$friend"));
    my $sql = "   SELECT TRUNC(1+10*dbms_random.value) FROM dual ";    
    my $sth = $dbh->prepare($sql);    
    $sth->execute();  
    
    $xx = $sth->fetchrow_array(); 
    
    
    
    my $sql = "SELECT count(*)   FROM cjxx where id=$xx"; 
    my $sth = $dbh->prepare($sql);    
    $sth->execute();  
    
     $yy = $sth->fetchrow_array();
    chomp $yy; 
    print "$xx is $xx
    ";
    print "1----------$yy is $yy
    ";
      my $hint=encode("utf8",decode("gbk","已经中过了,请继续抽奖!"));
      #if ($yy == 1) {$client->reply_msg($msg,"$xx--$hint")}
      
     if ($yy == 1) { while (1==1){
     my $sql = "   SELECT TRUNC(1+10*dbms_random.value) FROM dual ";    
    my $sth = $dbh->prepare($sql);    
    $sth->execute();  
    
    $xx = $sth->fetchrow_array();
    my $sql = "SELECT count(*)   FROM cjxx where id=$xx"; 
    my $sth = $dbh->prepare($sql);    
    $sth->execute();  
    
     $yy = $sth->fetchrow_array();
    chomp $yy; 
    if ($yy==0){$client->reply_msg($msg,"$xx");print "2---------$xx is $xx
    ";print "2---------$yy is $yy
    ";last}}
    }
    
      
       else {$client->reply_msg($msg,"$xx")};
    $dbh->do("insert into  	query.cjxx values ($xx)") or $!;
    }

  • 相关阅读:
    文件
    购物车
    session
    三级联动
    综合
    jquery弹窗插件
    Jquery
    PDO
    session cookie用法
    租房子
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13351076.html
Copyright © 2011-2022 走看看