Re: [PHP] users online

2005-04-03 Thread Ewout de Boer
Ryan A schreef:
 Hi,
 I have been searching the archives with little luck so I need a reminder
 here,
 I remember a little while ago someone asked how  to implement the users
 online functionality
 that some sites have...now i have been asked to do exactly that but with a
 small twist:
 instead of displaying xx number of users online they want me to display
 all the usernames who are online
 with a link to their profile.
 
 I have a few ideas on how this can be done, but I would like advise from
 people who have already done this
 or thought of doing it (i think there was also a class that does something
 like this i'll check while waiting for a reply from you guys) so i can
 compare it with my ideas (which are in the infancy stage ;-)  )

Easiest way of doing this is adding a 'last seen' field to your user
profiles and updating that record with the current timestamp every time
the user requests a page.

Al you need to do when displaying the 'users online' info is getting al
profiles with the 'last seen' record on a time between now and x minutes
ago (depending on what you consider to be an 'online' user).

If you're using a database like mysql or postgresql for profile storage,
use a field type that the database software can handle internaly, this
can speed up the query.


regards,
Ewout

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



[PHP] Strange results from file_get_contents using an url as filename

2004-12-28 Thread Ewout de Boer
I'm getting unexpected data from my file_get_contents function using an url
as filename.

The function does not return false, i do get data from it. Problem is that
is is not the data is requested.


  $data =
file_get_contents(http://somehost.com/xmlonl.asp?custid=00prodid=0
);

  if ($data)
  {
...


the string this function returns is the webpage from the default website of
the server where this php code is running at and not the data from the
remote site (which is not on the same server).

i tried the url from my shell on the server using telnet and it gets the
data i expected.

I can't figure out why php is getting the wrong results while telnet on the
same host gets the correct data. Is this a (known) error with php or is it a
apache/php/server configuration problem ?


regards,
Ewout

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



[PHP] [SOLVED] Re: [PHP] Strange results from file_get_contents using an url as filename

2004-12-28 Thread Ewout de Boer
 I'm getting unexpected data from my file_get_contents function using an
url
 as filename.

 The function does not return false, i do get data from it. Problem is that
 is is not the data is requested.

The ISP made a mistake in the server config :-( ... it works again



regards,
Ewout

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



Re: [PHP] Session handlers

2004-10-02 Thread Ewout de Boer

- Original Message - 
From: Shawn McKenzie [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, October 02, 2004 2:11 AM
Subject: [PHP] Session handlers


 Just curious, what is the advantage of using a custom session handler,
 such as saving session data in MySQL?

security !

The default location for php to store session data is the tmp directory of
the host os (like /tmp), and in most cases these files are readable by the
webserver... and by all other scripts it's running. So if you're hosting
your site on a shared server other users can read your session data, that's
fine as long as you don't use it to store critical information like
username, password

some more info on this topic:

http://shiflett.org/talks/phpworks2004-php-session-security/



regards,
Ewout

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



[PHP] Reading a image resource

2004-03-16 Thread Ewout de Boer
Is there a function to get the raw image data from a image resource ?
(resource created by imagecreatefrom)

I want to read and manipulate an image from a file and store it in a
database without the use of a temp. file




regards,
Ewout

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



RE: [PHP] form variables

2003-12-20 Thread Ewout de Boer


-Oorspronkelijk bericht-
Van: Nitin [mailto:[EMAIL PROTECTED] 
Verzonden: zaterdag 20 december 2003 7:30
Aan: PHP-General
Onderwerp: [PHP] form variables


 i've an application, where i'm receiving variables from an html form and
process them in the script. depending on the values, i may want to get some
extra information from user through another form. now, problem is how can i
keep the vaiables received from the first form, without passing them as
query string to the next script or specifying as hidden form fields.


You could use sessions to keep track of your data between different scripts
without reposting anything

http://www.php.net/manual/en/ref.session.php



Regards,
Ewout

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



Re: [PHP] manual key generation

2003-10-25 Thread Ewout de Boer

- Original Message - 
From: Joao Andrade [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, October 26, 2003 12:31 AM
Subject: [PHP] manual key generation



 Aloha!

 I have a script that inserts a new row in a table called quotations,
 which has a primary key called quotation_id. quotation_id is an
int(11)
 type. When I enter:

 SELECT MAX(quotation_id)+1 from quotations

 I get simply the number 7 (which is ok)

 But when I do:

 $new_key = mysql_query(SELECT MAX(quotation_id)+1 from quotations)

 I get $new_key = Resource id #3

 What the hell is that supposed to mean?

As the error-text says... mysql_query returns a result id

use this code instead:

$mri = mysql_query(SELECT MAX(quotation_id)+1 from quotations);
$result = mysql_fetch_row($mri);
$new_key = $result[0];

see the php.net website for details !




// Ewout

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



Re: [PHP] Parsing MySQL query return

2003-07-28 Thread Ewout de Boer
- Original Message - 
From: John [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, July 28, 2003 8:22 PM
Subject: [PHP] Parsing MySQL query return


 Hey All,

 I have a question regarding parsing text from a MySQL query. Basically, I
 have several paragraphs of text in a field in MySQL. I run a query, get
the
 results, no problem. However, I would like to only display the first
 paragraph of the data returned.

 What is the best way to do this?

That depends on te format of the text/paragraphs in the mysql field.
How are the paragraphs separated ?



regards,
Ewout


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



Re: [PHP] Re: More mail() questions.

2002-11-26 Thread Ewout de Boer
Try '\r\n' instead of '\n'



regards,

Ewout de Boer

- Original Message -
From: Beauford.2002 [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; Kyle Gibson [EMAIL PROTECTED]
Sent: Tuesday, November 26, 2002 10:17 AM
Subject: Re: [PHP] Re: More mail() questions.


 Thanks for the reply, however, that will not work.  The only line breaks
you
 may get with that are those layed out in a text box or from your mail
 client. What if I have other variables that need to be put in the body of
 the email.

 i.e.

 Age: 16
 Height: 168
 Weight: 120
 etc
 etc
 etc.

 These are variables that the user inputs into a form and need to be on a
 seperate line, so if I did $message = $age, $weight, $height, etc. they
 would appear on the same line - I need to have them on separate lines.

 - Original Message -
 From: Kyle Gibson [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, November 25, 2002 10:54 PM
 Subject: [PHP] Re: More mail() questions.


   I am  trying to get the message portion of the email to have line
 breaks,
   but  whatever I do it displays on one line. This is what I have.
  
   $message = 1st Line\n;
   $message .= 2nd Line\n;
   $message .= \n;
   $message .= 3rd Line\n;
   $message .= \n;
   $message .= 4th Line\n;
  
   mail (, $subject, $message, $headers);
  
   TIA
 
 
  As far as I've encountered, you can simply do the following:
 
  ?
 
  $message = 
  This is the message I
  wish to send with linebreaks...
 
 
 
  all the way down here.
  ;
 
 
  mail (, $subject, $message, $headers);
 
  ?
 
 
 
  --
  Kyle Gibson
  admin(at)frozenonline.com
  http://www.frozenonline.com/
 
 
  --
  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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Need difficult help !

2002-11-15 Thread Ewout de Boer
You could try something like this:


$verylongstring
$data = ... // your cut function
$verylongstring = substr($verylongstring, strln($data);



regards,

Ewout de Boer

- Original Message -
From: Hacook [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 15, 2002 11:39 AM
Subject: [PHP] Need difficult help !


 Hi all,
 I have a very long charachter chain which is like that :

 Number*link*name*Number*link*name*Number*link*name*Number*link*name*

 I made a php script to cut it thanks to the * to make a list with a
 number, and the name hyperlinked to the link.
 The thing is that after i get a data (number, link or name), i use
 str_replace to cut it off the chain to get the next one.
 But as my numbers are sometime the same, i have troubles because it cuts
all
 the same numbers off.
 Can i just cut one ?
 Thanks a lot for reading me and maybe answer me ? :-)



 --
 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] php Wildcard???

2002-11-15 Thread Ewout de Boer
You mean the opening tag ?

For php use ?php  {code here} ?


regards,

Ewout de Boer

- Original Message -
From: vernon [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 15, 2002 4:32 PM
Subject: [PHP] php Wildcard???


 Hey all, I'm coming over from programming ASP in VBScript and I know that
a
 wildcard there is '%' can anyone tell me what it is in PHP? Thanks.



 --
 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] Need difficult help !

2002-11-15 Thread Ewout de Boer
Oops !

My mistake.. it's strlen()

substr = substring .. see http://www.php.net/substr


regards,

Ewout de Boer


On Fri, Nov 15, 2002 at 12:03:34PM +0100, Tristan Carron wrote:
 The strln() function is unknown...
 To understand the script, could you please tell me what the substr()
 function does ?
 Thanks a lot,
 Hacook
 
 - Original Message -
 From: Ewout de Boer [EMAIL PROTECTED]
 To: Hacook [EMAIL PROTECTED]
 Cc: PHP General [EMAIL PROTECTED]
 Sent: Friday, November 15, 2002 11:59 AM
 Subject: Re: [PHP] Need difficult help !
 
 
  You could try something like this:
 
 
  $verylongstring
  $data = ... // your cut function
  $verylongstring = substr($verylongstring, strln($data);
 
 
 
  regards,
 
  Ewout de Boer
 
  - Original Message -
  From: Hacook [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Friday, November 15, 2002 11:39 AM
  Subject: [PHP] Need difficult help !
 
 
   Hi all,
   I have a very long charachter chain which is like that :
  
   Number*link*name*Number*link*name*Number*link*name*Number*link*name*
  
   I made a php script to cut it thanks to the * to make a list with a
   number, and the name hyperlinked to the link.
   The thing is that after i get a data (number, link or name), i use
   str_replace to cut it off the chain to get the next one.
   But as my numbers are sometime the same, i have troubles because it cuts
  all
   the same numbers off.
   Can i just cut one ?
   Thanks a lot for reading me and maybe answer me ? :-)
  
  
  
   --
   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] PHP Auth with Apache

2002-11-14 Thread Ewout de Boer
PHP sends a '401 Authorization required' to your browser (just like apache)
and it also gets the user/password info

Code example:

?php
if(!isset($PHP_AUTH_USER)) {
Header(WWW-Authenticate: Basic Realm=\Secret Page\);
Header(HTTP/1.0 401 Unauthorized);
   echo You did not log in correctly...\n;
exit; # exit wil stop php from parsing the rest of the script
} else {
echo Hello $PHP_AUTH_USER. You entered $PHP_AUTH_PW as your
password;
}
?

In this example no user/passwd checking is done... just replace the
'welcome' message with your mysql/ldap check routine and voila !


regards,

Ewout de Boer

- Original Message -
From: [EMAIL PROTECTED]
To: Ewout de Boer [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, November 14, 2002 5:42 PM
Subject: Re: [PHP] PHP Auth with Apache



  I'm now understanding how you can get PHP to present you with a username
 and password promt just like APache would do if you had a .htaccess file
 in the directory you were trying to enter. Great idea but it seems that it
 would be easier to just use the .htaccess file in the directory.

  What I've been trying to find out is how to pass through a .htaccess file
 if someone has already passed an database authentication lookup in PHP.

 I have an area on my site Special Publications where users login and
 their username and password is checked against a MySQL database. One field
 in their user records is the URL to their directory on our server. Each
 one of these directories is protected via .htaccess. What I would really
 like to do is have them redirected to their URL if they pass
 authentication and not have them enter their username and password again.
 Is their a way to do this?

 Thanks,

 Ed



 On Wed, 13 Nov 2002, Ewout de Boer wrote:

  in httpd.conf
 
  Directory /scriptdir
  AllowOverride AuthConfig
  /Directory
 
 
  More info at http://httpd.apache.org/docs/mod/core.html#allowoverride
 
 
  regards,
 
  Ewout
 
 
  - Original Message -
  From: Alexander Bemme [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Wednesday, November 13, 2002 12:02 PM
  Subject: [PHP] PHP Auth with Apache
 
 
   Hi,
   i got a little problem (i hope so)
  
   I have installed Apache 1.3.26 and PHP 4.2.3 as module.
  
   I used the example from www.php.net to do a PHP authentication,
   but it didn't work, the pop appears but i can't login.
  
   In PHPManual is someting about AuthType but nothing about how
   to fix it.
  
   Can someone help out?
  
   Thanks
  
   --Alex
  
  
  
   --
   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 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] Regular Expression trouble

2002-11-14 Thread Ewout de Boer
You could exclude the '}' sign from the expression

$content = ereg_replace(\{[^}]*},,$content);

This should do the trick... i'm not 100% certain about the '[^}]'
expression, but you should find it in any regexp tutorial


regards,

Ewout de Boer

- Original Message -
From: Brent Baisley [EMAIL PROTECTED]
To: php-gen [EMAIL PROTECTED]
Sent: Thursday, November 14, 2002 7:32 PM
Subject: [PHP] Regular Expression trouble


 I'm trying create form template as I have seen recommended in many
 places. It seems fairly simple but I can't seem to get ereg_replace to
 work the way I want it.
 I'm starting off easy and I want to use the sample template for entering
 a new record or editing an existing one. If they are editing, then I
 obviously want to populate the form fields with values. If it's a new
 entry, I don't want any values. Simple enough.

 A form entry looks like this:
 input type=text ... value={Name}
 input type=text ... value={Title}

 So I load the template into a variable using ob_start(), etc. I assumed
 that to clear out all the value declarations I would simply do this:
 $content = ereg_replace(\{.*},,$content);

 But it seems to be replacing everything between the first instance of
 { and the last instance of }, rather than each instance of {}. I've used
 regular expressions before and I even tested it using grep in BBEdit 6.5
 and it works as I would expect. I'm using PHP 4.1.2 on Mac OSX 10.1.5.

 --
 Brent Baisley
 Systems Architect
 Landover Associates, Inc.
 Search  Advisory Services for Advanced Technology Environments
 p: 212.759.6400/800.759.0577


 --
 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] icmp ping, check port, etc.

2002-11-14 Thread Ewout de Boer
You could exec the ping command and analyze its output using regular
expressions.



regards,

Ewout de Boer


- Original Message -
From: Bryan Koschmann - GKT [EMAIL PROTECTED]
To: PHP General [EMAIL PROTECTED]
Sent: Thursday, November 14, 2002 8:09 PM
Subject: [PHP] icmp ping, check port, etc.


 Hello,

 I've been looking into setting up a site to check the hosts on my network.
 Basically, I want it to ping each host and tell whether it is up or not,
 then also check various services (www, ftp, smtp, pop3, dns, ssh) and see
 if they are available. This would check either for a connection refused or
 a timeout. I am wondering first, how to do the icmp ping. Then, will
 fsockopen work for both seeing if the port is open, and checking for
 timeout? I'm sure I can play with fsockopen and figure it out, but I
 wanted to ask and make sure it was possible first. The ping portion is
 where I am stuck at.

 Any help would he greatly appreciated!

 Thanks,

 Bryan


 --
 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] returning unique values in columns

2002-11-14 Thread Ewout de Boer
use: SELECT DISTINCT column FROM table



regards,

Ewout de Boer


- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, November 14, 2002 10:17 PM
Subject: [PHP] returning unique values in columns


 Is there any way to run a query in mysql that retuns unique values in a
 column?  For example, say i had this colum:
 
 Column:
 -
 Fashion
 -
 Basics
 -
 Fashion
 -
 Plus
 
 Plus
 -
 
 but I only want it to return unique values - in this case I would only
 want Fashion, Basics, Plus - instead of the Fashion, Basics, Fashion,
 Plus, Plus I would get if I had run: SELECT column FROM tblname;
 
 any help would be greatly appreciated...
 

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




Re: [PHP] Can't escape characters in php??

2002-11-14 Thread Ewout de Boer

- Original Message -
From: Lars Espelid [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, November 14, 2002 9:59 PM
Subject: [PHP] Can't escape characters in php??


 Hello,

 I'm running Apache/1.3.26 and PHP 4.0.5 on WinXP pro.

 Also  '\n' in an echo-expression won't work. It is ignored.
 code:
 echo HELLO \n;
 echo WORLD;

 result:
 HELLO WORLD

 What can be wrong? Do I miss a library or something??

You are using a browser for the output ?

when you use \n you'll see a nice newline in the html source your
browser expects html so use html code !
(newline in html is br)



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




Re: [PHP] PHP Auth with Apache

2002-11-13 Thread Ewout de Boer
in httpd.conf

Directory /scriptdir
AllowOverride AuthConfig
/Directory


More info at http://httpd.apache.org/docs/mod/core.html#allowoverride


regards,

Ewout


- Original Message - 
From: Alexander Bemme [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, November 13, 2002 12:02 PM
Subject: [PHP] PHP Auth with Apache


 Hi,
 i got a little problem (i hope so)
 
 I have installed Apache 1.3.26 and PHP 4.2.3 as module.
 
 I used the example from www.php.net to do a PHP authentication,
 but it didn't work, the pop appears but i can't login.
 
 In PHPManual is someting about AuthType but nothing about how
 to fix it.
 
 Can someone help out?
 
 Thanks
 
 --Alex
 
 
 
 -- 
 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