NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Update included files without refresh

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 02-21-2007, 11:18 PM THREAD STARTER               #1 (permalink)
Senior Member
 
Camron's Avatar
Join Date: Jan 2006
Location: Portland, Oregon
Posts: 2,102
Camron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud of
 



VA Tech Memorial 9/11/01 :: Never Forget Cancer Survivorship Child Abuse

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
__________________
HostingFuze.com Premium Master Reseller Services | 99.9% Uptime Guaranteed SLA | Starting at $4.95/mo
Basic Reseller Hosting @ HostFz.com - Services starting as low as $1.95/mo!
Camron is offline  
Old 02-21-2007, 11:49 PM   #2 (permalink)
cef
NamePros Regular
Join Date: May 2004
Location: NYC
Posts: 236
cef is a jewel in the roughcef is a jewel in the roughcef is a jewel in the rough
 


Animal Rescue
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">
cef is offline  
Old 02-21-2007, 11:50 PM   #3 (permalink)
NamePros Legend
 
weblord's Avatar
Join Date: Dec 2005
Location: Philippines - www.Nabaza.com
Posts: 19,785
weblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatness
 


Autism Protect Our Planet
have you tried this one? though it uses mysql
http://ajaxchat.org/
__________________
Nabaza.com - Amaia
weblord is offline  
Old 02-22-2007, 12:08 AM THREAD STARTER               #4 (permalink)
Senior Member
 
Camron's Avatar
Join Date: Jan 2006
Location: Portland, Oregon
Posts: 2,102
Camron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud of
 



VA Tech Memorial 9/11/01 :: Never Forget Cancer Survivorship Child Abuse
Originally Posted by cef
Add a refresh header to the html code of the frame you want refreshed.
????: NamePros.com http://www.namepros.com/programming/297197-update-included-files-without-refresh.html

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">
Actually, this is exactly not what I am looking for. I'm looking for something that is actually not refreshing rather than re-loading the include, because if I were to refresh that much my server would detect it as DDoS

Originally Posted by weblord
have you tried this one? though it uses mysql
http://ajaxchat.org/
I need to create my own because there are some features that I must have (this will be used as a live support system rather than an open public chatroom).
__________________
HostingFuze.com Premium Master Reseller Services | 99.9% Uptime Guaranteed SLA | Starting at $4.95/mo
Basic Reseller Hosting @ HostFz.com - Services starting as low as $1.95/mo!
Camron is offline  
Old 02-22-2007, 12:35 AM   #5 (permalink)
NamePros Regular
 
beaver6813's Avatar
Join Date: May 2005
Location: England
Posts: 392
beaver6813 is a jewel in the roughbeaver6813 is a jewel in the roughbeaver6813 is a jewel in the rough
 




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 is offline  
Old 02-22-2007, 12:35 AM   #6 (permalink)
NamePros Legend
 
weblord's Avatar
Join Date: Dec 2005
Location: Philippines - www.Nabaza.com
Posts: 19,785
weblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatness
 


Autism Protect Our Planet
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/
????: NamePros.com http://www.namepros.com/showthread.php?t=297197

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
__________________
Nabaza.com - Amaia
weblord is offline  
Old 02-22-2007, 12:37 AM THREAD STARTER               #7 (permalink)
Senior Member
 
Camron's Avatar
Join Date: Jan 2006
Location: Portland, Oregon
Posts: 2,102
Camron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud of
 



VA Tech Memorial 9/11/01 :: Never Forget Cancer Survivorship Child Abuse
Originally Posted by weblord
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.
Thanks, but I am actually looking to use this script to sell as well as use it, plus I will be able to customize it in many ways.

Originally Posted by beaver6813
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.
Looks interesting. Thanks for the link, I will check that out.
__________________
HostingFuze.com Premium Master Reseller Services | 99.9% Uptime Guaranteed SLA | Starting at $4.95/mo
Basic Reseller Hosting @ HostFz.com - Services starting as low as $1.95/mo!
Camron is offline  
Old 02-22-2007, 12:40 AM   #8 (permalink)
NamePros Regular
 
beaver6813's Avatar
Join Date: May 2005
Location: England
Posts: 392
beaver6813 is a jewel in the roughbeaver6813 is a jewel in the roughbeaver6813 is a jewel in the rough
 




Originally Posted by Camron
Originally Posted by weblord
now i see the purpose, why host it on your server when you can do remote hosting?
????: NamePros.com http://www.namepros.com/showthread.php?t=297197
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.
Thanks, but I am actually looking to use this script to sell as well as use it, plus I will be able to customize it in many ways.
You should be able to sell the script with Prototype as long as you give the appropriate credit in the source files where it's used.
beaver6813 is offline  
Old 02-22-2007, 12:41 AM THREAD STARTER               #9 (permalink)
Senior Member
 
Camron's Avatar
Join Date: Jan 2006
Location: Portland, Oregon
Posts: 2,102
Camron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud of
 



VA Tech Memorial 9/11/01 :: Never Forget Cancer Survivorship Child Abuse
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.
__________________
HostingFuze.com Premium Master Reseller Services | 99.9% Uptime Guaranteed SLA | Starting at $4.95/mo
Basic Reseller Hosting @ HostFz.com - Services starting as low as $1.95/mo!
Camron is offline  
Old 02-22-2007, 04:18 AM   #10 (permalink)
NamePros Regular
 
Jim_'s Avatar
Join Date: Aug 2005
Location: NY, USA
Posts: 610
Jim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to behold
 


Save The Children
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>
and then you're set to use it's methods in your JavaScript.
__________________
ask me about the internet
Jim_ is offline  
Old 02-22-2007, 01:33 PM   #11 (permalink)
tm
Senior Member
 
tm's Avatar
Join Date: Nov 2005
Location: on a oil rig just off Ireland
Posts: 1,408
tm is a glorious beacon of lighttm is a glorious beacon of lighttm is a glorious beacon of lighttm is a glorious beacon of lighttm is a glorious beacon of light
 



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.
tm is offline  
Old 02-22-2007, 09:07 PM   #12 (permalink)
cef
NamePros Regular
Join Date: May 2004
Location: NYC
Posts: 236
cef is a jewel in the roughcef is a jewel in the roughcef is a jewel in the rough
 


Animal Rescue
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.
????: NamePros.com http://www.namepros.com/showthread.php?t=297197

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.
cef is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 06:44 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger