Login | Register | FAQ
Anonymous

Simple Javascript Chat

+ Post a reply

Page 1 of 1


Simple Javascript Chat

by Pixel-Wizard » Mon Mar 04, 2013 6:20 am

Hey togheter

I have a problem. I made the layout for a simple chat, but now I want to make it work. On the following website is my actual stand: simplechat.comxa.com

If i write a message, nobody can see it except me. What have I to do, if I like to make my posts visible, or better, to make everyones posts visible to each other?

And please don't report me bugs, I know there is still a lot to do. I just want the answer to this question!

Thank you!
Pixel-Wizard
User avatar

Pixel-Wizard

  • Posts: 4
  • Joined: Mon Jan 21, 2013 7:31 pm

Re: Simple Javascript Chat

by XainPro » Mon Mar 04, 2013 3:37 pm

when you submit chat msg
save this message into a txt file
and when page load read that file and echo its content simple

Code: Select all

    <?php
    if( !empty($_POST['clear'])){
       $my_file = 'file.txt';
       if(is_file($my_file)){
    unlink($my_file);
       }
    }
    if( !empty($_POST['chat'])){
    $newData = $_POST['chat'];
    $newData .= "<br>";
    $my_file = 'file.txt';
    $handle = fopen($my_file, 'a+') or die('Cannot open file:  '.$my_file);
    $data = fwrite($handle,$newData);
    }
    ?>
    <!DOCTYPE html>
    <html lang="en">
    <head>
       <meta charset="utf-8">
       <title>FlemChat</title>
       <link rel="stylesheet" href="main.css" type="text/css"/>
       <script src="chat.js"></script>
    </head>
    <body>

       <form id="form1" method="post" action="">
             <textarea id="area2" rows="10" name="chat" cols="50" placeholder="Type here..."></textarea>
             <br>
             <input type="submit" id="button" value="Speak">
       </form>
       <form id="form1" method="post" action="">
             <input type="submit" name="clear" id="button" value="Clear">
       </form>
       <hr>
    <h2>Message:</h2>
    <?php

    $my_file = 'file.txt';
    if(is_file($my_file)){
    $handle = fopen($my_file, 'r') or die('Cannot open file:  '.$my_file);
    $data = fread($handle,filesize($my_file));

    echo nl2br($data);
    }
    ?>
    <hr>
    </body>
    </html>



save this code as filename.php
and enjoy !
User avatar

XainPro

  • Posts: 2401
  • Joined: Fri Feb 17, 2012 8:10 pm

Re: Simple Javascript Chat

by Pixel-Wizard » Mon Mar 04, 2013 5:10 pm

First of all, thank you for your reply.

But isn't that possible with pure JavaScript? If not, is it possible to make a Chat with AJAX?
User avatar

Pixel-Wizard

  • Posts: 4
  • Joined: Mon Jan 21, 2013 7:31 pm

Re: Simple Javascript Chat

by XainPro » Tue Mar 05, 2013 11:52 am

you are right its not possible with only javascript but yes it is possible with AJAX :)
User avatar

XainPro

  • Posts: 2401
  • Joined: Fri Feb 17, 2012 8:10 pm

Re: Simple Javascript Chat

by muratsal » Tue Mar 05, 2013 7:05 pm

there is javascript service https://www.firebase.com/
No need server side scripting.
User avatar

muratsal

  • Posts: 48
  • Joined: Wed Oct 17, 2012 12:51 pm
--
my map applications http://haritaaraci.com/

Re: Simple Javascript Chat

by XainPro » Wed Mar 06, 2013 7:00 am

muratsal
is is no chat service and they are providing service infact they are working server side totally unrelated link to this topic.
User avatar

XainPro

  • Posts: 2401
  • Joined: Fri Feb 17, 2012 8:10 pm

h68iql6s

by GeorgeHarPeale » Sun Aug 27, 2017 6:58 pm

https://www.flickr.com/groups/3532655@N ... 289469701/
https://www.flickr.com/groups/3934138@N ... 635768054/

This driver Mac HP Scan supports : TIFF, PNG, JPEG, JPEG 2000, PDF, HP Scanning Software (includes OCR); HP Scanjet Software (includes OCR); ArcSoft PhotoStudio v6 (Mac); ReadIris OCR.
https://www.flickr.com/groups/3944416@N ... 718631043/
https://bitbucket.org/snippets/gregorio ... w0/AArzB7/

Company website; Software available. Easy & Free Download Pixma E510 Driver for Windows 8.1, Windows 8, Windows 7, Windows Vista, Windows Xp, Mac Os The Canon Pixma E510 All-in-one printer is a multifunctional colour inkjet printer that is also endowed with copy and scan functionalities.
https://bitbucket.org/snippets/sandysdg1967k3/R8Arp5/
https://bitbucket.org/snippets/juliusuck1965a6/9qnXkg/

Additional Repair Word file (2013, 2010, 2007 & lower) with Stellar Phoenix Word repair software. Watch Grammarly in Action. Fast downloads of the latest free software!
http://michale.icyboards.net/showthread ... 46#pid1246
http://www.bullypedia.net/forums/showth ... 29#pid1229
http://bpmusic.kwaoo.me/viewtopic.php?f ... 8685#p8685
http://umnikizdes.ru/topic579396.html
http://forum.charm-lady.club/viewtopic. ... 9663#p9663

http://google.com/q=hj2911ej
User avatar

GeorgeHarPeale

  • Posts: 1820
  • Joined: Mon Jul 10, 2017 5:19 pm
  • Location: Iceland

p6zl3jfk

by GeorgeHarPeale » Wed Aug 30, 2017 4:00 pm

https://bitbucket.org/snippets/orlandomye1970y6/BBr5ME/
https://bitbucket.org/snippets/montykgi1978w7/nR7pB6/

Advertisement Kaspersky Anti-Virus 7.0: Kaspersky Anti-Virus Windows 7.
https://www.flickr.com/groups/3566825@N ... 294368551/
https://www.flickr.com/groups/3930815@N ... 853158863/

There's even the option to download a portable version so you can run it from a memory stick without installing. Download the free Optimum App Search the program guide.
https://www.flickr.com/groups/3974869@N ... 147080155/
https://www.flickr.com/groups/3601137@N ... 308051371/

Jun 16, 2014 Hyper-V Enabled; File Server Resource Management is Enabled Symantec Endpoint Protection Manager's - Virus and Spyware .. 10. Feb 23, 2016 You control the File Classification Infrastructure through the File Server Resource The new Enterprise Vault Authorization Manager replaces Windows Exchange Server 2016; Outlook 2016 Windows; Outlook 2016 for Mac; Windows 10 Updates the specified settings of an existing file server volume. Windows 10, Windows 7, Windows XP & 2000.
http://le8uzz.zzz.com.ua/viewtopic.php?pid=74486#p74486
http://ukrbeekeeper.com/newforum/viewto ... 286#p15286
http://gamers-loft.com/showthread.php?1 ... post294444
http://navolodarke.ru/viewtopic.php?f=9 ... 3551#p3551
http://forum.hotenglish.com.br/index.ph ... w.html#new

http://google.com/q=8zhfe826
User avatar

GeorgeHarPeale

  • Posts: 1820
  • Joined: Mon Jul 10, 2017 5:19 pm
  • Location: Iceland


+ Post a reply

Page 1 of 1