-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
14 changed files
with
152 additions
and
25 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
<?php | ||
$thisPage="Bills"; | ||
include 'top.php'; ?> | ||
|
||
|
||
<!-- <title>Bills - IDLEG - Idaho Legislative Information Portal, Bills, Lawmakers & Data</title> --> | ||
|
||
<div class="maincontainer"> | ||
|
||
<?php include 'dash.php'; ?> | ||
|
||
|
||
|
||
<?php include 'footer.php'; ?> |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
session_start(); | ||
|
||
if (isset($_SESSION["access_granted"]) && !$_SESSION["access_granted"] || | ||
!isset($_SESSION["access_granted"])) { | ||
$_SESSION["status"] = "You need to log in first"; | ||
header("Location:index.php"); | ||
} | ||
else { | ||
echo "ACCESS GRANTED"; } | ||
?> | ||
|
||
<a href="logout.php">Logout</a> |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,21 @@ | ||
<?php | ||
$thisPage="Lawmakers"; | ||
include 'top.php'; ?> | ||
|
||
|
||
<!-- <title>Lawmakers - IDLEG - Idaho Legislative Information Portal, Bills, Lawmakers & Data</title> --> | ||
|
||
<div class="maincontainer"> | ||
|
||
<?php include 'dash.php'; ?> | ||
|
||
<div class="billmain"> | ||
|
||
<?php | ||
|
||
$host = "localhost"; | ||
$user = "root"; | ||
$dbpassword = "root"; | ||
$database = "idleg_test"; | ||
$dbport = 8889; | ||
|
||
$db = new PDO("mysql:host=$host;dbname=$database;port=$dbport", $user, $dbpassword); | ||
|
||
<?php include 'footer.php'; ?> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
session_start(); | ||
include 'users.php'; | ||
|
||
if (check_login($_POST["username"], $_POST["password"])) { | ||
$_SESSION["access_granted"] = true; | ||
header("Location:granted.php"); | ||
|
||
} else { | ||
$status = "Invalid username or password"; | ||
$_SESSION["status"] = $status; | ||
$_SESSION["user_preset"] = $_POST["user"]; | ||
$_SESSION["access_granted"] = false; | ||
|
||
header("Location:index.php"); | ||
} | ||
?> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
include('top.php'); | ||
include('users.php'); | ||
|
||
$name = $_POST["name"]; | ||
$password = $_POST["password"]; | ||
|
||
if (check_login($name, $password) { | ||
session_start(); | ||
$_SESSION["name"] = $name; | ||
?> | ||
|
||
<p>Login successful! Welcome back, <?= $name ?>.</p> | ||
<?php | ||
} | ||
else { | ||
?> | ||
<p>Sorry, incorrect user name or password.</p> | ||
<?php | ||
} | ||
include('bottom.php'); | ||
?> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
session_start(); | ||
session_destroy(); | ||
header("Location:index.php"); | ||
?> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
if (!isset($_SESSION)) { | ||
session_start(); | ||
} | ||
|
||
if (isset($_SESSION["flash"])) { | ||
?> | ||
<div id="flash"> <?= $_SESSION["flash"] ?> </div> | ||
<?php | ||
unset($_SESSION["flash"]); | ||
} | ||
|
||
|
||
|
||
/* if (isset($_SESSION["access_granted"]) && $_SESSION["access_granted"]) { | ||
header("Location:granted.php"); | ||
} | ||
$user = ""; | ||
if (isset($_SESSION["user_preset"])) { | ||
$user = $_SESSION["user_preset"]; | ||
} */ | ||
?> |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
if (!isset($_SESSION)) { session_start(); } | ||
|
||
# Returns TRUE if PW correct | ||
|
||
ini_set('display_errors',1); | ||
error_reporting(E_ALL); | ||
|
||
/* $host = "localhost"; | ||
$user = "root"; | ||
$dbpassword = "root"; | ||
$database = "idleg_test"; | ||
$dbport = 8889; */ | ||
|
||
function check_login($name, $password) { | ||
$db = new PDO("mysql:host=127.0.0.1;port=8889;dbname=idleg_test", "root", "root"); | ||
var_dump($db); | ||
$name = $db->quote($name); | ||
$rows = $db->query("SELECT password FROM users WHERE username = $name"); | ||
if ($rows) { | ||
foreach ($rows as $row) { #only one row should match | ||
if ($password === $row["password"]) { | ||
return TRUE; | ||
} | ||
} | ||
} | ||
return FALSE; | ||
} | ||
|
||
function ensure_logged_in() { | ||
if (!isset($_SESSION[$name])) { | ||
redirect("user.php", "You must login first"); | ||
} | ||
} | ||
|
||
function redirect | ||
?> |