[PHP] password in the mysql table 'auth'

2004-10-08 Thread 22
Concerning Auth
How to set username and password in the  mysql table 'auth'.
Nothing has resulted from  direct entry into the table.

Vlad Alivanov 


RE: [PHP] code not working...help?

2004-10-08 Thread Graham Cossey
[snip][snip]

 Secondly I find it easier (to read) to code my SQL statements thus:

 $countResult = db_query(SELECT count(*) AS msgCount FROM messages WHERE
  uid='$userID' AND fid='$fid' AND post_date='$lastmonth');

 [snip]
 /quote ---

  I find queries even easier to read when they are written like this:

 $countResult = db_query(SELECT count(*) AS msgCount
  FROM messages
  WHERE
 uid='$userID' AND
 fid='$fid' AND
 post_date='$lastmonth'
  );


So do I, and I do actually format my queries like that in my code, I was
concentrating more on string evaluation by using  instead of lots of
concatenations with .

Graham

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



[PHP] Array concatenation behaviour change

2004-10-08 Thread rich gray
Just a heads up on this change in array concatenation behaviour that
could cause a few probs for some people...

?
$arr1 = array(0 = 'Zero');
$arr2 = array(1 = 'One',2 = 'Two');

$arr2 = $arr1 + $arr2;
echo phpversion().'br /';
print_r($arr2);
?

this code produces on our provider's server...

4.2.3
Array ( [0] = Zero [1] = One [2] = Two ) 

and on my development server...

4.3.8
Array ( [1] = One [2] = Two [0] = Zero ) 

hth
rich

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



RE: [PHP] Help with Array Sorting Please

2004-10-08 Thread Ford, Mike
On 07 October 2004 17:29, Nick Wilson wrote:

 Hi,
 
 If you scroll up the list you'll see another thread of mine, this is
 related. The reason for a new thread is that i've made a lot
 of progress
 but the old was getting really confusing..
 
 Here's the scoop:
 
 I have an array like this:
 
 123 = 1  // each value may have few or many duplicate values 321 = 1
 543 = 2
 432 = 2 // like here, more 2's than 1's see?
 566 = 2
 568 = 2
 999 = 3
 878 = 3
 444 = 3

That's not terribly good, as you are using the unknowns (ip addresses) as keys to 
the knowns (machine IDs).  It would be better keying off the machine IDs, although 
this does lead to a 2-level array; something like:

   array( 1 = array(123),
  2 = array(543, 432, 566, 568),
  3 = array(999, 878, 444)
)

 Now, the keys are not the issue. What i would really like, is for
 that array, to end up like this: 
 
 123 = 1
 543 = 2
 999 = 3
 321 = 1
 432 = 2
 878 = 3
 123 = 1
 566 = 2

OK. So you don't really want an array out of this, but a sequence of machine ID = IP 
address pairs.  Do you want this to cycle ad infinitum, or just until you've hit every 
IP address at least once?  In either case, using my restructured array, I think your 
basic loop looks something like this:

   // don't assume machine IDs are sequential:
   $mach_ids = array_keys($array);

   // this loop may look odd, but can't foreach $array itself as
   // that gives a copy and following code needs original.
   foreach ($mach_ids as $m_id):
  reset($array[$m_id]);
   endforeach

   foreach ($mach_ids as $m_id):
  list(,$ip) = each($array[$m_id]);
  if ($ip===FALSE):
 reset($array[$m_id]);
 list(,$ip) = each($array[$m_id]);
  endif;

  // do stuff with $m_id and $ip

   endforeach;

That's an endless loop -- there's no code in there to terminate it, so if you want to 
stop at some point you'll have to figure out the conditions to test and break out.

Usual disclaimer -- it's off the top of my head and untested!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



Re: [PHP] pdf_open_pdi_page

2004-10-08 Thread Hendrik Schmieder
Matt M. schrieb:
I was on that page.
There's nothing which comes close to your  assumption.
   

sorry, wrong link you dont need PDFlib+PDI.  Is that the license that you have?
here is an assumption.  I assumed you would read the pdflib manual, did you see?
Note All functions described in this section require PDFlib+PDI. The
PDF import library (PDI) is not contained in PDFlib or PDFlib Lite.
Although PDI is integrated in all precompiled editions of PDFlib, a
license key for PDI (or PPS, which includes PDI) is required.
 

I only  have read the php manual at
http://www.php.net/manual/en/ref.pdf.php..
This states that you only need a licence for commercial use.
I thought, that this only a legal point.
At the moment, I  try to investigate wheter I can do with pdflib what I
wanted to do with pdfs.
At least any documented function in the php manaul should work witout
any licence,
otherwise they shouldn't be described.
with best regards
 Hendrik Schmieder
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Sessions not destroyed

2004-10-08 Thread Hendrik Schmieder
Hello,
we have a severe problem with seesions.
We use Apache 1.3.31 with PHP 4.3.9 as Apache module in Windows 2000
In our php.ini we have
session.gc_probability = 100
session.gc_dividend= 100
session.gc_maxlifetime = 120
But even after 20 minutes the session file is still there.
And the session file ist also not deleted  if we then stop the apache 
service.

Has anybody an idea ?
TIA
  Hendrik Schmieder
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] function.filetime in PHP5

2004-10-08 Thread Nunners
Does anyone know what function.filetime has been replaced by in PHP5?

 

Cheers

Nunners



Re: [PHP] Array concatenation behaviour change

2004-10-08 Thread Gareth Williams
Can't you sort the array?
On 8 Oct 2004, at 10:41, rich gray wrote:
Just a heads up on this change in array concatenation behaviour that
could cause a few probs for some people...
?
$arr1 = array(0 = 'Zero');
$arr2 = array(1 = 'One',2 = 'Two');
$arr2 = $arr1 + $arr2;
echo phpversion().'br /';
print_r($arr2);
?
this code produces on our provider's server...
4.2.3
Array ( [0] = Zero [1] = One [2] = Two )
and on my development server...
4.3.8
Array ( [1] = One [2] = Two [0] = Zero )
hth
rich
--
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] function.filetime in PHP5

2004-10-08 Thread Marek Kilimajer
Nunners wrote:
Does anyone know what function.filetime has been replaced by in PHP5?
no such function ever existed. Choose one of the following:
filemtime
filectime
fileatime
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Sessions not destroyed

2004-10-08 Thread M. Sokolewicz
are you using the default PHP sessions? or are you using a custom 
session handler?

Hendrik Schmieder wrote:
Hello,
we have a severe problem with seesions.
We use Apache 1.3.31 with PHP 4.3.9 as Apache module in Windows 2000
In our php.ini we have
session.gc_probability = 100
session.gc_dividend= 100
session.gc_maxlifetime = 120
But even after 20 minutes the session file is still there.
And the session file ist also not deleted  if we then stop the apache 
service.

Has anybody an idea ?
TIA
  Hendrik Schmieder
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Sessions not destroyed

2004-10-08 Thread Hendrik Schmieder
M. Sokolewicz schrieb:
are you using the default PHP sessions? or are you using a custom 
session handler?

Hendrik Schmieder wrote:
Hello,
we have a severe problem with seesions.
We use Apache 1.3.31 with PHP 4.3.9 as Apache module in Windows 2000
In our php.ini we have
session.gc_probability = 100
session.gc_dividend= 100
session.gc_maxlifetime = 120
But even after 20 minutes the session file is still there.
And the session file ist also not deleted  if we then stop the apache 
service.

Has anybody an idea ?
TIA
  Hendrik Schmieder

We are using the default php sessions ,
This are all of our session settings;
[Session]
session.save_handler = files
session.save_path = D:\Worksheet-Server\apache\sessiondata
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 100
session.gc_dividend= 100
session.gc_maxlifetime = 120
session.bug_compat_42 = 1
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 1
url_rewriter.tags = a=href,area=href,frame=src,input=src,form=,fieldset=
with best regards
  Hendrik Schmieder
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Sessions not destroyed

2004-10-08 Thread Marek Kilimajer
Hendrik Schmieder wrote:
Hello,
we have a severe problem with seesions.
We use Apache 1.3.31 with PHP 4.3.9 as Apache module in Windows 2000
In our php.ini we have
session.gc_probability = 100
session.gc_dividend= 100
Should be session.gc_divisor. And you need to start at least one other 
session so that the first one gets cleared.

session.gc_maxlifetime = 120
But even after 20 minutes the session file is still there.
And the session file ist also not deleted  if we then stop the apache 
service.

Has anybody an idea ?
TIA
  Hendrik Schmieder
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] tool to check syntax

2004-10-08 Thread Stéphane THIBAUDEAU
Hello,

