FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
phpUserClass/example1.php at master · HumanWorks/phpUserClass · GitHub
HumanWorks
phpUserClass
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
phpUserClass
/
example1.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
36 lines (36 loc) · 1.16 KB
Breadcrumbs
phpUserClass
/
example1.php
Copy path
File metadata and controls
36 lines (36 loc) · 1.16 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?
/*
Basic login example with php user class
http://phpUserClass.com
*/
require_once
'
access.class.php
'
;
$
user
=
new
flexibleAccess
();
if
(
$
_GET
[
'
logout
'
] ==
1
)
$
user
->
logout
(
'
http://
'
.
$
_SERVER
[
'
HTTP_HOST
'
].
$
_SERVER
[
'
PHP_SELF
'
]);
if
( !
$
user
->
is_loaded
() )
{
//Login stuff:
if
(
isset
(
$
_POST
[
'
uname
'
]) &&
isset
(
$
_POST
[
'
pwd
'
])){
if
( !
$
user
->
login
(
$
_POST
[
'
uname
'
],
$
_POST
[
'
pwd
'
],
$
_POST
[
'
remember
'
] )){
//Mention that we don't have to use addslashes as the class do the job
echo
'
Wrong username and/or password
'
;
}
else
{
//user is now loaded
header
(
'
Location: http://
'
.
$
_SERVER
[
'
HTTP_HOST
'
].
$
_SERVER
[
'
PHP_SELF
'
]);
}
}
?>
<h1>Login</h1>
<p><form method="post" action="
<?php
echo
htmlspecialchars
(
$
_SERVER
[
'
PHP_SELF
'
]);
?>
" />
username: <input type="text" name="uname" /><br /><br />
password: <input type="password" name="pwd" /><br /><br />
Remember me? <input type="checkbox" name="remember" value="1" /><br /><br />
<input type="submit" value="login" />
</form>
</p>
<?php
}
else
{
//User is loaded
?>
<a href="
<?php
echo
htmlspecialchars
(
$
_SERVER
[
'
PHP_SELF
'
]);
?>
'?logout=1">logout</a>
<?php
}
?>
Back
|
FazBrowse Home
|
New Git URL