Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script language="text/javascript" src="validate.js"></script>
- <link rel="shortcut icon" href="images/favicon.ico">
- <link rel="icon" type="image/ico" href="favicon.ico">
- <script type="text/javascript" src="js/jquery-1.4.2.js "></script>
- <script type="text/javascript">
- $(document).ready(function(){
- //called when key is pressed in textbox
- $("#inputString").keypress(function (e)
- {
- $("#error").hide();
- $("#autoSuggestionsList").hide();
- //if the letter is not digit then display error and don't type anything
- if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57)&& (e.which<65 || e.which>90)&& (e.which<97 || e.which>122))
- {
- //display error message
- $("#error").html("No Special Characters.Only number & alphabets").show();
- return false;
- }
- });});
- function lookup(inputString) {
- if(inputString.length <5) {
- alert("Username must be geater than 5"+data);
- $('#suggestions').show();
- $('#autoSuggestionsList').hide();
- } else {
- // alert("called")
- $('#suggestions').hide();
- $.post("CheckUsername.jsp",{userId: ""+inputString+""},function(data){
- //document.getElementById('suggestions').innerHTML = data;
- $('#suggestions').html(data).show();
- });
- }
- }
- </script>
- </head>
- <body background="imagesfazer1.jpg" onload="updateClock(); setInterval('updateClock()', 1000 )">
- <form action="regdbservlet" method="post">
- <center>
- <table border="0" cellpadding="4" cellspacing="2">
- <tbody>
- <tr>
- <th bgcolor="#999966" colspan="2">
- <span style="color:#00ff00;"><font size="5">YAMAHA DEALER REGISTERATION</font></span><br />
- <hr />
- </th>
- </tr>
- <script>
- var myfont_face = "MATURASC";
- // Set the clock's font size (in point):
- var myfont_size = "14";
- // Set the clock's font color:
- var myfont_color = "#000000";
- // Set the clock's background color:
- var myback_color = "#FFFFFF";
- // Set the text to display before the clock:
- var mypre_text = "The time is: ";
- // Set the width of the clock (in pixels):
- var mywidth = 300;
- // Display the time in 24 or 12 hour time?
- // 0 = 24, 1 = 12
- var my12_hour = 1;
- // How often do you want the clock updated?
- // 0 = Never, 1 = Every Second, 2 = Every Minute
- // If you pick 0 or 2, the seconds will not be displayed
- var myupdate = 1;
- // Display the date?
- // 0 = No, 1 = Yes
- var DisplayDate = 1;
- /////////////// END CONFIGURATION /////////////////////////
- ///////////////////////////////////////////////////////////
- // Browser detect code
- var ie4=document.all
- var ns4=document.layers
- var ns6=document.getElementById&&!document.all
- // Global varibale definitions:
- var dn = "";
- var mn = "th";
- var old = "";
- // The following arrays contain data which is used in the clock's
- // date function. Feel free to change values for Days and Months
- // if needed (if you wanted abbreviated names for example).
- var DaysOfWeek = new Array(7);
- DaysOfWeek[0] = "Sunday";
- DaysOfWeek[1] = "Monday";
- DaysOfWeek[2] = "Tuesday";
- DaysOfWeek[3] = "Wednesday";
- DaysOfWeek[4] = "Thursday";
- DaysOfWeek[5] = "Friday";
- DaysOfWeek[6] = "Saturday";
- var MonthsOfYear = new Array(12);
- MonthsOfYear[0] = "January";
- MonthsOfYear[1] = "February";
- MonthsOfYear[2] = "March";
- MonthsOfYear[3] = "April";
- MonthsOfYear[4] = "May";
- MonthsOfYear[5] = "June";
- MonthsOfYear[6] = "July";
- MonthsOfYear[7] = "August";
- MonthsOfYear[8] = "September";
- MonthsOfYear[9] = "October";
- MonthsOfYear[10] = "November";
- MonthsOfYear[11] = "December";
- // This array controls how often the clock is updated,
- // based on your selection in the configuration.
- var ClockUpdate = new Array(3);
- ClockUpdate[0] = 0;
- ClockUpdate[1] = 1000;
- ClockUpdate[2] = 60000;
- // For Version 4+ browsers, write the appropriate HTML to the
- // page for the clock, otherwise, attempt to write a static
- // date to the page.
- if (ie4||ns6) { document.write('<span id="LiveClockIE" style="width:'+mywidth+'px; background-color:'+myback_color+'"></span>'); }
- else if (document.layers) { document.write('<ilayer bgColor="'+myback_color+'" id="ClockPosNS" visibility="hide"><layer width="'+mywidth+'" id="LiveClockNS"></layer></ilayer>'); }
- else { old = "true"; show_clock(); }
- // The main part of the script:
- function show_clock() {
- if (old == "die") { return; }
- //show clock in NS 4
- if (ns4)
- document.ClockPosNS.visibility="show"
- // Get all our date variables:
- var Digital = new Date();
- var day = Digital.getDay();
- var mday = Digital.getDate();
- var month = Digital.getMonth();
- var hours = Digital.getHours();
- var minutes = Digital.getMinutes();
- var seconds = Digital.getSeconds();
- // Fix the "mn" variable if needed:
- if (mday == 1) { mn = "st"; }
- else if (mday == 2) { mn = "nd"; }
- else if (mday == 3) { mn = "rd"; }
- else if (mday == 21) { mn = "st"; }
- else if (mday == 22) { mn = "nd"; }
- else if (mday == 23) { mn = "rd"; }
- else if (mday == 31) { mn = "st"; }
- // Set up the hours for either 24 or 12 hour display:
- if (my12_hour) {
- dn = "AM";
- if (hours > 12) { dn = "PM"; hours = hours - 12; }
- if (hours == 0) { hours = 12; }
- } else {
- dn = "";
- }
- if (minutes <= 9) { minutes = "0"+minutes; }
- if (seconds <= 9) { seconds = "0"+seconds; }
- // This is the actual HTML of the clock. If you're going to play around
- // with this, be careful to keep all your quotations in tact.
- myclock = '';
- myclock += '<font style="color:'+myfont_color+'; font-family:'+myfont_face+'; font-size:'+myfont_size+'pt;">';
- myclock += mypre_text;
- myclock += hours+':'+minutes;
- if ((myupdate < 2) || (myupdate == 0)) { myclock += ':'+seconds; }
- myclock += ' '+dn;
- if (DisplayDate) { myclock += ' on '+DaysOfWeek[day]+', '+mday+mn+' '+MonthsOfYear[month]; }
- myclock += '</font>';
- if (old == "true") {
- document.write(myclock);
- old = "die";
- return;
- }
- // Write the clock to the layer:
- if (ns4) {
- clockpos = document.ClockPosNS;
- liveclock = clockpos.document.LiveClockNS;
- liveclock.document.write(myclock);
- liveclock.document.close();
- } else if (ie4) {
- LiveClockIE.innerHTML = myclock;
- } else if (ns6){
- document.getElementById("LiveClockIE").innerHTML = myclock;
- }
- if (myupdate != 0) { setTimeout("show_clock()",ClockUpdate[myupdate]); }
- }
- if (myupdate != 0) { setTimeout("show_clock()",ClockUpdate[myupdate]); }
- </script>
- <tr bgcolor="#ED3BA3">
- <td valign="top">
- <span style="color:#00ffff;"><b>First Name<sup>*</sup></b></span><br />
- <input maxlength="20" name="firstname" size="15" type="text" value="" /></td>
- <td valign="top">
- <span style="color:#00ffff;"><b>Last Name<sup>*</sup></b></span><br />
- <input maxlength="20" name="surname" size="15" type="text" value="" /></td>
- </tr>
- <p><b id='boldStuff'></b> </p>
- <tr bgcolor="#ED3BA3">
- <td valign="top">
- <span style="color:#00ffff;"><b>E-Mail<sup>*</sup></b></span><br />
- <input maxlength="125" name="email" size="25" type="text" value="" onblur="mailvalidate(this)"/></td>
- <td valign="top">
- <span style="color:#00ffff;"><b>Zip Code<sup>*</sup></b></span><br />
- <input maxlength="6" name="zipcode" size="6" type="text" value="" /></td>
- </tr>
- <tr bgcolor="#ED3BA3">
- <td colspan="2" valign="top">
- <span style="color:#00ffff;"><b>User ID/Name<sup>*</sup></b></span><br />
- <input maxlength="10" name="userId" type="text" value="" id="inputString" onkeyup="lookup(this.value);"/>
- <div id="suggestions"></div></td>
- </tr>
- <tr bgcolor="#ED3BA3">
- <td valign="top">
- <span style="color:#00ffff;"><b>Password<sup>*</sup></b></span><br />
- <input maxlength="10" name="dealer_password" size="10" type="password" value="" /></td>
- <td valign="top">
- <span style="color:#00ffff;"><b>Confirm Password<sup>*</sup></b></span><br />
- <input maxlength="10" name="dealer_password1" size="10" type="password" value="" /></td>
- </tr>
- <tr bgcolor="#ED3BA3">
- <td valign="top">
- <span style="color:#00ffff;"><b>Town:<sup>*</sup></b></span><br />
- <input maxlength="10" name="town" size="10" type="text" value="" /></td>
- </tr>
- <tr bgcolor="#ED3BA3">
- <td valign="top">
- <span style="color:#00ffff;"><b>City:<sup>*</sup></b></span><br />
- <input maxlength="10" name="country" size="10" type="text" value="" /></td>
- </tr>
- <tr bgcolor="#ED3BA3">
- <td valign="top">
- <p>Please Upload ur image
- <input type="file" maxlength="" name="dealeruploadimage"/>
- <input type="submit" value="Upload" name="image_submit">
- </p>
- </td>
- </tr>
- <tr bgcolor="#ED3BA3">
- <td align="center" colspan="2">
- <hr />
- <input type="submit" value="Submit" /></td>
- </tr>
- </tbody>
- </table>
- </center>
- <p>
- </p>
- </form>
- <center>
- </center>
- </body>
- </html>
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package testing;
- import java.io.*;
- import java.sql.*;
- //import javax.servlet.*;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServlet;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- /**
- *
- * @author Admin
- */
- public class regdbservlet extends HttpServlet {
- /* private static String algorithm = "DESede";
- private static Key key = null;
- private static Cipher cipher = null;
- private static byte[] encrypt(String input)throws Exception {
- cipher.init(Cipher.ENCRYPT_MODE, key);
- byte[] inputBytes = input.getBytes();
- return cipher.doFinal(inputBytes);
- }
- */
- /**
- * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
- * @param request servlet request
- * @param response servlet response
- * @throws ServletException if a servlet-specific error occurs
- * @throws IOException if an I/O error occurs
- */
- protected void processRequest(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException, SQLException {
- /* key = KeyGenerator.getInstance(algorithm).generateKey();
- cipher = Cipher.getInstance(algorithm);*/
- response.setContentType("text/html;charset=UTF-8");
- // PrintWriter out = response.getWriter();
- String surname=request.getParameter("firstname");
- String firstname=request.getParameter("surname");
- System.out.println("Nanme"+firstname);
- String email=request.getParameter("email");
- String zipcode=request.getParameter("zipcode");
- String userId=request.getParameter("userId");
- String dealer_password=request.getParameter("dealer_password");
- String dealer_password1=request.getParameter("dealer_password1");
- String town=request.getParameter("town");
- String country=request.getParameter("country");
- //String input = dealer_password;
- //byte[] encryptionBytes = encrypt(input);
- //String passw=new String(encryptionBytes);
- String url = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=swingmail";
- String user = "sa";
- String pwd = "sa";
- Connection con=null;
- // Statement st=null;
- //ResultSet rs=null;
- try {
- Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
- con = DriverManager.getConnection(url,user,pwd);
- //String sql = "INSERT INTO memory VALUES ('" + surname + "','" + firstname + "'," + userId + ","+ zipcode +",'"+ email +"','"+ dealer_password +"','"+ town +"','"+ country +"')" ;
- String sql = "insert into Dealer_Register(firstname,lastname,email ,zipcode ,userid ,password1,password2,town ,city ) values(?,?,?,?,?,?,?,?,?)";
- PreparedStatement ps =con.prepareStatement(sql);
- int zipcode1 = Integer.parseInt(zipcode);
- ps.setString(1, firstname);
- ps.setString(2, surname);
- ps.setString(3, email);
- ps.setInt(4, zipcode1);
- ps.setString(5,userId );
- ps.setString(6, dealer_password);
- ps.setString(7, dealer_password1);
- ps.setString(8, town);
- ps.setString(9, country);
- ps.executeQuery();
- ps.close();
- con.close();
- /* out.println("<html>");
- out.println("<head>");
- out.println("<title>Servlet regdbservlet</title>");
- out.println("</head>");
- out.println("<body>");
- out.println("<h1>Servlet regdbservlet at " + request.getContextPath () + "</h1>");
- out.println("</body>");
- out.println("</html>");*/
- }
- catch(Exception cnfe){
- cnfe.printStackTrace();
- }
- finally {
- }
- }
- // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
- /**
- * Handles the HTTP <code>GET</code> method.
- * @param request servlet request
- * @param response servlet response
- * @throws ServletException if a servlet-specific error occurs
- * @throws IOException if an I/O error occurs
- */
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- try {
- processRequest(request, response);
- } catch (SQLException ex) {
- Logger.getLogger(regdbservlet.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- /**
- * Handles the HTTP <code>POST</code> method.
- * @param request servlet request
- * @param response servlet response
- * @throws ServletException if a servlet-specific error occurs
- * @throws IOException if an I/O error occurs
- */
- @Override
- protected void doPost(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- try {
- processRequest(request, response);
- } catch (SQLException ex) {
- Logger.getLogger(regdbservlet.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- /**
- * Returns a short description of the servlet.
- * @return a String containing servlet description
- */
- @Override
- public String getServletInfo() {
- return "Short description";
- }// </editor-fold>
- }
Add Comment
Please, Sign In to add comment