[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

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


Closed Thread
 
LinkBack Thread Tools
Old 02-21-2007, 10:18 PM   #1 (permalink)
Senior Member
 
Camron's Avatar
 
Join Date: Jan 2006
Location: Portland, Oregon
Posts: 2,059
24.85 NP$ (Donate)

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
__________________
|| 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.
Camron is offline  
Old 02-21-2007, 10:49 PM   #2 (permalink)
cef
NamePros Regular
 
Join Date: May 2004
Location: NYC
Posts: 236
76.50 NP$ (Donate)

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, 10:50 PM   #3 (permalink)
NamePros Legend
 
weblord's Avatar
 
Join Date: Dec 2005
Location: Philippines - www.Nabaza.com
Posts: 19,840
21,700.43 NP$ (Donate)

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/
weblord is offline  
Old 02-21-2007, 11:08 PM   #4 (permalink)
Senior Member
 
Camron's Avatar
 
Join Date: Jan 2006
Location: Portland, Oregon
Posts: 2,059
24.85 NP$ (Donate)

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
Quote:
Originally Posted by cef
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">
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

Quote:
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).
__________________
|| 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.
Camron is offline  
Old 02-21-2007, 11:35 PM   #5 (permalink)
NamePros Regular
 
beaver6813's Avatar
 
Join Date: May 2005
Location: England
Posts: 349
65.50 NP$ (Donate)

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.com V5 Soon!
beaver6813 is offline  
Old 02-21-2007, 11:35 PM   #6 (permalink)
NamePros Legend
 
weblord's Avatar
 
Join Date: Dec 2005
Location: Philippines - www.Nabaza.com
Posts: 19,840
21,700.43 NP$ (Donate)

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/

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
weblord is offline  
Old 02-21-2007, 11:37 PM   #7 (permalink)
Senior Member
 
Camron's Avatar
 
Join Date: Jan 2006
Location: Portland, Oregon
Posts: 2,059
24.85 NP$ (Donate)

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
Quote:
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.

Quote:
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.
__________________
|| 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.
Camron is offline  
Old 02-21-2007, 11:40 PM   #8 (permalink)
NamePros Regular
 
beaver6813's Avatar
 
Join Date: May 2005
Location: England
Posts: 349
65.50 NP$ (Donate)

beaver6813 is a jewel in the roughbeaver6813 is a jewel in the roughbeaver6813 is a jewel in the rough


Quote:
Originally Posted by Camron
Quote:
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.
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.com V5 Soon!
beaver6813 is offline  
Old 02-21-2007, 11:41 PM   #9 (permalink)
Senior Member
 
Camron's Avatar
 
Join Date: Jan 2006
Location: Portland, Oregon
Posts: 2,059
24.85 NP$ (Donate)

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.
__________________
|| 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.
Camron is offline  
Old 02-22-2007, 03:18 AM   #10 (permalink)
NamePros Regular
 
Jim_'s Avatar
 
Join Date: Aug 2005
Posts: 585
285.40 NP$ (Donate)

Jim_ is a name known to allJim_ is a name known to allJim_ is a name known to allJim_ is a name known to allJim_ is a name known to allJim_ is a name known to all

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, 12:33 PM   #11 (permalink)
tm
Senior Member
 
tm's Avatar
 
Join Date: Nov 2005
Location: on a oil rig just off Ireland
Posts: 1,409
374.65 NP$ (Donate)

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, 08:07 PM   #12 (permalink)
cef
NamePros Regular
 
Join Date: May 2004
Location: NYC
Posts: 236
76.50 NP$ (Donate)

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.

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 03:00 PM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85