Belzar
-
Posts
37 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by Belzar
-
-
What I am trying to do is make it so you can copy the code from my page and put it on myspace comments... I hate to show this, cuz its a lil vulgar or bad, but the thing i want to be able to use this for is at http://droppingthebomb.com/ecards/######/pony2.htm when i put the code inside the box, it looked like it was just showing it as it would on the web page, but i didnt upload it to try cuz i didnt think it would work... it looked something like this:Could you supply an example? Maybe link to the page in question, or post the HTML that you are using.As far as I can tell, you shouldn't have to do anything special to make code appear as code inside the textarea. The test page I did with some HTML insde the textarea tags worked...<html><body><textarea cols="50" rows="10"><table><tr><td>cell 1</td></tr></table><br /><script type="text/javascript"><!--alert('hello');--></script></textarea></body></html>
<textarea><font color='FF0066' size='7'>Don't mind me,<br><a href='http://droppingthebomb.com'><embed img src='http://droppingthebomb.com/gfx/tampon.jpg'></a><br>I'm riding the cotton pony.</font></textarea>
-
Hi everyone, I am trying to make a <textarea> with code inside of it on my website, like they have here, and I know I have seen it on other sites. When I do it on my site, it always just runs the code, it will not let me just have the code so I can show what certain codes are... Can anyone help me please?
-
I remember a long while back, i always saw some one mention a space where you could get a free website from an asp host... can someone tell me where to go for that please
-
hi, this seems to be the same question i asked and was replied with an answer that worked great by Yahweh i think it was... this is the code and it works perfectly, also can see it under my post on this page last i looked called Password protecting pages... this is actually just copied from there
<%Dim strPasswordstrPassword = request("password")if Password = "baby" then%> The rest of your page contents should go here.<%else%> <form action="<%=Request.ServerVariables("SCRIPT_NAME")%>" method="post"> What's the password:<br> <input type="password" name="password"> <p> <input type="Submit" value="Go!"> </p> </form><%end if%>
You can make the password whatever you want to with line number 5
-
Hey, I guess what I mean is a Visual Studio type program... I used Dreamweaver on Windows so I could do the graphics and all... Now, besides the text editor I am not sure what to use to do this.Are you talking about just a text editor, or an IDE like Visual Studio? -
Hi, before when I was writing asp I was using Windows Operating System, I recently swiched back to Linux OS and I am having trouble writing asp using it. I am using the program called Nvu and it seems to only make HTML files. If there is anybody here that uses Linux and knows a good program that will help me, please reply and let me know. Thanks a lot.
-
Nevermind, I finally got it working.. thanks for all the help
-
Hey again, I am still having trouble with this code. It is like I get it so close to working then I run into another problem. Atleast now I am using a browser that lets me see where the error is, before it wouldnt tell me. I copied the code just to try to make it work and it is telling me that the ODBC Driver does not support this action. Here is the code.
<% Option ExplicitFunction SQLSecurity(myStr) 'This eliminates the risk of SQL injection SQLSecurity = Replace(myStr, "'", "''", 1, -1, vbBinaryCompare)End FunctionDim Username, PasswordUsername = cstr(request("username")) 'the cstr function explicitly casts thePassword = cstr(request("Password")) 'variable as a string.'Validating username and password.If Username = "" then response.redirect "signup.asp?msg=Invalid username."elseif Password = "" then response.redirect "signup.asp?msg=Invalid password.&username=" & username'elseif Len(username) < 3 then 'this checks to see that the username at least 3' 'characters long' response.redirect "signup.asp?msg=Username must be at least" & _' "3 characters long.&username=" & username'elseif Len(password) < 3 then 'this checks to see that the password at least 3' 'characters long' response.redirect "signup.asp?msg=Password must be at least" & _' "3 characters long.&username=" & usernameEnd ifelseif Len(username) > 25 then response.redirect "signup.asp?msg=Username cannot be longer than" & _ "25 characters.&username=" & usernameelseif Len(password) > 25 then response.redirect "signup.asp?msg=Password cannot be longer than" & _ "25 characters.&username=" & usernameEnd if'I've commented out the minimum username and password validations. Just'remove the apostrophes before the appropriate lines if you want to use those'validations.Dim Conn, RS, SQL, Successful, DSNNameDSNName = "PROVIDER=MSDASQL;driver={MySQL ODBC 3.51 Driver};server=mysql14.ixwebhosting.com;option=18475"Set Conn = Server.CreateObject("ADODB.Connection")Set RS = Server.CreateObject("ADODB.RecordSet")Conn.Open DSNNameSQL = "Select Username, Password, IPAddress, Email, DateRegistered FROM Users WHERE " & _ "Username = '" & SQLSecurity(Username) & "' Limit 1;"RS.Open SQL, Conn, 3, 3 'This is line number 48, where the error is occuring If RS.EOF then 'RS.EOF means no results returned from the SQL query. In this case, since 'no results were returned the query executed above, then it means there 'is no user in the Users table with the same username. So, we can insert the 'new username. 'Adding new account to the Users table RS.AddNew RS("Username") = Username RS("Password") = Password RS("IPAddress") = Request.ServerVariables("REMOTE_ADDR") RS("DateRegistered") = Now RS.Update 'Setting cookies for the user. These cookies will expire in 1 year. Response.Cookies("account")("username") = Username Response.Cookies("account")("password") = Password Response.Cookies("account").Expires = DateAdd("m", 12, Now()) Successful = True else 'If a result is found for the query above, that means a user already exists 'with the chosen username, so we have to forward the user back to the 'signup page and ask him or her to choose another name. Successful = False End ifRS.CloseConn.CloseSet Conn = nothingSet RS = nothingIf Successful = True then%> <html> <body> <h1>Congrats!</h1> <p>Your account has been successfully created, <%=Request.Cookies("account")("username")%> :)</p> <p>Please go back to the <a href="default.asp">home page</a>, or for free to edit your <a href="profile.asp">profile</a>.</p> </body> </html><%else response.redirect "signup.asp?msg=Username is already taken." & _ "&username=" & usernameEnd if%>
I, of course took out the user, password and database name... but, this is the error it is giving me.
I do not know why it is not working, please help me again Thanks.Microsoft OLE DB Provider for ODBC Drivers error '80040e21'ODBC driver does not support the requested properties./signup1.asp, line 48 -
I would, it is just that I dont get an error strangely enough. ill check out line 27, thanks.You should post the error message as well. It's hard to debug without it.Line 27:Conn.Open connection_ stringYou need to define connection_string (you have a space after the _). -
Hi, I have been trying this code and I cant figure out. Yahweh, I have tried the code you gave me, and I havent gotten it to work. The statement in it that verifies the password and username seems to make it so its not in ASP code anymore for some reason, so I took that out. It still isnt working thought.. here is my code:
<% Option ExplicitFunction SQLSecurity(myStr) SQLSecurity = Replace(myStr, "'", "''", 1, -1, vbBinaryCompare)End FunctionDim Username, PasswordUsername = cstr(request("username"))Password = cstr(request("password"))If Username = "" then response.redirect "signup.asp?msg=Invalid username."Elseif Password = "" then response.redirect "signup.asp?msg=Invalid password.&username=" & Username End IFDim Conn, RS, SQL, SuccessfulSet Conn = Server.CreateObject("ADODB.Connection")Set Conn = Server.CreateObject("ADODB.Recordset")SQL = "Select Username, Password, IPAddress, Email, DateRegistered FROM Users Where " & _ "Username = '" & SQLSecurity(Username) & "' Limit 1;" Conn.Open connection_ stringRS.Open SQL, Conn, 3, 3 If RS.EOF then RS.Addnew RS("Username") = Username RS("Password") = Password RS("IPAddress") = Request.ServerVariables("Remote_Addr") RS("DateRegistered") = Now RS.Update Response.Cookies("account")("Username") = Username Response.Cookies("account")("Password") = Password Response.Cookies("account").Expires = DateAdd("m", 12, Now()) Successful = TrueElse Successful = FalseEnd IfRS.CloseConn.CloseSet Conn = NothingSet RS = NothingIf Successful = True then%> <html> <body> <h1 align="center">Congrats!</h1> <p>Your account has been successfully created, <%=Request.Cookies("account")("username")%> :)</p> <p>Please go back to the <a href="default.asp">Home Page</a>, or you can edit your <a href="profile.asp">Profile</a>.</p> </body> </html><%Else response.redirect "signup.asp?msg=Username is already taken." & _ "&username=" & usernameEnd If%>
I will show you the link again, maybe there is another error that I am not seeing. Sign upPlease help, I dont know what it is thats not letting it work
-
I started learning php a little while ago, I know very little. I already have a website, and I use MySql as my database. I started learning php here on the tutorials, but I am not so sure it answers my question. I dont know how to write the code for a signup.php page still even though I know a small amount of it. Basically the only code I have written in php was what I learned here on this site.Do you mean you want a page for the signup to your site? Or the processor that handles signups, or an entire system for registering?The processor as well as the entire system could be like half of your website, if you integrate it with the rest of your functions. Well, registering systems just like login systems, are complicated big codes I suggest you learn PHP first, if you haven't already, and after that try to make some experience in coding. It would help you to begin coding from scratch.Can you code in php already? If thats so, we'll help you for your system, if not support for an entire one... :)For a secure system you'll probably need:-a running site-php (or other server-side)-mysql (or other database)-organised files *lol* -
Hello all,I have been trying to get a signup.asp page and a signin page. I was unsuccessful at using it for some reason and it didnt work even after I reposted my problem, I ran into problem after problem. My point is, I figured I would try this in php code. Is there anybody that could help me out with writing a signup.php code. maybe some examples or even some other ideas.Thanks a lot
-
I am never the ones with answers... but, in line 9 it saysif(bunny) then... you wouldnt need the () and if bunny what? it doesnt know what you are saying i think.But, like i said, i am not one with all the answers.. but it doesnt seem to make any since to me, not trying to be mean or anything. Since you are using Bunny as a variable, you shouldnt need to use the () and your not telling it anything.hi i try this code <%Dim Regex, BunnySet Regex = New RegexpRegex.Global = TrueRegex.Multiline = TrueRegex.IgnoreCase = TrueRegex.Pattern = "^\d+$" Bunny = "matar^"if(bunny) thenResponse.write ("true")elseresponse.write("error")end if%>and i see this errorError Type:Microsoft VBScript runtime (0x800A000D)Type mismatch: '[string: "samer^"]'/test.asp, line 9 -
My problem is, when I use the exact code with my connection string, it says that the page cannot be displayed. Last time I sent a reply with a link and telling my problem, I some how fixed it before you even looked. So, ill show you the code that I am using and I will show you the link to it at the same time.
<% Option ExplicitFunction SQLSecurity(myStr) 'This eliminates the risk of SQL injection SQLSecurity = Replace(myStr, "'", "''", 1, -1, vbBinaryCompare)End FunctionDim Username, PasswordUsername = cstr(request("username")) 'the cstr function explicitly casts thePassword = cstr(request("Password")) 'variable as a string.'Validating username and password.If Username = "" then response.redirect "signup.asp?msg=Invalid username."elseif Password = "" then response.redirect "signup.asp?msg=Invalid password.&username=" & username'elseif Len(username) < 3 then 'this checks to see that the username at least 3' 'characters long' response.redirect "signup.asp?msg=Username must be at least" & _' "3 characters long.&username=" & username'elseif Len(password) < 3 then 'this checks to see that the password at least 3' 'characters long' response.redirect "signup.asp?msg=Password must be at least" & _' "3 characters long.&username=" & usernameEnd ifelseif Len(username) > 25 then response.redirect "signup.asp?msg=Username cannot be longer than" & _ "25 characters.&username=" & usernameelseif Len(password) > 25 then response.redirect "signup.asp?msg=Password cannot be longer than" & _ "25 characters.&username=" & usernameEnd if'I've commented out the minimum username and password validations. Just'remove the apostrophes before the appropriate lines if you want to use those'validations.Dim Conn, RS, SQL, SuccessfulSet Conn = Server.CreateObject("ADODB.Connection")Set Conn = Server.CreateObject("ADODB.RecordSet")SQL = "Select Username, Password, IPAddress, Email, DateRegistered FROM Users WHERE " & _ "Username = '" & SQLSecurity(Username) & "' Limit 1;Conn.Open "PROVIDER=MSDASQL;driver={MySQL ODBC 3.51 Driver}" & _"server=mysql14.ixwebhosting.com" & _"option=18475" & _"uid=scourge_scourge;pwd=mypass;database=scourge_Data"RS.Open SQL, Conn, 3, 3 If RS.EOF then 'RS.EOF means no results returned from the SQL query. In this case, since 'no results were returned the query executed above, then it means there 'is no user in the Users table with the same username. So, we can insert the 'new username. 'Adding new account to the Users table RS.AddNew RS("Username") = Username RS("Password") = Password RS("IPAddress") = Request.ServerVariables("REMOTE_ADDR") RS("DateRegistered") = Now RS.Update 'Setting cookies for the user. These cookies will expire in 1 year. Response.Cookies("account")("username") = Username Response.Cookies("account")("password") = Password Response.Cookies("account").Expires = DateAdd("m", 12, Now()) Successful = True else 'If a result is found for the query above, that means a user already exists 'with the chosen username, so we have to forward the user back to the 'signup page and ask him or her to choose another name. Successful = False End ifRS.CloseConn.CloseSet Conn = nothingSet RS = nothingIf Successful = True then%> <html> <body> <h1>Congrats!</h1> <p>Your account has been successfully created, <%=Request.Cookies("account")("username")%> :)</p> <p>Please go back to the <a href="default.asp">home page</a>, or for free to edit your <a href="profile.asp">profile</a>.</p> </body> </html><%else response.redirect "signup.asp?msg=Username is already taken." & _ "&username=" & usernameEnd if%>
And this is the link to it: Signup hereI, trying to do it exactly correct, copied and pasted it and put my connection string in it to see if that would work, and its always the same thing. Anything I did?
-
Oh yea, and I am not sure how you wanted me to put in my connection string:
Conn.Open you_connection_string
How will I do this, make a Dim String maybe?
-
I have been trying this, but i get a strange error when i click the register button. It tells me that the page is unable to be displayed for some reason. This, of course, is on signup1.asp. Any idea?
-
Games in ASP
in ASP
Im not sure about asp, but I know that PHP has some pretty cool games. Gangwars is a pretty cool game built fully in php. Give it a look, its actaully pretty fun
-
Hey Yahweh,This is in reply to you asking if I needed help on any signup/signin.asp pages. I would love to have your help Thanks in advanced.
-
Great, now i have learned how to use the database and connect to it, very tuff stuff, but i have a small understanding for it now and it is working for the guestbook thing, thank godConnectionStrings.com has a lot of information on the type of connection strings you should use to connect to your database.Basically, to connect to a database, you'll use this code:Dim ConnectionString, Conn, RS, SQLConnectionString = "something here" 'modify this lineConn = Server.CreateObject("ADODB.Connection")RS = Server.CreateObject("ADODB.RecordSet")SQL = "some SQL statement" 'modify this lineConn.Open ConnectionStringRS.Open sql1, Conn, 1, 1 'this opens a database in forward-only, read-only mode 'stuff hereRS.CloseConn.Close'Always set your recordsets and connections to nothing when you're done with themSet rs = nothingSet conn = nothing
You only need to open a database connection once per page, and you need to open and close as many recordsets as SQL statements you plan on executing. After you are finished getting your information out of your databae and recordsets, close them immediately and set them equal to nothing to free up server resources.The value of ConnectionString variable depends on what type of database you're connecting to, and where the database is located relative to your ASP scripts.To connect to a MySQL database, use this connection string:
ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" & _ "SERVER=mysqlServer;PORT=3306;DATABASE=myDatabase;" & _ "USER=myUsername;PASSWORD=myPassword;OPTION=18475;"
For the part reading SERVER=mysqlServer, set that to the location of your sql server. If your ASP scripts and sqlServer are located on the same domain, then SERVER=localhost works most of the time. If that doesn't work, or if you are connecting to a remote database, just use the location of the sql server. A few examples:
'Connecting to a local database, where your database and scripts are'located on the same serverConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" & _ "SERVER=localhost;PORT=3306;DATABASE=myDatabase;" & _ "USER=myUsername;PASSWORD=myPassword;OPTION=18475;"'Connecting to remote databaseConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" & _ "SERVER=data.domain.com;PORT=3306;DATABASE=myDatabase;" & _ "USER=myUsername;PASSWORD=myPassword;OPTION=18475;"
The USER and PASSWORD correspond to the username and password of your mySQL account (usually these will be identical to the username and password of your account on the remote server), and the DATABASE corresponds to the name of your database.
-
to be honest, i could use help on those... i have tried many different things, i am the kind of person that only uses the code i write... i have only used codes from other people once i think, thats cuz it was a very confusing code. Here is my problem, I have mySQL database, but i am unsure of how exactly how to use it, its on another site, so i dont know how to connect to it. and then there is exactly how it all works, if you could help me, thanks greatly.If you need help on Login/Signup pages, let me know, and I can certainly help you out on them -
Wow, thats very good information. I am having trouble learning how to get into my database and such, like how to get people to sign up and create there own names. I mainly have trouble with it cuz i am unsure of how to code it correctly, but thats a whole nother problem thanks for your help on this one.Belzar,VBScript as a client-side language is browser specific, it only works on IE. However, client-side VBScript is dead, NO ONE uses anymore. To get a password box that works on all browsers, you have to convert your script to client-side Javascript.However, there is a significant problem with using client-side scripts to password protect pages, namely on the basis that they don't protect anything at all. Anyone can view the source of your page and see everything you've written.Here are 2 ways to password protect pages, but here's a simpler ASP-specific way:<%Dim strPasswordstrPassword = request("password")if Password = "baby" then%> The rest of your page contents should go here.<%else%> <form action="<%=Request.ServerVariables("SCRIPT_NAME")%>" method="post"> What's the password:<br> <input type="password" name="password"> <p> <input type="Submit" value="Go!"> </p> </form><%end if%>
Using this code, no one can see any code they shouldn't when they view your source.Alternatively, I like to use this method on my sites:Login.asp:
'You should always use a function like the one below to protect'against SQL injectionFunction SQLSecurity(strString) SQLSecurity = replace(strString, "'", "\'", 1, -1, vbBinaryCompare)End FunctionSub Login Dim Conn, RS, SQL, Redirect Redirect = True Conn = Server.CreateObject("ADODB.Connection") RS = Server.CreateObject("ADODB.Recordset") sql = "SELECT Count(*) as Count FROM my_table WHERE Username = " & _ "'" & SQLSecurity(Request.Cookies("Username")) & "' " & _ "AND Password = '" & SQLSecurity(Request.Cookies("Password")) & "';" Conn.Open my_connection_string RS.Open sql, Conn, 1, 1 if RS("Count") then Redirect = False end if RS.Close Conn.Close set conn = nothing set rs = nothing if Redirect = True then 'if a valid username and password is not found response.redirect "error.asp" end ifEnd Sub
On any other page, all I have to do is insert the following two lines at the top of any page:
<!--include file="login.asp"-->Call Login... rest of page goes here ...
If the user is not logged in, then he or she is automatically redirected to an error.asp page. Otherwise, the page loads as normal.
-
Hi again all, I know, I write on here a little to often. It's just that I learn so much from here :)I have this code that will password protect a page when using Internet Explorer, but it doesnt work when using almost any other browser (Netscape, Mozzilla...)This is the VBscript code i have written:
<script type="text/vbscript"> password = Inputbox("Please enter the password:") do until password = "baby" msgbox "You have entered an incorrect password- Please try again." password = Inputbox("Please enter the password:") Loop</script>
Maybe there is an asp code that I could use, or some way or another tweek this code to turn it into asp. Help please.
-
great it worked perfectly, thanks again for all the helpThis site is awsome, i have had so much help here from everyone, and its great to be able to get the help you need on code so fast.... thanks againThanks very much, i'll give that a shot -
Thanks very much, i'll give that a shotStart by getting rid of the response.write calls, and remove the quotes.mymail.to = request.form('to')
<textarea> problems
in HTML/XHTML
Posted