473,396 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

I want to save newpassword into database

Expand|Select|Wrap|Line Numbers
  1.  
  2. <html>
  3.  
  4. <head>
  5.   <style type="text/css">
  6.   h2{color:#A02820}
  7.   </style>
  8.  
  9. </head>
  10.  
  11. <script language=javascript>
  12.  function fnNew_Retype_Pswd()
  13.         {
  14.               var pass1 = document.useredit.txtEmployeeNewPassword.value;
  15.               var pass2 = document.useredit.txtEmployeeRetypePassword.value;
  16.  
  17.                  if(document.useredit.txtEmployeeNewPassword.value =="")
  18.                 {
  19.                         alert("Please Enter New Password...");
  20.                         //useredit.txtEmployeeNewPassword.focus();
  21.                         return false;
  22.                 }
  23.  
  24.                 else if(document.useredit.txtEmployeeNewPassword.value.length < 6)
  25.                 {
  26.                         alert("Your New Password Length Should Be 6 Characters...");
  27.                         return false;
  28.                 //      useredit.txtEmployeeNewPassword.value = "";
  29.  
  30.                 }
  31.  
  32.                 else  if(document.useredit.txtEmployeeRetypePassword.value =="")
  33.                 {
  34.                         alert("Please Enter Retype Password...");
  35.                         return false;
  36.                 }
  37.  
  38.                 else if(document.useredit.txtEmployeeRetypePassword.value.length < 6)
  39.                 {
  40.                         alert("Your Retype Password Length Should Be 6 Characters..."); alert("Your Retype Password Length Should Be 6 Characters...");
  41.                         useredit.txtEmployeeRetypePassword.value = "";
  42.                 }
  43.  
  44.                 else if(pass1 != pass2)
  45.                 {
  46.                         alert("Your New Password Did Not Match With The Retype Password.. ");
  47.                          event.returnValue = false;
  48.  
  49.                 }
  50.  
  51.                 function fnSave()
  52.                 {
  53.                         if( fnNew_Retype_Pswd()== false)
  54.                         {
  55.                         event.returnValue = true;
  56.                         }
  57. }
  58. <?php
  59.  
  60.  
  61.         $code = $_GET['code'];
  62.         $name = "";
  63.         $desg = "";
  64.    $weeklyoff = "";
  65.          $doj = "";
  66.  $activatedon = "";
  67. $passwordexpireson = "";
  68.  
  69.                 $dbconnect=pg_connect("host=10.10.2.12 dbname=punch_system  user=postgres password=postgres") or
  70.          die("could not connect to the database");
  71.  
  72.         $query = "select pmt19_emp_code,pmt19_activatedon,pmt19_passwordexpireon,";
  73.         $query = $query . " pmt06_emp_code,pmt06_emp_name,pmt06_desg_code,pmt06_date_of_join,";
  74.         $query = $query . " pmt06_weekly_off,pmt12_desg_code,pmt12_desg_desc";
  75.         $query = $query . " from  pmt_web_users,pmt_employee,pmt_designation ";
  76.         $query = $query . "where pmt19_emp_code=pmt06_emp_code and pmt12_desg_code=pmt06_desg_code";
  77.         $query = $query . " and  pmt19_emp_code   = '" . $code . "'";
  78.  
  79.  
  80.  
  81.          $rs = pg_query($query)
  82.                       or die('Could not Open Recordset...') . pg_last_error($rs);
  83.  
  84.  
  85.          if (pg_num_rows($rs) > 0)
  86.  {
  87.                         $row = pg_fetch_row($rs);
  88.  
  89.                         $code = $_GET['code'];
  90.                         $name = $row[4];
  91.                         $desg = $row[9];
  92.                          $doj = $row[6];
  93.                    $weeklyoff = $row[7];
  94.                  $activatedon = $row[1];
  95.            $passwordexpireson = $row[2];
  96.  
  97.                 }
  98.                  pg_free_result($rs);
  99.                  pg_close($dbconnect);
  100.  
  101. ?>
  102.  
  103.  
  104.  
  105.         <body bgcolor="#F0F0F0 ">
  106.          <h2 align=center>User Edit Information </h2>
  107.         <form name=useredit method=post action="" onsubmit=fnSave() >
  108.         <br><center>
  109.         <fieldset style='width:50%'><legend>User Edit Data</legend>
  110.         <table align=center cellspacing=2 cellpadding=2 bgcolor=FFFFCC >
  111.         <tr>
  112.           <td align=right>
  113.                  <font face="Garamond" size=3><b>
  114.                      Employee Code :
  115.                     </b></font>
  116.                     </td>
  117. <td>
  118.                      <font face="Garamond" size=2><b>
  119.                     <input  title  = "Specify Employee Code..."
  120.                          style     = "WIDTH: 100px; HEIGHT: 21px"
  121.                          maxLength = 7
  122.                          align     = left
  123.                                 id = txtEmployeeCode
  124.                          name      = txtEmployeeCode
  125.                          tabindex  = 1 readonly
  126.                          value     = "<? echo $code ?>">
  127.             </b></font> </td>
  128.  
  129.               <td align=right>
  130.                  <font face="Garamond" size=3><b>
  131.                       Employee Name :
  132.                        </b></font>
  133.                       </td>
  134.  
  135.                       <td align=left>
  136.                         <font face="Garamond" size=4><b>
  137.                          <input  title     = "Specify Employee Name..."
  138.                                  style     = "WIDTH: 100px; HEIGHT: 21px"
  139.                                  maxLength = 7
  140.                                  align     = left
  141.                                  id        = txtEmployeeName
  142.                                  name      = txtEmployeeName
  143.                                  tabindex  = 1 readonly
  144.                                  value     = "<? echo $name ?>">
  145.              </b></font> </td></tr>
  146.  <tr>
  147.            <td align=right>
  148.             <font face="Garamond" size=3><b>
  149.                Employee Desig:
  150.            </b></font> </td>
  151.  
  152.             <td align=right>
  153.                 <font face="Garamond" size=4><b>
  154.                 <input  title     = "Specify Employee Desig..."
  155.                         style     = "WIDTH: 100px; HEIGHT: 21px"
  156.                         maxLength = 7
  157.                         align     = left
  158.                         id        = txtEmployeeDesig
  159.                         name      = txtEmployeeDesig
  160.                         tabindex  = 1 readonly
  161.                         value     = "<? echo $desg?>">
  162.               </b></font> </td>
  163.  
  164.          <td align=right>
  165.              <font face="Garamond" size=3><b>
  166.                   Weeklyoff:
  167.                  </b></font> </td>
  168.  
  169.                   <td align=left>
  170.                       <font face="Garamond" size=4><b>
  171.                       <input  title     = "Specify Employee WeeklyOff..."
  172.                               style     = "WIDTH: 100px; HEIGHT: 21px"
  173.                               maxLength = 7
  174.                               align     = left
  175.                               id        = txtEmployeeWeeklyOff
  176.  name      = txtEmployeeWeeklyOff
  177.                               tabindex  = 1 readonly
  178.                               value     = "<?
  179.  
  180.                                                       if($weeklyoff == 1)
  181.                                                         {
  182.                                                         $weeklyoff = "Sunday";
  183.                                                         }
  184.                                                 else if($weeklyoff == 2)
  185.                                                         {
  186.                                                         $weeklyoff = "Monday";
  187.                                                         }
  188.                                                 else if($weeklyoff == 3)
  189.                                                         {
  190.                                                         $weeklyoff = "Tuesday";
  191.                                                         }
  192.                                                 else if($weeklyoff == 4)
  193.                                                         {
  194.                                                         $weeklyoff = "Wednesday";
  195.                                                         }
  196.                                                 else if($weeklyoff == 5)
  197.                                                         {
  198.                                                         $weeklyoff = "Thursday";
  199.                                                         }
  200.                                                 else if($weeklyoff == 6)
  201.                                                         {
  202.                                                         $weeklyoff = "Friday";
  203.                                                         }
  204.  
  205.                                                 else if($weeklyoff == 7)
  206.                                                         {
  207.  $weeklyoff = "Saturday";
  208.                                                         }
  209.  
  210.                                          echo $weeklyoff ?>">
  211.         </b></font> </td> </tr>
  212.  
  213.                  <tr><td><hr></td><td><hr></td><td><hr></td><td><hr></td></tr>
  214. <!--<HR NOSHADE="NOSHADE">-->
  215.         <tr>
  216.            <td align=right>
  217.               <font face="Garamond" size=3><b>
  218.                    Doj:
  219.                 </b></font></td>
  220.  
  221.                <td>
  222.                    <font face="Garamond" size=4><b>
  223.                        <input  title     = "Specify Employee Doj..."
  224.                                style     = "WIDTH: 100px; HEIGHT: 21px"
  225.                                maxLength = 7
  226.                                align     = left
  227.                                id        = txtEmployeeDoj
  228.                                name      = txtEmployeeDoj
  229.                                tabindex  = 1 readonly
  230.                                value     = "<? echo $doj ?>">
  231.                   </b></font> </td>
  232.  
  233.  
  234.         <td align=right> <font face="Garamond" size=3><b>
  235.                   Role:
  236.                     </b></font>
  237.           </td>
  238.  </td>
  239.  
  240.  
  241.         <td>
  242.     <select id=Role name=Role style="width: 100px"><option>[Select One]</option><?php fnRoles(); ?></select></td>
  243.        </tr>
  244.  
  245.  
  246.         <tr>
  247.                 <td align=left>
  248.                  <font face="Garamond" size=3><b>
  249.                    Current Password:
  250.                   </b></font> </td>
  251.  
  252.           <td>
  253.            <font face="Garamond" size=4><b>
  254.              <input  title     = "Specify Employee Current Password..."
  255.                      type      = password
  256.                      style     = "WIDTH: 100px; HEIGHT: 21px"
  257.                      maxLength = 7
  258.                      align     = left
  259.                      id        = txtEmployeeCurrentpassword
  260.                      name      = txtEmployeeCurrentPassword
  261.                      tabindex  = 1>
  262.                </b></font></td>
  263.  
  264.  
  265.          <td align=right> <font face="Garamond" size=3><b>
  266.                  Valid Compinies:
  267.                    </b></font> </td>
  268. <td>
  269.         <select name="ValidCompinies" id="Select1" size="4" multiple="multiple"
  270.          style="width: 180px"><option>[Select-One]</option><?php fnValidCompinies(); ?></select></tr>
  271.  
  272.         <tr>
  273.          <td align=right>
  274.            <font face="Garamond" size=3><b>
  275.                    New Password:
  276.                    </b></font> </td>
  277.  
  278.           <td>
  279.             <font face="Garamond" size=4><b>
  280.              <input  title     = "Specify Employee New Password..."
  281.                          type  = password
  282.                      style     = "WIDTH: 100px; HEIGHT: 21px"
  283.                      maxLength = 7
  284.                      align     = left
  285.                     id         = txtEmployeeNewpassword
  286.                      name      = txtEmployeeNewPassword
  287.                      tabindex  = 1 onfocusout=fnNew_Retype_Pswd() >
  288.                  </b></font>
  289.             </td></tr>
  290.  
  291.                 <tr>
  292.                    <td>
  293.                    <font face="Garamond" size=3><b>
  294.                          Retype Password:
  295.                        </b></font>
  296. <td>
  297.                     <font face="Garamond" size=4><b>
  298.                        <input  title     = "Specify Employee Retype Password..."
  299.                                type      = password
  300.                                style     = "WIDTH: 100px; HEIGHT: 21px"
  301.                                maxLength = 7
  302.                                align     = left
  303.                                id        = txtEmployeeRetypepassword
  304.                                name      = txtEmployeeRetypePassword onfocusout=fnNew_Retype_Pswd()
  305.                                tabindex  = 1>
  306.                         </b></font>
  307.                   </td></tr>
  308. <table align=center>
  309.         <tr><td>
  310.     <input type=submit value=Save id=Save name=Save style="width: 75px" onclick=fnPasswordSave()></td>
  311.         <td> <input type=Reset value=Reset id=reset name=reset style="width: 75px"></td>
  312.  
  313.          <td> <input type=button value=Close id=close name=close style="width: 75px" onclick='window.close()'>
  314.         </td></tr>
  315.         </table>
  316. <?php
  317.   function fnPasswordSave()
  318.          {
  319.  
  320.                        $code = $_GET['code'];
  321.                  $CurrentPwd = $_POST[' txtEmployeeCurrentPassword'];
  322.                  $NewPwd     = $_POST['txtEmployeeNewPassword'];
  323.                  $RetypePwd  = $_POST['txtEmployeeRetypePassword'];
  324.  
  325.          $dbconnect=pg_connect("host=10.10.2.12 dbname=punch_system  user=postgres password=postgres") or
  326.                  die("could not connect to the database");
  327.  
  328.  
  329.         $query = "update pmt_login_info set pmt19_password=$NewPwd where  pmt19_emp_code='" . $code . "'";
  330.                 echo $query;
  331.  
  332.                 $rs = pg_query($query) or die('Could not Open Recordset...') . pg_last_error($rs);
  333. if($rs)
  334.         {
  335.                 echo "Password Updated Successfully..";
  336.         }
  337.         else
  338.          {
  339.                 echo "Password Updation Unsuccessfull..";
  340.          }
  341.  
  342.         }
  343.  
  344.  
  345. ?>
  346. </form>
  347. </body>
  348. </html>

any one tell me,is my code correct to save newpassword into database.but output is not grtting.please,correct the code
Aug 5 '09 #1
1 2265
dlite922
1,584 Expert 1GB
are you getting any errors?
What have you done to debug so far? I can't run your code on my computer so you have to do some debugging and narrow down the issue.

Your SQL password field value does not have quotes around it. Put some quotes around that as well. You should be getting a SQL error though.



Dan
Aug 5 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Andras Gilicz | last post by:
Hi VB fans I'm working on a relatively large project in VB6 with about a dozen forms, including graphs, labels, text boxes, etc. The software itself is actually a flow simulator with more or...
7
by: joseph.inglis | last post by:
I have a web browser object on a form which I have set to edit mode and use the UCOMIConnectionPointContainer interface to hook in and catch events. All working sweetly. Except there...
7
by: Shanli RICHEZ | last post by:
I'm using ASP.NET and quite a lot of object in memory instead of a database. The question is that I tried to save the data, serialize them in a XML file to save them when the application is...
3
by: teedilo | last post by:
Our MS SQL (SQL Server 2000) DBA has database privileges locked down pretty tightly. We end users/developers do not have administrator privileges for most databases. That arrangement has worked...
4
by: xAvailx | last post by:
Hello: I didn't find any documentation that notes save point names are case sensitive, but I guess they are... Stored Proc to reproduce: /* START CODE SNIPPET */ If Exists (Select * From...
9
by: Chester | last post by:
I'm working on an app that records data collected by service technicians (VB.Net front-end, SQL Server 2000 back end). The technicians need to record numbers with varying scale and precision. For...
6
by: Josetta | last post by:
Access 2003 I've been experiencing some problems with my "monster" database the last couple of days. I imported all objects into a new database yesterday, which pretty much stopped the crashing...
1
by: TonyJ | last post by:
Hello! I'm using VS2005. I'm looking at ADO.NET and have found some test tutorial solution on microsoft MSDN. The one that I'm looking at now is called Walkthrough: Saving Data to a Database...
1
by: somnamblst | last post by:
I have a Flash form that uses ASP to write to Access db. I have an HTML form that uses ASP to upload files and email those files and sends copies to recipients based on the form fields. I would like...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.