1: <?php
2: session_start();
3: if(isset($_REQUEST['password'])){
4: $password = $_REQUEST['password'];
5: if($password == "password") {
6: $_SESSION['authenticated'] = "yes";
7: $do = "redirect";
8: }
9: else {
10: $do = "incorrect";
11: }
12: }
13: else{
14: $do = "showform";
15: }
16: //done processing
17: if($do == "showform"){
18: $formhtml = <<<EOT
19: <html>
20:
21: <head>
22: <title>Your Site | Login</title>
23: <style type="text/css">
24: body {
25: background: url(http://chatfieldfamily.co.uk/images/1.jpg) no-repeat;
26: background-size: 100%;
27: font-family:Verdana, Geneva, sans-serif;
28: }
29: #form {
30: opacity: 0.5;filter:alpha(opacity=50);zoom:1;
31: }
32: #form:hover {
33: opacity: 0.8;filter:alpha(opacity=80);zoom:1;
34: }
35: </style>
36: </head>
37:
38: <body>
39: <div align="center" id="form" class="form"style="margin-top:400px; margin-left:40%; margin-right:40%;; background-color:#000; color:#FFF"><h2>Your Site Login</h2>
40: <form action="login.php" method="post">
41: Password: <input type="password" name="password"></input><br></br>
42: <input type="submit"></input></form></div>
43:
44:
45:
46: </body>
47:
48: </html>
49: EOT;
50: echo($formhtml);
51: }
52: else if($do == "incorrect") {
53: $formhtml = <<<formhtml
54: <html>
55:
56: <head>
57: <title>Your Site | Login</title>
58: <style type="text/css">
59: body {
60: background: url(http://chatfieldfamily.co.uk/images/1.jpg) no-repeat;
61: background-size: 100%;
62: font-family:Verdana, Geneva, sans-serif;
63: }
64: #form {
65: opacity: 0.5;filter:alpha(opacity=50);zoom:1;
66: }
67: #form:hover {
68: opacity: 0.8;filter:alpha(opacity=80);zoom:1;
69: }
70: </style>
71: </head>
72:
73: <body>
74: <div align="center" id="form" class="form"style="margin-top:400px; margin-left:40%; margin-right:40%;; background-color:#000; color:#FFF"><h2>Chatfield Family Login</h2>
75: <form action="login.php" method="post">
76: <div style="color:#F00" >Incorrect password</div>
77: Password: <input type="password" name="password"></input><br></br>
78: <input type="submit"></input></form></div>
79:
80:
96: </body>
97:
98: </html>
99:
100: formhtml;
101: echo($formhtml);
102: }
103: elseif($do == "redirect") {
104: echo <<<redirect
105: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
106: <html>
107: <head>
108: <title>Redirecting</title>
109: <meta http-equiv="REFRESH" content="0;url=http://loggedinurl.com"></HEAD>
110: <BODY>
111: Authenticated - redirecting...
112: </BODY>
113: </HTML>
114: redirect;
115: }
116: ?>