home *** CD-ROM | disk | FTP | other *** search
/ Image Master / L80.iso / Net / websuite / websuite.exe / CHAT.AP_ / CHAT.AP
Encoding:
Text File  |  1997-12-08  |  3.9 KB  |  133 lines

  1. <[
  2. // Personal World Chat - Main
  3. // (c) 1997 SmartDesk, Inc., All Rights Reserved
  4.  
  5. FUNCTION chatUserCount( websrvr, channel )
  6.  
  7.     local cnt, session
  8.  
  9.     cnt = 0
  10.     session = sessionFindFirst( websrvr )
  11.  
  12.     while ( session )
  13.         if ( sessionDataGet( websrvr, sessionId( session ), "winc_channel" ) == channel )
  14.             if ( ! sessionDataExpired( websrvr, sessionId( session ), "winc_channel", 0 ) )
  15.                 cnt++
  16.             end
  17.         end
  18.         session = sessionFindNext( session )
  19.     end
  20.     
  21.     return( cnt )
  22. END
  23.  
  24. _apGenerate( )
  25.  
  26. websrvr = 0 + param( 1 )
  27. sessionId = 0 + param( 2 )
  28.  
  29. session = new( "session", websrvr, sessionId )
  30.  
  31. name = session.data( "winc_name" )
  32. alias = session.data( "winc_alias" )
  33. email_addr = session.data( "winc_email_addr" )
  34. pword = session.data( "winc_pword" )
  35.  
  36. channel = session.var( "channel" )
  37. if ( channel < 1 )
  38.     channel = 1
  39. end
  40.  
  41. if ( strempty( name ) || strempty( alias ) || strempty( email_addr ) || strempty( pword ) )
  42.     session.data( "winc_reload_channel", channel )
  43.     session._redir( "One Moment Please...", "logon.ap" )
  44.     return( 0 )
  45. end
  46.  
  47. if ( chatUserCount( websrvr, channel ) == 0 )
  48.     // notify the operator that someone has entered the chat room
  49. //    if ( webAddrFromHost( webHostName( ) ) != session.data( "REMOTE_ADDR" ) )
  50.         sndplaywavefile( webServerHome( websrvr ) + "\\chat\\chat.wav" )
  51. //    end
  52. end
  53.  
  54. session.data( "winc_channel", channel )
  55.  
  56. file = fileFixPath( webServerHome( websrvr ) + "\\chat\\chan" + channel + ".cfg" )
  57. if ( ! fileExists( file ) )
  58.     hfile = fcreate( file, 0 )
  59.     if ( hfile > 0 )
  60.         fwriteline( hfile, "[Comments]" )
  61.         fwriteline( hfile, "1=Hello Everybody!" )
  62.         fwriteline( hfile, "2=Greetings All!" )
  63.         fwriteline( hfile, "3=Howdy!" )
  64.         fwriteline( hfile, "4=Cool!" )
  65.         fwriteline( hfile, "5=Way cool!" )
  66.         fwriteline( hfile, "6=Awesome!" )
  67.         fwriteline( hfile, "7=Hmmm..." )
  68.         fwriteline( hfile, "8=Ahhh, yeah..." )
  69.         fwriteline( hfile, "9=Geeze..." )
  70.         fwriteline( hfile, "10=Say what?" )
  71.         fwriteline( hfile, "11=Good-bye" )
  72.         fwriteline( hfile, "12=Later, dude." )
  73.         fwriteline( hfile, "13=Chow, man." )
  74.         fwriteline( hfile, "" )
  75.         fwriteline( hfile, "[Images]" )
  76.         fwriteline( hfile, "1=SmartDesk Logo|/image/sdlogo.gif" )
  77.         fwriteline( hfile, "2=VirtualPROMOTE Logo|/image/vplogo.jpg" )
  78.         fwriteline( hfile, "3=WINC Logo|chathdr.jpg" )
  79.         fwriteline( hfile, "" )
  80.         fwriteline( hfile, "[Links]" )
  81.         fwriteline( hfile, "1=SmartDesk|http://www.smartdesk.com" )
  82.         fwriteline( hfile, "2=VirtualPROMOTE|http://www.virtualpromote.com" )
  83.         fwriteline( hfile, "" )
  84.         fwriteline( hfile, "[Sounds]" )
  85.         fwriteline( hfile, "1=Applause|applause.wav" )
  86.         fwriteline( hfile, "2=Opps|oops.wav" )
  87.         fwriteline( hfile, "" )
  88.         fwriteline( hfile, "[Emoticons]" )
  89.         fwriteline( hfile, "1=:)" )
  90.         fwriteline( hfile, "2=;)" )
  91.         fwriteline( hfile, "3=:-)" )
  92.         fwriteline( hfile, "4=;-)" )
  93.         fwriteline( hfile, "5=:o)" )
  94.         fwriteline( hfile, "6=;o)" )
  95.         fwriteline( hfile, "7=:<)" )
  96.         fwriteline( hfile, "8=:(" )
  97.         fwriteline( hfile, "9=:o" )
  98.         fwriteline( hfile, "10=@#!$%&$#" )
  99.         fwriteline( hfile, "11=!!!!!!!" )
  100.         fwriteline( hfile, "12=???????" )
  101.         fwriteline( hfile, "" )
  102.         fwriteline( hfile, "[Actions]" )
  103.         fwriteline( hfile, "1=User Name" )
  104.         fwriteline( hfile, "2=Alias" )
  105.         fwriteline( hfile, "3=Email Address" )
  106.         fwriteline( hfile, "4=Time Stamp" )
  107.         fwriteline( hfile, "5=Date" )
  108.         fwriteline( hfile, "6=Time" )
  109.         fwriteline( hfile, "" )
  110.  
  111.         fclose( hfile )
  112.     end
  113. end
  114.  
  115. ]>
  116.  
  117. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
  118. <!-- SmartDesk Active Page, www.smartdesk.com -->
  119. <HTML>
  120. <HEAD>
  121. <TITLE>SmartDesk Web Chat</TITLE>
  122. </HEAD>
  123.  <FRAMESET BORDER="0" FRAMEBORDER="no" ROWS="105, *">
  124.   <FRAME NAME="winc_top" SCROLLING="no" NORESIZE SRC="/chat/chat1.ap">
  125.   <FRAME NAME="winc_bottom" NORESIZE SRC="/chat/chatcmd.ap">
  126.  </FRAMESET>
  127.   <BODY>
  128.  <NOFRAMES>
  129.    <H2>The WINC chat program requires frame support</H2>
  130.   </BODY>
  131.  </NOFRAMES> 
  132. </HTML>
  133.