php-general Digest 9 Dec 2007 10:26:42 -0000 Issue 5171

Topics (messages 265583 through 265589):

Re: build a multi chat server with php
        265583 by: Robert Cummings
        265584 by: Robert Cummings
        265585 by: Nathan Rixham
        265586 by: Børge Holen
        265589 by: abderrazzak nejeoui

Incorporating a PHP/MySQL based search
        265587 by: Steve Finkelstein
        265588 by: Cesar D. Rodas

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
On Sat, 2007-12-08 at 16:46 +0000, Nathan Rixham wrote:
> 1 - yes you can make a multichat daemon in php
> 2 - if you don't know that it's possible or where to begin, then odds 
> are you won't be able to make it.

That's what the list is for... to help him find his way.

> abderrazzak nejeoui wrote:
> > Hello,
> > i want build a multi chat server based in php.
> > 1- is that possible
> > 2- if yes can you instruct me how to bigin
> > thanks

There are two approaches. You either are looking to do it as a
standalone application outside of the web environment, or you are
looking to do it via the web environment using some combination of
backend PHP and front end browser refreshes (not recommended) or AJAX.
A simple scenario for the web version follows:

    1. User logs in (or implicitly is logged in anonymously)
    2. User sees any ongoing discussion for X amount of previous time
    3. User can post a form to the website (or post data via AJAX)
       which effectively is the user's message to the chat server
    4. Message is save to database with ID/timestamp
    5. Browser refreshes or AJAX retrieves messages greater than
       user's session message ID
    6. Return to step 1.

The session is responsible for tracking the last message ID retrieved by
the user. This could also be facilitated by the browser, but it will
almost certainly be problematic. Additionally, but having it in the
session you ensure the user can't arbitrarily jump back in time (this
may be a privacy issue if chat users only expect those logged in to ever
see their messages). Additionally when saving messages or viewing
messages you may want to track a group ID that refers to the chat forum
in which the messages are being posted/retrieved. In this way you can
have multiple chat rooms.

This should get you started or asking questions more to the point.

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

--- End Message ---
--- Begin Message ---
On Sat, 2007-12-08 at 12:19 -0500, Robert Cummings wrote:
> On Sat, 2007-12-08 at 16:46 +0000, Nathan Rixham wrote:
> > 1 - yes you can make a multichat daemon in php
> > 2 - if you don't know that it's possible or where to begin, then odds 
> > are you won't be able to make it.
> 
> That's what the list is for... to help him find his way.
> 
> > abderrazzak nejeoui wrote:
> > > Hello,
> > > i want build a multi chat server based in php.
> > > 1- is that possible
> > > 2- if yes can you instruct me how to bigin
> > > thanks
> 
> There are two approaches. You either are looking to do it as a
> standalone application outside of the web environment, or you are
> looking to do it via the web environment using some combination of
> backend PHP and front end browser refreshes (not recommended) or AJAX.
> A simple scenario for the web version follows:
> 
>     1. User logs in (or implicitly is logged in anonymously)
>     2. User sees any ongoing discussion for X amount of previous time
>     3. User can post a form to the website (or post data via AJAX)
>        which effectively is the user's message to the chat server
>     4. Message is save to database with ID/timestamp
>     5. Browser refreshes or AJAX retrieves messages greater than
>        user's session message ID
>     6. Return to step 1.

Should have been:

    6. Return to step 3.

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

--- End Message ---
--- Begin Message ---
Robert, Abderrazzak,

You make some good points, and apologies abderrazzak; I woke under stress and haven't been the friendliest today!

The Ajax method is definately a good approach, particulary if you're wanting to have the chat client within a web page.

The other approach is to make a php chat daemon, this can be achieved by running php through the CLI. To get started some reading of the PHP Manual would be advised, partculary under stream_socket_server, stream_socket_accept, pcntl_fork, the CLI section itself, and finally some catching up on php wrapeprs to stdin, stdout and stderr - stream_socket_pair may come in useful aswell.

I'd strongly recommend you follow Roberts advice to start with, and build that chat application as a standrd php app with mysql and an ajax front end (perhaps even an iframe whilst developing functionality, then upgrade to ajax).

Many Regards

Nathan

Robert Cummings wrote:
On Sat, 2007-12-08 at 12:19 -0500, Robert Cummings wrote:
On Sat, 2007-12-08 at 16:46 +0000, Nathan Rixham wrote:
1 - yes you can make a multichat daemon in php
2 - if you don't know that it's possible or where to begin, then odds are you won't be able to make it.
That's what the list is for... to help him find his way.

abderrazzak nejeoui wrote:
Hello,
i want build a multi chat server based in php.
1- is that possible
2- if yes can you instruct me how to bigin
thanks
There are two approaches. You either are looking to do it as a
standalone application outside of the web environment, or you are
looking to do it via the web environment using some combination of
backend PHP and front end browser refreshes (not recommended) or AJAX.
A simple scenario for the web version follows:

    1. User logs in (or implicitly is logged in anonymously)
    2. User sees any ongoing discussion for X amount of previous time
    3. User can post a form to the website (or post data via AJAX)
       which effectively is the user's message to the chat server
    4. Message is save to database with ID/timestamp
    5. Browser refreshes or AJAX retrieves messages greater than
       user's session message ID
    6. Return to step 1.

Should have been:

    6. Return to step 3.

Cheers,
Rob.

--- End Message ---
--- Begin Message ---
On Saturday 08 December 2007 16:28:06 you wrote:
> live chat throught a web page like www.amitie.fr

then I got three solutions for you, either make a (as mentioned by others on 
the list) an ajax frontend witch do the irc lookalike.

You can create a webinterface for an irc server. I think java is often used 
for this solution, you can probably also use ajax. (this isn't as hard as is 
looks, I think this solution is easier than the first one)

And as a third and ... the COOL solution is to user the jabber 2.0 as the 
backend and some php stuff in the middle and a nice interface, that you can 
connect directly using a jabber client (maby throught a mobile) and someone 
on the same time using the webpage to chat with you ?;D This option is of 
course available on the second option to, except you use irc. 

All this open protocolls just makes us nerds go crazy!!!


>
> 2007/12/8, Børge Holen <[EMAIL PROTECTED]>:
> > On Saturday 08 December 2007 09:59:35 abderrazzak nejeoui wrote:
> > > Hello,
> > > i want build a multi chat server based in php.
> > > 1- is that possible
> > > 2- if yes can you instruct me how to bigin
> > > thanks
> >
> > chat as in :
> > forum
> > livchat throught a page
> > livechat throught an external program,
> >
> > --
> > ---
> > Børge Holen
> > http://www.arivene.net
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php



-- 
---
Børge Holen
http://www.arivene.net

--- End Message ---
--- Begin Message ---
thanks for Nathan, Robert Cummings and Børge Holen, the information you sent
are very useful

Cordially
Nejeoui



2007/12/8, Børge Holen <[EMAIL PROTECTED]>:
> >
> > On Saturday 08 December 2007 16:28:06 you wrote:
> > > live chat throught a web page like www.amitie.fr
> >
> > then I got three solutions for you, either make a (as mentioned by
> > others on
> > the list) an ajax frontend witch do the irc lookalike.
> >
> > You can create a webinterface for an irc server. I think java is often
> > used
> > for this solution, you can probably also use ajax. (this isn't as hard
> > as is
> > looks, I think this solution is easier than the first one)
> >
> > And as a third and ... the COOL solution is to user the jabber 2.0 as
> > the
> > backend and some php stuff in the middle and a nice interface, that you
> > can
> > connect directly using a jabber client (maby throught a mobile) and
> > someone
> > on the same time using the webpage to chat with you ?;D This option is
> > of
> > course available on the second option to, except you use irc.
> >
> > All this open protocolls just makes us nerds go crazy!!!
> >
> >
> > >
> > > 2007/12/8, Børge Holen <[EMAIL PROTECTED]>:
> > > > On Saturday 08 December 2007 09:59:35 abderrazzak nejeoui wrote:
> > > > > Hello,
> > > > > i want build a multi chat server based in php.
> > > > > 1- is that possible
> > > > > 2- if yes can you instruct me how to bigin
> > > > > thanks
> > > >
> > > > chat as in :
> > > > forum
> > > > livchat throught a page
> > > > livechat throught an external program,
> > > >
> > > > --
> > > > ---
> > > > Børge Holen
> > > > http://www.arivene.net
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
> > --
> > ---
> > Børge Holen
> > http://www.arivene.net
> >
>
>

--- End Message ---
--- Begin Message ---
Hey folks,

One area I lack experience in is writting a solution to index/search on a
site. Would anyone be kind enough and point me in the right direction as far
as any books which discuss some simple solutions or articles/blogs on the
web? Clearly I'm not looking for anything as complex as Google's engine, ;-)
but would love just to be able to understand/incorporate a decent level of
search capabilities.

Cheers all,

- sf

--- End Message ---
--- Begin Message ---
Hello,

This is quite simple, you need to have mysql table with "fulltext" index.

The "hard work" is done by mysql, you need to learn a few of things
about fulltext with mysql, for that you can google it.

PHP is only used to send the query to mysql (in most of case but not always).

Try to do something, and when you need help, only ask here...

good luck :)

On 08/12/2007, Steve Finkelstein <[EMAIL PROTECTED]> wrote:
> Hey folks,
>
> One area I lack experience in is writting a solution to index/search on a
> site. Would anyone be kind enough and point me in the right direction as far
> as any books which discuss some simple solutions or articles/blogs on the
> web? Clearly I'm not looking for anything as complex as Google's engine, ;-)
> but would love just to be able to understand/incorporate a decent level of
> search capabilities.
>
> Cheers all,
>
> - sf
>


-- 
Best Regards

Cesar D. Rodas
http://www.cesarodas.com
http://www.thyphp.com
http://www.phpajax.org
Phone: +595-961-974165

--- End Message ---

Reply via email to