Jump to content

Eivo

Members
  • Posts

    94
  • Joined

  • Last visited

Everything posted by Eivo

  1. I am going to try "recordset.MoveFirst" and see if that works. But before I go, do Session variables carry over from page to page or is it just for the page it is declared in?
  2. Eivo

    asp log in pages

    http://www.asp101.com/samples/login.asphttp://www.aspin.com/home/tutorial/usermanage/loginhttp://www.hotscripts.com/Detailed/55969.htmlhttp://www.evolt.org/node/28652http://www.codefixer.com/codesnippets/cookieLogin.asp30 Second Google Search, and that was just the front page!Drink up!
  3. Ok, I am trying to get a login page working and I'm running into errors and such. I'm using ASP (classic) and JScript. Here is what I have... <%var connectionObject = new ActiveXObject("ADODB.Connection");var connectionString = "Provider=sqloledb; Data Source=mssql08.1and1.com,1433; Initial Catalog=db186589768; User Id=*****; Password=*****;"connectionObject.Open(connectionString); var recordset = new ActiveXObject("ADODB.Recordset");var find = "SELECT * FROM security WHERE username LIKE '" + Request.Form("usernameFM") + "'"recordset.Open(find,connectionObject);var user = new String(Request.Form("usernameFM"))var pass = new String(Request.Form("passwordFM"))var userRS = new String(recordset("username"))var passRS = new String(recordset("password"))<!-- This part is just for making sure that my form data and DB data are correct, shouldn't even see it if it matches. -->Response.Write("<div style=\"color:#FFFFFF;\">");Response.Write(recordset("username") + "<br/>");Response.Write(user + "<br/>");Response.Write(recordset("password") + "<br/>");Response.Write(pass + "<br/>");Response.Write("</div>");<!-- Ok, that part is over -->if (userRS == user && passRS == pass){Response.Redirect("controlpanel.asp");}else{Response.Write("<div style=\"color:#FFFFFF;\">");Response.Write("Sorry, the username or password you entered was incorrect, <a href=\"login.asp\">please click here to return to the log in page</a>");Response.Write("</div>");}recordset.Close;connectionObject.Close;connectionObject = null;%> The behavior I get from the code is like this...Correct User name & Correct Password = Error-Free, Failed LoginCorrect User name & Incorrect Password = Error-Free, Failed LoginIncorrect User name & Correct Password = Error PageIncorrect User name & Incorrect Password = Error PageHere is the Error from the Error pages... Line 134 is: var userRS = new String(recordset("username"))I have a few ideas of what I am doing wrong, but I haven't been able to get it to work still. Any help would be greatly appreciated. Thanks in advance.
  4. Eivo

    Safe Login

    What is the best way to go about adding a login (username / password) to asp safely?
  5. Eivo

    Query String Variable

    You rock! Thanks.god, I wish I understood this better. I feel like I am always on this board asking questions.
  6. Working on a site for the local volunteer fire dept. I'm working with asp and databases and all kinds of stuff I don't fully understand yet, lol. But it's coming along. I needed this to pull the correct article from the database.
  7. Eivo

    Query String Variable

    You're Awesome.But now I have an error.ADODB.Recordset error '800a0bb9'Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another./mfvfd/article_index.asp, line 87 I don't fully understand why I am getting this error. If I manually put in the value I need, I get the desired results. But as soon as I replace the value with the variable (which, have the same value as before) I get this error. Let me illustrate.var find = "SELECT * FROM mfvfd WHERE category='firesafety'";recordset.Open(find,connectionObject); var find = "SELECT * FROM mfvfd WHERE category LIKE 'firesafety'";recordset.Open(find,connectionObject); Those both work like they should. However as soon as I change it to this... var find = "SELECT * FROM mfvfd WHERE category LIKE '%" & Request.QueryString("cat") & "%'";recordset.Open(find,connectionObject); var find = "SELECT * FROM mfvfd WHERE category LIKE country='" & Request.QueryString("cat") & "'";recordset.Open(find,connectionObject); Then I start getting the error. The URL looks like this,.../article_index.asp?cat=firesafetyand I even tried,.../article_index.asp?cat='firesafety'but nothing. Any help would be awesome.
  8. Eivo

    Query String Variable

    Is it possible to have a query string to look up based on a variable? Like this kinda....SELECT * FROM table WHERE name LIKE variableIf you can, how do you format it. I have been testing a few way, but can't get it to work. Mine looks like this right nowSELECT * FROM table WHERE name LIKE Request.QueryString("value")
  9. Is it possible to pass a variable with a <a href> link? Kind of how a form does. If so, how?
  10. I am trying to set up a site, but I need to be able to pass large amounts of text. I am using newString() but I hit the limit I guess becuase it keeps telling me... "String or binary data would be truncated."Is there another way to do this?
  11. I got it working, Thank again
  12. I tried this and got mixed results.My first error was that " 'document' is undefined " so I replaced document.write with Response.Write then got my next errorrecordset.Open("SELECT recordnumber FROM mfvfd",connectionObject);recordset.MoveFirstwhile(!recordset.eof){Response.Write(recordnumber);recordset.MoveNext;} I get a " 'recordnumber' is undefined " error. I got this error both when I had "SELECT recordnumber FROM mfvfd" and "SELECT * FROM mfvfd".
  13. I have come a long way in this site I am building. I have my page connecting and writing to my database, but I can't nail down how to read and write from my database. To make a long story short, here is my code. <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%><!-- METADATA TYPE="typelib" FILE="C:\Program Files\Common Files\System\ado\msado15.dll" --><!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>Title Bar!</title></head><body><%var myConnection = "Provider=sqloledb; Data Source=*****; Initial Catalog=*****; User Id=*****; Password=*****;"var connectionObject = Server.CreateObject("ADODB.Connection");connectionObject.Open (myConnection);var placeAuthor = new String(Request.Form("writeAuthor"))var placeTitle = new String(Request.Form("writeTitle"))var placeStory = new String(Request.Form("writeStory"))var wr_table = "INSERT INTO mfvfd (author,title,story) Values ('";wr_table += placeAuthor + "','" + placeTitle + "','" + placeStory + "');"connectionObject.Execute(wr_table);var recordset = Server.CreateObject("ADODB.Recordset");var rd_table = "SELECT title FROM mfvfd;";recordset.Open(rd_table,connectionObject);connectionObject.Execute(rd_table);Response.Write(rd_table("title"));connectionObject.Close()connectionObject = null;%></body></html> I am sure there are a crap load of problems with this, but I can't seem to figure it out. Thanks in advance.
  14. Eivo

    Foiled again!

    I should have stated, when I put the var in the Value() without any quotes or double quotes I get an error...Microsoft OLE DB Provider for SQL Server error '80040e14'The name 'placeAuthor' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted./Test/connection_test.asp, line 29
  15. Eivo

    Foiled again!

    Ahh, I am almost there. Major changes to the code cause I'm an idiot. I have it written in javascript now. I can connect to the database and even right to it! But I can't seem to write what I want to it. Here is the code. <%var myConnection = "Provider=sqloledb; Data Source=mssql08.1and1.com,1433; Initial Catalog=db186589768; User Id=dbo186589768; Password=password;"var connectionObject = Server.CreateObject("ADODB.Connection");var placeAuthor = new String(Request.Form("writeAuthor"))var placeTitle = new String(Request.Form("writeTitle"))var placeStory = new String(Request.Form("writeStory"))Response.Write(placeAuthor)Response.Write("<br />")Response.Write(placeTitle)Response.Write("<br />")Response.Write(placeStory)Response.Write("<br />")sql = "INSERT INTO mfvfd (author,title,story) Values ('placeAuthor','placeTitle','placeStory');"connectionObject.Open (myConnection)connectionObject.Execute(sql)connectionObject.Close()connectionObject = null;%> I know it has something to do with the sql line in Values. It thinks that I want to write "placeAuthor" when I really want to write the var placeAuthor. My table is full of placeAuthor, placeTitle, and placeStory 's. How to I get it to recognize that it is the var I want?
  16. Eivo

    Foiled again!

    Ok, I am still working in my endeavor to connect to this database. Here is all the code there is on my page to connect. I got the connection string and everything from the db admin along with the file location. But this is the error I get... I pasted that into the ms site and got thishttp://support.microsoft.com/kb/190940I guess what I'm asking is what am I doing wrong. It says that it's a bug. That mean I'm screwed or is there a work around or another method I can connect with? Thanks in advance for your help.<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%><!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>Title Bar!</title></head><%set conn=Server.CreateObject("ADODB.Connection")conn.Provider=sqloledb;Data Source=mssql08.1and1.com,1433;Initial Catalog=db186589768;User Id=dbo186589768;Password=dummypassword;conn.Open "E:\MSSQL2000\MSSQL\Data\\db186589768.mdf"conn.Close%><body></body></html>
  17. Eivo

    Database connections

    Thank you very much =)
  18. Eivo

    Database connections

    I think I found something that could help me, but is there a difference between MS SQL, SQL, and MySQL databases?
  19. Eivo

    Database connections

    I'm trying to learn ASP and I am stumped on how to connect to a database with it. I know you have to use ADO to connect, but I can find anything on what kind of databases I can connect to or how to put in the user and pass for the database. I am pretty confused on this matter. Can anyone shed some light on this or point me to something that can. I have already been through the W3Schools stuff on it.
  20. sweet, got it working how i needed. thanks
  21. I am having troubles nesting <div> tags. I am creating my layout and I need to nest a <div> layer inside another <div> layer. I got it to work once will testing it, then tried to impliment it into my layout and the parent <div> layer is a no-show. Is there a limit to how far you can nest these tags or something that I may be missing. I think it has to do with the position style. <div id="shell" style="z-index:0; position:absolute; width:819px; left:102px; top:0px; visibility:visible; background-color:#999999">Text<div id="story" style="z-index:1; position:absolute; width:615px; left:204px; visibility:visible; background-color:#666666">Text</div></div> I just noticed that it works in IE7 but not FF2Anyone know of a work around or why FF2 doesn't nest tags correctly?
  22. Anyone have suggestions where I can find dedicated servers with ASP / ASP.NET support? Customer / Tech support is important so that would be a great bonus.
×
×
  • Create New...