Alright i made a php shout box but now i want to make it so it refreshes but only way i can think of it without messing up the text box everytime someone tries typing.. i want it to refresh every 15 seconds..... and only way i know how to do that is to put the shout box into a frame and the text boxes out of the frame unless someone else knows different.. and plus i want to make it where when they login to my site it logs them into the shout box so they dont have to keep typing there username and stuff can someone help me with this please... and i was just wondering if someone could show me how to make it where when a users logs online it takes them from a offline table to an online table or something like that so i can make it where it says which users are online............
Thank you
Raven-Flock
here are the scripts...(Didnt want to feel this place up alot)
http://www45.brinkster.com/shoutbox2032/login.html
http://www45.brinkster.com/shoutbox2032/shout.html[/url]
PHP Shoutbox help
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
-
Raven-flock
- Forum Newbie
- Posts: 24
- Joined: Tue Apr 12, 2005 2:02 pm
...
Ok, the problem for me is - that I didn't "quite" understood what you need, but here is the solution for what I understood ( my version
)
If you need to preserve everything ( this shout-box ) - sorry I don't know the exact translation - not native english speaker, use JavaScript, and PHP/MySQL in this way:
Put the text-area or a form element in the page - that will not change, use frame or iframe and refresh it in the desired interval ( or maybe on user submit - when he/she enters some text in the field )
Use JavaScript code in the main page to:
- Start the timer,
- When it ticks 15 sec's or the button is clicked
- Submit the frame or iframe I mentioned
- And when it loads retreive the data from it.
- And then just ADD data(records) to the text-area or text-box
This requires PHP/MySQL - server counterpart:
You can use 2 ways to transfer data - GET, POST - I recommend POST - create little form in the frame/iframe, submit it and let PHP process the data.
When processed they must be stored in a manner that JavaScript can use them later - easiest: blank page with one form and one textfield, and every new record in that field, comma ( or some special sign ) delimited. JavaScript can easily refference it.
In JavaScript use "location.replace", not "location.href" for submiting the frame/iframe - so when user clicks BACK button, it gets the page it was before, not reload the frame/iframe.
Hope this helps.
If you need to preserve everything ( this shout-box ) - sorry I don't know the exact translation - not native english speaker, use JavaScript, and PHP/MySQL in this way:
Put the text-area or a form element in the page - that will not change, use frame or iframe and refresh it in the desired interval ( or maybe on user submit - when he/she enters some text in the field )
Use JavaScript code in the main page to:
- Start the timer,
- When it ticks 15 sec's or the button is clicked
- Submit the frame or iframe I mentioned
- And when it loads retreive the data from it.
- And then just ADD data(records) to the text-area or text-box
This requires PHP/MySQL - server counterpart:
You can use 2 ways to transfer data - GET, POST - I recommend POST - create little form in the frame/iframe, submit it and let PHP process the data.
When processed they must be stored in a manner that JavaScript can use them later - easiest: blank page with one form and one textfield, and every new record in that field, comma ( or some special sign ) delimited. JavaScript can easily refference it.
In JavaScript use "location.replace", not "location.href" for submiting the frame/iframe - so when user clicks BACK button, it gets the page it was before, not reload the frame/iframe.
Hope this helps.
-
Raven-flock
- Forum Newbie
- Posts: 24
- Joined: Tue Apr 12, 2005 2:02 pm
- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
make a table with 2 cells
in the cell you want to be your iframe(were you show your messages)
in show_messages.php have a meta refresh set for 15 seconds so the show_messages.php will automatically refresh itself inside the iframe.
then on the other cell of your table have the html form where you can do the remember me option, the username, and the message, and whatnot.
as for the login part have where it logs into the shotbox
is that the answers you needed?
in the cell you want to be your iframe(were you show your messages)
Code: Select all
<iframe name='frameA' width='100%' height='100%' src='show_messages.php'></iframe>then on the other cell of your table have the html form where you can do the remember me option, the username, and the message, and whatnot.
as for the login part have where it logs into the shotbox
Code: Select all
if (isset($_SESSION['logedIn']))
{
//make the user able to type into the shoutbox
}
else
{
//show login screen and make sure after the user logs in to set a session
}-
Raven-flock
- Forum Newbie
- Posts: 24
- Joined: Tue Apr 12, 2005 2:02 pm