login  Naam:   Wachtwoord: 
Registreer je!
 Scripts:

Scripts > ASP > Fora/Discussieborden > ASP Chatroom

ASP Chatroom

Auteur: tomk - 19 november 2004 - 16:01 - Gekeurd door: Dennisvb - Hits: 4003 - Aantal punten: 3.25 (6 stemmen)




Gewoon alles uploaden een een paar afbeeldingen maken :-). Die namen van de afbeeldingen kan je zien door er in de chatroom rechtermuisknop en dan eigeschappen dan staat er de naam. Je maak de afbeeldingen die je nodig hebt. Die plaats je in de map images. Je kan de naam veranderen in chat.asp (
  1. <%
  2. '----------------setup------------------
  3. title="Chatroom" 'title of web page
  4. '----------------/setup------------------

Als er vragen zijn moet je het maar effe pm naar mij.

Code:
  1. +++default.asp+++( kan er ook index.asp van maken naar jou keuze )
  2. <%
  3. if Request.Cookies("emchatrefresh")="" then response.Cookies("emchatrefresh")="15"
  4.  
  5. %>
  6. <body bgcolor="#FFFFFF" topmargin="5"><center>
  7. <font face='verdana,arial' size='2'>Type nickname
  8. <form action='chat.asp?event=login' method='post'>
  9. <input type='text' name='login' size='10'>
  10. <input type='submit' value='Enter'>
  11. <%if request("error")=1 then response.write "<br><br><font color='red'>Nick "& request("username") &" is used!</font>"%>
  12. </form>
  13. <hr size='1'>
  14. +++chat.asp+++
  15. <%
  16. '----------------setup------------------
  17. title="Chatroom" 'title of web page
  18. '----------------/setup------------------
  19.  
  20.  
  21. if request("event")="login" then
  22.  
  23. if (InStr(application("emchatusers"), ","& request("login") &",")<>0) then response.redirect("default.asp?error=1&username=" & request("login"))
  24. Response.Cookies("emchatlogin")=request("login")
  25. application("emchatusers") = application("emchatusers") & request("login") &"," & minute(now) & ","
  26.  
  27. Application(20)=Application(19)
  28. Application(19)=Application(18)
  29. Application(18)=Application(17)
  30. Application(17)=Application(16)
  31. Application(16)=Application(15)
  32. Application(15)=Application(14)
  33. Application(14)=Application(13)
  34. Application(13)=Application(12)
  35. Application(12)=Application(11)
  36. Application(11)=Application(10)
  37. Application(10)=Application(9)
  38. Application(9)=Application(8)
  39. Application(8)=Application(7)
  40. Application(7)=Application(6)
  41. Application(6)=Application(5)
  42. Application(5)=Application(4)
  43. Application(4)=Application(3)
  44. Application(3)=Application(2)
  45. Application(2)=Application(1)
  46.  
  47. Application("1")="<font color='green'><b>"& request.Cookies("emchatlogin") & "</b> enters chatroom</font>"
  48. Response.Redirect "chat.asp"
  49. end if
  50.  
  51. if request.Cookies("emchatlogin")="" then Response.Redirect"default.asp"
  52. if mid(request.Cookies("emchatlogin"),1,1)=" " then Response.Redirect"default.asp"
  53.  
  54.  
  55. if request("event")="post" then
  56.  
  57. Application(20)=Application(19)
  58. Application(19)=Application(18)
  59. Application(18)=Application(17)
  60. Application(17)=Application(16)
  61. Application(16)=Application(15)
  62. Application(15)=Application(14)
  63. Application(14)=Application(13)
  64. Application(13)=Application(12)
  65. Application(12)=Application(11)
  66. Application(11)=Application(10)
  67. Application(10)=Application(9)
  68. Application(9)=Application(8)
  69. Application(8)=Application(7)
  70. Application(7)=Application(6)
  71. Application(6)=Application(5)
  72. Application(5)=Application(4)
  73. Application(4)=Application(3)
  74. Application(3)=Application(2)
  75. Application(2)=Application(1)
  76.  
  77. Application("1")="<b>" & request.Cookies("emchatlogin") & ":</b>"& request("text")
  78. Response.Redirect "chat.asp?event=form"
  79. end if
  80.  
  81. if request("event")="logout" then
  82. Application(20)=Application(19)
  83. Application(19)=Application(18)
  84. Application(18)=Application(17)
  85. Application(17)=Application(16)
  86. Application(16)=Application(15)
  87. Application(15)=Application(14)
  88. Application(14)=Application(13)
  89. Application(13)=Application(12)
  90. Application(12)=Application(11)
  91. Application(11)=Application(10)
  92. Application(10)=Application(9)
  93. Application(9)=Application(8)
  94. Application(8)=Application(7)
  95. Application(7)=Application(6)
  96. Application(6)=Application(5)
  97. Application(5)=Application(4)
  98. Application(4)=Application(3)
  99. Application(3)=Application(2)
  100. Application(2)=Application(1)
  101.  
  102. Application("1")="<font color='green'><b>"& request.Cookies("emchatlogin") & "</b> leaves chatroom</font>"
  103.  
  104.  
  105. userarray=split(application("emchatusers"),",")
  106. userscount=int(((UBound(userarray)+1))-0.5)
  107. for f = 0 to userscount-1 step 2
  108. if userarray(f)=request.Cookies("emchatlogin") then
  109. reptmp=userarray(f) & "," & userarray(f+1) &","
  110. application("emchatusers") = replace(application("emchatusers"),reptmp,"")
  111. end if
  112. next
  113.  
  114.  
  115.  
  116. Response.Cookies("emchatlogin")=""
  117. Response.Redirect"default.asp"
  118.  
  119. end if
  120.  
  121. if request("event")="form" then
  122. %>
  123.  
  124. <body bgcolor="#FFCC99" topmargin="5">
  125. <table border="0" width="100%" cellspacing="0" cellpadding="0">
  126. <tr>
  127. <td>
  128. <form action='chat.asp?event=post' method='post' name='chatform'>
  129. <input type='text' name='text' size='50'>
  130. <input type="image" src="images/post.gif" width="84" height="18" border="0">
  131. </td>
  132. <td width="120">
  133. <a href="chat.asp?event=setup" target="_top"><p align="right"><img border="0" src="images/setup.gif" width="44" height="18" ><a href="chat.asp?event=logout" target="_top"></a>
  134. <img border="0" src="images/exit.gif" width="44" height="18"></a>
  135. </td>
  136. </tr>
  137. </table>
  138. </form>
  139.  
  140.  
  141. <script language="VBScript">
  142. Sub Window_onLoad
  143. chatform.text.focus
  144. End Sub
  145. </script>
  146. <%
  147. end if
  148.  
  149.  
  150. if request("event")="show" then
  151. Response.Write "<meta http-equiv='refresh' content='" & request.Cookies("emchatrefresh") &"'>"
  152. Response.Write "<body bgcolor='#ECE4B0'>"
  153. Response.Write "<font face='arial,verdana' size='2'>"
  154. for f=1 to 20
  155. Response.Write Application(f) & "<br>"
  156.  
  157. userarray=split(application("emchatusers"),",")
  158. userscount=int(((UBound(userarray)+1))-0.5)
  159.  
  160.  
  161. for f = 0 to userscount-1 step 2
  162. if abs(minute(now)-int(userarray(f+1))) > 2 then
  163. application("emchatusers")=replace(application("emchatusers"),userarray(f) & "," & userarray(f+1) & ",","")
  164. end if
  165. if userarray(f)=request("userrefresh") then
  166. reptmp=userarray(f) & "," & userarray(f+1) &","
  167. application("emchatusers") = replace(application("emchatusers"),reptmp,userarray(f) & "," & minute(now) &",")
  168. end if
  169. end if
  170.  
  171.  
  172. if request("event")="listusers" then
  173. Response.Write "<meta http-equiv='refresh' content='30'>"
  174. Response.Write "<body bgcolor='#FFCC99'>"
  175. Response.Write "<font face='arial,verdana' size='2'>"
  176. userarray=split(application("emchatusers"),",")
  177. userscount=int(((UBound(userarray)+1))-0.5)
  178. for f = 0 to userscount-1 step 2
  179. response.write userarray(f) & "<br>"
  180. end if
  181.  
  182.  
  183. if request("event")="" then
  184. if request.Cookies("barpos")="" then
  185. %>
  186. <title><%=title%></title>
  187. <frameset rows="37,*" frameborder="0">
  188. <frame name="header" scrolling="no" noresize target="main" src="chat.asp?event=form">
  189. <frameset cols="*,130">
  190. <frame name="main" target="main" scrolling="auto" noresize src="chat.asp?event=show&userrefresh=<%=request.Cookies("emchatlogin")%>">
  191. <frame name="main" scrolling="auto" noresize src="chat.asp?event=listusers" target="main">
  192. </frameset>
  193. <noframes>
  194. <body>
  195.  
  196. <p>This page uses frames, but your browser doesn't support them.</p>
  197.  
  198. </body>
  199. </noframes>
  200. </frameset>
  201. <%
  202. end if
  203.  
  204.  
  205.  
  206. if request.Cookies("barpos")="1" then
  207. %>
  208. <frameset rows="*,37" frameborder="0">
  209. <frameset cols="*,130">
  210. <frame name="contents" target="main" scrolling="auto" src="chat.asp?event=show&userrefresh=<%=request.Cookies("emchatlogin")%>">
  211. <frame name="main" scrolling="auto" src="chat.asp?event=listusers">
  212. </frameset>
  213. <frame name="bottom" scrolling="no" noresize target="contents" src="chat.asp?event=form">
  214. <noframes>
  215. <body>
  216.  
  217. <p>This page uses frames, but your browser doesn't support them.</p>
  218.  
  219. </body>
  220. </noframes>
  221. </frameset>
  222. <%
  223. end if
  224.  
  225. end if
  226.  
  227.  
  228.  
  229.  
  230. if request("event")="refresh" then
  231. Response.Cookies("emchatrefresh")=request("refresh")
  232. Response.Redirect"chat.asp"
  233. end if
  234.  
  235. if request("event")="aptop" then
  236. Response.Cookies("barpos")=""
  237. Response.Redirect"chat.asp"
  238. end if
  239.  
  240. if request("event")="aptop1" then
  241. Response.Cookies("barpos")="1"
  242. Response.Redirect"chat.asp"
  243. end if
  244.  
  245.  
  246. if request("event")="setup" then
  247. %>
  248.  
  249. <body bgcolor="#FFCC99">
  250.  
  251. <b><font face="Arial" size="4">Appearance</font></b>
  252. <hr noshade>
  253. <p align="center"><a href='chat.asp?event=aptop'><img border="0" src="images/bartopico.gif" width="50" height="38"></a>
  254. &nbsp;
  255. <a href='chat.asp?event=aptop1'><img border="0" src="images/bardownico.gif" width="50" height="38"></a></p>
  256. <b><font face="Arial" size="4">Refresh</font></b>
  257. <hr noshade>
  258. <center>
  259. <form action='chat.asp?event=refresh' method='post'>
  260. <select size="1" name='refresh'>
  261. <option <%if request.Cookies("emchatrefresh")="5" then Response.Write "selected"%>>5</option>
  262. <option <%if request.Cookies("emchatrefresh")="10" then Response.Write "selected"%>>10</option>
  263. <option <%if request.Cookies("emchatrefresh")="15" then Response.Write "selected"%>>15</option>
  264. <option <%if request.Cookies("emchatrefresh")="20" then Response.Write "selected"%>>20</option>
  265. <option <%if request.Cookies("emchatrefresh")="30" then Response.Write "selected"%>>30</option>
  266. <option <%if request.Cookies("emchatrefresh")="60" then Response.Write "selected"%>>60</option>
  267. </select>
  268. <input type='submit' value='Set refresh (sec.)'>
  269. </form>
  270.  
  271.  
  272.  
  273. <%
  274. end if
  275.  
  276.  
  277.  
  278.  
  279. %>
  280. +++clear.asp+++
  281. <%
  282. 'clear users and chat data
  283.  
  284. application("emchatusers") = ""
  285. for f=1 to 20
  286. Application(f)=""
  287. next
  288.  
  289. %>
Download code! Download code (.txt)

 Stemmen
Niet ingelogd.

 Reacties
Post een reactie
Lees de reacties (3)
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.048s