این یه تیکه از یه برنامه ایه که Page2 رو باز میکنه که در اون Page2 یه سرچ میشه و نتیجه رو به Page اصلی منتقل میکنه :wacko:
این برنامه اونه
این برنامه اونه
کد:
If strMode = "PM" Then
Response.Write(vbCrLf & " <tr>" & _
vbCrLf & " <td align=""right"" width=""15%"" class=""text"">" & strTxtToUsername & "*:</td>" & _
vbCrLf & " <td width=""70%"" class=""text"">")
'Get the users buddy list if they have one
'Initlise the sql statement
strSQL = "SELECT " & strDbTable & "Author.Username "
strSQL = strSQL & "FROM " & strDbTable & "Author INNER JOIN " & strDbTable & "BuddyList ON " & strDbTable & "Author.Author_ID = " & strDbTable & "BuddyList.Buddy_ID "
strSQL = strSQL & "WHERE " & strDbTable & "BuddyList.Author_ID=" & lngLoggedInUserID & " AND " & strDbTable & "BuddyList.Buddy_ID <> 2 "
strSQL = strSQL & "ORDER By " & strDbTable & "Author.Username ASC;"
'Query the database
rsCommon.Open strSQL, adoCon
Response.Write(vbCrLf & " <input type=""text"" name=""member"" size=""15"" maxlength=""15"" value=""" & Server.HTMLEncode(strBuddyName) & """")
If NOT rsCommon.EOF Then Response.Write(" onChange=""document.frmAddMessage.selectMember.options[0].selected = true;""")
Response.Write(" />")
Response.Write(vbCrLf & " <a href=""JavaScript:openWin('pop_up_member_search.asp','profile','toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=1,width=440,height=255')""><img src=""" & strImagePath & "search.gif"" alt=""" & strTxtMemberSearch & """ border=""0"" align=""absmiddle""></a>")
'If there are records returned then display the users buddy list
If NOT rsCommon.EOF Then
Response.Write(vbCrLf & " <span class=""text"">" & strSelectFormBuddyList & ":</span>" & _
vbCrLf & " <select name=""selectMember"" onChange=""member.value=''"">" & _
vbCrLf & " <option value="""">-- " & strTxtNoneSelected & " --</option>")
'Loop throuhgn and display the buddy list
Do While NOT rsCommon.EOF
Response.Write("<option value=""" & rsCommon("Username") & """>" & rsCommon("Username") & "</option>")
'Move to next record in rs
rsCommon.MoveNext
Loop
Response.Write(vbCrLf & " </select>")
Else
Response.Write(vbCrLf & " <input type=""hidden"" name=""selectMember"" value="""" />")
End If
'Reset server variables
rsCommon.Close
Response.Write(vbCrLf & " </td>" & _
vbCrLf & " </tr>")
End If
اینم برنامه Page2
کد:
<% @ Language=VBScript %>
<% Option Explicit %>
<!--#include file="common.asp" -->
<!--#include file="functions/functions_send_mail.asp" -->
<%
Response.Buffer = True
Dim strUsername 'Holds the users username
'If this is a post back then search the member list
If Request.Form("name") <> "" Then
'Read in the username
strUsername = Request.Form("name")
'Take out parts of the username that are not permitted
strUsername = disallowedMemberNames(strUsername)
'Get rid of milisous code
strUsername = formatSQLInput(strUsername)
'Initalise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT " & strDbTable & "Author.Username "
strSQL = strSQL & "FROM " & strDbTable & "Author "
strSQL = strSQL & "WHERE " & strDbTable & "Author.Username Like '" & strUsername & "%' "
strSQL = strSQL & "ORDER BY " & strDbTable & "Author.Username ASC;"
'Query the database
rsCommon.Open strSQL, adoCon
End If
%>
<html>
<head>
<meta name="copyright" content="Copyright (C) 2001-2006 Bruce Corkhill" />
<title>Member Search</title>
<%
'***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******
Response.Write("<!--//" & _
vbCrLf & "/* *******************************************************" & _
vbCrLf & "Application: Web Wiz Forums ver. " & strVersion & "" & _
vbCrLf & "Author: Bruce Corkhill" & _
vbCrLf & "Info: http://www.webwizforums.com" & _
vbCrLf & "Available FREE: http://www.webwizforums.com" & _
vbCrLf & "Copyright: Bruce Corkhill ©2001-2006. All rights reserved" & _
vbCrLf & "******************************************************* */" & _
vbCrLf & "//-->" & vbCrLf & vbCrLf)
'***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******
%>
<script language="JavaScript">
//Function to check form is filled in correctly before submitting
function CheckForm () {
var errorMsg = "";
//Check for a Username
if (document.frmMemSearch.name.value==""){
msg = "<% = strTxtErrorDisplayLine %>\n\n";
msg += "<% = strTxtErrorDisplayLine1 %>\n";
msg += "<% = strTxtErrorDisplayLine2 %>\n";
msg += "<% = strTxtErrorDisplayLine %>\n\n";
msg += "<% = strTxtErrorDisplayLine3 %>\n";
alert(msg + "\n\t<% = strTxtErrorUsername %>");
document.frmMemSearch.name.focus();
return false;
}
return true;
}
//Function to place the username in the text box of the opening frame
function getUserName(selectedName)
{
window.opener.document.<% If Request.QueryString("RP") = "BUD" Then Response.Write("frmBuddy.username") Else Response.Write("frmAddMessage.member") %>.focus();
window.opener.document.<% If Request.QueryString("RP") = "BUD" Then Response.Write("frmBuddy.username") Else Response.Write("frmAddMessage.member") %>.value = selectedName;
window.close();
}
</script>
</head>
<body bgcolor="<% = strBgColour %>" text="<% = strTextColour %>" background="<% = strBgImage %>" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0">
<div align="center" class="heading">
<% = strTxtMemberSearch %>
</div>
<br />
<form method="post" name="frmMemSearch" action="pop_up_member_search.asp<% If Request.QueryString("RP") = "BUD" Then Response.Write("?RP=BUD") %>" onSubmit="return CheckForm();">
<br />
<table width="390" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="<% = strTableBorderColour %>" height="30">
<tr>
<td height="2" width="483" align="center"> <table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr>
<td bgcolor="<% = strTableColour %>" background="<% = strTableBgImage %>" height="26"> <table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="32%" align="right"><span class="text"><% = strTxtMemberSearch %>:</span> </td>
<td width="68%"><input type="text" name="name" size="15" maxlength="15" value="<% = strUsername %>"> <input type="submit" name="Submit" value="<% = strTxtSearch %>"></td>
</tr><%
'If this is a post back then display the results
If Request.Form("name") <> "" Then
%>
<tr>
<td align="right"> </td>
<td> </td>
</tr>
<tr>
<td width="32%" align="right"><span class="text"><% = strTxtSelectMember %>:</span> </td>
<td width="68%"><select name="userName"><%
'If there are no records found then display an error message
If rsCommon.EOF then
Response.Write("<option value="""" selected>" & strTxtNoMatchesFound & "</option>")
'Else there are matches found so display the result
Else
'Loop through the recordset
Do while NOT rsCommon.EOF
'Disply the usernames found
Response.Write("<option value=""" & rsCommon("Username") & """>" & rsCommon("Username") & "</option>")
'Jump to the next record in recordset
rsCommon.MoveNext
Loop
End If
%>
</select> <input type="button" name="Button" value="<% = strTxtSelect %>" onClick="getUserName(frmMemSearch.userName.options[frmMemSearch.userName.selectedIndex].value);"></td>
</tr><%
'Clean up
rsCommon.Close
End If
%>
</table></td>
</tr>
</table></td>
</tr>
</table>
</form>
<table width="<% = strTableVariableWidth %>" border="0" cellspacing="0" cellpadding="1" align="center">
<tr>
<td align="center"><a href="JavaScript:onClick=window.close()">
<% = strTxtCloseWindow %>
</a> <br />
<br />
<br />
<%
'Reset Server Objects
Set rsCommon = Nothing
adoCon.Close
Set adoCon = Nothing
%>
</td>
</tr>
</table>
</body>
</html>
یکی بگه این برنامه چطوری اطلاعات رو از Page2 به صفحه اصلی میفرسته ... :wacko: