[PHP] who is on the page?

2003-03-23 Thread Oliver Witt
Hi everybody,
I've been looking for a script to determine who is on my page (people
have to log in). So far, I've been using a script that updates the time
in the database continuously as long as the person is on the page. That
way, the script could determine whether the user is still online or not.
However, this script has way too many queries and uses too much server
resources. Is there anything else? I'm wondering if the
connection_status() function would help in any way...
thx,
Olli


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] include dosn't after Provider-Change

2003-03-13 Thread Oliver Witt
Hallo,

after a Provider-Change my counter-script dosn't work again.

My entry is: ?php include (counter/rcounter.php) ; ? in an
html-document.
Is there an Error inside?
My server show no error-messages...

Thanx for Help.

Olly


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] include dosn't after Provider-Change - I have it!

2003-03-13 Thread Oliver Witt
After the Tip: You can't execute PHP from an HTML page. My guess is that
your old provider had PHP parsing enabled for .html files, shich most don't.

Now I have created an .htaccess in the home-folder with: AddType
application/x-httpd-php .php .php4 .html

It works...

Thanxs!

Olly

-Ursprüngliche Nachricht-
Von: Oliver Witt [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 13. März 2003 10:03
An: [EMAIL PROTECTED]
Betreff: [PHP] include dosn't after Provider-Change


Hallo,

after a Provider-Change my counter-script dosn't work again.

My entry is: ?php include (counter/rcounter.php) ; ? in an
html-document.
Is there an Error inside?
My server show no error-messages...

Thanx for Help.

Olly


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] authentication problem

2003-02-28 Thread Oliver Witt
Hi again,
My problem was about authentication without the default popup, but with
a form that submits the credentials. I still didn't get it to work, so
I'd like to know if anyone has ever done anything like that. I just
can't get it to work right and I'd like to see a working script
thx,
Oliver


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] simple problem about authentication

2003-02-26 Thread Oliver Witt
1lt John W. Holmes schrieb:

  I'm trying to set up a password section on my website. But I don't want
  a window popping up asking for a username and password. I'd rather like
  to have a form that submits the data. I did that and it works fine, but
  the browser seems to not save the username and password, because if i
  click on any link, it returns an unauthorized message... any ideas?
  thnx,

 Show some code... the possibilities are endless for what you're doing wrong.

 ---John Holmes...

ok, here's the code:

the form submits the user name and password in the variables $user and $pw to
another site, which includes this:

if(isset($user)  isset($pw)){
$user = ucwords(strtolower($user));
$PHP_AUTH_USER = $user;
$PHP_AUTH_PW = $pw;}

if(isset($PHP_AUTH_USER)){
$result = mysql_query(select * from _users where user = '$PHP_AUTH_USER');
$_user = mysql_fetch_array($result);}

if(!isset($PHP_AUTH_USER)) {
header('HTTP/1.0 401 Unauthorized');
echo('unauthorized');
exit;}
else{
$result = mysql_query(select * from _users where user = '$PHP_AUTH_USER') or
die('Error occured while connecting to database');
$rows = mysql_num_rows($result);
if($rows == 0){
header('HTTP/1.0 401 Unauthorized');
echoscriptwindow.location.href='../index.php?action=user_wrong'/script;
exit;}
else{
$daten = mysql_fetch_array($result);
if($PHP_AUTH_PW == $daten['pw']){
// authorized
}
else{
header('HTTP/1.0 401 Unauthorized');
echoscriptwindow.location.href='../index.php?action=pw_wronguser=$user'/script;

exit;}}}

And this works fine for just this page. Whenever I click on a link to a page
which includes the same file though, it echoes 'unauthorized'...
Olli


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] simple problem about authentication

2003-02-26 Thread Oliver Witt
Ernest E Vogelsinger schrieb:

 At 14:22 26.02.2003, Oliver Witt spoke out and said:
 [snip]
 if(isset($user)  isset($pw)){
 $user = ucwords(strtolower($user));
 $PHP_AUTH_USER = $user;
 $PHP_AUTH_PW = $pw;}
 
 [more...]
 And this works fine for just this page. Whenever I click on a link to a page
 which includes the same file though, it echoes 'unauthorized'...
 [snip]

 Sounds like you're using sessions... perhaps register_globals is off in
 your environment, so session variables are not registered? How do you set
 the $user and $pw variables?


no, im not using sessions and register globals is on.
the variables user and pw are set by submitting a form (method=post). that's
where i expect the mistake to be. because as far as i know, the browser usually
saves the credentials, at least the user name after authenticating. but it just
doesn't seem to do so
Olli



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] simple problem about authentication

2003-02-25 Thread Oliver Witt
Hi,
I'm trying to set up a password section on my website. But I don't want
a window popping up asking for a username and password. I'd rather like
to have a form that submits the data. I did that and it works fine, but
the browser seems to not save the username and password, because if i
click on any link, it returns an unauthorized message... any ideas?
thnx,
Olli


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Submit buttons

2003-02-25 Thread Oliver Witt
Greg schrieb:

 Is there any way that I can have a form submit to different pages depending
 on the submit button that is pressed?  Thanks!

dont use submit buttons, but buttons... (type=button) calling a script that
submits the form to whatever page you want it to.
Olli


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Size of images (in bytes)

2003-01-23 Thread Oliver Witt
Hi,
After calling to the function ImageCreateFromJPEG() and before outputing
the image with ImageJPEG, is there a way to determine the images size in
bytes?
I want to reduce the quality more and more until it has reached a
certain level.
Thanks,
Olli


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Size of images (in bytes)

2003-01-23 Thread Oliver Witt
1lt John W. Holmes schrieb:

  After calling to the function ImageCreateFromJPEG() and before outputing
  the image with ImageJPEG, is there a way to determine the images size in
  bytes?
  I want to reduce the quality more and more until it has reached a
  certain level.
  Thanks,
  Olli

 You have the image data in a string, right? Could you relate the length of
 that string to the resulting size of the file, somehow?

 ---John Holmes...

After calling the funtion ImageCreateFromJPEG like this:
$im = ImageCreateFromJPEG(pic.jpg);
then $im is not a string but a resource. I don't know how to get it into a
string
Olli



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Size of images (in bytes)

2003-01-23 Thread Oliver Witt


Marek Kilimajer schrieb:

 Use output buffer:
 ob_start();
 ImageJPEG($im);
 $imagestring=ob_get_contents();
 ob_end_clean();



Thanks for the answer. But if I do it like that, the picture has been sent to
the browser. That's what I don't want. I need to know the size of the picture
before it is sent to the browser.
Olli





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] ftp_put: permission denied

2003-01-09 Thread Oliver Witt
Well, how to I get access to where I'm trying to put it? The rights already are 777.
Olli

Thomas Seifert schrieb:

 it may be, that destiny is wrong.
 the error-message tells that you don't have access to where you are trying to upload 
the file to.

 Thomas

 On Wed, 08 Jan 2003 20:59:02 +0100 [EMAIL PROTECTED] (Oliver Witt) wrote:

  I uploaded that script with a common ftp program on my server in the
  internet.
  FOr the host, user and pw, I use the same data as I use to log in with
  my ftp program. So the mistake can't be there.
  This is how that script basically works:
 
  ?php
  if(isset($destiny)){
  $ftp_server = host;
  $benutzername = user;
  $passwort = pw;
  $connection_id = ftp_connect($ftp_server);
  $login_result = ftp_login($connection_id, $benutzername, $passwort);
 
  $upload = ftp_put($connection_id, $destiny, $local_file, FTP_ASCII);
  if (!$upload) {
  echo pIt didn't work/p;}
  else {
  echo pIt did work/p;}
  ftp_quit($connection_id);}
  ?
 
  html
  head
  title/title
  /head
  body bgcolor=#FF text=#00
  form action=upload.php enctype=multipart/form-data method=POST
  input name=local_file type=file size=50
  br
  input type=text name=destiny
  br
  input type=submit value=Submit
  /form
  /body
  /html
 
 
 
  Timothy Hitchens ) schrieb:
 
   Using ftp_login() ??
  
   Timothy Hitchens (HiTCHO)
   Open Platform Consulting
   e-mail: [EMAIL PROTECTED]
  
-Original Message-
From: Oliver Witt [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 9 January 2003 5:30 AM
To: [EMAIL PROTECTED]; Timothy Hitchens )
Subject: Re: [PHP] ftp_put: permission denied
   
   
Timothy Hitchens ) schrieb:
   
 I am assuming you have testing from a desktop client.

 Are you sure that the PHP script has been logged in??

 Can you see via a log file of the successful authentication??

   
I logged in using the same information as I used to upload
that script.
   
if ((!$conn_id) || (!$login_result)) {
echo Not logged in;
die;
} else {
echo Logged in;
}
   
That script returned Logged in.
Olli
   
   
   
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   
 
 
 
 





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] ftp_put: permission denied

2003-01-08 Thread Oliver Witt
Hi,
I am running a really simple php script to upload files on my server via
ftp. But it always return this warning: ftp_put(): Permission denied
I can't have to do anything with CHMOD can it? I mean it's ftp!! I don't
know what else it is but I guess it's a pretty common problem.
Thx for any help,
Olli


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] ftp_put: permission denied

2003-01-08 Thread Oliver Witt
Timothy Hitchens ) schrieb:

 I am assuming you have testing from a desktop client.

 Are you sure that the PHP script has been logged in??

 Can you see via a log file of the successful authentication??


I logged in using the same information as I used to upload that script.

if ((!$conn_id) || (!$login_result)) {
echo Not logged in;
die;
} else {
echo Logged in;
}

That script returned Logged in.
Olli



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] ftp_put: permission denied

2003-01-08 Thread Oliver Witt
I uploaded that script with a common ftp program on my server in the
internet.
FOr the host, user and pw, I use the same data as I use to log in with
my ftp program. So the mistake can't be there.
This is how that script basically works:

?php
if(isset($destiny)){
$ftp_server = host;
$benutzername = user;
$passwort = pw;
$connection_id = ftp_connect($ftp_server);
$login_result = ftp_login($connection_id, $benutzername, $passwort);

$upload = ftp_put($connection_id, $destiny, $local_file, FTP_ASCII);
if (!$upload) {
echo pIt didn't work/p;}
else {
echo pIt did work/p;}
ftp_quit($connection_id);}
?

html
head
title/title
/head
body bgcolor=#FF text=#00
form action=upload.php enctype=multipart/form-data method=POST
input name=local_file type=file size=50
br
input type=text name=destiny
br
input type=submit value=Submit
/form
/body
/html



Timothy Hitchens ) schrieb:

 Using ftp_login() ??

 Timothy Hitchens (HiTCHO)
 Open Platform Consulting
 e-mail: [EMAIL PROTECTED]

  -Original Message-
  From: Oliver Witt [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, 9 January 2003 5:30 AM
  To: [EMAIL PROTECTED]; Timothy Hitchens )
  Subject: Re: [PHP] ftp_put: permission denied
 
 
  Timothy Hitchens ) schrieb:
 
   I am assuming you have testing from a desktop client.
  
   Are you sure that the PHP script has been logged in??
  
   Can you see via a log file of the successful authentication??
  
 
  I logged in using the same information as I used to upload
  that script.
 
  if ((!$conn_id) || (!$login_result)) {
  echo Not logged in;
  die;
  } else {
  echo Logged in;
  }
 
  That script returned Logged in.
  Olli
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] problems with uploading files

2002-12-22 Thread Oliver Witt
Hi,
I have a problem with a php script that enables people to upload files
on my server. I don't know if this is a general problem or if you need
to see the script. It works fine with small files, but as soon as I try
to upload files with a size of a couple of MB, if
(is_uploaded_file($file)) returns false. I wonder why that is!
Kind regards,
Oliver


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] editing .htaccess / .htpasswrd

2002-11-20 Thread Oliver Witt
Hi everyone,
I'm looking for a script that enables users of password demanding web
sites to change their password, in other words a script, that can write
into the .htpsswrd file.
Thanks for help,
Olli


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] attachement

2002-11-10 Thread Oliver Witt
Hi,
I wrote a php script that's supposed to enable me to attach files to an
email. However, the attached files ends up being a mess of letters.
Hallo becomes SGFsbG8=. That must have to do with encoding. Is that
a common problem or do you need the entire script?
Thanks,
Olli


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] attachement

2002-11-10 Thread Oliver Witt
Ernest E Vogelsinger schrieb:

 In your mail headers, you should see some MIME like

 Content-Type: multipart/alternative;
 boundary=GU4wuTSk68F

 (alternative could also read related - depends on the content, the
 multipart is the point here)

 which would tell the client browser that the next mail consists of a couple
 of separate parts, with a separator line as --GU4wuTSk68F.


I had it set like this:

$fp = fopen($file, r);
$contents = fread($fp, $file_size);
$encoded_file = chunk_split(base64_encode($contents));
fclose($fp);

unset($header);
$header = FROM:$name_abs$adresse_abs\n;
$header.= MIME-version: 1.0\n;
$header.= Content-type: multipart/mixed; ;
$header.= boundary=\Message-Boundary\\n;
$header.= Content-transfer-encoding: 7BIT\n;
$header.= X-attachments: $file_name;

$body = --Message-Boundary\n;
$body .= Content-type: text/plain; charset=US-ASCII\n;
$body .= Content-Disposition: inline;
$body .= Content-transfer-encoding: 7BIT\n;
$body .= Content-description: Mail message body\n\n;
$body .= $text;
$body.= \n\n--Message-Boundary\n;
$body.= Content-type: $file_type; name=\$file_name\\n;
$body.= Content-Transfer-Encoding: PLAINTEXT\n;
$body.= Content-disposition: attachment; filename=\$file_name\\n\n;
$body.= $encoded_file\n;
$body.= --Message-Boundary--\n;

That's the same as a friend of mine uses it. He's saying it's working fine...
I'll try to do what you told me.
Olli


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] attachement

2002-11-10 Thread Oliver Witt
Ernest E Vogelsinger schrieb:

 At 15:27 10.11.2002, Oliver Witt said:
 [snip]
 I had it set like this:
 
 $fp = fopen($file, r);
 $contents = fread($fp, $file_size);
 $encoded_file = chunk_split(base64_encode($contents));
 fclose($fp);
 
  ...
 
 $body.= \n\n--Message-Boundary\n;
 $body.= Content-type: $file_type; name=\$file_name\\n;
 $body.= Content-Transfer-Encoding: PLAINTEXT\n;
 $body.= Content-disposition: attachment; filename=\$file_name\\n\n;
 $body.= $encoded_file\n;
 $body.= --Message-Boundary--\n;
 [snip]

 You must not give PLAINTEXT as encoding when you have it base64... use:
 Content-Transfer-Encoding: base64

 BTW, PLAINTEXT is not a MIME recognized encoding type. Excerpt from RFC2045:

 [snip]
 5.2. Content-Type Defaults
 Default RFC 822 messages without a MIME Content-Type header are taken
 by this protocol to be plain text in the US-ASCII character set,
 which can be explicitly specified as:

 Content-type: text/plain; charset=us-ascii

 This default is assumed if no Content-Type header field is specified.
 It is also recommend that this default be assumed when a
 syntactically invalid Content-Type header field is encountered. In
 the presence of a MIME-Version header field and the absence of any
 Content-Type header field, a receiving User Agent can also assume
 that plain US-ASCII text was the sender's intent. Plain US-ASCII
 text may still be assumed in the absence of a MIME-Version or the
 presence of an syntactically invalid Content-Type header field, but
 the sender's intent might have been otherwise.

 6.1. Content-Transfer-Encoding Syntax
 The Content-Transfer-Encoding field's value is a single token
 specifying the type of encoding, as enumerated below. Formally:

 encoding := Content-Transfer-Encoding : mechanism

 mechanism := 7bit / 8bit / binary /
  quoted-printable / base64 /
  ietf-token / x-token

 These values are not case sensitive -- Base64 and BASE64 and bAsE64
 are all equivalent. An encoding type of 7BIT requires that the body
 is already in a 7bit mail-ready representation. This is the default
 value -- that is, Content-Transfer-Encoding: 7BIT is assumed if the
 Content-Transfer-Encoding header field is not present.
 [snip]

 Therefore, for plaintext headings you should use
 Content-type: text/plain
 Content-Transfer-Encoding: 7bit (or 8bit, depends)

 --
