Forum Moderators: open

Message Too Old, No Replies

Message Board

Design and Construction

         

Stuperfied

12:56 am on Apr 28, 2005 (gmt 0)

10+ Year Member



*Moved from Community Building.
Yeah, im not sure what you mean with that session variable thing but I will check it out when I get back.

FourDegreez

1:31 am on Apr 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's probably done automatically for you, actually. See how you obtained the username on the page with the form? Just move that to the page that accepts the post. That should do it.

GaryK

1:33 am on Apr 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd love to continue to wreak havoc on your message board but right now I'm getting database errors when I try to access the site:

Error Type:
ADODB.Recordset.1 (0x80004005)
SQLState: S1000 Native Error Code: 2013 [TCX][MyODBC]Lost connection to MySQL server during query
/messageboard/pages/posts.asp, line 22

Let me know when you're ready to go again and I'll continue to try and help you out.

This is actually a lot of fun. ;)

~gary.

Stuperfied

6:55 am on Apr 28, 2005 (gmt 0)

10+ Year Member



GaryK: That lost connection thing happens sometimes, I dont know why but if you open it in another window it should work again.

FourDegreez:
In ASP/VBScript, there are default session variables and user defined session variables. An example of default session variables would be:


HTTP_HOST
HTTP_REFERER
HTTP_USER_AGENT

Then there is the user defined session variables which in my message board are:

MM_UserAuthorization
MM_Username

MM_UserAuthorization is created by my login page which comes from the Dreamweaver GUI, I could just have easily renamed it to MM_Birds. It contains the users access level such as Admin or Member and is intended to be checked against a list of authorized users, to determin if the user has access to a particular page.

MM_Username is also created by my login page. It contains the users login name and is used to determin if a user is logged in or not.

The test for both of these is simple as in this example taken from another one of my sites:


<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers="Member,Moderator,Super Moderator,Admin,Webmaster,Super Admin"
MM_authFailedURL="home.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
If (false Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>

At present, my login page set's MM_Username with your login name but MM_UserAuthorization is not in use at present. My reply page contains a hidden field (the one you saw before) which when the form is submitted, places the value of MM_Username into the username field of the post table.

Is this the type of setup you were refering to, if not, can you give me a php example?

Stuperfied

12:42 pm on Apr 28, 2005 (gmt 0)

10+ Year Member



I had forgotten how much Mozilla's line of browsers blows when it comes to divide bassed pages. Im going to have to do some extensive restructuring and take it back to tables I think.

GaryK

2:24 pm on Apr 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's not Mozilla's line of browsers that's blowing it. It's the 100+ validation errors on your page. ;)

HTTP_HOST
HTTP_REFERER
HTTP_USER_AGENT

The above are server variables, not session variables. :)

I'm always curious about people's choices. So I'm wondering why you decided to use ASP if you're not on a Windows box? I noticed on your error page that you're using SunOne ASP.

I'll check in later and see how the message board is coming along and offer whatever advice I can. I know my writing style seems harsh. It's not meant to be, I wish I could change it, so please don't take it that way.

Stuperfied

2:59 pm on Apr 28, 2005 (gmt 0)

10+ Year Member



Yeah, I dont take what anyone say's too harshly unless they make it undenyably clear that they wish to offend me. Other than that, I try to see the best in people.

The 100+ valadation errors are due to the repeat region I used in the VBScript. The validator is seeing the duplicated id's and chucking a wobbly because it doesnt like duplicate definitions. In actual fact, there was only about 2 genuine errors on the entire page although there may be more now because I just changed it to tables.

I had to change it to tables because the Mozilla Firefox browser was displaying 2 divides of 155px and 645px as longer than one 800px divide. The Mozilla line of browsers allways has had a problem with divides and although you can get around it, I cant be bothered. Tables will do exactly the same task with fewer complications.

I am on a windows box but using a commercial server to host my ASP sites because my Selisoft ASP server is in limbo at this current point in time. I am using ASP/VBScript because I had troubles writing pages in perl and although I know a little of other languages, I dont know enough to perform this sort of level of programing.

I saw a javascript somewhere which had a tag in it that was intended to make the javascript executed server side. I might give that a go and see what happens, might save me from having to re-write the substitution code.

FourDegreez

3:42 pm on Apr 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



At present, my login page set's MM_Username with your login name but MM_UserAuthorization is not in use at present. My reply page contains a hidden field (the one you saw before) which when the form is submitted, places the value of MM_Username into the username field of the post table.

