Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ page contentType="text/html; charset=utf-8" %>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <jsp:useBean id="db" class = "JDBC.ForDataBase"/>
- <!-- equals to "JDBC.ForDataBase db=new JDBC.ForDataBase()" -->
- <html lang="he" dir="rtl">
- <head>
- <title>הרשמה לאתר</title>
- <meta http-equiv="Content-Type" content="text/html; charset=windows-1255" />
- <link rel="stylesheet" href="style.css" type="text/css" media="screen"/>
- <link rel="shortcut icon" href="images/favicon.ico" />
- <script language="JavaScript">
- function check()
- {
- msg = "";
- fullname = document.rishum.fullname.value;
- if(fullname.length == 0)
- {
- msg = msg + "חסר שם מלא \n";
- alert("חסר שם מלא \n");
- }
- email = document.rishum.email.value;
- if(email.length == 0)
- {
- msg = msg + "חסר אי מייל \n";
- alert("חסר אי מייל \n");
- }
- else
- {
- if(email.length < 4)
- {
- msg = msg + "אי מייל פחות מארבע אותיות \n";
- alert("אי מייל פחות מארבע אותיות \n");
- }
- }
- if(email.indexOf("@") < 0)
- {
- msg = msg + "חסר שטורדל בדואר אלקטרוני \n";
- alert("חסר שטורדל בדואר אלקטרוני \n");
- }
- if(email.indexOf(".") < 0)
- {
- msg = msg + "חסר נקודה בדואר אלקטרוני \n";
- alert("חסר נקודה בדואר אלקטרוני \n");
- }
- username = document.rishum.username.value;
- if(username.length < 4)
- {
- msg = msg + "שם משתמש לא חוקי \n";
- alert("שם משתמש לא חוקי \n");
- }
- password = document.rishum.password.value;
- password2 = document.rishum.password2.value;
- if(password.length == 0)
- {
- msg = msg + "חסרה סיסמה \n";
- alert("חסרה סיסמה \n");
- }
- else
- {
- if(password!=password2)
- {
- msg = msg + "סיסמה שונה מאימות סיסמה \n";
- alert("סיסמה שונה מאימות סיסמה \n");
- }
- }
- if(msg.length == 0)
- return true;
- else
- {
- alert("- - - בטופס נמצאו הבעיות הבאות - - - \n\n" + msg);
- return false;
- }
- }
- </script>
- </head>
- <body>
- <div id="container">
- <jsp:include page="navbar.jsp"></jsp:include>
- <%
- if (session.getAttribute("status").equals("error"))
- {
- %>
- <p>
- שם משתמש או הדואר האלקטרוני קיימים במערכת
- </p>
- <%
- }
- %>
- <%
- <form name="rishum" method="post" onsubmit="return check()" action="register.jsp">
- <table>
- <tr>
- <td class="input">שם מלא: </td>
- <td><input type="text" size="30" id="fullname" name="fullname"></td>
- </tr>
- <tr>
- <td class="input">שם משתמש: </td>
- <td><input type="text" size="30" id="username" name="username"></td>
- </tr>
- <br>
- <tr>
- <td class="input">דואר אלקטרוני: </td>
- <td><input type="text" size="30" id="email" name="email"></td>
- </tr>
- <br>
- <tr>
- <td class="input">סיסמא: </td>
- <td><input type="password" size="30" id="password" name="password"></td>
- </tr>
- <br>
- <tr>
- <td class="input">וודא סיסמא: </td>
- <td><input type="password" size="30" id="password2" name="password2"></td>
- </tr>
- <br><br>
- </table>
- <center>
- <table>
- <tr>
- <td><input type="submit" name="reg" value="שלח"></td>
- <td><input type="reset" name="res" value="אפס"></td>
- </tr>
- </table>
- </center>
- </div>
- </form>
- %>
- <%
- if(request.getMethod().equals("POST"))
- {
- String fullname=request.getParameter("fullname");
- String email=request.getParameter("email");
- String username=request.getParameter("username");
- String password=request.getParameter("password");
- String[][] ucheck=db.select("select * from members where username='"+username+"'");
- String[][] echeck=db.select("select * from members where email='"+email+"'");
- if ((ucheck==null || ucheck.length==0) && (echeck==null || echeck.length==0))
- {
- db.insertUpdateDelete("insert into members values( '"
- +fullname+ "'," +
- " '"+email+"'," +
- "'"+ username+"'," +
- "'"+ password +"')");
- session.setAttribute("status","guest");
- response.sendRedirect("login.jsp");
- }
- else
- {
- session.setAttribute("status","error");
- response.sendRedirect("register.jsp");
- }
- }
- %>
- </body>
- </html>
Add Comment
Please, Sign In to add comment