O Ernest E. Vogelsinger
(\)ICQ #13394035
 ^ http://www.vogelsinger.at/

thanks you very much, that's it, it's working perfectly now!!!
thx, Olli




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] who's in the chat?

2002-10-10 Thread Oliver Witt

Hi all,
Here's my problem:
I created a web site with a chat. People have to log in to get on the
site, but not to get into the chat. I can tell who's on the site but not
in the chat. Is there anywhy to tell who's in the chat?
Thanks,
Olli


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: who's in the chat?

2002-10-10 Thread Oliver Witt

Jason Young schrieb:

 What's the chat built in? Is this web-page-based, telnet-based?
 Is this your code (i.e. you have access to the source and can modify it
 on-the-fly)?

 Oliver Witt wrote:
  Hi all,
  Here's my problem:
  I created a web site with a chat. People have to log in to get on the
  site, but not to get into the chat. I can tell who's on the site but not
  in the chat. Is there anywhy to tell who's in the chat?
  Thanks,
  Olli
 

Yeah, I wrote the chat, it's php. I have access to everything.
Olli



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: who's in the chat?

2002-10-10 Thread Oliver Witt

Jason Young schrieb:

 Without knowing how your chat works as far as entering the chat, you DO
 have to put some sort of name with the person, right?  Perhaps you could
 just update a temp table with their chat name..

 Or if you can only get into chat by logging into the site, you could
 just set a bit with their cookie data or something..

 Is this not what you wanted to do? (I guess I should have asked you to
 elaborate :) )

 Just throwing suggestions out there
 -Jason


I've been trying something similar like that. How can I update a temp table
when they enter and leave the chat? That's my problem,
Olli




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: who's in the chat?

2002-10-10 Thread Oliver Witt

James E Hicks III schrieb:

 My chat stores usernames, timestamps in a table on DB. When refresh script runs,
 it updates the timestamp on usernames and deletes rows in DB with stale
 timestamps (no refresh run). Pulling usernames from this table gives current
 chat users.

 James


That's a cool idea, I'll try that.
Thanks,
Olli





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: who's in the chat?

2002-10-10 Thread Oliver Witt

Jason Young schrieb:

 Well, when they enter, when its building all of the frames or however
 you ahd it set up.. just throw an INSERT in there..

 Do you know if the chat patrons use the 'leave' button? That could throw
 out another SQL statement, or put it wherever you have your unload
 functions...

 -J



The problem is when they leave. There is no leave button because most of them
wouldn't use it anyway.
Olli





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] parts of sentences

2002-10-09 Thread Oliver Witt

Hi,
I have a problem that I don't know how to solve within php.
I have the variable $x = How are you today and the variable $y. Now, I
want the variable to be $y = are you today or $y = you today. How do
I do that?
Thanks,
Oliver


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: parts of sentences

2002-10-09 Thread Oliver Witt

Bogdan Stancescu schrieb:

 You might want to take a look at explode() and array functions - I don't
 understand exactly what you want (I want this -- or that), but those
 will probably solve the problem, whatever that is specifically.

 Bogdan

 Oliver Witt wrote:
  Hi,
  I have a problem that I don't know how to solve within php.
  I have the variable $x = How are you today and the variable $y. Now, I
  want the variable to be $y = are you today or $y = you today. How do
  I do that?
  Thanks,
  Oliver
 

Thanks, explode() is what i needed ^^
Olli



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Chat with php

2002-10-08 Thread Oliver Witt