What I'm saying is, instead of putting that hidden form field there with the value of MM_Username, grab the value from MM_Username on the page the form posts to instead and have no hidden field. You can grab the value from MM_Username at any time from any page, so there is no need to pass it in a hidden field.

Speaking of PHP, why have you ruled it out?

GaryK

3:53 pm on Apr 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Perhaps what you saw was the ability to use JScript in ASP? To do that put <%@ Language=JScript %> at the top of the .asp page instead of <%@ Language=VBScript %>. I don't think JScript is exactly the same as JavaScript but since I've never used it I'm not 100% certain of that.

Please do a search for DOCTYPE. It's one of the most essential things to include in the first line of your .asp pages. For now your page looks much better in Firefox, but it's still throwing a ton of validation errors, starting with the absence of a DOCTYPE.

GaryK

4:08 pm on Apr 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Um, I can still post anonymously. Also, I can still get around your JS validation by turning off JS. Sorry if I've complicated things but at least for now anyone visiting your page w/JS enabled will get directed to the WW home page.

Stuperfied

4:16 pm on Apr 28, 2005 (gmt 0)

10+ Year Member



FourDegreez: Oh, I understand what you mean now. The form is validated on the same page that it is submitted on but I should be able to enter username on the fly as you suggest, i'll give it a go.

I decided not to use PHP because I am still learning it and dont know enough to write this level of code in it yet. About all I know of it at the moment asside from a few stray tags and the basic syntax is:


echo("hello world");

GaryK: Nah, what I saw was something like:


<Script language="Javascript" type="text/javascript" execute server side>

Also, I dont think that putting a doctype in is going to fix the problem since your using a HTML Validator on an ASP page. There will always be multiple instances of 'id="[identifier]"' tags with duplicate identifiers unless I stop using CSS style sheets and 'id' tag's, which is not likely if I want to be able to incorporate skins at a later date.

You can still post without logging in which is how I want it for now but I just added a new script which should stop you from posting without providing at least an anonymous user name for your post.

Also, I have not been able to get around to fixing the javascript problem yet but will tomorrow. For now, im going to get some sleep because its 2:30am.

GaryK

4:42 pm on Apr 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think that's a .NET construct. It's not available in ASP Classic and it's for sure not available in the much older version of ASP that SunOne tries to emulate.

Instead of "id" why not use "class" instead? The "id" property and a CSS element is only valid once per page whereas "class" can be used numerous times.

As for the DOCTYPE, why are you of the opinion that ASP doesn't need it? ASP outputs HTML just like a static .html page. DOCTYPEs and validation are just as relevant and important on an .asp page as an .html page.

Stuperfied

2:55 am on Apr 29, 2005 (gmt 0)

10+ Year Member



Good idea with the classes, I switched the page to use them and it fixed a lot of problems for me too.

I didnt say that the doctype wasnt needed, I simply didnt get around to putting it in yet but I have now and the page is now HTML 4.01 Transitional.

I havent had a chance to search for that javascript thing but it was being used in a perl or php page, not sure which.

Stuperfied

4:27 am on Apr 29, 2005 (gmt 0)

10+ Year Member



Found what I was looking for:

<script language="javascript" type="text/javascript" runat="server"></script>

But unfortunately it doesnt like functions handling form data like that. It seems I will have to do the hard yards and write it into my VBScript. I dont suppose you know the VBScript equivalent to the Javascript replace(); function?

Found it:


Replace(expression, find, replacewith[, start[, count[, compare]]])

Stuperfied

7:00 am on Apr 29, 2005 (gmt 0)

10+ Year Member



GaryK: Ok, I used server side VBScript to do the substitution now and prevented posting with a blank username. Havent got around to preventing posting of blank message yet though.

I substituted "<" and ">" with their non executable equivalents "&gt;" and "&lt;", do you think that is sufficient or can you think of some other substitution I should do?

FourDegreez: I have deleted that username form field that had the value of Session("MM_Username") and replaced it with a VBScript that writes the value of Session("MM_Username") directly to the database username field.

Stuperfied

1:38 am on May 1, 2005 (gmt 0)

10+ Year Member



GaryK re-PM: Yeah I know. I had planned to resolve the issue but never had a good enough incentive until now. I will contact the host tomorrow and request more information on the subject. It may turn out that im attempting to do something which is not fully supported by their SQL server. Our host is quite reasonable and very helpful when it comes to resolving problems so I wont have to threaten to leave or anything. Its one of the reasons we stay with them, we pay $25 AUD per month for $20MB space, 1000MB of transfers, 5 Emails, ASP, SQL, Perl, FTP, Control Panel, Dedicated IP, Subdomains and more on what I believe is a Linux server in America but its well worth it when it comes to Support vs Features.

