Solved

DB Error: ADODB.Recordset error '800a0cc1 > New Twitter Widget

Posted on 2013-01-27
7
648 Views
Last Modified: 2013-02-01
I've got some code that's getting the following error:

ADODB.Recordset error '800a0cc1'
Item cannot be found in the collection corresponding to the requested name or ordinal.
/Assets/Templates/Public/Franchise/FullPageAdvert.asp, line 182

This is the line:
  <% if len(""&rsAdvert("Twitter"))>0 then %>

Open in new window

     

Twitter being the Twitter address name (not full URL).

It's for a Twitter widget, where we're storing the Twitter addresses and ID's for different businesses and having custom widgets for their advert page.

The widget is right nav on this page using the following code:

   <% if lcase(""&Session("PublicFranchiseName")) = "brentwood" then %>
  <div class="bg twitter"><div id="twitter"><h3>On Twitter</h3>
  <% if len(""&rsAdvert("Twitter"))>0 then %>	
    <a class="twitter-timeline" href="https://twitter.com/<%=rsAdvert("Twitter")%>" data-widget-id="<%=rsAdvert("TwitterID")%>">Tweets by @<%=rsAdvert("Twitter")%>"</a>
  <% else %>
    <a class="twitter-timeline" href="https://twitter.com/InsideBrentwood" data-widget-id="268336500536647680">Tweets by @InsideBrentwood</a>
  <% end if %>
    <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
   </div></div>
  <% end if %>

Open in new window


Please let me know if you need more details, any help much appreciated.
0
Comment
Question by:UName10
  • 5
  • 2
7 Comments
 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 250 total points
ID: 38824314
How do you open that recordset? It does not have that field...
0
 

Author Comment

by:UName10
ID: 38824326
Sorry I was just updating it and it wouldn't let me..

This is the thing - all the advert data comes from the ClientAdverts table, but my developer used the rsAdvert for the full page ads.

There's two Twitter fields in the  ClientAdverts table: Twitter and TwitterID and they're populated there so that's ok.

This is the page for the advert output:

<!--#include virtual="/System/Startup_Public.asp"-->
<%
if isnumeric(""&getquery("id")) then
	adname = replace(getquery("ad"),"-"&getquery("id"),"")
	sqlCommand = "SELECT * FROM uvw_DirectoryBrowser_Adverts WHERE ID = "&cint(getquery("id"))&" AND url = cast(? as varchar)"
	getrs rsAdvert,sqlCommand,array(adname)
else
	adname = getquery("ad")
	sqlCommand = "SELECT * FROM uvw_DirectoryBrowser_Adverts WHERE cast(ActiveAdvertGID as varchar(255)) = cast(? as varchar(255))"
	getrs rsAdvert,sqlCommand,array(adname)
end if

if getcount(rsAdvert) = 0 then 

	sqlCommand = "SELECT * FROM uvw_DirectoryBrowser_Adverts "&_
		"WHERE cast(FranchiseGID as varchar(255)) = cast(? as varchar(255)) "&_
		"AND dbo.RemoveNonAlphaCharacters(CompanyNameText) = cast(? as varchar(255));"
		
	getrs rsAdvert,sqlCommand,array(getquery("f"),adname)

	if getcount(rsAdvert) = 0 then 
		response.end
		response.redirect("/PageHandlers/404handler.asp")
		if ""&rsAdvert("FullPageAdvert") <> "True" then response.redirect("/PageHandlers/404handler.asp")
	end if

end if

' breadcrumb
sqlCommand = "SELECT * FROM AdvertDirectories WHERE AdvertGID = '"&rsAdvert("ActiveAdvertGID")&"';"
getrs tmp,sqlCommand,""
strDB_SQLCommand = "USP_Helper_GetDirectoryHierarchy '" & tmp("AdvertDirectory") & "'"

getrs rsDB_rsCrumbs,strDB_SQLCommand,""
strDB_Crumbs = ""
sFolder = lcase(Session("PublicFranchiseName"))
While Not rsDB_rsCrumbs.EOF
	sFolder = sFolder & "/" & rsDB_rsCrumbs("URL")
	'strDB_Crumbs = strDB_Crumbs & " »<a href=""" & DirectoryBrowser_GetScriptName() & "?Action=Select&amp;PID=" & rsDB_rsCrumbs("GID") & "&amp;f="&Session("PublicFranchiseGID")&""">" & rsDB_rsCrumbs("DirectoryName") & "</a>"
	strDB_Crumbs = strDB_Crumbs & "<li>»<a href='/" & sFolder & ".html'>" & rsDB_rsCrumbs("DirectoryName") & "</a></li>"		
	rsDB_rsCrumbs.MoveNext
Wend
session("strFolder") = sFolder
rsDB_rsCrumbs.Close
If Left(strDB_Crumbs, 3) = " » " then
	strDB_Crumbs = Right(strDB_Crumbs, Len(strDB_Crumbs) - 3)
End if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><%=server.HTMLEncode(rsAdvert("CompanyNameText"))%>&nbsp;<%=server.HTMLEncode(Session("PublicFranchiseName"))%>, Essex | <%=server.HTMLEncode(Session("PublicFranchiseName"))%>&nbsp;<%=server.HTMLEncode(rsAdvert("CompanyNameText"))%></title>
<meta name="Description" content="<%=server.HTMLEncode(rsAdvert("CompanyNameText"))%>&nbsp;<%=(Session("PublicFranchiseName"))%> | <%=(Session("PublicFranchiseName"))%> Business Directory. <%=server.HTMLEncode(rsAdvert("CompanyNameText"))%> business <%=server.HTMLEncode(Session("PublicFranchiseName"))%>, Essex" />
<meta name="Keywords" content="<%=server.HTMLEncode(rsAdvert("CompanyNameText"))%> in <%=server.HTMLEncode(Session("PublicFranchiseName"))%>, business of <%=server.HTMLEncode(Session("PublicFranchiseName"))%>, <%=server.HTMLEncode(rsAdvert("CompanyNameText"))%>, Essex" />
<!--#include virtual="/Assets/Templates/Public/Franchise/HeadCSS.asp"-->
<link rel="stylesheet" type="text/css" href="/css/FullPageAdvert.css"/>
<script type="text/javascript" src="/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="/js/DirectoryBrowser.js"></script>
</head>
<body id="business">
<!--#include virtual="/Assets/Templates/Public/Franchise/FullPageAdvert.asp"-->

  <div class="Advert">
	<ul class="tabs clearfix">
		<li class="aboutustab active" style="border-left:1px solid #ccc;">About</li>
		<li class="maptab">Map</li>
        <li class="featurestab">Features</li>
		<li class="openingtimestab">Open</li>
		<li class="voucherstab">Voucher</li>
	</ul>
	<div class="tab aboutus">

       <div class="inner clearfix">        
			<%=rsAdvert("Descriptiontext")%>
            <div style="height:15px;"></div>
			<%
                strTempHTML1 = ""
                strTempHTML2 = ""
                For intTempLoop = 1 to rsAdvert("BulletPointLimit")
                    if abs(intTempLoop) mod 2 = 1 then
						bullet = rsAdvert("BulletPoint" & Trim(CStr(intTempLoop)))
						if len(""&bullet)>0 then strTempHTML1 = strTempHTML1 & "<li><span></span>"&bullet&"&nbsp;</li>"
                    else
						bullet = rsAdvert("BulletPoint" & Trim(CStr(intTempLoop))) 
						if len(""&bullet)>0 then strTempHTML2 = strTempHTML2 & "<li><span></span>"&bullet&"&nbsp;</li>"
                    end if
                Next
                %><ul class="abullets1"><%
                response.write(strTempHTML1)
                %></ul><ul class="abullets2"><%
                response.write(strTempHTML2)			
                %></ul><%
            %>
<div class="topcontact">
	<ul class="contact clearfix">
		<% if len(""&rsAdvert("ContactTel"))>0 then %><li class="web"><img alt='<%=(Session("PublicFranchiseName"))%> business phone icon' src='/Assets/Images/SiteStructure/Advert-Template/phone.png' /><%=server.HTMLEncode(rsAdvert("ContactTel"))%></li><% end if %>
		<% if len(""&rsAdvert("WebAddress"))>0 then %>
        	<% if instr("abc"&rsAdvert("WebAddress"),"http:")>0 then shttp="" else shttp="http://" %><li><img alt='<%=(Session("PublicFranchiseName"))%> website icon' src='/Assets/Images/SiteStructure/Advert-Template/web.png' /><a href='<%=shttp%><%=rsAdvert("WebAddress")%>' target='_blank' rel='nofollow'>Visit Website</a></li><% end if %>
		<% if len(""&rsAdvert("ContactEmail"))>0 then %><li><img alt='<%=(Session("PublicFranchiseName"))%> business email icon' src='/Assets/Images/SiteStructure/Advert-Template/email.png' /><a class='image' href='mailto:<%=server.URLEncode(rsAdvert("ContactEmail"))%>'>Send Email</a></li><% end if %>
	</ul> 
