| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Senior Member | Update included files without refresh Hello, I was wondering if it's possible to update a included file every 1-5 seconds without actually refreshing the entire thing. I am developing a simple chat script, which needs to update the file which contains the chat text (will be flat file). The frame needs to update to the latest text file so that all parties can see what has been stored. I googled around but could not come up with anything that would help me (I tried many possibilities). I am assuming I would need to use javascript, in which case I am no javascript guru, so if someone could kindly let me know how this would be done, it would be greatly appreciated. Thanks, Camron
__________________ || VPSByte Virtual & Dedicated Solutions || True 24/7/365 support with a 1 hour guaranteed response time! || We offer budget, yet powerful dedicated servers and vps solutions. || All servers come w/ 10Mbps unmetered bandwidth & lite management standard. |
| |
| | #2 (permalink) |
| NamePros Regular | Add a refresh header to the html code of the frame you want refreshed. For example, if you want the frame containing the chat text to refresh every five seconds, put this in the header section of the frame's html file: Code: <META HTTP-EQUIV="Refresh" CONTENT="5; URL=http://this/file/name"> |
| |
| | #3 (permalink) |
| NamePros Legend | have you tried this one? though it uses mysql http://ajaxchat.org/ |
| |
| | #4 (permalink) | ||
| Senior Member | Quote:
![]() Quote:
__________________ || VPSByte Virtual & Dedicated Solutions || True 24/7/365 support with a 1 hour guaranteed response time! || We offer budget, yet powerful dedicated servers and vps solutions. || All servers come w/ 10Mbps unmetered bandwidth & lite management standard. | ||
| |
| | #5 (permalink) |
| NamePros Regular | Presuming you have some experience in coding i would reccomend ajax for this, so basically it will update a DIV every x seconds. This can be achived the most easily using a library like Prototype, and using the PeriodicalUpdater function. Prototype:http://www.prototypejs.org/ http://www.prototypejs.org/api/ajax click Periodical Updater on the side, so as i said it will get the info from a file every x amount of seconds and put that into the div.
__________________ -Beaver6813.com V5 Soon! |
| |
| | #6 (permalink) |
| NamePros Legend | now i see the purpose, why host it on your server when you can do remote hosting? and besides if server is down, you can't use it at all for support. have you tried the possibilities of this? http://www.kayako.com/ http://humanclick.com/ < - the server is you, the client is downloaded by your client http://www.providesupport.com/ http://www.zazachat.com/ it will not consume your bandwidth and will not be treated as ddos since they refresh a lot. or free http://www.livehelpengine.com/ HTH |
| |
| | #7 (permalink) | ||
| Senior Member | Quote:
Quote:
__________________ || VPSByte Virtual & Dedicated Solutions || True 24/7/365 support with a 1 hour guaranteed response time! || We offer budget, yet powerful dedicated servers and vps solutions. || All servers come w/ 10Mbps unmetered bandwidth & lite management standard. | ||
| |
| | #8 (permalink) | ||
| NamePros Regular | Quote:
__________________ -Beaver6813.com V5 Soon! | ||
| |
| | #9 (permalink) |
| Senior Member | True, actually looking at Prototype, it looks like it actually has to be installed on the server before use. I was actually looking for something stand-alone.
__________________ || VPSByte Virtual & Dedicated Solutions || True 24/7/365 support with a 1 hour guaranteed response time! || We offer budget, yet powerful dedicated servers and vps solutions. || All servers come w/ 10Mbps unmetered bandwidth & lite management standard. |
| |
| | #10 (permalink) |
| NamePros Regular | lol. Prototype does not need to be installed on the server. It is just plain JavaScript source code. You just have to load it in your browser like this: Code: <script src="prototype.js" type="text/javascript"></script>
__________________ ask me about the internet |
| |
| | #11 (permalink) |
| Senior Member | Definately an Ajax thing you need... this can't be achieved purely in PHP.
__________________ You design in photoshop, I code into valid XHTML/CSS. Professional PSD, PNG or HTML to tableless XHTML/CSS designs. For more info, send me a PM. |
| |
| | #12 (permalink) |
| NamePros Regular | Just so you know, whether you use ajax or a refresh header, it's the same to your server: an http request. As such, it could be interpreted as a ddos either way. Ajax does it behind the scenes so that your page doesn't flicker on update. As you hinted in your first post, you're already using frames (at least it sounds like you are), which has the same visual result for the user: no flicker on update, because only the data in a frame is being refreshed. That said, ajax is the "more modern" way of doing things, and because you want to market the script, is a more apporpriate implementation. Bottom line though, your code has to call some server somewhere via http. If you want the calls to avoid being treated as a ddos attack, you have a few choices, each with some pros and cons. For example, you could have apache (or better yet, lighttpd) listen on an alternative port, and configure the listener to ONLY serve the chat text. You would then whitelist that server and port with your firewall and/or datacenter and/or whomever monitors these things. If someone really does try to ddos that particular port and server, you could simply nullroute the requests, a step you would ultimately have to take anyhow. The downside to this is that it would require communications on a non-standard port, which means opening the port everywhere on your firewall chain (at least for the relevant IP) and requiring the same of your clients, which is, to me, something of a dealbreaker. So...no easy solution I'm afraid, but at least you have some more info to work with. |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |