public function importCSV($course_code, $course_dep, $filename)
 {
     if (!loggedIn() || privilege() == NULL || privilege() == 'admin') {
         return 0;
     }
     $file = fopen($filename, "r");
     $count = 0;
     while (($data = fgetcsv($file, 10000, ",")) !== FALSE) {
         $count++;
         if ($count > 1) {
             $save = $this->newEntry($data[0], $course_code, $course_dep, $data[1], $data[2]);
         }
     }
     fclose($file);
     return 1;
 }
 function __construct()
 {
     if (loggedIn()) {
         new MenuItem(array("name" => "reportThis", "label" => "<i class='icon ion-flag'></i>", "menu" => "header_right", "title" => "Report This", "page" => "reportThis?p=" . currentURL()));
     }
     new Admintab("reported_content");
 }
 public function __construct()
 {
     new Accesshandler("friends");
     if (loggedIn()) {
         new MenuItem(array("name" => "friends", "label" => translate("friends"), "page" => "friends", "menu" => "my_account", "weight" => 50));
         new MenuItem(array("name" => "friend_requests", "label" => translate("friend_requests"), "page" => "Friendrequests", "menu" => "my_account", "weight" => 100));
         new Usersetting(array("name" => "notify_when_friend_request_sent", "field_type" => "dropdown", "options" => array("email" => "Email", "site" => "Site", "both" => "Both", "none" => "None"), "tab" => "notifications", "default_value" => "both"));
         new Usersetting(array("name" => "notify_when_friend_request", "field_type" => "dropdown", "options" => array("email" => "Email", "site" => "Site", "both" => "Both", "none" => "None"), "tab" => "notifications", "default_value" => "both"));
         if (currentPage() == "profile" && pageArray(1)) {
             if (pageArray(1) != getLoggedInUserGuid()) {
                 if (!FriendsPlugin::requestSent(getLoggedInUserGuid(), pageArray(1))) {
                     if (!FriendsPlugin::friends(pageArray(1), getLoggedInUserGuid())) {
                         new MenuItem(array("name" => "add_friend", "label" => translate("add_friend"), "page" => addTokenToURL("action/addFriend/" . pageArray(1)), "menu" => "profile", "weight" => 10, "link_class" => "list-group-item list-group-item-info confirm"));
                     } else {
                         new MenuItem(array("name" => "remove_friend", "label" => translate("remove_friend"), "page" => addTokenToURL("action/removeFriend/" . pageArray(1)), "menu" => "profile", "weight" => 10, "link_class" => "list-group-item list-group-item-warning confirm"));
                     }
                 } else {
                     new MenuItem(array("name" => "friend_request_sent", "label" => translate("friendship_requested"), "page" => "friend", "menu" => "profile", "weight" => 20, "link_class" => "list-group-item confirm"));
                 }
             }
         }
     }
     new ViewExtension("profile/left", "friends/profile", "after");
     new ViewExtension('pages/home_stats', 'pages/friend_stats');
     new ViewExtension("user/buttons", "friends/friend_button");
 }
 public function init($file)
 {
     if (!loggedIn()) {
         return false;
     }
     if (!is_a($file, "SocialApparatus\\File")) {
         return false;
     }
     $product = getEntity($file->container_guid);
     if (!is_a($product, "SocialApparatus\\Product")) {
         return false;
     }
     $user = getLoggedInUser();
     if ($user->stripe_cust) {
         \Stripe\Stripe::setApiKey(EcommercePlugin::secretKey());
         $orders = \Stripe\Order::all(array("limit" => 300, "customer" => $user->stripe_cust));
         foreach ($orders['data'] as $order) {
             foreach ($order->items as $item) {
                 if ($item->description != "Taxes (included)" && $item->description != "Free shipping") {
                     $sku = $item->parent;
                     if ($sku == $product->stripe_sku) {
                         return true;
                     }
                 }
             }
         }
     }
     return false;
 }
 public function init()
 {
     if (loggedIn()) {
         return true;
     }
     return false;
 }
function requireLogin()
{
    // prevents unauthorised access to the registered users pages...called on the controllers for these pages...
    if (!loggedIn()) {
        header('Location: ?page=redirect');
    }
}
 public function __construct()
 {
     $title = $body = $button = NULL;
     switch (pageArray(1)) {
         case "all":
         default:
             if (loggedIn()) {
                 $admin_groups = Setting::get("admin_groups");
                 if (!$admin_groups) {
                     $admin_groups = "users";
                 }
                 if ($admin_groups == "admin" && adminLoggedIn() || $admin_groups == "user") {
                     $button = "<a href='" . getSiteURL() . "groups/create' class='btn btn-success'>Create a Group</a>";
                 }
             }
             $title = "Groups";
             $body = display("pages/groups");
             break;
         case "create":
             $admin_groups = Setting::get("admin_groups");
             if (!$admin_groups) {
                 $admin_groups = "user";
             }
             if ($admin_groups == "admin" && adminLoggedIn() || $admin_groups == "user") {
                 $title = "Create a Group";
                 $body = drawForm(array("name" => "create_group", "action" => "createGroup", "method" => "post", "files" => true));
             }
             break;
         case "view":
             $guid = pageArray(2);
             $group = getEntity($guid);
             $edit_url = getSiteURL() . "groups/edit/{$guid}";
             $delete_url = addTokenToURL(getSiteURL() . "action/deleteGroup/{$guid}");
             if ($group->ownerIsLoggedIn()) {
                 $button = "<a href='{$edit_url}' class='btn btn-warning'>Edit Group</a>";
                 $button .= "<a href='{$delete_url}' class='btn btn-danger confirm'>Delete Group</a>";
             }
             if (GroupsPlugin::loggedInUserCanJoin($group)) {
                 $join_group_url = addTokenToURL(getSiteURL() . "action/JoinGroup/" . $group->guid);
                 $button .= "<a href='{$join_group_url}' class='btn btn-success confirm'>Join Group</a>";
             }
             if ($group->loggedInUserIsMember() && $group->owner_guid != getLoggedInUserGuid()) {
                 $leave_group_url = addTokenToURL(getSiteURL() . "action/LeaveGroup/" . $group->guid);
                 $button .= "<a href='{$leave_group_url}' class='btn btn-danger confirm'>Leave Group</a>";
             }
             $title = $group->title;
             $body = display("pages/group");
             break;
         case "edit":
             $guid = pageArray(2);
             $group = getEntity($guid);
             $title = "Edit " . $group->title;
             $body = drawForm(array("name" => "edit_group", "action" => "editGroup", "method" => "post", "files" => true));
             break;
     }
     $this->html = drawPage(array("header" => $title, "body" => $body, "button" => $button));
 }
 public function __construct()
 {
     $title = $body = $buttons = $breadcrumbs = NULL;
     switch (pageArray(1)) {
         default:
             $body = display("pages/forum");
             $title = "Forum Categories";
             if (adminLoggedIn()) {
                 $add_category_url = getSiteURL() . "forum/add_category";
                 $buttons = "<a href='{$add_category_url}' class='btn btn-danger'>Add a Category</a>";
             }
             $breadcrumbs = array(array("link" => getSiteURL() . "forum", "label" => "Categories"));
             break;
         case 'add_category':
             adminGateKeeper();
             $body = drawForm(array("name" => "add_category", "method" => "post", "action" => "addCategory"));
             $title = "Add a Forum Category";
             break;
         case 'category':
             $guid = pageArray(2);
             if ($guid) {
                 $category = getEntity($guid);
                 $body = display("forum/category");
                 if (loggedIn()) {
                     $add_topic_url = getSiteURL() . "forum/add_topic/{$guid}";
                     $buttons = "<a href='{$add_topic_url}' class='btn btn-success'>Add Topic</a>";
                 }
             }
             $breadcrumbs = array(array("link" => getSiteURL() . "forum", "label" => "Categories"), array("link" => getSiteURL() . "forum/category/" . $category->guid, "label" => $category->title));
             break;
         case "add_topic":
             gateKeeper();
             $category_guid = pageArray(2);
             $category = getEntity($category_guid);
             $body = drawForm(array("name" => "add_topic", "method" => "post", "action" => "addTopic"));
             $title = "Add a topic to {$category->title}";
             break;
         case "topic":
             $topic = getEntity(pageArray(2));
             $category = getEntity($topic->container_guid);
             $breadcrumbs = array(array("link" => getSiteURL() . "forum", "label" => "Categories"), array("link" => getSiteURL() . "forum/category/" . $category->guid, "label" => $category->title), array("link" => getSiteURL() . "forum/topic/" . $topic->guid, "label" => $topic->title));
             $body = display("forum/topic");
             break;
         case "editCategory":
             adminGateKeeper();
             $title = "Edit Forum Category";
             $body = drawForm(array("name" => "edit_category", "method" => "post", "action" => "editCategory'"));
             break;
         case "editTopic":
             adminGateKeeper();
             $title = "Edit Forum Topic";
             $body = drawForm(array("name" => "edit_topic", "method" => "post", "action" => "editTopic"));
             break;
     }
     $this->html = drawPage(array("header" => $title, "body" => $body, "button" => $buttons, "breadcrumbs" => $breadcrumbs));
 }
 public function __construct()
 {
     new CSS("files", getSitePath() . "core_plugins/files/assets/css/files.css", 600);
     new FooterJS("files", getSiteURL() . "core_plugins/files/assets/js/files.js", 600, true);
     if (loggedIn()) {
         new StorageType("File", "path", "text");
         new StorageType("File", "description", "text");
         new StorageType("File", "filename", "text");
         new StorageType("File", "file_location", "text");
     }
 }
Beispiel #10
0
 public function __construct()
 {
     parent::__construct();
     $this->load->helper('form');
     $this->load->library('form_validation');
     $this->load->library('hash');
     $this->load->library('email');
     $this->load->library('random');
     if (!loggedIn()) {
         return redirect('home');
     }
 }
 function __construct()
 {
     if (loggedIn()) {
         $count = self::countUnread();
         new MenuItem(array("name" => "messages", "page" => "messages", "label" => "Messages <span class='badge'>{$count}</span> ", "menu" => "my_account", "weight" => 100));
     }
     new CSS("messages", getSitePath() . "core_plugins/messages/assets/css/style.css", 400000);
     new FooterJS("messages", getSiteURL() . "core_plugins/messages/assets/js/messages.js", 5000, true);
     new StorageType("MessageElement", "subject", "text");
     new StorageType("MessageElement", "message", "text");
     new StorageType("Message", "subject", "text");
     new Usersetting(array("name" => "notify_when_message", "field_type" => "dropdown", "options" => array("email" => "Email", "site" => "Site", "both" => "Both", "none" => "None"), "tab" => "notifications", "default_value" => "both"));
 }
 public function __construct()
 {
     if (loggedIn()) {
         new MenuItem(array("name" => "profile", "label" => "My Profile", "page" => "profile/" . getLoggedInUserGuid(), "menu" => "my_account", "weight" => 0));
         if (currentPage() == "profile" && pageArray(1) == getLoggedInUserGuid()) {
             new MenuItem(array("name" => "edit_profile", "label" => "Edit Profile", "menu" => "profile", "page" => "editProfile", "list_class" => "active", "link_class" => "list-group-item list-group-item-danger"));
         } elseif (currentPage() == "home" && loggedIn()) {
             new MenuItem(array("name" => "view_my_profile", "label" => "View My Profile", "menu" => "profile", "page" => "profile/" . getLoggedInUserGuid(), "weight" => 10));
             new MenuItem(array("name" => "edit_profile", "label" => "Edit My Profile", "menu" => "profile", "page" => "editProfile", "link_class" => "list-group-item", "weight" => 20));
             if (isEnabledPlugin("members")) {
                 new MenuItem(array("name" => "members", "label" => "Browse Members", "menu" => "profile", "page" => "members", "weight" => 30));
             }
             if (isEnabledPlugin("inviteFriends")) {
                 new MenuItem(array("name" => "invite_friends", "label" => translate("invite_your_friends"), "menu" => "profile", "page" => "members", "weight" => 40));
             }
         }
         if (currentPage() == "profile" && adminLoggedIn()) {
             if (adminLoggedIn()) {
                 $guid = pageArray(1);
                 $user = getEntity($guid);
                 if (is_a($user, "SocialApparatus\\User")) {
                     if (!isAdmin($user)) {
                         new MenuItem(array("name" => "delete", "label" => "Delete User", "page" => "action/deleteUser/{$guid}", "menu" => "profile", "weight" => 100000, "list_class" => "active", "link_class" => "list-group-item list-group-item-danger confirm"));
                         new MenuItem(array("name" => "login_as", "label" => "Login As", "page" => "action/loginas/{$guid}", "menu" => "profile", "weight" => 90000, "list_class" => "active", "link_class" => "list-group-item list-group-item-danger confirm"));
                         if ($user->banned == "true") {
                             new MenuItem(array("name" => "unban", "label" => "Unban", "page" => "action/unbanUser/{$guid}", "menu" => "profile", "weight" => 80000, "list_class" => "active", "link_class" => "list-group-item list-group-item-danger confirm"));
                         } else {
                             new MenuItem(array("name" => "ban", "label" => "Ban", "page" => "action/banUser/{$guid}", "menu" => "profile", "weight" => 80000, "list_class" => "active", "link_class" => "list-group-item list-group-item-danger confirm"));
                         }
                     }
                 }
             }
         }
     }
     if (currentPage() == "profile") {
         new CSS("profile", getSitePath() . "core_plugins/profile/assets/css/profile.css");
         new FooterJS('profile', getSiteURL() . 'core_plugins/profile/assets/js/profile.js', 900, true);
     }
     if (currentPage() == "admin") {
         new ViewExtension("admin/tabs", "admin_tabs/profile_fields");
     }
     new ProfileField("first_name", "First Name", "text", false, false, "form-control", "default", 10);
     new ProfileField("last_name", "Last Name", "text", false, false, "form-control", "default", 20);
     new ProfileField("gender", "Gender", "dropdown", array("Male" => "Male", "Female" => "Female"));
     new ProfileField("birthday", "Birthday", "date");
     new ProfileField("about", "About Me", "textarea");
     new ProfileField("hobbies", "Hobbies", "tags");
     new StorageType("User", "about", "text");
     new ViewExtension("profile/right", "profile/activity");
 }
Beispiel #13
0
 public function __construct()
 {
     global $database;
     $this->competitions = $database->getAllCompetitions();
     $this->pages = $database->getAllPages();
     if (loggedIn()) {
         $this->userGroups = $database->getUserGroups($_SESSION['userID']);
         $this->userGroupNames = array();
         foreach ($this->userGroups as $groupId) {
             $this->userGroupNames[$groupId] = $database->getGroupName($groupId);
         }
         $this->money = $database->getMoney($_SESSION['userID']);
         $user = new \User($_SESSION['userID']);
         $this->score = number_format((double) $user->getScore(), 2, '.', '.');
     }
 }
 function __construct()
 {
     if (loggedIn()) {
         if (currentPage() == "profile") {
             if (isEnabledPlugin("Friends")) {
                 $user_one = pageArray(1);
                 $user_two = getLoggedInUserGuid();
                 if (FriendsPlugin::friends($user_one, $user_two)) {
                     new MenuItem(array("name" => "chat", "menu" => "profile", "label" => "Chat", "page" => "action/CreateChat/" . $user_one, "link_class" => "list-group-item list-group-item-success"));
                 }
             }
         }
     }
     new ViewExtension("page_elements/foot", "chat/chat_boxes");
     new CSS("chat", getSitePath() . "core_plugins/chat/assets/css/chat.css", 400);
     new FooterJS("chat", getSiteURL() . "core_plugins/chat/assets/js/chat.js", 400, true);
     new Usersetting(array("name" => "notify_offline_chat", "field_type" => "dropdown", "options" => array("yes" => "Yes", "no" => "No"), "default_value" => "yes", "tab" => "notifications"));
 }
Beispiel #15
0
 public function login()
 {
     if (loggedIn()) {
         return redirect('home');
     }
     $this->form_validation->set_rules('username', 'Login', 'required|trim|callback_check_username');
     $this->form_validation->set_rules('password', 'Mot de passe', 'required|trim|callback_check_password');
     $this->form_validation->set_message('required', 'Le champ %s est obligatoire');
     if ($this->form_validation->run() == false) {
         $data['NOTOPBAR'] = true;
         $data['NOSIDEBAR'] = true;
         $data['title'] = 'Connexion';
         $this->render('login', $data);
     } else {
         // Start the session and redirect
         $user = $this->user_model->getUserByUsername($this->input->post('username'));
         $sess_array = array('id' => $user->userId, 'username' => $user->username, 'role' => $user->role);
         $this->session->set_userdata('login', $sess_array);
         return redirect('home');
     }
 }
Beispiel #16
0
function get_comments_link($comments_allow, $comments, $id)
{
    global $ft, $rewrite;
    /*
    if ($comments_allow == -1) {
      if (isset($_SESSION) && array_key_exists('loggedIn', $_SESSION) && $_SESSION['loggedIn'] == 1) {
        $comments_allow = 1;
      } else {
        $comments_allow = 0;
      }
    }
    */
    if ($comments_allow == 0) {
        $ft->assign(array('COMMENTS_ALLOW' => false, 'COMMENTS' => ''));
    } else {
        if ($comments_allow == -1) {
            if ($comments > 0) {
                $comments_link = (bool) $rewrite ? '1,' . $id . ',2,item.html' : 'index.php?p=2&amp;id=' . $id . '';
                $ft->assign(array('COMMENTS_LINK' => $comments_link, 'COMMENTS_ALLOW' => true, 'COMMENTS' => $comments));
            } else {
                if (loggedIn()) {
                    $comments_link = (bool) $rewrite ? '1,' . $id . ',3,item.html' : 'index.php?p=3&amp;id=' . $id . '';
                    $ft->assign(array('COMMENTS_LINK' => $comments_link, 'COMMENTS_ALLOW' => true, 'COMMENTS' => ''));
                } else {
                    $ft->assign(array('COMMENTS_ALLOW' => false, 'COMMENTS' => ''));
                }
            }
        } else {
            if ($comments == 0) {
                $comments_link = (bool) $rewrite ? '1,' . $id . ',3,item.html' : 'index.php?p=3&amp;id=' . $id . '';
                $ft->assign(array('COMMENTS_LINK' => $comments_link, 'COMMENTS_ALLOW' => true, 'COMMENTS' => ''));
            } else {
                $comments_link = (bool) $rewrite ? '1,' . $id . ',2,item.html' : 'index.php?p=2&amp;id=' . $id . '';
                $ft->assign(array('COMMENTS_LINK' => $comments_link, 'COMMENTS_ALLOW' => true, 'COMMENTS' => $comments));
            }
        }
    }
}
Beispiel #17
0
function check()
{
    $dmenu = def_menu();
    $menu = array('Home' => array('Home' => ''), 'Account' => array('Rewards' => 'mpayouts', 'Payments' => 'payments', 'Settings' => 'settings', 'User Settings' => 'userset', '2FA Settings' => '2fa'), 'Workers' => array('Shifts' => 'shifts', 'Shift Graph' => 'usperf', 'Workers' => 'workers', 'Management' => 'workmgt'), 'Pool' => array('Stats' => 'stats', 'Blocks' => 'blocks', 'Graph' => 'psperf', 'Acclaim' => 'userinfo', 'Luck' => 'luck'), 'Admin' => NULL, 'gap' => array('API' => 'api', 'PBlocks' => 'pblocks'), 'Help' => array('Payouts' => 'payout'));
    tryLogInOut();
    $who = loggedIn();
    if ($who === false) {
        $p = getparam('k', true);
        if ($p == 'reset') {
            showPage(NULL, 'reset', $dmenu, '', $who);
        } else {
            if (requestLoginRegReset() == true) {
                showPage(NULL, 'reg', $dmenu, '', $who);
            } else {
                $p = getparam('k', true);
                process($p, $who, $dmenu);
            }
        }
    } else {
        $p = getparam('k', true);
        process($p, $who, $menu);
    }
}
Beispiel #18
0
function genUserBar()
{
    if (loggedIn()) {
        ?>
		<!--including script here bad? where should we then?-->
		<script src="js/user.js"></script>
			<div id = "loginDiv">
				<div id = "innerLoginDiv">
					Welcome <?php 
        echo getLoggedInUsername();
        ?>
!
					<button id = 'buttonMyBooks' onClick="document.location.href='mybooks.php'">My Books</button>
					<button id = 'buttonLogout' onclick = "logout()"> Logout </button>
				</div>
			</div>
	<?php 
    } else {
        ?>
			<!--including script here bad? where should we then?-->
			<script src="js/user.js"></script>
			<!--TODO: build css file for this-->
			<div id = "loginDiv">
				<div id = "innerLoginDiv">
					Username:
					<input id = 'usernameInput' type='text' maxlength='30' value=''/>
					Password:
					<input id = 'passwordInput' type='password' maxlength='30' value=''/>
					<button id = 'buttonLogin' onclick='login()'>  Login </button>
					<form id = "signUpForm" action="signup.php">
    					<input type="submit" value="Sign Up">
					</form>
				</div>
			</div>
		<?php 
    }
}
 static function userCanCreateBlog($user = false)
 {
     if (!loggedIn()) {
         return false;
     }
     if (!$user) {
         $user = getLoggedInUser();
     }
     $setting = Setting::get("who_can_create_blogs");
     if (!$setting) {
         $setting = "everyone";
     }
     switch ($setting) {
         case "everyone":
             return true;
             break;
         case "admin_only":
             if (adminLoggedIn()) {
                 return true;
             }
             break;
     }
     return false;
 }
            $title = $db->f('title');
            $text = $db->f('text');
            $author = $db->f('author');
            if ((bool) $rewrite) {
                $perma_link = sprintf('1,%s,1,item.html', $id);
                $form_link = '1,3,item.html';
            } else {
                $perma_link = 'index.php?p=1&amp;id=' . $id;
                $form_link = 'index.php?p=3&amp;action=add';
            }
            // przypisanie tablicy szablonów::ft
            $ft->assign(array('NEWS_TITLE' => $title, 'NEWS_ID' => $id, 'NEWS_TEXT' => $text, 'NEWS_AUTHOR' => $author, 'QUOTE' => '', 'COMMENT_AUTHOR' => $comment_author, 'STRING' => $page_string, 'PERMA_LINK' => $perma_link, 'FORM_LINK' => $form_link));
        }
        switch ($db->f('comments_allow')) {
            case 0:
                $show_addcomment = false;
                break;
            case 1:
                $show_addcomment = true;
                break;
            case -1:
                $show_addcomment = loggedIn();
                break;
        }
        $ft->assign('SHOW_ADDCOMMENT', $show_addcomment);
        $ft->define('comments_request', 'comments_request.tpl');
        // parsowanie szablonu::ft
        $ft->parse('MAIN', '.comments_request');
        break;
}
$ft->assign(array('STRING' => '', 'PAGINATED' => false, 'MOVE_BACK' => false, 'MOVE_FORWARD' => false));
<?php

