Jump to content


  • Posts

  • Joined

  • Last visited

About logz

  • Birthday 11/01/1987

Contact Methods

  • Website URL
  • ICQ

Profile Information

  • Location
  • Interests
    I love treking, camping and cycling over dartmoor national park! Anything endurancy is cool to me.<br /><br />In computing, Im developing my own network of websites, www.cyban-entertainment.com is the first website, check it out! its not finished yet though!<br /><br />I use the following languages: HTML, CSS, Javascript, ASP, ADO, SQL and im learning PHP

logz's Achievements


Newbie (1/7)



  1. HTML FORM PAGE:<FORM action="http://www.yoursite.com/db_add.asp" method="get"><input type="checkbox" name="checkboxname"><input type="submit" value="submit"></FORM>db_add.asp:<% var checkboxvalue checkboxvalue=request.querystring("checkboxname") if checkboxvalue<>"" then var_dbaddvalue="yes" else var_dbaddvalue="no" end if end if set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open "D:\DATABASE PATH.mdb" sql="INSERT INTO table_name (field_name) sql=sql & " VALUES " sql=sql & "('" & var_dbaddvalue & "')" on error resume next conn.Execute sql,recaffected if err<>0 then Response.Write("Error") else Response.Write("OK") end if conn.close%>
  2. logz

    ASP and Databases

    You need to create a login form with the fields USERNAME and PASSWORD.When you click login, you need to be taken to a new ASP page.On that page, you need a program which saves the username and password collected from the login form to a variable.Use the USERNAME variable to then search your database for the username and password. IE:SQL:SELECT username, userpass FROM login WHERE username='" & request.form("username") & "'"Then, assign these two entries you've collected from the database to two other variables. for instance: collected_username and collected_passwordYou then need to compare the password submited via the login form to the password collected from the database using the IF ELSE function.IF request.form("username")=collected_username AND if request.form("password")=collected_password THENresponse.redirect("controlpanel.asp")ELSEresponse.redirect("failed.asp")END IF
  3. logz

    connecting mysql, asp

    Try this: set Conn = Server.CreateObject("ADODB.Connection")Conn.Open "Driver={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=kurf;USER=root;PASSWORD=rishakawwemana;Option=3;"set rs=Server.CreateObject("ADODB.Recordset")rs.Open "Select * from diwan" , Conndo until rs.EOF for each x in rs.Fields Response.Write(x.name) Response.Write("=") Response.Write(x.value & "<br />") next Response.Write("<br />") rs.MoveNext loop rs.close Conn.closeIT looks like you forgot the rs.MoveNext part. But im not sure.
  4. logz


    maybe your host isnt allowing hot-linking?
  5. logz

    #include help

    Does your host accept ASP?Are you sure you got the file locations right?Sure you got the collection type right?
  6. logz

    ms access

    W3schools has set the database and ASP program so you cant update or delete entries from the database.
  7. logz

    Find Login Name

    Well, if you want to find there user ID, then you would need to create a few ASP programs. You would need for members to login to your website, then a save a cookie to there computer, then you would need to access and display that cookie. I dont know hwo to get the computer name, but ill have a look around, and as for the IP address, use this code:<% Response.Write(Request.ServerVariables("remote_addr"))%> How do you want to display them? just wrote as plain text on a webpage? or saved to a database?Here is a very simple login script i wrote a while back. It connects to a database with a table of two fields, username and user_pass. What happens is, the user enters there username and password into a login form, that data is then saved as a variable, and the database is connected to. The program then collects the password in the database where the username relates the the username given by the user. The password collected from the database is then compared to the password provided by the user, and if the username given AND username collected = the same, and the password given AND password collected = the same, a cookie is placed on there computer and they are logged in. Else they are redirected to an error page:---------------------------------Login Form: <form action="http://www.yourdomain.com/login.asp" method="post"><input type="text" size="40" name="username" value="username"><br><input type="password" size="40" name="password" value=""><p><input type="submit" value="Login"></form><form> login.asp(before the HTML tags, i collected the data sent from the form, and assign it to variables: <% dim cusername, cpassword cusername=request.form("username") cpassword=request.form("password")%> Then this is the database program: <% set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open "D:\database.mdb" set rs = Server.CreateObject("ADODB.recordset") rs.Open "SELECT username, user_pass FROM userdata WHERE username='" & cusername & "'", conn do until rs.EOF for each x in rs.Fields if x.name="username" then session("con_user_session")=x.value else if x.name="user_pass" then session("con_pass_session")=x.value end if end if next rs.MoveNext loop rs.close conn.close if session("con_user_session")=cusername AND session("con_pass_session")=cpassword then response.cookies("acception")=1 response.cookies("iuser")=cusername else response.cookies("acception")=0 response.cookies("iuser")="" end if%> Then in the body section, i use this code to display the username given: <% response.write(request.cookies("iuser"))%> Hope it helps. But that databse program is very simple, and un-secure. Im not sure what you meant about the displaying username tho.
  8. set conn=Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open(Server.Mappath("/your/database/path.mdb"))or set conn=Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open "D:\your database path "
  9. theres a couple of ways of doing it. The most easiest of which is creating a field which uses the AutoIncrement function. When you use the CREATE TABLE function, add this line:CREATE TABLE your_table(id autoincrement)Then, when you go to insert some data into the table, the ID field will automatically add 1 to the current value.However, if you delete a record in the middle of the table, you will be left with this id array:12356As you can see, the 4 is missing, and its carried straight on to five.You can overcome this by using the second method. You need to create the field ID as a varchar or whatever table. NOT AutoincrementThis one is slightly longer. First of all, create your ADO connection and use the SELECT SQL statement, but use the function COUNT(*). Note ive created the variable "add_count". <%set conn=Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open "YOUR DATABASE ROUTE"set rs = Server.CreateObject("ADODB.recordset")rs.Open "SELECT COUNT(*) FROM your_table", conndo until rs.EOF for each x in rs.Fields dim add_count add_count=x.value next rs.MoveNextlooprs.closeconn.close%> What ive done, is counted all the records in the "your_table" table. ive then assigned this value to a variable. You will need this variable later.Next, you need to create a new variable which will add 1 to the total number of records.... to do this write this: <% dim iadd_count iadd_count=add_count+1%> Now, you can write your update or insert program as normal: <%set conn=Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open "DATABASE PATH"sql="INSERT INTO your_table (id)"sql=sql & " VALUES "sql=sql & "('" & iadd_count & "')"on error resume nextconn.Execute sql,recaffectedif err<>0 then Response.Write("Error")else Response.Write("Record Added")end ifconn.close%> Now, you've included the "iadd_count" variable in the insert program.If you need any help, just ask!Try the first method first though!
  10. logz

    ASP help needed !

    Using the Content Linkin Component1) Create the file nav.txt (or whatever you want to call it. Just remember the exact file name).2) In your nav.txt file, you need to format your text as such: home.asp (TAB) Homepage1.asp (TAB) Example Page 1page2.asp (TAB) Example Page 2contact.asp (TAB) Contact Us In the above, the first column indicates the URL to the web page you are linking to. so for example, if you wanted your first link to go to your homepage, you would use this url:http://www.your-domain.com/index.aspAfter you have wrote the URL, you need to use the TAB spacing character. NOT the space bar.When you have pressed tab, enter the text you want users to click on. IE:index.asp (TAB) HomeSave this file to your server, and take note of the location.Next, open the file you want your links to be displayed on, and enter this code: <% dim c dim i set nl=server.createobject("MSWC.Nextlink") c = nl.GetListCount("nav.txt") i = 1%><table border="0" cellspacing="0" cellpadding="0" width="100%" align="left" valign="top"><% do while (i <=c) %> <tr> <td width="100%" align="left" valign="top"> <a href="<%=nl.GetNthURL("nav.txt", i)%>" target="_self"><%=nl.GetNthDescription("nav.txt", i)%></a> </td> </tr><% i= (i+1) loop%></table> Save that page as a .asp page, save to your server and run the page.
  11. logz

    TextStream Object

    Hey, Im trying to utilize the TextStream object of ASP to create and write into a textfile based on my server.This is the code im using to create the textfile. <% set fs=Server.CreateObject("Scripting.FileSystemObject") set tfile=fs.CreateTextFile("D:\WWWRoot\cyban-networks.com\www\entertainment\textfiles\content_music\news\" & request.querystring("filename") & ".txt",false) tfile.close set tfile=nothing set fs=nothing%> That code works fine. The next part of the code includes a form, in which details can be wrote and submitted to the next section of ASP, which is wrote below. In this section of code, i only want to write details into a TXT file, not create a new file. <% set fs=Server.CreateObject("Scripting.FileSystemObject") set t=fs.OpenTextFile("D:\WWWRoot\cyban-networks.com\www\entertainment\textfiles\content_music\news\" & request.querystring("filename") & ".txt") t.WriteLine("<!--filename-->" & request.querystring("filename") & ".txt") t.WriteLine("<!--author-->" & request.querystring("author")) t.WriteLine("<!--date-->" & request.querystring("date")) t.WriteLine("<!--header-->" & request.querystring("header")) t.close set t=nothing set fs=nothing%> However, Whenever i execute this last peice of code, I am given the error message: Bad File ModeCan anyone give me a hand here and tell me what im doing wrong?!Cheers
  12. logz

    title bar

    lol i know, but i never use Xhtml, only HTML, but im not really a designer, im more towards server side languages and development
  13. logz

    title bar

    Yup, you can use lowercase if you want. Usually, i put the main tags in capitals and lesser tags in lowercase so its easier for me to nagivate the code.
  14. This is what it looks like in my browser: I dont have firefox however. It looks alrite in IE though?
  15. logz


    Im just wondering, if we happen to have an ADO query, should we put it in the SQL or ASP forum?Thanks :)EDIT: Can we ask about online databases such as MSSQL, MySQL and Access?
  • Create New...