RE: [PHP] Max File Size

2002-12-05 Thread Roger Lewis


Hi,

Thursday, December 5, 2002, 5:11:16 PM, you wrote:
RL Jason Wong responded Wednesday, December 04, 2002 10:24 PM

RL  On Thursday 05 December 2002 10:14, Roger Lewis wrote:
RL   Thanks for the suggestion.  I'll try ini_set although I'm not yet
RL certain
RL   of how to use it.

RL  As has already been pointed out, the uploads take place *before* your
RL script
RL  is run. The manual has table which shows what you can and cannot
change
RL using
RL  ini_set().

RL  THE place to change it is in php.ini.

RL   I checked again and post_max_size is not in my php.ini, but perhaps
I
RL   should just add it.

RL  Perhaps you should indeed. I think it defaults to 2M, so if you
haven't
RL set it
RL  2MB is your limit.

RL   Also, I was wrong before - I do have a directive for memory_limit.
It
RL is
RL   8M

RL  I think this only has effect if php was compiled with
RL --enable-memory-limit.

RL   Regardless, this doesn't explain why I can't upload a file that
exceeds
RL 2M,
RL   except that I don't seem to be able to reset upload_max_filesize to
RL greater
RL   than 2M.

RL  You mean you set it in php.ini and phpinfo() reports something
different?

RL  --
RL  Jason Wong - Gremlins

RL That's what I've been trying to say, Jason.  I set upload_max_filesize
in
RL php.ini to 8M, 800, or any other number, restart Apache, and the
reset
RL seems to be ignored.  When looking at phpinfo, upload_max_filesize is
RL *always* 2M.
RL Adding the directive post_max_size = 16M to my php.ini did nothing
except
RL change my include_path settings ?%!?!*. (I can see in phpinfo that the
RL default is 8M, but there is no setting in my php.ini)
RL In reply to Tom's comment, there is no difference between master and
local
RL settings; however, there are no separate settings in my php.ini either.
RL Do you have any other thoughts on this?
RL Regards,
RL Roger




TR A shot in the dark check for:

TR file_uploads = On

TR --
TR regards,
TR Tom
file_uploads = 1.
I presume this is means on, right?

Roger


I think I figured it out.  The clue was that phpinfo() would show changes
that I wasn't making.  I concluded that it might be a syntax error in my
php.ini due to some weird line wrapping that was going on. (I can't see the
entire text on my telnet screen).  I deleted my entire section on Paths and
Directories and replaced with a clean section.  Then reset
upload_max_filesize and restarted Apache.
Wadda you know! It worked.
Thanks for all the comments and suggestions.

Roger


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




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


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




Re: [PHP] Struggling with code

2002-12-05 Thread Jason Wong
On Thursday 05 December 2002 15:44, Ben C. wrote:
 I am now getting the following error:

 Warning: Supplied argument is not a valid MySQL-Link resource in
 /home/httpd/vhosts/localhost/httpdocs/data/up.php
 on line 21

 Why do you think that is?

Try using mysql_error() after each of your mysql_*() functions.


-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Experience is not what happens to you; it is what you do with what happens
to you.
-- Aldous Huxley
*/


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




Re: [PHP] Struggling with code

2002-12-05 Thread Hugh Danaher
please post lines 20 and 21, get rid of all @, the comma after url='$url'
and show your most recent code.  Others have posted and given you good
advice, you should incorporate their suggestions.

