PHP的一段登陸代碼,該怎么解決
Jun 13, 2016 pm 01:39 PM
PHP的一段登陸代碼
現(xiàn)在有段PHP代碼, 我要把登陸密碼設(shè)為指定的數(shù)字, 不從數(shù)據(jù)庫里面取, 大家給我看看改如何修改?
/**
?**============================================================================
?* ============================================================================
*/
$dir_name=str_replace('\\','/',dirname(__FILE__));
$admindir=substr($dir_name,strrpos($dir_name,'/')+1);
define('CMS_PATH',str_replace($admindir,'',$dir_name));
define('INC_PATH',CMS_PATH.'includes/');
define('DATA_PATH',CMS_PATH.'data/');
include(INC_PATH.'fun.php');
include(DATA_PATH.'confing.php');
include(INC_PATH.'mysql.class.php');
if(file_exists(DATA_PATH.'sys_info.php')){
include(DATA_PATH.'sys_info.php');
}
$mysql=new mysql(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME,DB_CHARSET,DB_PCONNECT);
session_start();
$_SESSION['login_in']=empty($_SESSION['login_in'])?'':$_SESSION['login_in'];
$_SESSION['admin']=empty($_SESSION['admin'])?'':$_SESSION['admin'];
if($_SESSION['login_in']&&$_SESSION['admin']){header("location:admin.php");}
$action=empty($_GET['action'])?'login':$_GET['action'];
$password=empty($_POST['password'])?'':$_POST['password'];
$user=empty($_POST["user"])?'':$_POST['password'];
$code=empty($_POST['code'])?'':$_POST['code'];
$submit=empty($_POST['submit'])?'':$_POST['submit'];
go_url($action);
function login(){
global $_sys;
include('template/admin_login.html');
}
function ck_login(){
global $submit,$user,$password,$_sys,$code;
$submit=$_POST['submit'];
$user=fl_html(fl_value($_POST['user']));
$password=fl_html(fl_value($_POST['password']));
$code=$_POST['code'];
if(!isset($submit)){
msg('請從登陸頁面進(jìn)入');
}
if(empty($user)||empty($password)){
msg("密碼或用戶名不能為空");
}
if(!empty($_sys['safe_open'])){
foreach($_sys['safe_open'] as $k=>$v){
if($v=='3'){
if($code!=$_SESSION['code']){msg("驗證碼不正確!");}
}
}
}
check_login($user,$password);
}
function out(){
login_out();
}
?>
------解決方案--------------------
那你將你的check_login($user,$password);
方法的$password變量直接設(shè)置為數(shù)字就可。在方法里面就將你傳遞的數(shù)字在你的方法里面進(jìn)行比對。
------解決方案--------------------
fun.php 貼出這個文件的代碼
------解決方案--------------------
- PHP code
check_login($user,$password) { ($password == '12345') ? $_SESSION['login_in'] = yes : die("error"); } <br><font color="#e78608">------解決方案--------------------</font><br> 有幾個注釋的地方自己看看 因為不知道你其他代碼是否有用到那些變量處理.<br><br>
- PHP code
function check_login($user, $password) { /* $rel=$GLOBALS['mysql']->fetch_asc("select id,admin_name,admin_password,admin_purview,is_disable from ".DB_PRE."admin where admin_name='".$user."' limit 0,1"); $rel=empty($rel)?'':$rel[0]; if(empty($rel)){ msg('不存在該管理用戶','login.php'); } $password=md5($password); if($rel['is_disable']){ msg('該賬號已經(jīng)被鎖定,無法登陸'); } */ $oldPassword = '12345'; //默認(rèn)固定密碼 if ($password != $oldPassword) { msg("輸入的密碼不正確"); } if (!isset($_SESSION)) { session_start(); } $_SESSION['admin'] = $rel['admin_name']; //$_SESSION['admin_purview'] = $rel['admin_purview']; //這里需要根據(jù)車給你需代碼進(jìn)行處理 //$_SESSION['admin_id'] = $rel['id']; 這里id 需要根據(jù)程序代碼進(jìn)行處理 $_SESSION['admin_time'] = time(); $_SESSION['login_in'] = 1; $_SESSION['login_time'] = mktime(); $ip = fl_value(get_ip()); $ip = fl_html($ip); $_SESSION['admin_ip'] = $ip; //unset($rel); header("location:admin.php"); } <div class="clear"> </div>

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

??? ??











springboot ???? ???? ???? ?? ???? ??? ???????. ?? ??: ??? ????? ???? ??? ?????? ???? ?? application.yaml? ???? ????? ??????. , ???? ??? ???? ?? ??? 8???? ?? ???????. ??? ??? ?????? ???? ?? ??? ?? ???? ??? ???? ?????. 30? ?? ?? ??? ???? ??? ??? ???? ?? ???? ?????. ?? ?? ?? ??? ?????. springboot ?????? Tomcat? ???? ???? ????? application.yaml? ??? ?? ??? ??????. ???? ??: ???? ?? ???? ??? ????.

?? ?? ? PHP ??? ???? ??? ?? ?? ??: 1. "session_start();"? ?? ??? ???. 2. ?? ?? ??? PHP ??? ?????. 3. ?? ??? ?? ??? ?? ? ????. 4. phpinfo?? ?? ???? ?? ??? ???? ?? ????? sessio? ????? ?????? ?????.

?? ??? ????? ?? ?? ?? ?? ?? ??? ?? ?????. ?? ??? ??? ????. 1. ?? ??? ?????. 3. ??? ?????. 4. ?? ?? ????? ?????.

??: ?? ?????? ?? ?? ?? ??? ????? SpringBoot2? application.properties? ?? ?? ??? ???? ?????. ?? ??: server.* ??? SpringBoot?? ???? ?? ????? ???? ??? ?????. SpringBoot? ServletWebServerFactory ???? ? ??? ???? ??? ????? ????? ?????. ??? ???? server.* ??? ???? ???? ??? ????(tomcat, jetty ?)? ?????. ??????? Tomcat ????? war ??? ???? server.* ??? ???? ????. ???? ????.

PHPSession? ??? ? ?? ?? ?????? ??? ?? ???? ??? ? ??? ??? ?????. ??? ? ??? ??? ? ????? ?? ?? ? ??? ?????. ??? ???? ?? ?? ???? ?? ????? ??? ?? ??? ??? ? ????. ? ??? ????? ??? ? ?? ??? ???? ?? ? ?? ??? ??? ???? ???. 1. ??? ? ??? ???? ?? ??? ?? ???? ??

?? PHP? ?? ?? ??? 1440?(24?)???. ?, ?????? 24? ?? ?? ??? ??? ???? ????? ??? ?? ??? ???? ??? ?????. ??? ? ?? ???? ????.

1. ?? ?? SMS ??? ?? 1.1 SMS ??? ??? 1.2 SMS ???? ?? ?? ????? ?? ??: ?? ?? ?? POST ?? ??/???/?? ?? ???? ??(????) ?? ? ??? ????? ?? ??: @Slf4j@ ServicepublicclassUserServiceImplextendsServiceImplimplementsIUserService{@OverridepublicResultsendCode(Stringphone,HttpSessionsession){//1? ?? ??? ??? ?????.

JavaScript?? JavaScript ??? ???? ?? ???, ??, ??? ? ?? ??? ???? ???? ?? ???? ?????. ? ?? ??? ???? ???? ??? ?? ??? ?????. PHPCookieCookies? ????? ???? ???? ?? ???? ???? ??? ?????. PHP? HTTP ??? ???? ?????. JavaScript ??? ??? ?????? ??? ??? ?? ??? ???? ????? ?? ???? ????. ????? ??? ??? ? ????. ???? ?? ???? ?? ????? ?? ??? ???? ?????. ?? ???? ???? ?? ???? ????
