Expand|Select|Wrap|Line Numbers
- <html>
- <head>
- <style type="text/css">
- h2{color:#A02820}
- </style>
- </head>
- <script language=javascript>
- function fnNew_Retype_Pswd()
- {
- var pass1 = document.useredit.txtEmployeeNewPassword.value;
- var pass2 = document.useredit.txtEmployeeRetypePassword.value;
- if(document.useredit.txtEmployeeNewPassword.value =="")
- {
- alert("Please Enter New Password...");
- //useredit.txtEmployeeNewPassword.focus();
- return false;
- }
- else if(document.useredit.txtEmployeeNewPassword.value.length < 6)
- {
- alert("Your New Password Length Should Be 6 Characters...");
- return false;
- // useredit.txtEmployeeNewPassword.value = "";
- }
- else if(document.useredit.txtEmployeeRetypePassword.value =="")
- {
- alert("Please Enter Retype Password...");
- return false;
- }
- else if(document.useredit.txtEmployeeRetypePassword.value.length < 6)
- {
- alert("Your Retype Password Length Should Be 6 Characters..."); alert("Your Retype Password Length Should Be 6 Characters...");
- useredit.txtEmployeeRetypePassword.value = "";
- }
- else if(pass1 != pass2)
- {
- alert("Your New Password Did Not Match With The Retype Password.. ");
- event.returnValue = false;
- }
- function fnSave()
- {
- if( fnNew_Retype_Pswd()== false)
- {
- event.returnValue = true;
- }
- }
- <?php
- $code = $_GET['code'];
- $name = "";
- $desg = "";
- $weeklyoff = "";
- $doj = "";
- $activatedon = "";
- $passwordexpireson = "";
- $dbconnect=pg_connect("host=10.10.2.12 dbname=punch_system user=postgres password=postgres") or
- die("could not connect to the database");
- $query = "select pmt19_emp_code,pmt19_activatedon,pmt19_passwordexpireon,";
- $query = $query . " pmt06_emp_code,pmt06_emp_name,pmt06_desg_code,pmt06_date_of_join,";
- $query = $query . " pmt06_weekly_off,pmt12_desg_code,pmt12_desg_desc";
- $query = $query . " from pmt_web_users,pmt_employee,pmt_designation ";
- $query = $query . "where pmt19_emp_code=pmt06_emp_code and pmt12_desg_code=pmt06_desg_code";
- $query = $query . " and pmt19_emp_code = '" . $code . "'";
- $rs = pg_query($query)
- or die('Could not Open Recordset...') . pg_last_error($rs);
- if (pg_num_rows($rs) > 0)
- {
- $row = pg_fetch_row($rs);
- $code = $_GET['code'];
- $name = $row[4];
- $desg = $row[9];
- $doj = $row[6];
- $weeklyoff = $row[7];
- $activatedon = $row[1];
- $passwordexpireson = $row[2];
- }
- pg_free_result($rs);
- pg_close($dbconnect);
- ?>
- <body bgcolor="#F0F0F0 ">
- <h2 align=center>User Edit Information </h2>
- <form name=useredit method=post action="" onsubmit=fnSave() >
- <br><center>
- <fieldset style='width:50%'><legend>User Edit Data</legend>
- <table align=center cellspacing=2 cellpadding=2 bgcolor=FFFFCC >
- <tr>
- <td align=right>
- <font face="Garamond" size=3><b>
- Employee Code :
- </b></font>
- </td>
- <td>
- <font face="Garamond" size=2><b>
- <input title = "Specify Employee Code..."
- style = "WIDTH: 100px; HEIGHT: 21px"
- maxLength = 7
- align = left
- id = txtEmployeeCode
- name = txtEmployeeCode
- tabindex = 1 readonly
- value = "<? echo $code ?>">
- </b></font> </td>
- <td align=right>
- <font face="Garamond" size=3><b>
- Employee Name :
- </b></font>
- </td>
- <td align=left>
- <font face="Garamond" size=4><b>
- <input title = "Specify Employee Name..."
- style = "WIDTH: 100px; HEIGHT: 21px"
- maxLength = 7
- align = left
- id = txtEmployeeName
- name = txtEmployeeName
- tabindex = 1 readonly
- value = "<? echo $name ?>">
- </b></font> </td></tr>
- <tr>
- <td align=right>
- <font face="Garamond" size=3><b>
- Employee Desig:
- </b></font> </td>
- <td align=right>
- <font face="Garamond" size=4><b>
- <input title = "Specify Employee Desig..."
- style = "WIDTH: 100px; HEIGHT: 21px"
- maxLength = 7
- align = left
- id = txtEmployeeDesig
- name = txtEmployeeDesig
- tabindex = 1 readonly
- value = "<? echo $desg?>">
- </b></font> </td>
- <td align=right>
- <font face="Garamond" size=3><b>
- Weeklyoff:
- </b></font> </td>
- <td align=left>
- <font face="Garamond" size=4><b>
- <input title = "Specify Employee WeeklyOff..."
- style = "WIDTH: 100px; HEIGHT: 21px"
- maxLength = 7
- align = left
- id = txtEmployeeWeeklyOff
- name = txtEmployeeWeeklyOff
- tabindex = 1 readonly
- value = "<?
- if($weeklyoff == 1)
- {
- $weeklyoff = "Sunday";
- }
- else if($weeklyoff == 2)
- {
- $weeklyoff = "Monday";
- }
- else if($weeklyoff == 3)
- {
- $weeklyoff = "Tuesday";
- }
- else if($weeklyoff == 4)
- {
- $weeklyoff = "Wednesday";
- }
- else if($weeklyoff == 5)
- {
- $weeklyoff = "Thursday";
- }
- else if($weeklyoff == 6)
- {
- $weeklyoff = "Friday";
- }
- else if($weeklyoff == 7)
- {
- $weeklyoff = "Saturday";
- }
- echo $weeklyoff ?>">
- </b></font> </td> </tr>
- <tr><td><hr></td><td><hr></td><td><hr></td><td><hr></td></tr>
- <!--<HR NOSHADE="NOSHADE">-->
- <tr>
- <td align=right>
- <font face="Garamond" size=3><b>
- Doj:
- </b></font></td>
- <td>
- <font face="Garamond" size=4><b>
- <input title = "Specify Employee Doj..."
- style = "WIDTH: 100px; HEIGHT: 21px"
- maxLength = 7
- align = left
- id = txtEmployeeDoj
- name = txtEmployeeDoj
- tabindex = 1 readonly
- value = "<? echo $doj ?>">
- </b></font> </td>
- <td align=right> <font face="Garamond" size=3><b>
- Role:
- </b></font>
- </td>
- </td>
- <td>
- <select id=Role name=Role style="width: 100px"><option>[Select One]</option><?php fnRoles(); ?></select></td>
- </tr>
- <tr>
- <td align=left>
- <font face="Garamond" size=3><b>
- Current Password:
- </b></font> </td>
- <td>
- <font face="Garamond" size=4><b>
- <input title = "Specify Employee Current Password..."
- type = password
- style = "WIDTH: 100px; HEIGHT: 21px"
- maxLength = 7
- align = left
- id = txtEmployeeCurrentpassword
- name = txtEmployeeCurrentPassword
- tabindex = 1>
- </b></font></td>
- <td align=right> <font face="Garamond" size=3><b>
- Valid Compinies:
- </b></font> </td>
- <td>
- <select name="ValidCompinies" id="Select1" size="4" multiple="multiple"
- style="width: 180px"><option>[Select-One]</option><?php fnValidCompinies(); ?></select></tr>
- <tr>
- <td align=right>
- <font face="Garamond" size=3><b>
- New Password:
- </b></font> </td>
- <td>
- <font face="Garamond" size=4><b>
- <input title = "Specify Employee New Password..."
- type = password
- style = "WIDTH: 100px; HEIGHT: 21px"
- maxLength = 7
- align = left
- id = txtEmployeeNewpassword
- name = txtEmployeeNewPassword
- tabindex = 1 onfocusout=fnNew_Retype_Pswd() >
- </b></font>
- </td></tr>
- <tr>
- <td>
- <font face="Garamond" size=3><b>
- Retype Password:
- </b></font>
- <td>
- <font face="Garamond" size=4><b>
- <input title = "Specify Employee Retype Password..."
- type = password
- style = "WIDTH: 100px; HEIGHT: 21px"
- maxLength = 7
- align = left
- id = txtEmployeeRetypepassword
- name = txtEmployeeRetypePassword onfocusout=fnNew_Retype_Pswd()
- tabindex = 1>
- </b></font>
- </td></tr>
- <table align=center>
- <tr><td>
- <input type=submit value=Save id=Save name=Save style="width: 75px" onclick=fnPasswordSave()></td>
- <td> <input type=Reset value=Reset id=reset name=reset style="width: 75px"></td>
- <td> <input type=button value=Close id=close name=close style="width: 75px" onclick='window.close()'>
- </td></tr>
- </table>
- <?php
- function fnPasswordSave()
- {
- $code = $_GET['code'];
- $CurrentPwd = $_POST[' txtEmployeeCurrentPassword'];
- $NewPwd = $_POST['txtEmployeeNewPassword'];
- $RetypePwd = $_POST['txtEmployeeRetypePassword'];
- $dbconnect=pg_connect("host=10.10.2.12 dbname=punch_system user=postgres password=postgres") or
- die("could not connect to the database");
- $query = "update pmt_login_info set pmt19_password=$NewPwd where pmt19_emp_code='" . $code . "'";
- echo $query;
- $rs = pg_query($query) or die('Could not Open Recordset...') . pg_last_error($rs);
- if($rs)
- {
- echo "Password Updated Successfully..";
- }
- else
- {
- echo "Password Updation Unsuccessfull..";
- }
- }
- ?>
- </form>
- </body>
- </html>
any one tell me,is my code correct to save newpassword into database.but output is not grtting.please, correct the code