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

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

WBOY
WBOYasal
2016-06-08 17:30:041216semak imbas
<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:







}
?>
Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn