header("Content-Type: text/html"); if (isset($_GET)) { $errMsgs = array(); $email = ""; if (isset($_GET['email']) && trim($_GET['email'], " ") != "") { if (filter_var($_GET['email'], FILTER_VALIDATE_EMAIL) !== false) { $email = $_GET['email']; } else { array_push($errMsgs, "Invalid Email Address"); } } else { array_push($errMsgs, "Email Address Empty"); } if (count($errMsgs) <= 0) { $result = getUserInfo($email, $errMsgs); if ($result['success']) { showHtml($result); } else { generateErrorHtml($errMsgs); showResultHtml("Error", generateErrorHtml($errMsgs), true); } } else { showResultHtml("Error", generateErrorHtml($errMsgs), true); } } function showHtml($userInfo) { $test = getTreeArray(generateTreeJson($userInfo)); $html = "<head><title>View - Big Yaad Tree</title><meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'><link rel=\"stylesheet\" href=\"css/reset.css\"><link rel=\"shortcut icon\" href=\"img/favicon.ico\" type=\"image/x-icon\">\n <link rel=\"icon\" href=\"img/favicon.ico\" type=\"image/x-icon\"><script src=\"js/go.js\"></script><script id='code' src='js/tree.js'></script>\n <link rel='stylesheet prefetch' href='css/font-awesome.min.css'><link rel=\"stylesheet\" href=\"css/style.css\"><link rel=\"stylesheet\" href=\"css/animate.css\"></head><header>\n <div class=\"animated fadeIn\">\n <div class=\"nav\">\n <ul>\n <li class=\"logo\"><img class=\"animated lightSpeedIn\" src=\"img/logo.png\" style='height: 40px'></li>\n <li class=\"home\"><a href=\"index.php\">HOME</a></li>\n <li class=\"searchMenu\"><a class=\"active\" href=\"search.php\">SEARCH</a></li>\n </ul>\n </div></div>" . "<body onload=init('" . $test . "');>" . userDetailsHtml($userInfo) . "<div id=\"myDiagram\"></div>" . "</body>"; echo $html; }
} else { $htmlStr .= "<div class='animated zoomInUp'><div class='successFilterLbl' style='margin-top: 0; text-align: center'>SEARCH - {$keyword}</div>"; $htmlStr .= "<label><div class='filterLbl' style='text-align: center'>FILTER - {$fullOptions}</div></label><br><br><br>"; $htmlStr .= $searchHtml . "</div>"; $_SESSION['searchFilter'] = $option; $_SESSION['searchValue'] = $keyword; $_SESSION['htmlResult'] = $htmlStr; header("Location: search.php"); exit; } } else { $htmlStr .= generateErrorHtml($errMsgs); } } } showResultHtml($pageTitle, $htmlStr, true); function createSearchTable($searchedArray, &$errMsgs, $sort, $sortBy, $keyword, $opt) { $htmlStr = ""; $fNameCaret = "fa-caret-up"; $lNameCaret = "fa-caret-up"; if ($sort === "ASC" && $sortBy === 'FNAME') { $fNameCaret = "fa-caret-down"; } else { if ($sort === "ASC" && $sortBy === 'LNAME') { $lNameCaret = "fa-caret-down"; } } if (count($searchedArray) > 0) { $htmlStr .= "<table style='max-width: 640px'>"; $htmlStr .= "<tr class='tableHeader'><td>EMAIL</td><td id='fNameSort' onclick='searchNameSort(\"{$sort}\" , \"FNAME\", \"prc_search.php?uSearch={$keyword}&uOptions={$opt}\")'>FIRST NAME" . getSpaces(2) . "<i class='fa {$fNameCaret}'></i></td><td id='lNameSort' onclick='searchNameSort(\"{$sort}\" , \"LNAME\", \"prc_search.php?uSearch={$keyword}&uOptions={$opt}\")'>LAST NAME" . getSpaces(2) . "<i class='fa {$lNameCaret}'></i></td></tr>";
} break; } closeDatabase($conn); } if (count($errMsgs) > 0) { $htmlStr .= generateErrorHtml($errMsgs); } else { $htmlStr .= "<script> goodSweet('SIGN UP SUCCESS', '') </script><div class='successLbl'>SIGN UP SUCCESS</div>"; $htmlStr .= getTableLabelData($labelArr, $dataArr); $htmlStr .= "<a href='../../index.php'><button>LOGIN</button></a>"; } } } function middleOrAlias($conn, $procName, $email, $nameArray, &$errMsgs) { if (count($nameArray) > 0) { $stmt = $conn->prepare("call {$procName}(?, ?)"); for ($r = 0; $r < count($nameArray); $r++) { $stmt->bind_param("ss", $email, $nameArray[$r]); $stmt->execute(); } if (check_error($stmt->errno, $stmt->error, $errMsgs)) { return false; } $stmt->close(); } return true; } showResultHtml($pageTitle, $htmlStr);