예제 #1
0
                     $data = iconv($module_charset[$tmp['charset']], "utf-8//IGNORE", $data);
                     if (false === $data) {
                         $lasterror[] = $language['fail_iconv'] . $module_charset[$tmp['charset']];
                     }
                 }
             }
         }
     } else {
         $lasterror[] = $language['client_off_line'];
     }
 }
 if (!$lasterror) {
     $query = 'insert into ' . $mysql_ini['prefix'] . 'online_task_lock values(?)';
     $stmt = $db->prepare($query);
     for ($retry = 10; $retry; $retry--) {
         $TaskId = GlobalFunc::random(32);
         $stmt->bind_param('s', $TaskId);
         if (!$stmt->execute()) {
             if (false !== strstr($stmt->error, 'Duplicate') and $retry > 1) {
                 continue;
             } else {
                 $lasterror[] = $language['fail_get_uniqu_tid'];
             }
         } else {
             break;
         }
     }
     $stmt->close();
 }
 if (!$lasterror) {
     $requestStatus = -9;
예제 #2
0
 public static function GetTaskID()
 {
     $ret = false;
     $query = 'insert into ' . self::$_mysql_ini['prefix'] . 'online_task_lock values(?)';
     $stmt = self::$_db->prepare($query);
     for ($retry = 10; $retry; $retry--) {
         $TaskId = GlobalFunc::random(32);
         $stmt->bind_param('s', $TaskId);
         if (!$stmt->execute()) {
             if (false !== strstr($stmt->error, 'Duplicate') and $retry > 1) {
                 continue;
             }
         } else {
             self::$_tid = $TaskId;
             $ret = true;
             break;
         }
     }
     $stmt->close();
     return $ret;
 }
예제 #3
0
 } else {
     $new_comment = $_POST['new_comment'];
     $query = "select token,comment from " . $mysql_ini['prefix'] . "token";
 }
 $result = $db->query("{$query}");
 $i = mysqli_num_rows($result);
 $max_token -= $i;
 for (; $i > 0; $i--) {
     $r = $result->fetch_assoc();
     $r['comment'] = htmlspecialchars($r['comment']);
     $r['remark'] = explode(',', $r['comment']);
     $c_token[] = $r;
 }
 if ($new_comment) {
     if ($max_token > 0) {
         $new_token = GlobalFunc::random(32);
         $query = "insert into " . $mysql_ini['prefix'] . "token values (NULL,?,?,0)";
         $stmt = $db->prepare($query);
         $stmt->bind_param("ss", $new_token, $new_comment);
         if (!$stmt->execute()) {
             $lasterror[] = $language['create_token_fail'];
         } else {
             $max_token--;
             $r['token'] = $new_token;
             $r['comment'] = htmlspecialchars($new_comment);
             $r['remark'] = explode(',', $r['comment']);
             $c_token[] = $r;
         }
         $stmt->close();
     } else {
         $lasterror[] = $language['no_more_token'];