Initial commit.

This commit is contained in:
tim
2013-05-17 23:38:44 +02:00
commit 7fc40728f5
1334 changed files with 164883 additions and 0 deletions
+103
View File
@@ -0,0 +1,103 @@
<?
require_once("../session.lib.php");
$denied = NULL;
$is_admin = NULL;
if (isset($_SESSION['editor'])) {
header("Location: http://xxx.org.za/publish/edit");
} else if (isset($_POST['login'])) {
include_once('../open_db.lib.php');
$table = "editors";
open_db('open');
$username = $db->real_escape_string($_POST['username']);
$query = "SELECT * FROM $table WHERE ".
"username LIKE '".$username."' ".
"LIMIT 1;";
$getid = $db->query($query) or die("Query failed: ".$db->error());
$row = $getid->fetch_assoc();
if (isset($row)) $stored_password = $row['password'];
else $denied = TRUE;
$getid->close();
open_db('close');
$compare_password = $_POST['password'];
if (crypt($compare_password, $stored_password) != $stored_password) {
$denied = TRUE;
} else {
$_SESSION['editor'] = $username;
// Keep user logged in with cookie, if they request it
if (isset($_POST['remember'])) {
create_persistent_login($username);
}
if (isset($_SESSION['referrer'])) {
$url = $_SERVER['HTTPS'] ? "https://" : "http://";
$url .= $_SERVER['HTTP_HOST'];
$url .= $_SESSION['referrer'];
unset($_SESSION['referrer']);
header("Location: $url");
return;
} else {
header("Location: http://xxx.org.za/publish/edit");
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" value="text/html; charset=UTF-8" />
<title>x.x.x: login</title>
<link rel="shortcut icon" href="/favicon.png">
<link rel="icon" href="/favicon.png">
<link rel='stylesheet' type='text/css' href='/style.css'>
<link rel='stylesheet' type='text/css' href='/publish/style.css'>
<link rel="alternate" type="application/rss+xml" title="xxx.org.za RSS feed" href="/feed" />
</head>
<? flush(); ?>
<body>
<div id="container">
<!-- Include siderbar here -->
<? include_once('../sidebar.inc.php'); ?>
<!-- Continue with main page stuff -->
<div id="main">
<div id="maintext">
<H1>editor login</H1>
<?
if ($denied)
echo "<p><strong>Access denied. Please try again.</strong></p>\n";
?>
<form action="<? echo "https://xxx.org.za".$_SERVER['REQUEST_URI']; ?>" method="post">
<label for="username">Username: </label>
<input type="text" id="username" name="username" />
<br class="clear" />
<label for="password">Password: </label>
<input type="password" id="password" name="password" />
<br class="clear" />
<label for="remember">Remember me:</label>
<input type="checkbox" id="remember" name="remember" checked />
<br class="clear" />
<div class="submission">
<button type="submit" id="login" name="login" value="1">Login</button>
</div>
</form>
</div> <!-- maintext -->
</div> <!-- main -->
</div> <!-- container -->
<!-- Include bottom bar here -->
<? include('../bottombar.inc.php'); ?>
<!-- Finis -->
</body>
</html>