Created
September 24, 2010 20:15
-
-
Save walterdavis/595957 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('lib/config.inc.php'); | |
$page_title = $page_header = SITE_NAME; | |
if(isset($_SESSION['flash'])){ | |
$flash = $_SESSION['flash']; | |
unset($_SESSION['flash']); | |
} | |
$out = '<p><a href="?action=login">Log in</a>, or <a href="?action=register">register here</a> to use the members-only features of this site.</p>'; | |
if(isset($_SESSION['current_user'])){ | |
if($_user = ActiveRecord::FindCookie()){ | |
$out = '<p>Welcome, ' . $_user->full_name() . '!</p><p>You can access <a href="listing.php">our library</a> now.</p>'; | |
}else{ | |
header('Location: library.php?action=logout'); | |
exit; | |
} | |
} | |
if(isset($_GET['action']) && in_array($_GET['action'],w('view edit remind register login logout forgot'))){ | |
$action = $_GET['action']; | |
} | |
if(isset($_GET['id']) && !empty($_GET['id']) && ($_user = ActiveRecord::FindById('users',$_GET['id']))){ | |
//yay | |
}else{ | |
$_user = ActiveRecord::Create('users'); | |
} | |
if(isset($action)) $out = '<h2>' . $page_header . '</h2>' . $_user->$action(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment