473,789 Members | 3,096 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I want to save newpassword into database

10 New Member
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 2281
dlite922
1,584 Recognized Expert Top Contributor
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
25031
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 less complex technical calculations, several input variables. I would like to equipp the starting panel with the usual New, Open, Save, Save As, Close etc. menus (like in Excel, or Word, etc.) What is the best way to accomplish Save, or Save As?...
7
3704
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 are instances where i rewrite the Document.Content and the
7
1272
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 ending. event : Application_End in Global.asax. But the object are not accesible from there so I can't save them. Any idea ???
3
10692
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 out OK for the most part. However, it's a bit aggravating that we can't even create our own database diagrams. When we attempt to do so (in Enterprise Manager), we get a dialog that says "You do not have sufficient privilege to create a new...
4
9184
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 sysobjects Where Type = 'P' and Name =
9
8656
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 example, they may record one reading as 63.45 and the next as 123.1 and a third as 1.32456. That's fine - those can be saved as floating point numbers (very little math is done with these numbers so I'm not too worried about strange floating...
6
4143
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 problems, but here's something weird: Whenever I copy an object (reports so far), I am able to open it and make changes, but when I try to save it (without closing), it appears to save (message box goes off), but it doesn't. Then, if I try to...
1
2617
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 (Single Table) I have followed the walkthrought exectly but it doesn't work as expected.
1
2664
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 to also save all this data to an Access db and have created one that has all the same field names. I have copied my working SQL statement, modified with correct fields for new db and appended it to the bottom of my existing ASP email script. Good...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10199
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9020
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6768
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4092
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3697
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.