GaryK

3:29 am on May 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is going to be fun. I'm working with a fellow software developer in Hong Kong. Apparently you're in Australia. These time differences keep me in a constant state of confusion. When it's 12 noon here it's one in the morning in HK.

Let me know what you find out about the database issue. Maybe it would help if you posted the query that it's failing on. IIRC the error message mentioned a line number. What's on that line?

Stuperfied

6:50 am on May 1, 2005 (gmt 0)

10+ Year Member



Last time I got that message, it came up as line 22 which is:
rsPosts.Open()

If it happens again, I will take note of it but I think its the same part of the code every time.

My connection is this:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<%
Dim rsPosts__MMColParam
rsPosts__MMColParam = "1"
If (Request.QueryString("board_id") <> "") Then
rsPosts__MMColParam = Request.QueryString("board_id")
End If
%>
<%
Dim rsPosts
Dim rsPosts_numRows
Dim MM_messageboard_STRING
MM_messageboard_STRING = "Driver=Driver; Server=Server; Database=Database; UID=UID; PWD=PWD"

Set rsPosts = Server.CreateObject("ADODB.Recordset")
rsPosts.ActiveConnection = MM_messageboard_STRING
rsPosts.Source = "SELECT * FROM post WHERE board_id = " + Replace(rsPosts__MMColParam, "'", "''") + " ORDER BY post_id ASC"
rsPosts.CursorType = 0
rsPosts.CursorLocation = 2
rsPosts.LockType = 1
rsPosts.Open()

rsPosts_numRows = 0
%>


*I think I took out all of the sensetive info, if I didnt can an admin fix it or someone let me know pls, thanks.

Ok, if anyone can find a problem with that connection which would cause a lost connection to database during queery line 22 error, please let me know.

Stuperfied

7:06 am on May 1, 2005 (gmt 0)

10+ Year Member



Got it...
The page cannot be displayed 
There is a problem with the page you are trying to reach and it cannot be displayed.

--------------------------------------------------------------------------------

Please try the following:

Click the Refresh button, or try again later.

Open the www.whatever.com.au home page, and then look for links to the information you want.
HTTP 500.100 - Internal Server Error - ASP error
Apache/1.3.29 (Unix) Sun-ONE-ASP/4.0.0 ApacheJServ/1.1.2 PHP/4.3.4 mod_throttle/2.11 FrontPage/5.0.2.2634 Rewrit/1.1a

--------------------------------------------------------------------------------

Technical Information (for support personnel)

Error Type:
ADODB.Recordset.1 (0x80004005)
SQLState: S1000 Native Error Code: 2013 [TCX][MyODBC]Lost connection to MySQL server during query
/messageboard/pages/boards.asp, line 15

Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)

Page:
GET /messageboard/pages/boards.asp

Time:
Sunday, May 01, 2005, 3:05:29 AM

More information:
Sun ONE Active Server Pages Support

Oh, there we go. Its a unix server.
Well thats the error I got when I tried to access the page so with all this information about my connection and the error I got, can anyone see what the problem is?

Stuperfied

5:30 am on May 2, 2005 (gmt 0)

10+ Year Member



I called my host today and they said that they dont know what the problem is but they will ask the teck's and get back to me when the teck's get back to them.

GaryK

3:02 pm on May 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That's a good start. Please let me know when they've found and fixed the problem so I can resume my attempts to break your message board. ;)

Stuperfied

2:37 am on May 3, 2005 (gmt 0)

10+ Year Member



The error is actually intermittent and has been happenning ever since they switched us accross to their ASP and MySQL servers, so you can still access the page as you have been but you may sometimes get the error. A lot of the time when the error occurs at my end, I have to reload the page 3-5 times before it will work. They are aware of the problem and are currently attempting to track down the cause.

Is FourDegreez still here? If so, you suggested simply throwing a simple message board up there and then expanding on it. I have the register, login, boards, posts and reply pages up there now and they work well enough to look at advancing the project to the next step. In your experience, is there anything else that I might need to setup now or be aware of to save on problems later or can I just move onto adding more functionallity?

From what I can see, I still need to add an edit post page, delete post page, preview post page, profiles pages in general and control panel. Whilst I wait for your reply, I will begin on the edit and delete pages.

Note: Please do not be put off by the look of the message board, I just added a bit of color to make it easier to read. The overall look of the message board will be completely changed before we are finished.

GaryK

3:39 am on May 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry but I lack the patience to reload a page until it stops throwing errors. In that regard I think I'm like most users. If a site breaks the first time I try it then it's not likely I'll be back.

