안녕하세요, 나는 암호를 변경하기위한 HTML 및 PHP 코드를 작성한 PHP 페이지가 있으며이 페이지를 localhost에서 직접 실행하면 잘 작동합니다. 내가 어떤 다른 HTML 페이지에서이 페이지를 포함하고 여기에어떻게 PHP와 내 SQL을 사용하여 비밀 번호를 변경하려면?
작동하지 않습니다 그것을 사용할 때
하지만 때 잘 작동 내 코드
changepassword.php
<?php
session_start();
?>
<?php
$eid=$_SESSION['eid'];
echo $eid;
$conn = mysql_connect("localhost","root","root");
mysql_select_db("helixcrm",$conn);
if(count($_POST)>0) {
$result = mysql_query("SELECT *from login WHERE eid='" . $eid . "'");
$row=mysql_fetch_array($result);
if($_POST["currentPassword"] == $row["password"]) {
mysql_query("UPDATE login set password='" . $_POST["newPassword"] . "' WHERE eid='" . $eid . "'");
$message = "Password Changed";
} else $message = "Current Password is not correct";
}
?>
<html>
<head>
<title>Change Password</title>
<link rel="stylesheet" type="text/css" href="styles.css" />
<script>
function validatePassword() {
var currentPassword,newPassword,confirmPassword,output = true;
currentPassword = document.frmChange.currentPassword;
newPassword = document.frmChange.newPassword;
confirmPassword = document.frmChange.confirmPassword;
alert(i+j+k);
if(!currentPassword.value) {
currentPassword.focus();
document.getElementById("currentPassword").innerHTML = "required";
output = false;
}
else if(!newPassword.value) {
newPassword.focus();
document.getElementById("newPassword").innerHTML = "required";
output = false;
}
else if(!confirmPassword.value) {
confirmPassword.focus();
document.getElementById("confirmPassword").innerHTML = "required";
output = false;
}
if(newPassword.value != confirmPassword.value) {
newPassword.value="";
confirmPassword.value="";
newPassword.focus();
document.getElementById("confirmPassword").innerHTML = "not same";
output = false;
}
return output;
}
</script>
</head>
<body>
<form name="frmChange" method="post" action="" onSubmit="return validatePassword()">
<div style="width:500px;">
<div class="message"><?php if(isset($message)) { echo $message; } ?></div>
<table border="0" cellpadding="10" cellspacing="0" width="500" align="center" class="tblSaveForm">
<tr class="tableheader">
<td colspan="2">Change Password</td>
</tr>
<tr>
<td width="40%"><label>Current Password</label></td>
<td width="60%"><input type="password" name="currentPassword" id="currentpassword"class="txtField"/><span id="currentPassword" class="required"></span></td>
</tr>
<tr>
<td><label>New Password</label></td>
<td><input type="password" name="newPassword" id="newpassword" class="txtField"/><span id="newPassword" class="required"></span></td>
</tr>
<td><label>Confirm Password</label></td>
<td><input type="password" name="confirmPassword" id ="confirmpassword"class="txtField"/><span id="confirmPassword" class="required"></span></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" value="Submit" class="btnSubmit"></td>
</tr>
</table>
</div>
</form>
</body></html>
이 페이지입니다 이런 식으로 코드를 작성하면 작동하지 않습니다.
<script type="text/javascript">
$(document).ready(function() {
$("#resetpassword").click(function() {
$(function() {
$("#RightPaneContainerDiv").load("changepassword.php");
});
});
});
</script>
위의 코드 여기
암호 재설정
어떻게 당신은 다른 페이지에서 사업부로 완전한 HTML 페이지를로드하지 못할 내 출력을 사전
와 appropriatly 스타일이 적용된
정의 "작동하지 않는"할 아마도 가장 쉬운 방법은 iframe 대응을 사용하는 것입니다. 오류가 있습니까? 예상되는 행동은 무엇이며 대신 무엇이 발생합니까? –
다시 색인 페이지로 돌아가는 데 오류가 없습니다. –
http://rs1img.memecdn.com/Urban-SQL-injection_o_80492.webp – PeeHaa