Thomas Weber schrieb:

 Hi,

 i'm running a selfmade PHP-chat since one and a half year, currently version
 3. Maybe we can share some ideas
 The image-idea is interesting, but would take heavy bandwith i think.
 My chat runs over a simple dsl-line with 256kbit upstream, there are up to
 50 users at the same time (slow but okay). It's very good at 30 users, but
 there is a whole community with galleries etc. on the same server.

 What i know:

 To avoid reloads, you must use a stream. That's the
 flush()'n'sleep()-thing. This is my main-loop:

 01 ini_set(max_execution_time, 0);
 02 for(;;)
 03 {
 04 $newline = get_newline($last_row);// fetch a new line (out of an
 database for example, returns time, alias, text as array, or false if no new
 line is found)
 05  if(is_array($newline))
 06  {
 07   $newtext = format($newline);// format line for output (text
 bla could be (01:01) Alias: bla and /me bla could be Alias bla,
 returns the string to be outputtet to the browser)
 08   if($newtext AND $newtext != $oldtext) echo $newtext;// if it's
 new text (avoids flooding), output the line!
 09   $last_row = $newline[id];// next time fetch another id
 10   flush();// sends buffer to browser
 11   echo \n!-- for Opera --\n;// Opera seems to use a strange
 buffer and does not display the last line, so send another one, invincible
 12   flush();// flush again, opera should now display the line
 13  }
 14  unset($newline);
 15
 16  usleep(20);// sleep some time, otherwise the script would
 eat 100% CPU. Usuable on my server (p3-550) are 10 to 50 msec
 17
 18  $loop++;
 19  if($loop  600)
 20  {
 21   echo !-- TOK --\n;// some browsers kill the connection if
 it is dead for some time, so send a time out kill, some minutes are enaugh
 22   $loop = 0;// reset
 23  }
 24 }

 Okay, tha's the deal..

 max_execution_time is set to unlimited, I had streams running several
 days. Fortunately PHP kills the scripts automatically if no brower is
 listening.

 To fetch a line there are some ways the most simple is to query a
 database for a line with an higher id, but this eats up loads of cpu-usage
 in bigger chats. Currently i use shared memory. I've an php-console-script
 running wich fetches newline out of the database and writes 'em into shared
 memory. This is MUCH faster than have every stream-script connecting to the
 db.

 What i don't know:

 I'm searching for an better idea to interchange data between the scripts
 wich enter data, the server and the stream-scripts. Shared memory is good
 enaugh for the last two one, but it ever takes min. the 20 ms sleep-time
 for a new line. I need something to awaik the script exactly when a new line
 is in memory.
 Synchronisation between enter and server is more difficult, because there is
 the posibillity for two scripts entering a new line at the same time
 don't know how to avoid this.

 I hope this helps.

Hey cool,
That's working. The only problem I have now is that I want the most recent text
at the top. But that script adds it on the bottom. Any way to change that? At
least a way to always scroll automatically to the bottom?
Cya,
Olli



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Chat with php

2002-10-08 Thread Oliver Witt

Thomas Weber schrieb:

 I've thought about adding the text on the top, but never found a good way to
 make that (not with plain HTML, it would require a java-applet to display
 the stream).
 Scrolling is quite simple, i use this:

 head
   SCRIPT language=JavaScript
   !--
doscroll = true;
function Scroller() {
if (doscroll != false) {
window.scrollBy(0,15);
  }
  window.setTimeout(Scroller(),15)
}
Scroller();
parent.atok = 'CCOFs';
function atok(p1) {
parent.atok = p1;
}
   //--
   /SCRIPT
  /head
  body onFocus=doscroll=false onBlur=doscroll=true
 onMouseOver=doscroll=false onMouseOut=doscroll=true
 ...

 It scrolls down whenever the mouse is outside the frame with the stream.

 Cya,
 Thomas 'Neo' Weber


Cool, the scroll script is working well.
Now, I'm working on a list that shows who's in the chat. The problem is that
people who log in don't always log out. I've thought about some time out and
automatical log out, but isn't there a way to determine who is on what page, at
least how many are on it?
Greetings,
Olli


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Chat with php

2002-10-07 Thread Oliver Witt

I attempted to write a oage that you can chat on with php. It ended up
being a page that reloads itself all the time which isn't really what I
wanted. But I didn't know how to do it differently. Is there another
way? I heard something about flush()?
Kind regards,
Oliver


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Chat with php

2002-10-07 Thread Oliver Witt

Brad Dameron schrieb:

 Another way is to use javascript with PHP to pull the database every so many
 seconds. I have seen this in I think it was PHPChat. Been a long time
 however.


Well, that's pretty much how I've done it. And it is pretty crappy...
Olli



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Chat with php

