Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Launch sound file with 'log on' button

Status
Not open for further replies.

Blueie

Technical User
May 12, 2012
72
GB
Hello

I have a default ASP page which is where users type in a username to login to a chat. But at the moment, the Webmaster is unaware that a site visitor wishes to chat, so I was hoping to create a sound alert to notify the Webmaster (the sound should not be heard by the site visitor).

I imagine that the sound would need to load when the user presses the log-in button, and that I would need to use <embed>sound.mp3</embed>, but I am unsure where to put it in my stripped down code below:

Code:
Dim mode, errorMessage
	mode = Request("mode")
	If (mode = "userLogin") Then
		
		Dim userName
		userName = Server.HTMLEncode(Request("username"))
		
		If (countUsers() >= USERS) Then
			errorMessage = getMsg("error.maximum_users_reached")
		ElseIf (Len(userName) = 0)  Then
			errorMessage = getMsg("error.missing_username")
		ElseIf (Len(userName) > MAX_USERNAME_LENGTH) Then
			errorMessage = getMsg("error.username_length_exceeded", MAX_USERNAME_LENGTH)
		ElseIf (userExists(userName)) Then
			errorMessage = getMsg("error.username_in_use")
		ElseIf (NOT isValidUsername(userName)) Then
			errorMessage = getMsg("error.invalid_username")
		ElseIf (isUserNameBlocked(userName)) Then
			errorMessage = getMsg("error.username_blocked")
		Else
			Dim p
			Set p = New Person
			p.id = -1
			p.name = userName
			p.roomId = 0
			p.ipAddress = Request.ServerVariables("REMOTE_ADDR")
			
			' new chat user so create new id
			Set p = addUser(p)
			
			' tell all other users about this new user
			Call addMessage( _
				p.id, _
				"-1", _
				"<span class=LoggedIn><img src='images/new.gif' height=9 width=9>&nbsp;" & getMsg("user.logged_on", p.name, Now()) & "</span><br>" _
			)
			Session("user") = p.data
			
			' redirect to new frame and create new user login
			Response.Redirect("frames.asp")
			Response.End
			
		End If
......

<%= getMsg("login.join_chat", getMsg("application.name") & " " & getMsg("application.version")) %></td>
.......
<input type=text name=username value="<%= Server.HTMLEncode(userName) %>" 
.......
<input type=submit class=btn name=login value="<%= getMsg("button.login") %>" border=0 tabindex=2 title="<%= getMsg("button.login.title") %>"></td>

Thanks for any advice/help.

Blueie
 
Does the "webmaster" sit in the same room as the webserver?

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top