require_once "includes/sessions.php";
if (loggedIn()) {
    header("Location: index.php");
    die;
}
// get the User Name and Password
$username = $_POST['username'];
$email = $_POST['email'];
$pwd = $_POST['pwd'];
$pwdC = $_POST['pwdC'];
// start a connection to the mysql server and choose the database
$conn = mysql_connect("127.0.0.1", "test", "test") or die("Connection failed");
$mydb = mysql_select_db("WebSecurity");
// write the required sql query
$sql = "INSERT INTO  Users ( email, username, password) VALUES (\"" . $email . "\", \"" . $username . "\", \"" . $pwd . "\")";
$result = mysql_query($sql);
if ($result) {
    $sql = "SELECT * from Users where email=\"" . $email . "\";";
    $result2 = mysql_query($sql);
    $row = mysql_fetch_array($result2, MYSQL_ASSOC);
    $_SESSION['login'] = "******";
    $_SESSION['username'] = $username;
    $_SESSION['user_id'] = $row["user_id"];
    header("Location : index.php");
} else {
    $_SESSION["alert"] = "Your account could not be created at this time, please try again." . mysql_error();
    header("Location: register.php");
}
mysql_close() or die("Failure while trying to close connection");
<?php

require_once 'core/init.php';
if (!loggedIn()) {
    Redirect::to('logout.php');
} else {
    if (loggedIn() && (privilege() === 'teacher' || privilege() === 'dppc' || privilege() === 'dupc' || privilege() == NULL)) {
        Session::destroy();
        Redirect::to('includes/errors/unauthorized.php');
    }
}
?>
				<section class="content-header">
                    <h1>
                        Departments
                        <small>Create new department</small>
                    </h1>
                    <ol class="breadcrumb">
                        <li><a href="home.php"><i class="fa fa-dashboard"></i> Home</a></li>
                        <li><a href="#">Departments</a></li>
                        <li class="active">Create new department</li>
                    </ol>
                </section>

                <!-- Main content -->
                <section class="content">
                	<div class="col-md-6">
                	<div id="update">
						
					</div>
								<div class="box box-default">
Beispiel #23
0
   <ul class="nav navbar-nav">
                    <!-- Hidden li included to remove active class from about link when scrolled up past about section -->
                    <li class="hidden">
                        <a href="#page-top"></a>
                    </li>
                    <li>
                        <a class="page-scroll" href="index.php#about">About</a>
                    </li>
                    <li>
                        <a class="page-scroll" href="index.php#contact">Contact</a>
                    </li>		
                   <li>
                        <a class="page-scroll" href="notice.php">Notice</a>
                    </li>		
                    <li>
                        <a class="page-scroll" href="rank.php">Rank</a>
                    </li>
                        <?php 
$_SESSION['loggedin'] == True ? print '<li><a class="page-scroll" href="challenge.php">Challenge</a></li><li><a class="page-scroll" href="home.php">Home</a></li>' : (print '');
?>
					
	            	<li><?php 
loggedIn() == True ? print '<a class="page-scroll" href="login.php?action=logout"><span class="glyphicon glyphicon-user"></span>Logout</a>' : (print '<a class="page-scroll" href="login.php"><span class="glyphicon glyphicon-user"></span>Login</a>');
?>
              
                    </li>

                </ul>
Beispiel #24
0
<?php

include_once '../includes/general.php';
include_once '../includes/db.php';
include_once 'access_control.php';
db_connect();
if (isset($_REQUEST['callback'])) {
    $callback = $_REQUEST['callback'];
    // jsonp request
    $jsonp = true;
    header('Content-Type: text/javascript');
} else {
    $callback = false;
    $jsonp = false;
    header('Content-Type: application/json');
}
if (isset($_REQUEST['username']) && isset($_REQUEST['password'])) {
    authenticate($_REQUEST['username'], $_REQUEST['password']);
}
if (loggedIn(false)) {
    $response = '{"userid":"' . $_SESSION['mid'] . '"}';
    if ($jsonp) {
        $response = $_REQUEST['callback'] . '(' . $response . ')';
    }
    echo $response;
} else {
    header('Content-Type: text/html');
    http_response_code(403);
    echo "<h1>Forbidden</h1>";
}
exit;
Beispiel #25
0
function showLoginMenu()
{
    echo "<ul class=\"login\">";
    if (loggedIn()) {
        echo "<li id=username userid=" . $_SESSION['user_id'] . ">Bem-vindo <a href=ver_perfil_utilizador.php?id=" . $_SESSION['user_id'] . ">" . $_SESSION['username'] . "</a></li><li><a href=\"logout.php\">Logout</a></li>";
    } else {
        echo "<li><a href=\"login.php\">Login</a></li>";
    }
    echo "</ul>";
}
Beispiel #26
0
<?php

