Thanx again Link9, you've been a real help lately,
if I show you my code, can you take a look and tell me if it looks ok, if you have time of course. My small problem is that when I load the page, the word Incorrect appears right away when I want it to appear, if need be, only after the cmdLogin button has been pushed:
<center><font size=+4>Gladiators</font><font size=+4></font>
<p><font size=+2>Your nostrils fill with the scent of blood and sweat.
Your eyes focus on your enemy's blade. Your ears rejoyce in your opponent's
screams of agony. Your mouth waters in anticipation of victory. The crowds.
The cheers. </font><font size=+3>VICTORY...</font><font size=+3></font>
<p><font size=+2>Your nostrils struggle to breathe. Your eyes are blinded
by the blood flowing from your brow. Your ears shy away from your
enemy's taunts. Your mouth fills with blood, drowning you in defeat. The
crowds. The cheers. </font><font size=+3>DEFEAT...</font><font size=+3></font>
<p><font size=+2>Be it one or the other, GLORY or SHAME, you ARE destined
to be a...</font><font size=+2></font>
<p><font size=+4>Gladiator</font><font size=+4></font>
<br>
<p><font size=+4>UserID:</font><font size=+4></font>
<br><br>
<div align="center"><input type="text" name="txtUserID" value="" size="15" maxlength="15"></div>
<br>
<p><font size=+4>Password:</font></center>
<br><br>
<div align="center"><input type="text" name="txtPassword" value="" size="15" maxlength="15"></div>
<br><br><br><br>
<%
if Request.Form("cmdLogin" <> "" then
UID = request.form("txtUserID"
EntPWD = request.form("txtPassword"
sql = "select top 1 password, UserID from players Where UserID = '" & UID & "'"
Set Conn = Server.CreateObject("ADODB.Connection"
Conn.Open "Glad"
Set rs = Server.CreateObject("ADODB.Recordset"
rs.Open sql, Conn
if not rs.EOF then
PWD = rs("Password"
if PWD = EntPWD then
Response.Write "Correct"
else
Response.Write "Incorrect"
end if
else
PWD = "No such User"
Response.Write PWD
end if
rs.Close
conn.Close
set conn = nothing
set rs = nothing
This appears to be your login page, but you are checking the password and userID here on the same page --
I think that's where you are in error --
Try taking out the asp script that is here, and placing it on the page where your form is pointing to, 'default.asp' -- that way, a user visits this page, enters their info, and then they hit 'Login'...
the information is then sent to default.asp to run the password checking --
Then, you can redirect them to wherever they are supposed to go...
Is this making sense, or am I missing the point here?
Oh, ok I get it. So basically, because it would point elsewhere, that "Incorrect" word would not appear when I load the first page. Ok that makes sense. I'll try it and keep you posted on my progress, this is actually quite interesting this ASP stuff.
It works great, but let me see if I get this straight...
Each time I need to call an event (like a user clicking a button) I need to load a new page? And this is determined with the following line?
You are right on track. There is actually a way to make a round trip to the server and get info from a database without submitting a form, and it's called remote scripting, but it can get complicated, and is probably best left for another discussion...
As a rule, you are right on track as far as the submit button goes -- when a user clicks a Submit button, the data that is in the form elements is bundled up and whisked away to the page that you have specified in the action portion of your form...
Other buttons can be used -- you can call functions with them, if you wish -- and have them do something -- like maybe validate the contents of the form before you submit, and then the last line of your function could well be... document.formName.submit()
which, in essence, does the exact same thing as your user actually pressing a 'Submit' button...
Ok, I think I understand most of it, but you can be sure I'll be back on here for more help. I'm not sure I get how to use other buttons, maybe you can give me a concrete example?
Anyway, thax again
<input type=button value="Just a Button" onClick="someFunction();">
<script>
function someFunction(){
document.formName.submit();
}
</script>
so you see you have effectively made that button a submit button, even though it isn't technically a submit button -- and so it stands to reason that you might want to do something else in that function besides just the submit, such as form validation, or anything else you need.
Thanx for the exemple, good stuff...
Another question if your infinite wisdom permits ;O)
Is there a way to implement a timer? Kind of like a vb timer...
If possible, how would the events be played, let's say...
After 1 minute of the user being on the page, a new window opens but the original page is not closed.
Then after 5 minutes, the same repeats and so forth every 5 minutes until the user presses a button or something...
Well, I'm sure there is a way to do that with a session object or something, but that probably wouldn't be a good idea, and here's why --
It would have to be kept up with on the server -- a timer object -- it would be the only way to introduce a real timer into the equation.
So you have your timer object ticking away and say 5 visitors on your site ----> that equals five objects ticking away (spin looping = mucho server resources) -- but with only 5 visitors... eh... not too bad...
But lets say all of a sudden 500 other people (or worse, 5000) suddenly logon to the site, and ... I think you see where I'm going with this --
Your performance just took a SERIOUS nosedive, and if you're lucky, your server won't crash...
Setting session objects just isn't a good idea... variables are ok -- because they take up less real estate.
So how else could you do it??? I suppose you could continue checking system time -- set it to a client side variable when the page loads, and use the javascript setTimeout() function to keep track of what's going on --
Hey - there's an idea!
Ok -- back up --
javascript has a function called setTimeout that effectively works like a 'pause' function -- it doesn't wait on modal components to finish what they are doing (i.e. modal components won't 'pause' the 'pause' function -- if that makes any sense), but it works like this...
So that once that line of code is encountered, it starts counting, and when the specified number of milliseconds has passed, it executes whatever is supposed to be executed. What's in quotes up there can either be a javaScript expression or a function call --
I bet if you played around with that method, you could get something to work for ya.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.