function process_list_next($con, $uiid) { $sql = "SELECT currcmd, currgroupid, currqueryid, curranswerid FROM bpusers where id=" . $uiid; if (!($result = mysqli_query($con, $sql))) { echo "Error description: " . mysqli_error($con); } $cmd = ""; $groupid = 0; $queryid = 0; $answerid = 0; $responseMessage = ""; if ($row = $result->fetch_assoc()) { $groupid = $row["currgroupid"]; $queryid = $row["currqueryid"]; $answerid = $row["curranswerid"]; $cmd = $row["currcmd"]; if ($cmd == "lq") { $queryid = get_next_queryid($con, $groupid, $queryid); //echo "queryid = [".$queryid."]<br>"; return process_list_queries($con, $uiid, $groupid, $queryid); } else { if ($cmd == "la") { $answerid = get_next_answerid($con, $queryid, $answerid); //echo "queryid = [".$queryid."]<br>"; return process_list_answers($con, $uiid, $queryid, $queryid, $answerid); } else { if ($cmd == "lg") { $groupid = get_next_groupid($con, $groupid); //echo "queryid = [".$queryid."]<br>"; return process_list_groups($con, $uiid, $groupid); } } } } return $responseMessage; }
$con = dbopen(); if ($cmd == "lg") { $responseMessage = process_list_groups($con, $uiid, 0); } else { if ($cmd == "query") { $responseMessage = process_query($con, $uiid, $ref, $content); } else { if ($cmd == "ans") { $responseMessage = process_answer($con, $uiid, $ref, $content); } else { if ($cmd == "lq") { $responseMessage = process_list_queries($con, $uiid, $ref, $content); // ref for groupId, content for queryId } else { if ($cmd == "la") { $responseMessage = process_list_answers($con, $uiid, $ref, $content, 0); } else { if ($cmd == "next") { $responseMessage = process_list_next($con, $uiid); } else { if ($cmd == "fg") { $responseMessage = process_following_group($con, $uiid, $ref); } else { if ($cmd == "fq") { $responseMessage = process_following_query($con, $uiid, $ref); } else { if ($cmd == "cg") { $responseMessage = process_create_group($con, $uiid, $ref, $content); } } }
//echo "\n user_body = " . $user_body . "\n"; if (startsWith($user_body, "lg:")) { $responseMessage = process_group($con); } else { if (startsWith($user_body, "query:")) { $responseMessage = process_query($con, $user_body, $uiid); } else { if (startsWith($user_body, "ans:")) { $responseMessage = process_answer($con, $user_body, $uiid); } else { if (startsWith($user_body, "lq:")) { //echo "---lq\n"; $responseMessage = process_list_queries($con, $user_body, $uiid); } else { if (startsWith($user_body, "la:")) { $responseMessage = process_list_answers($con, $user_body, $uiid); } else { if (startsWith($user_body, "next:")) { $responseMessage = process_list_next($con, $user_body, $uiid); } else { if (startsWith($user_body, "fg:")) { $responseMessage = process_following_group($con, $user_body, $uiid); } else { if (startsWith($user_body, "fq:")) { $responseMessage = process_following_query($con, $user_body, $uiid); } else { if (startsWith($user_body, "create:")) { $groupName = trim(substr($user_body, 7)); $query = "INSERT INTO bpgroups ( `name`, ownerid ) VALUES ('" . $groupName . "','" . $uiid . "' )"; if (!mysqli_query($con, $query)) { //echo("Error description: " . mysqli_error($con));