2002-10-07 Thread Oliver Witt

Marco Tabini schrieb:

 Simple trick (well, not so simple, but kind of a Columbus' Egg):

 1) Create an img tag in your web page that is hidden

 2) Point the img tag to a php script that returns:

 1) An image with a pixel width of 1 if there is new data to pick
up from the server
 2) An image with a pixel width of 0 otherwise

 3) Create a javascript that refreshes the image every second (or every
 two seconds, or however often you feel necessary--the more often, the
 more responsive and real time your chat system will be).

 4) Add an OnLoad event to the img tag that points to a Javascript that
 checks the width of the newly reloaded image. If the width is one, then
 you reload your chat text content (which you may want to put in an
 iframe to avoid having to reload the whole page).

 I don't have a script to show unfortunately, as it would probably be too
 complicated and long for the list (and I have no time to write
 it...sigh), but hopefully, this will give you the gist of it.

 Cheers,

 Marco


Okay, that sounds like something i can do, i just need to know how to hide
and how to point the img tag at something.
Olli



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [Fwd: Re: [PHP] Chat with php]

2002-10-07 Thread Oliver Witt

Marco Tabini schrieb:

 Ok, off the top of my head (please don't be upset if it doesn't work
 right off, because I'm doing this from memory):

 Web page:

 script language=javascript

 function checkimage()
 {
 if (document.all.image1.width == 1)
 {
 document.all.fr1.src=http://www.mysite.com/chat.php;;
 }
 }

 function reloadimg()
 {
 document.all.image1.src=http://www.mysite.com/img.php;;
 setInterval (reloadimg(), 2000);  // every 2 secs
 }

 /script

 body
 iframe name=fr1 src=chat.php

 img style=display=none src=http://www.mysite.com/chat.php;
 onLoad=javascript:checkimage();
 /body

 In chat.php you simply push out whatever is in the database (the whole
 thing--or you come up with some method of just printing out what has
 changed since the last poll, which is trivial and beyond the point
 here).

 In img.php:

 ?

 function checkdb()
 {
 // This returns true if new data is available
 }

 $filename = (checkdb() ? '1pixel.gif' : '2pixel.gif');

 header (Content-type: image/gif);
 readfile ($filename);

 ?

 1pixel.gif is a one-pixel wide image, while 2pixel.gif is two pixels
 wide (it just occurred to me that you can't have a zero-pixels wide
 image, which would be quite pointless). The script basically reads in
 either file and spits it out after setting the content type.

 Once more, this script, as is, probably won't work because it was
 programmed in my messy head rather than in a proper PHP environment, but
 it should give you an idea of what needs to be done. In particular,
 remember to use the display CSS attribute rather than visibility so
 that the image will not take up any space on your page.

 Also, an apology--I seem to have mailed some messages twice by mistake.
 I was checking e-mail between eating my lunch and trying to get a tie on
 and things might have gotten a bit out of hand ;-)

 Let me know how it turns out!


Thanks, I will try that script as soon as I find some time, probably tomorrow.
But it seems to do the same thing as reloading would do: clicking all the time.
But I'll try it tomorrow.
Kind regards,
Oliver


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: PHP source code

2002-09-20 Thread Oliver Witt

Michael Geier schrieb:

 PHP Source code is only available on the server, and will never be shown to
 the client (unless you create a tool to allow them to see the source;
 see show_source() );

 And you can always put your authentication data (username/passwords) in an
 external include() file

 auth.inc:
 ?
 $username = foo;
 $password = bar;
 ?

 page.php:
 ?
 include ('[secure directory outside of web tree]/auth.inc');
 mysql_connect(dbname,$username,$password);
 ?

 of course, if you are on a shared-host web server (multiple clients on the
 same server), you are only as secure as the weakest idiot that
 configures/administrates the server, IMHO.

Won't the server ask for authorization if the included PHP script is in an
directory accessible with .htaccess-Authorization?
Oliver




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] PHP source code

2002-09-19 Thread Oliver Witt

Hi,
Is there any way to read php source code? I didn't think so until I
heard about people you have done that...
Kind regards,
Oliver


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: PHP source code

2002-09-19 Thread Oliver Witt

