Source Code for Enter.asp



<%

'Check to see that they've filled out the form

If Request("Name") = "" Then
Response.Redirect("Chat_Form.asp?NoInfo=True")
End If

'Local Variables:

Name = Request("Name")
Email = Request("Email")
Refresh = Request("Refresh")

'Assigning Session Variables:

Session("RefreshRate") = Refresh
Session("Name") = Name

If Request("Email")="" then
Session("Email")="none"
Else
Session("Email") = Email
End If

'Add the user to the App level array of users:

If Not IsEmpty(Application("Users")) Then
If IsArray(Application("Users")) Then
uLen = UBound(Application("Users"))

'Check to see if someone already has the name, if so redirect w/ querystring bln var

For I = 0 To uLen
If Application("Users")(I) = Name Then
Name = Name & "_1"
Session("Name") = Name
Response.Redirect("Chat_Form.asp?BadName=True")
Exit For
End If
Next

'Get App level array variable, add current user info and put back

Users = Application("Users")
NumOfUsers = UBound(Users)+1
ReDim Preserve Users(NumOfUsers)
Users(NumOfUsers-1) = Name
Application("Users") = Users

Else

'If not array, dimension the variables as array

Users = Application("Users")
ReDim Preserve Users(1)
Users(0) = Name
Application("Users") = Users

End If

Else
'If it's empty, then initialize Users Variable
Dim NewUsers()
Redim NewUsers(1)
NewUsers(0) = Name
Application("Users") = NewUsers

End If

'User added to App level array of users, now send their first message:
'Variables to be passed to app level:

Name = Session("Name")
NewUserInput= "[Has entered the room]"
NewInputEmail = Session("Email")

MaxLength = 100

If Not IsEmpty(Application("UserInput")) Then

If IsArray(Application("UserInput")) Then
UserInput = Application("UserInput")
Handle = Application("Handle")
InputEmail = Application("InputEmail")
TimeInput = Application("TimeInput")
NumofEntries = UBound(UserInput)

If NumofEntries > MaxLength then

'Move all the entries up one, deleting the first
For I = 0 to (NumofEntries - 2)
UserInput(I) = UserInput(I+1)
Handle(I) = Handle(I+1)
TimeInput(I) = TimeInput(I+1)
InputEmail(I) = InputEmail(I+1)
Next

'Assign values and put the new arrays to App level
UserInput(MaxLength) = NewUserInput
Handle(MaxLength) = Name
TimeInput(MaxLength) = Now
InputEmail(MaxLength)= NewInputEmail
Application("UserInput") = UserInput
Application("Handle") = Handle
Application("InputEmail") = InputEmail
Application("TimeInput")= TimeInput
Else

'ReDimension the array to include new input and return to App level


NumofEntries = NumofEntries + 1

ReDim Preserve UserInput(NumofEntries)
ReDim Preserve Handle(NumofEntries)
ReDim Preserve TimeInput(NumofEntries)
ReDim Preserve InputEmail(NumofEntries)
UserInput(NumofEntries -1) = NewUserInput
Handle(NumofEntries -1) = Name
InputEmail(NumofEntries -1) = NewInputEmail
TimeInput(NumofEntries -1)=Now
Application("UserInput") = UserInput
Application("Handle") = Handle
Application("TimeInput")= TimeInput
Application("InputEmail") = InputEmail
End If

Else
'ReDimension the variable to an array and put back to App level
ReDim UserInput(1)
ReDim Handle(1)
ReDim TimeInput(1)
ReDim InputEmail(1)
Handle(0) = Name
UserInput(0) = NewUserInput
TimeInput(0) = Now
InputEmail(0) = NewInputEmail
Application("Handle") = Handle
Application("UserInput") = UserInput
Application("TimeInput") = TimeInput
Application("InputEmail") = InputEmail

End If

'CHANGED

Else
'Initialize Users Variable and give to the App
Dim NwUserInput()
ReDim NwUserInput(1)
Dim NwHandle()
ReDim NwHandle(1)
Dim NwTimeInput()
ReDim NwTimeInput(1)
Dim NwInputEmail()
ReDim NwInputEmail(1)
NwUserInput(0) = NewUserInput
NwHandle(0) = Name
NwInputEmail(0) = NewInputEmail
'CHANGED 8/8/01
NwTimeInput(0)= Now()
Application("UserInput") = NwUserInput
Application("Handle") = NwHandle
Application("TimeInput") = NwTimeInput
Application("InputEmail") = NwInputEmail


End If
Session("FirstEntry")="True"

%>
<html>
<head>
<title></title>
<script language="JavaScript">
function Redirect(){
chatWin = window.open("HS_Chat.asp","chatWin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,WIDTH=617,HEIGHT=475");
chatWin.location.href = "HS_Chat.asp"
self.location.href="Chat_Form.asp"
if(navigator.appVersion.indexOf("4") != -1){
chatWin.moveTo(0,0);
}

}
</script>
</head>
<body onLoad="Redirect()">
<div align="center" style="margin:35px 0px 20px 0px">
<script type="text/javascript"><!--
amazon_ad_tag = "httpwwwhotspr-20"; amazon_ad_width = "728"; amazon_ad_height = "90"; amazon_ad_logo = "hide"; amazon_ad_link_target = "new"; amazon_color_border = "B8CD6F"; amazon_color_background = "F1F7DA"; amazon_color_link = "334141"; amazon_color_price = "232A23"; amazon_color_logo = "080808";//--></script>
<script type="text/javascript" src="http://www.assoc-amazon.com/s/ads.js"></script>
</div>

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-11415514-1");
pageTracker._trackPageview();
} catch(err) {}</script>

</body>
</html>


<--Back