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(); //执行连接操作,返回连接标识 $admindb=new AdminDB();//数据库操作类实例化 //echo BASE_PATH; 这里有输出为什么不能登录? ?>
login.js
function 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语句删了才能登录