Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. help me please

help me please

Scheduled Pinned Locked Moved JavaScript
javascriptphphtmldatabasedesign
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nth92
    wrote on last edited by
    #1

    please help me to write ... A) Write the code for the login.html document (Client side) which gives the following interface. When the user clicks on the button you must check if the user enters data or not, if the fields are empty you must present an alert message and do not send the data to the server side. If the user entered login and password, then your program must call the validate.php document. B) Write the code of the server side validate.php page such that. 1) The validate.php checks if the login is valid or not. A valid login must start with a letter and followed by any one or more of the characters:_, 0-9, A-Z, a-z For instance, a1, ab_1, and Z_2d are valid logins while _a1, b*, and c23_@2 are invalid logins. But, there are no restrictions on the password; the user can use any character in the keyboard. (hint. You must use the regular expression in php). 2) The validate.php page reads the login and passwords from a database named"students" to verify whether the student is a valid user. The "students" database contains two tables named "login_pssword" and “marks”. The login_pssword table has three fields “Student_Id”,"login" and"password”. Check if the user name and passwords exist. If it exists print the message "Thank you for logging in". If the password or login is not in the database, display the alert message "wrongpassword and/or login please try again". The “marks” table has five fields: student_Id, course_name, first_mark, second_mark, Final_mark. 3)if a valid user logged in, give him/her two choices: 1. Add a new student 2. Remove a student Design two different forms, one for each choice above to enable the student to perform the choice he/she selected. the header code :-

    <html> <head> <script type = "text/javascript">
    Function validate(){
    Winow.event.returnvalue = false;
    If ((f1.login.value == "") || (f1.password.value ==""))
    alert("you must enter your name and password");
    else
    window.event.returnvalue = true;
    }
    </script> </head> <body>
    <form id ="f1" action = "validate.php" method = "post" onsubmit ="validate()">
    User Name <input type ="text" name = "login"/> <br />
    Password <input type ="password" name ="password"/> <br />
    <in

    L 1 Reply Last reply
    0
    • N nth92

      please help me to write ... A) Write the code for the login.html document (Client side) which gives the following interface. When the user clicks on the button you must check if the user enters data or not, if the fields are empty you must present an alert message and do not send the data to the server side. If the user entered login and password, then your program must call the validate.php document. B) Write the code of the server side validate.php page such that. 1) The validate.php checks if the login is valid or not. A valid login must start with a letter and followed by any one or more of the characters:_, 0-9, A-Z, a-z For instance, a1, ab_1, and Z_2d are valid logins while _a1, b*, and c23_@2 are invalid logins. But, there are no restrictions on the password; the user can use any character in the keyboard. (hint. You must use the regular expression in php). 2) The validate.php page reads the login and passwords from a database named"students" to verify whether the student is a valid user. The "students" database contains two tables named "login_pssword" and “marks”. The login_pssword table has three fields “Student_Id”,"login" and"password”. Check if the user name and passwords exist. If it exists print the message "Thank you for logging in". If the password or login is not in the database, display the alert message "wrongpassword and/or login please try again". The “marks” table has five fields: student_Id, course_name, first_mark, second_mark, Final_mark. 3)if a valid user logged in, give him/her two choices: 1. Add a new student 2. Remove a student Design two different forms, one for each choice above to enable the student to perform the choice he/she selected. the header code :-

      <html> <head> <script type = "text/javascript">
      Function validate(){
      Winow.event.returnvalue = false;
      If ((f1.login.value == "") || (f1.password.value ==""))
      alert("you must enter your name and password");
      else
      window.event.returnvalue = true;
      }
      </script> </head> <body>
      <form id ="f1" action = "validate.php" method = "post" onsubmit ="validate()">
      User Name <input type ="text" name = "login"/> <br />
      Password <input type ="password" name ="password"/> <br />
      <in

      L Offline
      L Offline
      Leon Munir
      wrote on last edited by
      #2

      Here is the complete code without ajax functionality. You didn't mention in the question if you wanted to display result without loading the php page.The login.html could looks like this:

      </pre>
      <pre lang="Javascript">function validate(){
      if((f1.login.value == "") || (f1.password.value == ""))
      {
      alert("you must enter your name and password");
      return false;
      }
      else
      {
      return true;
      }
      }</pre>
      <pre lang="HTML">

      User Name
      Password

      The validate.php could look like this:

      Add a new student
      Remove a student";
      }
      else
      {
      // GO BACK link
      echo "GO BACK";
      // javascript displays message
      echo "alert(\"wrongpassword and/or login please try again\");";
      }
      }
      }
      ?>

      Hope it answers your question :)

      follow me on twitter @leon_developer

      J N 2 Replies Last reply
      0
      • L Leon Munir

        Here is the complete code without ajax functionality. You didn't mention in the question if you wanted to display result without loading the php page.The login.html could looks like this:

        </pre>
        <pre lang="Javascript">function validate(){
        if((f1.login.value == "") || (f1.password.value == ""))
        {
        alert("you must enter your name and password");
        return false;
        }
        else
        {
        return true;
        }
        }</pre>
        <pre lang="HTML">

        User Name
        Password

        The validate.php could look like this:

        Add a new student
        Remove a student";
        }
        else
        {
        // GO BACK link
        echo "GO BACK";
        // javascript displays message
        echo "alert(\"wrongpassword and/or login please try again\");";
        }
        }
        }
        ?>

        Hope it answers your question :)

        follow me on twitter @leon_developer

        J Offline
        J Offline
        J4amieC
        wrote on last edited by
        #3

        Well done, you just did this guy's homework for him. Or worse, this guy is actually a paid programmer and you just did his work for which he's getting paid.

        L 2 Replies Last reply
        0
        • J J4amieC

          Well done, you just did this guy's homework for him. Or worse, this guy is actually a paid programmer and you just did his work for which he's getting paid.

          L Offline
          L Offline
          Leon Munir
          wrote on last edited by
          #4

          This is a community forum and I am here help and answer questions. :| Please refrain from posting such comments.:mad:

          1 Reply Last reply
          0
          • J J4amieC

            Well done, you just did this guy's homework for him. Or worse, this guy is actually a paid programmer and you just did his work for which he's getting paid.

            L Offline
            L Offline
            Leon Munir
            wrote on last edited by
            #5

            :confused:I am new here.How else should I answer questions?

            J F 2 Replies Last reply
            0
            • L Leon Munir

              :confused:I am new here.How else should I answer questions?

              J Offline
              J Offline
              J4amieC
              wrote on last edited by
              #6

              Look for ones which are BLATANT homework or "send me codez im clueless", and move on to the next one.

              1 Reply Last reply
              0
              • L Leon Munir

                :confused:I am new here.How else should I answer questions?

                F Offline
                F Offline
                fjdiewornncalwe
                wrote on last edited by
                #7

                Being new here and with good knowledge to help people is great and we welcome you to the community. Like mentioned already by Jamie, we don't like blatant homework answers to be answered with complete code answers like you gave here. The reason is that we want the students who come here for help to learn how to develop things properly. No one learns anything when a blatant gimme-codez homework question is answered in full as you have. The OP is simply going to copy/paste your solution as their homework solution, get the marks, and learn nothing about the process of arriving at that solution. If you are already a professional developer, would you like to hire this individual to work with/for you? I doubt it and I know I don't want to. The way to answer questions like this if you feel so compelled is to lead them down the right path to a solution while still getting them to make the decisions and write the code necessary. That way every one is a winner. Again, cheers and welcome to CP.

                I wasn't, now I am, then I won't be anymore.

                1 Reply Last reply
                0
                • L Leon Munir

                  Here is the complete code without ajax functionality. You didn't mention in the question if you wanted to display result without loading the php page.The login.html could looks like this:

                  </pre>
                  <pre lang="Javascript">function validate(){
                  if((f1.login.value == "") || (f1.password.value == ""))
                  {
                  alert("you must enter your name and password");
                  return false;
                  }
                  else
                  {
                  return true;
                  }
                  }</pre>
                  <pre lang="HTML">

                  User Name
                  Password

                  The validate.php could look like this:

                  Add a new student
                  Remove a student";
                  }
                  else
                  {
                  // GO BACK link
                  echo "GO BACK";
                  // javascript displays message
                  echo "alert(\"wrongpassword and/or login please try again\");";
                  }
                  }
                  }
                  ?>

                  Hope it answers your question :)

                  follow me on twitter @leon_developer

                  N Offline
                  N Offline
                  nth92
                  wrote on last edited by
                  #8

                  Leon Munir ... thanks 4 u

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups