<?php include_once './DBAccess.php'; $method = $_GET['method']; if ($method = 'star-game') { $fired = false; //Get the actual constellation to guess $conResult = DBAccess::getAllConstellationPresent(); $rows = count($conResult, 0); $randomNumber = mt_rand(0, $rows - 1); //$randomNumber = $randomNumber * date('s'); //$randomNumber = $randomNumber % ($rows - 1); $StarPairResult = DBAccess::getStarPairs($conResult[$randomNumber]['ConstellationID']); $starRows = count($StarPairResult, 0); $randomPairNo = mt_rand(0, $starRows - 1); $total = $starRows - 1; $pictureReal = DBAccess::getPictureByPictureID($StarPairResult[$randomPairNo]['StarPictureID'], NULL); $pictureLine = DBAccess::getPictureByPictureID($StarPairResult[$randomPairNo]['LinePictureID'], TRUE); $targetConID = $conResult[$randomNumber]['ConstellationID']; //Constellation Target $starID = $StarPairResult[$randomPairNo]['StarPictureID']; $hash = sha1($targetConID); $correctAnswer = ""; //Image Details echo $pictureReal[0]['PictureImage'] . ","; echo $conResult[$randomNumber]['ConstellationCartoon'] . ","; $description = $conResult[$randomNumber]['ConstellationDescription'] . ","; $name = $conResult[$randomNumber]['ConstellationName']; echo $hash . ", "; $correctAnswer .= $name . ","; $correctAnswer .= $targetConID . ",";