login.php

来自「哈克MusicPHP音乐程序v1.0一套基本于PHP+TXT的在线音乐播放程序。」· PHP 代码 · 共 54 行

PHP
54
字号
<?php
require("global.php");
$subtitle='会员登录';

//试听排行
$top="viewhot";

if(empty($action)){ 
  if (GetCookie('userlogin')=="1"){
	Showmsg("no","你已经登录,无需再登录","返回", "javascript:history.back(-1)");
	exit; 
  }
  require("header.php");
  include_once PrintEot('login');
  footer();
  exit;
}
elseif ($action=="login"){
  	if (!file_exists("$userdir/$username.php")) {
	    Showmsg("no","无此用户名,请更改!","返回重新填写","javascript:history.back(-1)");
		exit;
	}
	if (empty($username) || empty($userpass)) {
	    Showmsg("no","用户名或密码不能为空!请填写完整后登录!","返回重新填写","javascript:history.back(-1)");
		exit;
	}
	else{
    $user_info=@file("$userdir/$username.php");
    list($user_name,$user_nicheng,$user_pass,$user_level,$user_mail,$add_lrcnum,$commend_song,$reg_time)=explode("|",$user_info[1]);
    if ($user_name!=$username || $user_pass!=md5($userpass)) {
		Showmsg("no","用户名或密码错误!","返回重新填写","javascript:history.back(-1)");
		exit;
	}
	
    $cktime != 0 && $cktime += $timestamp;
	Cookie("username",$user_name,$cktime);
	Cookie("userlogin","1",$cktime);
	Cookie("usernicheng",$user_nicheng,$cktime);
	Cookie("userlever",$user_level,$cktime);
	if (!$jumpurl) $jumpurl="member.php"; 
	Showmsg("yes","登录成功!2 秒后页面将自动跳转到新的页面","自动跳转", $jumpurl);
	exit;
	}
}  
elseif ($action=="out"){
	Cookie("username","");
	Cookie("userlogin","");
	Cookie("usernicheng","");
	Cookie("userlever","");
	Showmsg("yes","安全退出!2 秒后页面将自动跳转到首页","进入首页","index.php");
	exit;
} 
?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?