function performLogin($credentials, $mysql) { $JSONerror->state = 0; $JSONerror->message = 'Success'; //Connect to MySQL DB $MySQLConnection = new Mysql($mysql['host'], $mysql['port'], $mysql['user'], $mysql['password'], $mysql['database']); $MySQLConnection->connect(); if (verifyCredentials($credentials, $MySQLConnection)) { $userObject = getUserInfo($credentials, $MySQLConnection); if ($userObject->userValid) { sessionInit($userObject, false); echo json_encode($userObject); } else { $JSONerror->state = 1; $JSONerror->message = 'User blocked!'; print_r(json_encode($JSONerror)); } } else { $JSONerror->state = 1; $JSONerror->message = 'Your Password and Username combination does not Match our databse, Sorry'; print_r(json_encode($JSONerror)); } }
<?php /* Project: myAm * By: Adarsh * Started On: 21-Aug-2014 19:07:53 Purpose: * */ //Include the required files and start session include __DIR__ . '/include/outline.php'; include __DIR__ . '/include/user.php'; $user = sessionInit(); /* * Check whether the user updated their status. * If yes, call user::updateStatus function */ if (isset($_POST['updateContent'])) { $user->updateStatus($_POST['updateContent']); if ($user->err) { $afterSubmit = $user->errMessage; } else { $afterSubmit = "Updated, your friends will be able to view your status."; } } //Display the status updates of all friends function displayUpdates($user) { $result = $user->friendUpdates(); if ($result->num_rows < 1) { echo "<h5>No friend updates</h5>"; } else {
<?php require_once "functions.php"; sessionInit(); $mysqli = dbConnect(); error_reporting(E_ALL); ini_set('display_errors', 1); require_once "includes/header.php"; ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> </body> </html> <?php if (isset($_GET['id'])) { $id = $_GET['id']; $name = NULL; $cuisine = NULL; $description = NULL; $ingredients = NULL; $instructions = NULL; $servings = NULL; //Displays the table contents with the WHERE condition if (!($stmt = $mysqli->prepare("SELECT DISTINCT name, cuisine, description, ingredients, instructions, servings FROM recipe\r\n\t\t\tWHERE id='{$id}';"))) { echo 'Prepare failed: (' . $mysqli->errno . ') ' . $mysqli->error;
function installerInit() { sessionInit(); //handle streamed content first if (isset($_SERVER['PATH_INFO'])) { $path_bits = preg_split('/\\//', $_SERVER['PATH_INFO']); $path_bits = cleanPath($path_bits); if (count($path_bits) == 3) { if ($path_bits[0] == "stream") { streamContent($path_bits[2], $path_bits[1]); } } else { redirectSelf(); } } $result = array(); if (installerStep() !== STEP_DONE && getLock()) { installerStepSet(STEP_DONE); redirectSelf(); } $is_redirect = FALSE; if (isset($_GET['restart'])) { session_destroy(); redirectSelf(); } if (isset($_GET['next'])) { transitionNextStep(); } if (isset($_GET['prev'])) { installerStepSet(prevStep(installerStep())); } if (dbEnabled()) { $result['with_db'] = TRUE; } else { $result['with_db'] = FALSE; } $result['step'] = installerStep(); return $result; }
<?php /* Project: myAm Purpose: * Displays the friends page using the friendHandler class * $afterSubmit holds the message to be printed after any user requests */ //Include the required files and start session include __DIR__ . '/include/friendHandler.php'; include __DIR__ . '/include/outline.php'; $fr = sessionInit(TRUE); /*Checks whether the user accepted a friend request * $reqid is the id of the friend request in the friends table */ if (isset($_POST['yes']) && isset($_POST['reqid'])) { $fr->acceptReq($_POST['reqid']); if (!$fr->err) { $afterSubmit = "Friend added"; } else { $afterSubmit = $fr->errMessage; } } else { if (isset($_POST['no']) && isset($_POST['reqid'])) { $fr->rejectReq($_POST['reqid']); if (!$fr->err) { $afterSubmit = "Request rejected."; } else { $afterSubmit = $fr->errMessage; } } else { if (isset($_POST['add']) && isset($_POST['userid'])) {