FWIW I advise against letting members delete their own posts. Every site I've seen that allows it has wound up with more trouble than it's worth. Someone will post something inflammatory, wait until people attack him/her, delete the message that started it all and claim they don't understand why people are being so mean.

Please let me know when the db problem has been fixed and I'll try to resume helping you again.

Stuperfied

5:07 am on May 3, 2005 (gmt 0)

10+ Year Member



Good point with the deleting of posts, I will make sure that access to it is restricted however user editing is required. I have noticed though that the webmasterworld message board stops you from editing your post after a certain time, this is probably for the same reason and is also a good idea.

I must thank you all very much for your help, it is an interesting experience and I am already amazed with the amount of things I didnt know about message boards. I am learning at an astronomical rate and getting better all the time. When we are done, if I ever do design a message board, I will be sure to note in it those here who have helped so much.

I will let you know when they get the problem resolved.

GaryK

2:44 pm on May 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For my own message boards I limit editing to three hours. I'm finding that may be too liberal and have begun discussing with my admins and mods the possibility of reducing it to 30 minutes. Usually the purpose of editing is to correct spelling or grammar mistakes, or even to correct a broken link and that sort of thing. I figure that sort of stuff should become obvious to the poster within half an hour. If it takes longer than that the member always has the option of asking a mod to edit the message. Our mods are always happy to do that for our members.

Stuperfied

6:33 am on May 5, 2005 (gmt 0)

10+ Year Member



Good idea too I think.
I got this message today,
Hi Stuperfied,

I got a sysadmin to investigate further into this problem and he found out the problem. He didn't tell me but it should now be resolved.

Cheers,
AVS Network Team

Cant wait to see what crafty ideas you come up with GaryK.

GaryK

10:01 pm on May 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I seem to have misplaced the URL. Would you send it to me again please? Thanks.

Stuperfied

8:51 am on May 6, 2005 (gmt 0)

10+ Year Member



Sent.. Hmm, I guess FourDegreez must be away or lost interest or something.

Stuperfied

12:52 pm on May 7, 2005 (gmt 0)

10+ Year Member



It has been brought to my attention that many of the members of WW might not be responding to my posts because they may believe that I lack sufficient knowledge of the basics to undertake many of the tasks which I have set for myself.

I do not take this to heart, everybody is entitled to their own opinion. I have never tried to hide the fact that I am not the greatest coder that this world has ever seen and I do not intend to. If people do decide to help me for whatever reason, I realize that it is my responsibility to let them know what level I am at so that they can provide information which would be of some use to me.

As such, I would like to make it very clear right now that my first computer was a commodore64. I learned commodore64 basic and touched on some machine code, afterwhich I advanced to a 286. I quickly picked up QBasic, which I became very proficient at. After a year of two I moved onto Borland C++ ver 4.0 which being from a basic language background, I found very daunting. Once I moved onto Microsoft Visual C++, I began to find it a little easier and started to get a grasp for object oriented programing. Next, I moved onto HTML which was not very hard at all to learn. I had a brief incounter with DHTML but found it more convenient to use pre written codes rather than writing them myself. After that, I setup my first web server using Abyse web server in conjunction with GuildFTP and shortly after learned Perl. Then I moved onto Apache with MySQL and started learning ASP. I have been using Apache, ASP and MySQL for only about 2-3 months now. I make no secret of the fact that I use dreamweavers GUI to insert pre written code into my pages for the sake of ease and convenience. I would sooner use dreamweavers pre written login and databasing routines which work perfectly fine and then edit them than spend hrs writing it all myself. I am a very quick learner when its something that interests me and with a 129 IQ im inteligent enough to understand what im being told if you use simple laymens terms and dont use confusing terminology. The only thing standing between me and a very successfull career is the breakdown between my short term and long term memory. I touched on PHP but have put learning it on hold for this project.

I am extremely greatful for any and all assistance I receive from the members here at WW and endeavour to conduct myself in a manner befitting one of its members. Should I advance this project to a fully functional production model one day, I will do the right thing and give credit where it is due to those who have helped me so much to achieve that potential.

GaryK

8:13 pm on May 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I just tested your message board again.

Is the login stuff working yet? I ask because I was able to post without logging in.

Also, when accepting form input you need to validate it a bit more than whatever you're doing. For example, I was able to post a message by using a blank space as my name. Dealing with it is as simple, in this case, as using Trim to remove leading and trailing blank spaces from both the name and message form fields.

This 41 message thread spans 2 pages: 41