include.php<?php
session_start();
header("content-type:text/html;charset=utf-8");
define('BASE_PATH',$_SERVER['DOCUMENT_ROOT']); //定義服務器的絕對路徑
define('SMARTY_PATH','/new09/smarty/'); //定義Smarty目錄的絕對路徑
require?BASE_PATH.SMARTY_PATH.'Smarty.class.php';
require_once('system/mysql.func.php');
$smarty=new?smarty();? //定義方法
$smarty->template_dir?=?"./system/template/"; //指定模板文件存儲位置
$smarty->compile_dir?=?"./system/compile/"; ??????????//指定編譯文件存儲位置
$smarty->config_dir?=?"./system/config/"; ?//指定配置文件存儲位置
$smarty->cache_dir?=?"./system/cache/";? //指定緩存文件存儲位置
$connobj=new?ConnDB("mysql","localhost","root","123","dzxx_db");//數據庫連接類實例化
$conn=$connobj->GetConnId(); //執(zhí)行連接操作,返回連接標識
$admindb=new?AdminDB();//數據庫操作類實例化
//echo?BASE_PATH;???這里有輸出為什么不能登錄?
?>login.jsfunction?check_login(form){
var?user?=?form.user.value;
var?pwd?=?form.pwd.value;
if(user?==?""){
alert('用戶名不允許為空');
form.user.focus();
return?false;
}
if(pwd?==?""){
alert('密碼不允許為空');
form.pwd.focus();
return?false;
}
var?url?=?"chkadmin.php?user="+user+"&pwd="+pwd;
xmlhttp.open("GET",url,true);
xmlhttp.onreadystatechange?=?checklogin;
xmlhttp.send(null);
}
function?checklogin(){
if(xmlhttp.readyState?==?4){
if(xmlhttp.status?==?200){
var?msg?=?xmlhttp.responseText;
//if(msg=="1"){
if(msg=="1"?||?parseInt(msg)=="1"?||?msg.indexof()==0){
alert('登錄成功');
window.location.href='default.php?htgl=添加信息';
}else{
alert('對不起,用戶名或密碼輸入錯誤!');
alert(msg);
}
}
}
}我把echo語句刪了才能登錄
為什么在一個頁面有輸出,會導致不能登錄呢?
錯過了年華
2017-06-24 00:32:27