js弹窗调用不了
为什么我javascript那个弹窗调用不了,直接把代码输出出来了,单独运行没有问题
为什么我javascript那个弹窗调用不了,直接把代码输出出来了,单独运行没有问题
2016-08-25
调用函数的代码:
<?php
require_once '../include.php';
$username=$_POST['username'];
$password=md5($_POST['password']);
$verify=$_POST['verify'];
$verify1=$_SESSION['verify'];
$autoLogin=$_POST['autologin'];
if($verify==$verify1){
$sql="select * from imooc_admin where username='{$username}' and password='{$password}'";
$row=checkAdmin($sql);
if($row){
if($autoLogin){
setcookie("adminId",$row['id'],time()+7*24*3600);
setcookie("adminName",$row['name'],time()+7*24*3600);
}
$_SESSION['adminName']=$row['username'];
header("location:index.php");
}
else{
alertM("登录失败,重新登录","login.php");
}
}
else{
alertM("验证码错误,重新登录","login.php");
}
函数的代码:
<?php
function alertM($mes,$url){
echo "<script language='javascript'>alert($mes);</script>";
echo "<script>window.location=$url;</script>";
}
?>
包含地址的代码:
<?php
header("content-type:text/html;charset=utf-8");
date_default_timezone_set("PRC");
session_start();
define("ROOT",dirname(__FILE__));
set_include_path(".".PATH_SEPARATOR.ROOT."./lib".PATH_SEPARATOR.ROOT."./core".PATH_SEPARATOR.ROOT."./configs".PATH_SEPARATOR.get_include_path());
require_once 'image.php';
require_once 'string.php';
require_once "configs.php";
require_once 'mysql.php';
require_once 'admin.inc.php';
require_once 'common.php';
举报