function findData($table = null, $args = null) { global $mysqlConn; if (!is_null($table)) { $tableAr = array(); $query = ""; foreach ($table as $tableName) { $query = "SELECT * FROM " . $tableName; if (isset($_GET["qid"])) { $quesId = $_GET["qid"]; $query .= " WHERE questionid=" . $quesId; } $result = ""; $rows = []; if ($result = $mysqlConn->query($query)) { /* fetch object array */ while ($row = $result->fetch_array(MYSQLI_ASSOC)) { $rows[] = $row; } /* free result set */ $result->close(); } $tableAr[$tableName] = $rows; } return $tableAr; } closeConn(); }
function insertABCChecklist($obj) { global $conn; $timestamp = date('Y-m-d H:i:s', strtotime($obj->when)); $sql = "INSERT INTO abc_checklist (dateOfEvent, antecedent, duration, intensity, antecedentOther, peopleOther, behaviorOther, consequenceOther, location)\n\tVALUES ('{$timestamp}', '{$obj->antecedent}', '{$obj->duration}', '{$obj->intensity}', '{$obj->antecedentOther}', '{$obj->peopleOther}', '{$obj->behaviorOther}', '{$obj->consequenceOther}', '{$obj->location}')"; if ($conn->query($sql) === TRUE) { $last_id = $conn->insert_id; // echo "New record created successfully. Last inserted ID is: " . $last_id . "<br>"; return $last_id; } else { echo "Error: " . $sql . "<br>" . $conn->error; closeConn(); die; } }
exit; } $sql = "select type from UsersTb where id='" . $self . "' and pwd='" . $selfPwd . "';"; $rs = query($db, $sql); if (count($rs) == 0) { echo makeJsonRs(false, "重置密码失败,当前账户不存在"); closeConn($db); exit; } $sql = "select type from UsersTb where id='" . $uid . "';"; $rs1 = query($db, $sql); if (count($rs1) == 0) { echo makeJsonRs(false, "重置密码失败,用户不存在"); closeConn($db); exit; } else { if ($rs1[0][0] <= $rs[0][0] || !Tools::canModifyPwd($rs[0][0])) { echo makeJsonRs(false, "重置密码失败,权限不足"); closeConn($db); exit; } } $sql = "update UsersTb set pwd='21218cca77804d2ba1922c33e0151105' where id='{$uid}'"; $rs = execute($db, $sql); if ($rs == 1) { echo makeJsonRs(true, "重置密码成功"); } else { echo makeJsonRs(false, "重置密码失败"); } closeConn($db);
$email = $_POST["email"]; $phone = $_POST["phone"]; $pword = $_POST["pword"]; $cpword = $_POST["cpword"]; if ($pword != $cpword) { echo '<font color = "red">Passwords do not match</font><br>'; } $link = connectDatabase(); $check = checkNewUser($email, $link); if (FALSE == $check) { $flag = addNewUser($first_name, $last_name, $email, $phone, $pword, $link); if (FALSE == $flag) { echo '<font color = "red">Oops techie issues !!</font><br>'; } else { echo "<script type='text/javascript'>alert('User " . $email . " was created successfully.');</script>"; closeConn($link); } } else { echo "<script type='text/javascript'>alert('User " . $email . " already registered.');</script>"; } } } } } } } } if ("" != $nameErr) { echo '<font color = "red">' . $nameErr . '</font><br>'; } }
$q = mysql_query($sql); $player2_count = mysql_num_rows($q); if ($player1_count + $player2_count == 9) { if ($player1_count < 5) { echo 'You Lose!'; } else { echo 'You Win!'; } } #-- Win condition if board fills up --# #-- Win condition if players use all the cards--# $sql = "select * from tblplayer_card where used = \"DEAD\" or \"ON BOARD\""; $q = mysql_query($sql); $card_count = mysql_num_rows($q); if ($card_count == 50) { if ($player1_count > $player2_count) { echo 'You Win!'; } if ($player1_count == $player2_count) { echo 'draw'; } else { echo 'You Lose!'; } } #-- Wind codition if players use all the cards--# closeConn(); ?> </div> </div> </body>