---- login.html --------
·Î°íÀÎȸé
ID : [ ]
¾ÏÈ£ : [ ]
[·Î°íÀÎ] [Ãë¼Ò]
-µî·ÏÀ» ÇϽÅÈÄ »ç¿ë°¡´É
-»ç¿ëÀÚ°èÁ¤»èÁ¦
-µî·ÏµÈ »ç¿ëÀÚ ¸ðµÎº¸±â
-----------------------
---- loginCheck.jsp----------
[idÁ¸Àç].................no-¿¡·¯
Y :
[ºñ¹Ð¹øÈ£ÀÏÄ¡]........no-¿¡·¯
Y :
[welcome.jspÀ̵¿]
----------------------------
--- registration.html---------
»ç¿ëÀÚµî·Ïȸé
À̸§ : [ ] ///name
ID : [ ] ///id
E - mail : [ ] ///email
¾Ï È£: [ ] ///pass1
¾ÏȣȮÀÎ: [ ] ///pass2
µåµð¾î¿Ï¼º Login 2004 12 03 ¾ÆÈÞ
¢Ì jsp·Î ·Î±×ÀÎ ÀÛ¼ºÇϱâ - ¾ÆÈÞ µåµð¾î¿Ï¼º **************** ³²ÀÌ ¹æ¸í·Ï¿Ï¼ºÇÒ ¶§, °Ü¿ì ·Î°íÀÎÀ» ¿Ï¼ºÇÏ¿´µµ´Ù ¾ÆÈÞ~
¢ºMYsql¿¡¼ Å×ÀÔºí¸íº¸±â -user Å×À̺í¸í--------------- Microsoft Windows 2000 [Version 5.00.2195] (C) Copyright 1985-2000 Microsoft Corp.
C:\Documents and Settings\Administrator>mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 to server version: 4.0.22-nt
Type help; or \h for help. Type \c to clear the buffer.
mysql> exit Bye
C:\Documents and Settings\Administrator> C:\Documents and Settings\Administrator>cd mysql -u root ÁöÁ¤µÈ °æ·Î¸¦ ãÀ» ¼ö ¾ø½À´Ï´Ù.
C:\Documents and Settings\Administrator>cd mysql -u root -p ÁöÁ¤µÈ °æ·Î¸¦ ãÀ» ¼ö ¾ø½À´Ï´Ù.
C:\Documents and Settings\Administrator>cd ..
C:\Documents and Settings>cd ..
C:\>cd \mysql -u root -p ÁöÁ¤µÈ °æ·Î¸¦ ãÀ» ¼ö ¾ø½À´Ï´Ù.
C:\>cd \mysql\bin
C:\mysql\bin>mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 43 to server version: 4.0.22-nt
Type help; or \h for help. Type \c to clear the buffer.
mysql> use mysql Database changed mysql> show tables; +-----------------+ | Tables_in_mysql | +-----------------+ | bbs | | bbs1 | | bbs2 | | columns_priv | | customer | | db | | func | | host | | orders | | procuct | | settest | | tables_priv | | test5 | | test6 | | test7 | | test8 | | ttt | | user | +-----------------+ 18 rows in set (0.04 sec)
mysql> use JspTestDB; Database changed mysql> \s -------------- mysql Ver 12.22 Distrib 4.0.22, for Win95/Win98 (i32)
Connection id: 43 Current database: jsptestdb Current user: root@localhost SSL: Not in use Server version: 4.0.22-nt Protocol version: 10 Connection: localhost via TCP/IP Client characterset: latin1 Server characterset: latin1 TCP port: 3306 Uptime: 2 hours 51 min 38 sec
Threads: 2 Questions: 2262 Slow queries: 0 Opens: 13 Flush tables: 1 Open tables: 0 Queries per second vg: 0.220 --------------
mysql> create table guestreply(replynum int(10) auto_increment primary key, seg int(10), replyname varchar(20 , erplycontet text, replydate varchar(10), peplypassword varchar(10)); Query OK, 0 rows affected (0.06 sec)
mysql> desk user -> ; ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server ver ion for the right syntax to use near desk user at line 1 mysql> desk user; ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server ver ion for the right syntax to use near desk user at line 1 mysql> show tables; +---------------------+ | Tables_in_jsptestdb | +---------------------+ | guestbook | | guestreply | | memo | | starcraft | | user | +---------------------+ 5 rows in set (0.04 sec)
mysql> show user; ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server ver ion for the right syntax to use near user at line 1 mysql> show table user; ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server ver ion for the right syntax to use near user at line 1
********************************************************* mysql> select * from user; +---------+-----------+-------------+----------+--------------+ | user_id | user_name | user_email | user_psw | user_regdate | +---------+-----------+-------------+----------+--------------+ | dd | dd | dd@. | 11 | 2004/12/03 | | anne | ÇÑ±Û | abc@abc.com | 1 | 2004/12/03 | +---------+-----------+-------------+----------+--------------+ 2 rows in set (0.00 sec) ***********************************************************
mysql>
111111111111111111111111111111111111111 ***ÆÄÀϸí : user.sql*** create table user ( user_id varchar(10) primary key, user_name varchar(20), user_email varchar(50), user_psw varchar(10), user_regdate varchar(10) ); 222222222222222222222222222222222222222 ***ÆÄÀϸí : db.jsp*** <% String drivers=org.gjt.mm.mysql.Driver; String dbhost=jdbc:mysql://localhost:3306/JspTestDB; String dbuser=
oot; String dbpassword=\; try { Class.forName(drivers).newInstance(); }catch (ClassNotFoundException e){out.println(e);} %> 333333333333333333333333333333333333333 ÆÄÀϸí :login.html <html> <head> <!-- header - edit Data/yourHtmlHeader to customize --> <!-- contents - edit EventHandlers/Html file/onCreate to customize --> <title>login.html </title>
</head> <body> <center> <h1>·Î°íÀΠȸé</h1> <p> <hr> <form method=post action=loginCheck.jsp> <table> <tr> <td>id:</td> <td><input type=text name=id></td> </tr> <tr> <td>¾ÏÈ£:</td> <td><input type=password name=pass></td> </tr> <tr> <td colspan=2><center> <input type=submit value=·Î°íÀÎ> <input type=reset value=Ãë¼Ò></center></td> </tr> </table> </form> <p> <hr> <table> <tr bgcolor=silver><td><font color=white>:<a href=registration.html>µî·Ï</a>À» ÇϽÅÈÄ »ç¿ë ÇÒ ¼ö ÀÖ½À´Ï´Ù.</font></td></tr> <tr bgcolor=silver><td><font color=white>:»ç¿ëÀÚ °èÁ¤<a href=delete.html>»èÀç</a></font></td></tr> <tr bgcolor=silver><td><font color=white>:µî·ÏµÈ »ç¿ëÀÚ<a href=show.jsp>¸ðµÎº¸±â</a></font></td></tr> </table> </center> </body> </html>
444444444444444444444444444444444444444 ***ÆÄÀϸí :loginCheck.jsp*** <!--logoinCheck.jsp--> <%@ include file=db.jsp\%> <%@ page language=java import=java.sql.*,java.io.*,java.text.*,java.util.* contentType= ext/html; charset=EUC-KR\%>
<html> <head><title>loginCheck.jsp</title></head> Å×½ºÆ® <body> <center> <h2>·Î±×ÀΠüũ</h2> <p> <hr> <p> <% Connection con=null; Statement stmt=null; ResultSet rs=null;
String id=request.getParameter(id).trim(); String pass = request.getParameter(pass).trim(); if(id.length()==0){ out.println(<font color=red>ID¸¦ ÀÔ·ÂÇØ ÁÖ»õ¿ä!</font>); out.println(<p><hr><p>); out.println(<a href=login.html><font color=blue>·Î±×ÀΠȸéÀ¸·Î µ¹¾Æ°¡±â</font></a>); return; } if(pass.length()==0){ out.println(<font color=red>password¸¦ ÀÔ·ÂÇØ ÁÖ»õ¿ä!</font>); out.println(<br>); out.println(<p><hr><p>); out.println(<a href=login.html><font color=blue>·Î±×ÀΠȸéÀ¸·Î µ¹¾Æ°¡±â</font></a>); return; } try{ con=DriverManager.getConnection(dbhost, dbuser, dbpassword); stmt=con.createStatement(); rs=stmt.executeQuery(select user_id, user_psw from User where user_id=\+id+\); if(rs.next()) { String db_id=rs.getString(1); String db_psw=rs.getString(2); //out.println(DB:+db_id+,+db_psw); if(db_psw.equals(pass)) { response.sendRedirect(welcome.jsp?id=+id); } else { out.println(<font color=red>password°¡ Ʋ¸³´Ï´Ù. ´Ù½ÃÈ®ÀÎÇØÁֽʽÿä.!!</font>); out.println(<a href=login.html>·Î±×ÀÎÇϱâ</a>); out.println(<p><hr><p>); return; } } else { out.println(<font color=red>Password°¡ Ʋ¸³´Ï´Ù. ´Ù½Ã È®ÀÎÇØ Áֽʽÿä!</font>); out.println(<p><hr><p>); out.println(<a href=registration.html>»ç¿ëÀÚ µî·ÏÇϱâ</a>); } } catch(Exception e) { System.out.println(e); //System.»ý·«°¡´É } %> </body> </html> 555555555555555555555555555555555555555 ***ÆÄÀϸí : registration.html
<html> <head> <title>registration.html</title>
</head> <body> <center> <h1>»ç¿ëÀÚ µî·Ïȸé</h1><p> <hr> <form method=post action=regConform.jsp> <table> <tr> <td>*À̸§:</td> <td><input type=text name=
ame></td> </tr> <tr> <td>*ID(ÃÖ´ë10):</td> <td><input type=text name=id size=10></td> </tr> <tr> <td>*E-mail:</td> <td><input type=text name=email size=30></td> </tr> <tr> <td>*¾ÏÈ£(ÃÖ´ë10):</td> <td><input type=password name=pass1 size=10></td> </tr> <tr> <td>*¾ÏȣȮÀÎ(ÃÖ´ë10):</td> <td><input type=password name=pass2 size=10></td> </tr> <tr> <td colspan=2><center> <input type=submit value=µî·ÏÇϱâ> <input type=reset value=Ãë¼Ò></center></td> </tr> </table> </from> <p> <hr> <a href=show.jsp><font color=blue>³»¿ëÀúÀåÈ®ÀÎ</font></a> </center>
</body> </html>
666666666666666666666666666666666666666 ***ÆÄÀϸí : welcome.jsp <!--welcome.jsp-->
<%@ page contentType= ext/html;charset=EUC-KR\%>
<html> <head> <title>Welcome.jsp</title> </head> <body bgcolor=white text=lack link=lue vlink=purple alink=
ed> <center> <h2>ȯ¿µÇÕ´Ï´Ù.</h2> <p><hr><%=request.getParameter(id)%>´ÔÀÇ ·Î±×ÀÎÀ» ȯ¿µÇÕ´Ï´Ù.</hr></p> </center> </body> </html> 777777777777777777777777777777777777777 ÆÄÀϸí : show.jsp <!--show.jsp--> <%@ include file=db.jsp\%> <%@ page language=java import=java.sql.*,java.io.*,java.text.*,java.util.* contentType= ext/html;charset = EUC-KR\%>
<html> <head><title>Àüüº¸±â</title></head> <body> <center><h2>µî·Ï »ç¿ëÀÚ ¸í´Ü</h2></center> <% Connection con=null; Statement stmt=null; ResultSet rs=null; try{ con=DriverManager.getConnection(dbhost, dbuser, dbpassword); stmt=con.createStatement(); rs=stmt.executeQuery(select user_id, user_name, user_email, user_regdate from User); %> <center> <table width=70%> <tr bgcolor=gray><th>¼ø¼</th><th>ID</th><th>À̸§</th><th>À̸ÞÀÏ</th><th>µî·ÏÀÏ</th></tr> <% int cnt=0; while(rs.next()) { String id=rs.getString(1); String name=rs.getString(2); String email=rs.getString(3); String regdate=rs.getString(4); %> <tr> <td align=center><%=Integer.toString(++cnt)%></td> <td><font color=blue><%=id %></font></td> <td><font color=blue><%=name %></font></td> <td><font color=blue><%=email %></font></td> <td><font color=blue><%=regdate %></font></td> </tr> <%}%> </table> <table width=70%> <tr bgcolor=gray> <td align=right><font color=white>°Ë»ö°Ç¼ö: ÃÑ <b><%=cnt%></b>°Ç</font> </td> </tr> </table> </center> <% }catch(Exception e) { System.out.println(e); } %> </body> </html> 888888888888888888888888888888888888888 ***ÆÄÀϸí : regConform.jsp*** <!--regConform.jsp--> <%@ include file=db.jsp\%> <%@ page language=java import=java.sql.*,java.io.*,java.text.*,java.util.* contentType= ext/html;charset = EUC-KR\%>
<html> <head><title>regConform.jsp</title></head> <body>
<center> <h1>»ç¿ëÀÚ µî·ÏÈ®ÀΠȸé</h1> <p> <hr>
<% Connection con=null; Statement stmt=null; ResultSet rs=null;
String name=new String(request.getParameter(
ame)); String id=new String(request.getParameter(id)); String email=request.getParameter(email); String pass1=request.getParameter(pass1).trim(); String pass2=request.getParameter(pass2).trim(); java.util.Date now=new java.util.Date(); SimpleDateFormat date=new SimpleDateFormat(yyyy/MM/dd); String regdate=date.format(now);
if(name.trim().length()==0){ out.println(<p>); out.println(<font color=red>À̸§À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä!</font>); out.println(<p><hr><p>); out.println(<a href=registration.html><font color=blue>»ç¿ëÀÚµî·Ï ȸéÀ¸·Î µ¹¾Æ°¡±â</font></a>); return; } if(id.length()==0){ out.println(<P>); out.println(<font color=red>ID¸¦ ÀÔ·ÂÇØ ÁÖ»õ¿ä!</font>); out.println(<p><hr><p>); out.println(<a href=registration.html><font color=blue>»ç¿ëÀÚ µî·ÏȸéÀ¸·Î µ¹¾Æ°¡±â</font></a>); return; } if(email.trim().length()==0){ out.println(<P>); out.println(<font color=red>¸ÞÀÏÁÖ¼Ò¸¦ ÀÔ·ÂÇØ ÁÖ»õ¿ä!</font>); out.println(<p><hr><p>); out.println(<a href=registration.html><font color=blue>»ç¿ëÀÚ µî·ÏȸéÀ¸·Î µ¹¾Æ°¡±â</font></a>); return; } if(pass1.length()==0){ out.println(<P>); out.println(<font color=red>¾ÏÈ£¸¦ ÀÔ·ÂÇØ ÁÖ»õ¿ä!</font>); out.println(<p><hr><p>); out.println(<a href=registration.html><font color=blue>»ç¿ëÀÚ µî·ÏȸéÀ¸·Î µ¹¾Æ°¡±â</font></a>); return; } if(pass2.length()==0){ out.println(<P>); out.println(<font color=red>¾ÏȣȮÀÎÀ» ÀÔ·ÂÇØ ÁÖ»õ¿ä!</font>); out.println(<p><hr><p>); out.println(<a href=registration.html><font color=blue>»ç¿ëÀÚ µî·ÏȸéÀ¸·Î µ¹¾Æ°¡±â</font></a>); return; } if(!pass1.equals(pass2)){ out.println(<P>); out.println(<font color=red>¾ÏÈ£°¡ ÀÏÄ¡ÇÏÁö ¾Ê½À´Ï´Ù!</font>); out.println(<p><hr><p>); out.println(<a href=registration.html><font color=blue>»ç¿ëÀÚ µî·ÏȸéÀ¸·Î µ¹¾Æ°¡±â</font></a>); return; } if(email.indexOf(@)<0 || email.indexOf(.)<0){ out.println(<P>); out.println(<font color=red>ÀüÀÚ¸ÞÀÏÀ» ÀÔ·ÂÇØ ÁÖ»õ¿ä!</font>); out.println(<p><hr><p>); out.println(<a href=registration.html><font color=blue>»ç¿ëÀÚ µî·ÏȸéÀ¸·Î µ¹¾Æ°¡±â</font></a>); return; } try{ con=DriverManager.getConnection(dbhost,dbuser, dbpassword); stmt=con.createStatement(); rs=stmt.executeQuery(select user_id from User where user_id=\+id+\); if(rs.next()) { out.println(<p>); out.println(<font color=red>ÀÌ¹Ì »ç¿ëÁßÀÎ IDÀÔ´Ï´Ù.!</font>); out.println(<p><hr><p>); out.println(<a href=registration.html><font color=blue>»ç¿ëÀÚ µî·ÏȸéÀ¸·Î µ¹¾Æ°¡±â</font></a>); return; } else { String query=insert into user (user_id, user_name, user_email, user_psw, user_regdate) values (\+id+\,\ +name+\, \ +email+\, \ +pass1+\, \ +regdate+\);;/////////////////////////////////////////////////////////////////////// //out.println(query); stmt.executeUpdate(query); %> <table border=1> <tr><td>À̸§:</td> <td><%=name%></td> </tr> <tr><td>ID:</td> <td><%=id%></td> </tr> <tr><td>E-mail:</td> <td><%=email%></td> </tr> <tr><td>¾ÏÈ£:</td> <td><%=pass1%></td> </tr> <tr><td>µî·ÏÀÏ:</td> <td><%=regdate%></td> </tr> </table> <% } } catch(Exception e){ e.printStackTrace(new PrintWriter(out)); return; } %> <p> <hr> <p> <a href=login.html><font color=blue>·Î±×ÀΠȸéÀ¸·Î</font></a> </center> </body> </html> 9999999999999999999999999999999999999999 ***ÆÄÀϸí : delete.html*** <html> <head> <title>»ç¿ëÀÚ »èÁ¦È¸é</title>
</head> <body> <h1>»ç¿ëÀÚ »èÁ¦ ȸé</h1> <p> <hr> <form method=post action=delete.jsp> <table> <tr><td>ID:</td> <td><input type=text name=id></td> </tr> <tr><td>PASSWORD:</td> <td><input type=password name=pass></td> </tr> <tr><td colspan=2><center> <input type=submit value=»èÁ¦Çϱâ> <input type=reset value=Ãë¼Ò></center></td></tr> </table> </form> <p> <hr> <a href=show.jsp><font color=blue>³»¿ëÀúÀå È®ÀÎ</font></a> </center> </body> </html>
10101010101010101010101010101010101010 ***ÆÄÀϸí : delete.jsp*** <!--delete.jsp--> <%@ include file=db.jsp\%> <%@ page language=java import=java.sql.*,java.io.*,java.text.*,java.util.* contentType= ext/html;charset=EUC-KR\%>
<html> <head><title>»ç¿ëÀÚ Á¤º¸ »èÁ¦</title></head> <body> <center><h2>»ç¿ëÀÚ Á¤º¸ »èÁ¦</h2> <p> <hr> <p> <% Connection con=null; Statement stmt=null; ResultSet rs=null; String id=request.getParameter(id).trim(); String pass=request.getParameter(pass).trim(); if(id.length()==0){ out.println(<font color=red> ID¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä!</font>); out.println(<p><hr><p>); out.println(<a href=delete.html><font colort=blue>»èÁ¦È¸éÀ¸·Î µ¹¾Æ±â</font></a>); return; } if(pass.length()==0){ out.println(<font color=red>Password¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä!</font>); out.println(<br>); out.println(<p><hr><p>); out.println(<a href=delete.html><font color=blue>»èÁ¦È¸éÀ¸·Î µ¹¾Æ°¡±â</font></a>); return; } try{ con=DriverManager.getConnection(dbhost, dbuser, dbpassword); stmt=con.createStatement(); rs=stmt.executeQuery(select user_id, user_psw from User where user_id=\+id+\); if(rs.next()) { String db_id=rs.getString(1); String db_psw=rs.getString(2); //out.println(DB:+db_id+,+db_psw); if(db_psw.equals(pass)) { stmt.executeUpdate(delete from User where user_id=\+id+\); response.sendRedirect(show.jsp); } else { out.println(<font color=red>Password°¡ Ʋ¸³´Ï´Ù. ´Ù½ÃÇѹøÇØ Áֽʽÿä!!</font><br>); out.println(<a href=delete.html>»ç¿ëÀÚ »èÁ¦Çϱâ</a>); out.println(<p><hr><p>); return; } } else { out.println(<font color=red>Á¸ÀçÇÏÁö ¾Ê´Â IDÀÔ´Ï´Ù. °¡ÀÔÇϽÅÀû À½³ª봥¿°..</font><br>); } } catch(Exception e) { System.out.println(e); } %> <p> <hr> <p> <font color=blue> »ç¿ëÀÚ»èÁ¦È¸éÀ¸·Î<a href=delete.html>µ¹¾Æ°¡±â</a></font><br> <font color=blue> »ç¿ëÀÚ ·Î±×ÀΠȸéÀ¸·Î <a href=login.html>µ¹¾Æ°¡±â</a></font> </body> </html>
JSP½ºÅ͵ð 2004 12 3 ÀÏ¿¡ ¿Ï¼º ³²µéÀº ¹æ¸í·Ï¿Ï¼ºÇؽ¿¹Ì´Ù
¼Ò½º ÀÚ¼¼È÷ Á¤È®ÇÏ°Ô º¸±â http://www.6VJ.com/jsp/jsp1129.txt
|