function loginCallback($username, $a) { $from = "*****@*****.**"; $to = "*****@*****.**"; $subject = "Rack Login"; $body = "Hi,\n\nLogin successful"; $host = "smtpout.secureserver.net"; $username = "******"; $password = '******'; $headers = array('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); redirectHome(); }
<?php //Connect to database include "dbaction/titanconnect.php"; $username = '******'; if (!$username) { redirectHome(); } $query = "{call dbo.SelectUserPermissions(?)}"; $params = array(array($username, SQLSRV_PARAM_IN)); $stmt = sqlsrv_query($conn, $query, $params); if ($stmt === false) { sqlsrv_close($conn); redirectHome(); } $result = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC); if ($result["Permission"] != 1) { redirectHome(); } sqlsrv_free_stmt($stmt); sqlsrv_close($conn); function redirectHome() { header('Location: index.php'); }
function edit_profile($ObjectPDO) { // TODO - Mak sure that a user input is filtered. // If User isn't signed in, go back to home page if (!userSignedIn()) { redirectHome(); die("You should not be here"); } // If the user is not an admin if (userSignedIn() && !userIsAdmin()) { // If the session ID is not set or empty then redirect the user home if (!isset($_SESSION['id']) || trim($_SESSION['id']) == "") { redirectHome(); } $userId = $_SESSION['id']; $params = array("userId" => $userId); $user = new User($ObjectPDO); $results = $user->get_user_details($params); //Convert created at time to mm/dd/yy format $updated_at_date = DateTime::createFromFormat('Y-m-d H:m:s', $results['updated_at']); $results['updated_at'] = $updated_at_date->format("m/d/Y"); return $results; } // If the user is an Admin if (userSignedIn() && userIsAdmin()) { if (!isset($_GET['userId']) || trim($_GET['userId'] == "")) { redirectHome(); } $user = new User($ObjectPDO); // Uses $_GET variable to show the user $results = $user->get_user_details($_GET); // Todo - Make this so that you get the count of the results instrad of boolean if (!$results) { redirectHome(); return false; } return $results; } die("edit_profile ran into a critical error. You must be signed in to continue"); }
<img src="images/last.gif" width="16" height="16" alt="Last Page" onclick="sorter.move(1,true)" /> </div> <div id="text">Displaying Page <span id="currentpage"></span> of <span id="pagelimit"></span> </div> </div> <script type="text/javascript" src="js/scriptSort.js"></script> <script type="text/javascript"> var sorter = new TINY.table.sorter("sorter"); sorter.head = "head"; sorter.asc = "asc"; sorter.desc = "desc"; sorter.even = "evenrow"; sorter.odd = "oddrow"; sorter.evensel = "evenselected"; sorter.oddsel = "oddselected"; sorter.paginate = true; sorter.currentid = "currentpage"; sorter.limitid = "pagelimit"; sorter.init("table",1); </script> <script type="text/javascript"> setVarsForm("pageID=profileEdit&userID=<?echo $id;?>&sessionID=<?echo $rowx['id'];?>"); </script><? } else { // echo('<script>redirectHome("Nothing provided Password");</script>'); redirectHome("Nothing provided Password"); } ?> </body> </html>
function edit_course($ObjectPDO) { // TODO - Mak sure that a user input is filtered. // If User isn't signed in, go back to home page if (!userSignedIn()) { redirectHome(); die("You should not be here"); } // If the user is not an admin then take them back home. // A normal user should not be able to see this page. if (userSignedIn() && !userIsAdmin()) { redirectHome(); } // If the user is sign in and is an admin if (userSignedIn() && userIsAdmin()) { if (!isset($_GET['courseId']) || trim($_GET['courseId'] == "")) { // Should redirect back to the course edit page; redirectHome(); } $course = new Course($ObjectPDO); // Uses $_GET variable to show the course details $results = $course->get_class_details($_GET['courseId']); // Todo - get a cournt of result instead of whether there is something in ther or not. if (!$results) { redirectHome(); return false; } // Make each array item HTML safe; $results = makeArrayHtmlSafe($results); return $results; } die("edit_profile ran into a critical error. You must be signed in to continue"); }