01.
<?php
02.
session_start();
03.
if
(isset(
$_POST
[
'logout'
]))
04.
{
05.
unset(
$_SESSION
[
'user'
]);
06.
}
07.
?>
08.
<?php
09.
include
(
"Class_User.php"
);
10.
if
(isset(
$_POST
[
'submit'
]))
11.
{
12.
$pdo
=
new
User();
13.
$_SESSION
[
'user'
] =
$_POST
[
'user'
];
14.
$_SESSION
[
'pass'
] =
$_POST
[
'pass'
];
15.
16.
17.
$str
=
$pdo
->seach(
$_SESSION
[
'user'
],md5(
$_SESSION
[
'pass'
]));
18.
if
(
$str
->rowCount() != 0)
19.
{
20.
header(
"Location:wecome.php"
);
21.
}
22.
else
header(
"Refresh:1;url=work1.php"
);
23.
}
24.
?>
27.
<head>
28.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
29.
<title>Untitled Document</title>
30.
<link href=
"css/pure-min.css"
rel=
"stylesheet"
type=
"text/css"
/>
31.
<style>
32.
#name-shop{margin:20px 0px 0px 50px}
33.
</style>
34.
</head>
35.
36.
<body>
37.
<form action=
"work1.php"
method=
"post"
class
=
"pure-form-stacked"
>
38.
<fieldset>
39.
<legend id=
"name-shop"
>Book</legend>
40.
<label
for
=
"email"
>UserName</label>
41.
<input type=
"text"
name=
"user"
placeholder=
"Username"
/>
42.
<label
for
=
"password"
>Password</label>
43.
<input id=
"password"
type=
"password"
name=
"pass"
placeholder=
"Password"
/>
44.
<input
class
=
"pure-button pure-button-primary"
type=
"submit"
value=
"Login"
name=
"submit"
/> Or <a href=
"New User.php"
>New User</a>
45.
<label
for
=
"remember"
class
=
"pure-checkbox"
>
46.
<input id=
"remember"
type=
"checkbox"
> Remember me
47.
</label>
48.
</legend></fieldset>
49.
</form>
50.
</body>
51.
</html>