[PHP] Re: who's on-line application - php

2005-02-15 Thread Stefan Dengscherz
Hello,

usually you can not determine clearly who is online on your website at the
moment because http is a session-less protocol (thus php implements a session
mechanism through cookies or session id). However you can use the following
approach:

- add a 'last_seen' field to the users table of your website
- update that field for the user everytime he calls a page on your site
  (e.g. include(updatels.php); on every page)
- to get the number of (probably still) online users do a 'select from
  user_table where now()-lastseen  3 minutes'

another method would be changing the session handler to store session data in
the database and query the sessiontable appropriately.


best regards,

Stefan Dengscherz


On Mon, Feb 14, 2005 at 04:30:32PM +0200, Jacques wrote:
 I would like to indicate the particulars (from a MySQL database) of all
 those users that are currently on-line (those whom have successfully signed
 in). How should I go about achieving this? Does it have something to do with
 Sessions?
 
 I am developing in PHP.
 
 Regards
 
 Jacques
 
 -- 
 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] Re: Users logins in Linux machine

2005-02-14 Thread Stefan Dengscherz
Hello,

changing the system password requires root privileges, because it needs to
modify the /etc/shadow file. Thus either I would put the password change
requests into a mysql table or text file and run a cronjob as root which
checks e.g. every 15 minutes if there are new pw change requests. If there
are new ones, an expect (tool to control interactive programs) script gets
executed by root which changes the system password depending on the request.
However this method could be insecure depending on the setup of your scripts.

Another approach would be letting the users change their system passwords by
setting their shell to /usr/bin/passwd, so they only get the change password
prompt when they login to the server with their account. This would also send
the new password over a secured connection (implies using ssh to login).

I don't know if there are any big security risks by setting the shell to
passwd. Correct me if I am wrong :)


best regards,

Stefan Dengscherz


On Sat, Feb 12, 2005 at 04:24:57PM +, Bruno Santos wrote:
 Hello all.
 
 I've a linux server that runs a mailserver for several users. I want to 
 build a page where users can change their email password, that's their 
 accounts password.
 
 how can i with PHP manage to compare the password they type in a web 
 form with the one they have in the system ?? (/etc/passwd) ??
 
 can it be with LDAP ? or PAM ? or any other method ?
 
 cheers !
 
 Bruno Santos
 
 -- 
 Say no to software patents
 www.nosoftwarepatents.com/
 --
 [EMAIL PROTECTED]
 --
 Divisao de Informatica
 [EMAIL PROTECTED]
 Tel: +351 272 000 155
 Fax: +351 272 000 257
 --
 Hospital Amato Lusitano
 [EMAIL PROTECTED]
 Tel: +351 272 000 272
 Fax: +351 272 000 257
 
 -- 
 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



Re: [PHP] Quick imageSize question

2004-10-13 Thread Stefan Dengscherz
Hello,
that's usually not possible because your webserver can't access the image
on your computer; a possible solution might be to determine the image size
via javascript and submit it with the form, so you can accept or deny the
image upload in your php script - problem: with javascript running on client
side, this is not foolproof. Anyways i don't know exactly how to solve it with
javascript even, so please correct me, if i'm talking crap here.

Best regards,

-sd

On Wed, Oct 13, 2004 at 07:37:29AM -0700, Mag wrote:
 The problem with the above is I can only get the
 dimensions AFTER the file has been uploaded and is on
 disk,which is quite a pain in the ... coz I want to
 accept only images that are smaller than x pixels
 width and then i have to tell the client that their
 upload failed coz their image is too big...is there
 any way to get the dimensions before the upload is
 done?

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



Re: [PHP] preg_replace problem

2003-06-17 Thread Stefan Dengscherz
Hello,

?php

$parsed = preg_replace(/(\ba\b)/i,tag\\1/tag,$sourcestring);

?

should do the job.

regards

Am Die, 2003-06-17 um 13.25 schrieb Vincent Bouret:
 Hi,
 
 I am having this problem with preg_replace. I want the following thing but I
 can't understand what regular expression I should put.
 
 I want to replace all occurences of a given **whole** word into a string.
 
 For example:
 
 I want A dog jumped over a ladder to become xyzA/xyz dog jumped over
 xyza/xyz ladder.
 
 I **don't** want: A dog jumped over a ladder to become xyzA/xyz dog
 jumped over xyza/xyz lxyza/xyzdder.
 
 You understand what I mean? I can't do that will str_replace, but I know it
 would be quite easy with preg_replace. Can someone help me?
 
 Thanks
 
 Vincent
 
 
 


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



Re: [PHP] Re: php editor?

2003-06-16 Thread Stefan Dengscherz
Hi James,

Quanta has built in syntax highlighting for PHP; i have made a small
screenshot: http://www.chowned.us/sd/quanta-php.png

regards

Am Mon, 2003-06-16 um 17.49 schrieb James Hatridge:
 Hi John et al,,
 On Sunday 15 June 2003 02:09, John Nichel wrote:
 
 Linux I  use Quanta.
 
 Do you know how (or if) to get Quanta to color code PHP like it does html? If 
 I could get that then Quanta would be almost perfit.
 
 Thanks
 
 JIM
 
 -- 
 Jim Hatridge
 Linux User #88484
 --
  BayerWulf
Linux System # 129656
  The Recycled Beowulf Project
   Looking for throw-away or obsolete computers and parts
to recycle into a Linux super computer
 


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



Re: [PHP] HTML...

2003-06-16 Thread Stefan Dengscherz
Hello,

 select name='email_recipients' size='6' multiple

change this to select name='email_recipients[]' ...

you can then easily access the multiple selections by walking the array:

for ($i=0;$isizeof($email_recipients);$i++) 
{
 echo $email_recipients[$i];
 echo br /;
}

regards


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