function updateUser($DBlink, $user, $name, $deptID, $token) { if (!checkExist($DBlink, $user, $token)) { return false; } else { $DBlink->query("UPDATE `login` \n\t\t\t\t\t\t\tSET `name` = '{$name}', \n\t\t\t\t\t\t\t\t`deptID` = {$deptID}\n\t\t\t\t\t\t\tWHERE `user` = '{$user}'; "); return true; } }
function needLogin($DBlink) { if (!isset($_SESSION['loginID']) || !isset($_SESSION['loginToken'])) { alert('Please login first. '); locate($URLPv . "login.php"); return; } if (!checkExist($DBlink, $_SESSION['loginID'], $_SESSION['loginToken'])) { alert('Please login first. '); locate($URLPv . "login.php"); return; } }
/** * 文章属性调用标签 * * @version $Id: getarcattr.lib.php netman * @package Stourweb.Taglib * @copyright Copyright (c) 2007 - 2011, Stourweb, Inc. * @link http://www.stourweb.com */ function lib_getarcattr(&$ctag, &$refObj) { global $dsql; $attlist = "row|8,limit|0,flag|"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnertext()); $revalue = ''; $kindid = $refObj->Fields['kindid']; $sql = "select * from #@__article_attr where isopen=1 and pid!=0 order by displayorder asc limit {$limit},{$row}"; if ($flag == 'mdd') { $sql = "select a.*,count(b.id) as num from #@__article_attr as a inner join #@__article as b on find_in_set(a.id,b.attrid) where find_in_set({$kindid},b.kindlist) group by a.id limit {$limit},{$row}"; } $dsql->SetQuery($sql); $dsql->Execute(); $ctp = new STTagParse(); $ctp->SetNameSpace("field", "[", "]"); $ctp->LoadSource($innertext); $GLOBALS['autoindex'] = 0; while ($row = $dsql->GetArray()) { if (checkExist($row['id'])) { $destid = isset($GLOBALS['destid']) ? $GLOBALS['destid'] : 0; $py = Helper_Archive::getDestPinyin($destid); $py = !empty($py) ? $py : 'all'; //$row['url'] = $GLOBALS['cfg_cmsurl']."/raiders/search.php?attrid={$row['id']}&destid={$destid}"; $row['url'] = $GLOBALS['cfg_cmsurl'] . "/raiders/" . $py . '-' . $row['id']; $row['title'] = $row['attrname']; $row['number'] = getCount($row['id']); if ($flag == 'mdd') { $row['number'] = $row['num']; } foreach ($ctp->CTags as $tagid => $ctag) { if ($ctag->GetName() == 'array') { $ctp->Assign($tagid, $row); } else { if (!empty($row[$ctag->GetName()])) { $ctp->Assign($tagid, $row[$ctag->GetName()]); } } } $revalue .= $ctp->GetResult(); $GLOBALS['autoindex']++; } else { continue; } } return $revalue; }
<?php require_once '../functions.php'; $files = glob("*.webm"); foreach ($files as $webm) { $existance = checkExist($webm); if ($existance['cnt'] < 1) { addWebm($webm); } }
<?php $n = 0; $thisScript = $argv[$n++]; $librariesConfigFile = $argv[$n++]; $workerTimeLibrariesDir = $argv[$n++]; $webTimeLibrariesDir = $argv[$n++]; $baseDirectory = $argv[$n++]; echo "Starting pullLibraries\n"; echo " config file = " . checkExist($librariesConfigFile) . "\n"; echo " workerTime dir = " . checkExist($workerTimeLibrariesDir) . "\n"; echo " webTime dir = " . checkExist($webTimeLibrariesDir) . "\n"; echo " base dir = " . checkExist($baseDirectory) . "\n"; $libraries = readLibraryDefinitions($librariesConfigFile); foreach ($libraries as $libraryName => $info) { processLibraryDeclaration($libraryName, $info, $baseDirectory, $workerTimeLibrariesDir, $webTimeLibrariesDir); } function readLibraryDefinitions($librariesConfigFile) { $jsonString = file_get_contents($librariesConfigFile); if ($jsonString === false) { echo "{$thisScript}: file {$librariesConfigFile} not found\n"; exit(2); } $libraries = json_decode($jsonString, true); if ($libraries === null) { echo "{$thisScript}: error in json file {$librariesConfigFile}\n"; exit(3); } return $libraries; }
$channel->queue_declare($queue, false, true, false, false); $channel->queue_bind($queue, $exchange, 'orderack'); /* --------- 发送队列 -------------*/ // echo ' [*] Waiting for logs. To exit press CTRL+C', "\n"; $callback = function ($msg) { global $channel, $exchange; echo ' [x] ', $msg->body, "\n"; // return ; $result = json_decode($msg->body, TRUE); if ($result == FALSE) { echo '解析数据失败'; return FALSE; } //print_r($result); $info = $result[0]; $isexist = checkExist($info['id']); //验证数据是否已经提交过 if (TRUE == $isexist) { echo "duplicate massage!"; return FALSE; } $username = mysql_real_escape_string($info['username']); $platformUsername = mysql_real_escape_string($info['platformUsername']); $email = mysql_real_escape_string($info['email']); $countryName = mysql_real_escape_string($info['countryName']); $countrySn = mysql_real_escape_string($info['countrySn']); $state = mysql_real_escape_string($info['state']); $city = mysql_real_escape_string($info['city']); $street = mysql_real_escape_string($info['street']); $address2 = mysql_real_escape_string($info['address2']); $address3 = mysql_real_escape_string($info['address3']);
$data = array(); $arFilter = array('IBLOCK_ID' => IBLOCK_ID); $raw = CIBlockSection::GetList(array('ID' => 'ASC'), $arFilter); while ($item = $raw->Fetch()) { $data[$item['CODE']] = $item['ID']; } $obCache->StartDataCache($lifeTime, $cacheId, "/"); $obCache->EndDataCache(array("SECTIONS" => $data)); return $data; } } if ($USER->IsAuthorized()) { $user = $USER->GetID(); $email = $USER->GetEmail(); $sections = getSections(); $current = checkExist($user, $email); $result = 'success'; if (intval($current['ID']) > 0) { $ID = $current['ID']; $props = array(); $fields = json_decode($_COOKIE['fields'], true); for ($i = 1; $i < 4; $i++) { if (!isset($fields['q' . $i])) { $fields['q' . $i] = 'N'; } else { if (intval($fields['q' . $i]) !== $answers[$i]) { $result = 'error'; $fields['q' . $i] = 'N'; } else { $fields['q' . $i] = 'Y'; }
function adminEdit($tab, $id) { function checkExist($str1, $str2) { if ($str1 == $str2) { echo "selected"; } } if ($tab == 1) { $query = "SELECT rtk_short_kod,rtk_desc,rtk_active AS active FROM ref_test_kat\n WHERE rtk_kod='{$id}'"; } elseif ($tab == 2) { $query = "SELECT rtk_kod,rtg_rtk_kod,rtg_desc,rtg_active AS active FROM ref_test_group\n JOIN ref_test_kat ON ref_test_kat.rtk_kod=ref_test_group.rtg_rtk_kod\n WHERE rtg_kod='{$id}'"; } elseif ($tab == 3) { $query = "SELECT *,rt_active AS active FROM ref_test"; // $query .= " JOIN ref_ujian_group ON ref_ujian_group.rug_code=ref_ujian.rug_code"; // $query .= " JOIN ref_ujian_code ON ref_ujian_code.ruc_code=ref_ujian_group.ruc_code"; $query .= " WHERE rt_kod='{$id}'"; } elseif ($tab == 4) { $query = "SELECT rsek_desc,rsek_status As active FROM ref_seksyen"; $query .= " WHERE rsek_rp_kod=3 AND rsek_kod='{$id}'"; } elseif ($tab == 5) { $query = "SELECT ru_rsek_kod,ru_short_kod,ru_desc,rsek_desc,ru_status As active FROM ref_unit"; $query .= " JOIN ref_seksyen ON ref_seksyen.rsek_kod=ref_unit.ru_rsek_kod"; $query .= " WHERE rsek_rp_kod='3' AND ru_kod='{$id}'"; } $result = selQuery($query); $row = mysqli_fetch_assoc($result); ?> <div class="row"> <div class="admin-form"> <!-- <div class="form-status-holder alert alert-success" id="showAlert" style="position:fixed;right:17px;top:10;display:none;z-index:100"></div> --> <input type="hidden" id="itemID" value="<?php echo $id; ?> "> <?php if ($tab == 1) { ?> <div class="col-md-3">Code <font style="color:red">*</font></div> <div class="col-md-1">:</div> <div class="col-md-4"> <label class="field prepend-icon"> <input type="text" id="txt_code" class="gui-input" value="<?php echo $row['rtk_short_kod']; ?> "> <label for="txt_code" class="field-icon"> <i class="fa fa-edit"></i> </label> </label> </div> <div class="col-md-12"> </div> <div class="col-md-3">Description <font style="color:red">*</font></div> <div class="col-md-1">:</div> <div class="col-md-7"> <label class="field prepend-icon"> <input type="text" id="txt_desc" class="gui-input" value="<?php echo $row['rtk_desc']; ?> "> <label for="txt_desc" class="field-icon"> <i class="fa fa-edit"></i> </label> </label> </div> <?php } elseif ($tab == 2) { ?> <div class="col-md-3">Code <font style="color:red">*</font></div> <div class="col-md-1">:</div> <div class="col-md-4"> <select id="txt_code" class="form-control"> <option value="0">-- Please Select --</option> <?php $query = "SELECT * FROM ref_test_kat"; $result = selQuery($query); while ($rows = mysqli_fetch_assoc($result)) { if ($rows['rtk_kod'] == $row['rtk_kod']) { echo "<option value=\"" . $rows['rtk_kod'] . "\" selected>" . $rows['rtk_short_kod'] . " - " . $rows['rtk_desc'] . "</option>"; } else { echo "<option value=\"" . $rows['rtk_kod'] . "\" >" . $rows['rtk_short_kod'] . " - " . $rows['rtk_desc'] . "</option>"; } } ?> </select> </div> <div class="col-md-12"> </div> <div class="col-md-3">Description <font style="color:red">*</font></div> <div class="col-md-1">:</div> <div class="col-md-7"> <label class="field prepend-icon"> <input type="text" id="txt_desc" class="gui-input" value="<?php echo $row['rtg_desc']; ?> "> <label for="txt_desc" class="field-icon"> <i class="fa fa-edit"></i> </label> </label> </div> <?php } elseif ($tab == 3) { ?> <div class="col-md-3">Category<font style="color:red">*</font></div> <div class="col-md-1">:</div> <div class="col-md-4"> <select id="txt_category" class="form-control"> <option value="0">-- Please Select --</option> <?php getTestCategory(); ?> </select> </div> <div class="col-md-12"> </div> <div class="col-md-3">Description</div> <div class="col-md-1">:</div> <div class="col-md-7"> <label class="field prepend-icon"> <input type="text" id="txt_desc" class="gui-input" value="<?php echo $row['rt_desc']; ?> "> <label for="txt_desc" class="field-icon"> <i class="fa fa-edit"></i> </label> </label> </div> <div class="col-md-12"> </div> <div class="col-md-3">Code <font style="color:red">*</font></div> <div class="col-md-1">:</div> <div class="col-md-4"> <label class="field prepend-icon"> <input type="text" id="txt_code" class="gui-input" value="<?php echo $row['rt_test_kod']; ?> "> <label for="txt_code" class="field-icon"> <i class="fa fa-edit"></i> </label> </label> </div> <div class="col-md-12"> </div> <div class="col-md-3">Type <font style="color:red">*</font></div> <div class="col-md-1">:</div> <div class="col-md-7"> <label class="field prepend-icon"> <input type="text" id="txt_type" class="gui-input" value="<?php echo $row['ru_type']; ?> "> <label for="txt_type" class="field-icon"> <i class="fa fa-edit"></i> </label> </label> </div> <div class="col-md-12"> </div> <div class="col-md-3">Limit</div> <div class="col-md-1">:</div> <div class="col-md-7"> <label class="field prepend-icon"> <input type="text" id="txt_limit" class="gui-input" value="<?php echo $row['ru_limit']; ?> "> <label for="txt_limit" class="field-icon"> <i class="fa fa-edit"></i> </label> </label> </div> <div class="col-md-12"> </div> <div class="col-md-3">Reference</div> <div class="col-md-1">:</div> <div class="col-md-7"> <label class="field prepend-icon"> <textarea class="gui-textarea" id="txt_reference"><?php echo $row['ru_reference']; ?> </textarea> <label for="comment" class="field-icon"> <i class="fa fa-comments"></i> </label> <span class="input-footer">Reference</span> </label> </div> <div class="col-md-12"> </div> <div class="col-md-3">Specification</div> <div class="col-md-1">:</div> <div class="col-md-7"> <label class="field prepend-icon"> <textarea class="gui-textarea" id="txt_spec"><?php echo $row['rt_spec']; ?> </textarea> <label for="comment" class="field-icon"> <i class="fa fa-comments"></i> </label> <span class="input-footer">Specification</span> </label> </div> <div class="col-md-12"> </div> <div class="col-md-3">Accredited</div> <div class="col-md-1">:</div> <div class="col-md-6"> <label class="switch switch-primary"> <input type="checkbox" id="txt_accredited" <?php if ($row['rt_accredited'] == 1) { echo "checked"; } ?> > <label for="txt_accredited" data-on="YES" data-off="NO"></label> </label> </div> <?php } elseif ($tab == 4) { ?> <div class="col-md-3">Section <font style="color:red">*</font></div> <div class="col-md-1">:</div> <div class="col-md-7"> <label class="field prepend-icon"> <input type="text" id="txt_section" class="gui-input" value="<?php echo $row['rsek_desc']; ?> "> <label for="txt_section" class="field-icon"> <i class="fa fa-edit"></i> </label> </label> </div> <?php } elseif ($tab == 5) { ?> <div class="col-md-3">Section <font style="color:red">*</font></div> <div class="col-md-1">:</div> <div class="col-md-7"> <select id="txt_section" class="form-control"> <option value="0">-- Please Select --</option> <?php $querys = "SELECT * FROM ref_seksyen"; $querys .= " WHERE rsek_rp_kod=3"; $results = selQuery($querys); while ($rows = mysqli_fetch_assoc($results)) { ?> <option value="<?php echo $rows['rsek_kod']; ?> " <?php checkExist($row['ru_rsek_kod'], $rows['rsek_kod']); ?> ><?php echo $rows['rsek_desc']; ?> </option> <?php } ?> </select> </div> <div class="col-md-12"> </div> <div class="col-md-3">Code <font style="color:red">*</font></div> <div class="col-md-1">:</div> <div class="col-md-4"> <label class="field prepend-icon"> <input type="text" id="txt_code" class="gui-input" value="<?php echo $row['ru_short_kod']; ?> "> <label for="txt_code" class="field-icon"> <i class="fa fa-edit"></i> </label> </label> </div> <div class="col-md-12"> </div> <div class="col-md-3">Unit <font style="color:red">*</font></div> <div class="col-md-1">:</div> <div class="col-md-7"> <label class="field prepend-icon"> <input type="text" id="txt_unit" class="gui-input" value="<?php echo $row['ru_desc']; ?> "> <label for="txt_unit" class="field-icon"> <i class="fa fa-edit"></i> </label> </label> </div> <?php } ?> <div class="col-md-12"> </div> <div class="col-md-3">Active</div> <div class="col-md-1">:</div> <div class="col-md-6"> <label class="switch switch-primary"> <input type="checkbox" id="txt_active" <?php if ($row['active'] == 1) { echo "checked"; } ?> > <label for="txt_active" data-on="YES" data-off="NO"></label> </label> </div> <div class="col-md-12"> </div> <div class="col-md-12"><font style="color:red">*</font> required field</div> </div> </div> <?php }
$client = new Client(107700, 'QZ51sMdTQode'); $record = $client->city($ip); //echo $record->city->name . "\n"; // 'Yekaterinburg' */ $geiop = CAltasibGeoBase::GetAddres(); //var_dump($geiop['CITY_NAME']); ?> <div data-city='<?php echo $geiop['CITY_NAME']; ?> '></div><?php if ($USER->IsAuthorized()) { // && ($geiop['CITY_NAME'] == CITY_NAME || $USER->IsAdmin())) { ?> <div class="contest contest--demo contest--active <?php echo checkExist($USER->GetID(), $USER->GetEmail()) ? "contest--locked" : ""; ?> "> <div class="contest__header"> <span>*ю_концепт</span> <?php /* $APPLICATION->IncludeComponent( "bitrix:main.share", "myqube_uconcept", array( "COMPONENT_TEMPLATE" => "myqube_uconcept", "HIDE" => "N", "HANDLERS" => array( 0 => "facebook", 1 => "vk",
echo '<table class="table danger"><tr><td><h2 class="text-center">This page is not exist or permission deny. </h2></td></tr></table>'; } } else { $state = getActState($DBmain, $_GET['act']); $max = $row['voteLimit']; $dept = $row['deptID']; $rslt = $DBmain->query("SELECT * FROM `vote` WHERE `user` = '{$_SESSION['loginID']}' AND `actID` = {$_GET['act']}; "); $hasVote = false; if ($rslt->num_rows > 0) { alert('您已經投過票囉!'); $hasVote = true; } $canVote = false; $isAdmin = false; if (isset($_SESSION['loginID'])) { if (checkExist($DBmain, $_SESSION['loginID'], $_SESSION['loginToken'])) { if ($state == 3) { $canVote = true; } } if (checkAdmin($DBmain, $_SESSION['loginID'])) { $isAdmin = true; } } if ($canVote && !$hasVote) { alert('每人最多 ' . $max . ' 票,請不要多投喔!'); } ?> <form method="post" action="process.php?act=<?php echo $_GET['act']; ?>
} else { $sql = "insert into canteen_grade values({$_POST['user_id']},{$_POST['canteen_id']},{$_POST['grade']});"; } } else { echo getJsonResponse(2, "grade参数错误", null); exit; } } else { echo getJsonResponse(2, "post参数没有设置或错误", null); exit; } } else { if ($_GET['for'] == "food") { if (isset($_POST['user_id']) && isset($_POST['canteen_id']) && isset($_POST['food_id']) && isset($_POST['grade'])) { if ($_POST['grade'] >= 0 && $_POST['grade'] <= 5) { if (checkExist($db, 'food')) { $sql = "update food_grade set grade={$_POST['grade']} where user_id={$_POST['user_id']} and canteen_id={$_POST['canteen_id']} and food_id={$_POST['food_id']};"; } else { $sql = "insert into food_grade values({$_POST['user_id']},{$_POST['canteen_id']},{$_POST['food_id']},{$_POST['grade']},null);"; } } else { echo getJsonResponse(2, "grade参数错误", null); exit; } } else { echo getJsonResponse(2, "post参数没有设置或错误", null); exit; } } else { echo getJsonResponse(2, "url for参数设置错误", null); exit;
} function checkExist() { global $mysqli; global $email; $stmt = $mysqli->prepare("SELECT Email FROM User WHERE Email = ?"); $stmt->bind_param('s', $email); $stmt->execute(); if ($stmt->fetch()) { $stmt->close(); return true; } $stmt->close(); return false; } if (!checkExist()) { $stmt = $mysqli->prepare("INSERT INTO User(Email,Password,Name) VALUES (?,?,?)"); if (!$stmt) { echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error; } $stmt->bind_param("sss", $email, $password, $username); // execute the statement $stmt->execute(); $stmt->close(); echo $username . ', your registration is successful! <br>'; echo 'Continue to the <a href="../login.html">LOGIN</a> page. '; } else { echo 'Sorry, the email already exist!'; echo '<a href="../login.html">Try Again</a> '; } $mysqli->close();
include_once 'connect.php'; $key = $_COOKIE['key']; $res = mysql_query("SELECT * FROM `session` WHERE `key`='{$key}' ORDER BY id"); if (mysql_num_rows($res) > 0) { while ($row = mysql_fetch_array($res)) { $iduser = $row['iduser']; } $res_d = mysql_query("SELECT * FROM `devices` WHERE `imei`=865790010425429 ORDER BY id"); if (mysql_num_rows($res_d) > 0) { $usersIds = []; while ($row = mysql_fetch_array($res_d)) { array_push($usersIds, $row['iduser']); $iduser_d = $row['iduser']; } //if ($iduser_d == $iduser) { if (checkExist($usersIds, $iduser)) { //echo 'EXIST_CURRENT'; echo json_encode(getTrack($imei, $from, $to)); } else { echo 'EXIST_OTHER'; return null; } } } function checkExist($array, $id) { for ($i = 0; $i < count($array); $i++) { if ($array[$i] == $id) { return true; } }
exit; } if (!$db->startTransaction()) { //transiton echo getJsonResponse(1, "事务启动失败", null); $db->close(); exit; } $foodname = stringToDb($_POST['foodname']); $flag = 0; //是否为新的食物 $foodid = checkFoodname($db, $foodname, $flag); //得到对应id //检查是否存在或者已被推荐给食堂 if ($flag) { checkExist($db, $foodid); } $imageurl = "http://" . getServerIp() . "/uploads/recommendedfood/default.jpg"; //上传食物图片 if (isset($_FILES['imageurl'])) { //上传文件 $config1 = array('maxSize' => 2100000, 'allowExts' => array('png', 'jpg'), 'allowTypes' => array('image/png', 'image/jpeg'), 'savePath' => '../uploads/recommendedfood/'); $up = new UploadFile($config1); $res1 = $up->uploadOne($_FILES['imageurl']); if ($res1 !== false) { $savePath = 'http://' . getServerIp() . '/uploads/recommendedfood/' . $res1['savename']; $imageurl = stringToDb($savePath); } else { //上传图片失败 echo getJsonResponse(5, $uf->errorMsg, null); $db->rollback();