Flashchat enhancement - نوشته شده در (2403 Views)
Junior Member
Zenfor
مطلب: 372
372
It would be great if there was a way to show on the forum who is currently in a chat room.

Something like:

The following are currently in the chat room:

user1, user2, user3,

Is this possible?
 پیش‌فرض مرتب‌سازی برای تاریخ DESC به معنی جدیدترین است  
 تعداد در صفحه 
نوشته شده در
Advanced Member
Carefree
مطلب: 4224
4224
It could be done, depending on where you live. There are many HTML to SMS gateways in the USA and Europe, very few here. It would have to be individually configured to use your EMail address to send the SMS via the gateway.
نوشته شده در
Junior Member
Zenfor
مطلب: 372
372
Most of the major wireless mobile providers offer an SMS gateway. Typically, the wireless providers use a mobile number plus an email domain to route email messages through their SMS gateway. For example, if you are sending an email to a Verizon Wireless mobile device, you would send it to the mobile number + "@vtext.com". If the mobile phone number was 123-456-7890, you would send the email to "1234567890@vtext.com". From a mobile device, you can generally just use an email address which will send the message through the SMS gateway and to the intended email address.

Where would I put it and what would the email code be?
Thank you, you are awesome!!
نوشته شده در
Advanced Member
Carefree
مطلب: 4224
4224
This should be all that's needed. Change the bits in red.
"loginout.asp"
Code:

<%@Language = "VBScript"%>
<%
Option Explicit
Response.Buffer = True
Response.Expires = -1000

Dim vAction
Dim vChatName, vPassword, vNewName, vUserPassword, vRoomPassword
Dim vUserArray, vMoodArray, vUserCount
Dim vRoomNo, vNewRoomNo, vCheckOp
Dim vRedirectTo, vSound
Dim vINIFile, x

vAction = Request.QueryString("action")
vChatName = "" & Session("ChatName")

%><!-- #INCLUDE FILE="inifiles.asp" --><%

If vAction = "getuser" Then
If vChatName <> "" Then
Response.Write "UserName=" & Server.URLEncode(vChatName) & "&Result=OK"
Else
Response.Write "Result=NotLoggedIn"
End If
Response.Flush
Response.End
End If

%><!-- #INCLUDE FILE = "chatlib.asp" --><%
Application.Lock

Select Case vAction
Case "login"
If vChatName <> "" Then
'already logged in
Session.Timeout = 2
Session("LastLine") = Session("StartLine")
Response.Write "Result=OK"
Else
vRoomNo = "" & Session("RoomNo")
If vRoomNo = "" Then vRoomNo = 1 Else
vUserArray = Application("ChatUsers" & vRoomNo)
vMoodArray = Application("ChatMoods" & vRoomNo)
vUserCount = Application("UserCount" & vRoomNo)
vNewName = Session("ChatName")
vPassword = Request.Form("txtPassword")

vCheckOp = CheckOp(vNewName, vPassword)
If vCheckOp = "BadPassword" Then
If vPassword = "" Then
Response.Write "Result=Password"
Else
Response.Write "Result=BadPassword"
End If
Else
If LogUserIn(vNewName, vUserArray, vMoodArray, vUserCount) = True Then
Session("Kicked") = "False"
If vCheckOp = "OK" Then
Session("Op") = "True"
Session("Password") = vPassword
Else
Session("Op") ="False"
Session("Password") = ""
End If
Session("RoomNo") = vRoomNo
Application("ChatUsers" & vRoomNo) = vUserArray
Application("ChatMoods" & vRoomNo) = vMoodArray
Application("UserCount" & vRoomNo) = vUserCount
AddLineToChat vRoomNo, "**" & vNewName & " has arrived**"
Session("StartLine") = Application("ChatLineCount" & vRoomNo)
Session("LastLine") = Application("ChatLineCount" & vRoomNo)
vINIFile = Application("INIFile")
vSound = Trim(INIFileValue(vINIFile, "Sound", "Sound"))
If vSound = "" Then vSound = "1"
Session.Timeout = 2
Response.Write "Result=OK&Users=" & Application("UserCount1") & "&Sound=" & vSound
strRecipients = "phonenumber@vtext.com"
strRecipientsName = "Forum Admin"
strFrom = "youremailaddress"
strFromName = "Easton Mass"
strSubject = "Flash Chat"
strMessage = Session("ChatName") & " has joined chatroom " & Session("RoomNo")
%>
<!--#INCLUDE FILE="../inc_mail.asp" -->
<%
Else
Response.Write "Result=BadLogin"
End If
End If
End If
Case "logout"
vRoomNo = Session("RoomNo")
vUserArray = Application("ChatUsers" & vRoomNo)
vMoodArray = Application("ChatMoods" & vRoomNo)
vUserCount = Application("UserCount" & vRoomNo)
If LogUserOut(vChatName, vUserArray, vMoodArray, vUserCount) Then
If vUserCount = 0 Then
Application("ChatLines" & vRoomNo) = ""
Application("ChatLineCount" & vRoomNo) = 0
Application("ChatMaxLines" & vRoomNo) = 0
End If
Application("ChatUsers" & vRoomNo) = vUserArray
Application("ChatMoods" & vRoomNo) = vMoodArray
Application("UserCount" & vRoomNo) = vUserCount
End If
Session("ChatName") = ""
Session.Timeout = 20
If Session("Kicked") = "True" Then
x = Instr(vChatName,"[")
If x > 1 Then vChatName = Left(vChatName, x - 1)
AddLineToChat vRoomNo, "**" & vChatName & " has left (kicked)**"
Else
AddLineToChat vRoomNo, "**" & vChatName & " has left (quit)**"
End If
vINIFile = Application("INIFile")
vRedirectTo = Trim(INIFileValue(vINIFile, "Logout", "redirect"))
If vRedirectTo <> "" Then
Response.Write "Redirect=" & Server.URLEncode(vRedirectTo) & "&Result=OK"
Else
Response.Write "Result=OK"
End If
Case "changeroom"
vINIFile = Application("INIFile")
vRoomNo = Session("RoomNo")
vNewRoomNo = Request.QueryString("room")

vUserPassword = Request.QueryString("Password")
vRoomPassword = INIFileValue(vINIFile, "Rooms", "Password" & vNewRoomNo)
If UCase(vRoomPassword) <> "" And UCase(vRoomPassword) <> UCase(vUserPassword) Then
Response.Write "Result=Denied&Password=" & vUserPassword
Else
If vRoomNo = vNewRoomNo Then
Response.Write "Result=OK"
Else
vUserArray = Application("ChatUsers" & vRoomNo)
vMoodArray = Application("ChatMoods" & vRoomNo)
vUserCount = Application("UserCount" & vRoomNo)
If LogUserOut(vChatName, vUserArray, vMoodArray, vUserCount) Then
AddLineToChat vRoomNo, "**" & vChatName & " has left (quit)**"
If vUserCount = 0 Then
Application("ChatLines" & vRoomNo) = ""
Application("ChatLineCount" & vRoomNo) = 0
Application("ChatMaxLines" & vRoomNo) = 0
End If
Application("ChatUsers" & vRoomNo) = vUserArray
Application("ChatMoods" & vRoomNo) = vMoodArray
Application("UserCount" & vRoomNo) = vUserCount
End If

vUserArray = Application("ChatUsers" & vNewRoomNo)
vMoodArray = Application("ChatMoods" & vNewRoomNo)
vUserCount = Application("UserCount" & vNewRoomNo)

If LogUserIn(vChatName, vUserArray, vMoodArray, vUserCount) = True Then
Session("RoomNo") = vNewRoomNo
AddLineToChat vNewRoomNo, "**" & vChatName & " has arrived**"
Application("ChatUsers" & vNewRoomNo) = vUserArray
Application("ChatMoods" & vNewRoomNo) = vMoodArray
Application("UserCount" & vNewRoomNo) = vUserCount
Session("StartLine") = Application("ChatLineCount" & vNewRoomNo)
Session("LastLine") = Application("ChatLineCount" & vNewRoomNo)
Response.Write "Result=OK"
Else
Response.Write "Result=BadLogin"
End If
End If
End If

End Select

Application.Unlock
Response.Flush
Response.End
%>
نوشته شده در
Junior Member
Zenfor
مطلب: 372
372
Originally posted by Carefree
This should be all that's needed. Change the bits in red.
Thank you, I replaced loginout with this and I'll see what happens. I logged in myself several times and didn't get a text but maybe there is a delay. I'll keep checking it.
نوشته شده در
Advanced Member
Carefree
مطلب: 4224
4224
This code is contingent upon your flashchat folder being within the forum folder. Oh I forgot to add the strmailmode variable. Save this file as anything you'd like in your forum folder and run it. The code it reports will be needed below.

Code:

<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_header.asp" -->
<%
strSql = "SELECT * FROM " & strTablePrefix & "CONFIG_NEW WHERE C_VARIABLE='STRMAILMODE'"
Set rs=my_Conn.Execute(strSql)
If not rs.EOF Then
strMode=rs("C_VALUE")
rs.Close
End If
Set rs=Nothing
Response.Write strMode & "=mail mode"
WriteFooter
%>

You will need to indicate which one you're using (see item in GREEN). Notice I also dimensioned the variable. Make sure you get that change, too.
"loginout.asp"
Code:

<%@Language = "VBScript"%>
<%
Option Explicit
Response.Buffer = True
Response.Expires = -1000

Dim vAction, strMailMode Dim vChatName, vPassword, vNewName, vUserPassword, vRoomPassword
Dim vUserArray, vMoodArray, vUserCount
Dim vRoomNo, vNewRoomNo, vCheckOp
Dim vRedirectTo, vSound
Dim vINIFile, x
strMailMode = "yourcodehere"
vAction = Request.QueryString("action")
vChatName = "" & Session("ChatName")

%><!-- #INCLUDE FILE="inifiles.asp" --><%

If vAction = "getuser" Then
If vChatName <> "" Then
Response.Write "UserName=" & Server.URLEncode(vChatName) & "&Result=OK"
Else
Response.Write "Result=NotLoggedIn"
End If
Response.Flush
Response.End
End If

%><!-- #INCLUDE FILE = "chatlib.asp" --><%
Application.Lock

Select Case vAction
Case "login"
If vChatName <> "" Then
'already logged in
Session.Timeout = 2
Session("LastLine") = Session("StartLine")
Response.Write "Result=OK"
Else
vRoomNo = "" & Session("RoomNo")
If vRoomNo = "" Then vRoomNo = 1 Else
vUserArray = Application("ChatUsers" & vRoomNo)
vMoodArray = Application("ChatMoods" & vRoomNo)
vUserCount = Application("UserCount" & vRoomNo)
vNewName = Session("ChatName")
vPassword = Request.Form("txtPassword")

vCheckOp = CheckOp(vNewName, vPassword)
If vCheckOp = "BadPassword" Then
If vPassword = "" Then
Response.Write "Result=Password"
Else
Response.Write "Result=BadPassword"
End If
Else
If LogUserIn(vNewName, vUserArray, vMoodArray, vUserCount) = True Then
Session("Kicked") = "False"
If vCheckOp = "OK" Then
Session("Op") = "True"
Session("Password") = vPassword
Else
Session("Op") ="False"
Session("Password") = ""
End If
Session("RoomNo") = vRoomNo
Application("ChatUsers" & vRoomNo) = vUserArray
Application("ChatMoods" & vRoomNo) = vMoodArray
Application("UserCount" & vRoomNo) = vUserCount
AddLineToChat vRoomNo, "**" & vNewName & " has arrived**"
Session("StartLine") = Application("ChatLineCount" & vRoomNo)
Session("LastLine") = Application("ChatLineCount" & vRoomNo)
vINIFile = Application("INIFile")
vSound = Trim(INIFileValue(vINIFile, "Sound", "Sound"))
If vSound = "" Then vSound = "1"
Session.Timeout = 2
Response.Write "Result=OK&Users=" & Application("UserCount1") & "&Sound=" & vSound
strRecipients = "phonenumber@vtext.com"
strRecipientsName = "Forum Admin"
strFrom = "youremailaddress"
strFromName = "Easton Mass"
strSubject = "Flash Chat"
strMessage = Session("ChatName") & " has joined chatroom " & Session("RoomNo")
%>
<!--#INCLUDE FILE="../inc_mail.asp" -->
<%
Else
Response.Write "Result=BadLogin"
End If
End If
End If
Case "logout"
vRoomNo = Session("RoomNo")
vUserArray = Application("ChatUsers" & vRoomNo)
vMoodArray = Application("ChatMoods" & vRoomNo)
vUserCount = Application("UserCount" & vRoomNo)
If LogUserOut(vChatName, vUserArray, vMoodArray, vUserCount) Then
If vUserCount = 0 Then
Application("ChatLines" & vRoomNo) = ""
Application("ChatLineCount" & vRoomNo) = 0
Application("ChatMaxLines" & vRoomNo) = 0
End If
Application("ChatUsers" & vRoomNo) = vUserArray
Application("ChatMoods" & vRoomNo) = vMoodArray
Application("UserCount" & vRoomNo) = vUserCount
End If
Session("ChatName") = ""
Session.Timeout = 20
If Session("Kicked") = "True" Then
x = Instr(vChatName,"[")
If x > 1 Then vChatName = Left(vChatName, x - 1)
AddLineToChat vRoomNo, "**" & vChatName & " has left (kicked)**"
Else
AddLineToChat vRoomNo, "**" & vChatName & " has left (quit)**"
End If
vINIFile = Application("INIFile")
vRedirectTo = Trim(INIFileValue(vINIFile, "Logout", "redirect"))
If vRedirectTo <> "" Then
Response.Write "Redirect=" & Server.URLEncode(vRedirectTo) & "&Result=OK"
Else
Response.Write "Result=OK"
End If
Case "changeroom"
vINIFile = Application("INIFile")
vRoomNo = Session("RoomNo")
vNewRoomNo = Request.QueryString("room")

vUserPassword = Request.QueryString("Password")
vRoomPassword = INIFileValue(vINIFile, "Rooms", "Password" & vNewRoomNo)
If UCase(vRoomPassword) <> "" And UCase(vRoomPassword) <> UCase(vUserPassword) Then
Response.Write "Result=Denied&Password=" & vUserPassword
Else
If vRoomNo = vNewRoomNo Then
Response.Write "Result=OK"
Else
vUserArray = Application("ChatUsers" & vRoomNo)
vMoodArray = Application("ChatMoods" & vRoomNo)
vUserCount = Application("UserCount" & vRoomNo)
If LogUserOut(vChatName, vUserArray, vMoodArray, vUserCount) Then
AddLineToChat vRoomNo, "**" & vChatName & " has left (quit)**"
If vUserCount = 0 Then
Application("ChatLines" & vRoomNo) = ""
Application("ChatLineCount" & vRoomNo) = 0
Application("ChatMaxLines" & vRoomNo) = 0
End If
Application("ChatUsers" & vRoomNo) = vUserArray
Application("ChatMoods" & vRoomNo) = vMoodArray
Application("UserCount" & vRoomNo) = vUserCount
End If

vUserArray = Application("ChatUsers" & vNewRoomNo)
vMoodArray = Application("ChatMoods" & vNewRoomNo)
vUserCount = Application("UserCount" & vNewRoomNo)

If LogUserIn(vChatName, vUserArray, vMoodArray, vUserCount) = True Then
Session("RoomNo") = vNewRoomNo
AddLineToChat vNewRoomNo, "**" & vChatName & " has arrived**"
Application("ChatUsers" & vNewRoomNo) = vUserArray
Application("ChatMoods" & vNewRoomNo) = vMoodArray
Application("UserCount" & vNewRoomNo) = vUserCount
Session("StartLine") = Application("ChatLineCount" & vNewRoomNo)
Session("LastLine") = Application("ChatLineCount" & vNewRoomNo)
Response.Write "Result=OK"
Else
Response.Write "Result=BadLogin"
End If
End If
End If

End Select

Application.Unlock
Response.Flush
Response.End
%>
نوشته شده در
Junior Member
Zenfor
مطلب: 372
372
Originally posted by Carefree
This code is contingent upon your flashchat folder being within the forum folder. Oh I forgot to add the strmailmode variable. Save this file as anything you'd like in your forum folder and run it. The code it reports will be needed below...
I made all the changes to loginout, I'm using cdosys and using myself to login to chat but I'm not getting any sms text messages. Thanks!
نوشته شده در
Advanced Member
Carefree
مطلب: 4224
4224
Here's a direct test, change the bit in RED. If you receive the SMS, then the configuration is correct.
Code:

<!--#INCLUDE FILE="config.asp" -->
<!--#INCLUDE FILE="inc_header.asp" -->
<%
If Session(strCookieURL & "Approval") <> "15916941253" Then
ScriptName = Split(Request.ServerVariables("SCRIPT_NAME"),"/")
Response.Redirect "admin_login.asp?target=" & ScriptName(uBound(ScriptName))
End If
Response.Write "<table border=""0"" width=""100%"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td width=""33%"" align=""left"" nowrap><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
" " & getCurrentIcon(strIconFolderOpen,"","") & " <a href=""default.asp"">All Forums</a><br />" & vbNewLine & _
" " & getCurrentIcon(strIconBar,"","") & getCurrentIcon(strIconFolderOpen,"","") & " <a href=""admin_home.asp"">Admin Section</a><br />" & vbNewLine & _
" " & getCurrentIcon(strIconBlank,"","") & getCurrentIcon(strIconBar,"","") & getCurrentIcon(strIconFolderOpenTopic,"","") & " SMS Test<br /></font></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"" width=""100%"">" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """><b>SMS Test</b>"
strRecipients = "phonenumber@vtext.com"
strRecipientsName = "Forum Admin"
strFrom = strSender
strFromName = "Easton Mass"
strSubject = "Flash Chat"
strMessage = "This is an SMS test."
%>
<!--#INCLUDE FILE="inc_mail.asp" -->
<%
If Err.Number <> 0 Then
Response.Write " <font color=""" & strHiliteFontColor & """>" & Err.Number & ". " & Err.Description & "</font>"
Else
Response.Write " No error encountered."
End If
Response.Write " </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
"</table>" & vbNewLine
WriteFooter
%>
نوشته شده در
Junior Member
Zenfor
مطلب: 372
372
Originally posted by Carefree
Here's a direct test, change the bit in RED. If you receive the SMS, then the configuration is correct...
All your code appears to be correct, it's just refusing to send the sms. I verified the gateway email address by cutting and pasting it the To: portion of an email message and it sent the sms perfectly from the email. I changed strRecipients to my email address and it sent me an email right away after running your test.
I'm wondering if it's the quotation marks that's causing it not to work, I can't think of anyhting else. Thanks for your help and work on this.
نوشته شده در
Advanced Member
Carefree
مطلب: 4224
4224
Try changing strRecipientsName to the phone number. It isn't the quotation marks.
نوشته شده در
Junior Member
Zenfor
مطلب: 372
372
Originally posted by Carefree
Try changing strRecipientsName to the phone number. It isn't the quotation marks.
Another thing, your test script works fine, it will send me an email (no sms) but loginout doesn't send anything even an email when I login or out of chat.
I did change strRecipientsName to "myphonenumber@vtext.com" and it doesn't work.
شما باید یک متن وارد کنید