</div>
<div id="share" style="float:left;margin-top:3em;width:60%;clear:left;">
<!-- AddThis Button BEGIN -->
 <div class="addthis_toolbox addthis_default_style">
  <a class="addthis_button_twitter"><img alt="<%=(Session("PublicFranchiseName"))%> Share Twitter" src="/images/social/twitter.png" /></a>
  <a class="addthis_button_facebook"><img alt="<%=(Session("PublicFranchiseName"))%> Share Facebook" src="/images/social/facebook.png" /></a>
  <a class="addthis_button_google"><img alt="<%=(Session("PublicFranchiseName"))%> Share Google" src="/images/social/google.png" /></a>
 </div>
  <script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script>
  <script type="text/javascript" defer="true" src="http://s7.addthis.com/js/250/addthis_widget.js#username=insideguides"></script>
  <!-- AddThis Button END -->
</div>
</div>
</div>

	<div class="tab map"><div class="inner">
        <% if len(""&rsAdvert("ContactPostcode"))>0 then %><iframe width="100%" height="450" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" 
        src="http://maps.google.co.uk/maps?q=<%=server.URLEncode(""&rsAdvert("ContactPostcode"))%>&amp;ie=UTF8&amp;hq=&amp;hnear=<%=Session("PublicFranchiseName")%>+<%=server.URLEncode(""&rsAdvert("ContactPostcode"))%>,+United+Kingdom&amp;z=14&amp;iwloc=near&amp;output=embed"></iframe>
        <% else %><p>The Map feature is not available for this business</p> <% end if %>
       </div></div>

    <div class="tab features"><div class="inner clearfix">
			<%
                strTempHTML1 = ""
                strTempHTML2 = ""
                For intTempLoop = 1 to rsAdvert("BulletPointLimit")
                    if abs(intTempLoop) mod 2 = 1 then
                        strTempHTML1 = strTempHTML1 & "<li><span></span>"&rsAdvert("BulletPoint" & Trim(CStr(intTempLoop))) & "&nbsp;</li>"
                    else
                        strTempHTML2 = strTempHTML2 & "<li><span></span>"&rsAdvert("BulletPoint" & Trim(CStr(intTempLoop))) & "&nbsp;</li>"
                    end if
                Next
                %><ul class="bullets1"><%
                response.write(strTempHTML1)
                %></ul><ul class="bullets2"><%
                response.write(strTempHTML2)			
                %></ul><%
            %>
    </div></div>
	<div class="tab openingtimes"><div class="inner">
    	<% if len(""&rsAdvert("OpeningTimes"))>0 then %><%=rsAdvert("OpeningTimes")%>
        <% else %><p>Opening Times have not been provided for this business</p><% end if %>
    </div></div>
	<div class="tab vouchers"><div class="inner">
    <% if len(""&rsAdvert("VoucherTitle")) = 0 then %>
        <p>This business has not added a voucher to their profile</p>
    <% else %>
    	<div class="voucher">
        	<h3><%=rsAdvert("VoucherTitle")%></h3>
            <p><%=rsAdvert("VoucherText")%></p>
        </div>
        <div class="voucher-page-text">
        <p>Here is your Discount Voucher from <%=server.HTMLEncode(rsAdvert("CompanyNameText"))%>.</p>
        <p>You can print the voucher out and bring it along when you visit us or simply mention the Offer Code if one has been quoted.</p>
        <p>You can share this offer with your friends and family too!</p>
        <p>For any questions or full terms and conditions regarding this offer, please contact <%=server.HTMLEncode(rsAdvert("CompanyNameText"))%> directly. </p>
        <% end if %>
        </div>
  </div>
 </div>
<br />
</div>
<!--#include virtual="/Assets/Templates/Public/Franchise/TemplateEnd.asp"-->
</body>
</html>
<!--#include virtual="/System/Shutdown.asp"-->

Open in new window


I can usually see where a recordset is open, but his style is different so I get confused...

Can you spot anything there?

This is the code for Creating an advert (which stores the Twitter fields fine):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--#include virtual="/System/Startup_FranchiseClient.asp"-->
<!--#include virtual="/AdvertiserAdmin/ManageSubscriptions/ManageAdverts/i_ManageAdverts.asp"-->
<%
If Not IsFranchiseClientLoggedIn = True then
    Response.Redirect "/AdvertiserAdmin/Default.asp"
End if
EnsurePageIsHTTPS

getrs tmp,"SELECT FranchiseGID FROM Clients WHERE GID = '"&session("PublicClientGID")&"';",""
ThisFranchiseGID = tmp(0)
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Inside Guides - Create Advert</title>
<!--#include virtual="/Assets/Templates/Public/Franchise/HeadCSS.asp"-->
<script type="text/javascript" src="/js/jquery-1.2.6.min.js"></script>
<script type="text/javascript" src="/system/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/system/ckeditor/adapters/jquery.js"></script>
<script type="text/javascript">
	$(window).load(function(){
		$('.editor').ckeditor( function() { /* callback code */ }, { toolbar: 'Basic' } );
	});
</script>
<style>
select {width:32%;}
</style>
</head>
<body class="pages admin">
<!--#include virtual="/Assets/Templates/Public/Franchise/AdvertiserAdmin.asp"-->
   <h1>Create New Advert</h1>
    <form name="EditForm" id="EditForm" method="post" action="CreateNewAdvert.asp">
                    <%

            ' Load Data
            objConn.Open strConn
            SQLCommand = "SELECT * FROM ClientAdverts WHERE ClientSubscriptionGID = '" & CleanSQLText(Request("CSGID")) & "' AND ClientGID='" & Session("PublicClientGID") & "'"
            'response.write SQLCommand
			rsAdverts.Open SQLCommand, objConn, adOpenStatic, adLockReadOnly
            intSubscriptionAdvertCount = rsAdverts.RecordCount
            rsAdverts.Close
            SQLCommand = "SELECT * FROM uvw_AdvertiserAdmin_SubscriptionDetails WHERE GID = '" & CleanSQLText(Request("CSGID")) & "' AND ClientGID='" & Session("PublicClientGID") & "'"
            rsSubscriptions.Open SQLCommand, objConn, adOpenStatic, adLockReadOnly

            ' Choose Welcome Text based on Allowed Edit settings
            If rsSubscriptions("AllowEditAdvert") = False then %>
				<% = GetContent("AdvertiserAdminCreateNewAdvert_Welcome_NoEdit", ThisFranchiseGID) %>
            <% Else %>
    	        <% = GetContent("AdvertiserAdminCreateNewAdvert_Welcome", ThisFranchiseGID) %>
            <% End if %>
                    <%

Dim bFirstDisplay
bFirstDisplay = False
if Request.QueryString("CSGID") <> "" then
    bFirstDisplay = True
End if

%>
                    <span class="ErrorText">
                      <% = strUserError %>
                    </span>
                    <input type="hidden" name="FormAction" id="FormAction" value="" />
                    <input type="hidden" name="CSGID" id="CSGID" value="<% = Request("CSGID") %>" />
                    <input type="hidden" name="blnRequestApproval" id="blnRequestApproval" value="1" />
                    <table class="register" width="99%">
                      <%
        if rsSubscriptions("AllowEditAdvert") = True and _
            rsSubscriptions("NumberOfAdvertTemplates") > 1 then
            %>
                      <tr>
                        <th align="left" valign="top"> Template Name: </th>
                        <td align="left" valign="top"><input type="text" name="strAdvertName" value="<% = ChooseDefaultValue(Request.Form("strAdvertName"), "New Advert", bFirstDisplay) %>" size="30" maxlength="50" />                        </td>
                      </tr>
                      <tr>
                        <th align="left" valign="top" colspan="2"> Provide a name for this advert, such as "Main Advert" or "Christmas Opening Times"<br />                        </th>
                      </tr>
                      <%
        End if
        %>
                      <tr>
                        <td align="left" valign="top" colspan="2"><br />
                            <h3>Business Information</h3>
                          <br />
                          Provide the name of your business as you wish it to be displayed in your advert<br />
                          &nbsp; </td>
                      </tr>
                      <tr>
                        <th align="left" valign="top" width="200"> Company Name Text: </th>
                        <td align="left" valign="top"><input type="text" name="strCompanyNameText" value="<% = ChooseDefaultValue(Request.Form("strCompanyNameText"), rsSubscriptions("CompanyTradingName"), bFirstDisplay) %>" size="30" maxlength="100" />                        </td>
                      </tr>
                      <tr>
                        <td align="left" valign="top" colspan="2"><br />
                            <h3>Contact Details</h3>
                          <br />
                          The details provide here will be visible to all users of the website.<br />
                          &nbsp; </td>
                      </tr>
                      <tr>
                        <th align="left" valign="top"> Address 1: </th>
                        <td align="left" valign="top"><input type="text" name="strContactAddress1" value="<% = ChooseDefaultValue(Request.Form("strContactAddress1"), rsSubscriptions("Billing_Address1"), bFirstDisplay) %>" size="30" maxlength="50" />                        </td>
                      </tr>
                      <tr>
                        <th align="left" valign="top"> Address 2: </th>
                        <td align="left" valign="top"><input type="text" name="strContactAddress2" value="<% = ChooseDefaultValue(Request.Form("strContactAddress2"), rsSubscriptions("Billing_Address2"), bFirstDisplay) %>" size="30" maxlength="50" />                        </td>
                      </tr>
                      <tr>
                        <th align="left" valign="top"> Town: </th>
                        <td align="left" valign="top"><input type="text" name="strContactTown" value="<% = ChooseDefaultValue(Request.Form("strContactTown"), rsSubscriptions("Billing_Town"), bFirstDisplay) %>" size="30" maxlength="50" />                        </td>
                      </tr>
                      <tr>
                        <th align="left" valign="top"> County: </th>
                        <td align="left" valign="top"><input type="text" name="strContactCounty" value="<% = ChooseDefaultValue(Request.Form("strContactCounty"), rsSubscriptions("Billing_County"), bFirstDisplay) %>" size="30" maxlength="50" />                        </td>
                      </tr>
                      <tr>
                        <th align="left" valign="top"> Postcode: </th>
                        <td align="left" valign="top"><input type="text" name="strContactPostcode" value="<% = ChooseDefaultValue(Request.Form("strContactPostcode"), rsSubscriptions("Billing_Postcode"), bFirstDisplay) %>" size="10" maxlength="10" />                        </td>
                      </tr>
                      <tr>
                        <th align="left" valign="top"> Email: </th>
                        <td align="left" valign="top"><input type="text" name="strContactEmail" value="<% = ChooseDefaultValue(Request.Form("strContactEmail"), rsSubscriptions("EmailAddress"), bFirstDisplay) %>" size="30" maxlength="255" />                        </td>
                      </tr>
                      <%
        if rsSubscriptions("AllowPhoneNumber") = True then
            %>
                      <tr>
                        <th align="left" valign="top"> Telephone: </th>
                        <td align="left" valign="top"><input type="text" name="strContactTel" value="<% = ChooseDefaultValue(Request.Form("strContactTel"), rsSubscriptions("Phone"), bFirstDisplay) %>" size="30" maxlength="20" />                        </td>
                      </tr>
                      <%
        End if
        if rsSubscriptions("AllowFaxNumber") = True then
            %>
                      <tr>
                        <th align="left" valign="top"> Fax Number: </th>
                        <td align="left" valign="top"><input type="text" name="strContactFax" value="<% = ChooseDefaultValue(Request.Form("strContactFax"), rsSubscriptions("Fax"), bFirstDisplay) %>" size="30" maxlength="20" />                        </td>
                      </tr>
                      <%
        End if
        if rsSubscriptions("AllowWebLink") = True then
            %>
                      <tr>
                        <th align="left" valign="top"> Website: </th>
                        <td align="left" valign="top"><input type="text" name="strWebAddress" value="<% = Request.Form("strWebAddress") %>" size="30" maxlength="255" />                        </td>
                      </tr>
                      <%
        End if
        if rsSubscriptions("AllowLogo") = True then
            %>
                      <tr style="margin-top:0.5em;">
                        <th align="left" valign="top"> Logo: </th>
                        <td align="left" valign="baseline"> All logos must be in either JPEG or GIF format and a maximum of 125 x 125 pixels.<br />
                          Tick this box if you wish to show a logo on your advert.&nbsp;
                          <input type="checkbox" name="blnUploadLogo" /></td>
                      </tr>
                      <tr style="margin-top:0.5em;">
                        <th align="left" valign="top">Photos:</th>
                        <td align="left" valign="baseline"><p>You may upload up to 6 images to be displayed as part of a full page advert.</p>
                            <p>Tick this box if you wish to upload images.
                              <input type="checkbox" name="blnUploadImages" />
                            </p></td>
                      </tr>
                      <%
        End if
        %>
                      <tr>
                        <td align="left" valign="top" colspan="2"><br />
                            <h3>Advert Content</h3>
                          <br />
                          Using the Description and Bullet Points, describe your business as you would like it to appear on your advert.<br />
                          &nbsp; </td>
                      </tr>
                    <%
                     If rsSubscriptions("AllowSummaryText") = True then
                    %>
                      <tr>
                        <th align="left" valign="top" style="margin-top:0;vertical-align:top;"> Brief Summary: </th>
                        <td align="left" valign="top"><textarea id="article" name="strSummaryText" cols="90%"  maxlength="350" rows="6"><%=request.form("strSummaryText")%></textarea>
<script type="text/javascript">
    CKEDITOR.replace( 'article',
    {
        toolbar : 'article',
    });
</script>
</td>
                      </tr>
                    <% End if %>
                    <%
                     If rsSubscriptions("FullPageAdvert") = True then
                    %>
                      <tr>
                        <th align="left" valign="top" style="margin-top:0;vertical-align:top;"> Description Text: </th>
                        <td align="left" valign="top"><textarea name="strDescriptionText" id="strDescriptionText" cols="50" rows="10" class="editor"><%=request.form("strDescriptionText")%></textarea>
<script type="text/javascript">
    CKEDITOR.replace( 'article',
    {
        toolbar : 'article',
    });
</script>
</td>
                      </tr>
                    <% End if %>


                    <%
                     If rsSubscriptions("AllowOpeningTimes") = True then
                    %>
        <tr>
          <th align="left" valign="top">Twitter Name (e.g. InsideBrentwod)</th>
          <th align="left" valign="top">
          	<input type="text" name="strTwitter" value="<% = Request.Form("strTwitter") %>" size="30" maxlength="100" /> 
          </th>          
        </tr>
                  
        <tr>
          <th align="left" valign="top">Twitter ID (e.g. 268336500536647680)</th>
          <th align="left" valign="top">
          	<input type="text" name="strTwitterID" value="<% = Request.Form("strTwitterID") %>" size="30" maxlength="100" /> 
          </th>          
        </tr>
              <% End if %>

                    <%
                     If rsSubscriptions("AllowOpeningTimes") = True then
                    %>
        <tr>
          <th align="left" valign="top">Monday</th>
          <th align="left" valign="top">
          	<% CreateDayNameTimeSelectionBox "OpenMonday", NULL, False %>
          </th>          
        </tr>
        <tr>
          <th align="left" valign="top">Tuesday</th>
          <th align="left" valign="top">
          	<% CreateDayNameTimeSelectionBox "OpenTuesday", NULL, False %>
          </th>          
        </tr>
        <tr>
          <th align="left" valign="top">Wednesday</th>
          <th align="left" valign="top">
          	<% CreateDayNameTimeSelectionBox "OpenWednesday", NULL, False %>
          </th>          
        </tr>
        <tr>
          <th align="left" valign="top">Thursday</th>
          <th align="left" valign="top">
          	<% CreateDayNameTimeSelectionBox "OpenThursday", NULL, False %>
          </th>          
        </tr>
        <tr>
          <th align="left" valign="top">Friday</th>
          <th align="left" valign="top">
          	<% CreateDayNameTimeSelectionBox "OpenFriday", NULL, False %>
          </th>          
        </tr>
        <tr>
          <th align="left" valign="top">Saturday</th>
          <th align="left" valign="top">
          	<% CreateDayNameTimeSelectionBox "OpenSaturday", NULL, False %>
          </th>          
        </tr>
        <tr>
          <th align="left" valign="top">Sunday</th>
          <th align="left" valign="top">
          	<% CreateDayNameTimeSelectionBox "OpenSunday", NULL, False %>
          </th>          
        </tr>
       <% End if %>
                    <%
                     If rsSubscriptions("AllowVoucher") = True then
                    %>
                      <tr>
                        <th align="left" valign="top" style="margin-top:0;vertical-align:top;">Voucher Heading</th>
                        <td align="left" valign="top"><input type="text" name="strVoucherTitle" value="<%=request.form("strVoucherTitle")%>" /></td>
                      </tr>
                      <tr>
                        <th align="left" valign="top" style="margin-top:0;vertical-align:top;">Voucher Contents</th>
                        <td align="left" valign="top"><textarea name="strVoucherText" cols="50" rows="3"><%=request.form("strVoucherText")%></textarea></td>
                      </tr>
                      <tr>
                        <th align="left" valign="top" style="margin-top:0;vertical-align:top;">&nbsp;</th>
                        <td align="left" valign="top">&nbsp;</td>
                      </tr>
                    <%
                     End if
                    %>

                      <%
        if rsSubscriptions("BulletPointLimit") > 0 then
            For iLoop = 1 to rsSubscriptions("BulletPointLimit")
                %>
                      <tr>
                        <th align="left" valign="top">Bullet Point
                          <% = iLoop %>
                          :</th>
                        <td align="left" valign="top"><input type="text" name="strBulletPoint<% = iLoop %>" value="<% = Request.Form("strBulletPoint" & Trim(CStr(iLoop))) %>" size="30" maxlength="30 "/>                        </td>
                      </tr>
                      <%
            Next
        End if
        %>
                      <%
        If rsSubscriptions("AllowEditAdvert") = False then
            %>
                      <tr>
                        <td align="left" valign="top" colspan="2">
                            <h3>Finish Advert</h3>
                          <br />
                          Please read and check all of this page and make sure you are happy with this advert before submitting.  You will not be able to change any details after submitting this advert for approval.<br />
                          &nbsp; </td>
                      </tr>
                      <tr id="tr1">
                        <th align="left" valign="top"> Category: </th>
                        <td align="left" valign="top"><select name="strRequestMakeLiveInSubDir1GID" style="width:60%;">
                            <%
                        CreateSelectOption "", " - Choose a Subcategory - ", rsSubscriptions("ActiveSubDir1GID")
                        SQLCommand = "USP_Helper_GetAllSelectableDirectoriesForTopDir '" & ThisFranchiseGID & "', '" & rsSubscriptions("DirectoryGID") & "'"
                        rsTemp.Open SQLCommand, objConn, adOpenStatic, adLockReadOnly
                        While Not rsTemp.EOF
                            CreateSelectOption rsTemp("GID"), rsTemp("DirectoryName"), rsSubscriptions("ActiveSubDir1GID")
                            rsTemp.MoveNext
                        Wend
                        rsTemp.Close
                        %>
                          </select>                        </td>
                      </tr>
                      <%
            if rsSubscriptions("NumberOfSubCategories") > 1 then
                %>
                      <tr id="tr2">
                        <th align="left" valign="top"> Category 2: </th>
                        <td align="left" valign="top"><select name="strRequestMakeLiveInSubDir2GID" style="width:60%;">
                            <%
                            CreateSelectOption "", " - Choose the 2nd Subcategory - ", rsSubscriptions("ActiveSubDir2GID")
                            SQLCommand = "USP_Helper_GetAllSelectableDirectoriesForTopDir '" & Session("PublicFranchiseGID") & "', '" & rsSubscriptions("DirectoryGID") & "'"
                            rsTemp.Open SQLCommand, objConn, adOpenStatic, adLockReadOnly
                            While Not rsTemp.EOF
                                CreateSelectOption rsTemp("GID"), rsTemp("DirectoryName"), rsSubscriptions("ActiveSubDir2GID")
                                rsTemp.MoveNext
                            Wend
                            rsTemp.Close
                            %>
                          </select>                        </td>
                      </tr>
                      <%
            End if
            %>
                      <tr>
                        <td align="center" valign="top" colspan="2"><input type="button" value="I have finished my Advert.  Submit it for Approval" onclick="javascript:finishedSingleAd();" />                        </td>
                      </tr>
                      <%
        Else
            %>
                      <tr>
                        <td align="left" valign="top" colspan="2"><br />
                            <h3>Finish Advert</h3>
                          <br />
                          Please take a moment to read over the contents of this page to check all of the information supplied is accurate and that you are happy with the details provided.
                          If you want this advert to become live as soon as it is approved, please ensure this box is ticked. Otherwise if unchecked, once approved, you will have the option of making this advert live at any time.<br />
                          &nbsp; </td>
                      </tr>
                      <tr>
                        <th align="left" valign="top" colspan="2"> Publish my advert straight away
                          <%
                    if intSubscriptionAdvertCount = 0 then
                        blnRequestMakeLiveWhenApproved = True
                    ElseIf intSubscriptionAdvertCount = 1 then
                        blnRequestMakeLiveWhenApproved = True
                    Else
                        blnRequestMakeLiveWhenApproved = False
                    End if
                    %>
                            <input type="checkbox" name="blnRequestMakeLiveWhenApproved" id="blnRequestMakeLiveWhenApproved" onclick="javascript:changeMakeLive();" <% = GetCheckBoxStatus_FromBoolean(blnRequestMakeLiveWhenApproved) %> />
                            <br />
                          &nbsp; </th>
                      </tr>
                      <%
						sub drawdirs(parent,parentstr)
							sql = "GetAllDirectories '"&ThisFranchiseGID&"'" & iif(len(parent)>0,",'"&parent&"'","")
							response.write sql&vbcrlf
							getrs rs,sql,""
							while not rs.eof
								if ""&rs("Subdirs") = "0" then
									' end of the trail, write the string
									response.write "<option value='"&rs("GID")&"'>"&parentstr & iif(len(""&parentstr)>0," > ","") & rs("DirectoryName")&"</option>"&vbcrlf
								else
									' subdirs exist, recurse
									drawdirs rs("GID"), parentstr & iif(len(""&parentstr)>0," > ","") & rs("DirectoryName")
								end if
							rs.movenext
							wend
						end sub
					  %>
                      <% for i = 1 to cint(rsSubscriptions("NumberOfSubCategories")) %>
                      <tr>
                      		<th align="left" valign="top">Category <%=i%>:</th>
                            <td align="left" valign="top">
                            	<select name="subcategory<%=i%>" style="width:400px;">
                                	<option value="">- Choose a Subcategory -</option>
									<% drawdirs "","" %>                                	
                                </select>
                            </td>
                      </tr>
                      
                      <% next %>
                      
                      <tr>
                        <td align="center" valign="top" colspan="2"><br />
                          &nbsp;
                          <input class="submit" type="button" value="Submit for Approval" onclick="CKupdate();submitForApproval();" />
                          <input class="submit" type="button" value="Save to Edit Later" onclick="CKupdate();saveToEditLater();" />
                          <input class="submit" type="button" value="Cancel Changes" onclick="CKupdate();cancelChanges();" />                        </td>
                      </tr>
           <% End if %>
                    </table>
 <script type="text/javascript">
    <!--
	function CKupdate(){
    for ( instance in CKEDITOR.instances )
        CKEDITOR.instances[instance].updateElement();
	}

        function changeMakeLive(){
            try{
                if(document.getElementById('blnRequestMakeLiveWhenApproved').checked==true){
                    document.getElementById('trActiveSubDir1').style.display='block';
                    document.getElementById('trActiveSubDir2').style.display='block';
                }else{
                    document.getElementById('trActiveSubDir1').style.display='none';
                    document.getElementById('trActiveSubDir2').style.display='none';
                }
            }catch(e){
            }
        }
        function finishedSingleAd(){
            if(confirm('You are about to submit your advert for approval.\n\nOnce approved, you will not be able to amend your advert.\n\nAre you sure you want to continue?')){
                document.getElementById('blnRequestApproval').value='1';
                document.getElementById('FormAction').value='CreateAdvert';
                document.getElementById('EditForm').submit();
            }   
        }
        function submitForApproval(){
            if(document.getElementById('blnRequestMakeLiveWhenApproved').checked==true){
                if(confirm('You are about to submit your advert for approval.\n\nOnce approved, this advert will be made live, replacing any existing advert.\n\nClick OK to Continue, or Cancel to abort')){
                    // Submit
                    document.getElementById('blnRequestApproval').value='1';
                    document.getElementById('FormAction').value='CreateAdvert';
                    document.getElementById('EditForm').submit();
                }
            }else{
                if(confirm('You are about to submit your advert for approval.\n\nOnce approved, you will have the option of making this advert live at any time.\n\nClick OK to Continue, or Cancel to abort')){
                    // Submit
                    document.getElementById('blnRequestApproval').value='1';
                    document.getElementById('FormAction').value='CreateAdvert';
                    document.getElementById('EditForm').submit();
                }
            }
        }
        function saveToEditLater(){
            document.getElementById('blnRequestApproval').value='0';
            document.getElementById('FormAction').value='CreateAdvert';
            document.getElementById('EditForm').submit();
        }
        function cancelChanges(){
            document.location='/AdvertiserAdmin/ManageSubscriptions/ManageAdverts/Default.asp?CSGID=<% = CleanResponseText(Request("CSGID")) %>&AutoCreate=0';
        }
    //-->
                  </script>
                    <%
rsSubscriptions.Close
objConn.Close
%>
 <br />
</form>
<!--#include virtual="/Assets/Templates/Public/Franchise/TemplateEnd.asp"-->
</body>
</html>
<!--#include virtual="/System/Shutdown.asp"-->

Open in new window


Here's the i_ManageAdverts include when creating an advert just in case:

<%
Dim objConn : Set objConn = Server.CreateObject("ADODB.Connection")
Dim rsClients : Set rsClients = Server.CreateObject("ADODB.RecordSet")
Dim rsSubscriptions : Set rsSubscriptions = Server.CreateObject("ADODB.RecordSet")
Dim rsAdverts : Set rsAdverts = Server.CreateObject("ADODB.RecordSet")
Dim rsTemp : Set rsTemp = Server.CreateObject("ADODB.RecordSet")
Dim SQLCommand

Dim iLoop
Dim blnFirstAdvert
Dim intSubscriptionAdvertCount

Dim strNewAdvertGID
Dim strAdvertName
Dim strCompanyNameText
Dim strContactAddress1
Dim strContactAddress2
Dim strContactTown
Dim strContactCounty
Dim strContactPostcode
Dim strContactEmail
Dim strContactTel
Dim strContactFax
Dim strWebAddress
Dim blnUploadLogo
Dim strSummaryText
Dim strDescriptionText
Dim intDescriptionTextWordCount
Dim strTwitter
Dim strTwitterID
Dim strBulletPointX
Dim strOpeningTimes
Dim strOpenMonday
Dim strOpenTuesday
Dim strOpenWednesday
Dim strOpenThursday
Dim strOpenFriday
Dim strOpenSaturday
Dim strOpenSunday
Dim blnRequestApproval
Dim blnRequestMakeLiveWhenApproved

Dim blnReferencesRequired
Dim strActiveAdvertGID
Dim strActiveSubDir1GID
Dim strActiveSubDir2GID

Dim strRequestMakeLiveInSubDir1GID
Dim strRequestMakeLiveInSubDir2GID

Dim strUserError : strUserError = ""

Dim blnDivertToReferences

Dim strAdvertSubmitConfirmMessage

Function DirectoryNeedsReferences(byVal DirectoryGID)
    If IsNull(DirectoryGID) then
        DirectoryNeedsReferences = False
        Exit Function
    End if
    Dim oConn : Set oConn = Server.CreateObject("ADODB.Connection")
    Dim rsDir : Set rsDir = Server.CreateObject("ADODB.RecordSet")
    Dim sSQL
    sSQL = "SELECT * FROM Directories WHERE GID = '" & CleanSQLText(DirectoryGID) & "'"
    oConn.Open strConn
    rsDir.Open sSQL, oConn, adOpenStatic, adLockReadOnly
    if rsDir.RecordCount = 1 then
        DirectoryNeedsReferences = rsDir("ReferencesRequired")
    Else
        FailSystemEvent "DirectoryNeedsReferences failed to load Directory ID"
    End if
    rsDir.Close
    oConn.Close
    Set rsDir = Nothing
    Set oConn = Nothing
End Function

' Load Startup Data
Select Case UCase(Request.Form("FormAction"))
    Case "CREATEADVERT"
        ' Load Data
        objConn.Open strConn
        SQLCommand = "SELECT * FROM ClientAdverts WHERE ClientSubscriptionGID = '" & CleanSQLText(Request("CSGID")) & "' AND ClientGID = '" & Session("PublicClientGID") & "'"
        rsAdverts.Open SQLCommand, objConn, adOpenStatic, adLockReadOnly
        intSubscriptionAdvertCount = rsAdverts.RecordCount
        rsAdverts.Close
        SQLCommand = "SELECT * FROM uvw_AdvertiserAdmin_SubscriptionDetails WHERE GID = '" & CleanSQLText(Request("CSGID")) & "' AND ClientGID = '" & Session("PublicClientGID") & "'"
        rsSubscriptions.Open SQLCommand, objConn, adOpenStatic, adLockReadOnly

        ' Check that the Max Number of Advert rule is applied
        If rsSubscriptions("AllowEditAdvert") = False then
            ' Validate this is the first time, otherwise someone is trying it on!
            if intSubscriptionAdvertCount = 0 then
                ' Good to go
            Else
                FailSystemEvent "AdvertiserAdmin.CreateNewAdvert - Error occured creating Requested FirstTime Advert.  Advert already Exists"
            End if
        Else
            ' Check we have the Allowed number of Adverts
            If intSubscriptionAdvertCount > rsSubscriptions("NumberOfAdvertTemplates") then
                FailUserEvent "You have already reached the maximum number of Advert Templates allowed with your subscription"
            End if
        End if

        ' Save all fields allowed in this Subscription
        if rsSubscriptions("AllowEditAdvert") = True and _
            rsSubscriptions("NumberOfAdvertTemplates") > 1 then
            strAdvertName = CleanSQLData(Request.Form("strAdvertName"))
            if strAdvertName = "" Or Len(strAdvertName) > 50 then
                strUserError = strUserError & "You must specify an Advert Name which must be no longer than 50 characters<br>"
            end if
        Else
            strAdvertName = "Default Advert"
        End if
        strCompanyNameText = CleanSQLData(Request.Form("strCompanyNameText"))
        If strCompanyNameText = "" or Len(strCompanyNameText) > 100 then
            strUserError = strUserError & "You must specify the Company Name which must be no longer than 100 characters<br>"
        End if
        strContactAddress1 = CleanSQLData(Request.Form("strContactAddress1"))
        if Len(strContactAddress1) > 50 then
            strUserError = strUserError & "Contact Address 1 cannot be more than 50 characters<br>"
        end if
        strContactAddress2 = CleanSQLData(Request.Form("strContactAddress2"))
        if Len(strContactAddress2) > 50 then
            strUserError = strUserError & "Contact Address 2 cannot be more than 50 characters<br>"
        end if
        strContactTown = CleanSQLData(Request.Form("strContactTown"))
        if Len(strContactTown) > 50 then
            strUserError = strUserError & "Contact Town cannot be more than 50 characters<br>"
        end if
        strContactCounty = CleanSQLData(Request.Form("strContactCounty"))
        if Len(strContactCounty) > 50 then
            strUserError = strUserError & "Contact County cannot be more than 50 characters<br>"
        end if
        strContactPostcode = CleanSQLData(Request.Form("strContactPostcode"))
        if Len(strContactPostcode) > 50 then
            strUserError = strUserError & "Contact Postcode cannot be more than 50 characters<br>"
        end if
        strContactEmail = CleanSQLData(Request.Form("strContactEmail"))
        if Len(strContactEmail) > 255 then
            strUserError = strUserError & "Contact Email cannot be more than 255 characters<br>"
        end if
        if rsSubscriptions("AllowPhoneNumber") = True then
            strContactTel = CleanSQLData(Request.Form("strContactTel"))
            if Len(strContactTel) > 20 then
                strUserError = strUserError & "Contact Telephone cannot be more than 20 characters<br>"
            end if
        end if
        if rsSubscriptions("AllowFaxNumber") = True then
            strContactFax = CleanSQLData(Request.Form("strContactFax"))
            if Len(strContactFax) > 20 then
                strUserError = strUserError & "Contact Fax cannot be more than 20 characters<br>"
            end if
        End if
        if rsSubscriptions("AllowWebLink") = True then
            strWebAddress = CleanSQLData(Request.Form("strWebAddress"))
            if Len(strWebAddress) > 255 then
                strUserError = strUserError & "Your Web Address cannot be more than 255 characters<br>"
            end if
        End if
        if rsSubscriptions("AllowLogo") = True then
            blnUploadLogo = GetBITFromCheckBox("blnUploadLogo")
        Else
            blnUploadLogo = False
        End if
		
		blnUploadImages = GetBITFromCheckBox("blnUploadImages")

        If rsSubscriptions("AllowSummaryText") = True then
            strSummaryText = (Request.Form("strSummaryText"))
            if Len(strSummaryText) > 350 then
                strUserError = strUserError & "The Summary Text cannot be longer than 350 characters<br>"
            end if
        End if

       if rsSubscriptions("FullPageAdvert") = True then
        strDescriptionText = (Request.Form("strDescriptionText"))
        intDescriptionTextWordCount = WordCount(strDescriptionText)
          If intDescriptionTextWordCount > rsSubscriptions("DescriptionWordLimit") then
            strUserError = strUserError & "The Description field can only contain up to " & rsSubscriptions("DescriptionWordLimit") & " words in line with your subscription<br>"
          End if
       End if
        if rsSubscriptions("BulletPointLimit") > 0 then
            For iLoop = 1 to rsSubscriptions("BulletPointLimit")
                strBulletPointX = CleanSQLData(Request.Form("strBulletPoint" & Trim(CStr(iLoop))))
                if Len(strBulletPointX) > 30 then
                    strUserError = strUserError & "Bullet Point " & Trim(CSTr(iLoop)) & " cannot be longer than 30 characters<br>"
                End if
            Next
        End if

        If 1=1 or rsSubscriptions("AllowOpeningTimes") = True then
            strTwitter = (Request.Form("strTwitter"))
        End if

        If 1=1 or rsSubscriptions("AllowOpeningTimes") = True then
            strOpeningTimes = (Request.Form("strOpeningHours"))
        End if

        If 1=1 or rsSubscriptions("AllowOpeningTimes") = True then
            strOpenMonday = (Request.Form("strOpenMonday"))
            strOpenTuesday = (Request.Form("strOpenTuesday"))
            strOpenWednesday = (Request.Form("strOpenWednesday"))
            strOpenThursday = (Request.Form("strOpenThursday"))
            strOpenFriday = (Request.Form("strOpenFriday"))
            strOpenSaturday = (Request.Form("strOpenSaturday"))
            strOpenSunday = (Request.Form("strOpenSunday"))
        End if

        blnRequestApproval = GetBoolean_FromParamValue(Request.Form("blnRequestApproval"))
		
		
        blnRequestMakeLiveWhenApproved = GetBITFromCheckBox("blnRequestMakeLiveWhenApproved")

		strNewAdvertGID = NewGUID()
		if len(""&strUserError) = 0 then		
			' populate category link table
			bNoCategories = True
				for i = 1 to cint(rsSubscriptions("NumberOfSubCategories"))
					if len(""&request.form("subcategory"&i))>0 then
						bNoCategories = False
						exesql "INSERT INTO AdvertDirectories (AdvertGID,AdvertDirectory) VALUES ('"&StrNewAdvertGID&"','"&request.form("subcategory"&i)&"');",""

						If blnRequestMakeLiveWhenApproved = True then
						If DirectoryNeedsReferences(request.form("subcategory"&i)) then
							blnDivertToReferences = True
						End if
						End if
						
					end if
				next
			if bNoCategories then
                strUserError = strUserError & "Please select at least one subcategory.<br>"
			end if
		end if
		
        if strUserError = "" then
            SQLCommand = "SELECT TOP 1 * FROM ClientAdverts WHERE ClientGID = '" & Session("PublicClientGID") & "'"
            rsAdverts.Open SQLCommand, objConn, adOpenKeySet, adLockOptimistic
            rsAdverts.AddNew
            
            rsAdverts("GID") = strNewAdvertGID
            rsAdverts("ClientGID") = Session("PublicClientGID")
            rsAdverts("ClientSubscriptionGID") = CleanSQLText(Request("CSGID"))
            rsAdverts("AdvertName") = strAdvertName
            rsAdverts("CompanyNameText") = strCompanyNameText
			rsAdverts("SummaryText") = strSummaryText
            rsAdverts("DescriptionText") = strDescriptionText
			rsAdverts("VoucherTitle") = ""&request.form("strVoucherTitle")
			rsAdverts("VoucherText") = ""&request.form("strVoucherText")
            rsAdverts("ContactAddress1") = strContactAddress1
            rsAdverts("ContactAddress2") = strContactAddress2
            rsAdverts("ContactTown") = strContactTown
            rsAdverts("ContactCounty") = strContactCounty
            rsAdverts("ContactPostcode") = strContactPostcode
            rsAdverts("ContactEmail") = strContactEmail
            rsAdverts("ContactTel") = strContactTel
            rsAdverts("ContactFax") = strContactFax
            rsAdverts("WebAddress") = strWebAddress
            rsAdverts("Twitter") = strTwitter
            rsAdverts("TwitterID") = strTwitterID
            rsAdverts("LogoFile") = NULL
            rsAdverts("OpeningTimes") = strOpeningTimes
            rsAdverts("OpenMonday") = strOpenMonday
            rsAdverts("OpenTuesday") = strOpenTuesday
            rsAdverts("OpenWednesday") = strOpenWednesday
            rsAdverts("OpenThursday") = strOpenThursday
            rsAdverts("OpenFriday") = strOpenFriday
            rsAdverts("OpenSaturday") = strOpenSaturday
            rsAdverts("OpenSunday") = strOpenSunday
            if rsSubscriptions("BulletPointLimit") > 0 then
                For iLoop = 1 to rsSubscriptions("BulletPointLimit")
                    strBulletPointX = CleanSQLData(Request.Form("strBulletPoint" & Trim(CStr(iLoop))))
                    rsAdverts("BulletPoint" & Trim(CStr(iLoop))) = strBulletPointX
                Next
            End if
            rsAdverts("RequestApproval") = blnRequestApproval
            rsAdverts("RequestMakeLiveWhenApproved") = blnRequestMakeLiveWhenApproved
            rsAdverts("RequestMakeLiveInSubDir1GID") = strRequestMakeLiveInSubDir1GID
            rsAdverts("RequestMakeLiveInSubDir2GID") = strRequestMakeLiveInSubDir2GID
            rsAdverts("ReferencesChecked") = False
            rsAdverts("Approved") = False
            rsAdverts("ApprovalRefusedReason") = Null
            rsAdverts.Update
            objConn.Close

            if blnRequestApproval = True then
                If GetSystemParam("Emails_SendAutoEmails") = "1" then
                    SendEmail GetSiteConfig("Public_AutoEmailsFrom"), GetSiteConfig("Notify_ApprovalWaiting"), "Confirm New Advert", GetContent("EmailTemplate_ClientApprovalWaiting", Session("PublicFranchiseGID")), True
                End if
            End if
            
            if blnUploadLogo = True or blnUploadImages = True then
                If blnDivertToReferences = True or 1=2 then
                    strAdvertSubmitConfirmMessage = GetContent("AdvertiserAdmin_SubmitAdvertConfirm_LogoRef", Session("PublicFranchiseGID"))
                    DoJavaAlert strAdvertSubmitConfirmMessage
                    DoJavaRedirect "/AdvertiserAdmin/ManageSubscriptions/ManageAdverts/SetAdvertLogo.asp?CSGID=" & Request("CSGID") & "&AGID=" & strNewAdvertGID & "&LoadRef=1"
                    Response.End
                Else
                    strAdvertSubmitConfirmMessage = GetContent("AdvertiserAdmin_SubmitAdvertConfirm_LogoNoRef", Session("PublicFranchiseGID"))
                    DoJavaAlert strAdvertSubmitConfirmMessage
                    DoJavaRedirect "/AdvertiserAdmin/ManageSubscriptions/ManageAdverts/SetAdvertLogo.asp?CSGID=" & Request("CSGID") & "&AGID=" & strNewAdvertGID                
                    Response.End
                End if
            Else
                If blnDivertToReferences = True or 1=2 then
                    strAdvertSubmitConfirmMessage = GetContent("AdvertiserAdmin_SubmitAdvertConfirm_NoLogoRef", Session("PublicFranchiseGID"))
                    DoJavaAlert strAdvertSubmitConfirmMessage
                    DoJavaRedirect "/AdvertiserAdmin/ManageReferences/Default.asp?CSGID=" & Request("CSGID") & "&RefRequiredByAd=1"
                    Response.End
                Else
                    strAdvertSubmitConfirmMessage = GetContent("AdvertiserAdmin_SubmitAdvertConfirm_NoLogoNoRef", Session("PublicFranchiseGID"))
                    DoJavaAlert strAdvertSubmitConfirmMessage
                    DoJavaRedirect "/AdvertiserAdmin/ManageSubscriptions/ManageAdverts/Default.asp?CSGID=" & Request("CSGID")
                    Response.End
                End if
            End if
        End if
        objConn.Close
    Case "UPDATEADVERT"
        ' Load Data
        objConn.Open strConn
        SQLCommand = "SELECT * FROM ClientAdverts WHERE ClientSubscriptionGID = '" & CleanSQLText(Request("CSGID")) & "' AND ClientGID = '" & Session("PublicClientGID") & "'"
        rsAdverts.Open SQLCommand, objConn, adOpenStatic, adLockReadOnly
        intSubscriptionAdvertCount = rsAdverts.RecordCount
        rsAdverts.Close
        SQLCommand = "SELECT * FROM uvw_AdvertiserAdmin_SubscriptionDetails WHERE GID = '" & CleanSQLText(Request("CSGID")) & "' AND ClientGID = '" & Session("PublicClientGID") & "'"
        rsSubscriptions.Open SQLCommand, objConn, adOpenStatic, adLockReadOnly

        ' Check Logged in User is allowed to update the specified Advert
        If rsSubscriptions("AllowEditAdvert") = False then
            if rsSubscriptions("Approved") = True then
                FailSystemEvent "AdvertiserAdmin.CreateNewAdvert - Error occured creating Requested FirstTime Advert.  Advert already Exists"
            End if
        End if

        ' Update fields
        SQLCommand = "SELECT * FROM ClientAdverts WHERE ClientSubscriptionGID = '" & CleanSQLText(Request("CSGID")) & "' AND ClientGID = '" & Session("PublicClientGID") & "' AND GID = '" & CleanSQLText(Request("AGID")) & "'"
        rsAdverts.Open SQLCommand, objConn, adOpenKeySet, adLockOptimistic

        ' Save all fields allowed in this Subscription
        If rsSubscriptions("NumberOfAdvertTemplates") > 1 then
            strAdvertName = CleanSQLData(Request.Form("strAdvertName"))
            if strAdvertName = "" Or Len(strAdvertName) > 50 then
                strUserError = strUserError & "You must specify an Advert Name which must be no longer than 50 characters<br>"
            Else
                rsAdverts("AdvertName") = strAdvertName
            end if
        Else
            rsAdverts("AdvertName") = "Default Advert"
        End if
        strCompanyNameText = CleanSQLData(Request.Form("strCompanyNameText"))
        If strCompanyNameText = "" or Len(strCompanyNameText) > 100 then
            strUserError = strUserError & "You must specify the Company Name which must be no longer than 100 characters<br>"
        Else
            rsAdverts("CompanyNameText") = strCompanyNameText
        End if
        strContactAddress1 = CleanSQLData(Request.Form("strContactAddress1"))
        if Len(strContactAddress1) > 50 then
            strUserError = strUserError & "Contact Address 1 cannot be more than 50 characters<br>"
        Else
            rsAdverts("ContactAddress1") = strContactAddress1
        end if
        strContactAddress2 = CleanSQLData(Request.Form("strContactAddress2"))
        if Len(strContactAddress2) > 50 then
            strUserError = strUserError & "Contact Address 2 cannot be more than 50 characters<br>"
        Else
            rsAdverts("ContactAddress2") = strContactAddress2
        end if
        strContactTown = CleanSQLData(Request.Form("strContactTown"))
        if Len(strContactTown) > 50 then
            strUserError = strUserError & "Contact Town cannot be more than 50 characters<br>"
        Else
            rsAdverts("ContactTown") = strContactTown
        end if
        strContactCounty = CleanSQLData(Request.Form("strContactCounty"))
        if Len(strContactCounty) > 50 then
            strUserError = strUserError & "Contact County cannot be more than 50 characters<br>"
        Else
            rsAdverts("ContactCounty") = strContactCounty
        end if
        strContactPostcode = CleanSQLData(Request.Form("strContactPostcode"))
        if Len(strContactPostcode) > 50 then
            strUserError = strUserError & "Contact Postcode cannot be more than 50 characters<br>"
        Else
            rsAdverts("ContactPostcode") = strContactPostcode
        end if
        strContactEmail = CleanSQLData(Request.Form("strContactEmail"))
        if Len(strContactEmail) > 255 then
            strUserError = strUserError & "Contact Email cannot be more than 255 characters<br>"
        Else
            rsAdverts("ContactEmail") = strContactEmail
        end if
        if rsSubscriptions("AllowPhoneNumber") = True then
            strContactTel = CleanSQLData(Request.Form("strContactTel"))
            if Len(strContactTel) > 20 then
                strUserError = strUserError & "Contact Telephone cannot be more than 20 characters<br>"
            Else
                rsAdverts("ContactTel") = strContactTel
            end if
        end if
        if rsSubscriptions("AllowFaxNumber") = True then
            strContactFax = CleanSQLData(Request.Form("strContactFax"))
            if Len(strContactFax) > 20 then
                strUserError = strUserError & "Contact Fax cannot be more than 20 characters<br>"
            Else
                rsAdverts("ContactFax") = strContactFax
            end if
        End if
        if rsSubscriptions("AllowWebLink") = True then
            strWebAddress = CleanSQLData(Request.Form("strWebAddress"))
            if Len(strWebAddress) > 255 then
                strUserError = strUserError & "Your Web Address cannot be more than 255 characters<br>"
            Else
                rsAdverts("WebAddress") = strWebAddress
            end if
        End if
        if rsSubscriptions("AllowLogo") = True then
            blnUploadLogo = GetBITFromCheckBox("blnUploadLogo")
        Else
            blnUploadLogo = False
        End if
		
	        blnUploadImages = GetBITFromCheckBox("blnUploadImages")

		strSummaryText = (Request.Form("strSummaryText"))
		if Len(strSummaryText) > 350 then
			strUserError = strUserError & "The Summary Text cannot be longer than 350 characters<br>"
		Else
			rsAdverts("SummaryText") = strSummaryText
		end if

        strDescriptionText = (Request.Form("strDescriptionText"))
        intDescriptionTextWordCount = WordCount(strDescriptionText)
        rsAdverts("DescriptionText") = strDescriptionText

        If intDescriptionTextWordCount > rsSubscriptions("DescriptionWordLimit") then
            strUserError = strUserError & "The Description field can only contain up to " & rsSubscriptions("DescriptionWordLimit") & " words in line with your subscription<br>"
        End if
		
		rsAdverts("SummaryText") = request.form("strSummaryText")
		
        if rsSubscriptions("BulletPointLimit") > 0 then
            For iLoop = 1 to rsSubscriptions("BulletPointLimit")
                strBulletPointX = CleanSQLData(Request.Form("strBulletPoint" & Trim(CStr(iLoop))))
                if Len(strBulletPointX) > 30 then
                    strUserError = strUserError & "Bullet Point " & Trim(CSTr(iLoop)) & " cannot be longer than 30 characters<br>"
                Else
                    rsAdverts("BulletPoint" & Trim(CStr(iLoop))) = strBulletPointX
                End if
            Next
        End if

		strTwitter = (Request.Form("strTwitter"))
		rsAdverts("Twitter") = strTwitter

		strTwitterID = (Request.Form("strTwitterID"))
		rsAdverts("TwitterID") = strTwitterID
		
		strOpeningTimes = (Request.Form("strOpeningHours"))
		rsAdverts("OpeningTimes") = strOpeningTimes

		strOpenMonday = (Request.Form("strOpenMonday"))
		rsAdverts("OpenMonday") = strOpenMonday

		strOpenTuesday = (Request.Form("strOpenTuesday"))
		rsAdverts("OpenTuesday") = strOpenTuesday

		strOpenWednesday = (Request.Form("strOpenWednesday"))
		rsAdverts("OpenWednesday") = strOpenWednesday

		strOpenThursday = (Request.Form("strOpenThursday"))
		rsAdverts("OpenThursday") = strOpenThursday

		strOpenFriday = (Request.Form("strOpenFriday"))
		rsAdverts("OpenFriday") = strOpenFriday

		strOpenSaturday = (Request.Form("strOpenSaturday"))
		rsAdverts("OpenSaturday") = strOpenSaturday

		strOpenSunday = (Request.Form("strOpenSunday"))
		rsAdverts("OpenSunday") = strOpenSunday
			
        blnRequestApproval = GetBoolean_FromParamValue(Request.Form("blnRequestApproval"))
        rsAdverts("RequestApproval") = blnRequestApproval
        
        If rsSubscriptions("AllowEditAdvert") = False then
            blnRequestMakeLiveWhenApproved = True
        Else
            blnRequestMakeLiveWhenApproved = GetBITFromCheckBox("blnRequestMakeLiveWhenApproved")
        End if
        rsAdverts("RequestMakeLiveWhenApproved") = blnRequestMakeLiveWhenApproved

		strRequestMakeLiveInSubDir1GID = CleanSQLData(Request.Form("strRequestMakeLiveInSubDir1GID"))
		strRequestMakeLiveInSubDir2GID = CleanSQLData(Request.Form("strRequestMakeLiveInSubDir2GID"))

		if len(""&strUserError) = 0 then
			' delete any existing categories, we'll repopulate from the form next
				exesql "DELETE FROM AdvertDirectories WHERE AdvertGID = '"&rsAdverts("GID")&"';",""
			' populate category link table
			bNoCategories = True
				for i = 1 to cint(rsSubscriptions("NumberOfSubCategories"))
					if len(""&request.form("subcategory"&i))>0 then
						bNoCategories = False
						exesql "INSERT INTO AdvertDirectories (AdvertGID,AdvertDirectory) VALUES ('"&rsAdverts("GID")&"','"&request.form("subcategory"&i)&"');",""
					end if
				next
			if bNoCategories then
                strUserError = strUserError & "Please select at least one subcategory.<br>"
			end if
		end if	
		
		rsAdverts("VoucherTitle") = ""&request.form("strVoucherTitle")
		rsAdverts("VoucherText") = ""&request.form("strVoucherText")
		'rsAdverts("RequestMakeLiveInSubDir1GID") = strRequestMakeLiveInSubDir1GID
		'rsAdverts("RequestMakeLiveInSubDir2GID") = strRequestMakeLiveInSubDir2GID
        rsAdverts("ReferencesChecked") = False
        rsAdverts("Approved") = False
        rsAdverts("ApprovalRefusedReason") = Null
        rsAdverts.Update
        rsAdverts.Close

        if blnRequestApproval = True then
            If GetSystemParam("Emails_SendAutoEmails") = "1" then
                SendEmail GetSiteConfig("Public_AutoEmailsFrom"), GetSiteConfig("Notify_ApprovalWaiting"), "Confirm New Advert", GetContent("EmailTemplate_ClientApprovalWaiting", Session("PublicFranchiseGID")), True
            End if
        End if
        
        if strUserError = "" then
            if rsSubscriptions("AllowEditAdvert") = False then
                if blnUploadLogo = True or blnUploadImages = True then
                    Response.Redirect "/AdvertiserAdmin/ManageSubscriptions/ManageAdverts/SetAdvertLogo.asp?CSGID=" & Request("CSGID") & "&AGID=" & CleanSQLText(Request("AGID"))
                Else
                    Response.Redirect "/AdvertiserAdmin/ManageSubscriptions/Default.asp"
                End if
            Else
                if blnUploadLogo = True or blnUploadImages = True then
                    Response.Redirect "/AdvertiserAdmin/ManageSubscriptions/ManageAdverts/SetAdvertLogo.asp?CSGID=" & Request("CSGID") & "&AGID=" & CleanSQLText(Request("AGID"))
                Else
                    Response.Redirect "/AdvertiserAdmin/ManageSubscriptions/ManageAdverts/Default.asp?CSGID=" & Request("CSGID")
                End if
            End if
        end if
        objConn.Close
    Case "DELETEADVERT"
        ' Show warning if last advert
        SQLCommand = "SELECT * FROM uvw_AdvertiserAdmin_SubscriptionDetails WHERE GID = '" & CleanSQLText(Request.Form("CSGID")) & "' AND ClientGID = '" & Session("PublicClientGID") & "'"
        objConn.Open strConn
        rsSubscriptions.Open SQLCommand, objConn, adOpenStatic, adLockReadOnly
        if rsSubscriptions.RecordCount <> 1 then
            FailSystemEvent "An error occured during the ChangeActiveAdvert process.  The specified Subscription is invalid"
        End if
        if rsSubscriptions("ActiveAdvertGID") = CleanSQLText(Request.Form("GID")) then
            SQLCommand = "UPDATE ClientSubscriptions SET ActiveAdvertGID = NULL, ActiveSubDir1GID = NULL, ActiveSubDir2GID = NULL WHERE ActiveAdvertGID = '" & rsSubscriptions("ActiveAdvertGID") & "'"
			'response.write sqlcommand
            objConn.Execute SQLCommand
        End if
        SQLCommand = "DELETE FROM ClientAdverts WHERE GID = '" & CleanSQLText(Request.Form("GID")) & "' AND ClientGID = '" & Session("PublicClientGID") & "'"
		'response.write sqlcommand
        objConn.Execute SQLCommand
        objConn.Close
    Case "CHANGEACTIVEADVERT"
        ' Get Data
        
        strActiveAdvertGID = CleanSQLData(Request.Form("strActiveAdvertGID"))

        IF strActiveAdvertGID = "" then
            strActiveAdvertGID = Null
        End if
        
        ' Confirm Advert is Approved.  If Directory needs References, check this has been verified
        SQLCommand = "SELECT * FROM uvw_AdvertiserAdmin_SubscriptionDetails WHERE GID = '" & CleanSQLText(Request.Form("CSGID")) & "' AND ClientGID = '" & Session("PublicClientGID") & "'"
        objConn.Open strConn
        rsSubscriptions.Open SQLCommand, objConn, adOpenStatic, adLockReadOnly
        if rsSubscriptions.RecordCount <> 1 then
            FailSystemEvent "An error occured during the ChangeActiveAdvert process.  The specified Subscription is invalid"
        End if
        ' Check if Directory Needs References
'        SQLCommand = "SELECT * FROM Directories WHERE GID = '" & rsSubscriptions("DirectoryGID") & "'"
'        rsTemp.Open SQLCommand, objConn, adOpenStatic, adLockReadOnly
'        if rsTemp.RecordCount <> 1 then
'            FailSystemEvent "An error occured during the ChangeActiveAdvert process.  The active Directory is invalid"
'        End if
'        blnReferencesRequired = rsTemp("ReferencesRequired")
        blnReferencesRequired = False
        If DirectoryNeedsReferences(rsSubscriptions("DirectoryGID")) then
            blnReferencesRequired = True
        End if
        
        ' Verify Advert is valid.
        SQLCommand = "SELECT * FROM ClientAdverts WHERE GID = '" & CleanSQLText(strActiveAdvertGID) & "' AND ClientGID = '" & Session("PublicClientGID") & "' AND ClientSubscriptionGID = '" & Request.Form("CSGID") & "'"
        rsTemp.Open SQLCommand, objConn, adOpenStatic, adLockReadOnly
        if rsTemp.RecordCount <> 1 then
            FailSystemEvent "An error occured during the ChangeActiveAdvert process.  The Active Advert is invalid"
        End if
        if blnReferencesRequired = True then
            if rsTemp("ReferencesChecked") = False then
                strUserError = strUserError & "The selected Advert requires your References to be Checked and cannot be Selected as the Active Advert.<br>"
            end if
        End if
        rsTemp.Close
        rsSubscriptions.Close
        if strUserError = "" then
            SQLCommand = "SELECT * FROM ClientSubscriptions WHERE GID = '" & CleanSQLText(Request.Form("CSGID")) & "' AND ClientGID = '" & Session("PublicClientGID") & "'"
            rsSubscriptions.Open SQLCommand, objConn, adOpenKeySet, adLockOptimistic
            rsSubscriptions("ActiveAdvertGID") = strActiveAdvertGID
            rsSubscriptions.Update
            rsSubscriptions.Close
        end if
        objConn.Close
End Select

%>

Open in new window


I've done this before and found the recordset, I've just forgotten and can't find it!

Any help much appreciated.
0
 

Author Comment

by:UName10
ID: 38824342
I think the fields should be added to this view:

sqlCommand = "SELECT * FROM uvw_DirectoryBrowser_Adverts WHERE cast(ActiveAdvertGID as varchar(255)) = cast(? as varchar(255))"
	getrs rsAdvert,sqlCommand,array(adname)
end if

Open in new window


"uvw_DirectoryBrowser_Adverts W"

I'll add them and see how I get on...
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Accepted Solution

by:
UName10 earned 0 total points
ID: 38824365
That's what it was  - just added the fields to the view
uvw_DirectoryBrowser_Adverts W
and it's working.

Thank you though; would've been a nightmare for you to trawl through that!

Many thanks.
0
 

Author Comment

by:UName10
ID: 38824381
I haven't requested to delete the question...?
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 38824511
glad I could help :)
the "close request" is OK, it won't delete the question!
CU
0
 

Author Closing Comment

by:UName10
ID: 38843073
angelIII spotted the reason the error came up and I remembered the views or we'd have had to go through loads of code.. Adding fields to the view worked.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Read about why website design really matters in today's demanding market.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now