Stephan Seidt schrieb:

 On Thu, 19 Sep 2002 16:50:16 +0200
 [EMAIL PROTECTED] (Oliver Witt) wrote:

  Hi,
  Is there any way to read php source code? I didn't think so until I
  heard about people you have done that...
  Kind regards,
  Oliver
 

 If you mean php's source, download it ;)

Well, but if I write a script with MySQl, there has to be my user name
and password in the source code. If anybody could read it, anybody could
have access to my databases!
Oliver




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Attachements

2002-08-25 Thread Oliver Witt

Fongming schrieb:

 Hi:

 the following is my easy way to send MIME mail with a
 attach files. It worked for my own mailing system.

 //---Make sure if a file upload or not...

 if(!empty($my_file))
 {

 copy($my_file,files/$my_file_name);
 $fp=fopen(files/$my_file_name,r);
 //---compose the
 MIME

 $version=MIME-Version: 1.0 \n;  //declair the version
 $boundary =b.md5(uniqid(time())); //make the boundary
 $body_message=$content.$bottom.\n\n--$boundary \n;
 $my_add_file=Content-Type: .$my_file_type.;\n
 name=\.$my_file_name.\\n.
 Content-Disposition: attachment; \n
 filename=\$my_file_name\ \n.
 Content-Transfer-Encoding: base64 \n\n;
 $the_file_content= chunk_split(base64_encode(fread
 ($fp,filesize(files/$my_file_name;
 //use base64 method to encode the file.
 $my_add_file .= $the_file_content; //the file
 content added.

 //
 $the_part=Content-Type: multipart/mixed; .
   boundary = $boundary \n\n.
   This is a  MIME encoded mesaage. \n\n--
 $boundary\n\n;
 $the_part2=Content-Type: multipart/alternative; .
 boundary = $boundary .
\n\n--$boundary;

 $mime .=From: .$main_address.\n;
 $mime .=Cc: .$other_address.\n;
 $mime .=$version;
 $mime .=$the_part;
 $mime .=$body_message;
 $mime .=$my_add_file;
 $mime .=--$boundary-- \n;

 mail($main_address,$title,,$mime);
  ?
 script
 alert(you succeed to send a MIME mail);
 location.href=list.php;
 /script
  ?  exit;
 }

 -
 This mail sent through IMP: http://web.horde.org/imp/

Looks like a have to have a directory with write permissions where
people can upload their files to. Isn't that sort of a security risk?
Olli



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] .htaccess

2002-08-02 Thread Oliver Witt

Hi!
Using an .htaccess file to limit access to some web files, is there a
way to get the name and password into a variable used by a user to log
on?
Kind regards,
Oliver


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] uploading pictures

2002-07-27 Thread Oliver Witt

Alexander Kuznetsov schrieb:

 Hello Oliver,

 Thursday, July 25, 2002, 1:42:05 PM, you wrote:

 OW Alexander Kuznetsov schrieb:

  i think u should set write permissions to directory
  where u r trying to copy file

 OW Thank you for answering.
 OW But how do I set write permisisons? With a .htaccess file?
 OW Oliver

 i think the reason is write permission on file system of the server
 and u have to type chmod command:

 shell chmod a+r /place/to/put/uploaded/file

 P.S. When reply message use Reply-To All option for you answer will be
 accessible in PHP-general mailing list ;)

 --
 Best regards,
 Alexander Kuznetsov

I got a ftp program that i wanna use to set write permission. It tells me
to enter it like that:
site chmod %a[Mode] %a[Filename]
I still don't know how to do it, can somebody please give me an example?
Oliver


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] uploading pictures

2002-07-25 Thread Oliver Witt

Hi!
I got a problem with uploading pictures. Using a script following this
schema:

if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) {
copy($HTTP_POST_FILES['userfile']['tmp_name'],
/place/to/put/uploaded/file);
} else {
echo Possible file upload attack. Filename:  .
$HTTP_POST_FILES['userfile']['name'];

 the script always returns:
Warning: Unable to create '/*.jpg': Permission denied in fotos2.php on
line 62

I do not understand why that happens. Do I need to include a password
somewhere or somehitng like that? Thank you for your help!
Oliver



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php