在线求一个PHP网页源代码 ``(为了完成作业) 25

今天老师布置的作业``急需`谢谢要求全英语... 今天老师布置的作业``急需` 谢谢 要求全英语 展开
 我来答
我手我口
2008-12-10 · TA获得超过807个赞
知道小有建树答主
回答量:565
采纳率:61%
帮助的人:325万
展开全部
一楼的不要蒙人啊。

下面是一个远程修改ftp密码的php程序,你交上去,一定非常好。
不仅包含有html知识,也有js验证,还有php知识。如果你今后做网站,这个程序对你也非常实用。

<?PHP

if($_POST['servername']){

function jsalert($w)
{
echo '<script language="javascript">alert("'.$w.'");'."\r\n";
echo 'window.history.go(-1)';
echo '</script>';
}

if(!$_POST['UserName']){jsalert('Username error');exit;}

if(!($fp=@ftp_connect($_POST['servername'])))
{
jsalert( $_POST['servername'].'server can not connect!');
exit();
}

if(!@ftp_login($fp,$_POST['UserName'],$_POST['OldPassWord']))
{
jsalert('Sorry, you entered an incorrect username or password!');
exit();
}
if(@ftp_site($fp,'pswd '.$_POST['OldPassWord'].' '.$_POST['NewPassWord']))
{
jsalert('OK, the password has been successfully changed.');
exit;
}
else
{
jsalert('Failure, may be the FTP server does not support the change。');
exit;
}

}

else{

?>

<html>

<head>
<title>FTP password online tools to change</title>

<script language="JavaScript">
function is_kuho_password(password){
var pattern = /^([a-zA-Z0-9])+$/;
var flag= pattern.test(password);
if(!flag){return false;}
return true;
}

function passchange(){
var servername = document.passwdchange.servername.value;
var UserName = document.passwdchange.UserName.value;
var OldPassWord = document.passwdchange.OldPassWord.value;
var NewPassWord = document.passwdchange.NewPassWord.value;
var NewPassWord1 = document.passwdchange.NewPassWord1.value;

if(!servername){
alert('Please input domain name or ip');
document.passwdchange.servername.focus();
document.passwdchange.servername.value='';
return false;
}

if(!UserName){
alert('Please input user name');
document.passwdchange.UserName.focus();
document.passwdchange.UserName.value='';
return false;
}
//check PassWord
if(!OldPassWord){
alert('Please input password');
document.passwdchange.OldPassWord.focus();
document.passwdchange.OldPassWord.value='';
return false;
}
if(!NewPassWord){
alert('Please input new password');
document.passwdchange.NewPassWord1.value='';
document.passwdchange.NewPassWord.focus();
document.passwdchange.NewPassWord.value='';
return false;
}
if(!is_kuho_password(NewPassWord)){
alert('Sorry! You do not regulate the new password! Please enter from the 6-20 letters or numbers in Password!');
document.passwdchange.NewPassWord1.value='';
document.passwdchange.NewPassWord.focus();
document.passwdchange.NewPassWord.value='';
return false;
}
if(NewPassWord.length < 6 || NewPassWord.length > 20 ){
alert('You enter a new password length is not in line with the norms, enter the password 6-20 bit!');
document.passwdchange.NewPassWord1.value='';
document.passwdchange.NewPassWord.focus();
document.passwdchange.NewPassWord.value='';
return false;
}
if(!NewPassWord1){
alert('Make sure your new password!');
document.passwdchange.NewPassWord1.focus();
document.passwdchange.NewPassWord1.value='';
return false;
}
if(!is_kuho_password(NewPassWord1)){
alert('Sorry! You do not regulate the new password! Please enter from the 6-20 letters or numbers in Password!');
document.passwdchange.NewPassWord1.focus();
document.passwdchange.NewPassWord1.value='';
return false;
}
if( NewPassWord1.length < 6 || NewPassWord1.length > 20 ){
alert('Sorry! You do not regulate the new password! Please enter from the 6-20 letters or numbers in Password!');
document.passwdchange.NewPassWord1.focus();
document.passwdchange.NewPassWord1.value='';
return false;
}
if(NewPassWord != NewPassWord1){
alert('You enter the new password twice inconsistent, please re-enter after the check!');
document.passwdchange.NewPassWord1.value='';
document.passwdchange.NewPassWord.focus();
document.passwdchange.NewPassWord.value='';
return false;
}
if(NewPassWord == OldPassWord){
alert('The new password and the old password, no need to change!');
document.passwdchange.NewPassWord1.value='';
document.passwdchange.NewPassWord.focus();
document.passwdchange.NewPassWord.value='';
return false;
}
document.passwdchange.Submit.value="Being change...";
document.passwdchange.Submit.disabled=true;
}

</SCRIPT>

</head>

<body>

<div align="center">
<center>
<TABLE cellSpacing=1 cellPadding=8 width="600" bgColor=#635139 border=0>
<FORM name=passwdchange target="_self" action=<?php echo $_SERVER['PHP_SELF']; ?> onsubmit="return passchange()" method=post>
<TBODY>
<tr>
<TD align=center bgColor=#FFFFFF colspan="2"><font color="#FF9933"><b>
FTP password online tools to change</b></font></TD>
</tr>
<tr>
<TD align=right bgColor=#d6d3d6 width="154">Sever name:</TD>
<TD align=left bgColor=#ffffff width="411"><INPUT style="BORDER-RIGHT: 1px solid; PADDING-RIGHT: 1px; BORDER-TOP: 1px solid; PADDING-LEFT: 1px; PADDING-BOTTOM: 1px; BORDER-LEFT: 1px solid; COLOR: #484800; PADDING-TOP: 1px; BORDER-BOTTOM: 1px solid; BACKGROUND-COLOR: #ffffff"
maxLength=16 name=servername size="20"><FONT class=color1> <font color="#FF9933">
* Domain name or IP address</font></FONT></TD>
</tr>
<TR height=30>
<TD align=right bgColor=#d6d3d6 width="154">User name:</TD>
<TD align=left bgColor=#ffffff width="411"><INPUT
style="BORDER-RIGHT: 1px solid; PADDING-RIGHT: 1px; BORDER-TOP: 1px solid; PADDING-LEFT: 1px; PADDING-BOTTOM: 1px; BORDER-LEFT: 1px solid; COLOR: #484800; PADDING-TOP: 1px; BORDER-BOTTOM: 1px solid; BACKGROUND-COLOR: #ffffff"
maxLength=16 name=UserName size="20"><FONT class=color1> <font color="#FF9933">
*</font></FONT></TD></TR>
<TR height=30>
<TD align=right bgColor=#d6d3d6 width="154">Password:</TD>
<TD align=left bgColor=#ffffff width="411"><INPUT
style="BORDER-RIGHT: 1px solid; PADDING-RIGHT: 1px; BORDER-TOP: 1px solid; PADDING-LEFT: 1px; PADDING-BOTTOM: 1px; BORDER-LEFT: 1px solid; COLOR: #484800; PADDING-TOP: 1px; BORDER-BOTTOM: 1px solid; BACKGROUND-COLOR: #ffffff"
type=password maxLength=16 name=OldPassWord size="20"><FONT
class=color1> <font color="#FF9933">*</font></FONT></TD></TR>
<TR height=30>
<TD align=right bgColor=#d6d3d6 width="154">New password:</TD>
<TD align=left bgColor=#ffffff width="411"><INPUT
style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; COLOR: #484800; BORDER-BOTTOM: 1px solid; BACKGROUND-COLOR: #ffffff"
type=password maxLength=16 name=NewPassWord size="20"><FONT
class=color1> <font color="#FF9933">*</font></FONT> (Length:6-16bit) </TD></TR>
<TR height=30>
<TD align=right bgColor=#d6d3d6 width="154">Replay new password:</TD>
<TD align=left bgColor=#ffffff width="411"><INPUT
style="BORDER-RIGHT: 1px solid; PADDING-RIGHT: 1px; BORDER-TOP: 1px solid; PADDING-LEFT: 1px; PADDING-BOTTOM: 1px; BORDER-LEFT: 1px solid; COLOR: #484800; PADDING-TOP: 1px; BORDER-BOTTOM: 1px solid; BACKGROUND-COLOR: #ffffff"
type=password maxLength=16 name=NewPassWord1 size="20"><FONT
class=color1> <font color="#FF9933">*</font></FONT></TD></TR>
<TR>
<TD class=huangz align=middle bgColor=#ffffff colSpan=2 height=30 width="504">
<p align="center"><INPUT type=submit value=Change name=Submit></p>
</TD></TR></FORM>
</table>
</center>
</div>

</body>

</html>

<?php } ?>
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式