function getMovesListFromPosition($moveString, $player, $tally, $pliesLeft) { global $FIRST_PASS_TIME, $SECOND_PASS_TIME, $ALT_THRESHOLD, $RETRY_THRESHOLD, $MAJOR_MOVE_THRESHOLD; global $MAX_CAPTURE_LINES, $SESSION_START, $SESSION_LENGTH; if (time() - $SESSION_START >= $SESSION_LENGTH) { echo "ABORT! TIME OUT!\n"; return 'abort'; } if ($player == TRUE) { $maxLines = $MAX_CAPTURE_LINES; } else { $maxLines = 1; } $uciOutput = getUci($moveString, $FIRST_PASS_TIME, $maxLines); preg_match_all("/info.*?cp (-?[0-9]+).*?([a-h][1-8][a-h][1-8][qrnb]?)/", $uciOutput, $matches); //Abort puzzles that go from material advantage to mate in N if ($player === TRUE) { preg_match_all("/info.*?mate ([0-9]+).*?([a-h][1-8][a-h][1-8][qrnb]?)/", $uciOutput, $mate_matches); if (!empty($mate_matches[0])) { echo "POSITION CHANGED TO MATE!\n"; return 'abort'; } } else { preg_match_all("/info.*?mate (-[0-9]+).*?([a-h][1-8][a-h][1-8][qrnb]?)/", $uciOutput, $mate_matches); if (!empty($mate_matches[0])) { echo "POSITION CHANGED TO MATE!\n"; return 'abort'; } } $candidateMoves = array(); $candidateMovesEval = array(); $lastMove = explode(' ', $moveString); array_pop($lastMove); $lastMove = array_pop($lastMove); foreach ($matches[2] as $key => $match) { if (!in_array($match, $candidateMoves)) { $candidateMoves[] = $match; } } foreach ($candidateMoves as $key => $move) { $candidateMovesEval[] = getPositionEval("{$moveString}{$move} ", $SECOND_PASS_TIME); } array_multisort($candidateMovesEval, SORT_ASC, SORT_NUMERIC, $candidateMoves); if (!empty($candidateMovesEval)) { while ($candidateMovesEval[0] === FALSE) { array_shift($candidateMovesEval); array_shift($candidateMoves); if (empty($candidateMovesEval)) { break; } } } if (isset($candidateMovesEval[0])) { $topEval = $candidateMovesEval[0]; } $moveArray = array(); foreach ($candidateMoves as $key => $move) { if (abs($candidateMovesEval[$key] - $topEval) <= abs($topEval * $ALT_THRESHOLD) && $key < $maxLines) { $parsedTally = $tally; $changeThisTurn = abs(materialChange($moveString . $move)); $isCheck = isCheck($moveString . $move); $isTension = isTension($moveString . $move); $nextMoveCapture = nextMoveCapture($moveString . $move); $confirmTension = FALSE; if ($player === FALSE) { $isMateThreat = isMateThreat($moveString . $move); $nextMoveCapture = nextMoveCapture($moveString . $move); if ($isTension === TRUE) { $confirmTension = confirmTension($moveString . $move); } } else { $isMateThreat = FALSE; $nextMoveCapture = FALSE; } if ($player == TRUE) { if ($changeThisTurn > 1) { $parsedTally += $changeThisTurn; } } else { $changeThisTurn = -$changeThisTurn; if ($changeThisTurn < -1) { $parsedTally += $changeThisTurn; } } //echo " Parent -> Child | CP Adv | Plies | Adv | Var | + | T\n"; printf("%1s: %5s -> %5s | %+6d | %5d | %+3d | %+3d | %1s | %1s | %1s | %1s\n", $player ? 'P' : 'C', $lastMove, $move, -1 * $candidateMovesEval[$key], $pliesLeft, $parsedTally, $changeThisTurn, $isCheck ? '+' : '-', $isTension ? $confirmTension ? '#' : '+' : '-', $isMateThreat ? '+' : '-', $nextMoveCapture ? '+' : '-'); if ($player == TRUE) { if ($parsedTally > 0 && $pliesLeft == 1) { $moveArray[$move] = 'win'; echo "{$move} -> WIN\n"; } else { if ($changeThisTurn > 1) { //Something happened $moveArray[$move] = getMovesListFromPosition($moveString . $move . ' ', FALSE, $parsedTally, $MAJOR_MOVE_THRESHOLD); } else { if ($pliesLeft - 1 > 0) { //Nothing happened $moveArray[$move] = getMovesListFromPosition($moveString . $move . ' ', FALSE, $parsedTally, $pliesLeft - 1); } else { $moveArray[$move] = 'retry'; echo "{$move} -> RETRY\n"; } } } } else { if ($parsedTally > 0 && $isCheck === FALSE && $isTension === FALSE) { $moveArray[$move] = 'win'; echo "{$move} -> WIN\n"; } else { if ($parsedTally <= 0 && $changeThisTurn === 0 && $isCheck === FALSE && $isTension === FALSE && $isMateThreat === FALSE && $pliesLeft - 1 > 0) { //Nothing has happened and we aren't complete $moveArray[$move] = getMovesListFromPosition($moveString . $move . ' ', TRUE, $parsedTally, $pliesLeft - 1); } else { if (abs($changeThisTurn) > 1 || $isCheck === TRUE || $confirmTension === TRUE || $nextMoveCapture === TRUE) { //Somthing noteworthy has happened $moveArray[$move] = getMovesListFromPosition($moveString . $move . ' ', TRUE, $parsedTally, $MAJOR_MOVE_THRESHOLD); } else { if (($isTension === TRUE || $isMateThreat === TRUE) && $pliesLeft - 1 > 0) { //Something UNnoteworthy happened $moveArray[$move] = getMovesListFromPosition($moveString . $move . ' ', TRUE, $parsedTally, $pliesLeft - 1); } else { $moveArray[$move] = 'retry'; echo "{$move} -> RETRY\n"; } } } } } if ($moveArray[$move] === 'abort') { echo "{$move} -> ABORT! TIME OUT!\n"; return 'abort'; } } else { if (abs($candidateMovesEval[$key] - $topEval) <= abs($topEval * $RETRY_THRESHOLD) && abs($candidateMovesEval[$key] - $topEval) > abs($topEval * $ALT_THRESHOLD) && $player === TRUE) { $moveArray[$move] = 'retry'; echo "{$move} -> RETRY\n"; } } } $empty = TRUE; foreach ($moveArray as $key => $value) { if ($value !== 'retry') { $empty = FALSE; } } if ($empty == TRUE) { $moveArray = 'retry'; echo "{$lastMove} -> NO WIN\n"; } return $moveArray; }
if ($_POST['pass'] == '') { $field = array('username', 'name', 'image', 'address', 'phone', 'email', 'name_nn', 'address_nn', 'phone_nn', 'email_nn', 'name_bank', 'chuthe', 'num_acc', 'block'); } else { $field = array('username', 'pass', 'name', 'image', 'address', 'phone', 'email', 'name_nn', 'address_nn', 'phone_nn', 'email_nn', 'name_bank', 'chuthe', 'num_acc', 'block'); } $filename = $_FILES['image']['name']; if ($filename == '') { $image = $_POST["tmpImage"]; } else { $image = uploadFile('image', 0, '../uploads/'); } // get value if ($_POST['pass'] == '') { $values = array(format($_POST['username'], 0), format($_POST['name'], 0), format(str_replace('../', '', $image), 0), format($_POST['address'], 0), format($_POST['phone'], 0), format($_POST['email'], 0), format($_POST['name_nn'], 0), format($_POST['address_nn'], 0), format($_POST['phone_nn'], 0), format($_POST['email_nn'], 0), format($_POST['name_bank'], 0), format($_POST['chuthe'], 0), format($_POST['num_acc'], 0), format(isCheck(isset($_POST["block"])), 0)); } else { $values = array(format($_POST['username'], 0), format(md5($_POST['pass']), 0), format($_POST['name'], 0), format(str_replace('../', '', $image), 0), format($_POST['address'], 0), format($_POST['phone'], 0), format($_POST['email'], 0), format($_POST['name_nn'], 0), format($_POST['address_nn'], 0), format($_POST['phone_nn'], 0), format($_POST['email_nn'], 0), format($_POST['name_bank'], 0), format($_POST['chuthe'], 0), format($_POST['num_acc'], 0), format(isCheck(isset($_POST["block"])), 0)); } // updateObject($field=array(),$value=array(),$where) $res = $tbl->updateObject($field, $values, 'id=' . $id); if ($res) { echo "OK"; } } $res = $tbl->loadOne('id=' . $id); if ($res) { $row = mysql_fetch_array($res); ?> <div id="center-column"> <div class="top-bar"> <h1>User</h1> <div class="breadcrumbs"><a href="#">Content</a> / <a href="#">Sửa</a></div>
$tbl = new table('advertise'); if (isset($_POST["done"])) { $field = 'id,catid,name,url,image,published,ordering,view,date,lang'; // upload file // uploadFile($file,$auto=1,$dir='uploads/images/') $path = '../Images/Advertisement/'; $image = uploadFile('image', 0, $path); // values // format($str,$isComma=1) // isCheck($check) $values = format($tbl->getLastId() + 1, 1); $values .= format($_POST["catid"], 1); $values .= format($_POST["name"], 1); $values .= format($_POST["url"], 1); $values .= format(str_replace('../', '', $image), 1); $values .= format(isCheck(isset($_POST["published"])), 1); $values .= format($_POST["ordering"], 1); $values .= format($_POST["view"], 1); $values .= format($_POST["date"], 1); @($values .= format($lang, 0)); // insertObject($field,$value) $res = $tbl->insertObject($field, $values); if ($res) { $thongbao = "OK"; } } ?> <div id="center-column"> <div class="top-bar"> <h1>Advertise</h1> <div class="breadcrumbs"><a href="index.php?choose=advertise">Advertise</a> / <a href="#">Thêm</a></div>
</table> <div class="hl2" style="margin-top:10px;margin-bottom:10px">Book source</div> <table class="stable" cellspacing="0" cellpadding="4px" border="0"> <tr><td width="12px" align="left"> <input id="bsr" class="iCheck" type="radio" <?php echo isCheck($f['source'], "r"); ?> name="source" value="r"/></td><td width="119px"><label for="bsr"><div>Buy:</div></label></td> <td><?php echo iText('sourcer', $f['source'] == 'r' ? $f['sourceval'] : "", $txtWidth, 'price'); ?> </td></tr> <tr><td width="12px" align="left"> <input id="bsg" class="iCheck" type="radio" name="source" <?php echo isCheck($f['source'], "g"); ?> value="g"/></td><td width="119px"><label for="bsg"><div>Gift:</div></label></td> <td><?php echo iText('sourceg', $f['source'] == 'g' ? $f['sourceval'] : "", $txtWidth, 'from'); ?> </td></tr> </table> <div class="hl2" style="margin-top:10px;margin-bottom:10px">Book allocation</div> <table class="stable" cellspacing="0" cellpadding="4px" border="0" style="margin-bottom:30px"> <tr><td width="140px" align="left">Place book in:</td><td><?php echo iSelect('shelf', $mstr_shelf, $f['shelf']); ?> </td></tr> </table>
</tr> <tr> <td width="20px"><input id="jd8" type="checkbox" <?php echo isCheck($job_data[7], "1"); ?> name="job_data8" id="job_data8" value="1"/></td><td colspan="3"><label for="jd8">Computer skills (please specify)</label></td> </tr> <tr> <td width="20px"> </td><td colspan="3"><input type="text" class="iText" style="width:100%" value="<?php echo $empjd['computer']; ?> " name="empjd_computer" id="empjd_computer"/></td> </tr> <tr> <td width="20px"><input id="jd9" type="checkbox" <?php echo isCheck($job_data[8], "1"); ?> name="job_data9" id="job_data9" value="1"/></td><td colspan="3"><label for="jd9">Other skills (please specify)</label></td> </tr> <tr> <td width="20px"> </td><td colspan="3"><input type="text" class="iText" style="width:100%" value="<?php echo $empjd['other']; ?> " name="empjd_other" id="empjd_other"/></td> </tr> </table> </td> </tr> <tr><td> </td><td colspan="2"></td></tr> <!-- Separator --> <tr height="30px" valign="top"><td width="20px"><b>G.</b></td><td colspan="2"><strong>Employment History (starting with the most recent)</strong></td></tr>
<input type="checkbox" class="check-avanzado" name="TrackAnalitics" value="1" title="<?php _e('Usar Google Analytics', 'envialo-simple'); ?> " <?php echo isCheck($c["TrackAnalitics"]); ?> > <?php _e('Usar Google Analytics', 'envialo-simple'); ?> <br /> <input type="checkbox" class="check-avanzado" name="SendStateReport" value="1" title="<?php _e('Enviar informe al finalizar', 'envialo-simple'); ?> " <?php echo isCheck($c["SendStateReport"]); ?> > <?php _e('Enviar informe al finalizar', 'envialo-simple'); ?> <br /> </div> </div> <div class="misc-pub-section curtime" style="border-bottom:0;"> <?php $optionSelect = ""; switch ($c["schedule"]["ScheduleType"]) { case 'Send Now': $enviar = __('Enviar <b>Ahora</b>', 'envialo-simple');
$values .= format($_POST["name"], 1); $values .= format($_POST["mavach"], 1); $values .= format($_POST["ghichu"], 1); $values .= format($_POST["nsx"], 1); $values .= format($_POST["status"], 1); $values .= format($str_img, 1); $values .= format($color, 1); $values .= format($_POST["details"], 1); $values .= format(isCheck(isset($_POST["new"])), 1); $values .= format(isCheck(isset($_POST["promo"])), 1); $values .= format(isCheck(isset($_POST["typi"])), 1); $values .= format(isCheck(isset($_POST["feat"])), 1); $values .= format(isCheck(isset($_POST["like"])), 1); $values .= format(isCheck(isset($_POST["chobe"])), 1); $values .= format(isCheck(isset($_POST["chome"])), 1); $values .= format(isCheck(isset($_POST["chogiadinh"])), 1); $values .= format($_POST["huongdan"], 1); $values .= format($_POST["url"], 1); $values .= format(rand_name($_POST["name"], $id), 0); //echo $values; // insertObject($field,$value) $res = $tbl->insertObject($field, $values); if ($res) { //var_dump($res); echo "<script>self.location='index.php?choose=addprice&proid=" . $id . "';</script>"; } } else { echo "Lỗi trùng mã vạch. Vui lòng nhập mã vạch khác."; } } ?>
<?php $tbl = new table('news'); if (isset($_POST["done"])) { // get field $field = 'id,name,details,image,hot,date_add,alias,url,lang'; $str_img = upload_img('image', '../Images/News/', 250, 163); $id = $tbl->getLastId() + 1; $values = format($id, 1); //$values.= format($_POST["catid"],1); $values .= format($_POST["name"], 1); $values .= format($_POST["details"], 1); $values .= format(str_replace('../', '', $str_img), 1); $values .= format(isCheck(isset($_POST["hot"])), 1); $values .= format(time(), 1); $values .= format(rand_name($_POST["name"], $id), 1); $values .= format($_POST["url"], 1); $values .= format('0', 0); // insertObject($field,$value) $res = $tbl->insertObject($field, $values); if ($res) { //var_dump($res); echo "OK"; } } ?> <div id="center-column"> <div class="top-bar"> <h1>Tin tức</h1> <div class="breadcrumbs"><a href="<?php echo loadPage('news');
$values .= format($_POST['username'], 1); $values .= format(md5($_POST['pass']), 1); $values .= format($_POST['name'], 1); $values .= format(str_replace('../', '', $image), 1); $values .= format($_POST['address'], 1); $values .= format($_POST['phone'], 1); $values .= format($_POST['email'], 1); $values .= format($_POST['name_nn'], 1); $values .= format($_POST['address_nn'], 1); $values .= format($_POST['phone_nn'], 1); $values .= format($_POST['email_nn'], 1); $values .= format($_POST['name_bank'], 1); $values .= format($_POST['chuthe'], 1); $values .= format($_POST['num_acc'], 1); $values .= format($now, 1); $values .= format(isCheck(isset($_POST["block"])), 0); if (isEmpty($_POST["username"]) == 1) { echo "Username invalid!"; } else { // insertObject($field,$value) $res = $tbl->insertObject($field, $values); if ($res) { header('location: ' . loadPage('member')); } } } ?> <div id="center-column"> <div class="top-bar"> <h1>Thành viên</h1> <div class="breadcrumbs"><a href="#">Content</a> / <a href="#">Thêm</a></div>
$id = $_GET["id"]; } $tbl = new table('advertise'); if (isset($_POST["done"])) { $field = array('catid', 'name', 'url', 'image', 'published', 'ordering', 'view', 'date', 'lang'); // upload file // uploadFile($file,$auto=1,$dir='uploads/images/') $filename = $_FILES['image']['name']; if ($filename == '') { $image = $_POST["tmpImage"]; } else { del_file('advertise', 'image', $id); $image = uploadFile('image', 0, '../Images/Advertisement/'); } // format($str,$isComma=1) $values = array(format($_POST["catid"], 0), format($_POST["name"], 0), format($_POST["url"], 0), format(str_replace('../', '', $image), 0), format(isCheck(isset($_POST["published"])), 0), format($_POST["ordering"], 0), format($_POST["view"], 0), format($_POST["date"], 0), format($lang, 0)); // updateObject($field=array(),$value=array(),$where) $res = $tbl->updateObject($field, $values, 'id=' . $id); if ($res) { header('location: ' . loadPage('advertise')); } } $res = $tbl->loadOne('id=' . $id); if ($res) { $row = mysql_fetch_array($res); ?> <div id="center-column"> <div class="top-bar"> <h1>Advertise</h1> <div class="breadcrumbs"><a href="index.php?choose=advertise">Advertise</a> / <a href="#">Sửa</a></div> </div><br />
$dem=0; for($i=0;$i<$max;$i++){ $sizename = $_POST['size'.$i]; if($sizename!=''){ $cuoi = ''; $dem++; if($dem!=1) $cuoi='-'; $size .= $cuoi.$sizename; } } } } */ // values $values = array(format($_POST["catid1"], 0), format($_POST["catid2"], 0), format($_POST["catid3"], 0), format($_POST["chuyenmucid"], 0), format($_POST["name"], 0), format($_POST["mavach"], 0), format($_POST["ghichu"], 0), format($_POST["nsx"], 0), format($_POST["status"], 0), format($str_img, 0), format($color, 0), format($_POST["details"], 0), format(isCheck($_POST["new"]), 0), format(isCheck($_POST["promo"]), 0), format(isCheck($_POST["typi"]), 0), format(isCheck($_POST["feat"]), 0), format(isCheck($_POST["like"]), 0), format(isCheck($_POST["chobe"]), 0), format(isCheck($_POST["chome"]), 0), format(isCheck($_POST["chogiadinh"]), 0), format($_POST["huongdan"], 0), format(rand_name($_POST["name"], $id), 0), format($_POST["url"], 0)); // updateObject($field=array(),$value=array(),$where) $res = $tbl->updateObject($field, $values, 'id=' . $id); if ($res) { header('location: ' . loadPage('products')); } } else { echo "Lỗi trùng mã vạch. Vui lòng nhập mã vạch khác."; } } // load page // loadOne($where) $res = $tbl->loadOne('id=' . $id); if ($res) { $row = mysql_fetch_array($res); $img = explode('(*_^)', $row['image']);
?> to </td></tr> <tr><td> </td><td><?php echo inputDate('date2', $r['date2']); ?> </td></tr> <tr><td>Speaker:</td><td><?php echo iText('speaker', $r['speaker'], $iTextFw); ?> </td></tr> <tr valign="top"><td>Participant:</td><td><?php echo iTextarea('participant', $r['participant'], $iTextFw, 3); ?> </td></tr> <tr><td>Certified:</td><td><label style="padding:0;margin:0"><input style="padding:0;margin:0" <?php echo isCheck("Y", $r['certified']); ?> type="checkbox" id="certified" name="certified"/> Certified</label></td></tr> <tr><td>Attachment:</td><td> <iframe id="imgframe2" name="imgframe" scrolling="no" style="border:none;display:;height:25px;width:230px;overflow:hidden;margin:0;padding:0" src="trform.php?name=<?php echo $r['fname']; ?> "></iframe> </td></tr> <input type="hidden" id="pf_train_file" value="" /> <input type="hidden" id="pf_train_current_file" value="<?php echo $r['file']; ?> " /> <?php } else {
/* * * edit to category * */ if (isset($_POST["done"])) { // get field $field = array('sections', 'name', 'hit', 'published', 'loai', 'lang', 'ordering'); // get values // format // format($str,$isComma=1) $sections = format($_POST["sections"], 0); $name = format($_POST["name"], 0); $hit = format($_POST["hit"], 0); // isCheck($check) $published = isCheck(isset($_POST["published"])); $loai = format($b, 1); $lang = format($a, 1); $ordering = format($_POST["ordering"], 0); // values $values = array($sections, $name, $hit, $published, $loai, $lang, $ordering); // updateObject($field=array(),$value=array(),$where) $res = $tbl->updateObject($field, $values, 'id=' . $id); if ($res) { echo "OK!"; } } $res = $tbl->loadOne('id=' . $id); if ($res) { $row = mysql_fetch_array($res); ?>
<?php if (isset($_GET['id'])) { $id = $_GET["id"]; } $tbl = new table('news'); if (isset($_POST["done"])) { $field = array('catid', 'name', 'details', 'image', 'hot', 'date_add', 'alias', 'url'); $img = edit_img('../', 'Images/News/', 'news', 'image', $_POST['tmpimage'], $id, 250, 163); $values = array(format($_POST["catid"], 0), format($_POST["name"], 0), format($_POST["details"], 0), format($img, 0), format(isCheck(isset($_POST["hot"])), 0), format(strtotime(date('H:i:s ') . $_POST["date_add"]), 0), format(rand_name($_POST["name"], $id), 0), format($_POST["url"], 0)); // insertObject($field,$value) $res = $tbl->updateObject($field, $values, 'id=' . $id); if ($res) { header('location: ' . loadPage('news')); } } $res = $tbl->loadOne('id=' . $id); if ($res) { $row = mysql_fetch_array($res); $thumb_img = get_thumb('Images/News/', $row['image']); ?> <div id="center-column"> <div class="top-bar"> <h1>Tin tức</h1> <div class="breadcrumbs"><a href="<?php echo loadPage('news'); ?> ">Tin tức</a> / <a href="#">Sửa</a></div> </div><br />