Heim  >  Artikel  >  php教程  >  php登陆问题[txt保存数据]

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

WBOY
WBOYOriginal
2016-06-08 17:30:041168Durchsuche
<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:







}
?>
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn