Web Wiz - Solar Powered Eco Hosting

  New Posts New Posts RSS Feed - Need help with error message...
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Need help with error message...

 Post Reply Post Reply
Author
brossyg View Drop Down
Newbie
Newbie


Joined: 12 May 2010
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote brossyg Quote  Post ReplyReply Direct Link To This Post Topic: Need help with error message...
    Posted: 12 May 2010 at 6:44pm
I am trying to match a string on the server side of an ASP page. My code is this:

Code:
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!-- #include file = "connection.asp" -->
<!-- #include file = "replace.asp" -->

<%
var r_user;
var r_pass;

r_user = Request.querystring("xyz");
r_pass = Request.querystring("abc");

r_user = replaceAwithBinC("'","'",r_user + '');
r_pass = replaceAwithBinC("'","'",r_pass + '');

r_user = replaceAwithBinC('"',""",r_user + '');
r_pass = replaceAwithBinC('"',""",r_pass + '');

var quer = "SELECT access_code FROM resourceadmin WHERE (user_name = '" + r_user + "') AND (user_pass = '" + r_pass + "')";
var rs = Server.CreateObject("ADODB.RecordSet");
rs.Open(quer,con);	

var access = rs("access_code");
Response.Write(access);

if(access.indexOf("wc")<0) {
	Response.Write("Yes");
}
else{
	Response.Write("No");
}

rs.Close();
rs = null;

con.Close();
con = null;
%>
This gets a Username and Password from a URL link, gets the "access_code" from the Access database for that subscriber and then I am trying to match the access code for the letters "wc".

It works fine until it tries to match the string "wc" to the access code. The variable "access" properly appears as 999, so the match should return "No".

However, I get an "Object doesn't support this property or method" error for the line that has the if(access.indexOf("wc")<0) statement on it. I have tried using InStr(), but that doesn't work either.

Please help! I don't know why I am getting this error. Thanks.
Back to Top
gotlivechat View Drop Down
Newbie
Newbie


Joined: 09 March 2010
Location: Upstate NY
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote gotlivechat Quote  Post ReplyReply Direct Link To This Post Posted: 04 August 2010 at 3:40am
Seems you're mixing javascript with asp.  The test for string comparison is INSTR; so
IF INSTR(access,"wc")>0 THEN do something
If that doesn't work, do a response.write on access to see what value it is.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.01
Copyright ©2001-2018 Web Wiz Ltd.


Become a Fan on Facebook Follow us on Twitter Connect with us on LinkedIn Community Forums Web Wiz Blogs Web Wiz News
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Policy

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2019 Web Wiz Ltd. All rights reserved.