function showList($q) { include "showProject.php"; //---get user information---// if ($q !== "") { $userid = match("users", "username", "userid", $q); } else { $sessionid = $_SESSION["sessionid"]; $random = $_SESSION["random"]; $query = "SELECT * FROM sessions WHERE sessionid = '{$sessionid}' AND random = '{$random}' "; $recordSet = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($recordSet); $userid = $row["userid"]; } //---get projects---// $arrayProjectids = array(); $query = "SELECT * FROM projects WHERE shoot = '{$userid}' OR video = '{$userid}' OR photo = '{$userid}' OR copy = '{$userid}' "; $recordSet = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($recordSet)) { array_push($arrayProjectids, $row["projectid"]); } //---build return---// $returnArray = array(); foreach ($arrayProjectids as $projectid) { array_push($returnArray, "project:|:|:|:" . showProject($projectid)); } //---return information---// return implode(":|::|::|:", $returnArray); }
<?php include "../universal/config.php"; //---pageType---// if (isset($_POST["showPage"])) { $resultArray = explode(":|:|:|:", pageType($_POST["q"])); $pageType = $resultArray[0]; $match = $resultArray[1]; //---showProfile---// if ($pageType === "profile") { include "showProfile.php"; $result = showProfile($match); echo $pageType . ":|:|:|:" . $result; } elseif ($pageType === "project") { include "showProject.php"; $result = showProject($match); echo $pageType . ":|:|:|:" . $result; } elseif ($pageType === "search") { include "showSearch.php"; $result = showSearch($match); if ($result === "") { echo $pageType; } else { echo $pageType . ":|:|:|:" . $result; } } elseif ($pageType === "home") { echo "home"; } } elseif (isset($_POST["showList"])) { include "showList.php"; if (isset($_POST["q"])) {