I'm looking for a tool which checks php syntax the way CheckStyle does for
Java for example.
(http://checkstyle.sourceforge.net/)

I'd like such a tool to warn me when a PHPDoc comment doesn't document every
parameters for a method, when there is no PHPDoc comment for a class or
method, when a method contains too many lines and so on...

I couldn't find any tool like that on the internet. I hope it exists.

Thanks in advance,
Stéphane

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



[PHP] fopen and http://

2004-10-08 Thread Adam Williams
Hi, I'm having a problem with fopen and http files.  I keep getting the 
error:

Warning: fopen(http://zed/htdocs/rgfindingaids/series594.html ) 
[function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 404 
Not Found in /home/awilliam/public_html/rgfaidstest.php on line 15
http://zed/htdocs/rgfindingaids/series594.html does not exist

Warning: fopen(http://zed/htdocs/rgfindingaids/ser391.html ) 
[function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 404 
Not Found in /home/awilliam/public_html/rgfaidstest.php on line 15
http://zed/htdocs/rgfindingaids/ser391.html does not exist

Warning: fopen(http://zed/htdocs/rgfindingaids/ser392.html ) 
[function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 404 
Not Found in /home/awilliam/public_html/rgfaidstest.php on line 15
http://zed/htdocs/rgfindingaids/ser392.html does not exist



I have a text file /home/awilliam/public_html/rgfaids containing URLs such 
as:

http://zed/htdocs/rgfindingaids/series594.html
http://zed/htdocs/rgfindingaids/ser391.html
http://zed/htdocs/rgfindingaids/ser392.html

and I can bring up these URLs fine in a browser on the PC i'm running the 
script on.

The following is my code:

?

$filelist = fopen(/home/awilliam/public_html/rgfaids, r);

if (!$filelist)
{
echo error opening rgfaids;
exit;
}

while ( !feof($filelist))
{
$line = fgets($filelist, 9);

$filetotest = fopen($line, r);

if (!$filetotest)
{
echo $line does not existbr;
}
elseif ($filetotest)
{
echo $line does exist;
}
}

?



But I don't understand why I am getting that error about failed to open 
strem: HTTP request failed, when I can bring up the links fine in a 
browser on the server running the php script.  So can anyone help me out?  
Thanks

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



Re: [PHP] fopen and http://

2004-10-08 Thread Matt M.
 But I don't understand why I am getting that error about failed to open
 strem: HTTP request failed, when I can bring up the links fine in a
 browser on the server running the php script.  So can anyone help me out?
 Thanks

do you have allow_url_fopen enabled? 

http://us4.php.net/manual/en/ref.filesystem.php#ini.allow-url-fopen

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



Re: [PHP] fopen and http://

2004-10-08 Thread Adam Williams
On Fri, 8 Oct 2004, Matt M. wrote:

  But I don't understand why I am getting that error about failed to open
  strem: HTTP request failed, when I can bring up the links fine in a
  browser on the server running the php script.  So can anyone help me out?
  Thanks
 
 do you have allow_url_fopen enabled? 
 
 http://us4.php.net/manual/en/ref.filesystem.php#ini.allow-url-fopen
 
 

Yes I do, in my php.ini I have:

;;
; Fopen wrappers ;
;;

; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
allow_url_fopen = On

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



Re: [PHP] Sessions not destroyed

2004-10-08 Thread Hendrik Schmieder
Marek Kilimajer schrieb:
Hendrik Schmieder wrote:
Hello,
we have a severe problem with seesions.
We use Apache 1.3.31 with PHP 4.3.9 as Apache module in Windows 2000
In our php.ini we have
session.gc_probability = 100
session.gc_dividend= 100

Should be session.gc_divisor
OK , changed in php.ini, but no change in behaviour.
And you need to start at least one other session so that the first one 
gets cleared.
If you are right, then this is a severe design bug.
 with best regards
Hendrik Schmieder
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] tool to check syntax

2004-10-08 Thread Robby Russell
On Fri, 2004-10-08 at 14:37 +0200, Stphane THIBAUDEAU wrote:
 Hello,
 
 I'm looking for a tool which checks php syntax the way CheckStyle does for
 Java for example.
 (http://checkstyle.sourceforge.net/)
 
 I'd like such a tool to warn me when a PHPDoc comment doesn't document every
 parameters for a method, when there is no PHPDoc comment for a class or
 method, when a method contains too many lines and so on...
 
 I couldn't find any tool like that on the internet. I hope it exists.
 
 Thanks in advance,
 Stphane
 

What about phpxref?

http://phpxref.sourceforge.net/

I use it for documentation and forcing myself to stick to a standard.

-Robby


-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
/



signature.asc
Description: This is a digitally signed message part


Re: [PHP] Sessions not destroyed

2004-10-08 Thread Marek Kilimajer
Hendrik Schmieder wrote:
Marek Kilimajer schrieb:
Hendrik Schmieder wrote:
Hello,
we have a severe problem with seesions.
We use Apache 1.3.31 with PHP 4.3.9 as Apache module in Windows 2000
In our php.ini we have
session.gc_probability = 100
session.gc_dividend= 100

Should be session.gc_divisor

OK , changed in php.ini, but no change in behaviour.
And you need to start at least one other session so that the first one 
gets cleared.

If you are right, then this is a severe design bug.
Depends on your point of view. It is a sideeffect of loading current 
session (and thus accessing it) before the session gc is called.

So the question is, should the session module give up on current session 
just because it should have been garbaged, even if the session file 
still exists?

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


[PHP] Quotes in form textarea fields

2004-10-08 Thread Sam Smith

I swear I googled for an hour first.


A user enters in a textarea field of FORM1.php:
Bob is high

Submitted to FROM2.php we get:

Bob is \high\

In a hidden field in FROM2.php we store the value: type=hidden, value=?
echo stripslashes($_POST['textarea']); ? Value now Bob is high

Then from FROM2.php we Submit BACK to FROM1.php and enter it back into the
textarea field with:
type=textarea, value=? echo $_POST['hidden']); ?

we have;
Bob is

Everything after the first double quote is clobbered.

I can fix this by putting this in FORM2.php:
$APParea1 = $_POST['textarea'];
$APParea1 = str_replace(\,[QT],$APParea1);

and then back by putting this in FORM1.php:
$APParea1 = $_POST['hidden'];
$APParea1 = str_replace([QT],\,$APParea1);

type=textarea, value=? echo $APParea1; ?


BUT THIS must have happened many times a long long time ago to many good
people and some smart function was developed, right?


Thanks

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



Re: [PHP] fopen and http://

2004-10-08 Thread Hendrik Schmieder
Adam Williams schrieb:
Hi, I'm having a problem with fopen and http files.  I keep getting the 
error:

Warning: fopen(http://zed/htdocs/rgfindingaids/series594.html ) 
[function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 404 
Not Found in /home/awilliam/public_html/rgfaidstest.php on line 15
http://zed/htdocs/rgfindingaids/series594.html does not exist

But I don't understand why I am getting that error about failed to open 
strem: HTTP request failed, when I can bring up the links fine in a 
browser on the server running the php script.  So can anyone help me out?  
Thanks

 

What say phpinfo about Registered PHP Streams ?
  Hendrik
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Quotes in form textarea fields

2004-10-08 Thread Robby Russell
On Fri, 2004-10-08 at 06:22 -0700, Sam Smith wrote:
 I swear I googled for an hour first.
 
 
 A user enters in a textarea field of FORM1.php:
 Bob is high
 
 Submitted to FROM2.php we get:
 
 Bob is \high\
 
 In a hidden field in FROM2.php we store the value: type=hidden, value=?
 echo stripslashes($_POST['textarea']); ? Value now Bob is high
 
 Then from FROM2.php we Submit BACK to FROM1.php and enter it back into the
 textarea field with:
 type=textarea, value=? echo $_POST['hidden']); ?
 
 we have;
 Bob is
 
 Everything after the first double quote is clobbered.
 
 I can fix this by putting this in FORM2.php:
 $APParea1 = $_POST['textarea'];
 $APParea1 = str_replace(\,[QT],$APParea1);
 
 and then back by putting this in FORM1.php:
 $APParea1 = $_POST['hidden'];
 $APParea1 = str_replace([QT],\,$APParea1);
 
 type=textarea, value=? echo $APParea1; ?
 
 
 BUT THIS must have happened many times a long long time ago to many good
 people and some smart function was developed, right?
 
 
 Thanks
 

stripslashes()
addslashes()

another option is to turn off magic quotes.

-Robby

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
/



signature.asc
Description: This is a digitally signed message part


Re: [PHP] fopen and http://

2004-10-08 Thread Adam Williams
On Fri, 8 Oct 2004, Hendrik Schmieder wrote:

 What say phpinfo about Registered PHP Streams ?
 
Hendrik
 
 

Hi, I think I just figured out my problem...I had to use rtrim($line) 
because I think there was a \n or an invisible character at the end of the 
line that was being passed to the http:// server from looking at the 
server's access_log and error_log files.  So now it works except on the 
very last line it processes, it prints does not exist, so there is still 
some sort of a hidden character but its not affecting fetching the URLs 
from the web server.  so i'm still trying to figure that last line out, 
but everything else works.

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



RE: [PHP] Sessions not destroyed

2004-10-08 Thread Graham Cossey
[snip]
 
  If you are right, then this is a severe design bug.

 Depends on your point of view. It is a sideeffect of loading current
 session (and thus accessing it) before the session gc is called.

 So the question is, should the session module give up on current session
 just because it should have been garbaged, even if the session file
 still exists?

Apologies if I'm way off here, but I'm relatively new to PHP.

Surely it should be down to settings in php.ini, not a point of view or the
probability of the garbage collection possibly having run when a new session
is started. Why can there not be a session_timeout value that is adhered to?
Would it not also save everyone from writing their own code to determine
whether or not they should be using the session that PHP is making
available?

If my site is accessed by few users and I have a session 'timeout' of
30minutes specified, if Bob leaves his PC at 10:00 I would expect that if he
returned at 10:40, and no-one else had accessed the system, his session
would have expired and he would need to re-authenticate to create a new
session.

Short of writing custom session handlers, the current arrangement seems
somewhat haphazard to me.

Those are my current thoughts anyway.

Graham

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



RE: [PHP] fopen and http://

2004-10-08 Thread Mulley, Nikhil
May be the path is not the correct ,just check with the Web Directory you configured 
to be and if its htdocs then I would say that its better to remove the htdocs from the 
path in fopen statement.

-Original Message-
From: Adam Williams [mailto:[EMAIL PROTECTED]
Sent: Friday, October 08, 2004 6:22 PM
To: [EMAIL PROTECTED]
Subject: [PHP] fopen and http://


Hi, I'm having a problem with fopen and http files.  I keep getting the 
error:

Warning: fopen(http://zed/htdocs/rgfindingaids/series594.html ) 
[function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 404 
Not Found in /home/awilliam/public_html/rgfaidstest.php on line 15
http://zed/htdocs/rgfindingaids/series594.html does not exist

Warning: fopen(http://zed/htdocs/rgfindingaids/ser391.html ) 
[function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 404 
Not Found in /home/awilliam/public_html/rgfaidstest.php on line 15
http://zed/htdocs/rgfindingaids/ser391.html does not exist

Warning: fopen(http://zed/htdocs/rgfindingaids/ser392.html ) 
[function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 404 
Not Found in /home/awilliam/public_html/rgfaidstest.php on line 15
http://zed/htdocs/rgfindingaids/ser392.html does not exist



I have a text file /home/awilliam/public_html/rgfaids containing URLs such 
as:

http://zed/htdocs/rgfindingaids/series594.html
http://zed/htdocs/rgfindingaids/ser391.html
http://zed/htdocs/rgfindingaids/ser392.html

and I can bring up these URLs fine in a browser on the PC i'm running the 
script on.

The following is my code:

?

$filelist = fopen(/home/awilliam/public_html/rgfaids, r);

if (!$filelist)
{
echo error opening rgfaids;
exit;
}

while ( !feof($filelist))
{
$line = fgets($filelist, 9);

$filetotest = fopen($line, r);

if (!$filetotest)
{
echo $line does not existbr;
}
elseif ($filetotest)
{
echo $line does exist;
}
}

?



But I don't understand why I am getting that error about failed to open 
strem: HTTP request failed, when I can bring up the links fine in a 
browser on the server running the php script.  So can anyone help me out?  
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] Sessions not destroyed

2004-10-08 Thread Marek Kilimajer
Graham Cossey wrote:
[snip]
If you are right, then this is a severe design bug.
Depends on your point of view. It is a sideeffect of loading current
session (and thus accessing it) before the session gc is called.
So the question is, should the session module give up on current session
just because it should have been garbaged, even if the session file
still exists?

Apologies if I'm way off here, but I'm relatively new to PHP.
Surely it should be down to settings in php.ini, not a point of view or the
probability of the garbage collection possibly having run when a new session
is started. Why can there not be a session_timeout value that is adhered to?
Would it not also save everyone from writing their own code to determine
whether or not they should be using the session that PHP is making
available?
If my site is accessed by few users and I have a session 'timeout' of
30minutes specified, if Bob leaves his PC at 10:00 I would expect that if he
returned at 10:40, and no-one else had accessed the system, his session
would have expired and he would need to re-authenticate to create a new
session.
Short of writing custom session handlers, the current arrangement seems
somewhat haphazard to me.
The session timeout was never ment to be security feature, it is merely 
a way to not choke the server with dead session files.

If you want a hard timeout, store the last access in session variable:
if(isset($_SESSION['last_access'])
 $_SESSION['last_access']  (time() - 
ini_get('session.gc_maxlifetime'))) {
	session_destroy();
} else {
	$_SESSION['last_access'] = time();
}

no need to write custom session handlers
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Sessions not destroyed

2004-10-08 Thread Hendrik Schmieder
Marek Kilimajer schrieb:
Hendrik Schmieder wrote:
Marek Kilimajer schrieb:
Hendrik Schmieder wrote:
Hello,
we have a severe problem with seesions.
We use Apache 1.3.31 with PHP 4.3.9 as Apache module in Windows 2000
In our php.ini we have
session.gc_probability = 100
session.gc_dividend= 100


Should be session.gc_divisor

OK , changed in php.ini, but no change in behaviour.
And you need to start at least one other session so that the first 
one gets cleared.

If you are right, then this is a severe design bug.

Depends on your point of view. It is a sideeffect of loading current 
session (and thus accessing it) before the session gc is called.

So the question is, should the session module give up on current 
session just because it should have been garbaged, even if the session 
file still exists?

That's the point.
If the current sesions timed out, since there was no action in the 
session lifetime, then the session file must be deleted.
On the other side, if there's an action in the session lifetime, the 
timer for this session should be reset to zero.

Anyway , if the apache service is stopped (I am not speaking about a 
crash) all session files must be deleted.

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


Re: [PHP] Quotes in form textarea fields

2004-10-08 Thread Marek Kilimajer
Sam Smith wrote:
I swear I googled for an hour first.
A user enters in a textarea field of FORM1.php:
Bob is high
Submitted to FROM2.php we get:
Bob is \high\
In a hidden field in FROM2.php we store the value: type=hidden, value=?
echo stripslashes($_POST['textarea']); ? Value now Bob is high
So it looks:
input type=hidden value=Bob is high (hope this is what you meant)
You forgot ending quote, but that does not matter now. You need to 
convert quotes and other special html chars to their html entities, 
using htmlentities() function

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


Re: [PHP] Sessions not destroyed

2004-10-08 Thread Hendrik Schmieder
Graham Cossey schrieb:
[snip]
 

If you are right, then this is a severe design bug.
 

Depends on your point of view. It is a sideeffect of loading current
session (and thus accessing it) before the session gc is called.
So the question is, should the session module give up on current session
just because it should have been garbaged, even if the session file
still exists?
   

Apologies if I'm way off here, but I'm relatively new to PHP.
Surely it should be down to settings in php.ini, not a point of view or the
probability of the garbage collection possibly having run when a new session
is started. Why can there not be a session_timeout value that is adhered to?
Would it not also save everyone from writing their own code to determine
whether or not they should be using the session that PHP is making
available?
If my site is accessed by few users and I have a session 'timeout' of
30minutes specified, if Bob leaves his PC at 10:00 I would expect that if he
returned at 10:40, and no-one else had accessed the system, his session
would have expired and he would need to re-authenticate to create a new
session.
Short of writing custom session handlers, the current arrangement seems
somewhat haphazard to me.
Those are my current thoughts anyway.
Graham
 

Graham,
that's also my point.
Unfortunately this isn't happening.
Bob can work on as he never left his PC.
 Hendrik
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Sessions not destroyed

2004-10-08 Thread Marek Kilimajer
Hendrik Schmieder wrote:
Anyway , if the apache service is stopped (I am not speaking about a 
crash) all session files must be deleted.
Why? Why should users loose their sessions just because I need to 
restart web server?

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


[PHP] Re: [PHP-INSTALL] install errors with oci8

2004-10-08 Thread Hendrik Schmieder
Bob Redding schrieb:
Running on Mandrake 10.0, Apache 2 and Oracle Client
Bob Redding
 

Look where you have libclntsh.a or libclntsh.so.
 Hendrik
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Sessions not destroyed

2004-10-08 Thread Hendrik Schmieder
Marek Kilimajer schrieb:
Hendrik Schmieder wrote:
Anyway , if the apache service is stopped (I am not speaking about a 
crash) all session files must be deleted.

Why? Why should users loose their sessions just because I need to 
restart web server?

OK,
good point.
So I redrew the request for deleting, when Apache is stopping ,
but not the other point.
Your php code is a workaround, but no real solution .
 Hendrik
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Sessions not destroyed

2004-10-08 Thread Hendrik Schmieder
Patrick Blousson schrieb:
Hi,
What about your hard disk partitions? Sessions only works on NTFS 
partitions. FAT don 't have a last accessed flag on file.

Patrick.
- Original Message - From: Hendrik Schmieder 
[EMAIL PROTECTED]
Newsgroups: php.general
To: [EMAIL PROTECTED]
Sent: Friday, October 08, 2004 7:23 AM
Subject: Sessions not destroyed


Hello,
we have a severe problem with seesions.
We use Apache 1.3.31 with PHP 4.3.9 as Apache module in Windows 2000
In our php.ini we have
session.gc_probability = 100
session.gc_dividend= 100
session.gc_maxlifetime = 120
But even after 20 minutes the session file is still there.
And the session file ist also not deleted  if we then stop the apache 
service.

Has anybody an idea ?
TIA
  Hendrik Schmieder 


NTFS
but you claim about FAT is wrong for PHP = 4.2.3 :
Since PHP 4.2.3 it has used mtime (modified date) instead of atime. So, 
you won't have problems with filesystems where atime tracking is not 
available.
http://www.php.net/manual/en/ref.session.php

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


[PHP] URL verification

2004-10-08 Thread Bruno Santos
Hello all.
I have a login page  where users have to authenticate themselves to 
access some site areas.
Apache is configured to use https.

the user when is typing the URL in the browser, i know that it will not 
put the https protocol.

how can i check in the page if the user is accessing the the site via SSL ??
or i have to put a redirect in the page anyway, whether the user is 
alredy accessing the page via SSL?

cheers
Bruno Santos
--
[EMAIL PROTECTED]
--
Divisao de Informatica
[EMAIL PROTECTED]
Tel: +351 272 000 155
Fax: +351 272 000 257
--
Hospital Amato Lusitano
Av. Pedro Alvares Cabral
6000-085 Castelo Branco
[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


Re: [PHP] Sessions not destroyed

2004-10-08 Thread Marek Kilimajer
Hendrik Schmieder wrote:
Marek Kilimajer schrieb:
Hendrik Schmieder wrote:
Anyway , if the apache service is stopped (I am not speaking about a 
crash) all session files must be deleted.

Why? Why should users loose their sessions just because I need to 
restart web server?

OK,
good point.
So I redrew the request for deleting, when Apache is stopping ,
but not the other point.
Your php code is a workaround, but no real solution .
Once again, the session timeout was never ment to be a security feature, 
it is merely a way to not choke the server with dead session files.

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


Re: [PHP] Sessions not destroyed

2004-10-08 Thread M. Sokolewicz
Hendrik Schmieder wrote:
Graham Cossey schrieb:
[snip]
 

If you are right, then this is a severe design bug.

Depends on your point of view. It is a sideeffect of loading current
session (and thus accessing it) before the session gc is called.
So the question is, should the session module give up on current session
just because it should have been garbaged, even if the session file
still exists?
  

Apologies if I'm way off here, but I'm relatively new to PHP.
Surely it should be down to settings in php.ini, not a point of view 
or the
probability of the garbage collection possibly having run when a new 
session
is started. Why can there not be a session_timeout value that is 
adhered to?
Would it not also save everyone from writing their own code to determine
whether or not they should be using the session that PHP is making
available?

If my site is accessed by few users and I have a session 'timeout' of
30minutes specified, if Bob leaves his PC at 10:00 I would expect that 
if he
returned at 10:40, and no-one else had accessed the system, his session
would have expired and he would need to re-authenticate to create a new
session.

Short of writing custom session handlers, the current arrangement seems
somewhat haphazard to me.
Those are my current thoughts anyway.
Graham
 

Graham,
that's also my point.
Unfortunately this isn't happening.
Bob can work on as he never left his PC.
 Hendrik

Ok, I think you're all missing a few points here...
First of all,
every time a session is started/accessed/written to/whatever, PHP makes 
a check, it calculates , using gc_probability/gc_divisor, if it should 
run the gc (Garbage Collector) on this call or not. If it should, then 
it checks which sessions are expired, and those that are, are deleted. 
If the one the user just activated was one of those, then the session is 
 reinstated, as a NEW (blank) session.

The reason for the gc being called with a CHANCE is that when you have 
50 people/min visiting your site (that's a bit less than 1 hit/sec), 
you're calling the Grabage Collector once EVERY SECOND. The garbage 
collector is pretty slow, especially when many sessions are open, 
because it needs a lot of filesystem info.

So, instead of calling it with every hit, it's called less, only 
gc_probability/gc_divisor of those times.

The Garbage collector works on ACCESS TIMES for files, so if you have a 
sessions lifetime of 5 min, and someone revisits in 4 min. Then the 
session will last at LEAST another 5 min (and theoretically more as long 
as the garbage collector isn't ran).

Imagine our situation again. If you have 1hit/sec, and gc_probability=1 
and gc_divisor=100, then these are the chances the GC hasn't been run yet:
1 sec: 99%
2 secs: 98.01%
3 secs: 97.0299%
4 secs: 96.059601%
5 secs: 95.09900499%
...
10 secs: 90.438207500880449001%
...
20 secs: ??
...
30 secs: 73.970037338828042273001509231671%
...
40 secs: 66.897175856968051393833859880371%
...
50 secs: 60.500606713753665044791996801256%
...
60 secs: 54.715664239076147619474137084001%

So, after 1 min, you have a 50% chance that the GC has been called at 
LEAST once. This is a logaritmic equation (1-1/100)^n (n being the 
amount of secs; making log(n/100)/log(99/100) = secs (n being the chance 
you want in percent)). This means that after 7 min 38, you have only a 
1% chance left that the GC hasn't been ran yet! After 1 hour, this is as 
far down as 0.019% !!

Right, back to the point. The higher the hitrate, the lower a 
gc_probability you need to get the garbage collected regularly. Doubling 
the amount of users means that you'll have the same chance in a bit LESS 
than half that time aswell.

Now, in your case, only 1 user every HOUR visits... this means your 
garbage is collected really really sparsely! Setting a high divisor and 
probability would be useful for you :)

Ok, so far so good, now the reason why sessions aren't removed 
automatically without the need to visit the site. The reason is very simple.
PHP works as a daemon type of application. It does not, and can not, 
run on its own initiative :) It either runs all the time, or it does not 
run till someone starts it.
Having a continuous PHP app running in the background is not very 
efficient, and thus the only (easy) way to get it to be cleaned is to do 
it when PHP is running, and thus when a user visits the server.

Please note, it doesn't matter what SITE the user visits for the gc to 
be ran!! As long as the php engine used is the same on the same machine 
;) (and a session is started/written to/called/whatever).

Ok, after that long explenation (which hopefully everyone could follow), 
I still wouldn't know the answer to the original question (*sighs*). Oh 
well...

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


Re: [PHP] URL verification

2004-10-08 Thread Matt M.
 how can i check in the page if the user is accessing the the site via SSL ??
 or i have to put a redirect in the page anyway, whether the user is
 alredy accessing the page via SSL?

if it has to be https, why not just use mod_rewrite to make sure it is.

With php you could check $_SERVER['SERVER_PORT'] or $_SERVER['HTTPS']

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



Re: [PHP] URL verification

2004-10-08 Thread Greg Donald
On Fri, 08 Oct 2004 15:48:52 +0100, Bruno Santos
[EMAIL PROTECTED] wrote:
 how can i check in the page if the user is accessing the the site via SSL ??
 or i have to put a redirect in the page anyway, whether the user is
 alredy accessing the page via SSL?

parse_url()


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] URL verification

2004-10-08 Thread Marek Kilimajer
Bruno Santos wrote:
Hello all.
I have a login page  where users have to authenticate themselves to 
access some site areas.
Apache is configured to use https.

the user when is typing the URL in the browser, i know that it will not 
put the https protocol.

how can i check in the page if the user is accessing the the site via 
SSL ??

$_SERVER['HTTPS']
if ( !isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on' ) {
   header ('Location: 
https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
   exit();
}

or i have to put a redirect in the page anyway, whether the user is 
alredy accessing the page via SSL?
No, this would create infinite redirects.
cheers
Bruno Santos
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] URL verification

2004-10-08 Thread Justin Palmer
how can i check in the page if the user is accessing the the site via
SSL ??

if(!$_server['https'])
{
//redirect to secure page.
}

There are probably better ways, maybe through apache, but I think that
will work.

-Justin

-Original Message-
From: Bruno Santos [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 08, 2004 7:49 AM
To: [EMAIL PROTECTED]
Subject: [PHP] URL verification


Hello all.

I have a login page  where users have to authenticate themselves to 
access some site areas.
Apache is configured to use https.

the user when is typing the URL in the browser, i know that it will not 
put the https protocol.

how can i check in the page if the user is accessing the the site via
SSL ?? or i have to put a redirect in the page anyway, whether the user
is 
alredy accessing the page via SSL?

cheers

Bruno Santos

-- 
[EMAIL PROTECTED]
--
Divisao de Informatica
[EMAIL PROTECTED]
Tel: +351 272 000 155
Fax: +351 272 000 257

--
Hospital Amato Lusitano
Av. Pedro Alvares Cabral
6000-085 Castelo Branco
[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] Sessions not destroyed

2004-10-08 Thread Marek Kilimajer
M. Sokolewicz wrote:
Hendrik Schmieder wrote:
Ok, I think you're all missing a few points here...
First of all,
every time a session is started/accessed/written to/whatever, PHP makes 
a check, it calculates , using gc_probability/gc_divisor, if it should 
run the gc (Garbage Collector) on this call or not. If it should, then 
it checks which sessions are expired, and those that are, are deleted. 
If the one the user just activated was one of those, then the session is 
 reinstated, as a NEW (blank) session.

The reason for the gc being called with a CHANCE is that when you have 
50 people/min visiting your site (that's a bit less than 1 hit/sec), 
you're calling the Grabage Collector once EVERY SECOND. The garbage 
collector is pretty slow, especially when many sessions are open, 
because it needs a lot of filesystem info.

So, instead of calling it with every hit, it's called less, only 
gc_probability/gc_divisor of those times.

The Garbage collector works on ACCESS TIMES for files, so if you have a 
sessions lifetime of 5 min, and someone revisits in 4 min. Then the 
session will last at LEAST another 5 min (and theoretically more as long 
as the garbage collector isn't ran).

Imagine our situation again. If you have 1hit/sec, and gc_probability=1 
and gc_divisor=100, then these are the chances the GC hasn't been run yet:
1 sec: 99%
2 secs: 98.01%
3 secs: 97.0299%
4 secs: 96.059601%
5 secs: 95.09900499%
...
10 secs: 90.438207500880449001%
...
20 secs: ??
...
30 secs: 73.970037338828042273001509231671%
...
40 secs: 66.897175856968051393833859880371%
...
50 secs: 60.500606713753665044791996801256%
...
60 secs: 54.715664239076147619474137084001%

So, after 1 min, you have a 50% chance that the GC has been called at 
LEAST once. This is a logaritmic equation (1-1/100)^n (n being the 
amount of secs; making log(n/100)/log(99/100) = secs (n being the chance 
you want in percent)). This means that after 7 min 38, you have only a 
1% chance left that the GC hasn't been ran yet! After 1 hour, this is as 
far down as 0.019% !!

Right, back to the point. The higher the hitrate, the lower a 
gc_probability you need to get the garbage collected regularly. Doubling 
the amount of users means that you'll have the same chance in a bit LESS 
than half that time aswell.

Now, in your case, only 1 user every HOUR visits... this means your 
garbage is collected really really sparsely! Setting a high divisor and 
probability would be useful for you :)

Ok, so far so good, now the reason why sessions aren't removed 
automatically without the need to visit the site. The reason is very 
simple.
PHP works as a daemon type of application. It does not, and can not, 
run on its own initiative :) It either runs all the time, or it does not 
run till someone starts it.
Having a continuous PHP app running in the background is not very 
efficient, and thus the only (easy) way to get it to be cleaned is to do 
it when PHP is running, and thus when a user visits the server.

Please note, it doesn't matter what SITE the user visits for the gc to 
be ran!! As long as the php engine used is the same on the same machine 
;) (and a session is started/written to/called/whatever).

Ok, after that long explenation (which hopefully everyone could follow), 
I still wouldn't know the answer to the original question (*sighs*). Oh 
well...
If you mean question of the OP, the answer is in your first mistake:
 If the one the user just activated was one of those, then the session is
  reinstated, as a NEW (blank) session.
No, the session persists with the old data.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] URL verification

2004-10-08 Thread Jordi Canals
Hi,

Check the port number: 80 for http and 443 for https (standard
defaults). You can check it with $_SERVER['SERVER_PORT']

i.e.:

if ($_SERVER['SERVER_PORT'] != 443) {
header('Location: https://some.location.here');
}

Also, there is not important if the login form is displayed in SSL
mode or not. You can force the form to post to an SSL page, and then
all data will be transmitted with SSL.

i.e.:

echo 'form action=https://secure.example.com/login_process.php;
method=post';

Hope this helps.

Regards,
Jordi.


On Fri, 08 Oct 2004 15:48:52 +0100, Bruno Santos
[EMAIL PROTECTED] wrote:
 Hello all.
 
 I have a login page  where users have to authenticate themselves to
 access some site areas.
 Apache is configured to use https.
 
 the user when is typing the URL in the browser, i know that it will not
 put the https protocol.
 
 how can i check in the page if the user is accessing the the site via SSL ??
 or i have to put a redirect in the page anyway, whether the user is
 alredy accessing the page via SSL?


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



Re: [PHP] Quotes in form textarea fields

2004-10-08 Thread Jordi Canals
 A user enters in a textarea field of FORM1.php:
 Bob is high
 
 Submitted to FROM2.php we get:
 
 Bob is \high\
 

Tha't's normal beacuse you have magic_quotes_gpc_on

 In a hidden field in FROM2.php we store the value: type=hidden, value=?
 echo stripslashes($_POST['textarea']); ? Value now Bob is high
 
 Then from FROM2.php we Submit BACK to FROM1.php and enter it back into the
 textarea field with:
 type=textarea, value=? echo $_POST['hidden']); ?
 
 we have;
 Bob is
 

Well, you get that in the browser. But i'm sure that if you look to
the page source, you will see something like type=textarea
value=Bob is High

Because of that the atribute value will end at the first closeing
quotes and will show only the string to that closing quotes.

You can solve this by using the htmlspecialchars() or htmlentities() functions:

$APParea1 = htmspecialchars(stripslashes($_POST['textarea']));

or can be done that other way:

$APParea1 = htmlentities(stripslashes($_POST['textarea']));

Choose one or other function depending of your needs.

Hope this helps.

Regards,
Jordi.

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



[PHP] Grab an array from a cookie without throwing errors?

2004-10-08 Thread Brian Dunning
I've got a cookie that's either non-existent or a serialized array. I'm 
trying all sorts of different code combinations to retrieve it into an 
array variable, but everything I try throws up some combination of 
notices and/or warnings. Here is my latest  greatest:

$cookie = $_COOKIE['bookmarks'];
if(unserialize($cookie) == true) {
$bookmarks = unserialize($cookie);
} else {
$bookmarks = array();
}
Produces:
Notice: Undefined index: bookmarks in 
c:\Inetpub\wwwroot\palms\htdocs\bookmarks.php on line 5

Notice: unserialize() [function.unserialize]: Argument is not an string 
in c:\Inetpub\wwwroot\palms\htdocs\bookmarks.php on line 5

Any suggestions on how I can do this without throwing notices? I'm 
aware that I can turn notices off but I like them kept on to help me 
with debugging.

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


Re: [PHP] Grab an array from a cookie without throwing errors?

2004-10-08 Thread Matt M.
 $cookie = $_COOKIE['bookmarks'];
 if(unserialize($cookie) == true) {
 $bookmarks = unserialize($cookie);
 } else {
 $bookmarks = array();
 }

if (isset($_COOKIE['bookmarks'])) {
$cookie = $_COOKIE['bookmarks'];
if(unserialize($cookie) == true) {
   $bookmarks = unserialize($cookie);
} else {
   $bookmarks = array();
}
}

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



[PHP] header redirect with POST?

2004-10-08 Thread Jay Blanchard
Good morning gurus,

Is it possible to have a form where I post variables to a processing
script which would then redirect to another form have variables posted
from the processing script? I am researching the HTTP header things as I
write this, but have not found a viable answer that is PHP only.

Thanks!

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



RE: [PHP] header redirect with POST?

2004-10-08 Thread Murray @ PlanetThoughtful


Much warmth,

Murray
http://www.planetthoughtful.org
Building a thoughtful planet,
One quirky comment at a time.


-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED] 
Sent: Saturday, 9 October 2004 1:50 AM
To: [EMAIL PROTECTED]
Subject: [PHP] header redirect with POST?

Good morning gurus,

Is it possible to have a form where I post variables to a processing
script which would then redirect to another form have variables posted
from the processing script? I am researching the HTTP header things as I
write this, but have not found a viable answer that is PHP only.

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



[PHP] WDDX functions not working!!

2004-10-08 Thread Phil Ewington - 43 Plc
Hi All,

I have been running 4.3.4 on a Cobalt RaQ 4 for some months and have been
using the WDDX functions with great effect. I have recently moved all our
sites to a new server (Linux RedHat ES 3 running PHP 4.3.6) and found that
the WDDX functions do not work! No errors just nothing happens. I checked
the phpinfo and it clearly shows that wddx is enabled (as I would expect
with the --enable-wddx configure option). I have found this to be the case
for 4.3.6, 4.3.8  4.3.9. What's going on??

$wddx_string = wddx_deserialize($wddx_packet);

This should generate an array but does not! Has anyone else found this? What
version does it work on? Installing PHP 5 is not an option at the moment as
all our classes would need re-writing to conform to the new standards.


TIA

- Phil.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.769 / Virus Database: 516 - Release Date: 24/09/2004

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



Re: [PHP] header redirect with POST?

2004-10-08 Thread raditha dissanayake
Hi Jay,
Nice to see you ask a question for a change ;-)
Jay Blanchard wrote:
Good morning gurus,
Is it possible to have a form where I post variables to a processing
script which would then redirect to another form have variables posted
from the processing script? I am researching the HTTP header things as I
write this, but have not found a viable answer that is PHP only.
 

Unfortunately if you redirect with a POST the post data will not be 
forwarded to the second page it will be discarded. You will either have 
to add your important data to the query string or store them in the session.

If you are sending a lot of data, there is the possibility of opening a 
socket from your first script and making it post the data to the second.

best regards
raditha
Thanks!
 


--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] header redirect with POST?

2004-10-08 Thread Matt M.
 Is it possible to have a form where I post variables to a processing
 script which would then redirect to another form have variables posted
 from the processing script? I am researching the HTTP header things as I
 write this, but have not found a viable answer that is PHP only.

I dont know if that is poosible.  I think you would have to find a way
to tell the browser to pass the post data.

Why are you trying to do this?  Why not use sessions, or the query string?

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



Re: [PHP] Grab an array from a cookie without throwing errors?

2004-10-08 Thread John Nichel
Brian Dunning wrote:
I've got a cookie that's either non-existent or a serialized array. I'm 
trying all sorts of different code combinations to retrieve it into an 
array variable, but everything I try throws up some combination of 
notices and/or warnings. Here is my latest  greatest:

$cookie = $_COOKIE['bookmarks'];
if(unserialize($cookie) == true) {
$bookmarks = unserialize($cookie);
} else {
$bookmarks = array();
}
Use isset
if ( isset ( $_COOKIE['bookmarks'] )  unserialize ( 
$_COOKIE['bookmarks'] ) ) {
	$bookmarks = unserialize ( $_COOKIE['bookmarks'] );
} else {
	$bookmarks = array();
}

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] header redirect with POST?

2004-10-08 Thread John Nichel
Jay Blanchard wrote:
Good morning gurus,
Is it possible to have a form where I post variables to a processing
script which would then redirect to another form have variables posted
from the processing script? I am researching the HTTP header things as I
write this, but have not found a viable answer that is PHP only.
If memory serves, we had to do this at my last job, and I think we found 
sockets to be the answer.  I don't remember any of the details (wasn't 
my project), but I'm pretty sure they opened a socket to POST the data thru.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] header redirect with POST?

2004-10-08 Thread raditha dissanayake
John Nichel wrote:
Jay Blanchard wrote:
Good morning gurus,
Is it possible to have a form where I post variables to a processing
script which would then redirect to another form have variables posted
from the processing script? I am researching the HTTP header things as I
write this, but have not found a viable answer that is PHP only.

If memory serves, we had to do this at my last job, and I think we 
found sockets to be the answer.  I don't remember any of the details 
(wasn't my project), but I'm pretty sure they opened a socket to POST 
the data thru.
that works, had to do it a couple of times myself.
btw jay, if your machine has perl installed and the LWP module is also 
installed (usually will be) you might find the POST binary on your 
server. If it's there you can forget about sockets and make use of this 
program to send the data to the second page.


--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Array concatenation behaviour change

2004-10-08 Thread rich gray
 
 Can't you sort the array?
 
 

Yes of course but that wasn't the point of my post I was trying to
show that the same code produces differing results on 2 different
versions of PHP ...

rich

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



Re: [PHP] RE: **[SPAM]** RE: [PHP] Newsgroups Space

2004-10-08 Thread Chris Dowell
Nice idea, but you want to be future-proof, don't you?
Once alt.binaries.vr.animals.lobster starts filling up with 5 hour 
Virtual Reality ROMs you're looking at needing a lot more than that. I'd 
go with about 6 YB if I were you, and that's only because there aren't 
any SI prefixes higher than Yotta (10^24).

Jay Blanchard wrote:
[snip]
Better go with 2TB. You know how all that porn fills up.
[/snip]
Shoot, I forgot porn. 4-7TB minimum
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] header redirect with POST?

2004-10-08 Thread Jay Blanchard
[snip]
that works, had to do it a couple of times myself.
btw jay, if your machine has perl installed and the LWP module is also 
installed (usually will be) you might find the POST binary on your 
server. If it's there you can forget about sockets and make use of this 
program to send the data to the second page.
[/snip]

It seems as if it would be really simple, but not so much I guess. I'll
have a look at the PERL POST binary and sockets both. Thanks all!

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



RE: [PHP] Newsgroups Space

2004-10-08 Thread Jay Blanchard
[snip]
Nice idea, but you want to be future-proof, don't you?

Once alt.binaries.vr.animals.lobster starts filling up with 5 hour 
Virtual Reality ROMs you're looking at needing a lot more than that. I'd

go with about 6 YB if I were you, and that's only because there aren't 
any SI prefixes higher than Yotta (10^24).
[/snip]

Good call

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



[PHP] sending mail -- nullmailer

2004-10-08 Thread Josh Howe
 

Ok, so I came across nullmailer, which seems to do exactly what I want -
forward mail to an existing smtp server. But it isn't working. I'm using the
mail() php function, and the mails aren't arriving. The same code works fine
on a windows machine pointing to the same smtp server. Does anybody have any
experience configuring nullmailer? How do I tell linux to use nullmailer as
the default MTA? Thanks!! 



[PHP] Need help with a string

2004-10-08 Thread Brent Clements
Given the following string:

$textString = Share A Dream Come True Parade 3:00 SpectroMagic Parade 9:00, 11:00 
Wishes? nighttime spectacular 10:00

I need to break the string up into pieces where as 

$string[1] = Share A Dream Come True Parade 3:00
$string[2] = SpectroMagic Parade 9:00, 11:00
$string[3] = Wishes? nighttime spectacular 10:00


Granted this is pretty easy because I could just search for this stuff and break it 
up, but the string above can actually be different each time, for instance, next time 
it could be:

$textString = Share A Dream Come True Parade 3:00, 5:00 SpectroMagic Parade 9:00, 
11:00 Wishes? nighttime spectacular 10:00

I think my main issue is that I don't know how to keep the , XX:XX part combined with 
the previous part of the string. 

Any help would be appreciated!

Thanks,
Brent



Re: [PHP] RE: **[SPAM]** RE: [PHP] Newsgroups Space

2004-10-08 Thread Matthew Sims
 Nice idea, but you want to be future-proof, don't you?

 Once alt.binaries.vr.animals.lobster starts filling up with 5 hour
 Virtual Reality ROMs you're looking at needing a lot more than that. I'd
 go with about 6 YB if I were you, and that's only because there aren't
 any SI prefixes higher than Yotta (10^24).


Yeah, that Super Turbo Lobster Fighter Alpha EX2 Special is freakin' huge.

-- 
--Matthew Sims
--http://killermookie.org

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



Re: [PHP] sending mail -- nullmailer

2004-10-08 Thread Matthew Sims

Does nullmailer have a sendmail wrapper? mail() in unix/linux looks for
the sendmail binary.

mail() on windows uses the settings in php.ini.

-- 
--Matthew Sims
--http://killermookie.org



 Ok, so I came across nullmailer, which seems to do exactly what I want -
 forward mail to an existing smtp server. But it isn't working. I'm using
 the
 mail() php function, and the mails aren't arriving. The same code works
 fine
 on a windows machine pointing to the same smtp server. Does anybody have
 any
 experience configuring nullmailer? How do I tell linux to use nullmailer
 as
 the default MTA? Thanks!!



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



[PHP] Re: sending mail -- nullmailer

2004-10-08 Thread Manuel Lemos
Hello,
On 10/08/2004 01:35 PM, Josh Howe wrote:
Ok, so I came across nullmailer, which seems to do exactly what I want -
forward mail to an existing smtp server. But it isn't working. I'm using the
mail() php function, and the mails aren't arriving. The same code works fine
on a windows machine pointing to the same smtp server. Does anybody have any
experience configuring nullmailer? How do I tell linux to use nullmailer as
the default MTA? Thanks!! 
I don't know why do you want to replace your Linux installation MTA. 
Usually is sendmail or compatible and can be configured to relay 
messages to a SMTP server instead of deliverying them directly.

Under Linux/Unix PHP just hands the message to the sendmail program. It 
would not make much sense to relay messages a SMTP server when sendmail 
can be more efficient by sending them directly to the SMTP of the 
recipient users, unless you are trying to send messages from a server 
that is blacklisted and the world is not accepting messages from it or 
because of some other blocking reason.

Anyway, if you really want to relay messages to a SMTP server under 
Linux/Unix, the mail function will not do that. Instead you may want to 
try this class that comes with a wrapper function named smtp_mail(). It 
emulates the mail() function and the purpose of its arguments except 
that it can relay the messages a SMTP server of choice.

http://www.phpclasses.org/mimemessage
You also need this:
http://www.phpclasses.org/smtpclass
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Need help with a string

2004-10-08 Thread Greg Donald
On Fri, 8 Oct 2004 11:38:23 -0500, Brent Clements
[EMAIL PROTECTED] wrote:
 Given the following string:
 
 $textString = Share A Dream Come True Parade 3:00 SpectroMagic Parade 9:00, 11:00 
 Wishes? nighttime spectacular 10:00
 
 I need to break the string up into pieces where as
 
 $string[1] = Share A Dream Come True Parade 3:00
 $string[2] = SpectroMagic Parade 9:00, 11:00
 $string[3] = Wishes? nighttime spectacular 10:00
 
 Granted this is pretty easy because I could just search for this stuff and break it 
 up, but the string above can actually be different each time, for instance, next 
 time it could be:
 
 $textString = Share A Dream Come True Parade 3:00, 5:00 SpectroMagic Parade 9:00, 
 11:00 Wishes? nighttime spectacular 10:00
 
 I think my main issue is that I don't know how to keep the , XX:XX part combined 
 with the previous part of the string.

preg_match_all() is what you want to use.  You can easily match
everything up to the time since it's formed with a :00 at the end
each time.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



[PHP] RE: Quotes in form textarea fields

2004-10-08 Thread Jensen, Kimberlee
Yes, the magic quotes will get you, but they are meant to protect you.

Either

1. Go into php.ini and disable them
2. Create an include file that you include in each script, in it, use ini_set() to 
disable magic quotes at run time http://us2.php.net/manual/en/function.ini-set.php


-Original Message-
From:   Sam Smith [mailto:[EMAIL PROTECTED]
Sent:   Fri 10/8/2004 6:22 AM
To: PHP
Cc: 
Subject:Quotes  in form textarea fields

I swear I googled for an hour first.


A user enters in a textarea field of FORM1.php:
Bob is high

Submitted to FROM2.php we get:

Bob is \high\

In a hidden field in FROM2.php we store the value: type=hidden, value=?
echo stripslashes($_POST['textarea']); ? Value now Bob is high

Then from FROM2.php we Submit BACK to FROM1.php and enter it back into the
textarea field with:
type=textarea, value=? echo $_POST['hidden']); ?

we have;
Bob is

Everything after the first double quote is clobbered.

I can fix this by putting this in FORM2.php:
$APParea1 = $_POST['textarea'];
$APParea1 = str_replace(\,[QT],$APParea1);

and then back by putting this in FORM1.php:
$APParea1 = $_POST['hidden'];
$APParea1 = str_replace([QT],\,$APParea1);

type=textarea, value=? echo $APParea1; ?


BUT THIS must have happened many times a long long time ago to many good
people and some smart function was developed, right?


Thanks





[PHP] move_uploaded_file() problem

2004-10-08 Thread Daniel Lahey
I'm seeing a very strange problem with move_uploaded_file(...).  I'm
uploading jpegs and the transfer appears to go a little too quickly,
and when I look at the directory listing, the files are about twice the
size that they should be.  When we view the file in the browser, the
images are either mangled or appear incomplete.  Sometimes the bits
seem to be scrambled and other times it appears that only the first 1/4
or so of the image is complete.  I can ftp the files to the same folder
and they are uploaded without any problem.  Another odd thing is that
the permissions on the files are set to -rw--- and owned by apache.
   I can do a chmod on them to get them readable, but chown doesn't
appear to work to change ownership.
I'm using a multipart/form-data form with a MAX_FILE_SIZE of 1MB, which
should be plenty.
We're using PHP 4.2.2, Apache 2.0.40, and Red Hat Linux 9 (Shrike).
Has anyone encountered such a thing before?  We're going to upgrade PHP
from 4.2.2, but I wasn't able to find any documented bugs with that
version relating to this issue.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Creating a Sequence from Array

2004-10-08 Thread Nick Wilson
hello all, 

I have an array like this:

array (
1 = array(123, 345, 454), 
2 = array(8854, 393, 4947, 77, 3343), 
3 = array(393, 33)
  );

I need to create an array sequence from that that would look like this:

array (
'1:123', 
'2:8854', 
'3:393', 
'1:345', 
'2:393', 
'3:33', 
'1:454', 
'2:4947', 
'3:393',// notice this has started from the start again...
'1:123',// as has this..
'2:77', 
etc etc 
  );

untill the last number of the largest array (number 2 in
the original array) have been used.

I do have some code to show you but im afraid ive been going at it all
the wrong way so im not sure it's of any use. (posted below) - Could
someone please help me out? im just not good enough to do this i
think... thanks very much indeed..


 Nicks messed up code so far:

  function rubbish_function($machines) {
while(count($machines)  1) {
  for($i=0; $icount($machines); $i++) {
sequence[] = ($i+1) . ':' . rtrim($machines[$i][0]);
array_shift($machines[$i]);
  }
  if(empty($machines[$i])) {
array_shift($machines);
  } else rubbish_function($machines);
}
return $sequence;
  }

  
-- 
Nick W

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



Re: [PHP] Help with Array Sorting Please

2004-10-08 Thread Nick Wilson

* and then Ford, Mike declared
php
  543 = 2
  432 = 2 // like here, more 2's than 1's see?
  566 = 2
  568 = 2
  999 = 3
  878 = 3
  444 = 3
 
 That's not terribly good, as you are using the unknowns (ip addresses) as keys to 
 the knowns (machine IDs).  It would be better keying off the machine IDs, although 
 this does lead to a 2-level array; something like:
 
array( 1 = array(123),
   2 = array(543, 432, 566, 568),
   3 = array(999, 878, 444)
 )

That's exactly what i have Mike, the above was what i had generated in
an attempt to get the ips in sequential machineId order ;-)

So, now im back to square one, do you have a suggestion as to how to
acheive the goal? -

many, many thanks..

-- 
Nick W

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



Re: [PHP] Help with Array Sorting Please

2004-10-08 Thread Nick Wilson

* and then Ford, Mike declared
  543 = 2
  432 = 2 // like here, more 2's than 1's see?
  566 = 2
  568 = 2
  999 = 3
  878 = 3
  444 = 3
 
 That's not terribly good, as you are using the unknowns (ip addresses) as keys to 
 the knowns (machine IDs).  It would be better keying off the machine IDs, although 
 this does lead to a 2-level array; something like:
 
array( 1 = array(123),
   2 = array(543, 432, 566, 568),
   3 = array(999, 878, 444)
 )

That's exactly what i have Mike, the above was what i had generated in
an attempt to get the ips in sequential machineId order ;-)

So, now im back to square one, do you have a suggestion as to how to
acheive the goal? -

many, many thanks..

-- 
Nick W

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



Re: [PHP] Need help with a string

2004-10-08 Thread Jason Davidson
prolly already mentioned, but what about explode using the commas

$strings = explode(',', $textString);

Greg Donald [EMAIL PROTECTED] wrote: 
 
 On Fri, 8 Oct 2004 11:38:23 -0500, Brent Clements
 [EMAIL PROTECTED] wrote:
  Given the following string:
  
  $textString = Share A Dream Come True Parade 3:00 SpectroMagic Parade 9:00,
 11:00 Wishes? nighttime spectacular 10:00
  
  I need to break the string up into pieces where as
  
  $string[1] = Share A Dream Come True Parade 3:00
  $string[2] = SpectroMagic Parade 9:00, 11:00
  $string[3] = Wishes? nighttime spectacular 10:00
  
  Granted this is pretty easy because I could just search for this stuff and
 break it up, but the string above can actually be different each time, for
 instance, next time it could be:
  
  $textString = Share A Dream Come True Parade 3:00, 5:00 SpectroMagic Parade
 9:00, 11:00 Wishes? nighttime spectacular 10:00
  
  I think my main issue is that I don't know how to keep the , XX:XX part
 combined with the previous part of the string.
 
 preg_match_all() is what you want to use.  You can easily match
 everything up to the time since it's formed with a :00 at the end
 each time.
 
 
 -- 
 Greg Donald
 Zend Certified Engineer
 http://gdconsultants.com/
 http://destiney.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



Re: [PHP] Need help with a string

2004-10-08 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Greg Donald wrote:
 On Fri, 8 Oct 2004 11:38:23 -0500, Brent Clements
[EMAIL PROTECTED] wrote:
 Given the following string:
 
 $textString = Share A Dream Come True Parade 3:00 SpectroMagic Parade 9:00, 11:00 
 Wishes? nighttime spectacular 10:00
 
 I need to break the string up into pieces where as
 
 $string[1] = Share A Dream Come True Parade 3:00
 $string[2] = SpectroMagic Parade 9:00, 11:00
 $string[3] = Wishes? nighttime spectacular 10:00
 
 Granted this is pretty easy because I could just search for this stuff and break it 
 up, but the string above can actually be different each time, for instance, next 
 time it could be:
 
 $textString = Share A Dream Come True Parade 3:00, 5:00 SpectroMagic Parade 9:00, 
 11:00 Wishes? nighttime spectacular 10:00
 
 I think my main issue is that I don't know how to keep the , XX:XX part combined 
 with the previous part of the string.
 
 preg_match_all() is what you want to use.  You can easily match
 everything up to the time since it's formed with a :00 at the end
 each time.

If i'm not mistaken, preg_split on \d{0,2}:\d{2}

-- 
Met vriendelijke groeten,
Tim Van Wassenhove http://www.timvw.info

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



[PHP] Re: move_uploaded_file() problem

2004-10-08 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Daniel Lahey wrote:
 I'm seeing a very strange problem with move_uploaded_file(...).  I'm
 uploading jpegs and the transfer appears to go a little too quickly,
 and when I look at the directory listing, the files are about twice the
 size that they should be.  When we view the file in the browser, the
 images are either mangled or appear incomplete.  Sometimes the bits
 seem to be scrambled and other times it appears that only the first 1/4
 or so of the image is complete.  

Meaby the maximum execution time is exceeded, and the script dies?


Another odd thing is that
 the permissions on the files are set to -rw--- and owned by apache.
 I can do a chmod on them to get them readable, but chown doesn't
 appear to work to change ownership.

I believe you have to be root to perform chown.

If you really want another user to be the owner of the files, you could
extend your upload script so that it uploads all the files with ftp to
localhost. This way they will be owned by the ftp-user.



-- 
Met vriendelijke groeten,
Tim Van Wassenhove http://www.timvw.info

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



[PHP] Re: Creating a Sequence from Array

2004-10-08 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Nick Wilson wrote:
 array (
 1 = array(123, 345, 454), 
 2 = array(8854, 393, 4947, 77, 3343), 
 3 = array(393, 33)
   );
 
 I need to create an array sequence from that that would look like this:
 array (
 '1:123', 
 '2:8854', 
 '3:393', 
 '1:345', 
 '2:393', 
 '3:33', 
 '1:454', 
 '2:4947', 
 '3:393',// notice this has started from the start again...
 '1:123',// as has this..
 '2:77', 
 etc etc 
   );
 
 untill the last number of the largest array (number 2 in
 the original array) have been used.
 
 I do have some code to show you but im afraid ive been going at it all
 the wrong way so im not sure it's of any use. 

Do you have a clue what your code is doing? Or did you just come up with
it? What is the use of writing code that you don't understand?

Not going to do your homework, but will give you some hints:

it seems your function accepts an array as parameter, and returns a new
array. 

to find the largest number, you could say the first number in the array
is the current biggest. And then you loop through all the values, and remember
the array number when you meet a value that is greater than the current
biggest.

Now it's only a matter of building the new array, and resetting your
index to 0 when it's as big as the biggest found earlier.

http://www.php.net/functions
http://www.php.net/foreach


-- 
Met vriendelijke groeten,
Tim Van Wassenhove http://www.timvw.info

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



Re: [PHP] header redirect with POST?

2004-10-08 Thread djoseph
I'm not sure I completely understand what is trying to be accomplished, but it sounds 
like some javascript could be used to do this.  Basically, you'd have form a submit to 
form b, then form b generate a form with a few hiddens, then force a submit with 
javascript to form c.

-Dan Joseph

- Original Message -
From: Matt M. [EMAIL PROTECTED]
Date: Friday, October 8, 2004 11:59 am
Subject: Re: [PHP] header redirect with POST?

  Is it possible to have a form where I post variables to a processing
  script which would then redirect to another form have variables 
 posted from the processing script? I am researching the HTTP 
 header things as I
  write this, but have not found a viable answer that is PHP only.
 
 I dont know if that is poosible.  I think you would have to find a way
 to tell the browser to pass the post data.
 
 Why are you trying to do this?  Why not use sessions, or the query 
 string?
 -- 
 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] read aspx files

2004-10-08 Thread celso andrade
hi all,

how do i setup a apache+php server to read aspx files
as php files?

i need it to parse aspx files.

thank you






___ 
Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! 
http://br.acesso.yahoo.com/

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



Re: [PHP] Help with Array Sorting Please

2004-10-08 Thread Nick Wilson

* and then Nick Wilson declared
 
 * and then Ford, Mike declared
 php

sorry about the dupes everyone, i changed router today and resent a
whole bunch of stuff b4 i realized it wasnt goint out...
-- 
Nick W

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



Re: [PHP] fopen and http://

2004-10-08 Thread Andrew Kreps
On Fri, 8 Oct 2004 08:33:11 -0500 (CDT), Adam Williams
[EMAIL PROTECTED] wrote:
 So now it works except on the
 very last line it processes, it prints does not exist, so there is still
 some sort of a hidden character but its not affecting fetching the URLs
 from the web server.  so i'm still trying to figure that last line out,
 but everything else works.
 

That new problem you're having might just be an extra newline in the
file.  Make sure you don't have any blank lines at the end, or check
to make sure you actually have a URL to fetch before trying to grab
it.

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



Re: [PHP] read aspx files

2004-10-08 Thread Robby Russell
On Fri, 2004-10-08 at 15:00 -0300, celso andrade wrote:
 hi all,
 
 how do i setup a apache+php server to read aspx files
 as php files?
 
 i need it to parse aspx files.
 
 thank you

Do you mean run aspx files?
Or just read them? If so, you should just be able to read the contents
of yourfile.aspx on the local disk.

PHP doesn't run aspx files..

-Robby

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
/



signature.asc
Description: This is a digitally signed message part


Re: [PHP] read aspx files

2004-10-08 Thread Brent Clements
Your question is a bit confusing.

Do you want to convert asp to php on the fly? and then parse the php
natively? Not easily done.

Or do you just want to name your files .aspx yet have php code in the files.
Easily done.

Or do you want to run aspx files natively?(if so check out the mod_mono
project).

-Brent

- Original Message - 
From: celso andrade [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, October 08, 2004 1:00 PM
Subject: [PHP] read aspx files


 hi all,

 how do i setup a apache+php server to read aspx files
 as php files?

 i need it to parse aspx files.

 thank you






 ___
 Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora!
http://br.acesso.yahoo.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



Re: [PHP] Sessions not destroyed

2004-10-08 Thread Dennis Gearon
There is a difference between the session file existing, and the user 
still having a valid session.

If the timeout has occurred, and the file has not been deleted, when the 
user accesses it, the session will not show up in $_SESS[]. Which for 
all intents an purposes, means the session has been deleted as far as 
the script is concerned.. Now whether it gets deleted by such a direct 
request, I  wonder. It will get deleted by OTHER sessions be requested, 
if the gc probablity works at that moment.

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


Re: [PHP] read aspx files

2004-10-08 Thread Marek Kilimajer
celso andrade wrote:
hi all,
how do i setup a apache+php server to read aspx files
as php files?
i need it to parse aspx files.
Find this line in httpd.conf:
AddType application/x-httpd-php .php
Add aspx extension and restart apache
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Creating a Sequence from Array

2004-10-08 Thread Nick Wilson

* and then Tim Van Wassenhove declared
  I do have some code to show you but im afraid ive been going at it all
  the wrong way so im not sure it's of any use. 
 
 Do you have a clue what your code is doing? Or did you just come up with
 it? What is the use of writing code that you don't understand?
 
 Not going to do your homework, but will give you some hints:

Please dont. Thanks.

-- 
Nick W

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



Re: [PHP] header redirect with POST?

2004-10-08 Thread Chris Shiflett
--- Jay Blanchard [EMAIL PROTECTED] wrote:
 Is it possible to have a form where I post variables to a processing
 script which would then redirect to another form have variables posted
 from the processing script? I am researching the HTTP header things as I
 write this, but have not found a viable answer that is PHP only.

Luckily, this is not possible as you describe. Imagine if it were - just
by visiting a URL, I could unintentionally use Amazon's one-click
mechanism to make a purchase, even if I am a paranoid user with all
scripting disabled. That's not good.

There are ways to solve your problem, but you have to rethink your
approach a little.

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming December 2004http://httphandbook.org/

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



Re: [PHP] Help with Array Sorting Please

2004-10-08 Thread M Saleh EG
i'd recommand u to use trees if u got complicated data arrays.

use tree datascturcutres... u could sort n do watever then
or jus queues or stacks depending on what u wanna do

Try PEAR Tree class it might help

Hope that was usefull.


On Fri, 8 Oct 2004 20:13:10 +0200, Nick Wilson [EMAIL PROTECTED] wrote:
 
 * and then Nick Wilson declared
 
  * and then Ford, Mike declared
  php
 
 sorry about the dupes everyone, i changed router today and resent a
 whole bunch of stuff b4 i realized it wasnt goint out...
 
 
 --
 Nick W
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
M.Saleh.E.G
97150-4779817

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



Re: [PHP] read aspx files

2004-10-08 Thread M Saleh EG
Do u mean using .aspx as ur file extensions? and then setup Apache to
read them as php file?

If that's the case then ur talking about types and extension handlers.

Try or research about:
Add Type in apache docs.
and handlers.


On Fri, 08 Oct 2004 11:23:02 -0700, Robby Russell [EMAIL PROTECTED] wrote:
 On Fri, 2004-10-08 at 15:00 -0300, celso andrade wrote:
  hi all,
 
  how do i setup a apache+php server to read aspx files
  as php files?
 
  i need it to parse aspx files.
 
  thank you
 
 Do you mean run aspx files?
 Or just read them? If so, you should just be able to read the contents
 of yourfile.aspx on the local disk.
 
 PHP doesn't run aspx files..
 
 -Robby
 
 --
 /***
 * Robby Russell | Owner.Developer.Geek
 * PLANET ARGON  | www.planetargon.com
 * Portland, OR  | [EMAIL PROTECTED]
 * 503.351.4730  | blog.planetargon.com
 * PHP/PostgreSQL Hosting  Development
 /
 
 
 


-- 
M.Saleh.E.G
97150-4779817

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



RE: [PHP] Re: sending mail -- nullmailer

2004-10-08 Thread Josh Howe

I don't want to setup and maintain a new mail server (sendmail) when we
already have an smtp server set up and maintained by our sys admin. Am I
crazy here? 

Can anybody recommend a good sendmail wrapper I can use that will work with
PHP and any other apps that use sendmail? Thanks



-Original Message-
From: Manuel Lemos [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 08, 2004 12:59 PM
To: Josh Howe
Cc: [EMAIL PROTECTED]
Subject: [PHP] Re: sending mail -- nullmailer

Hello,

On 10/08/2004 01:35 PM, Josh Howe wrote:
 Ok, so I came across nullmailer, which seems to do exactly what I want -
 forward mail to an existing smtp server. But it isn't working. I'm using
the
 mail() php function, and the mails aren't arriving. The same code works
fine
 on a windows machine pointing to the same smtp server. Does anybody have
any
 experience configuring nullmailer? How do I tell linux to use nullmailer
as
 the default MTA? Thanks!! 

I don't know why do you want to replace your Linux installation MTA. 
Usually is sendmail or compatible and can be configured to relay 
messages to a SMTP server instead of deliverying them directly.

Under Linux/Unix PHP just hands the message to the sendmail program. It 
would not make much sense to relay messages a SMTP server when sendmail 
can be more efficient by sending them directly to the SMTP of the 
recipient users, unless you are trying to send messages from a server 
that is blacklisted and the world is not accepting messages from it or 
because of some other blocking reason.

Anyway, if you really want to relay messages to a SMTP server under 
Linux/Unix, the mail function will not do that. Instead you may want to 
try this class that comes with a wrapper function named smtp_mail(). It 
emulates the mail() function and the purpose of its arguments except 
that it can relay the messages a SMTP server of choice.

http://www.phpclasses.org/mimemessage

You also need this:

http://www.phpclasses.org/smtpclass


-- 

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

-- 
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] static inheritance in a class object

2004-10-08 Thread Kevin
Anyone know why class static vars are inherited?  (See code below)

class A
{
   public static $CONFIG = null;
}

A::$CONFIG = A;

class B extends A
{
   public static $CONFIG = null;
}

B::$CONFIG = B;

print (A:  . A::$CONFIG . br);
print (B:  . B::$CONFIG . br);

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



Re: [PHP] Help with Array Sorting Please

2004-10-08 Thread Nick Wilson

* and then M Saleh EG declared
 i'd recommand u to use trees if u got complicated data arrays.
 
 use tree datascturcutres... u could sort n do watever then
 or jus queues or stacks depending on what u wanna do
 
 Try PEAR Tree class it might help
 
 Hope that was usefull.

*very* useful, thankyou so much! ;-)

-- 
Nick W

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



[PHP] finding links to jpg,mpg,avi

2004-10-08 Thread Mag
Hi,
I have seen this functionality in a PERL
program/script and would like to do the same
thing...but in php.

The way the script worked was, you give it a url:
http://somesite.com/pics-and-movies.html

pics-and-movies.html (the above example page) would
contain something like:

html
body
a href=pic1.jpg pic 1/a
a href=pic2.jpg pic 2/abr
...
a href=mgp1.mpg mpg 1/a
a href=mpg2.mpg mpg 2/abr
/body
/html

the scipt would find ONLY the links pointing to either
a .jpg or a .mpg and then display the size of each.

This is how far I have come:
1: via fopen download the entire page (done)

2: scan the page for all where href ends with .jpg or
mpg (cant work out logic for this)

3: send the names and url to a function to get the
sizes of each (did this with help from the php manual!
yeahhh!!)

biggest problem I have come accross is that the link
can be written like this
a href='pic.jpg' or
a href=pic.jpg or
a href=pic.jpg or
a class='blah' href='pic.jpg'
etc

HOW are these guys doing it? anybody? (I think I need
regex here...but dont know regex :-((  )

Thanks,
Mag




=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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



Re: [PHP] Re: sending mail -- nullmailer

2004-10-08 Thread John Nichel
Josh Howe wrote:
I don't want to setup and maintain a new mail server (sendmail) when we
already have an smtp server set up and maintained by our sys admin. Am I
crazy here? 

Can anybody recommend a good sendmail wrapper I can use that will work with
PHP and any other apps that use sendmail? Thanks
Well, to use the mail() functions on a *nix box, you need to have some 
MTA running on it.  Maybe php's *other* mail functions are more along 
the lines of what you're looking for

http://us4.php.net/imap
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] 1000+ character POSTed strings get mangled

2004-10-08 Thread Jonny Roller
If I POST a string greater than 1000 character through a form, the 
resulting string gets mangled.  What I get back is the first 1000 
characters of the string, then the name of the form variable, an equal 
sign (=) and then the entire string again.  If I change the form to a 
GET, this problem does not occur.

If I add a phpinfo() call to the same page, I see that $_REQUEST and 
$_POST variables are indeed mangled.  However, 
$_SERVER[CONTENT_LENGTH] reports the correct string length.

I did not compile PHP with the hardened flag... adding 
varfilter.max_value_length = 5000 to the php.ini file had no effect.

I recreated this form with a Perl CGI and could not recreate the problem 
in that environment.

I'm running PHP 4.3.8 with Apache 2.0.50 on Linux but it also occurred 
with PHP 4.3.9 on Apache 2.0.52.  However, a similarly configured (but 
not identical) server running the same versions of PHP and Apache does 
not exhibit this behavior.

Any assistance that can be provided would be greatly appreciated.
- Jonny Roller
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] 1000+ character POSTed strings get mangled

2004-10-08 Thread John Holmes
Jonny Roller wrote:
If I POST a string greater than 1000 character through a form, the 
resulting string gets mangled.  What I get back is the first 1000 
characters of the string, then the name of the form variable, an equal 
sign (=) and then the entire string again.  If I change the form to a 
GET, this problem does not occur.
[snip]
I'm running PHP 4.3.8 with Apache 2.0.50 on Linux but it also occurred 
with PHP 4.3.9 on Apache 2.0.52.  However, a similarly configured (but 
not identical) server running the same versions of PHP and Apache does 
not exhibit this behavior.
I remember an Apache2/PHP bug that caused issues like this with any 
request variables, but I couldn't find it on bugs.php.net. Have you 
reported this there, yet?

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Quotes in form textarea fields

2004-10-08 Thread Andrew Kreps
On Fri, 08 Oct 2004 06:22:22 -0700, Sam Smith [EMAIL PROTECTED] wrote:
 Then from FROM2.php we Submit BACK to FROM1.php and enter it back into the
 textarea field with:
 type=textarea, value=? echo $_POST['hidden']); ?

I'd like to add that you can also use the following syntax for textarea fields:

input type=textarea?= $_POST['hidden'] ?/textarea

which may also get you past the quoting problem.

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



Re: [PHP] Need help with a string

2004-10-08 Thread Andrew Kreps
On 8 Oct 2004 17:27:10 -, Tim Van Wassenhove [EMAIL PROTECTED] wrote:
 In article [EMAIL PROTECTED], Greg Donald wrote:
  On Fri, 8 Oct 2004 11:38:23 -0500, Brent Clements
 [EMAIL PROTECTED] wrote:
  Given the following string:
 
  $textString = Share A Dream Come True Parade 3:00 SpectroMagic Parade 9:00, 
  11:00 Wishes? nighttime spectacular 10:00
 
  I need to break the string up into pieces where as
 
  $string[1] = Share A Dream Come True Parade 3:00
  $string[2] = SpectroMagic Parade 9:00, 11:00
  $string[3] = Wishes? nighttime spectacular 10:00
 
  preg_match_all() is what you want to use.  You can easily match
  everything up to the time since it's formed with a :00 at the end
  each time.
 
 If i'm not mistaken, preg_split on \d{0,2}:\d{2}
 

You may want to add a \s+ to the end of that, in the event that there
is more than one time associated with the string, as in $string[2]. 
If you can count on the last 2 digits of the time followed by a space
determining your separator (and a comma means keep going), it should
work for you.

My best guess: /([\w\s]+[\d{1,2}:\d{2},*]+\s+)/

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



Re: [PHP] Quotes in form textarea fields

2004-10-08 Thread John Holmes
Andrew Kreps wrote:
I'd like to add that you can also use the following syntax for textarea fields:
input type=textarea?= $_POST['hidden'] ?/textarea
which may also get you past the quoting problem.
You mean you can use:
textarea name=hidden?=htmlentities($_POST['hidden'])?/textarea
unless you prefer depreciated code and cross site scripting 
vulnerabilities...

http://www.w3.org/TR/html4/interact/forms.html#input-control-types
http://www.w3.org/TR/html4/interact/forms.html#h-17.4
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Callback functions inside classes - how to?

2004-10-08 Thread Thomas Hochstetter
Hi again,
 
I have always been wondering how this is done properly:
 
Here is an example:
 
[snip]
 class A {
   function name( $a, $b, $c) {
  $tmp = array();
  $tmp[a] = $a;
  .
 array_push( $GLOBALS['XMLStack'], $tmp );
  }
 
  function parse() {
.. some definitions .
$parser-set_handler( root/page/title, name );
   . some more stuff here .
  }
}
[/snip]
 
What I want is to have the callback function name as it is in the above
example. But, obviously, the above code won't work. So, how do I tell the
set_handler function that it must use the name function from the class?
Using:
A::name or $this-name (if instantiated) . how do these callback
function calls work, because the same issue is with the xml handler
functions in php4 (have not as yet been to v5).
 
Also, how can I get the data from the callback function out without using
$GLOBALS? I cannot just return an array, can I?
 
Any ideas.
 
Thanks so  long.
 
Thomas


[PHP] Recursion to sanitize user input

2004-10-08 Thread zooming
I'm trying to sanitize my user input.  My sanitize function does not work if
I send a variable that's an array.  I'm using recursion to go through the
array.  The example below shows that $_POST['city'] works but $_POST['user']
doesn't work.  The array comes back blank.

Anyone see what's wrong with my code?

OUTPUT:

Array
(
[city] = New York
[user] =
)

CODE:

?php

function sanitize($userInput = '')
{
if ( is_array($userInput) )
{
foreach ( $userInput as $key = $value )
{
sanitize( $value );
}
}
else
{
if ( get_magic_quotes_gpc() )
{
return trim( $userInput );
}
else
{
return trim( addslashes($userInput) );
}
}
}

$_POST['city'] = 'New York';
$_POST['user']['firstName'] = 'Bob';
$_POST['user']['lastName'] = 'Smith';
$_POST['user']['country'] = 'USA';

foreach ( $_POST as $key = $value )
{
 $_POST[$key] = sanitize( $value );
}

echo 'pre';
echo print_r($_POST);
echo '/pre';

?

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



[PHP] Re: Recursion to sanitize user input

2004-10-08 Thread M. Sokolewicz
Very simple :)
when recursion happens, you return the sanitized value, but never store 
it ;)

[EMAIL PROTECTED] wrote:
I'm trying to sanitize my user input.  My sanitize function does not work if
I send a variable that's an array.  I'm using recursion to go through the
array.  The example below shows that $_POST['city'] works but $_POST['user']
doesn't work.  The array comes back blank.
Anyone see what's wrong with my code?
OUTPUT:
Array
(
[city] = New York
[user] =
)
CODE:
?php
function sanitize($userInput = '')
{
if ( is_array($userInput) )
{
foreach ( $userInput as $key = $value )
{
sanitize( $value );
}
}
else
{
if ( get_magic_quotes_gpc() )
{
return trim( $userInput );
}
else
{
return trim( addslashes($userInput) );
}
}
}
$_POST['city'] = 'New York';
$_POST['user']['firstName'] = 'Bob';
$_POST['user']['lastName'] = 'Smith';
$_POST['user']['country'] = 'USA';
foreach ( $_POST as $key = $value )
{
 $_POST[$key] = sanitize( $value );
}
echo 'pre';
echo print_r($_POST);
echo '/pre';
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Recursion to sanitize user input

2004-10-08 Thread zooming
Hi M

I don't understand.  I don't think I'm storing it anywhere.  I have it
looping through all the POST variables.  If it's not an array then the
sanitize function returns a sanitized value.  If it's an array then the
sanitize function calls itself again and again until it finds a single
variable and returns it as a sanitized value.


- Original Message -
From: M. Sokolewicz [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, October 08, 2004 6:19 PM
Subject: [PHP] Re: Recursion to sanitize user input


 Very simple :)
 when recursion happens, you return the sanitized value, but never store
 it ;)

 [EMAIL PROTECTED] wrote:

  I'm trying to sanitize my user input.  My sanitize function does not
work if
  I send a variable that's an array.  I'm using recursion to go through
the
  array.  The example below shows that $_POST['city'] works but
$_POST['user']
  doesn't work.  The array comes back blank.
 
  Anyone see what's wrong with my code?
 
  OUTPUT:
 
  Array
  (
  [city] = New York
  [user] =
  )
 
  CODE:
 
  ?php
 
  function sanitize($userInput = '')
  {
  if ( is_array($userInput) )
  {
  foreach ( $userInput as $key = $value )
  {
  sanitize( $value );
  }
  }
  else
  {
  if ( get_magic_quotes_gpc() )
  {
  return trim( $userInput );
  }
  else
  {
  return trim( addslashes($userInput) );
  }
  }
  }
 
  $_POST['city'] = 'New York';
  $_POST['user']['firstName'] = 'Bob';
  $_POST['user']['lastName'] = 'Smith';
  $_POST['user']['country'] = 'USA';
 
  foreach ( $_POST as $key = $value )
  {
   $_POST[$key] = sanitize( $value );
  }
 
  echo 'pre';
  echo print_r($_POST);
  echo '/pre';
 
  ?

 --
 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] Securing Servers

2004-10-08 Thread Stephen Craton
Hello,

I'm in the process of hooking up my own personal web server for use by
certain clients to view the progress on work I'm doing for them. However,
I'm on a shared network that is behind a firewall and some computers on the
network need to stay secure as possible. I've heard that if you gain access
to one computer, the whole thing is vulnerable.

I've going to be running Apache with PHP on my Windows box that has
antivirus all set up and whatnot. My question comes in terms of port
security. Since I'll be having the port open for Apache, I want to make sure
nothing naughty gets through the port. What should I do to secure it to the
best ability? Is there any special firewall I can use or any special tricks
I should do? How should I configure Apache and PHP in order to keep it as
secure as possible but still functional?

I have considered using Linux, but until I can get myself a separate
computer box to dedicate to the server, I'm stuck with using my personal
computer as the server as well and all my programs/games need Windows.

Any help here would be greatly appreciated.

Thanks,
Stephen Craton

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



Re: [PHP] Re: Recursion to sanitize user input

2004-10-08 Thread Comex
The recursion doesn't do anything with the returned value from the function.

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



  1   2   >