Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Ajax Chat System - Active HTTP Connection?


I am trying to build an ajax chat system. Currently I have it so that
when you chat, you upload your message to the database, and each client
is polling that database to see if he/she has any new messages. The
problem with this is that I poll at 2 second intervals (since
connection is not active), and so its not as responsive as I'd like it
to be.

My question is, is an active HTTP connection possible? How did Meebo or
Gmail implement their ajax chat? Can someone point me to a better tool
for implementing an active-connection chat, rather than a poll-based
one?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Setting Up An Online Chat System
I have been asked by my manager to look into the possiblily of setting
up an online chat system for the external website. We run an Apache
server with PHP (hence the reason Im posting here) so it would need to
run on that.

Basically, it will run on the website and its purpose will allow
members of the public to access the chat room and discuss current
topics with experts. Similar to a doctors interactive website where
patients can speak and get advice from their GP.

Anyway, Ive never set up anything like this before so dont really know
where to begin. The chat system may be something that we would need to
pay for but ideally it will have a professioanl appearance and be easy
to implement.

Close Http Connection But Continue Execution?
I'm trying to work out how to close the connection to the browser at a
defined point within my code, but go on to do some time-consuming
processing with PHP.

Although it *should* be possible to do this by moving the slow stuff into a
function registered with register_shutdown_function, it appears that in
many cases, the connection is not closed before calling the shutdown
function - there are also issues with calling other functions from the
registered function.

I can't close stdout since I don't have a handle for it.

While I can get the desired result by creating a sort of 'proxy' which posts
on to the real script without waiting for the latter to finish this will be
rather difficult to implement in the operational context.

Aborting HTTP Connection From Server-side
I wonder if this is possible: I have a script that does things that
take time. In the first part of the script it does data checking and
other verifications, then comes the long part. I wish to be able to
send the result of the first part to the client, disconnect the HTTP
(so the client can do whatever they want), the script should then
continue with the rest of the time consuming tasks, at the end of
execution (or if an error occurs) an e-mail is sent.

The key here is that it's the script that aborts the connection. It
would be like putting the PHP process in the background to return the
hand to web server, which in turn would close the connection.

I already used the ignore_user_abort() to better control what's going
on in the script.

I've had a look at apache_child_terminate() but it still waits that
the PHP script ends.

I don't want to use an HTTP refresh and for security reason I'd rather
avoid using a system() or exec() call.

My script is actually called by another script on another server
(using CURL)

I've also tried to add "Content-length: ..." in the HTTP headers and
use flush() to force the client to read the output and close the
connection when the byte count is reached. But it doesn't seem to work
that well... I can't either set a too short client timeout because it
needs to wait for the first part to be over (and it may depend on
server load.)

Your ideas are welcomed... of course if that could be implemented
inside PHP itself that would be great. I don't think Apache or not
matters...

AJAX:: Using AJAX To Improve The Bandwidth Performance Of Web Applications
This is an amazing example of increasing bw performance using ajax. a
must see for all

visit:
http://webperformanceinc.com/library/reports/AjaxBandwidth/index.html

Active Persistent Links And Active Links Both 0
I just installed Apache/MySQL/PHP

I'm trying to test if the connection to MySQL is there

I know the database works on its own, I checked that

when I run phpinfo() I get mysql listed, I'm just wondering if when it says "Active Persistent Links" and "Active Links" both 0 (zero) under "enabled" column, is that fine, meaning configured properly?

Active Directory / Exchange / Active Directory.
I'm creating an Intranet module for a client (Forum, files upload...etc...etc). This client already has a huge server running on WIN2000 + IIS 4 + Exchange + Microsoft Active directory + proxy and finally PHP 4.03 + MySql.

Problem #1 :
All passwords are changed every weeks, so I want to be able to import users/pass from Microsoft exchange .... Does anyone have an idea to do such thing with PHP ?

Problem #2:
I would like that the user logged from the firm's network do not have to log. again when connecting the module. So, is it possible to do such thing ?

Warning: Fopen(http://localhost/.. ?HTTP Wrapper Does Not Support Writeable Conn
I am able to create a pdf using php and ezpdf, its works fine, and display the pdf document in the current server page.

But here are two things i wish to do, first store the pdf and than open, if possible in a new popup window?

When i tried this function below, it gives me an error

Error:
Warning: fopen(http://localhost/pdf/files/tmp1/yasmina.pdf) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections. in C:Program FilesxampphtdocspdfpdfClassesAndFonts_009ecertificate.php on line 139
Could not open file to save PDF. Code:

Server HTTP Sends Or Streaming HTTP?
I was wondering if you guys had any ideas to constantly
stream a webpage in case an announcement was posted
or possibly pushing onto the browser information.

What I basically want is for a user browsing my website
to be notified of any new announcements. I thought
about checking everytime he changes pages but then
I realized that I want them to be notified as long as
they have the page open even if it's minimized. So it
would at best be a method to use php force send a msg
after someone posts an announcement.

Questions About HTTP Headers Sent With PHP In HTTP Authentication
Here is an example from the PHP Manual

<?php

if ((!isset($_SERVER['PHP_AUTH_USER'])) || (1==1)) {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Text to send if user hits Cancel button'
exit;
} else {
echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</
p>";
}
?>

Questions.

1. This is a status code not a header, right? = header('HTTP/
1.0 401 Unauthorized');

2. According to the change log in the PHP manual, starting with 4.4.2
and 5.1.2 the header function now prevents more than one header to be
sent at once as a protection against header injection attacks. Does
this mean if I make multiple header calls the headers will be sent in
multiple response messages to the browser? Is this allowed? Can a
server send multiple response messages to one request?]

3. If you hit the "cancel" button on the browser user name/password
request dialog (as alluded to in the code snippet above), what message
does the browser send to the server.

Trapping A File Error: Failed To Open Stream: HTTP Request Failed! HTTP/1.1 404 Not Foundin
php
Warning: file(http://shop1.outpost.com/product/5053975)
[function.file]: failed to open stream: HTTP request failed! HTTP/1.1
404 Not Foundin

I am just trying to put some code around this to trap it.

Active Row?
I have an sql table with various fields in, one of which is "Active" which is an enum 'y' or 'n'. Basically This table holds different events, of which only 1 may be active at one time. So my question is, is their an easier/better way of doing this kind of thing. At the moment I have to check all rows in the table to find which one has active set to 'y', then if i want to change it, set it to 'n' and set the new row i want active to 'y'.

System(); Command Not Working On Remote System. Windows.
My server is a windows machine, on the same domain as python(also a windows machine). Apache is running as a service as an administrator. This is a test only environment to whom it may concern(I hate people telling me how insecure my system is) I'm just trying to run:

$last_line = exec('dir pythonc$', $retval, $g);
print_r($retval);
echo '<br>'.$g.'<br>';
echo '$last_line= '.$last_line.'<br>';
Which outputs:

Array ( )
1
$last_line=

The command from the command line works fine. And apache can access directories that only administrators can access on the local machine.

Active Directoroy With PHP
I have an active directory up and running, i can query against it from the box its on, but when i try and use php to query against it, i dont get anything. It seems to be able to connect, but unable to read the information that is there. Any idea or know where a good tutorial on active directory is? I know that is Microsoft's version of LDAP, but i wondering if there was a special way you had to do things since it is AD.

Active Time
I am wondering if their is a way to have the time update itself without refreshing the page?

PHP And Active Directory
Via a PHP script (running on a LAMP configuration - PHP with LDAP
support), I run queries on the LDAP server of our office (users and
arguments). Now, I want to put the result of this query (user
information) in a Windows 2003 AD.
I use PHP-ldap functions to connect with the domain controller: making
connection is no problem, but binding (authenticated, I even tried
Domain Administrator credentials) doesn't work...
Does anyone has experience with this matter (PHP and AD
connection/communucation)?

Active Sessions
How do I know how many active conecctions are in my server (with PHP)? I've done it with ASP, and it's WAY too easy, so I guess it should be in PHP.

PHP And Active Directory 2K3
Note: I'm cross-posting the below to nyphp.org as well.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~
I've been struggling with an issue for a few months. I am attempting to
search Active Directory 2003 via PHP, but am running into an issue
searching
from the base DN (i.e. 'cn=company,cn=com'). This seems to be somewhat
of a
known issue with AD2K3. A search at this level always returns:

Warning: ldap_search() [function.ldap-search]: Search: Partial results
and
referral received

If I change my base DN to 'ou=someOU,dc=company,dc=com', searches work
properly. I was curious to see what would happen at the command line,
so I
used openldap's ldapsearch function against AD and sure enough I got a
bunch
of results that were truncated with

ldap_result: Can't contact LDAP server

Of note: I have a base php class that sets the following options
whenever a
bind is created (seems to be necessary for searching AD2K3 at all):

ldap_set_option($this->_ldap, LDAP_OPT_REFERRALS, 0);
ldap_set_option($this->_ldap, LDAP_OPT_PROTOCOL_VERSION, 3);

Anyone have any feedback about how to search the base dn of AD2K3?

Last Active Field
If i was to make a last active field in a members table in my database and had it update the field every page they went on, would this effect anything like speed?

I was just thinking if say 100 people are using it at the same time and it's updating the database EVERYTIME someone clicks on a different part of the site, it may get a bit slow or something? Will this happen or is it fine to do this?

Active Sessions
Can you set up something in sessions that shows who is currently logged in?  The forum does it, is that in php?

Active Directory And PHP
Is there anyway to work PHP with Active directory? My intention
consist in developing an application that authenticates automatically
PHP on W2k3 server.

Active Directory Authentication Via Php.
I'm in a bit of a pickle.. at the company where I recently started
work, I discovered that the knowledge base we use sucks, and sucks bad
(oh Lotus Notes, how I loathe thee, let me count the ways)

So for kicks and giggles, I found a nice "personal notebook" solution
on the net called: http://www.tiddlywiki.com/

When this had ballooned into a big, nice knowledge base, I discovered
that there's a server-side version of it called cctiddly :

So as a test I found a free apache/php/sql solution:
- copied the cctiddly into
it, and the thing worked!

As you can see, up until now, no real programming has been undertaken
by me, at this point, I've just been at most playing around with
installing plugins into my tiddlywiki.

Of course, also, now I'm faced with the ultimate question... what's
the best way to authenticate people who want access to the wiki?

I've researched a bit, and discovered that you can enable LDAP access
via php, so theoretically you can authenticate people through AD...
which is excellent! People can just use their usual username and
password, no need to remember yet another user/pass, and no need for
admin to have to control yet another admin control thingum.

So I've been testing this out, browsing through information, and as a
test I created this:

------
echo "<h3>LDAP query test #1</h3>";
echo "Connecting ...";
$ldap_host = "localhost";
$ldap_user = "user@domain.is";
$ldap_pass = "password";
$connect = ldap_connect($ldap_host) or die ("No Connection to LDAP
server"); // must be a valid LDAP server!
echo "connect result is " . $connect . "<br />";

if (ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) {
echo "Using LDAPv3 <br />";
} else {
echo "Failed to set protocol version to 3 <br />";
}

if ($connect) {
echo "Binding to server...";
$bind=ldap_bind($connect, $ldap_user, $ldap_pass);
echo "Bind result is " . $bind . "<br />";
}
----
- Now this works.. if I remove the $ldap_pass in the
"$bind=ldap_bind($connect, $ldap_user, $ldap_pass); " line, because
then I'm connecting anonymously to the LDAP server...

But when I try to authenticate to the server with the password I get
this error:

"Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server:
Strong(er) authentication required in C:Program Filesxampphtdocs
wikiadtest.php on line 21"

- which made me go, whu?

Now I can't change the settings on the domain controller, as I'm not
the sysadmin.. so I need to somehow create a stronger authentication
to the server.. now how the hell do I do that?

I can't install an SSL certificate, because there isn't one on the
server, is there some way for me to make the password meet the bare
minimum requirements for a stronger authentication without having to
use SSL?

An administratoir I know recommended to try to figure out how to use
either NTLM or KERBEROS... which is at least perhaps something.

Hightlight Active Link.....
I have this table for links (below), how can I set it up so that whichever section is active then that link is highlighted? PHP Code:

Testing To See If A Page Is Active?
I have a Shoutcast station that is on and off pretty regularly. I'd like to make a "power light" on my website to detect whether the station is on or off.

I'm not quite sure what the best language to handle this would be, but I think PHP should be able to do it...

The station is basically outputted as a link, like this:
http://www.myurl.com:8000/listen.pls

If it's on, it pops open the app and goes to town.. If it's off, it gives a "page cannot be displayed error" (I'd like to do something about that, but that's a different story).

So basically, I want to query the link, and if it comes back active (or true or 1 or whatever), then it includes a certain graphic; if it's not active (or false or 0 etc.) then it'd include another. I'm thinking it'd be use simple if/else statement, something like this:

$radiostatus = *radiostationquery*
if ($radiostatus == true) {
echo "poweron.gif";
} else {
echo "poweroff.gif";
}

But I'm not sure what *radiosationquery* would be. Seems like it'd be a pretty simple command. Someone (familiar with coding, but not php) suggested the Get() command might be a way to do it.

Cell Active On The Date
I have a database that has a date such as 2007-12-01 with a inactive colum, what is the best way to have it make that cell active on the date that is in the date cell? So on 2007-12-01 that site would be active.

Make Links Active
Im just wondering if there is anyway to automatically make any urls in my page content, into clickable links. Basically I have a small forum I built, and I want to make any URL the user enters, into a clickable link. So if I had www.google.com as plain text, then it would make it into a clickable link.

Active Directory And LDAP
I have a php Intranet, and what I would like to do is hit the Active Directory and bring back the Username, FirstName and Lastname from Active Directory and set them to variables, so I can either display them or insert them into a database.

A few things to consider, php is installed on the server, but I don't have access to the server to change any settings.  This is just a side project and we are blowing up the existing intranet and going with a Content Management System, so the easier the better.

Active Directory Token
My environment is setup like this:

Windows Server 2003
Active Directory 2003
IIS 6.0
PHP 5.1.6

When a user tries to hit my system they are prompted for an Active Directory username / password combination. If their information is correct they get to the application. I need to modify the application code to check if the users password is about to expire.

IIS can  be configured to pass a token to the application. How would I use PHP to read the contents of this token so I can query AD?

Active Users Online
I am trying to keep track of the active users who are online. How would I implement a system of this nature?

PHP Chat
I'm searching for a CHAT written in PHP3. If you know where I can find such things.




Web Chat?
I want to create chat window for my web site.How can i solve this, a java based code should also be ok!

IRC Chat
Are there any live chat channels available out there for PHP related questions?

Php Chat
i have made a chat script that uses META REFRESHES to update from a flat txt file. this is very inefficient for both server and user. the problem is i can't think of any other way to do it.

one way i can think of is to open sockets so that a server can look at the file and see if it has been changed. of course, i have no idea where to start, so instead i built a really bad script that was worse on the client (i.e. 100% CPU usage) but not so bad on the server. any ideas? PHP Code:

Php Chat
i want the php chat scripts.i make some searches but find a big one, i need a simple one.i need public  chat system. the admin will type the message and press send button,the users who are logged at that time should see the admin message and give reply to him.all users can chat with admin.the messages will be stored in database.no private rooms.just chat messages only.

Number Of Current Active Session
anybody knows how to count the number of currently active session? using the current session_save_handler (/tmp and not using any db).

Ldap And Php4 With W2k Active Directory
I am trying to get ldap info from a W2K active directory. I have the authentication down, but I want to search on the aa0000000 to get the name associated with the login. Basically I am making a request form that will be used once a year, but need to be sure of the people signing up, use resources already setup, and have one login/pass. Code:

Creating Active Directory User
does anyone already tried to create a user into active directory through
php_ldap ?

i tried something like this but still don't work :-/

$adduserAD["cn"][0] = "phpldapuser";
$adduserAD["samaccountname"][0] = "guguseli";

$adduserAD["objectclass"][0] = "top";
$adduserAD["objectclass"][1] = "person";
$adduserAD["objectclass"][2] = "organizationalPerson";

$adduserAD["givenname"][0] = "thomas";
$adduserAD["name"][0] = "tester";
$adduserAD["sn"][0] = "btester";
$adduserAD["description"][0] = "TEST-Account ldap";
$adduserAD["title"][0] = "Programm Manager";

ldap_add($ad, "ou=test, dc=my,dc=domain", $adduserAD) or die("error!");

Make An Active Users Script In PHP
I'm trying to make an active users script in PHP, not because I need one, because I want to know if i can. I made one that worked with PHP sessions but then it failed to work with people who had cookies turned off. So, now the script i'm using stored the time and users IP in a flat file. Needless to say it doesn't work for a seemingly unknown reason.

It's a pretty small script that I heavily commented so I wouldn't get lost. If one of you more experienced PHP gurus can take a look through it real fast and tell me what's wrong and what I could do to fix it that'd be great. Code:

ISO PHP Chat With Games
I'm looking for a F/OSS chat app with included games, ideally chess,
checkers/draughts, etc. Thanks for any sightings.

API For Yahoo Chat?
How to get the contact list of a particular user from Yahoo chat from an external application? Is there any API available for this purpose?

Chat Program
Is it possible to create a chat program by using PHP. Or is it only possible by JAVA?

Realtime Chat
i want to code a realtime chat. the server side is done (php), what i need now is the best way to refresh the page/frame containing the messages periodically (t < 500 ms).
i think i could do this with a little bit of javascript. does anybody have some good code (normal mouse cursor in browser etc), or is there a better way?

PHP Stream (chat)
how the PHP stream chats works? There is
lot of "normal" chat where the page will be updated regurarly but I am
looking for php based chat where there is no update every 5 seconds...

Live Chat
I found that some of these pre-made help desks also have a live chat function that allows users to seek help via live chat, similar to aim. (Once you log into the help desk at php live, click on the "launch request monitor window" to get a better understanding of what I am talking about.)

Unfortunately, I showed this to my boss and he liked that idea. Why unfortunate? I have no idea where to start on this one! I have done several web apps with php and mysql, so I would say I have a fair grasp and understanding, but this one has me stumped. Has anyone done something similar to this or have an idea in which direction that I need to be going?

Chat With You Friends
<?php
// Get the names and values for vars sent by index.lib.php3
if (isset($HTTP_GET_VARS))
{
while(list($name,$value) = each($HTTP_GET_VARS))
{
$$name = $value;
};
};

// Get the names and values for post vars
if (isset($HTTP_POST_VARS))
{
while(list($name,$value) = each($HTTP_POST_VARS))
{
$$name = $value;
};
};

// Fix some security issues
if ((empty($From) || trim($From) == '')
|| (empty($U) || trim($U) == '')
|| (empty($R) || trim($R) == '')
|| (empty($Ver) || empty($L) || empty($N))
|| (!isset($T) || !isset($D) || !isset($O) || !isset($ST) || !isset($NT))
|| !is_dir('./localization/'.$L))
{
exit();
}

require("./config/config.lib.php3");
require("./localization/".$L."/localized.chat.php3");
require("./lib/release.lib.php3");
require("./lib/database/".C_DB_TYPE.".lib.php3");
require("./lib/clean.lib.php3");

header("Content-Type: text/html; charset=${Charset}");

// avoid server configuration for magic quotes
set_magic_quotes_runtime(0);

$U = urldecode($U);
$R = urldecode($R);

// Translate to html special characters, and entities if message was sent with a latin 1 charset
$Latin1 = ($Charset == "iso-8859-1");
function special_char($str,$lang)
{
return addslashes($lang ? htmlentities(stripslashes($str)) : htmlspecialchars(stripslashes($str)));
};

$DbLink = new DB;

// ** Updates user info in connected users tables and fix some security issues **
$DbLink->query("SELECT room, status, ip FROM ".C_USR_TBL." WHERE username = '$U' LIMIT 1");
if ($DbLink->num_rows() != 0)
{
list($room, $status, $knownIp) = $DbLink->next_record();
$DbLink->clean_results();
$kicked = 0;
// Security issue
include("./lib/get_IP.lib.php3");
if ($knownIp != $IP)
{
$kicked = 5;
}

Chat Script
where I can get a chat script to use on a dating site, where members can login and click on the member to start chatting something to be one on one not a general chat.
match.com has a nice messenger type one, however not sure where I can get that as I think it is custom built. However anything suitable to serve the purpose will do.

Need Urgent Help Regarding Web Cam Chat In Php
Anybody have idea or done before web cam chat in php, what are the things needed for that..

Chat Scrolling
I have need to know how when a person posts a message to a chat room window how to get the chat room window (iframe) to scroll when that message is posted instead of the person having to scroll the window themselves to see the newly posted messages. Any ideas?

Chat Script
im new here and i would like to ask how can i make a chat script that will have "one way communication". Its for a radio station. The radio producer will be able to see the listeners messages but they will not to be able to see their.

But listener will see producers message. I dont need nick names and other stuff, i want simple things a chat box, and and a text box so can write.

A Chat Script
I've made an attempt at a chat script, but it isn't performing exactly how I want. Yes, I am a relative newbie to PHP. I've spent hours on Hot Scripts looking for something, but nothing I found meets what I need. Code:


Copyright © 2005-08 www.BigResource.com, All rights reserved