/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param signIn $obj A signIn object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool($obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null signInPeer::$instances[$key] = $obj; } }
function signin_netid($netid, $reason_id) { $reason = signInReasonQuery::create()->findPK($reason_id); $beginOfDay = strtotime("midnight", time()); if (!$reason) { return array("error" => true, "message" => "Invalid reason."); } $user = get_user($netid); if (!$user) { return array("error" => true, "message" => "Invalid NetID."); } $signins = signInQuery::create()->filterByCreatedAt(array('min' => $beginOfDay))->filterByUser($user)->find(); $signins = $signins->toArray(); // If the user has signed in already today... if (!empty($signins)) { // Don't let them do it again return array("error" => true, "message" => "You've already signed in today."); } // Otherwise, sign them in. $signinRecord = new signIn(); $signinRecord->setUser($user); $signinRecord->setsignInReason($reason); $signinRecord->save(); return array("error" => false, "message" => "Sign-in successful."); }
/** * @param signIn $signIn The signIn object to add. */ protected function doAddsignIn($signIn) { $this->collsignIns[] = $signIn; $signIn->setsignInReason($this); }
<?php include_once $_SERVER["DOCUMENT_ROOT"] . "/app/controller/access.controller.php"; include_once $_SERVER["DOCUMENT_ROOT"] . "/app/model/sign-in.model.php"; $signIn = new signIn(); $email = $_POST["email"]; $password = $_POST["password"]; $remember = $_POST["remember"]; if (!empty($_POST["facebook"])) { } else { if ($signIn->passwordVerify($email, $password)) { include_once $_SERVER["DOCUMENT_ROOT"] . "/app/model/profile.model.php"; $profile = new Profile(); $_SESSION["id"] = intval($profile->gimme("id", "email", $email)); if ($remember === "on") { $rememberkey = md5(microtime() . rand()); $profile->set("remember", $rememberkey, $_SESSION["id"]); setcookie("remember", $rememberkey, time() + 5184000, "/"); } $_SESSION["debug"] = "blah"; header("Location: /profile/"); } else { if (isset($_POST["response"])) { } else { $_SESSION["status"] = "Sorry! Your login information wasn’t recognized. Please try again."; header("Location: /sign-in"); } } }
/** * Filter the query by a related signIn object * * @param signIn|PropelObjectCollection $signIn the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return UserQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterBysignIn($signIn, $comparison = null) { if ($signIn instanceof signIn) { return $this->addUsingAlias(UserPeer::ID, $signIn->getUserId(), $comparison); } elseif ($signIn instanceof PropelObjectCollection) { return $this->usesignInQuery()->filterByPrimaryKeys($signIn->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterBysignIn() only accepts arguments of type signIn or PropelCollection'); } }
/** * Exclude object from result * * @param signIn $signIn Object to remove from the list of results * * @return signInQuery The current query, for fluid interface */ public function prune($signIn = null) { if ($signIn) { $this->addUsingAlias(signInPeer::ID, $signIn->getId(), Criteria::NOT_EQUAL); } return $this; }
<?php error_reporting(E_ALL); ini_set('display_errors', 'On'); session_start(); include 'class/security.php'; include 'class/db.php'; include 'class/signIn.php'; $logIn = new signIn(); $logIn->logIn($_POST["login"], $_POST["password"]);