如何在这个文件中实现保存账号密码并写入到一个文件中?

fangongdalu7148 2012-01-28 03:27:08
<?
require_once("php/report/include/cookie.php");
$domain = trim($_SERVER["SERVER_NAME"]);
if(file_exists("/var/eyou/apache/htdocs/".$domain))
{
include("$domain");
exit;
}
?>

<html>
<title>青岛职业技术学院电子邮件系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript" src="/js/jquery-1.2.6.js"></script>
<style type="text/css">
<!--
.font{
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #4c4c4c;
}
.input {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #4c4c4c;
}
body{
margin: 0px;
}
.message{
color:red;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
</style>
<script language="javascript">
$(document).ready(function() {
$("#submit").click(function(){
login();
return false;
})
});
function login() {
var messageDefault = "系统错误,请稍候再试。";
formData = $("input, select").serialize();
$.ajax({
type: "post",
url: "/cgi-bin/user_login",
data: formData + "&rnd=" + parseInt(Math.random()*9999),
dataType: "html",
success: function (dataRes) {
switch ($.trim(dataRes)) {
case "0":
window.location = "/cgi-bin/user_login";
break;
case "2":
$TxtFileName = "Demo.txt";
//showMessage($TxtFileName);
showMessage("您输入的用户或密码错误");
break;
case "3":
showMessage("本系统已禁止使用别名登录,请使用真实用户名登录。");
break;
case "4":
showMessage("由于该用户尝试的登录次数达到最大值,已被禁止登录。");
break;
case "5":
showMessage("您输入的密码错误");
break;
case "6":
showMessage("该用户已经被锁定");
break;
case "7":
showMessage("该用户所在的域已经过期");
break;
case "8":
showMessage("该用户已经过期");
break;
case "9":
showMessage("您输入的域名错误");
break;
case "10":
showMessage("用户提交的验证码错误");
break;
case "11":
showMessage("license过期,请与管理员联系");
break;
case "12":
showMessage("用户输入的密码过短");
break;
case "13":
showMessage("导用户信件出错");
break;
case "14":
showMessage("异常错误");
break;
case "15":
showMessage("非法用户名");
break;
case "16":
showMessage("非法域名");
break;
case "17":
showMessage("您所在的组不允许您用页面登陆邮箱");
break;
default:
case "1":
showMessage(messageDefault);
break;
}
},
error: function () {
showMessage(messageDefault);
}
});
}

function showMessage(message) {
$("#message").html(message);
}
</script>
</head>

<body>
<form name=login method=post id="login">
<table width="995" height="549" align="center" cellpadding="0" cellspacing="0" >
<tr>
<td width="285" rowspan="3"><img src="/images/pic_zuo.gif" width="289" height="549"></td>
<td height="121"><img src="/images/pic_shang.gif" width="418" height="121"></td>
<td width="288" rowspan="3"><img src="/images/pic_you.gif" width="288" height="549"></td>
</tr>
<tr>
<td height="308" background="/images/pic_zhong.GIF"><table width="60%" align="center" cellpadding="0" cellspacing="7" >
<tr><br><br>
<td width="25%" align="right" class="font">用户名:</td>
<td width="75%"><input name="LoginName" type="text" class="input" size="18"><br/><span id="message" class="message"></span></td>
</tr>
<tr>
<td align="right" class="font">@</td>
<td>
<select class=input name=domain style="width:120px">
<?
$lines = @file(get_config('domain_txt'));
if(null == $lines || count($lines)>20)
{
if(null != $_COOKIE['domainname'] && $_COOKIE['domainname'] != get_config('me'))
{
?>
<option value="<?= get_config('me') ?>"><?= get_config('me') ?></option>
<option value="<?= $_COOKIE['domainname'] ?>" selected><?= $_COOKIE['domainname'] ?></option>
<?
}
else
{
?>
<option value="<?= get_config('me') ?>"><?= get_config('me') ?></option>
<?
}
}
else
{
for($i=0; $i<count($lines); $i++)
{
$lines[$i] = ereg_replace("\r","",$lines[$i]);
$lines[$i] = ereg_replace("\n","",$lines[$i]);
?>
<option value="<?= $lines[$i] ?>" <?= $_COOKIE['domainname']==$lines[$i]?"selected":"" ?>><?= $lines[$i] ?></option>
<?
}
}
?>
</select>
</td>
</tr>
<tr>
<td align="right" class="font">密 码:</td>
<td><input name="Password" type="password" class="input" size="18"></td>
</tr>
<tr>
<td align="right" class="font">风 格:</td>
<td><select class=input name="skin" style="width:120px ">
<option value="">默认</option>
<option value="blue">蔚蓝天空</option>
<option value="red">橘子红了</option>
<option value="silver">银装素裹</option>
<option value="purple">紫色情怀</option>
<option value="green">绿意盎然</option>
</select></td>
</tr>
<tr>
<!--
<td align="right" class="font">语 言:</td>
<td colspan="2" class="font"><input name="locale" type="radio" value="zh_CN" checked>
中文
<input type="radio" name="locale" value="en_US">
英文  <a href="/getpass">找回密码</a></td>
<td align="center" class="font" colspan="2" height="25"><a href="/getpass">找回密码</a></td>
-->
<td align="center" class="font" colspan="2" height="25"><a href="/php/report/osignup.php">邮箱注册</a>
<a href="/help/help.html">帮助</a>
<a href="http://www.qtc.edu.cn">返回主页</a></td>
</tr>
<tr>
<td height="25"> </td>
<td><INPUT id="submit" type=image cache src="/images/menu2.gif" border=0 name=log_in target="_blank"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="120"><img src="/images/pic_xia.gif" width="418" height="120"></td>
</tr>
</table></FORM>
</body>
</html>
<?php
?>
...全文
419 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
zgsdzhaolanxiang1 2012-02-22
  • 打赏
  • 举报
回复
谢谢各位了,问题解决了,。
黄袍披身 2012-01-29
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 fangongdalu7148 的回复:]

我想实现的功能是保存 login中的用户名和密码信息到服务器的文件中,能否通过PHP代码获取javascript中变量的值???
[/Quote]

不管你上面代码是什么,如果你是要将js内的变量内容传递给php.那么请用ajax.当然你也可以用跳转,但是我想ajax才是你需要的
zgsdzhaolanxiang1 2012-01-29
  • 打赏
  • 举报
回复
我想实现的功能是保存 login中的用户名和密码信息到服务器的文件中,能否通过PHP代码获取javascript中变量的值???
zgsdzhaolanxiang1 2012-01-29
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 yaw7408195 的回复:]

file_put_contents

另外楼主PS技术不行,头像P成那样了
[/Quote]
能详细点吗??? 头像是用windows的画图做的。。
K-dash 2012-01-29
  • 打赏
  • 举报
回复
同楼上,put contents
yaw7408195 2012-01-28
  • 打赏
  • 举报
回复
file_put_contents

另外楼主PS技术不行,头像P成那样了
黄袍披身 2012-01-28
  • 打赏
  • 举报
回复
我想知道的是写入的意思是什么?另外一个文件又是什么?最好描述一下应用场景

21,889

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