include_once "../includes/general.php";
include_once "../includes/db.php";
include_once 'access_control.php';
db_connect();
if (!loggedIn(false)) {
    header('Content-Type: text/html');
    http_response_code(403);
    die("<h1>Forbidden</h1>");
}
$error_message = "";
$success_message = "";
$active_tab = "breastfeeding";
$hour = isset($_REQUEST['entryhour']) ? $_REQUEST['entryhour'] : date('g');
$minute = isset($_REQUEST['entryminute']) ? $_REQUEST['entryminute'] : date('i');
$minute -= $minute % 5;
// round down the the closest 5 minute increment.
$ampm = isset($_REQUEST['entryam']) ? $_REQUEST['entryam'] == "01" ? "AM" : "PM" : date('A');
$today = "SELECTED";
$yesterday = "";
if (count($_REQUEST)) {
    $dateString = sprintf("%s %d:%s%d %s", $_REQUEST['which'] == "01" ? "Today" : "Yesterday", $hour, $minute < 10 ? "0" : "", $minute, $ampm);
    $entryDate = date_create($dateString)->format("Y-m-d H:i");
    error_log($dateString);
    error_log($entryDate);
    // =================================== BREASTFEEDING FORM ================================================
    if (@$_REQUEST['breast']) {
        if (!$_REQUEST['duration_left'] && !$_REQUEST['duration_right']) {
            $error_message .= _("Breastfeeding duration must be at least 1 minute.") . "<br />";
        }
function redirectToLogin()
{
    if (!loggedIn()) {
        header("Location: login.php");
    }
}
<?php

include_once "../includes/general.php";
include_once "../includes/constants.php";
include_once "../includes/db.include.php";
loggedIn();
if ($_POST['newpass'] != $_POST['rnewpass']) {
    $_SESSION['ChangePassMessage'] = "Password change failed.";
    $_SESSION['ChangePassDetails'] = "Passwords do not match. Make sure the passwords on both fields match.";
    $_SESSION['ChangePassType'] = 3;
    go("change_pass.php");
} else {
    if (strlen($_POST['newpass']) < 6) {
        $_SESSION['ChangePassMessage'] = "Password change failed.";
        $_SESSION['ChangePassDetails'] = "The password needs to be at least 6 characters long.";
        $_SESSION['ChangePassType'] = 3;
        go("change_pass.php");
    } else {
        db_connect();
        //update
        $query = "UPDATE Mothers SET password = '******'newpass'] . SALT) . "' WHERE  mid = " . $_SESSION['mid'] . ";";
        $result = mysql_query($query);
        $query = "UPDATE Mothers SET loginstep = 0 WHERE mid = " . $_SESSION['mid'] . ";";
        $result = mysql_query($query);
        $_SESSION['ChangePassMessage'] = "Password change successful.";
        $_SESSION['ChangePassDetails'] = "Password has been recorded. Please use this password from now on.";
        $_SESSION['ChangePassType'] = 1;
        go("m.add_entry.php");
    }
}
<?php

include_once 'modules/config.php';
if (!loggedIn()) {
    header('Location: login.php');
    exit;
} else {
    $query = $coll->findOne(array('username' => $_SESSION["username"]));
    if (isset($query['places_business'])) {
        foreach ($query['places_business'] as $obj_business) {
            $result_places = makePlacesAPIRequestBusiness($obj_business['places_id']);
            echo "Business: " . $result_places['result']['name'] . '<br/>';
            echo "Google Places URL: " . $result_places['result']['url'] . '<br/>';
            echo "Rating: " . $result_places['result']['rating'] . '<br/>';
            echo "Review Count: " . count($result_places['result']['reviews']) . '<br/>';
            echo "Most Recent Reviews: " . '<br/>';
            foreach ($result_places['result']['reviews'] as $item) {
                echo date($date_format, $item['time']) . '---' . $item['author_name'] . '---' . $item['aspects']['rating'] . '---' . $item['text'] . '<br/>';
            }
        }
    }
}
<?php

require_once 'core/init.php';
include 'header.php';
if (!loggedIn()) {
    Redirect::to('index.php');
} else {
    if (loggedIn() && !Session::exists('teacher_id')) {
        Session::destroy();
        Redirect::to('includes/errors/unauthorized.php');
    }
}
if (Input::exists()) {
    $validate = new Validate();
    $validation = $validate->check($_POST, array('course_id' => array('required' => true), 'examtype' => array('required' => true), 'category' => array('required' => true)));
    if ($validate->passed()) {
        $input = Input::get('course_id');
        $input = explode(',', Input::get('course_id'));
        $m = new Marks();
        if ($m->exportCSV($input[0], $input[1], Input::get('examtype'), Input::get('category'))) {
            echo '<div class="alert alert-success alert-dismissible" role="alert">';
            echo '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>';
            echo '<strong>Export successful</strong>';
            echo '</div>';
        } else {
            echo '<div class="alert alert-danger alert-dismissible" role="alert">';
            echo '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>';
            echo 'Temporary Error!';
            echo '</div>';
        }
    } else {