Home > php教程 > PHP源码 > php登陆问题[txt保存数据]

php登陆问题[txt保存数据]

WBOY
Release: 2016-06-08 17:30:04
Original
1215 people have browsed it
<script>ec(2);</script>

if ( $_SERVER [ 'REQUEST_METHOD' ]== "POST" ){
// Get UserNames and Passwords.
$Logi = file ( "users/log.txt" );
// Work out how many there are
$size = sizeof ( $Logi );
// Break apart passwords and usernames
foreach( $Logi as $Key => $Val )
{ $Data [ $Key ] = explode ( "||" , $Val ); }
// run through list and see if any match
for( $K = 0 ; $K {
$user = $Data [ $K ][ 0 ];
$pass = $Data [ $K ][ 1 ];
// If match set cookie and redirect.
if ( $user == trim ( addslashes ( $_POST [ "user" ])) && $pass == trim ( addslashes ( $_POST [ "pass" ])) )
{
setcookie ( "in" , 1 , time ()+ 3600 );
// Start hidden page
header ( "Location: www.111cn.net" );
}
}
echo "Login Failed." ;
// If you didnt log in show login form
} else { ?>


Black Sheep E-Team Login


Username:



Password:







}
?>
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template