hugh
- Original Message -
From: Ben C. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, December 04, 2002 11:44 PM
Subject: RE: [PHP] Struggling with code


 I am now getting the following error:

 Warning: Supplied argument is not a valid MySQL-Link resource in
 /home/httpd/vhosts/localhost/httpdocs/data/up.php
 on line 21

 Why do you think that is?

 -Original Message-
 From: Jason Wong [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, December 04, 2002 9:53 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Struggling with code


 On Thursday 05 December 2002 13:24, Ben C. wrote:
  I am struggling with the code below.  I keep getting the error Couldn't
  execute query.  Please help me out, let me know where I am going wrong.
 
  ?
 
  $db_name = db1;
  $table_name = user;
 
  $connection = @mysql_connect(localhost, user, password) or
  die(Couldn't connect.);
 
  $db = @mysql_select_db($db_name, $connection) or die(Couldn't select
  database.);
 
  $sql = UPDATE $table_name
  SET
  name = \$name\,
  lname = \$lname\,
  mobil = \$mobil\,
  email = \$email\,
  url = \$url\,
  WHERE id= \$id\
  ;
 
  $result = @mysql_query($sql,$connection) or die(Couldn't execute
 query.);
 
  ?

 How about NOT masking the error message by using mysql_query(), instead of
 @mysql_query(). And instead of using die(), use echo mysql_error().

 --
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *

 /*
 A rolling stone gathers no moss.
 -- Publilius Syrus
 */


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


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



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




Re: [PHP] How to create user in mySQL ?

2002-12-05 Thread Jason Wong
On Thursday 05 December 2002 14:36, Manisha wrote:
 I want to create mySQL user thr phpMyAdmin. I inserted one record in
 mysql.user table and one in mysql.db table,

 testing with following program

 ?
   $conn = @mysql_connect (localhost:/usr/home/nets/mysql/mysql-demo.sock,
 manisha, pass);
   echo(before conn  a);
   if ($conn){
   mysql_select_db (demo);
   echo(conn got it);
   }
 ?

 but not getting the connection - if try with old user and password - can
 get connected

 what's wrong ?

Why do people insist on asking MySQL questions on a PHP list?

search for flush privileges on the MySQL website.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
HEAD CRASH!!  FILES LOST!!
Details at 11.
*/


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




[PHP] Re: passing sessions via POST

2002-12-05 Thread Bastian Vogt
Hi,

make sure there's a session_start(); on each page.
Your server should keep the session_id.If it doesn't try this:
input type=hidden name=PHPSESSID value=$PHPSESSID

HTH,
Bastian


Myrage schrieb:

 How do we pass sessions via post ?? I seem to lose the session once it has
 been submitted through the POST Method.

 Any help??




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




RE: [PHP] Struggling with code

2002-12-05 Thread Ben C.
I have incorporated most of the suggestions.  My most recent code is:

?

$db_name = db1;
$table_name = user;

$connection = mysql_connect(localhost, user, password) or
die(Couldn't connect.);

$db = mysql_select_db($db_name, $connection) or die(Couldn't select
database.);

$sql = UPDATE user
SET
name = '$name',
lname = '$lname',
mobil = '$mobil',
email = '$email',
url = '$url',
WHERE id= '$id'

;

$result = mysql_query($sql,$connection) or mysql_error(Couldn't execute
query.);


?

-Original Message-
From: Hugh Danaher [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 12:07 AM
To: Ben C.
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Struggling with code


please post lines 20 and 21, get rid of all @, the comma after url='$url'
and show your most recent code.  Others have posted and given you good
advice, you should incorporate their suggestions.

hugh
- Original Message -
From: Ben C. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, December 04, 2002 11:44 PM
Subject: RE: [PHP] Struggling with code


 I am now getting the following error:

 Warning: Supplied argument is not a valid MySQL-Link resource in
 /home/httpd/vhosts/localhost/httpdocs/data/up.php
 on line 21

 Why do you think that is?

 -Original Message-
 From: Jason Wong [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, December 04, 2002 9:53 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Struggling with code


 On Thursday 05 December 2002 13:24, Ben C. wrote:
  I am struggling with the code below.  I keep getting the error Couldn't
  execute query.  Please help me out, let me know where I am going wrong.
 
  ?
 
  $db_name = db1;
  $table_name = user;
 
  $connection = @mysql_connect(localhost, user, password) or
  die(Couldn't connect.);
 
  $db = @mysql_select_db($db_name, $connection) or die(Couldn't select
  database.);
 
  $sql = UPDATE $table_name
  SET
  name = \$name\,
  lname = \$lname\,
  mobil = \$mobil\,
  email = \$email\,
  url = \$url\,
  WHERE id= \$id\
  ;
 
  $result = @mysql_query($sql,$connection) or die(Couldn't execute
 query.);
 
  ?

 How about NOT masking the error message by using mysql_query(), instead of
 @mysql_query(). And instead of using die(), use echo mysql_error().

 --
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *

 /*
 A rolling stone gathers no moss.
 -- Publilius Syrus
 */


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


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



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




RE: [PHP] Struggling with code

2002-12-05 Thread Ben C.
Hugh, I took away the comma from $url and it works.

Everyone, Thanks for your help!

Ben

-Original Message-
From: Ben C. [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 12:15 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Struggling with code


I have incorporated most of the suggestions.  My most recent code is:

?

$db_name = db1;
$table_name = user;

$connection = mysql_connect(localhost, user, password) or
die(Couldn't connect.);

$db = mysql_select_db($db_name, $connection) or die(Couldn't select
database.);

$sql = UPDATE user
SET
name = '$name',
lname = '$lname',
mobil = '$mobil',
email = '$email',
url = '$url',
WHERE id= '$id'

;

$result = mysql_query($sql,$connection) or mysql_error(Couldn't execute
query.);


?

-Original Message-
From: Hugh Danaher [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 12:07 AM
To: Ben C.
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Struggling with code


please post lines 20 and 21, get rid of all @, the comma after url='$url'
and show your most recent code.  Others have posted and given you good
advice, you should incorporate their suggestions.

hugh
- Original Message -
From: Ben C. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, December 04, 2002 11:44 PM
Subject: RE: [PHP] Struggling with code


 I am now getting the following error:

 Warning: Supplied argument is not a valid MySQL-Link resource in
 /home/httpd/vhosts/localhost/httpdocs/data/up.php
 on line 21

 Why do you think that is?

 -Original Message-
 From: Jason Wong [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, December 04, 2002 9:53 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Struggling with code


 On Thursday 05 December 2002 13:24, Ben C. wrote:
  I am struggling with the code below.  I keep getting the error Couldn't
  execute query.  Please help me out, let me know where I am going wrong.
 
  ?
 
  $db_name = db1;
  $table_name = user;
 
  $connection = @mysql_connect(localhost, user, password) or
  die(Couldn't connect.);
 
  $db = @mysql_select_db($db_name, $connection) or die(Couldn't select
  database.);
 
  $sql = UPDATE $table_name
  SET
  name = \$name\,
  lname = \$lname\,
  mobil = \$mobil\,
  email = \$email\,
  url = \$url\,
  WHERE id= \$id\
  ;
 
  $result = @mysql_query($sql,$connection) or die(Couldn't execute
 query.);
 
  ?

 How about NOT masking the error message by using mysql_query(), instead of
 @mysql_query(). And instead of using die(), use echo mysql_error().

 --
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *

 /*
 A rolling stone gathers no moss.
 -- Publilius Syrus
 */


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


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



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


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




Re: [PHP] ini function like ini_set and ini_alter

2002-12-05 Thread Franco Pozzer
Thanks Philip for the response.

I can to write in step by step for to explain well my situation.

1. my application work fine in Win32 system but I must to executed it also in
Linux and Mac env. It is possible. In Win32  in many case, I do not have
Apache and PHP install. It is possible to have other web_server like IIS
(Win32). The conflict with my application  are only for the TCP IP Port. In
Win32 system I can install Apache and PHP with same component of the
application without are invasive because *all* object (module apache + module
php + script php + XML files and so on ) are under my folder like
C:\OPENFEDRA\apache\htdocs... or C:\OPENFEDRA\php\extensionsetc

In the Linux system the distribution have Apache and PHP installed as for
default. I do not want to install Apache and PHP and I do not wnat to are
invasive in this env because it is possible that Apache and PHp are used to
worh with others application of the User's.

For this reson I think it is better to modify dinamically the php.ini
directives from my scripts PHP. In this way my application can work in the
other web_server like IIS but if it is PHP interpreted installed.

2. I have use include_once() function  at the init of the project. But in the
next time,  I have think that it is a good way to write my script PHP witout
to re-call in any script this function. I have discovered the
auto_prepend_files directive of the php.ini and it is a good way instead to
use in any script include_once() or require_once().
One other thing; I think that auto_prepend_file have a good peformance insted
of the include or require.

3. I have tried to use also the directives of Apache creating a file
.htaccess that he contains the directive of php.ini like this:
php_value auto_prepend_file
C:/OPENFEDRA/Apache/htdocs/fedra/sv/cfg/systemVariables.php  and without
modify my script PHP.

But I have not understood where to put these file  and then putting the
directive of Apache AllowOverride to the All value I have a InternalServer
error.

Also on this you can help me?

Ciao e grazie Franco.


Philip Olson wrote:

 Reread the docs here (the table):

   http://www.php.net/ini_set

 You cannot set this directive at runtime.  Using .htaccess
 is as close as you'll get to that.  I see no reason why
 using auto_prepend_file here would be better than include()
 as this is exactly what include() is for.

 Regards,
 Philip

 On 4 Dec 2002, Franco Pozzer wrote:

  Thanks for all.
 
  My end it is Apache 1.3.27 and PHP 4.3.2 in Win32 system NT 4.0.
 
  I have the php.ini auto_prepend_file  like this:
  auto_prepend_file=C:\OPENFEDRA\Apache\htdocs\fedra\sv\cfg\
 
  All work fine with this configuration of the php.ini.
 
  For same reason I must to do not configure php.ini and the directives
  auto_prepend_file must be null like auto_prepend_file =.
 
  I have discovered ini_alter function but I do not be able to work in my
  application.
 
  My script it is like:
  ?
  $path=C:\\OPENFEDRA\\Apache\\htdocs\\fedra\\sv\\cfg\\;
 
  echobr$pathbr;
 
  if(ini_alter('auto_prepend_file', $path.'systemVariables.php'))
   echo brini_alter successbr;
  else
   echo brini_alter failedbr;
 
  but do not work.
 
  If I change the ini_alter with include() it work all fine but I do not
  want to use include or require function.
 
  have sameone an idea about this code do not work??
 
  Thanks for all and if it is possible reply to me also to e-mail follow.
 
  [EMAIL PROTECTED]
  www.infocamere.it
 
 
 
 
  --
  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] Struggling with code

2002-12-05 Thread Hugh Danaher
Great to hear it works!
I'd still consider using addslashes and the only way I've gotten it to work
is to write them in like the following:
url='.addslashes($url).'
Looks messy but works.  Oh, and stripslashes on the output too.
Good Night!
Hugh
- Original Message -
From: Ben C. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 12:17 AM
Subject: RE: [PHP] Struggling with code


 Hugh, I took away the comma from $url and it works.

 Everyone, Thanks for your help!

 Ben

 -Original Message-
 From: Ben C. [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, December 05, 2002 12:15 AM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] Struggling with code


 I have incorporated most of the suggestions.  My most recent code is:

 ?

 $db_name = db1;
 $table_name = user;

 $connection = mysql_connect(localhost, user, password) or
 die(Couldn't connect.);

 $db = mysql_select_db($db_name, $connection) or die(Couldn't select
 database.);

 $sql = UPDATE user
 SET
 name = '$name',
 lname = '$lname',
 mobil = '$mobil',
 email = '$email',
 url = '$url',
 WHERE id= '$id'

 ;

 $result = mysql_query($sql,$connection) or mysql_error(Couldn't execute
 query.);


 ?

 -Original Message-
 From: Hugh Danaher [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, December 05, 2002 12:07 AM
 To: Ben C.
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Struggling with code


 please post lines 20 and 21, get rid of all @, the comma after url='$url'
 and show your most recent code.  Others have posted and given you good
 advice, you should incorporate their suggestions.

 hugh
 - Original Message -
 From: Ben C. [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, December 04, 2002 11:44 PM
 Subject: RE: [PHP] Struggling with code


  I am now getting the following error:
 
  Warning: Supplied argument is not a valid MySQL-Link resource in
  /home/httpd/vhosts/localhost/httpdocs/data/up.php
  on line 21
 
  Why do you think that is?
 
  -Original Message-
  From: Jason Wong [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, December 04, 2002 9:53 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] Struggling with code
 
 
  On Thursday 05 December 2002 13:24, Ben C. wrote:
   I am struggling with the code below.  I keep getting the error
Couldn't
   execute query.  Please help me out, let me know where I am going
wrong.
  
   ?
  
   $db_name = db1;
   $table_name = user;
  
   $connection = @mysql_connect(localhost, user, password) or
   die(Couldn't connect.);
  
   $db = @mysql_select_db($db_name, $connection) or die(Couldn't select
   database.);
  
   $sql = UPDATE $table_name
   SET
   name = \$name\,
   lname = \$lname\,
   mobil = \$mobil\,
   email = \$email\,
   url = \$url\,
   WHERE id= \$id\
   ;
  
   $result = @mysql_query($sql,$connection) or die(Couldn't execute
  query.);
  
   ?
 
  How about NOT masking the error message by using mysql_query(), instead
of
  @mysql_query(). And instead of using die(), use echo mysql_error().
 
  --
  Jason Wong - Gremlins Associates - www.gremlins.biz
  Open Source Software Systems Integrators
  * Web Design  Hosting * Internet  Intranet Applications Development *
 
  /*
  A rolling stone gathers no moss.
  -- Publilius Syrus
  */
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 


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


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



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




Re: [PHP] ini function like ini_set and ini_alter

2002-12-05 Thread Franco Pozzer
Thanks Janson.

plaese write  step by step how to do to confugure apache.

remeber this. I work in Win32 system and PHp worh as CGI.

I have created .htaccess like this: 

php_value 
auto_prepend_file=C:OPENFEDRA\Apache\htdocs\fedra\sv\cfg\systemvariables.php

and httpd.conf modify in this directives :
# 
# This controls which options the .htaccess files in directories can 
# override. Can also be All, or any combination of Options,
FileInfo, 
# AuthConfig, and Limit 
# 
AllowOverride All 

But I have and error like this: 

 error.log: [Wed Dec 04 15:14:53 2002] [alert] [client 127.0.0.1]
c:/openfedra/apache/htdocs/.htaccess: Invalid command 'php_value', perhaps
mis-spelled or
defined by a module not included in the server configuration 

The .htaccess files it is under this folder C:\OPENFEDRA\apache\conf\

Please see other response that I have write ed I have explain my test.

Thanks. ciao Franco.


Jason Wong wrote:

 On Thursday 05 December 2002 00:33, Franco Pozzer wrote:
  Thanks for all.
 
  My end it is Apache 1.3.27 and PHP 4.3.2 in Win32 system NT 4.0.
 
  I have the php.ini auto_prepend_file  like this:
  auto_prepend_file=C:OPENFEDRAApachehtdocsfedrasvcfg
 
  All work fine with this configuration of the php.ini.
 
  For same reason I must to do not configure php.ini and the directives
  auto_prepend_file must be null like auto_prepend_file =.

 Why could you not configure your php.ini?

 Other places where you can set auto_prepend_file is in httpd.conf or in a 
 ..htaccess file.

  I have discovered ini_alter function but I do not be able to work in my
  application.
 
  My script it is like:
  ?
  $path=C:\OPENFEDRA\Apache\htdocs\fedra\sv\cfg\;
 
  echobr$pathbr;
 
  if(ini_alter('auto_prepend_file', $path.'systemVariables.php'))

 You can't set the auto_prepend_file value at runtime -- auto_prepend has 
 (should have) already taken place by the time your script is run!




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




Re: [PHP] Regular Expresion Work on IP address

2002-12-05 Thread DL Neil
Dev,
Nice work!

Thanks for implementing the book's algorithm/proving it in PHP-PCRE, and I
do like your extension into an internal/external function.

I've not implemented your code (bookmarked for later) but some initial
comments:
- don't forget some of the other 'funnies' in the IP addressing scheme, most
notably 127.0.0.1 = localhost (which is also an 'internal' address) - I'd
need to read/remind myself of others...
- in the $parts[0]=255 type of construct, remember that the  is
superfluous - or the RegEx is overly specific (hence the discussion point
earlier)
- also the $parts[0] is a string, so 255 will be (marginally) faster
- similarly you could make $ip_state=0; into a boolean expression (and
function return value) which might enable the function call to read more
smoothly
- regardless, $ip_state is currently sometimes treated as a string and once
as an integer.
- I don't know your IP allocations but in net_check() shouldn't all the if()
logical ops be ANDs?

Any thoughts of extending it to work with IPng addresses (or whatever
they're calling it these days)?

Great stuff, keep it coming! (and when you've finished perhaps you could
submit it to one of the script libraries/improve on what they might already
have?)
=dn



 Well after reading John'ss and DL Neil's replys i came up with 2
functions.
 The first is to check to see if the entry is a valid IP address and the
 Next is to determine if it is a Private Network IP or not!.

 You can see this in action at:
 http://www.my-tangled-web.net/codebank/code/ip_check.php
 and the sorce for that page is at:

http://www.my-tangled-web.net/codebank/getsource.php?dir=file=ip_check.php

 Please if you test it and find a problem let me know!

 Thanks


 function ipcheck($ip_chk){
  $parts=explode(.,$ip_chk);
  if (preg_match

(/^([01]?\d\d?|2[0-4]\d|25[0-4])\.([01]?\d\d?|2[0-4]\d|25[0-4])\.([01]?\d\d
?|2[0-4]\d|25[0-4])\.([01]?\d\d?|2[0-4]\d|25[0-4])$/,
 $ip_chk))
  {
  if($parts[0]==0 || $parts[0]=255 ||$parts[1]=255 ||
 $parts[2]=255 || $parts[3]=255){
  $ip_state=0;
  }
  elseif($parts[0]255  $parts[1]255  $parts[2]255 
 $parts[3]255){
  $ip_state=1;
  }
  }
  else {
  $ip_state=0;
  }
  $this=that;
  return $ip_state;
 }

 function net_check($ip_2_chk){
  $parts=explode(.,$ip_2_chk);
  if($parts[0]==10){
  $network=internal;
  }
  elseif($parts[0]==172  $parts[1]=16 || $parts[1]=31){
  $network=internal;
  }
  elseif($parts[0]==192  $parts[1]==168){
  $network=internal;
  }
  else {
  $network=external;
  }
  return $network;
 };

 At 07:47 PM 12/4/2002 +, DL Neil wrote:
 John,
 
   I think it'd be hard to verify the range with a regex. ip2long and
long2ip
   do not validate. So, an option would be to write your own little
function
   that splits the $ip on the period, verifies there are 4 parts, then
checks
   that each part is between 1 and 255 inclusive.
 
 
 My other post on the subject notwithstanding, I agree.
 
 When I get time/when I get a round tuit, I'd like to do a performance
test
 on the (short) IP RegEx against what you have outlined:
 
 explode against .
 run resultant array through 0-255 validation function
 - and still have the semantic issues of 0.0.0.0, etc...
 
 Meantime, will sit here whistling and quietly muttering into my beard
(and
 dreaming of tuits),
 =dn
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


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




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




Re: [PHP] Struggling with code

2002-12-05 Thread liljim
Ben, consider re-working this slightly:

$result = mysql_query($sql,$connection) or mysql_error(Couldn't execute
query.);

mysql_error() doesn't take any arguments (other than maybe a resource
identifier ($connection, in this case)): it simply outputs problems, which
allows you to diagnose what's wrong with your script. Try throwing a bum
query in there and see what you get (I'm guessing it would be not a valid
mysql resource on line 21/22, which you've already reported in another
e-mail).

This would be a better way of doing things:

$result = mysql_query($sql,$connection) or die(Query failure:  .
mysql_error());

-James


Ben C. [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hugh, I took away the comma from $url and it works.

 Everyone, Thanks for your help!

 Ben

 -Original Message-
 From: Ben C. [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, December 05, 2002 12:15 AM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] Struggling with code


 I have incorporated most of the suggestions.  My most recent code is:

 ?

 $db_name = db1;
 $table_name = user;

 $connection = mysql_connect(localhost, user, password) or
 die(Couldn't connect.);

 $db = mysql_select_db($db_name, $connection) or die(Couldn't select
 database.);

 $sql = UPDATE user
 SET
 name = '$name',
 lname = '$lname',
 mobil = '$mobil',
 email = '$email',
 url = '$url',
 WHERE id= '$id'

 ;

 $result = mysql_query($sql,$connection) or mysql_error(Couldn't execute
 query.);


 ?

 -Original Message-
 From: Hugh Danaher [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, December 05, 2002 12:07 AM
 To: Ben C.
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Struggling with code


 please post lines 20 and 21, get rid of all @, the comma after url='$url'
 and show your most recent code.  Others have posted and given you good
 advice, you should incorporate their suggestions.

 hugh
 - Original Message -
 From: Ben C. [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, December 04, 2002 11:44 PM
 Subject: RE: [PHP] Struggling with code


  I am now getting the following error:
 
  Warning: Supplied argument is not a valid MySQL-Link resource in
  /home/httpd/vhosts/localhost/httpdocs/data/up.php
  on line 21
 
  Why do you think that is?
 
  -Original Message-
  From: Jason Wong [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, December 04, 2002 9:53 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] Struggling with code
 
 
  On Thursday 05 December 2002 13:24, Ben C. wrote:
   I am struggling with the code below.  I keep getting the error
Couldn't
   execute query.  Please help me out, let me know where I am going
wrong.
  
   ?
  
   $db_name = db1;
   $table_name = user;
  
   $connection = @mysql_connect(localhost, user, password) or
   die(Couldn't connect.);
  
   $db = @mysql_select_db($db_name, $connection) or die(Couldn't select
   database.);
  
   $sql = UPDATE $table_name
   SET
   name = \$name\,
   lname = \$lname\,
   mobil = \$mobil\,
   email = \$email\,
   url = \$url\,
   WHERE id= \$id\
   ;
  
   $result = @mysql_query($sql,$connection) or die(Couldn't execute
  query.);
  
   ?
 
  How about NOT masking the error message by using mysql_query(), instead
of
  @mysql_query(). And instead of using die(), use echo mysql_error().
 
  --
  Jason Wong - Gremlins Associates - www.gremlins.biz
  Open Source Software Systems Integrators
  * Web Design  Hosting * Internet  Intranet Applications Development *
 
  /*
  A rolling stone gathers no moss.
  -- Publilius Syrus
  */
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 


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




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




[PHP] Variables and http

2002-12-05 Thread hacook
Hi all,
I have a page (to create a database) with X text fields called chpX (chp0,
chp1, chp2..Etc) that posts these variables to a php file.
I would like to know how can i get these values ? (I have also the $i
variable that tells me what is the max X)

Thanks,
Hacook



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




[PHP] Checking for Overlapping Dates

2002-12-05 Thread Thomas . Churm
Hi, 

Background: 


I've created a vacation-request application for our company's intranet. 
When an employee requests a vacation, he has to list the name of another 
employee who will 'fill in' for him while he is gone. 

Before a vacation request can be saved in MySQL, I need to check to make 
sure that the person listed as the employee's replacement during this time 
has not already requested a vacation during the same time period...to 
check to be sure that the two vacation periods do not overlap. 

Date Ranges: 


I have fields saved in MySQL called unixStartDate  unixEndDate that are 
unix timestamps for the first day of the employee's vacation and the last 
day of the emplosyee's vacation. 

I have tried to do a check using purely SQL, but this doesn't account for 
all possibilities of overlapping dates: 

(unixStartDate is the unix timestamp for the replacement, whereas the PHP 
var $unixStartDate is the unix timestamp for the employee who wants to 
post a new vacation request) 

$checkSQL = SELECT * from $DB_TBLName WHERE 
(Trim(WorkerEmail)='$userReplacementEmail') 
AND (Status  40) 
AND 
( 
( 
($unixStartDate = unixStartDate) 
) 
OR 
( 
($unixEndDate = unixEndDate) 
) 
OR 
( 
($unixStartDate = unixEndDate) 
) 
OR 
( 
($unixEndDate = unixStartDate) 
) 
OR 
( 
(unixStartDate  $unixStartDate)  (unixEndDate  $unixEndDate) 
) 
OR 
( 
(unixStartDate  $unixStartDate)  (unixEndDate  $unixEndDate) 
) 
) 
; 

So I think what I instead need to do is use PHP code instead of SQL to 
check for overlapping dates in the 2 date ranges I have. 
My two ranges would be like this: 

Replacement's Date Range: 

$unixStartDateReplacementVacation 
...to... 
$unixEndDateReplacementVacation 

Employee's Date Range: 

$unixStartDateEmployeeVacation 
...to.. 
$unixEndDateEmployeeVacation 




...so i need to check that none of the dates occuring in the first date 
range listed above appear in the second date range. 
unfortunately, i have no basic idea of how i should go about doing 
this...should i use arrays of dates, for-loops, or what? 
thanks a whole lot in advance, 

Tom


Re: [PHP] Struggling with code

2002-12-05 Thread Jason Wong
On Thursday 05 December 2002 16:43, Hugh Danaher wrote:
 Great to hear it works!
 I'd still consider using addslashes and the only way I've gotten it to work
 is to write them in like the following:
 url='.addslashes($url).'
 Looks messy but works. 

Messy indeed ;)  Why not $url = addslashes($url) beforehand THEN use it to 
construct the query?

 Oh, and stripslashes on the output too.

No need for stripslashes() when _retrieving_ from the db.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
People will do tomorrow what they did today because that is what they
did yesterday.
*/


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




Re: [PHP] Variables and http

2002-12-05 Thread Timothy Hitchens (HiTCHO)
Are you saying this is coming from a form entry?

If so and you have PHP  4.1  then use:

$_GET['chp1'] OR $_POST['chp1']

Depends if it is get or post data!!

If you have pre 4.1 use the var name eg. $chp1 etc etc


Timothy Hitchens (HiTCHO)
[EMAIL PROTECTED]


If you need PHP hosting with an experienced
support team 24/7 then email me today.

On Thu, 5 Dec 2002, hacook wrote:

 Hi all,
 I have a page (to create a database) with X text fields called chpX (chp0,
 chp1, chp2..Etc) that posts these variables to a php file.
 I would like to know how can i get these values ? (I have also the $i
 variable that tells me what is the max X)

 Thanks,
 Hacook



 --
 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] ini function like ini_set and ini_alter

2002-12-05 Thread Jason Wong
On Thursday 05 December 2002 17:29, Franco Pozzer wrote:

 plaese write  step by step how to do to confugure apache.

 remeber this. I work in Win32 system and PHp worh as CGI.

I don't use PHP as CGI with Apache so I don't think I can help you here.

But ...

 I have created .htaccess like this:

 php_value
 auto_prepend_file=C:OPENFEDRA\Apache\htdocs\fedra\sv\cfg\systemvariables.p
hp

... I have a feeling that if you're using PHP/CGI then you cannot set PHP 
options using a .htaccess file ...

 But I have and error like this:

  error.log: [Wed Dec 04 15:14:53 2002] [alert] [client 127.0.0.1]
 c:/openfedra/apache/htdocs/.htaccess: Invalid command 'php_value', perhaps
 mis-spelled or
 defined by a module not included in the server configuration

... which is why you get this error.

In any case, the correct way to specify php options in a .htaccess file is:

php_value auto_prepend_file C:OPENFEDRA\Apache\xxx\xxx\xxx.php

NB there should not be an '='.


-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
static buildup
*/


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




Re: [PHP] Creating dynamic names for images

2002-12-05 Thread Marek Kilimajer
I use this function:

function sec_move_uploaded_file($tmp_name,$dir, $name) {
   if(file_exists($dir.'/'.$name)) {
   $ext=strrchr($name,'.');
   $basename=substr($name,0,strlen($name)-strlen($ext));
   $i=2;
   while(file_exists($dir.'/'.$basename.$i.$ext) ) {
   $i++;
   }
   $name=$basename.$i.$ext;
   }
   //echo copying $tmp_name to $dir/$namebr;
   return ( $r=move_uploaded_file($tmp_name, $dir.'/'.$name) ? $name : $r);
}

Davíð Örn Jóhannsson wrote:


I have a situation where I allow users to upload images, and I store the
names of the images in a database and the images  I store in a some
folder on the server, but what I would like to do is to dynamically
create names for the images and dont ever have to worry about if this
name exists and with out having to got to the trouble of asking the user
to change tha name of the file.

So dose some one have a nice litle solution for this problem.

Thanks, David


 



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




[PHP] Re: Variables and http

2002-12-05 Thread Mattia

Hacook [EMAIL PROTECTED] ha scritto nel messaggio
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi all,
 I have a page (to create a database) with X text fields called chpX (chp0,
 chp1, chp2..Etc) that posts these variables to a php file.
 I would like to know how can i get these values ? (I have also the $i
 variable that tells me what is the max X)


first you have to create the var name in a string, like

$var = 'chp'.$i ; // $i is the number

then retrive the posted value

$value = $_POST[$var] ;

bye



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




[PHP] Re: Post Variables

2002-12-05 Thread Mattia

 for ($i=0; $i=12; $i++)
 {
 echo select name='$i';
 echo option values;
 }

the select...  tag must stay out of the for loop. the syntax for
select... is

select ...
  option.../option
  option.../option
  option.../option
  option.../option
  
/select

bye
Mattia



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




[PHP] sessions

2002-12-05 Thread Martin Hudec
Hello,

I have following problem:

i have one script (index.php) which displays information (menu items)
based on result from function check_valid_user(). This function checks
if there is session_is_registered(valid_user).

second script is for login.it saves into session
session_register(valid_user).then it reloads parent window
(index.php), which will then again check validity of user...but it
does not work.

does anyone know why?

register globals are on.

-- 
Best regards,
 Martin  mail   [EMAIL PROTECTED]
 mobile +421.907.303.393
 icq34358414
 wwwhttp://www.corwin.sk

PGP key fingerprint  21365ca05ecfd8aeb1cf19c838fff033

In those days spirits were brave, the stakes were high, 
 men were real men, women were real women and small furry 
 creatures from Alpha Centauri were real small furry creatures 
 from Alpha Centauri.

by Douglas Adams


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




[PHP] Copy question

2002-12-05 Thread Evandro Sestrem
Hi,

Can I use the copy function to copy a file to a remote computer?
Ex:
// copy a file from my computer to a remote computer
copy('c:\teste.txt', '200.xxx.xx.xx/temp/teste.txt')

How can I do it?

Thanks in advance,

Evandro Sestrem



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




[PHP] passing form variables with the same name

2002-12-05 Thread Doug Parker
I'm passing form variables from a script that is meant to display 
information to be updated in a mysql database, and it sends these to a 
script that updates the changed values.  The problem is, I have a number 
of the same field being passed.  For example, I have two fields in an 
html form - Resource and Task, that need to be updated in a specific 
table, let's call it Projects.  However, I need to update every Resource 
and Task in table Projects.   So if there were 5 rows in Projects, the 
script would display the values for Task and Resource for all 5 rows, so 
that would total 10 input boxes.  Obviously, I loop the display of these 
variables in input boxes as to get all 5 rows.  So in order to send the 
variables to the script that will update them, they need to be unique - 
right?  I can't have the input name=Resource  for each one, so in the 
loop on the form I resolved this by appending a number to each one - 
e.g. input name=Resource1, input name=Task1, input name=Resource2, 
... etc.  So now I have the unique variables I need, the problem is that 
I have no idea how to loop through them in the update script and update 
each one accordingly.   Can someone give me an idea how to do this?  I'd 
love to use an array, but I don't think you can pass an array value from 
a form and have it work on the update script - e.g. input 
name=Resource[0]...

any help would be greatly appreciated.


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



Re: [PHP] Copy question

2002-12-05 Thread Marek Kilimajer
No, you can use ftp functions.

Evandro Sestrem wrote:


Hi,

Can I use the copy function to copy a file to a remote computer?
Ex:
// copy a file from my computer to a remote computer
copy('c:\teste.txt', '200.xxx.xx.xx/temp/teste.txt')

How can I do it?

Thanks in advance,

Evandro Sestrem



 



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




Re: [PHP] passing form variables with the same name

2002-12-05 Thread 1LT John W. Holmes
 I'd love to use an array, but I don't think you can pass an array value
from
 a form and have it work on the update script - e.g. input
 name=Resource[0]...

Ah, but you can... You can use exactly what you just wrote and have
$_POST['Resource'][0] in your processing script. Loop through that array and
you're good to go. Or, you can name them as name=Resource[] and let PHP
handle creating the keys (they'll start at zero, anyhow).

Enjoy...

---John Holmes...


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




Re: [PHP] sessions

2002-12-05 Thread 1LT John W. Holmes
 i have one script (index.php) which displays information (menu items)
 based on result from function check_valid_user(). This function checks
 if there is session_is_registered(valid_user).

 second script is for login.it saves into session
 session_register(valid_user).then it reloads parent window
 (index.php), which will then again check validity of user...but it
 does not work.

 does anyone know why?

Yes... my magic PHP 8-ball says you are missing a semi-colon, period, or
quote, or your logic is wrong and something isn't working...

---John Holmes...

PS: :) Show us your code so we can see what's going on.


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




Re: [PHP] ini function like ini_set and ini_alter

2002-12-05 Thread Franco Pozzer
Thanks Jason.

I use PHP as CGI in Win32 system because It is most stable like Apache
module.

I have make a same code PHP like this follow that I try ini_set and
ini_aletr function instead of the -htaccess solution.

The code that  try it is this:

?
$path=C:\\openfedra\\apache\\htdocs\\fedra\\sv\\cfg\\;
echobr$pathbr;

echo ini_get(include_path);
echobr;

echo ini_set(include_path, ini_get(include_path) . .; .$path);
echobr;

echo ini_get(include_path);
echobr;

echo ini_get(auto_prepend_file);
echobr;

if(ini_alter(auto_prepend_file, $path . systemVariables.php))
echo brini_alter successbr;
else
echo brini_alter failedbr;

echo ini_get(auto_prepend_file);
echobr;

echobrxPathLibraryExt=$xPathLibraryExtbr; 

The file that I try to *load* into my script it is in the
C:\OPENFEDRA\apache\htdocs\fedra\sv\cfg\systemVariables and it is this:

?
 $document_root = getenv('DOCUMENT_ROOT');
 $xPathLibraryExt=$document_root./fedra/sv/src/lib/;
 $systemVariables=$document_root./fedra/sv/cfg;
 $tabelle_genExt=$document_root./fedra/sv/xml/lookup/;
 $tabella_comExt=$document_root./fedra/sv/xml/lookup/;
 $elenco_pratExt=$document_root./fedra/sv/pratiche/;
 $modelliExt=$document_root./fedra/sv/xml/xmlguida/;
 $praticheExt=$document_root./fedra/sv/pratiche/;
 $sezioniExt=$document_root./fedra/sv/xml/xmlguida/;
 $riquadriExt=$document_root./fedra/sv/xml/xmlguida/;
 $lookupExt = $document_root./fedra/sv/xml/lookup/;
 $xmlguidaExt = $document_root./fedra/sv/xml/xmlguida/;
 $formPhpExt =  $document_root./fedra/sv/src/formphp/;
 $srcJsExt = $document_root./fedra/sv/src/js/;
 $srcPhpExt = $document_root./fedra/sv/src/php/;
 $srcHtmlExt = $document_root./fedra/sv/src/html/;
 $FolderTmpExt = $document_root./fedra/sv/tmp;
?

The error it is: 

C:\openfedra\apache\htdocs\fedra\sv\cfg\
;c:\php4\pear
;c:\php4\pear
;c:\php4\pear.;C:\openfedra\apache\htdocs\fedra\sv\cfg\


ini_alter failed
C:\openfedra\apache\htdocs\fedra\sv\cfg\systemVariables.php

xPathLibraryExt=

Warning: Failed opening 'functionXpath.php' for inclusion
(include_path='.;c:\php4\pear.;C:\openfedra\apache\htdocs\fedra\sv\cfg\')
in C:\OPENFEDRA\Apache\htdocs\fedra\sv\src\html\benvenut.php on line 39

Warning: Failed opening 'datiConfig.php' for inclusion
(include_path='.;c:\php4\pear.;C:\openfedra\apache\htdocs\fedra\sv\cfg\')
in C:\OPENFEDRA\Apache\htdocs\fedra\sv\src\html\benvenut.php on line 58

I this that auto_prepend_file it is set by ini_alter function because the
echo before and after function write the odl (Null value) and new value
(C:\openfedra\apache\htdocs\fedra\sv\cfg\systemVariables.php).

But  do not undestand because The ini_alter exit with failed and because
the next path variables are not find in the script.

Ciao franco.

Jason Wong wrote:

 On Thursday 05 December 2002 17:29, Franco Pozzer wrote:
 
  plaese write  step by step how to do to confugure apache.
 
  remeber this. I work in Win32 system and PHp worh as CGI.

 I don't use PHP as CGI with Apache so I don't think I can help you here.

 But ...

  I have created .htaccess like this:
 
  php_value
  auto_prepend_file=C:OPENFEDRAApachehtdocsfedrasvcfgsystemvariables.p
 hp

  I have a feeling that if you're using PHP/CGI then you cannot set PHP 
 options using a .htaccess file ...

  But I have and error like this:
 
   error.log: [Wed Dec 04 15:14:53 2002] [alert] [client 127.0.0.1]
  c:/openfedra/apache/htdocs/.htaccess: Invalid command 'php_value', perhaps
  mis-spelled or
  defined by a module not included in the server configuration

  which is why you get this error.

 In any case, the correct way to specify php options in a .htaccess file is:

 php_value auto_prepend_file C:OPENFEDRAApachex.php

 NB there should not be an '='.





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




Re: [PHP] sessions

2002-12-05 Thread Stephen
Show us your code and don't copy straight from books. ;-)


- Original Message - 
From: 1LT John W. Holmes [EMAIL PROTECTED]
To: Martin Hudec [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 7:57 AM
Subject: Re: [PHP] sessions


  i have one script (index.php) which displays information (menu items)
  based on result from function check_valid_user(). This function checks
  if there is session_is_registered(valid_user).
 
  second script is for login.it saves into session
  session_register(valid_user).then it reloads parent window
  (index.php), which will then again check validity of user...but it
  does not work.
 
  does anyone know why?
 
 Yes... my magic PHP 8-ball says you are missing a semi-colon, period, or
 quote, or your logic is wrong and something isn't working...
 
 ---John Holmes...
 
 PS: :) Show us your code so we can see what's going on.
 
 
 -- 
 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] Looping Addition

2002-12-05 Thread Stephen
One more question... If I then wanted to do this for the other operations
(such as multiplication, division, etc), how would I do that?


- Original Message -
From: John W. Holmes [EMAIL PROTECTED]
To: 'Stephen' [EMAIL PROTECTED]; 'Chris Wesley'
[EMAIL PROTECTED]
Cc: 'PHP List' [EMAIL PROTECTED]
Sent: Wednesday, December 04, 2002 9:01 PM
Subject: RE: [PHP] Looping Addition


  Let me explain this as best I can. The user enters how many numbers he
  wants
  to add. This form goes to another page. This page loops a form field
 and
  it's name is num and after num is the number it is currently on.
 Here's
  the code:
 
form name=add method=post action=?php $_SERVER['PHP_SELF'];
 ?
  tr
td width=35%How many numbers to add:/td
tdinput name=vars type=text id=vars value=2 size=10
  maxlength=2/td
  /tr
  tr
td colspan=2div align=center
input name=submit type=submit id=submit value=Next
  gt;
  /div/td
  /tr
/form
  ?php
   }
   else
   {
if(!is_numeric($_POST['vars']) || $_POST['vars'] = 1)
{
 echo a href=\javascript:history.back(-1)\Go back/a and enter
 a
  number or something greater then 1. DO NOT enter a letter or symbol.;
}
else
{
  ?
  form name=add action=module.php?id=?php echo
 $HTTP_GET_VARS['id'];
  ?show=calculate method=post
  input type=hidden name=vars value=?php echo $_POST['vars'];
 ?
  ?php
   $current = 1;
   do
   {
  ?
  tr
td width=35%?php echo Number .$current.:; ?/td
tdinput name=num?php echo $current; ? type=text
 id=vars
  value=0 size=25/td
  /tr
  ?php
   $current++;
   } while($current = $_POST['vars'])
  ?

 Change the above to:

 ?php
 for($x=0;$x$_POST['vars'];$x++)
 {
   ?
 tr
 td width=35%Number ?php echo $x; ?:/td
 tdinput name=num[] type=text id=vars value=0 size=25/td
 ?php } ?

  tr
td colspan=2div align=center
input name=add type=submit id=add value=Next gt;
  /div/td
  /tr
  /form
 
  This is only a snippet, there is more to it but for simplicities
 sake...
  Then I calculate it. My question is, how would I loop the adding? I
 hope
  you
  understand this now...

 And to do the addition...

 $sum = array_sum($_POST['num']);

 ---John Holmes...





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




[PHP] code for my question about sessions ;) sorry

2002-12-05 Thread Martin Hudec
Hello ,

okay here's the code...sorry forgot to post it
everything works in login.phpsession is registered...but in index,
it seems that session is empty...

login.php:
?
session_start();
include (forum_fns.php);
login($username);
echo script language=\JavaScript\;
//reloads index.php (login.php is popup from index.php
echo window.opener.location.reload();;
echo setTimeout('window.close()',1000);
echo /script;
?


index.php:
?
session_start();
include (forum_fns.php);
if (check_valid_user())
 {
  $login_status = true;
 }
 else
 {
  $login_status = false;
 }
if ($login_status == false)
 {
  echo LOGGED IN;
 }
 else
 {
  echo NOT LOGGED IN;
 }

?


forum_fns.php:
?
//will just set $username
//we are talking only about session all other works
$username = Corwin;

function login($username)
 {
  global $valid_user;
  $valid_user = $username;
  session_register(valid_user);
 }

function check_valid_user()
 {
  if (session_is_registered(valid_user))
   {
echo \$valid_user registeredbr;
return true;
   }
   else
   {
echo \$valid_user not registered!!br;
return false;
   }
 }
?



-- 
Best regards,
 Martin  mail   [EMAIL PROTECTED]
 mobile +421.907.303.393
 icq34358414
 wwwhttp://www.corwin.sk

PGP key fingerprint  21365ca05ecfd8aeb1cf19c838fff033

In those days spirits were brave, the stakes were high, 
 men were real men, women were real women and small furry 
 creatures from Alpha Centauri were real small furry creatures 
 from Alpha Centauri.

by Douglas Adams


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




Re: [PHP] code for my question about sessions ;) sorry

2002-12-05 Thread Stephen
I don't know if this will fix anything or not but instead of using
check_valid_user(), try making the if statement say this:

is(!isset($_SESSION['valid_user))
{
echo NOT LOGGED IN;
}
else
{
echo LOGGED IN;
}


- Original Message -
From: Martin Hudec [EMAIL PROTECTED]
To: 1LT John W . Holmes (U.S. Army) [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 8:18 AM
Subject: [PHP] code for my question about sessions ;) sorry


 Hello ,

 okay here's the code...sorry forgot to post it
 everything works in login.phpsession is registered...but in index,
 it seems that session is empty...

 login.php:
 ?
 session_start();
 include (forum_fns.php);
 login($username);
 echo script language=\JavaScript\;
 //reloads index.php (login.php is popup from index.php
 echo window.opener.location.reload();;
 echo setTimeout('window.close()',1000);
 echo /script;
 ?

 
 index.php:
 ?
 session_start();
 include (forum_fns.php);
 if (check_valid_user())
  {
   $login_status = true;
  }
  else
  {
   $login_status = false;
  }
 if ($login_status == false)
  {
   echo LOGGED IN;
  }
  else
  {
   echo NOT LOGGED IN;
  }

 ?

 
 forum_fns.php:
 ?
 //will just set $username
 //we are talking only about session all other works
 $username = Corwin;

 function login($username)
  {
   global $valid_user;
   $valid_user = $username;
   session_register(valid_user);
  }

 function check_valid_user()
  {
   if (session_is_registered(valid_user))
{
 echo \$valid_user registeredbr;
 return true;
}
else
{
 echo \$valid_user not registered!!br;
 return false;
}
  }
 ?



 --
 Best regards,
  Martin  mail   [EMAIL PROTECTED]
  mobile +421.907.303.393
  icq34358414
  wwwhttp://www.corwin.sk

 PGP key fingerprint  21365ca05ecfd8aeb1cf19c838fff033

 In those days spirits were brave, the stakes were high,
  men were real men, women were real women and small furry
  creatures from Alpha Centauri were real small furry creatures
  from Alpha Centauri.

 by Douglas Adams


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




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




[PHP] Re: Variables and http

2002-12-05 Thread Tristan Carron
thanks, works perfectly

- Original Message -
From: Mattia [EMAIL PROTECTED]
Newsgroups: php.general
To: [EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 12:41 PM
Subject: Re: Variables and http



 Hacook [EMAIL PROTECTED] ha scritto nel messaggio
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi all,
  I have a page (to create a database) with X text fields called chpX
(chp0,
  chp1, chp2..Etc) that posts these variables to a php file.
  I would like to know how can i get these values ? (I have also the $i
  variable that tells me what is the max X)


 first you have to create the var name in a string, like

 $var = 'chp'.$i ; // $i is the number

 then retrive the posted value

 $value = $_POST[$var] ;

 bye




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




Re: [PHP] Howto: run local script to update remote script

2002-12-05 Thread David T-G
eriol --

Yes, a cron job would do the trick for a process that must run at fixed
and frequest intervals.  The Windows scheduler might accomplish the same
thing.

Since we've already veered sharply off-topic, I'll go ahead and recommend
that you check out dyndns.org or the like; set up your address (they'll
give you one like eriol.dyndns.org for free), download some software to
your box, and then it will always be available at that fully-qualified
name, without any PHP magic; your friends would just point a browser or
ftp client to eriol.dyndns.org and start sucking down MP3s.

If you do go with a php script (on either end), be careful how you then
implement it; anyone could hijack your pointer by connecting to the same
script with your password.  Better to do something like encrypt your
current [external, of course] IP address (and maybe timestamp and maybe
who knows what else, with the more you can throw on the better) with a
secret password and send the garbage over the wire to your Linux server;
the script there also knows the password and decrypts the stuff and
checks to see that the sent IP matches the sending IP (and anything else
that you want to check) but you haven't actually exposed your password on
the wire.


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg88457/pgp0.pgp
Description: PGP signature


Re: [PHP] Looping Addition

2002-12-05 Thread 1LT John W. Holmes
 One more question... If I then wanted to do this for the other operations
 (such as multiplication, division, etc), how would I do that?

Assuming you've figured out how to do an array...

You'll have to loop through the values like in the code that others posted.

foreach($_POST['number'] as $num)
{ //calculate total here with $num }

* = multiplication
/ = divide

---John Holmes...




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




Re: [PHP] Advice with encrypting+storing sensitive data

2002-12-05 Thread ªüYam
Would u teach me how to setup the OpenSSL and the engine for the apache web
server in order to achieve the 128 bits SSL protection?
Actually, I have tried so many times but still failed to do so...
First of all, there were errors occurred when I compiled the Openssl engine,
It seemed looking for a wrong file paths itself, however, I don't know how
to correct it...
Would u like to help me please? thx a lot
Bahwi [EMAIL PROTECTED] ¼¶¼g©ó¶l¥ó·s»D
:[EMAIL PROTECTED]
 That's a big question.

 The most secure way, using either mcrypt or PGP, is to have an
 application on the client's side that does the encryption and the
 decryptiong. This is probably the best solution. Heavily encrypt things
 on both sides, and this assumes the client side is secure.

 Barring this, you're going to have holes no matter what. Especially with
 man in the middle attacks (MITM).

 Use SSL, 128-bit SSL. This will help the most.

 The next best thing is to store it in session variables, but build your
 own system perhaps, and yes, encrypt it lightly with some system and a
 system passphrase. Clean up the sessions as soon as possible. And store
 a bunch of other data in there. Perhaps store the passphrase as the
 variable 'Height' or 'Bytes' or something, and store 'Password'
 'Passphrase' with dummy data. Not too much, you want to throw the person
 off as much as possible.

 Then, you need to obfuscate or preferably, encode your script so know
 one can figure out your scheme. Hope this helps some.

 --Joseph Guhlin
 http://www.josephguhlin.com/
 Web Programmer / Unix Consultant / PHP Programmer






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




[PHP] Script not working from one computer

2002-12-05 Thread 1LT John W. Holmes
I know, PHP is executed server side, so it shouldn't matter about the computer, but...

I've got a basic log in script that takes username and password and does the typical 
SELECT to find a match. If it's good, it sets some session variables and redirects to 
a main page, otherwise redirects back to the login page with an error message.

The script works from all computers but one. The login page will come up, but no 
matter what, it says the username and password are bad. They are correct though, caps 
lock isn't on, etc. I've cleared the cookies and cache and it still does the same 
thing.

The script is on an intranet. One computer that had this issue was fixed by using 
https://computername.company.army.mil instead of just https://computername. But for 
this computer, both addresses give the same result. 

So, I'm sure it's not the PHP script, so I'm looking for ideas of what I should check, 
settings wise, on the client computer? Any help is greatly appreciated.

---John Holmes...


Re: [PHP] Script not working from one computer

2002-12-05 Thread @ Edwin
Hello,

1LT John W. Holmes [EMAIL PROTECTED] wrote:
[snip]
 So, I'm sure it's not the PHP script, so I'm looking for ideas of what I
 should check, settings wise, on the client computer? Any help is greatly
 appreciated.
[/snip]

Well, my magic PHP 8-ball says... Just kidding :)

Anyway, here's a long shot:

What browser are you using? Encryption is 128bit? If you're using one with
40bit or 56bit(?), I'm sure it won't work against a server with 128bit
SSL...

- E

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




Re: [PHP] mysql, php, checkbox

2002-12-05 Thread Adrian Partenie

Indeed, now it works, I put the form tag by mistake...
Thanks,
Adrian

- Original Message -
From: rija [EMAIL PROTECTED]
To: Adrian Partenie [EMAIL PROTECTED]
Sent: Tuesday, December 03, 2002 11:30 PM
Subject: Re: [PHP] mysql, php, checkbox


 There are form/form tags around input type=checkbox ... What are
they
 supposed to do?
 I think your problem lies there, because ids[] belong to this new form not
 to the first one and then ids[] cannot be set.

 Secondly,  method='post' inside input does nothing.

 Hope that helps.

 - Original Message -
 From: Adrian Partenie [EMAIL PROTECTED]
 To: php [EMAIL PROTECTED]
 Sent: Wednesday, December 04, 2002 4:50 AM
 Subject: Re: [PHP] mysql, php, checkbox


  It works, but just for the first row selected from the table. I think
that
  the problem is that the checkboxes are declared inside a while loop. If
i
  declare manually all checkboxes it works. Any ideas ? Or maybe I'm doing
  something wrong?
 
 


  
  echo  form method=\post\ action=\selectare.php?ids[]\;
  echo input type=\Submit\  value=\Trimite\;
 
 
  /* Connecting, selecting database */
  $link = mysql_connect(localhost, root, adrian)
  or die(Could not connect);
  print Connected successfully;
  mysql_select_db(menagerie) or die(Could not select database);
 
  /* Performing SQL query */
  $query = SELECT * FROM reclamatie;
  $result = mysql_query($query) or die(Query failed);
 
  /* Printing results in HTML */
 
   echo table border=1;
  echo
 

trtd/tdtdID/tdtdSubject/tdtdOpen/tdtdClose/td/tr;
 
   while($row = MySQL_fetch_array($result)) {
   echo  trtdforminput type=\checkbox\ method=\post\
  name=\ids[]\ value=\{$row['id']}\/form/td;
  echo tda href=\lowerframe.php?id={$row['id']}\
  target=\lowerframe\{$row['id']}/a/td;
  echo td{$row['subject']}/td;
  echo td{$row['open']}/td;
 echo td{$row['close']}/td/tr;
  }
  echo /table;
 
/* Free resultset */
  mysql_free_result($result);
 
  /* Closing connection */
  mysql_close($link);
 
  echo /form;
  ?
  ###
  //selectare.php  (just displays the id's of selected checkboxes)
 
 
  //$useri=$_POST['useri'];
  $ids=$_POST['ids'];
 
  reset($ids);
  while (list ($key, $value) = each ($ids)) {
  echo $valuebr /\n;
  }
  ?
  #
 
  As I said, when I select the first checkbox, I get the id, but when I
 select
  any other checkbox, I get the errors
  PHP Notice:  Undefined index:  ids in selectare.php
  PHP Warning:  Variable passed to each() is not an array or object in
  selectare.php
 
 
 
 
 
  - Original Message -
  From: John W. Holmes [EMAIL PROTECTED]
  To: 'Adrian Partenie' [EMAIL PROTECTED]; 'php'
  [EMAIL PROTECTED]
  Sent: Thursday, November 28, 2002 5:54 PM
  Subject: RE: [PHP] mysql, php, checkbox
 
 
I'm displaying the content of a mysql table with autoincrement
index.
   I
want to be able to select the each row from the table using the
check
boxes. In order to do that, i want to assign to each checkbox the
name=index of selected row.
I assign to the checkboxes the value of selected id, but I can't
retreiveit later for further processing. My code looks like this
   
 $query = SELECT * FROM reclamatie;
$result = mysql_query($query) or die(Query failed);
   
/* Printing results in HTML */
   
 echo table border=1;
echo
   
  
trtd/tdtdID/tdtdSubject/tdtdOpen/tdtdClose/td/tr
   
;
   
 while($row = MySQL_fetch_array($result)) {
 echo  trtdforminput type=\checkbox\
method=\post\
name=\{$row['id']}\/form/td; // ??
  
   It looks like your naming it as a number, which won't work for PHP.
You
   want to name all of your checkboxes the same, with a [] on the name to
   make the results an array in PHP.
  
   ... name=id[] value={$row['id']}
  
   Then, you'll have $_POST['id'][x] as an array in PHP. Only the
   checkboxes that were selected will be in the array, from zero to
however
   many were checked. The value of $_POST['id'][x] will be whatever was
in
   the value=... part of the HTML checkbox...
  
   ---John Holmes...
  
  
  
 
 
  --
  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] Script not working from one computer

2002-12-05 Thread M.A.Bond
Have you checked:

Browser versions? (is the browser the same type/version as on the other
machines)
Is it a laptop? If so, are you using the internal keyboard with Numlock on?
Is the machine in question set-up on the network correctly, i.e. has it got
domain, gateway addresses etc setup - this would only affect it if the
Intranet server is set-up to only allow a certain range of IP addresses or
doamin/hostnames etc.

Thanks

Mark


-Original Message-
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] 
Sent: 05 December 2002 14:10
To: php-general
Cc: heflinaw
Subject: [PHP] Script not working from one computer


I know, PHP is executed server side, so it shouldn't matter about the
computer, but...

I've got a basic log in script that takes username and password and does the
typical SELECT to find a match. If it's good, it sets some session variables
and redirects to a main page, otherwise redirects back to the login page
with an error message.

The script works from all computers but one. The login page will come up,
but no matter what, it says the username and password are bad. They are
correct though, caps lock isn't on, etc. I've cleared the cookies and cache
and it still does the same thing.

The script is on an intranet. One computer that had this issue was fixed by
using https://computername.company.army.mil instead of just
https://computername. But for this computer, both addresses give the same
result. 

So, I'm sure it's not the PHP script, so I'm looking for ideas of what I
should check, settings wise, on the client computer? Any help is greatly
appreciated.

---John Holmes...

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




[PHP] Sesion Vars get reseted

2002-12-05 Thread Miguel López Dinaweb Dpto. Programación
Hi,
I'm having a trouble with session vars, that i suspect that is related
to garbage collection system.
I start a session and make and continuos use of it, but sudently the
session vars are reseted, the time when this ocurs is variable, always
after passing the time of garbage recollection since the session was
started, but less than a minute from the last use of the session, is
this the correct way for php session handling or can be any error in the
scripts or the php config?


:-)

Miguel López Sánchez 
Programador
Voz +34 902 014 945    E-mail: [EMAIL PROTECTED] 

Dinaweb Networks s.l.
Rúa das Orfas 27
15703 Santiago de Compostela A Coruña Gz Sp ECC
Voz +34 902 014 945    GMT+1
E-mail: [EMAIL PROTECTED]

http://www.dinaweb.com   http://www.dinahosting.com
http://www.u-lo.com http://www.empregogalego.com



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




[PHP] Shopping Cart Rewrite

2002-12-05 Thread beno
Hi;
PHP isn't my strong language so I need your help. I'm writing a patch to a 
shopping cart called fishcart  http://fishcart.org  The following code 
works well in another page. I pass the variable $related to the page that 
I'm patching:

?
 $fcrp=new FC_SQL;
 $fcrp-query(select relprod from cubaprodrel where relsku='$related' 
order by relseq);
$fcrp-next_record();
 while( $fcrp-next_record() ){
  $rsku=$fcrp-f('relprod');
  $fcrpl-query(select * from cubaprodlang where prodlsku='$rsku' .
  and prodlzid=$zid and prodlid=$lid);
  $fcrpl-next_record();
  $pname = strip_tags($fcrpl-f(prodname));
  $pheight = strip_tags($fcrpl-f(prodpich));
  $ppic = strip_tags($fcrpl-f(prodpic));
  $ptpic = strip_tags($fcrpl-f(prodtpic));
 ?

There is already an established connection to the d'base. The first line of 
code works fine. The query doesn't appear to choke. But the third line 
pointing to the next_record() chokes. Any suggestions, or isn't this enough 
to go on?
TIA,
beno



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



[PHP] C#

2002-12-05 Thread Wilmar Perez
Hello guys

I'm sorry if this message disturbs anyone, I know it is completely off topic.

I've been thinking about open a C# mailing list for I hadn't been able to find a good 
one so far.  All I want to know is if there is enough people out there interested in 
joining such list.  

I posted this message to this list for a couple of reason: it is the only programming 
list I am in and since you're php developers I thought many of you may be interested.

Again please don't get mad at me for this I don't mean to upset or disturb anyone.

Thanks a lot.

***
 Wilmar Pérez
 Network Administrator
   Library System
  Tel: ++57(4)2105962
University of Antioquia
   Medellín - Colombia
  2002
***
 
 

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




Re: [PHP] Looping Addition

2002-12-05 Thread Stephen
So would I just put this?

foreach(%_POST['number'] as $num)
{
$output *= $num;
}
echo $output;

That's for multiplication.


- Original Message -
From: 1LT John W. Holmes [EMAIL PROTECTED]
To: Stephen [EMAIL PROTECTED]
Cc: PHP List [EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 8:24 AM
Subject: Re: [PHP] Looping Addition


  One more question... If I then wanted to do this for the other
operations
  (such as multiplication, division, etc), how would I do that?

 Assuming you've figured out how to do an array...

 You'll have to loop through the values like in the code that others
posted.

 foreach($_POST['number'] as $num)
 { //calculate total here with $num }

 * = multiplication
 / = divide

 ---John Holmes...




 --
 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] Safe mode and safe_mode_exec_dir

2002-12-05 Thread Rodrigo Borges Pereira
Hello all,

I'm having a bit of a problem making a particular configuration with PHP
and Apache. Here's the deal:

I want to have php running with safe mode, so i define safe mode = On on
/etc/php.ini.
I have this script that i need to execute two programas, with exec().
So, in apache, i define a directory directive, where i put
php_admin_value safe_mode_exec_dir /some/path/bin, so that the scripts
contained in the directory are able to execute binaries in
/some/path/bin. I also define open_basedir to ..

This doesn't work. In fact, defining safe_mode_exec_dir = /some/path/bin
directly in /etc/php.ini doesn't work either. I noticed PHP was compiled
with --with-exec-dir=/usr/bin, but i suppose that what we define in
php.ini (at least) overrides that.

I can only execute the bins with safe mode off... and i see nothing on
the logs, because for what i can see php logs nothing if it cannot
execute a program

I'm using PHP 4.2.3 and Apache 1.3.23 (RedHat)

Any help will be appreciated,

Regards



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




[PHP] Q: Use getImageSize() on image data from email?

2002-12-05 Thread Mans Jonasson
Hi all,
I am trying to use getImageSize() on imagedata I am receiving in an 
e-mail and collecting with imap_fetchstructure() et al. What I have in 
my $image variable is just the actual image data - no headers or 
anything, and of course getImageSize() doesn't work that way.

Now, the question is - does anybody have some code which will work with 
binary image data? Preferably with both JPG AND GIF data...

My only other option right now as I see it would be to create a file on 
the filesystem, write the image data to it and then use getImageSize() 
on it, but that seems like a bad solution for several reasons, some of 
them being speed and file permissions.

Thankful for any help!

//Mans


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



Re: [PHP] Looping Addition

2002-12-05 Thread Jason Wong
On Thursday 05 December 2002 23:05, Stephen wrote:
 So would I just put this?

 foreach(%_POST['number'] as $num)
 {
 $output *= $num;
 }
 echo $output;

 That's for multiplication.

Yes. Wouldn't it have been quicker for you to try it than to ask?

BTW make sure that none of $num is zero.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
The longest part of the journey is said to be the passing of the gate.
-- Marcus Terentius Varro
*/


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




[PHP] Newline charactes causing problems

2002-12-05 Thread Joshua E Minnie
Hey all,
I know this has been asked before, and I have tried many of the
solutions that were posted in the mailing archives, and also did some
googling.  But I can't seem to eliminate some new line characters from a
string.  Here is the scenario:

1. A user inputs some text into an form and submits the form.
2. The information gets put into my MySQL db.
3. I retrieve the information from the db and display it.

Now after the user submits the form, I have tried dumping it to the db in a
few different ways.  First of all, I dumped it directly to the db with no
changes, hoping that I could remove the newline characters and other
unwanted markup and tags when retrieving the string.  I also tried dumping
it to the db with after I used some string manipulation function, such as
stripslashes, nl2br, htmlentities, stripcslashes, trim, rtrim, and even
str_replace.  And just to be safe I made sure I double checked to make sure
the newlines were removed on before displaying by using some of the same
functions, but to no avail.  The newlines still seem to be there.

In the db, I have tried various different field types, from text to varchar
to blob, but this hasn't changed anything either.

The reason it is so important that the newline characters be removed is
because they are being used to create a javascript string.  And if the
newline characters are there then, I get an unterminated string error.

Here is the current code for adding the user input to the db:

?php

function addNewTask($posted) {
  if(db_conn()) {
// building query
$notes = trim($posted['notes']);
$query = INSERT INTO tasks (uid,title,due,notes) VALUES
('{$_SESSION['uid']}','{$posted['title']}',';
$query .= (($posted['is_due']==1) ?
mktime(23,59,59,$posted['month'],$posted['day'],$posted['year']) : x);
$query .= ','.$notes.');

$result = mysql_query($query) or header(Location:
http://localhost/errors/script.php?f=addNewTaskr=query_failed;);

header(Location: http://localhost/events/task.php?action=addset=1;);
  } else {
header(Location:
http://localhost/errors/script.php?f=addNewTaskr=db_conn;);
  }
}

?

$posted is the array $_POST after it is passed to the function.
$_POST['notes'] is where I am having the problem.

Here is the code for displaying the information from the db:

[library file snippit]
?php
function getTasks($uid) {
  if(db_conn()) {
$i=0;
$aTask=array();

$query = SELECT * FROM tasks WHERE uid='{$uid}' AND done'1';
$result = mysql_query($query);

while($row=mysql_fetch_assoc($result)) {
  $aTasks[$i] =
array($row['due'],$row['title'],stripslashes($row['notes']));
  $i++;
}
if(isset($aTasks)) {
  array_multisort($aTasks,SORT_DESC,SORT_STRING);
  print(pre);
  print_r($aTasks);
  print(/pre);
  return($aTasks);
}
  } else {
header(Location:
http://localhost/errors/script.php?f=getTasksr=db_conn;);
  }
}
?

[displaying page snippit]
?php
$tasks = getTasks($_SESSION['uid']);
$len = count($tasks);
if($len  0) {
  echo(script language=\JavaScript\ type=\text/javascript\\n);
  echo(aTasks = new Array(\n);
  $sTask = ;
  for($i=0;$i$len;$i++) {
$sTask .= \;
if($tasks[$i][0]  getNow()  $tasks[$i][0] != x) $sTask .= span
class='pastdue'Past Due!/spanbr;
$sTask .= $tasks[$i][2].\,;
  }
  $sTask = substr($sTask,0,(strlen($sTask) - 1));
  echo($sTask.);\n);
  echo(/script\n);
}
?

I know that is going into the db with the newlines still in the string.  And
I am constantly going back to mysqladmin and the newlines are there, no
matter what I do.  I was hoping someone could shed some light on what could
possibly be causing this.


+-+-+
| Joshua Minnie   |Tel:  269.276.9690   |
| [EMAIL PROTECTED]|Fax:  269.342.8750   |
| www.wildwebtech.com +-+
|   |
| Independent Web Consultant / Developer|
+---+
| SYSTEM INFO   |
+---+
| PHP v. 4.2.3 running on Win 2000 / IIS 5  |
| MySQL v. 3.23.49 running on RedHat 7.3/Apache |
+---+



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




Re: [PHP] Browser going to page twice?

2002-12-05 Thread Step Schwarz
on 12/2/02 6:12 PM, Leif K-Brooks at [EMAIL PROTECTED] wrote:

 I'm having a weird problem.  When I go to a page on my site, it often
 goes twice.  I'm not sure if this is a client-side or server-side
 problem, but it doesn't happen on other sites.  Is this a common
 problem, or am I making some dumb mistake?

Is this a public site that we can take a look at? I know there are some
JavaScripts which refresh/reload pages in order to work around bugs in
Netscape 4.  Is there by any chance anything in your site's body tags
which does this?

-Step


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




Re: [PHP] Newline charactes causing problems

2002-12-05 Thread John Wards
On Thursday 05 Dec 2002 3:48 pm, Joshua E Minnie wrote:
 A load of stuff..

I just read the fist few paragraphs and got bored;-)

but

Have you tried doing a str_replace for \n which is new line? just replate it 
with a blank string

John

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




Re: [PHP] Newline charactes causing problems

2002-12-05 Thread Joshua E Minnie
Already tried that.  Doesn't seem to change anything.

- Original Message -
From: John Wards [EMAIL PROTECTED]
To: Joshua E Minnie [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 10:48 AM
Subject: Re: [PHP] Newline charactes causing problems


On Thursday 05 Dec 2002 3:48 pm, Joshua E Minnie wrote:
 A load of stuff..

I just read the fist few paragraphs and got bored;-)

but

Have you tried doing a str_replace for \n which is new line? just replate it
with a blank string

John




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




Re: [PHP] Newline charactes causing problems

2002-12-05 Thread 1LT John W. Holmes
Or

$notes = preg_replace(/(\r)?\n/, ,$_POST['notes']);

in case it's the \r that's actually messing you up and not the \n?

---John Holmes...

- Original Message -
From: John Wards [EMAIL PROTECTED]
To: Joshua E Minnie [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 10:48 AM
Subject: Re: [PHP] Newline charactes causing problems


On Thursday 05 Dec 2002 3:48 pm, Joshua E Minnie wrote:
 A load of stuff..

I just read the fist few paragraphs and got bored;-)

but

Have you tried doing a str_replace for \n which is new line? just replate it
with a blank string

John

--
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] Newline charactes causing problems

2002-12-05 Thread John Wards
On Thursday 05 Dec 2002 3:54 pm, Joshua E Minnie wrote:
 Already tried that.  Doesn't seem to change anything.

how about \r 

John

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




Re: [PHP] Newline charactes causing problems

2002-12-05 Thread Joshua E Minnie
I am wondering if it has something to do with the way that MySQL is storing
the data.  But I can't seem to find anything that is helping me when I
search on MySQL related strings.

+-+-+
| Joshua Minnie   |Tel:  269.276.9690   |
| [EMAIL PROTECTED]|Fax:  269.342.8750   |
| www.wildwebtech.com +-+
|   |
| Independent Web Consultant / Developer|
+---+
| SYSTEM INFO   |
+---+
| PHP v. 4.2.3 running on Win 2000 / IIS 5  |
| MySQL v. 3.23.49 running on RedHat 7.3/Apache |
+---+

John Wards [EMAIL PROTECTED] wrote:
On Thursday 05 Dec 2002 3:48 pm, Joshua E Minnie wrote:
 A load of stuff..

I just read the fist few paragraphs and got bored;-)

but

Have you tried doing a str_replace for \n which is new line? just replate
it
with a blank string

John



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




RE: [PHP] Problem with functions

2002-12-05 Thread Carlos Alberto Pinto Hurtado
?
$username = victor;


function test() {
echo $GLOBALS[$username];
?

Carlos Alberto Pinto Hurtado
IT ICA
(57 1) 2322181 
(57 1) 2324698
Movil.(57 3) 310 6184251



-Mensaje original-
De: Victor Halla [mailto:[EMAIL PROTECTED]]
Enviado el: Wednesday, December 04, 2002 6:16 PM
Para: [EMAIL PROTECTED]
Asunto: [PHP] Problem with functions


Hi,

I have de following code for example


?php

$username = victor;


function test() {
echo $username;
}

?

If  I call the funcion test(), echo print nothing what's is going on ?

[]´s

[EMAIL PROTECTED]



__ Victor
Halla ICQ#: 114575440 Current ICQ status: + More ways to contact me
__



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


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




Re: [PHP] Sesion Vars get reseted

2002-12-05 Thread 1LT John W. Holmes
- Original Message -
I'm having a trouble with session vars, that i suspect that is related
to garbage collection system.
I start a session and make and continuos use of it, but sudently the
session vars are reseted, the time when this ocurs is variable, always
after passing the time of garbage recollection since the session was
started, but less than a minute from the last use of the session, is
this the correct way for php session handling or can be any error in the
scripts or the php config?
-

If you're not using your own session handling functions, garbage collection
won't touch the file if it's been accessed in the last 1440 seconds (I think
that's the default).

What if you write a really basic session page and keep loading it? Do the
variables dissappear from that, also? I'm sure it's something in the code
you've written, as normal session operations wouldn't do this.

---John Holmes...


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




[PHP] Re: code for my question about sessions ;) sorry

2002-12-05 Thread 1LT John W. Holmes
[snip]
 function login($username)
  {
   global $valid_user;
   $valid_user = $username;
   session_register(valid_user);
  }

It _should_ work. My only guess is that maybe because you're registering
something inside of a function, it's messing up, even though the variable is
global. I don't do it this way, and I prefer register globals off, so I
don't know if that's an issue or not.

---John Holmes...


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




[PHP] Re: MySQL ?

2002-12-05 Thread Bastian Vogt
Hi,

use mysql_list_tables();

HTH,
Bastian

Hacook schrieb:

 I am really sorry but i can't find any good mySQL good mailing list...

 How can i make a little php function to check if a table exists ?

 Thanks a lot,
 Hacook


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




Re: [PHP] Advice with encrypting+storing sensitive data

2002-12-05 Thread bahwi
Sorry, OpenSSL is base in FreeBSD, so I didn't have to set it up myself. 
You can check www.openssl.org and www.apache.org. You still have to buy 
a cert though. For that, try:

www.verisign.com
and www.instantssl.com --- seems alot cheaper, no experience with them 
however

But chances are your best bet will be to just get a webhost with SSL 
support already and buy the cert. That way, if there are errors with 
openssl you don't have to fix them, someone else does.

As far as anything else, see my sig, I gotta charge for Unix work so I 
can make the bills. That should help though.

--Joseph Guhlin 
http://www.josephguhlin.com/ 
Web Programmer / Unix Consultant / PHP Programmer




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



[PHP] socket timeout

2002-12-05 Thread Gareth Thomas
Hi,

I am attempting to timeout a socket_read() that is part of a handshaking
process using socket_set_timeout(). Problem is it doesn't seem to work at
all. If I switch of the handshaking write on the server side the read just
sits there and doesn't time out at all. I have tried
socket_set_timeout($socket,1) which I believe is 1 second and it never times
out...

Any thoughts on this would be most appreciated.

Gareth



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




RE: [PHP] Sesion Vars get reseted

2002-12-05 Thread Miguel López Dinaweb Dpto. Programación
I'm using php's built in functions, and i've made a very basic script
thats keeps reloading minute by minute and wen it was more than 24
minutes (1440 seconds) reloading in any moment the variables gets
reseted.
Also the last acced time from the file were the session data is stored
is updated every time that the page is reloaded, so the problen is that
i think that is making the garbage collection based on the creation time
no the last accesed time.

:-)

Miguel López Sánchez 
Programador
Voz +34 902 014 945    E-mail: [EMAIL PROTECTED] 

Dinaweb Networks s.l.
Rúa das Orfas 27
15703 Santiago de Compostela A Coruña Gz Sp ECC
Voz +34 902 014 945    GMT+1
E-mail: [EMAIL PROTECTED]

http://www.dinaweb.com   http://www.dinahosting.com
http://www.u-lo.com http://www.empregogalego.com


-Mensaje original-
De: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] 
Enviado el: jueves, 05 de diciembre de 2002 17:02
Para: Miguel López Dinaweb Dpto. Programación; [EMAIL PROTECTED]
Asunto: Re: [PHP] Sesion Vars get reseted


- Original Message -
I'm having a trouble with session vars, that i suspect that is related
to garbage collection system. I start a session and make and continuos
use of it, but sudently the session vars are reseted, the time when this
ocurs is variable, always after passing the time of garbage recollection
since the session was started, but less than a minute from the last use
of the session, is this the correct way for php session handling or can
be any error in the scripts or the php config?
-

If you're not using your own session handling functions, garbage
collection won't touch the file if it's been accessed in the last 1440
seconds (I think that's the default).

What if you write a really basic session page and keep loading it? Do
the variables dissappear from that, also? I'm sure it's something in the
code you've written, as normal session operations wouldn't do this.

---John Holmes...


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




Re: [PHP] Sesion Vars get reseted

2002-12-05 Thread 1LT John W. Holmes
What OS are you on?

---Quote---
Note: If you are using the default file-based session handler, your
filesystem must keep track of access times (atime). Windows FAT does not so
you will have to come up with another way to handle garbage collecting your
session if you are stuck with a FAT filesystem or any other fs where atime
tracking is not available.


---John Holmes...

- Original Message -
From: Miguel López Dinaweb Dpto. Programación [EMAIL PROTECTED]
To: '1LT John W. Holmes' [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 11:41 AM
Subject: RE: [PHP] Sesion Vars get reseted


I'm using php's built in functions, and i've made a very basic script
thats keeps reloading minute by minute and wen it was more than 24
minutes (1440 seconds) reloading in any moment the variables gets
reseted.
Also the last acced time from the file were the session data is stored
is updated every time that the page is reloaded, so the problen is that
i think that is making the garbage collection based on the creation time
no the last accesed time.

:-)

Miguel López Sánchez
Programador
Voz +34 902 014 945 E-mail: [EMAIL PROTECTED]

Dinaweb Networks s.l.
Rúa das Orfas 27
15703 Santiago de Compostela A Coruña Gz Sp ECC
Voz +34 902 014 945 GMT+1
E-mail: [EMAIL PROTECTED]

http://www.dinaweb.com http://www.dinahosting.com
http://www.u-lo.com http://www.empregogalego.com


-Mensaje original-
De: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
Enviado el: jueves, 05 de diciembre de 2002 17:02
Para: Miguel López Dinaweb Dpto. Programación; [EMAIL PROTECTED]
Asunto: Re: [PHP] Sesion Vars get reseted


- Original Message -
I'm having a trouble with session vars, that i suspect that is related
to garbage collection system. I start a session and make and continuos
use of it, but sudently the session vars are reseted, the time when this
ocurs is variable, always after passing the time of garbage recollection
since the session was started, but less than a minute from the last use
of the session, is this the correct way for php session handling or can
be any error in the scripts or the php config?
-

If you're not using your own session handling functions, garbage
collection won't touch the file if it's been accessed in the last 1440
seconds (I think that's the default).

What if you write a really basic session page and keep loading it? Do
the variables dissappear from that, also? I'm sure it's something in the
code you've written, as normal session operations wouldn't do this.

---John Holmes...


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




[PHP] IMG SRC .ico (icons)

2002-12-05 Thread Benja
Hi everybody,

The icons (.ico) are not displayed correctly by all the browsers (I.E. 5,
etc...).
After some research, it appears the only solution is to convert the .ico in
GIF or JPEG...

Do you know if a PHP script could do that conversion ?
Take a icon and create a GIF or JPEG file...

Thanks for your help,
Benja.



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




[PHP] Re: socket timeout

2002-12-05 Thread Gareth Thomas
Hi,

apparently this does not work with socket_read() but only with higher level
socket functions (fread etc). However I have found a function called
socket_set_nonblock(socketname) which apparently does something very
similar, it prevents the socket_read from waiting to receive data. I simply
built my own timeout loop into the code and voila!!

Gareth

Gareth Thomas [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

 I am attempting to timeout a socket_read() that is part of a handshaking
 process using socket_set_timeout(). Problem is it doesn't seem to work at
 all. If I switch of the handshaking write on the server side the read just
 sits there and doesn't time out at all. I have tried
 socket_set_timeout($socket,1) which I believe is 1 second and it never
times
 out...

 Any thoughts on this would be most appreciated.

 Gareth





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




[PHP] paging through results of mysql query

2002-12-05 Thread Larry Brown
I know I'm trying to re-invent the wheel, but it is because I don't know how
they do it.  I set up a script to pull a ruleset from mysql and then loop
through each row in the set.  I then check each row as it loops until I get
to the row number I want and start echoing rows.  I create the row numbers
by a $m=0; outside the loop; $m++; inside the loop.  Then I stop echoing
rows when it reaches 50 iterations.  The total iterations achieved is passed
on to the next script that does the same thing but starting where the total
left off.  This causes a lot of overhead as all of the resultset are pulled
for each script.  Does anyone have a magic bullet for this?  This
functionality is what I take search engines to be demonstrating.  If anyone
can help, I could wipe the sweat of my processors brow!  (and mine for that
matter)

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388




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




RE: [PHP] paging through results of mysql query

2002-12-05 Thread John W. Holmes
 I know I'm trying to re-invent the wheel, but it is because I don't
know
 how
 they do it.  I set up a script to pull a ruleset from mysql and then
loop
 through each row in the set.  I then check each row as it loops until
I
 get
 to the row number I want and start echoing rows.  I create the row
numbers
 by a $m=0; outside the loop; $m++; inside the loop.  Then I stop
echoing
 rows when it reaches 50 iterations.  The total iterations achieved is
 passed
 on to the next script that does the same thing but starting where the
 total
 left off.  This causes a lot of overhead as all of the resultset are
 pulled
 for each script.  Does anyone have a magic bullet for this?  This
 functionality is what I take search engines to be demonstrating.  If
 anyone
 can help, I could wipe the sweat of my processors brow!  (and mine for
 that
 matter)

SELECT * FROM tbl WHERE ... LIMIT $start, $per_page;

Adjust $start and $per_page accordingly to get your paging...

---John Holmes...



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




[PHP] RE: [PEAR-DEV] ANNOUNCE: Metastorage object persistence API generator

2002-12-05 Thread Lukas Smith
 -Original Message-
 From: Björn Schotte [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, December 05, 2002 6:42 PM
 To: Manuel Lemos
 Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; pear-
 [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED];
 [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PEAR-DEV] ANNOUNCE: Metastorage object persistence API
 generator
 
 * Manuel Lemos wrote:
  Here is the release announcement that may also be found on the site:
 
 Where's the PEAR context within the marketing text?

Well this stuff does work with PEAR::MDB!

And we are talking about a model where rapid development and easy of
migration to other platforms stands at the core. So its not that big of
a deal that its running through a wrapper.

However I fail to see why all the other addressants of your reply should
care about a PEAR context (you did include all the other non PEAR
related mailinglists in your reply as well).

Don’t get overly jumpy here .. there is no reason to. This can be a big
deal for a lot of people (especially the enterprise folks which you also
frequently cite as a target for PHP). So it works with php, it works in
combination with a PEAR package ... I see a context.

Regards,
Lukas


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




[PHP] A small problem with input feilds.

2002-12-05 Thread Mike
Hello everyone,
I have the following html code that is generated via a script:

table
 form action=/new/mp3/stuff/testsearch.php method=post target=

trtdbArtist/b/tdtdbTitle/b/tdtdbFile
Size/b/tdtdCheck/td/tr
 tr
  td width=295 valign=top
   pb Dj Ummet/b/p
  /td
  td width=195 valign=top
   pbPump This Party (extended Mix)/b
  /td
   td width = 195 valign = top
   bAbout 4.5 megabytes/b/p
  /td
  td valign=topinput type=checkbox name=file[]
value=%28Dj+Ummet%29+-+Pump+This+Party+%28Extended+Mix%29.mp3
   input type=hidden name=filenumber[] value=3437
  /td
 /tr
/tr
 tr
  td width=295 valign=top
   pb Metalica/b/p
  /td
  td width=195 valign=top
   pbEnter Sandman/b
  /td
   td width = 195 valign = top
   bAbout 4.43 megabytes/b/p
  /td
  td valign=topinput type=checkbox name=file[]
value=%28Metalica%29+-+Enter+Sandman.mp3
   input type=hidden name=filenumber[] value=986
  /td
 /tr
/tr
 tr
  td width=295 valign=top
   pb Metalica/b/p
  /td
  td width=195 valign=top
   pbThe Memory Remains/b
  /td
   td width = 195 valign = top
   bAbout 4.24 megabytes/b/p
  /td
  td valign=topinput type=checkbox name=file[]
value=%28Metalica%29+-+The+Memory+Remains.mp3
   input type=hidden name=filenumber[] value=2331
  /td
 /tr
/tr
 tr
  td width=295 valign=top
   pb Metallica/b/p
  /td
  td width=195 valign=top
   pbBattery/b
  /td
   td width = 195 valign = top
   bAbout 4.77 megabytes/b/p
  /td
  td valign=topinput type=checkbox name=file[]
value=%28Metallica%29+-+Battery.mp3
   input type=hidden name=filenumber[] value=2136
  /td
 /tr
/tr
/table
input type=submit name=submit value=submit
/form

the problem is this:
Array
(
[filenumber] = Array
(
[0] = 3437
[1] = 986
[2] = 2331
[3] = 2136
)

[file] = Array
(
[0] = %28Metalica%29+-+Enter+Sandman.mp3
[1] = %28Metallica%29+-+Battery.mp3
)

when I submit the form, I get the whole array of filenumber but only the
selected files. Is there a way that I could limit it so that I get only the
selected filenumbers and files, or should I re-think the way the script
works?

Thank you,
Mike


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




Re: [PHP] A small problem with input feilds.

2002-12-05 Thread Tim Ward
only checked checkboxes are submitted therefore you have to number
the form fields if you want to keep the relationship between the arrays
- this should be easy enough if the form is generated by your code.

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message -
From: Mike [EMAIL PROTECTED]
To: php mailinglist [EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 5:59 PM
Subject: [PHP] A small problem with input feilds.


 Hello everyone,
 I have the following html code that is generated via a script:

 table
  form action=/new/mp3/stuff/testsearch.php method=post target=

 trtdbArtist/b/tdtdbTitle/b/tdtdbFile
 Size/b/tdtdCheck/td/tr
  tr
   td width=295 valign=top
pb Dj Ummet/b/p
   /td
   td width=195 valign=top
pbPump This Party (extended Mix)/b
   /td
td width = 195 valign = top
bAbout 4.5 megabytes/b/p
   /td
   td valign=topinput type=checkbox name=file[]
 value=%28Dj+Ummet%29+-+Pump+This+Party+%28Extended+Mix%29.mp3
input type=hidden name=filenumber[] value=3437
   /td
  /tr
 /tr
  tr
   td width=295 valign=top
pb Metalica/b/p
   /td
   td width=195 valign=top
pbEnter Sandman/b
   /td
td width = 195 valign = top
bAbout 4.43 megabytes/b/p
   /td
   td valign=topinput type=checkbox name=file[]
 value=%28Metalica%29+-+Enter+Sandman.mp3
input type=hidden name=filenumber[] value=986
   /td
  /tr
 /tr
  tr
   td width=295 valign=top
pb Metalica/b/p
   /td
   td width=195 valign=top
pbThe Memory Remains/b
   /td
td width = 195 valign = top
bAbout 4.24 megabytes/b/p
   /td
   td valign=topinput type=checkbox name=file[]
 value=%28Metalica%29+-+The+Memory+Remains.mp3
input type=hidden name=filenumber[] value=2331
   /td
  /tr
 /tr
  tr
   td width=295 valign=top
pb Metallica/b/p
   /td
   td width=195 valign=top
pbBattery/b
   /td
td width = 195 valign = top
bAbout 4.77 megabytes/b/p
   /td
   td valign=topinput type=checkbox name=file[]
 value=%28Metallica%29+-+Battery.mp3
input type=hidden name=filenumber[] value=2136
   /td
  /tr
 /tr
 /table
 input type=submit name=submit value=submit
 /form

 the problem is this:
 Array
 (
 [filenumber] = Array
 (
 [0] = 3437
 [1] = 986
 [2] = 2331
 [3] = 2136
 )

 [file] = Array
 (
 [0] = %28Metalica%29+-+Enter+Sandman.mp3
 [1] = %28Metallica%29+-+Battery.mp3
 )

 when I submit the form, I get the whole array of filenumber but only the
 selected files. Is there a way that I could limit it so that I get only
the
 selected filenumbers and files, or should I re-think the way the script
 works?

 Thank you,
 Mike


 --
 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] Error in host server data stream

2002-12-05 Thread Daniel
my php code is working on one machine and not on another. I am now getting
the error
Warning: SQL error: [unixODBC][IBM][iSeries Access ODBC Driver]Error in host
server data stream., SQL state S1000 in SQLExecDirect

working machine: unixodbc 2.2.2-2 php-odbc4.1.2-7.2.4
non working:unixodbc 2.2.2-3 php-odbc4.2.2-8.0.5

any ideas would help!



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




[PHP] PHP Configuration - Can't Change Post_Max_Size

2002-12-05 Thread Roger Lewis
This is further to my post yesterday on Max File Size.

I was able to set upload_max_filesize to 790 and I can therefore upload
files up to that size.  I would now like to increase that limit, but I am
limited by post_max_size which defaults to 8M.  I can't seem to change the
value of post_max_size.

The post_max_size directive is not in my php.ini; however, I tried inserting
it into php.ini and setting it to 1600 and to 16M.   I inserted it just
before the directive, gpc_order  = GPC.  The change is ignored by
phpinfo(), that is, phpinfo() still shows post_max_size = 8M.

Furthermore, I tried resetting it using ini_set(post_max_size, 16M), and
ini_set(post_max_size, 1600), but neither of these had any effect.

Any suggestion for how I might reset post_max_size.  I'm using PHP 4.0.6.

Thanks in advance.

Roger




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




[PHP] Session and redirecting

2002-12-05 Thread Didier McGillis
I'm having some problems with sessions on this project I am doing for this 
one class.  I know what I am doing with sessions on a certain level, as I 
use them with ASP and JSP apps.  I notice that when I do session_start() the 
session SID or PHPSESSID doesnt appear until you refresh that page or go to 
the next page, I need the session to start on index, so do I have to plop a 
refresh statement in there?  And why is it you have to do a session_start() 
on every page, could you put that in a header and have it be the same?

_
Protect your PC - get McAfee.com VirusScan Online 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


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



[PHP] Repeating Decimals

2002-12-05 Thread Stephen
Hello again,

This is another PHP mathematical question. How can I display a bar over a
number (overline) if it's a repeating decimal? When the user types in 1 by
3, they get 0.. I want it to display as 0.3 with the 3
overlined. How can I do this keeping in mind that not all numbers will be
repeating decimals?

Thanks,
Stephen Craton
http://www.melchior.us

What is a dreamer that cannot persevere? -- http://www.melchior.us


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


Re: [PHP] Session and redirecting

2002-12-05 Thread 1LT John W. Holmes
 I'm having some problems with sessions on this project I am doing for this
 one class.  I know what I am doing with sessions on a certain level, as I
 use them with ASP and JSP apps.  I notice that when I do session_start()
the
 session SID or PHPSESSID doesnt appear until you refresh that page or go
to
 the next page, I need the session to start on index, so do I have to plop
a
 refresh statement in there?  And why is it you have to do a
session_start()
 on every page, could you put that in a header and have it be the same?

Sure, place it in an include file. Or turn on session.auto_start in php.ini
and you'll never have to call it. Why do you need to refresh. The SID
constant may not be available, but you can use session_id() to get it's
value.

---John Holmes...



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




Re: [PHP] fopen over a network

2002-12-05 Thread Joakim Andersson
Dara Dowd wrote:

Thanks for the advice lads but I realise I should have been clearer. I know about header(etc..) so displaying the download dialog isn't the problem, it's how to get to the file on the file server and then open it. The file server isn't a web server.  This is probably ridiculously easy so I hope I'm not wasting your time. I don't want to@use the 'right-click' option, I want something similar to@opening attachments in hotmail for example. Here's what I have anyway.
?php

if (isset($_GET[fname])){

  $fpath=file://fileserver/directory/;
  $fname=$_GET[fname];
  $filename=$fpath.$fname;

  $filelength=filesize($filename);

  header(Content-type: application/stream);
  header(Content-Length: $filelength);
  header(Content-Disposition: attachment; );

 $fp=fopen($filename,rb);
 print(fread($fp,$filelength));
 fclose($fp);
}
?

Cheers, Dara


What kind of network are you using?
If you're accessing a SMB-share (i.e. Windows or Samba) I think you need 
to skip file: from your script. Maybe you need to use backslashes 
instead ($fpath=file:fileserver\\directory\\).

Regards
Joakim


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



Re: [PHP] Repeating Decimals

2002-12-05 Thread 1LT John W. Holmes
 This is another PHP mathematical question. How can I display a bar over a
 number (overline) if it's a repeating decimal? When the user types in 1 by
 3, they get 0.. I want it to display as 0.3 with the 3
 overlined. How can I do this keeping in mind that not all numbers will be
 repeating decimals?

Well, the first problem is finding a charset or something that has a number
with a line over it and how you'd create that character in HTML, unless you
want to use an image or something.

Next, you can treat the result as a string and look at the last X digits. If
they are the same, remove them all and substitute with the number and a bar.
It just comes down to string manipulation...

---John Holmes...


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




Re: [PHP] Looping Addition

2002-12-05 Thread Stephen
Continuing this even more...how would I use this same method only to
subtract?

What I'm doing right now would result in the following sitution.

The user types in 5 as their first number. The second number is 4. Instead
of returnin 1, it returns -9. It's subtracting the first number from 0, then
taking 4 and subtracting that from -5. How can I fix this keeping in mind
the user may type in more then two numbers?


- Original Message -
From: Chris Wesley [EMAIL PROTECTED]
To: PHP List [EMAIL PROTECTED]
Cc: Stephen [EMAIL PROTECTED]
Sent: Wednesday, December 04, 2002 8:42 PM
Subject: Re: [PHP] Looping Addition


 On Wed, 4 Dec 2002, Stephen wrote:
  This is only a snippet, there is more to it but for simplicities sake...
  Then I calculate it. My question is, how would I loop the adding? I hope
you
  understand this now...

 Ah!, I think I understand better now.  You want to add num1, num2, num3,
 ... numN, which are inputs from the second form in your sequence.  Gotcha.

 If you name /all/ the form elements as nums[] instead of individually as
 num${current}, the numbers put into the form will all be accessible in
 one array to the PHP script that does the adding.  Then you can just loop
 over the array of numbers.

 In your second form, change this:
 input name=num?php echo $current; ? type=text id=vars value=0
  size=25

 To this:
 input name=nums[] type=text id=vars value=0 size=25

 Then in the script that adds the numbers:
 $total = 0;
 foreach( $_POST['nums'] as $number ){
 $total += $number;
 }

 Hopefully I understood your problem this time!  Let me know if I missed
 again.
 g.luck,
 ~Chris




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




RE: [PHP] paging through results of mysql query

2002-12-05 Thread Larry Brown
Much Gratefulness on my part!  Finally, my server and I can catch our
breath.

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 12:47 PM
To: 'Larry Brown'; 'PHP List'
Subject: RE: [PHP] paging through results of mysql query

 I know I'm trying to re-invent the wheel, but it is because I don't
know
 how
 they do it.  I set up a script to pull a ruleset from mysql and then
loop
 through each row in the set.  I then check each row as it loops until
I
 get
 to the row number I want and start echoing rows.  I create the row
numbers
 by a $m=0; outside the loop; $m++; inside the loop.  Then I stop
echoing
 rows when it reaches 50 iterations.  The total iterations achieved is
 passed
 on to the next script that does the same thing but starting where the
 total
 left off.  This causes a lot of overhead as all of the resultset are
 pulled
 for each script.  Does anyone have a magic bullet for this?  This
 functionality is what I take search engines to be demonstrating.  If
 anyone
 can help, I could wipe the sweat of my processors brow!  (and mine for
 that
 matter)

SELECT * FROM tbl WHERE ... LIMIT $start, $per_page;

Adjust $start and $per_page accordingly to get your paging...

---John Holmes...



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



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




[PHP] Re: Safe mode and safe_mode_exec_dir

2002-12-05 Thread James Hatridge

Hi Rodrigo et al...
On Thursday 05 December 2002 16:09, Rodrigo Borges Pereira wrote:
 Hello all,

 directly in /etc/php.ini doesn't work either. I noticed PHP was compiled
 with --with-exec-dir=/usr/bin, but i suppose that what we define in
 php.ini (at least) overrides that.

I had hell with safe_mode too. What I found out is that anything that is 
hardwired in by being compiled can NOT be overrode by php.ini. I would 
suggest for you to recompile PHP with everything turned off then use php.ini 
to set what you want. 

I did it this and now I'm able to run exec without problems. 

Hope this helps,

JIM 

-- 
Jim Hatridge
Linux User #88484
--
 BayerWulf
   Linux System # 129656
 The Recycled Beowulf Project
  Looking for throw-away or obsolete computers and parts
   to recycle into a Linux super computer


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




Re: [PHP] Looping Addition

2002-12-05 Thread Kevin Stone
You simply need the absolute value of the difference.  So taking Stephen's
example below..

$total = 0;
foreach( $_POST['nums'] as $number )
{
  $total -= $number;// if users inputs 5 as first value result equals -5
  $total = abs($total); // result now equals 5
}


- Original Message -
From: Stephen [EMAIL PROTECTED]
To: Chris Wesley [EMAIL PROTECTED]
Cc: PHP List [EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 12:33 PM
Subject: Re: [PHP] Looping Addition


 Continuing this even more...how would I use this same method only to
 subtract?

 What I'm doing right now would result in the following sitution.

 The user types in 5 as their first number. The second number is 4. Instead
 of returnin 1, it returns -9. It's subtracting the first number from 0,
then
 taking 4 and subtracting that from -5. How can I fix this keeping in mind
 the user may type in more then two numbers?


 - Original Message -
 From: Chris Wesley [EMAIL PROTECTED]
 To: PHP List [EMAIL PROTECTED]
 Cc: Stephen [EMAIL PROTECTED]
 Sent: Wednesday, December 04, 2002 8:42 PM
 Subject: Re: [PHP] Looping Addition


  On Wed, 4 Dec 2002, Stephen wrote:
   This is only a snippet, there is more to it but for simplicities
sake...
   Then I calculate it. My question is, how would I loop the adding? I
hope
 you
   understand this now...
 
  Ah!, I think I understand better now.  You want to add num1, num2, num3,
  ... numN, which are inputs from the second form in your sequence.
Gotcha.
 
  If you name /all/ the form elements as nums[] instead of individually
as
  num${current}, the numbers put into the form will all be accessible in
  one array to the PHP script that does the adding.  Then you can just
loop
  over the array of numbers.
 
  In your second form, change this:
  input name=num?php echo $current; ? type=text id=vars
value=0
   size=25
 
  To this:
  input name=nums[] type=text id=vars value=0 size=25
 
  Then in the script that adds the numbers:
  $total = 0;
  foreach( $_POST['nums'] as $number ){
  $total += $number;
  }
 
  Hopefully I understood your problem this time!  Let me know if I missed
  again.
  g.luck,
  ~Chris
 
 


 --
 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] Looping Addition

2002-12-05 Thread Stephen
But then, if the user entered 5 - 6, it should be -1 but it'd return
positive one... Is there another way?


- Original Message -
From: Kevin Stone [EMAIL PROTECTED]
To: Stephen [EMAIL PROTECTED]; Chris Wesley [EMAIL PROTECTED]
Cc: PHP List [EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 2:51 PM
Subject: Re: [PHP] Looping Addition


 You simply need the absolute value of the difference.  So taking Stephen's
 example below..

 $total = 0;
 foreach( $_POST['nums'] as $number )
 {
   $total -= $number;// if users inputs 5 as first value result
equals -5
   $total = abs($total); // result now equals 5
 }


 - Original Message -
 From: Stephen [EMAIL PROTECTED]
 To: Chris Wesley [EMAIL PROTECTED]
 Cc: PHP List [EMAIL PROTECTED]
 Sent: Thursday, December 05, 2002 12:33 PM
 Subject: Re: [PHP] Looping Addition


  Continuing this even more...how would I use this same method only to
  subtract?
 
  What I'm doing right now would result in the following sitution.
 
  The user types in 5 as their first number. The second number is 4.
Instead
  of returnin 1, it returns -9. It's subtracting the first number from 0,
 then
  taking 4 and subtracting that from -5. How can I fix this keeping in
mind
  the user may type in more then two numbers?
 
 
  - Original Message -
  From: Chris Wesley [EMAIL PROTECTED]
  To: PHP List [EMAIL PROTECTED]
  Cc: Stephen [EMAIL PROTECTED]
  Sent: Wednesday, December 04, 2002 8:42 PM
  Subject: Re: [PHP] Looping Addition
 
 
   On Wed, 4 Dec 2002, Stephen wrote:
This is only a snippet, there is more to it but for simplicities
 sake...
Then I calculate it. My question is, how would I loop the adding? I
 hope
  you
understand this now...
  
   Ah!, I think I understand better now.  You want to add num1, num2,
num3,
   ... numN, which are inputs from the second form in your sequence.
 Gotcha.
  
   If you name /all/ the form elements as nums[] instead of
individually
 as
   num${current}, the numbers put into the form will all be accessible
in
   one array to the PHP script that does the adding.  Then you can just
 loop
   over the array of numbers.
  
   In your second form, change this:
   input name=num?php echo $current; ? type=text id=vars
 value=0
size=25
  
   To this:
   input name=nums[] type=text id=vars value=0 size=25
  
   Then in the script that adds the numbers:
   $total = 0;
   foreach( $_POST['nums'] as $number ){
   $total += $number;
   }
  
   Hopefully I understood your problem this time!  Let me know if I
missed
   again.
   g.luck,
   ~Chris
  
  
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 



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




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




Re: [PHP] socket timeout

2002-12-05 Thread Chris Shiflett
--- Gareth Thomas [EMAIL PROTECTED] wrote:
 I am attempting to timeout a socket_read() that is part
 of a handshaking process using socket_set_timeout().
 Problem is it doesn't seem to work at all. If I switch of
 the handshaking write on the server side the read just
 sits there and doesn't time out at all. I have tried
 socket_set_timeout($socket,1) which I believe is 1 second
 and it never times out...

My bet is that you are only setting the timeout but not
ever checking to see whether the socket has timed out. If
you want to only read from the socket until it times out,
you need to add that to your logic. Try something like
this:

socket_set_timeout($fp, $timeout_seconds);
$response=;

# Get socket status
$socket_status = socket_get_status($fp);

# Read response up to 128 bytes at a time until EOF or
socket times out
while(!feof($fp)  !$socket_status[timed_out])
{
 $response .= fgets($fp, 128);
 $socket_status = socket_get_status($fp);
}

Chris

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




Re: [PHP] Looping Addition

2002-12-05 Thread 1LT John W. Holmes
 But then, if the user entered 5 - 6, it should be -1 but it'd return
 positive one... Is there another way?

Come on, man... this is addition and subtraction. You can't figure it out?

  You simply need the absolute value of the difference.  So taking
Stephen's
  example below..
 
  $total = 0;

Look, right here, you're setting the total to zero, so now everything will
be subtracted from zero. If you want everything to be subtracted from the
first number, the set $total equal to the first number and loop through the
remainder.

$total = $_POST['nums'][0];

$cnt = count($_POST['nums']);
for($x=1;$x$cnt;$x++)
{ $total -= $_POST['nums'][$x]; }

And I'm sure your next post will be but how will I use that if I want to go
back to addition/multiplication/division???;

Here, assuming $mode can be set to add,sub,mul or div:

$total = $_POST['nums'][0];
$cnt = count($_POST['nums']);
for($x=1;$x$cnt;$x++)
{
  switch($mode)
  {
case add: $total += $_POST['nums'][$x]; break;
case sub: $total -= $_POST['nums'][$x]; break;
case mul: $total *= $_POST['nums'][$x]; break;
case div: $total /= $_POST['nums'][$x]; break;
  }
}
echo $total;

Plenty of other ways to do it, too, that may be more efficient. And I
couldn't honestly tell you if *= and /= work and I don't want to go see.

Hope that helps. Good luck.

---John Holmes...


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




Re: [PHP] Q: Use getImageSize() on image data from email?

2002-12-05 Thread Morgan Hughes
On Thu, 5 Dec 2002, Mans Jonasson wrote:

 Hi all,
 I am trying to use getImageSize() on imagedata I am receiving in an
 e-mail and collecting with imap_fetchstructure() et al. What I have in
 my $image variable is just the actual image data - no headers or
 anything, and of course getImageSize() doesn't work that way.
(snip)

  The imageCreateFromString() function may help you here, this is exactly
  what it's for.  Unfortunately many people have had trouble with it.  In
  your situation, I'd write the thing out to a temporary file.

  In that case I'd consider using ImageMagick's identify command rather
  than getImageSize(), since it handles many more image types.  Depending
  on what you need you may find the -verbose option helpful, as it gives
  tons of information, but is slow...

-- 
   Morgan Hughes
   C programmer and highly caffeinated mammal.
   [EMAIL PROTECTED]
   ICQ: 79293356




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




[PHP] Hiding Errors

2002-12-05 Thread vernon
Is there a way to have errors in script not output to the screen? I have a
page that creates an error which really isn't a problem and I don't want
users to see the error message.

Thanks



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




Re: [PHP] Hiding Errors

2002-12-05 Thread Richard Baskett
If it is a function that you are getting an error on, just go ahead and put
a '@' sign before the function so for example @fopen(); or you can change
the error reporting in the php.ini file.  I do believe there is an error
reporting function also, but off the top of my head I cant remember what it
is.

Cheers!

Rick

The human mind is not capable of grasping the Universe. We are like a
little child entering a huge library. The walls are covered to the ceilings
with books in many different tongues. The child knows that someone must have
written these books. It does not know who or how. It does not understand the
languages in which they are written. But the child notes a definite plan in
the arrangement of the books---a mysterious order which it does not
comprehend, but only dimly suspects. - Albert Einstein

 From: vernon [EMAIL PROTECTED]
 Date: Thu, 5 Dec 2002 16:32:31 -0500
 To: [EMAIL PROTECTED]
 Subject: [PHP] Hiding Errors
 
 Is there a way to have errors in script not output to the screen? I have a
 page that creates an error which really isn't a problem and I don't want
 users to see the error message.
 
 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] Hiding Errors

2002-12-05 Thread bahwi
I'm not too familiar with this method, but trying putting the @ symbol
in front of the statement.

ex:

$file = @fopen(.);

Hope this helps.

--Joseph Guhlin 
http://www.josephguhlin.com/ 
Web Programmer / Unix Consultant / PHP Programmer




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



[PHP] Passthru / exec question - '127' returned

2002-12-05 Thread Lee P. Reilly
Hi,

I've ran into a problem using the passthru/exec commands with RH8. When
I try and run my program (or even pwd, ls, etc) the number '127' is
returned every_time. With passthru, the size of the optional return
array is 0. Can anyone fathom a guess at the problem? Is the 127 value
signifcant?

Thanks in advance.

- Best regards,

   Lee



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




[PHP] Re: Passthru / exec question - '127' returned

2002-12-05 Thread Lee P. Reilly
Ahhh... no reply necessary.
safe_mode :-o


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




Re: [PHP] Hiding Errors

2002-12-05 Thread Brad Pauly
On Thu, 2002-12-05 at 14:32, vernon wrote:
 Is there a way to have errors in script not output to the screen? I have a
 page that creates an error which really isn't a problem and I don't want
 users to see the error message.

You can also use set_error_handler to deal with errors however you like.

http://www.php.net/manual/en/function.set-error-handler.php

HTH,
Brad


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




Re: [PHP] Looping Addition

2002-12-05 Thread Stephen
No, I wasn't going to ask that. But thanks for the info. :P


- Original Message -
From: 1LT John W. Holmes [EMAIL PROTECTED]
To: Stephen [EMAIL PROTECTED]; Kevin Stone [EMAIL PROTECTED]
Cc: PHP List [EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 3:14 PM
Subject: Re: [PHP] Looping Addition


  But then, if the user entered 5 - 6, it should be -1 but it'd return
  positive one... Is there another way?

 Come on, man... this is addition and subtraction. You can't figure it out?

   You simply need the absolute value of the difference.  So taking
 Stephen's
   example below..
  
   $total = 0;

 Look, right here, you're setting the total to zero, so now everything will
 be subtracted from zero. If you want everything to be subtracted from the
 first number, the set $total equal to the first number and loop through
the
 remainder.

 $total = $_POST['nums'][0];

 $cnt = count($_POST['nums']);
 for($x=1;$x$cnt;$x++)
 { $total -= $_POST['nums'][$x]; }

 And I'm sure your next post will be but how will I use that if I want to
go
 back to addition/multiplication/division???;

 Here, assuming $mode can be set to add,sub,mul or div:

 $total = $_POST['nums'][0];
 $cnt = count($_POST['nums']);
 for($x=1;$x$cnt;$x++)
 {
   switch($mode)
   {
 case add: $total += $_POST['nums'][$x]; break;
 case sub: $total -= $_POST['nums'][$x]; break;
 case mul: $total *= $_POST['nums'][$x]; break;
 case div: $total /= $_POST['nums'][$x]; break;
   }
 }
 echo $total;

 Plenty of other ways to do it, too, that may be more efficient. And I
 couldn't honestly tell you if *= and /= work and I don't want to go see.

 Hope that helps. Good luck.

 ---John Holmes...


 --
 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] Easy array stuff I think for those who can I guess.

2002-12-05 Thread Raymond Lilleodegard
Hi!

I am trying to get out a value of an array that I have made from a query and
deliver the value into a variable. I have made this code. Am I totally lost?


while ($myrow = mysql_fetch_array($result));
{

 $id = $myrow['id'];

 $deltaker[] = array ($id);

}

$limit = count($deltaker);


$finn_vinner = rand(0,$limit);

$vinner_deltaker = $deltaker[$finn_vinner];

$vinner_id = current($vinner_deltaker);


$sql2 = SELECT * FROM konkuranse WHERE id = '$vinner_id';


Best regards Raymond



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




[PHP] PHP and Ensim Question

2002-12-05 Thread Mike Bowers



I have a question 
regarding PHP Safe-Mode and Ensim. On my master confing (/etc/php.ini) safe mode 
is off. But on each domain and site I installed on the server the local config 
file for that siteturns safemode on. Doesn anyone know where Ensim puts 
the config files? I've tried to find them and a few of my scripts I run my site 
with wont work with safe mode.

Mike Bowers
PlanetModz Gaming Network Webmaster 
http://www.planetmodz.com
[EMAIL PROTECTED]
[EMAIL PROTECTED]
All outgoing messages scanned for 
viruses
using Norton AV 2002


[PHP] SuSE 8.0 php 4.1.2 .spec file

2002-12-05 Thread Razvan Cosma
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

  Hello,

 Maybe I should post this to the -install mlist, but it is not the
installation (./configure, make...) that causes problems, but the fact
that I want to keep dependencies. So - does anyone have a working $subj?
 Thank you very much for any hint.


http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0xAD674062
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE979y1lDG6Z61nQGIRAm9rAJ9VL3dDzD/B1gxFbA7y4YED8SeZggCg3zyB
2HGLx0vyi5cNLmjzntyfe8c=
=xqqI
-END PGP SIGNATURE-


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




Re: [PHP] Advice with encrypting+storing sensitive data

2002-12-05 Thread Robert Mena
Thanks Bahwi, 

I agree with you regarding the client-side aspect.
But since we are talking about a regular web-based
application in php I think I will have to deal with
that.

The other security concerns are already addressed,
such as the use of SLL to encrypt the traffic and
possibly the use of an encoder do hide the source
code.

I do not think I understood your ideia : 
The next best thing is to store it in session
 variables, but build your own system perhaps, and
yes, encrypt it lightly with some system and a 
 system passphrase




__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




Re: [PHP] Advice with encrypting+storing sensitive data

2002-12-05 Thread bahwi
Sorry, it was late at night. I'm glad you have the SSL and everything 
else already taken care of.

What I meant was for you to build your own session system, so that it is 
secure, instead of using PHP's built in session system. Someone once 
said that it has a 1% chance of cleaning up the sessions, and that would 
be the secure data(the passphrase, even if encrypted) on the system. If 
you build your own, you can change that 1%. There may be another way. 
Also, if you build it yourself, you will understand what happens exactly 
and will be able to hide the data perhaps a bit more than the regular 
sessions.

I hope this makes more sense. If not, tell me and I'll try to explain it 
again. Sorry! =)

Robert Mena wrote:

I do not think I understood your ideia : 
 

The next best thing is to store it in session
variables, but build your own system perhaps, and
   

yes, encrypt it lightly with some system and a 
 

system passphrase
   

--Joseph Guhlin 
http://www.josephguhlin.com/ 
Web Programmer / Unix Consultant / PHP Programmer




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



[PHP] phpOpenTracker.

2002-12-05 Thread Dave Mc
Hi,
Is anyone on the list using this package? I've searched and can
find no examples of its use, outside those provided on the OpenTracker
Website. Is it possible to use the package on multiple hosted sites? All
my virtuals show up as one site and the referers include my site.
Confused and looking for pointers.


Dave.





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




[PHP] Re: PHP and Ensim Question

2002-12-05 Thread UberGoober
For those that don't know what ensim is, its a virtual hosting software
(www.ensim.com),

Mike - There is another setting in /etc/httpd/conf/httpd.conf to set safe
mode off. I don't suggest you do this though.

I would suggest you use the ensim bulliten board for these questions IMOHO.

--

Mike Bowers [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
I have a question regarding PHP Safe-Mode and Ensim. On my master confing
(/etc/php.ini) safe mode is off. But on each domain and site I installed on
the server the local config file for that site turns safemode on. Doesn
anyone know where Ensim puts the config files? I've tried to find them and a
few of my scripts I run my site with wont work with safe mode.

Mike Bowers
PlanetModz Gaming Network Webmaster
http://www.planetmodz.com
[EMAIL PROTECTED]
[EMAIL PROTECTED]
All outgoing messages scanned for viruses
using Norton AV 2002



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




[PHP] PHP includes without access to the default directory

2002-12-05 Thread Gundamn
I have a hosted account. As such, I am unable to use the default location
for files when used with the include command. So could somebody tell me how
I can either make it go to a different directory, or to link to something
(and how to add the variable as the filename)?

Thank you in advance.



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




RE: [PHP] Hiding Errors

2002-12-05 Thread John W. Holmes
 Is there a way to have errors in script not output to the screen? I
have a
 page that creates an error which really isn't a problem and I don't
want
 users to see the error message.

If this is a production machine, you should have display.errors OFF in
php.ini

---John Holmes...



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




RE: [PHP] Easy array stuff I think for those who can I guess.

2002-12-05 Thread John W. Holmes
If this is mysql, you can use

SELECT * FROM konkuranse ORDER BY RAND() LIMIT 1

To get a random row and skip all that stuff you have...

---John Holmes...

 -Original Message-
 From: Raymond Lilleodegard [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, December 05, 2002 5:36 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Easy array stuff I think for those who can I guess.
 
 Hi!
 
 I am trying to get out a value of an array that I have made from a
query
 and
 deliver the value into a variable. I have made this code. Am I totally
 lost?
 
 
 while ($myrow = mysql_fetch_array($result));
 {
 
  $id = $myrow['id'];
 
  $deltaker[] = array ($id);
 
 }
 
 $limit = count($deltaker);
 
 
 $finn_vinner = rand(0,$limit);
 
 $vinner_deltaker = $deltaker[$finn_vinner];
 
 $vinner_id = current($vinner_deltaker);
 
 
 $sql2 = SELECT * FROM konkuranse WHERE id = '$vinner_id';
 
 
 Best regards Raymond
 
 
 
 --
 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




  1   2   >