View Full Version : Trying to lay php login into html page

05-17-2011, 07:40 PM
Hello, I have a working login system for my website, its a very simple system that holds only one username/password, without using a database. I include the php on the page, and the html that I put into the page, shows up only after someone logs in. So the link first shows, simple php log in, then the page.
I want to be able to customize the log in part by including the menu and page layout. Heres my code

$username = "client";
$password = "buylocal";
$randomword = "bibblebobblechocolatemousse";

if (isset($_COOKIE['MyLoginPage'])) {
if ($_COOKIE['MyLoginPage'] == md5($password.$randomword)) {

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<link rel="shortcut icon" href="http://BLOCKED.com/favicon.ico">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- TemplateBeginEditable name="metatags" -->
<script src="http://BLOCKED.com/listmenu.js" type="text/javascript"></script>

<meta name="keywords" content="" />
<meta name="description" content="" />
<!-- TemplateEndEditable --><!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->

} else {
echo "<p>Bad cookie. Clear please clear them out and try to login again.</p>";

if (isset($_GET['p']) && $_GET['p'] == "login") {
if ($_POST['name'] != $username) {
echo "<p>Sorry, that username does not match. Use your browser back button to go back and try again.</p>";
} else if ($_POST['pass'] != $password) {
echo "<p>Sorry, that password does not match. Use your browser back button to go back and try again.</p>";
} else if ($_POST['name'] == $username && $_POST['pass'] == $password) {
setcookie('MyLoginPage', md5($_POST['pass'].$randomword));
header("Location: $_SERVER[PHP_SELF]");
} else {
echo "<p>Sorry, you could not be logged in at this time. Refresh the page and try again.</p>";

<form action="<?php echo $_SERVER['PHP_SELF']; ?>?p=login" method="post"><fieldset>
<label><input type="text" name="name" id="name" /> Name</label><br />
<label><input type="password" name="pass" id="pass" /> Password</label><br />
<input type="submit" id="submit" value="Login" />

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum