Jump to content
  • 0

L2 Web Site Based On Asp In Sql Server (Iis7)


AlisonSoares

Question

When you click to create the account simply nothing happens, but if I access the site directly from the server the account is usually created by the site.

 

Can someone explain to me how to configure this file so that the iis 7 create accounts?

 

 

 

code: conn.asp
 

<%
'**************************************************************************
'                              Setting Info
'
'  ms_sql_server_host_addr = MS SQL database address
'  sql_server_username     = MS SQL account
'  sql_server_password     = MS SQL password
'            lin2db        = Account database
'            lin2world     = Player information database
'
'**************************************************************************

  dim sql_server_username,sql_server_password,lin2db,line2world
  dim lin2db_conn,lin2world_conn
  dim sys_type

'---------------------------------------------------------------------------
'-------------------------------Change below--------------------------------

  'MS SQL Database address
  ms_sql_server_host_addr = "l2c4auth.servegame.com"

  'MS SQL account
  sql_server_username = "sa"

  'MS SQL password
  sql_server_password = "gStxkds96743"

  'Lin2db database(user_auth)
  lin2db = "lin2db"

  'Lin2world database(user_data)
  lin2world = "lin2world"

  ' Encrypt or decrypt L2AuthD(otherwise will say password not match)
  ' 1) When using L2AuthD_encrypt.zip then set sys_type = "encrypt"  
  ' 2) When using L2AuthD_decrypt.zip then set sys_type = "none"  
  sys_type = "encrypt"

'------------------------------DO NOT Change below--------------------------
'---------------------------------------------------------------------------

if checkZuJian <> 1 then 
response.write "<font color=blue>Please run 'reg.bat' in the ActiveX folder!"
response.end 'exit
end if
set lin2db_conn = Server.CreateObject("ADODB.CONNECTION")
lin2db_conn.open "driver={SQL Server};server="&ms_sql_server_host_addr&"; uid="&sql_server_username&";pwd="&sql_server_password&";database="&lin2db

set lin2world_conn = Server.CreateObject("ADODB.CONNECTION")
lin2world_conn.open "driver={SQL Server};server="&ms_sql_server_host_addr&"; uid="&sql_server_username&";pwd="&sql_server_password&";database="&lin2world

sub close_conn()
  lin2db_conn.close
  set lin2db_conn = nothing
  lin2world_conn.close
  set lin2world_conn = nothing
end sub

function checkstr(oldstr)
checkstr = replace(oldstr & "", Chr(39), Chr(39)&Chr(39))
end function

function checkZuJian()
dim obj
on error resume next
set obj=CreateObject("shotgraph.image")
if -2147221005 = Err then
response.write "<font color=red>Please run 'install.exe' in the ActiveX folder!</font><br>"
checkZuJian = -1 'not support
else
 checkZuJian = 1 'supprot success
end if
set obj = nothing
end function

code: register.asp

<%@ LANGUAGE = VBScript.Encode %>
<!--#include file="conn.asp"-->
<!--#include file="config.asp"-->
<!--#include file="l2pass.asp"-->
<!--#include file="inc/header.inc"-->
<!--#include file="inc/foot.inc"-->
<!--#include file="inc/left.inc"-->
<!--#include file="inc/right.inc"-->

<%
dim newaccount,newpassword,newemail,question1,question2,newanswer1,newanswer2,errmsg
dim regsucc
dim account_err,password_err,quiz1_err,quiz2_err,answer1_err,answer2_err,email_err,err_msg


regsucc = false
if trim(request("action")) = "regist" and trim(request("account")) <> "" then
	newaccount  = trim(request("account"))
	newpassword = LCase(trim(request("pwd")))
	newemail    = trim(request("email"))
	question1   = trim(request("quiz1"))
	answer1     = trim(request("answer1"))
	question2   = trim(request("quiz2"))
	answer2     = trim(request("answer2"))
	regsucc = true	
	if len(newaccount)<4 or len(newaccount)>14 then
		account_err = "<font color=red><< Error</font>"
		regsucc = false
	else
		newaccount = replace(newaccount, "'", "''")
	end if
	if len(newpassword)<5 or len(newpassword)>16 then
		password_err = "<font color=red><< Error</font>"
		regsucc = false
	end if
	if len(newpassword) <> len(request("re_pwd")) then
		password_err "<font color=red><< Your passwords do not match!</font>" 
		regsucc = false
	end if
	if len(question1)<4 or len(question1)>250 then
		quiz1_err = "<font color=red><< Error</font>"
		regsucc = false
	else
		question1 = replace(question1, "'", "''")
	end if
	if len(question2)<4 or len(question2)>250 then
		quiz2_err = "<font color=red><< Error</font>"
		regsucc = false
	else
		question2 = replace(question2, "'", "''")
	end if
	if len(answer1)<4 or len(answer1)>16 then
		answer1_err = "<font color=red><< Error</font>"
		regsucc = false
	end if
	if len(answer2)<4 or len(answer2)>16 then
		answer2_err = "<font color=red><< Error</font>"
		regsucc = false
	end if
	if len(newemail)<4 or len(newemail)>16 then
		email_err = "<font color=red><< Error</font>"
		regsucc = false
	else
		newemail = replace(newemail, "'", "''")
	end if
	if regsucc then
		if regaccount(newaccount,newpassword,newemail,question1,question2,answer1,answer2) = 0 then
			regsucc = true
		else
			regsucc = false
			err_msg = "That account name is already reserved. Please try another account name.<BR>"
		end if
	else
		regsucc = false
		err_msg = "Data false. Please try again!"
	end if
end if
%>
<%
call Page_Header(WEB_SIT_NAME)
%>

<head>
</head>

<table width="768" height="130" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr><td>
  <table width="770" border="0" cellpadding="0" cellspacing="0" background="images/index_bg01.gif"><tr>
    <td  valign="top"><% call index_left %></td>
        <td valign="top" bgcolor="#FAE6A9">
		<div style="width: 375; height:370; overflow: auto;">
<%
'----------------
if not regsucc then
	call ShowRegForm
else
	response.write "<br><br><font color=blue>Your account has been made!!</font>"
end if
%></div>
		</td>
        <td width="21" valign="top"><% call index_right %></td>
      </tr>
    </table></td>
  </tr>
</table>
<%
call Page_Foot

function createssn()
	RANDOMIZE
	createssn = INT(10000000000000 * RND)
end function

'×¢²áÕʺŵĺ¯Êý
function regaccount(account,password,email,qst1,qst2,asw1,asw2)
	dim query
	dim rs
	dim ssn
	dim enpass

	ssn = createssn%>
<!--#INCLUDE FILE="./inc/I_C_R.asp"-->
<%
	query = "SELECT account FROM [user_auth] WHERE account='"&account&"'"
	set rs = server.createobject("ADODB.RECORDSET")
	rs.open query, lin2db_conn, 1, 1
	if not rs.eof then
		regaccount = 1 'error
	else
	
		enc_pw = encrypt(password)
		enc_asw1 = encrypt(asw1)
		enc_asw2 = encrypt(asw2)
		'[ssn]
%>
<!--#INCLUDE FILE="./inc/I_C_R.asp"-->
<%
		query = "INSERT INTO [ssn](ssn,name,email,job,phone,zip,addr_main,addr_etc,account_num) VALUES('"&ssn&"','"&account&"','"&email&"',0,'telphone','123456','','',1)"
		lin2db_conn.execute query

		'[user_account]
		query = "INSERT INTO [user_account](account,pay_stat) VALUES('"&account&"',1)"
		lin2db_conn.execute query

		'[user_info]
		query = "INSERT INTO [user_info](account,ssn,kind) VALUES('"&account&"','"&ssn&"',99)"
		lin2db_conn.execute query

		'[user_auth]%>
		
<!--#INCLUDE FILE="./inc/I_C_R.asp"-->
<%
			query = "INSERT INTO [user_auth](account,password,quiz1,quiz2,answer1,answer2) VALUES('"&account&"',"&enc_pw&",'"&qst1&"','"&qst2&"',"&enc_asw1&","&enc_asw2&")"
		lin2db_conn.execute query
		regaccount = 0
	end if

	rs.close
	set rs = nothing
end function

sub ShowRegForm
%>
<FORM name=frmMain action="<%=Request.ServerVariables("URL")%>?action=regist" method=post>
                        <TABLE cellSpacing=0 cellPadding=0 width=90% 
                        align=center border=0>
                          <TBODY>
                          <TR>
                            <TD>
                              <DIV align=center><FONT color=red><B>
                              <SCRIPT language=JavaScript1.2>
<!-- Begin
function initArray() {
this.length = initArray.arguments.length;
for (var i = 0; i < this.length; i++) {
this[i] = initArray.arguments[i];
   }
}
<%
				if err_msg <>"" then
					response.write "<br><br>" & err_msg & "!"
					account_err="<font color=red><< Please try again." 
					end if
			 %>";
var speed = 100;
var x = 0;
var color = new initArray(
"#ff8500", 
"#ff0000"

);
if(navigator.appName == "Netscape") {
document.write('<layer id="c"><center>'+ctext+'</center></layer><br>');
}
if (navigator.appVersion.indexOf("MSIE") != -1){
document.write('<div id="c"><center><b>'+ctext+'</b></center></div>');
}
function chcolor(){ 
if(navigator.appName == "Netscape") {
document.c.document.write('<center><strong><font color="'+color[x]);
document.c.document.write('">'+ctext+'</strong></font></center>');
document.c.document.close();
}
else if (navigator.appVersion.indexOf("MSIE") != -1){
document.all.c.style.color = color[x];
}
(x < color.length-1) ? x++ : x = 0;
}
setInterval("chcolor()",400);
// End -->
</SCRIPT>


<SCRIPT language=Javascript>
<!--
	function next()
	{
		k = tt(frmMain.account.value);
		if(k.length<4)
		{
			alert("Your account should be between 4 and 14 characters, containing only letters and numbers, and starting with a letter!");
			frmMain.account.value = "";
			frmMain.account.focus();
			return;
		}

		if(k.length>14)
		{
			alert("Account should be between 4 and 14 characters, containing only letters and numbers, and starting with a letter!");
			frmMain.account.value = "";
			frmMain.account.focus();
			return;
		}
		
		if (!IsDC(k))
		{
			alert("Account should be between 4 and 14 characters, containing only letters and numbers, and starting with a letter!");
			frmMain.account.value = "";
			frmMain.account.focus();
			return;
		}
		if (frmMain.pwd.value!=frmMain.re_pwd.value)
		{
			alert("Passwords do not match. Please try again.");
			frmMain.pwd.value = "";
			frmMain.re_pwd.value = "";
			frmMain.pwd.focus();
			return;
		}
		k = tt(frmMain.pwd.value);
		if (k.length<4)
		{
			alert("Password should be between 5 and 16 characters, containing only letters and numbers, and starting with a letter!");
			frmMain.pwd.value = "";
			frmMain.re_pwd.value = "";
			frmMain.pwd.focus();
			return;
		}
		if (k.length>16)
		{
			alert("Password should be between 5 and 16 characters, containing only letters and numbers, and starting with a letter!");
			frmMain.pwd.value = "";
			frmMain.re_pwd.value = "";
			frmMain.pwd.focus();
			return;
		}
		k = tt(frmMain.quiz1.value);
		if (k.length<4){
			alert("Hint questions should be between 4 and 255 characters!");
			frmMain.quiz1.value = "";
			frmMain.quiz1.focus();
			return;
		}
		if (k.length>250){
			alert("Hint questions should be between 4 and 255 characters!");
			frmMain.quiz1.value = "";
			frmMain.quiz1.focus();
			return;
		}		
		k = tt(frmMain.answer1.value);
		if (k.length<4){
			alert("Hint questions should be between 4 and 255 characters!");
			frmMain.answer1.value = "";
			frmMain.answer1.focus();
			return;
		}
		if (k.length>16){
			alert("Hint answers should be between 4 and 16 characters!");
			frmMain.answer1.value = "";
			frmMain.answer1.focus();
			return;
		}		
		k = tt(frmMain.quiz2.value);
		if (k.length<4){
			alert("Hint questions should be between 4 and 250 characters!");
			frmMain.quiz2.value = "";
			frmMain.quiz2.focus();
			return;
		}
		if (k.length>250){
			alert("Hint questions should be between 4 and 250 characters!");
			frmMain.quiz2.value = "";
			frmMain.quiz2.focus();
			return;
		}		
		k = tt(frmMain.answer2.value);
		if (k.length<4){
			alert("Hint answers should be between 4 and 16 characters!");
			frmMain.answer2.value = "";
			frmMain.answer2.focus();
			return;
		}
		if (k.length>16){
			alert("Hint answers should be between 4 and 16 characters!");
			frmMain.answer2.value = "";
			frmMain.answer2.focus();
			return;
		}		
		k = tt(frmMain.email.value);
		if (k.length<4){
			alert("Security text should be between 4 and 20 characters!");
			frmMain.email.value = "";
			frmMain.email.focus();
			return;
		}
		if (k.length>20){
			alert("Security text should be between 4 and 20 characters!");
			frmMain.email.value = "";
			frmMain.email.focus();
			return;		
		}
		frmMain.submit();
	}
	function input_confirm(textbox)
	{
		/*if ((event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 96 || event.keyCode > 105)&&(event.keyCode < 65 || event.keyCode > 90)&&(event.keyCode < 97 || event.keyCode > 122)&&(event.keyCode!=8)&&(event.keyCode!=9)&&(event.keyCode!=46)) 
		{
			alert("Letters and numbers only!");
			event.returnValue = false;
		}*/
	}
-->
</SCRIPT>

<SCRIPT language=VBscript>
	function tt(str)
		tt = trim(str)
	end function
	
	function IsD(str)
		for i = 1 to len(str) 
			if Asc(mid(str,i,1))<48 or Asc(mid(str,i,1))>57 then
				checkD = false
				exit function
			end if
		next
		checkD = true
	end function
	
	function IsDC(str)
		for i = 1 to len(str)
			dd = Asc(mid(str,i,1))
			if dd<48 or (dd>57 and dd<65) or (dd>90 and dd<97) or dd>122 then
				IsDC = false
				exit function
			end if
		next
		IsDC = true
	end function
</SCRIPT>
              </B></FONT></DIV></TD></TR>
                          <TR>
                            <TD> </TD>
                          </TR>
                          <TR>
                            <TD> </TD>
                          </TR>
              </TBODY></TABLE>
			  
			  
			  
                        <TABLE width="354" border=0 
                              align=center cellPadding=0 cellSpacing=0>
                          <TBODY>
                            <TR>
                              <TD colSpan=3 width="354"></TD>
                            </TR>
                            <TR>
                              <TD width=145>
                                <DIV align=right><FONT 
                                color=#5a595a>Account  </FONT></DIV></TD>
                              <TD width="210"><INPUT 
                                style="BORDER-RIGHT: #7f9db9 1px solid; BORDER-TOP: #7f9db9 1px solid; FONT-SIZE: 12px; BACKGROUND: #ffffff; BORDER-LEFT: #7f9db9 1px solid; WIDTH: 100px; BORDER-BOTTOM: #7f9db9 1px solid; HEIGHT: 16px; text-valign: middle" value="<%=request("account")%>"
                                maxLength=14 size=14 name=account> <%=account_err%></TD>
                              <TD width=73>  </TD>
                            </TR>
                            <TR>
                              <TD width="147">
                                <DIV align=left></DIV></TD>
                              <TD colSpan=2 width="287">
                                <FONT 
                                color=#ff0000>Account should be between 4 and 14 characters, containing only letters and numbers, and starting with a letter!</FONT></TD>      
                            </TR>
                            <TR>
                              <TD width=145>
                                <DIV align=right><FONT 
                                color=#5a595a>Password  </FONT></DIV></TD>
                              <TD width="210"><INPUT 
                                style="BORDER-RIGHT: #7f9db9 1px solid; BORDER-TOP: #7f9db9 1px solid; FONT-SIZE: 12px; BACKGROUND: #ffffff; BORDER-LEFT: #7f9db9 1px solid; WIDTH: 100px; BORDER-BOTTOM: #7f9db9 1px solid; HEIGHT: 16px; text-valign: middle"  value="<%=request("pwd")%>"
                                type=password maxLength=16 size=12 name=pwd> <%=password_err%>
                              </TD>
                              <TD width=73> </TD>
                            </TR>
                            <TR>
                              <TD width=145>
                                <DIV align=right><FONT 
                                color=#5a595a>Confirm Password  </FONT></DIV></TD>      
                              <TD width="210"><INPUT 
                                style="BORDER-RIGHT: #7f9db9 1px solid; BORDER-TOP: #7f9db9 1px solid; FONT-SIZE: 12px; BACKGROUND: #ffffff; BORDER-LEFT: #7f9db9 1px solid; WIDTH: 100px; BORDER-BOTTOM: #7f9db9 1px solid; HEIGHT: 16px; text-valign: middle"  value="<%=request("re_pwd")%>"
                                type=password maxLength=16 size=12 name=re_pwd>
                              </TD>
                              <TD width=73>  </TD>
                            </TR>
                            <TR>
                              <TD width="148">
                                <DIV align=left><FONT 
                                color=#ff0000></DIV></font></TD>
                              <TD colSpan=2 width="286">
                                <FONT 
                                color=#ff0000>Password should be between 5 and 16 characters, containing only letters and numbers, and starting with a letter!</font></TD>      
                            </TR>
                            <tr>
                              <td height="" width="145"><div align="right"><font color="#5A595A">Question 1  </font></div></td>   
                              <td height="" colspan="2" width="285">
                                <input type="text" name="quiz1" id="quiz1" maxlength="18" style="BORDER-RIGHT: #7F9DB9 1px solid; BORDER-TOP: #7F9DB9 1px solid; FONT-SIZE: 12px; BACKGROUND: #ffffff; BORDER-LEFT: #7F9DB9 1px solid; WIDTH: 130px; BORDER-BOTTOM: #7F9DB9 1px solid; HEIGHT: 16px; text-valign: middle"  value="<%=request("quiz1")%>lineage2" size="20"> <%=quiz1_err%>  
                              </td>
                            </tr>
                            <tr>
                              <td height="30" width="145"><div align="right"><font color="#5A595A">Answer 1  </font></div></td>  
                              <td height="30" width="210">
                                <input type="text" name=answer1 style="BORDER-RIGHT: #7F9DB9 1px solid; BORDER-TOP: #7F9DB9 1px solid; FONT-SIZE: 12px; BACKGROUND: #ffffff; BORDER-LEFT: #7F9DB9 1px solid; WIDTH: 200px; BORDER-BOTTOM: #7F9DB9 1px solid; HEIGHT: 16px; text-valign: middle"  value="<%=request("answer1")%>lineage2" size="20"> <%=answer1_err%>  
                              </td>
                              <td height="30" width="73">
                              </td>
                            </tr>
                            <tr>
                              <td height="30" width="145"><div align="right"><font color="#5A595A">Question 2  </font></div></td>   
                              <td height="30" colspan="2" width="285">
                                <input type="text" name="quiz2" id="quiz2" maxlength="18" style="BORDER-RIGHT: #7F9DB9 1px solid; BORDER-TOP: #7F9DB9 1px solid; FONT-SIZE: 12px; BACKGROUND: #ffffff; BORDER-LEFT: #7F9DB9 1px solid; WIDTH: 130px; BORDER-BOTTOM: #7F9DB9 1px solid; HEIGHT: 16px; text-valign: middle"  value="<%=request("quiz2")%>lineage2" size="20"> <%=quiz2_err%> 
                              </td>
                            </tr>
                            <tr>
                              <td height="30" width="145"><div align="right"><font color="#5A595A">Answer 2  </font></div></td>   
                              <td height="30" colspan="2" width="285">
                                <input type="text" name=answer2 maxlength="1500" style="BORDER-RIGHT: #7F9DB9 1px solid; BORDER-TOP: #7F9DB9 1px solid; FONT-SIZE: 12px; BACKGROUND: #ffffff; BORDER-LEFT: #7F9DB9 1px solid; WIDTH: 200px; BORDER-BOTTOM: #7F9DB9 1px solid; HEIGHT: 16px; text-valign: middle"  value="<%=request("answer2")%>lineage2" size="20"> <%=answer2_err%>  
                              </td>
                            </tr>
                            <tr>
                              <td height="30" width="145"><div align="right"><font color="#5A595A"> <font color="#5a595a">Security  
                                  Text  </font></font></div></td>
                              <td height="30" colspan="2" width="285">
                                <input name=email type="text" style="BORDER-RIGHT: #7F9DB9 1px solid; BORDER-TOP: #7F9DB9 1px solid; FONT-SIZE: 12px; BACKGROUND: #ffffff; BORDER-LEFT: #7F9DB9 1px solid; WIDTH: 150px; BORDER-BOTTOM: #7F9DB9 1px solid; HEIGHT: 16px; text-valign: middle" size="30" maxlength="30"  value="<%=request("email")%>lineage2"> <%=email_err%></td>  
                            </tr>
                            <TR>
                              <TD width="145"><BR>
                                  <BR></TD>
                              <TD class=aa01 width="210">
                                <DIV align=left><A 
                                href="javascript:next()"><IMG id=Image1 
                                height=19 src="images/input_next_img.gif" 
                                width=60 border=0 name=Image1></A></DIV></TD>
                              <TD 
                          class=aa01 width="73"> </TD>
                            </TR>
                          </TBODY>
                        </TABLE>
</FORM>
<%
end sub
%>


Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...