[PHP] ntp client??

2003-06-12 Thread Paul
Hey Guys,

I've had a look around but no luck watsoever. If someone could give me a
short answer on this one? Is it possible to make a php ntp client? If so
give me your opinion on getting it done please?

Paul



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



Re: [PHP] 4 hours staring - can't see clear.

2003-06-12 Thread Lang Sharpe

You can't embed function calls in strings like this
$sString = {addslashes($blah)},{addslashes($blah)};

you have to go

$sString = addslashes($blah) . ',' . addslashes($blah);

Lang

John Taylor-Johnston wrote:
 Lars,
 
 Thanks. I am getting this error however:
 
 Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
 `T_NUM_STRING' in
 
 It does not like addslashes() because of the {}? What is a sensible work
 around? Or do I even need addslashes??
 
 if ($found)
  {
  $sql = INSERT INTO $dbtable
  
(RNum,YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC,SR,PL,PR,JR,VNum,INum,DT,PG,LG,SF,OL,KW,AUS,GEO,AN,RB,CO,RR)
  VALUES
  
('{addslashes($record['RNum'])}','{addslashes($record['YR'])}','{addslashes($record['AU'])}','{addslashes($record['ST'])}','{addslashes($record['SD'])}','{addslashes($record['SC'])}','{addslashes($record['BT'])}','{addslashes($record['BD'])}','{addslashes($record['BC'])}','{addslashes($record['AT'])}','{addslashes($record['AD'])}','{addslashes($record['AC'])}','{addslashes($record['SR'])}','{addslashes($record['PL'])}','{addslashes($record['PR'])}','{addslashes($record['JR'])}','{addslashes($record['VNum'])}','{addslashes($record['INum'])}','{addslashes($record['DT'])}','{addslashes($record['PG'])}','{addslashes($record['LG'])}','{addslashes($record['SF'])}','{addslashes($record['OL'])}','{addslashes($record['KW'])}','{addslashes($record['AUS'])}','{addslashes($record['GEO'])}','{addslashes($record['AN'])}','{addslashes($record['RB'])}','{addslashes($record['CO'])}','{addslashes($record['RR'])}');
  echo $sqlhr\n;
  }
 
 -snip--


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



[PHP] Warning with XtOffsetOf during make

2003-06-12 Thread andre . lagadec
On Solaris 2.7 with Apache 1.3.27 and PHP-4.2.3, I configure PHP with
this command :
'./configure' \
'--with-config-file-path=/usr/local/apache/conf' \
'--with-gd=/usr/local' \
'--enable-gd-native-ttf' \
'--with-png-dir=/usr/local' \
'--with-jpeg-dir=/usr/local' \
'--with-zlib=/usr/local' '--with-zlib-dir=/usr/local' \
'--with-freetype-dir=/usr/local' \
'--with-apxs=/usr/local/apache/bin/apxs' \
'--with-oci8=/produits/oracle/product/8.1.7' \
'--enable-track-vars' \
'--enable-libgcc' \
'--without-pear' \
'--disable-FEATURE' \
'--disable-xml' \
'--enable-inline-optimization' 1build_apache_php.log
2build_apache_php.log

During 'make', I get this warning :
/bin/sh /produits/packages/php-4.2.3/libtool --silent --mode=compile
gcc  -I. -I/produits/packages/php-4.2.3/ext/standard -I/produit
s/packages/php-4.2.3/main -I/produits/packages/php-4.2.3
-I/usr/local/apache/include -I/produits/packages/php-4.2.3/Zend
-I/usr/loca
l/include -I/usr/local/include/freetype2/freetype
-I/produits/packages/php-4.2.3/ext/mysql/libmysql
-I/produits/oracle/product/8.1.6
/rdbms/public -I/produits/oracle/product/8.1.6/rdbms/demo
-I/produits/oracle/product/8.1.6/network/public
-D_POSIX_PTHREAD_SEMANTIC
S -DSOLARIS2=270 -DEAPI -I/produits/packages/php-4.2.3/TSRM -g -O2
-prefer-pic  -c var_unserializer.c
var_unserializer.c: In function `php_var_unserialize':
var_unserializer.c:308: warning: comparison is always false due to
limited range of data type

Is it normal ?

AL


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



Re: [PHP] 4 hours staring - can't see clear.

2003-06-12 Thread Lars Torben Wilson
On Wed, 2003-06-11 at 21:00, John Taylor-Johnston wrote:
 Lars,
 
 Thanks. I am getting this error however:
 
 Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in
 
 It does not like addslashes() because of the {}? What is a sensible work around? Or 
 do I even need addslashes??
 
 if ($found)
  {
  $sql = INSERT INTO $dbtable
  
 (RNum,YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC,SR,PL,PR,JR,VNum,INum,DT,PG,LG,SF,OL,KW,AUS,GEO,AN,RB,CO,RR)
  VALUES
  
 ('{addslashes($record['RNum'])}','{addslashes($record['YR'])}','{addslashes($record['AU'])}','{addslashes($record['ST'])}','{addslashes($record['SD'])}','{addslashes($record['SC'])}','{addslashes($record['BT'])}','{addslashes($record['BD'])}','{addslashes($record['BC'])}','{addslashes($record['AT'])}','{addslashes($record['AD'])}','{addslashes($record['AC'])}','{addslashes($record['SR'])}','{addslashes($record['PL'])}','{addslashes($record['PR'])}','{addslashes($record['JR'])}','{addslashes($record['VNum'])}','{addslashes($record['INum'])}','{addslashes($record['DT'])}','{addslashes($record['PG'])}','{addslashes($record['LG'])}','{addslashes($record['SF'])}','{addslashes($record['OL'])}','{addslashes($record['KW'])}','{addslashes($record['AUS'])}','{addslashes($record['GEO'])}','{addslashes($record['AN'])}','{addslashes($record['RB'])}','{addslashes($record['CO'])}','{addslashes($record['RR'])}');
  echo $sqlhr\n;
  }

Ah...in this case, the addslashes() is being called from within the
quotes, so it won't get called. In this case, I would suggest moving it
to the assignment above:

if (isset($var[$key]['Option']))
{
// Flag that we got one this time round.
$found = true;
// Get the translated name from $var.
$record[$var[$key]['Option']] = addslashes(trim($val));
}

...that way, you know it's been called on everything, and you don't
have to hunt around and change it in a bunch of places if you decide on
something else later on.


Cheers,

Torben


-- 
 Torben Wilson [EMAIL PROTECTED]+1.604.709.0506
 http://www.thebuttlesschaps.com  http://www.inflatableeye.com
 http://www.hybrid17.com  http://www.themainonmain.com
 - Boycott Starbucks!  http://www.haidabuckscafe.com -




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



RE: [PHP] Sessions and login

2003-06-12 Thread Ford, Mike [LSS]
 -Original Message-
 From: Angelo Zanetti [mailto:[EMAIL PROTECTED]
 Sent: 11 June 2003 14:09
 
 session_register('user');
$_SESSION['user'] = ebusUser;

Just one other quick point here: if you use the $_SESSION array, you don't
need to -- and, in fact, should not -- use session_register() and friends.

Cheers!

Mike

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

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



Re: [PHP] SQL SERVER QUESTION

2003-06-12 Thread Brian McGarvie
Or the fact that various datatypes take up various storage needs

Clint Tredway [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 How about the need to add prices together, or store binary data, or using
a
 bit for true false...

 There are numerous reasons for datatypes in a database.

 HTH,
 Clint

 -Original Message-
 From: Dale [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, June 11, 2003 8:43 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] SQL SERVER QUESTION


 I am still new to web programming. I have a question regarding sql
 databases. Since variables in php don't require a type, why is it so
 important that you specify a type for each of the colomons in your tables
in
 your sql database. It seems to me that you could potentially make
everything
 chars and it wouldn't make a difference. The only real benefit is that I
 have seen that by making a column of type date, it allows you to easily
 compare dates. I don't see the benefit of making a colomon of type money
 though?

 Thanks,
 Dale



 --
 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: Warning with XtOffsetOf during make

2003-06-12 Thread andre . lagadec
Hi,

Excuse-me, I have 2 warnings : one with php_var_unserialize and an other
with
XtOffsetOf.
Here is the warning with XtOffsetOf
During 'make', I get this warning :
/bin/sh /produits/packages/php-4.2.3/libtool --silent --mode=compile
gcc  -I. -I/produits/packages/php-4.2.3/sapi/apache -I/produits
/packages/php-4.2.3/main -I/produits/packages/php-4.2.3
-I/usr/local/apache/include -I/produits/packages/php-4.2.3/Zend
-I/usr/local
/include -I/usr/local/include/freetype2/freetype
-I/produits/packages/php-4.2.3/ext/mysql/libmysql
-I/produits/oracle/product/8.1.6/
rdbms/public -I/produits/oracle/product/8.1.6/rdbms/demo
-I/produits/oracle/product/8.1.6/network/public
-D_POSIX_PTHREAD_SEMANTICS
 -DSOLARIS2=270 -DEAPI -I/produits/packages/php-4.2.3/TSRM -g -O2
-prefer-pic  -c sapi_apache.c
In file included from /usr/local/apache/include/httpd.h:72,
 from sapi_apache.c:32:
/usr/local/apache/include/ap_config.h:1396:1: warning: XtOffsetOf
redefined
/produits/packages/php-4.2.3/main/php.h:346:1: warning: this is the
location of the previous definition
/bin/sh /produits/packages/php-4.2.3/libtool --silent --mode=compile
gcc  -I. -I/produits/packages/php-4.2.3/sapi/apache -I/produits
/packages/php-4.2.3/main -I/produits/packages/php-4.2.3
-I/usr/local/apache/include -I/produits/packages/php-4.2.3/Zend
-I/usr/local
/include -I/usr/local/include/freetype2/freetype
-I/produits/packages/php-4.2.3/ext/mysql/libmysql
-I/produits/oracle/product/8.1.6/
rdbms/public -I/produits/oracle/product/8.1.6/rdbms/demo
-I/produits/oracle/product/8.1.6/network/public
-D_POSIX_PTHREAD_SEMANTICS
 -DSOLARIS2=270 -DEAPI -I/produits/packages/php-4.2.3/TSRM -g -O2
-prefer-pic  -c mod_php4.c
In file included from /usr/local/apache/include/httpd.h:72,
 from mod_php4.c:32:
/usr/local/apache/include/ap_config.h:1396:1: warning: XtOffsetOf
redefined
/produits/packages/php-4.2.3/main/php.h:346:1: warning: this is the
location of the previous definition
/bin/sh /produits/packages/php-4.2.3/libtool --silent --mode=compile
gcc  -I. -I/produits/packages/php-4.2.3/sapi/apache -I/produits
/packages/php-4.2.3/main -I/produits/packages/php-4.2.3
-I/usr/local/apache/include -I/produits/packages/php-4.2.3/Zend
-I/usr/local
/include -I/usr/local/include/freetype2/freetype
-I/produits/packages/php-4.2.3/ext/mysql/libmysql
-I/produits/oracle/product/8.1.6/
rdbms/public -I/produits/oracle/product/8.1.6/rdbms/demo
-I/produits/oracle/product/8.1.6/network/public
-D_POSIX_PTHREAD_SEMANTICS
 -DSOLARIS2=270 -DEAPI -I/produits/packages/php-4.2.3/TSRM -g -O2
-prefer-pic  -c php_apache.c
In file included from php_apache_http.h:6,
 from php_apache.c:45:
/usr/local/apache/include/ap_config.h:1396:1: warning: XtOffsetOf
redefined
/produits/packages/php-4.2.3/main/php.h:346:1: warning: this is the
location of the previous definition

Is it normal ?

So the message under this line correspond with php_var_unserialize.

Andre Lagadec a écrit :

 On Solaris 2.7 with Apache 1.3.27 and PHP-4.2.3, I configure PHP with
 this command :
 './configure' \
 '--with-config-file-path=/usr/local/apache/conf' \
 '--with-gd=/usr/local' \
 '--enable-gd-native-ttf' \
 '--with-png-dir=/usr/local' \
 '--with-jpeg-dir=/usr/local' \
 '--with-zlib=/usr/local' '--with-zlib-dir=/usr/local' \
 '--with-freetype-dir=/usr/local' \
 '--with-apxs=/usr/local/apache/bin/apxs' \
 '--with-oci8=/produits/oracle/product/8.1.7' \
 '--enable-track-vars' \
 '--enable-libgcc' \
 '--without-pear' \
 '--disable-FEATURE' \
 '--disable-xml' \
 '--enable-inline-optimization' 1build_apache_php.log
 2build_apache_php.log

 During 'make', I get this warning :
 /bin/sh /produits/packages/php-4.2.3/libtool --silent --mode=compile
 gcc  -I. -I/produits/packages/php-4.2.3/ext/standard -I/produit
 s/packages/php-4.2.3/main -I/produits/packages/php-4.2.3
 -I/usr/local/apache/include -I/produits/packages/php-4.2.3/Zend
 -I/usr/loca
 l/include -I/usr/local/include/freetype2/freetype
 -I/produits/packages/php-4.2.3/ext/mysql/libmysql
 -I/produits/oracle/product/8.1.6
 /rdbms/public -I/produits/oracle/product/8.1.6/rdbms/demo
 -I/produits/oracle/product/8.1.6/network/public
 -D_POSIX_PTHREAD_SEMANTIC
 S -DSOLARIS2=270 -DEAPI -I/produits/packages/php-4.2.3/TSRM -g -O2
 -prefer-pic  -c var_unserializer.c
 var_unserializer.c: In function `php_var_unserialize':
 var_unserializer.c:308: warning: comparison is always false due to
 limited range of data type

 Is it normal ?

 AL


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



Re: [PHP] Downloading a file.

2003-06-12 Thread Dustin Pate

Jeff Harris [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Jun 11, 2003, Alex Earl claimed that:

 | Does anyone know what to do to make it saved as: mysoft-1.0-truc.zip
 |
 | And I would like to display a page telling Thanks for download or
 | something...but if I had to the end:
 | header(Location: http://www.mywebsite.com/thanks.html;) ;
 | I does not work :(

 header(Location:...); must not be sent after any html, so you won't be
 able to redirect that way.

 Perhaps if you know approximately how much time it takes to download the
 file, you can use a meta http-equiv=refresh... to redirect to a
 thanks for downloading page, with a link back to the download.


Better yet, can you not spawn the download off in another window, which will
be closed automatically when it's discovered to be a file download instead,
and then do what ever you want in the main browser window?

Dustin Pate



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



[PHP] Re: cache

2003-06-12 Thread Dustin Pate

Diana Castillo [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 what code can I put at the begining of a php page so that the result from
 the cache is never shown ?



The following code should eliminate the cache for every broswer out there.

?php
header(Expires: Mon, 26 Jul 1997 05:00:00 GMT);// Date in the past
header(Last-Modified:  . gmdate(D, d M Y H:i:s) .  GMT);
 // always modified
header(Cache-Control: no-store, no-cache, must-revalidate);  // HTTP/1.1
header(Cache-Control: post-check=0, pre-check=0, false);
header(Pragma: no-cache);  // HTTP/1.0
?




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



[PHP] referer counter

2003-06-12 Thread Thomas Hochstetter
Hi guys,
 
I am writing a counter that checks where the hit comes from, and if it
comes from the same site, it will not count .
I have a question related to performance:
In the script (as yet) I have to open the txt file twice at this stage,
because I first need to read from it and then write to it. The problem
is that the a+ and w+ property of fopen set the file 0 before I can read
from it. So here is the real question:
Is it possible to do this with only one read? Does it matter performance
wise?
 
The script functions are below:
 
function ref($url)
{
$nc = 0;
$cfile = inc/log/logcount.txt;
$valid = preg_match(/dcv/, $url);
$fp = fopen($cfile,r);
$pc = fgets($fp,1024);

if($valid){
echo $pc;
} else {
$this-incr($pc,$fp,$nc);
fclose($fp);
$this-write($nc,$cfile);
echo $nc;
}
}

function incr($pc,$fp,$nc)
{
if($pc != ) 
$nc = intval($pc)+1;
else 
fputs($fp,1);
return $nc;
}

function write($nc,$cfile)
{
$fp = fopen($cfile,w);
$done = fputs($fp,$nc);
if($done == 0)
exit;
fclose($fp);

}
//END of counter functions
}
Additionally, why do I have to pass the nc variable to function incr()
as reference? It did not work just do return $nc.
 
Thomas


RE: [PHP] undefined variable: action

2003-06-12 Thread Ford, Mike [LSS]
 -Original Message-
 From: Ryan M [mailto:[EMAIL PROTECTED]
 Sent: 11 June 2003 20:22
 
 Thanks for the advice... The link worked Now it is saying this:
 
 Notice: Undefined index: action in
 
 It only says this if there is no action...it goes away once I 
 click the link
 and the action=someaction Is there a way to fix my php

Simplest way to fix this is to use the @ silence operator:

   @$_GET['action']

will return NULL if $_GET['action'] is undefined.

  so 
 that I dont
 have to change all of the web sites hosted on my server?? Thanks!

The only way to do that is to reduce the error reporting level to not include 
E_NOTICE.  Ideally, you should run a development server which has error reporting set 
to E_ALL, and only copy scripts to your production server once they produce no 
messages at this level -- your production server can then run with a reduced error 
reporting level (even down to none at all, if you feel confident about that ;). 
Ideally, if your production server does run with no error reporting, you should have 
error logging enabled as a safety net!

Cheers!

Mike

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

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



Re: [PHP] referer counter (scope part)

2003-06-12 Thread Chris Hayes
At 11:29 12-6-03, you wrote:
function ref($url)
{
   $this-incr($pc,$fp,$nc);
   $this-write($nc,$cfile);
   }
   function incr($pc,$fp,$nc)
{
if($pc != )
$nc = intval($pc)+1;
else
fputs($fp,1);
return $nc;
}
Additionally, why do I have to pass the nc variable to function incr()
as reference? It did not work just do return $nc.
See
http://www.php.net/manual/en/language.variables.scope.php
If these functions are in a class, you could try and make $nc a variable in 
the class and refer to it as $this-nc inside the class. 

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


[PHP] PHP Email....

2003-06-12 Thread Brian McGarvie
I have a question about automated email:

In my sendmail configuration i have:

Alias: Testit
Feeds to Program /usr/local/bin/php
/usr/local/apache/sites/xxx.com/tasks/automail/test.php

testit is set up to an address, so if i send to [EMAIL PROTECTED] the above is
indeed ran, my question is how in the test.php can i access the original
email that triggered it?

Any clues would be much appreciated :)

Thanks in advance.



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



[PHP] Re: ntp client??

2003-06-12 Thread Brian McGarvie
 I've had a look around but no luck watsoever. If someone could give me a
 short answer on this one? Is it possible to make a php ntp client? If so
 give me your opinion on getting it done please?

do you mean to query a time server?



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



Re: [PHP] PHP Email....

2003-06-12 Thread Jason Wong
On Thursday 12 June 2003 18:12, Brian McGarvie wrote:
 I have a question about automated email:

 In my sendmail configuration i have:

 Alias: Testit
 Feeds to Program /usr/local/bin/php
 /usr/local/apache/sites/xxx.com/tasks/automail/test.php

 testit is set up to an address, so if i send to [EMAIL PROTECTED] the above is
 indeed ran, my question is how in the test.php can i access the original
 email that triggered it?

 Any clues would be much appreciated :)

Assuming that your sendmail alias was setup properly then the whole email will 
be available in STDIN, see manual  Using PHP from the command line for 
details.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
If you sell diamonds, you cannot expect to have many customers.
But a diamond is a diamond even if there are no customers.
-- Swami Prabhupada
*/


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



Re: [PHP] PHP Email....

2003-06-12 Thread Brian McGarvie
 Assuming that your sendmail alias was setup properly then the whole email
will
 be available in STDIN, see manual  Using PHP from the command line for
 details.

Cheers! Works a treat now to parse the bugger :)



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



Re: [PHP] PHP Email....

2003-06-12 Thread Brian McGarvie
 Assuming that your sendmail alias was setup properly then the whole email
will
 be available in STDIN, see manual  Using PHP from the command line for
 details.

Working kind of :)

Get one line from it



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



Re: [PHP] PHP Email....

2003-06-12 Thread Brian McGarvie
 Working kind of :)

 Get one line from it

Kinda... I get it to return one line...

The code:

?php
define('STDIN',fopen(php://stdin,r));
$str = fgets(STDIN);
mail([EMAIL PROTECTED],Test,Test Test...\n\nOriginal
Email:\n\n$str);
?

Emails me:

Test Test...

Original Email:

From [EMAIL PROTECTED] Thu Jun 12 11:41:39 2003




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



[PHP] Looking for Function / Procedure, best practices

2003-06-12 Thread Tariq Murtaza
Dear All,
Hope someone could shed some light over. :)
I am looking for something like  strip_tags ($str, brhri) but in 
reverse operation.
This will  strip all tags except brhri  tags, but  I need to strip 
these tags only (brhri) keeping the rest unchanged.

Any help / hint will be highly appreciated.
Regards,
Tariq Murtaza


[PHP] Re: ntp client??

2003-06-12 Thread Paul
yes.

I hope this isn't a really dumb question.

Brian McGarvie [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
  I've had a look around but no luck watsoever. If someone could give me a
  short answer on this one? Is it possible to make a php ntp client? If so
  give me your opinion on getting it done please?

 do you mean to query a time server?





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



[PHP] Vars inside an sql query [Regular expression question]

2003-06-12 Thread Hatem Ben
Greetings all,

I got a headache doing this, i need to get vars inside an sql query. For example :

$query = select * FROM `table` where id='$value' order by name;
preg_match_all(/^('\$(.*)')/si, $query,$matches);

any help plz ?

Thanks,
Hatem




[PHP] Re: Looking for Function / Procedure, best practices

2003-06-12 Thread Brian McGarvie
 I am looking for something like  strip_tags ($str, brhri) but in
 reverse operation.
 This will  strip all tags except brhri  tags, but  I need to strip
 these tags only (brhri) keeping the rest unchanged.

You'll be wanting regular expressions then :)

http://uk2.php.net/ereg_replace

just build up an expression to replace brhri  /br/hr/i with
nothing :)



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



[PHP] Re: Vars inside an sql query [Regular expression question]

2003-06-12 Thread DvDmanDT
That doesn't work as the new string already is like select * FROM `table`
where id='2' order by name assuming $value was 2...
Hatem Ben [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
Greetings all,

I got a headache doing this, i need to get vars inside an sql query. For
example :

$query = select * FROM `table` where id='$value' order by name;
preg_match_all(/^('\$(.*)')/si, $query,$matches);

any help plz ?

Thanks,
Hatem





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



Re: [PHP] Re: Vars inside an sql query [Regular expression question]

2003-06-12 Thread Chris Hayes
At 13:54 12-6-03, you wrote:
I got a headache doing this, i need to get vars inside an sql query. For
example :
$query = select * FROM `table` where id='$value' order by name;
preg_match_all(/^('\$(.*)')/si, $query,$matches);


That doesn't work as the new string already is like select * FROM `table`
where id='2' order by name assuming $value was 2...
True, so try using

$query = select * FROM `table` where id='__VALUE__' order by name;

if you insist on doing it this way.

If you decide to keep trying with the $value, you need to know that 
variables inside double quotes are entered on the spot, while not so with 
'single quotes'.

Also it is nice to know that the $ has a special position in preg_matching, 
i kept this mail from a post from december in this list:

 such as $, you must escape it twice. For example:

 $matchme = \$example;
 if (preg_match(/\$example/, $matchme)) {

 will not be matched because PHP interprets the \$ and passes it as $.
 Instead, you must do this:

 if (preg_match(/\\\$example/, $matchme)) {
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] PHP Email....

2003-06-12 Thread Ford, Mike [LSS]
 -Original Message-
 From: Brian McGarvie [mailto:[EMAIL PROTECTED]
 Sent: 12 June 2003 11:42
 
 Kinda... I get it to return one line...
 
 The code:
 
 ?php
 define('STDIN',fopen(php://stdin,r));
 $str = fgets(STDIN);
 mail([EMAIL PROTECTED],Test,Test 
 Test...\n\nOriginal
 Email:\n\n$str);
 ?
 
 Emails me:
 
 Test Test...
 
 Original Email:
 
 From [EMAIL PROTECTED] Thu Jun 12 11:41:39 2003

That seems right.  The description in the manual at http://uk.php.net/fgets
says:

  Reading ends when length - 1 bytes have been read, on a
  newline (which is included in the return value), or on EOF
  (whichever comes first).

As your fgets() call is not in a loop, you only get to the first newline as
that is what comes first.

Cheers!

Mike

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

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



Re: [PHP] Re: Vars inside an sql query [Regular expression question]

2003-06-12 Thread Hatem Ben
Oh, ok this is how i want to do it exactly :
 query.php
?php
$query = select * FROM `table` where id='$value' order by name;
?

 parse.php
?php
$fcontents = join('' , file('query.php'));
preg_match_all(/^('\$(.*)')/si, $fcontents,$matches);
print_r($matches)
?

Thanks

Chris Hayes [EMAIL PROTECTED] a écrit dans le message de news:
[EMAIL PROTECTED]
 At 13:54 12-6-03, you wrote:
 I got a headache doing this, i need to get vars inside an sql query. For
 example :
 
 $query = select * FROM `table` where id='$value' order by name;
 preg_match_all(/^('\$(.*)')/si, $query,$matches);


 That doesn't work as the new string already is like select * FROM
`table`
 where id='2' order by name assuming $value was 2...

 True, so try using

 $query = select * FROM `table` where id='__VALUE__' order by name;

 if you insist on doing it this way.

 If you decide to keep trying with the $value, you need to know that
 variables inside double quotes are entered on the spot, while not so
with
 'single quotes'.


 Also it is nice to know that the $ has a special position in
preg_matching,
 i kept this mail from a post from december in this list:

   such as $, you must escape it twice. For example:
  
   $matchme = \$example;
   if (preg_match(/\$example/, $matchme)) {
  
   will not be matched because PHP interprets the \$ and passes it as $.
   Instead, you must do this:
  
   if (preg_match(/\\\$example/, $matchme)) {




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



Re: [PHP] Re: Vars inside an sql query [Regular expression question]

2003-06-12 Thread Hatem Ben
Sorry this is more correct :

-- starting query.php
select * FROM `table` where id='$value' order by name
-- ending query.php

Hatem Ben [EMAIL PROTECTED] a écrit dans le message de news:
[EMAIL PROTECTED]
 Oh, ok this is how i want to do it exactly :
  query.php
 ?php
 $query = select * FROM `table` where id='$value' order by name;
 ?

  parse.php
 ?php
 $fcontents = join('' , file('query.php'));
 preg_match_all(/^('\$(.*)')/si, $fcontents,$matches);
 print_r($matches)
 ?

 Thanks

 Chris Hayes [EMAIL PROTECTED] a écrit dans le message de news:
 [EMAIL PROTECTED]
  At 13:54 12-6-03, you wrote:
  I got a headache doing this, i need to get vars inside an sql query.
For
  example :
  
  $query = select * FROM `table` where id='$value' order by name;
  preg_match_all(/^('\$(.*)')/si, $query,$matches);
 
 
  That doesn't work as the new string already is like select * FROM
 `table`
  where id='2' order by name assuming $value was 2...
 
  True, so try using
 
  $query = select * FROM `table` where id='__VALUE__' order by name;
 
  if you insist on doing it this way.
 
  If you decide to keep trying with the $value, you need to know that
  variables inside double quotes are entered on the spot, while not so
 with
  'single quotes'.
 
 
  Also it is nice to know that the $ has a special position in
 preg_matching,
  i kept this mail from a post from december in this list:
 
such as $, you must escape it twice. For example:
   
$matchme = \$example;
if (preg_match(/\$example/, $matchme)) {
   
will not be matched because PHP interprets the \$ and passes it as $.
Instead, you must do this:
   
if (preg_match(/\\\$example/, $matchme)) {
 





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



[PHP] a simple class,please advise:)

2003-06-12 Thread hui
i wrote a simple easy class,
please give me some advise and help my skills,
thank you^_^

(using 'DB/DataObject.php,Smarty...)

?php

require_once('DB/DataObject.php');
define('AUTH_PREFIX','__auth__');

class Auth
{
var $_sessionname;
var $name;
var $login_time;

function singleton($name,$sessionname) {
static $instance;
if (!isset($instance)) {
$instance = new Auth($name,$sessionname);
}
return $instance;
}
function Auth($name,$sessionname)
{
$this - _sessionname = $sessionname;
$this - name = $name;
$this - login_time = time();
}

function knock($name,$prefix = null)
{
if(empty($prefix))  $prefix = AUTH_PREFIX;
$session_name = $prefix.$name;
if(empty($_SESSION[$session_name]))
{
$auth = false;
$redir = $_SERVER['REQUEST_URI'];
Auth::_gologin($name,$redir);
}else
{
$auth = Auth::singleton($name,$session_name);
}
return $auth;
}
function _gologin($name,$redir = null)
{
 $_AUTH = Auth::_loadConfig();
 if(key_exists($name,$_AUTH['CONFIG']))
 {
 $action = $_AUTH['CONFIG'][$name]['login'];
 if(empty($redir)!empty($_AUTH['CONFIG'][$name]['door']))
 {
 $redir = $_AUTH['CONFIG'][$name]['door'];
 }
 Auth::_forward($action?name=$nameredir=$redir);
 }
}
function _loadConfig()
{
global $_AUTH;
if(empty($_AUTH))
$_AUTH['CONFIG'] = PEAR::getStaticProperty('Auth','options');
return $_AUTH;
}
function _forward($url)
{
?
SCRIPT
window.location.replace('?=$url?');
/SCRIPT
?
die;
}
function login($get,$post){
$_AUTH = Auth::_loadConfig();
if(
!empty($get['name'])
key_exists($get['name'],$_AUTH['CONFIG'])
)   // if ()
 {
 $name = $get['name'];
 if(!empty($get['redir']))
 {
$redir = $get['redir'];
 }else
 {
$redir = './';
 }
 $action = $_AUTH['CONFIG'][$name]['login'];
 if(
!empty($post['action'])
$post['action'] == 'login'
!empty($post['username'])
!empty($post['password'])
)   // if ()
 {
$username = $post['username'];
$password = $post['password'];
$do_class = $_AUTH['CONFIG'][$name]['DO_class'];
$do_user = $_AUTH['CONFIG'][$name]['DO_userfield'];
$do_pass = $_AUTH['CONFIG'][$name]['DO_passfield'];
$do = DB_DataObject::staticGet($do_class,$do_user,$username);
if(!empty($do)){
//var_dump($do - $do_pass);
if(md5($password) == $do - $do_pass)
{
if(empty($prefix))  $prefix = AUTH_PREFIX;
   $session_name = $prefix.$name;
$_SESSION[$session_name] =
Auth::singleton($name,$session_name);
Auth::_forward($redir);
}else {
Auth::_forward($action?name=$nameredir=$redir);
}
}
 }else{
 $s = new mSmarty();
$s - assign('auth_name',$name);
$s - assign('auth_redir',$redir);
$s - display($_AUTH['CONFIG'][$name]['login_template']);
die;
 }
 }
}
function logout($name)
{
if(empty($prefix))  $prefix = AUTH_PREFIX;
$session_name = $prefix.$name;
if(!empty($_SESSION[$session_name])) {
$_SESSION[$session_name] = null;
$_AUTH = Auth::_loadConfig();
if(
key_exists($name,$_AUTH['CONFIG'])
!empty($_AUTH['CONFIG'][$name]['logout_to'])
)   // if ()
 {
$logout = $_AUTH['CONFIG'][$name]['logout_to'];
Auth::_forward($logout);
 }
}else {
Auth::_forward('./');
}
}
}

?

ini file:

[admin]
login=login.php
login_template=admin/login.htm
logout=logout.php
logout_to=t.php
DO_class = DataObjects_Config
DO_userfield = admin_user
DO_passfield = admin_pass

and the setup code:

...
require_once('Auth.php');
$Auth_options = PEAR::getStaticProperty('Auth','options');
$config = parse_ini_file(WEBDOC_PATH.'/auth.ini',true);
$Auth_options = $config;
...



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



Re: [PHP] piping email directly into PHP

2003-06-12 Thread Brent Baisley
You may also want to look into dbmail (dbmail.org), which is a mail 
server that uses Postgres or Mysql as it's repository. I haven't played 
with it yet, but I would think you would be able to query the database 
like any other database you create.

On Wednesday, June 11, 2003, at 05:31 PM, Adrian Teasdale wrote:

Hi there

We are wanting to create a little help/crm tool for internal use.  
Rather
than reading (and parsing) in an email from a pop account, is it now
possible to pipe email in directly to a database via PHP?  If so, any
pointers on how to do it and anything to watch out for?

Thanks in advance

Ade

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

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] A simple request from a simple person

2003-06-12 Thread Roberts, Mark (Tulsa)
Obviously relatively new to php
 
I would like to know how to do a simple redirect from a php page.
 
For example in ASP I do response.redirect(thispage.com)
 
Want to do the same thing in php.
 
I have tried to go through the documentation, but can't seem to get focused on the 
proper and simplest way to do it.
 
A little help would be appreciated. Thanks.

Mark Roberts 
Sr. Systems Analyst 


 


RE: [PHP] A simple request from a simple person

2003-06-12 Thread Jay Blanchard
[snip]
I would like to know how to do a simple redirect from a php page.
[/snip]

Look up 'header' on php.net

header(Location: wherever.php); exit();

HTH!

Jay 

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



Re: [PHP] PHP methods of striping tags and tag contents

2003-06-12 Thread Marek Kilimajer
Should be:
$results = preg_replace(@(tag|tag2)(.*?).*?/\\1@sm,,$html);
Remember you need to find the matching tag, so use backreference.

Burhan Khalid wrote:
Hello dwalker,

Thursday, April 24, 2003, 11:50:16 PM, you wrote:

Firstly, don't ask for reading confirmation reciepts -- especially on
a list.
d   What is the most efficient method of removing tags AND the contents between the tags?

$results = preg_replace(@(tag|tag2)(.*?).*?/(tag|tag2)@sm,,$html);

were tag|tag2 is the list of tags you want to search for.




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


[PHP] Re: shorthand if notation

2003-06-12 Thread Pete Morganic
Its a ternary operator

look at
http://www.phpbuilder.com/board/showthread.php?threadid=10235547
http://www.phpbeginner.com/columns/maxim/ternary

pete

Adrian Greeman wrote:
I am confused by the shorthand if notation.
For example I just saw this PHP snippet on another forum
?
$bkgndClass = $bkgndClass == darkBkgnd ? liteBkgnd :
darkBkgnd;
}
?
I think it is an if but cannot find it in the manual. How
is that written in the more normal notation -   if(){}   etc??
[And please excuse a slightly off-thread but related extension to
the question but I have seen similar in Javascript  - namely --- 
var evt = (evt ? evt : ((window.event) ? window.event : null);
is this the same notation or something else?]

RegardsAdrian Greeman



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


[PHP] General question...

2003-06-12 Thread Valentin
hi all,

is it possible with php:
first to pass request to another URL and after that to get the html responce
as a string and put it into php $variable?

best,



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



[PHP] Re: form name and submit test

2003-06-12 Thread Pete Morganic
Put a hidden field in the form and give it the same name as the forms

eg
input type=hidden name=form_name value=sign_up_form
I'm pretty sure the form name is not sent to the server - but i may be wrong

pete

Amanda McComb wrote:
If I have multiple forms on a page, and each form has it's own name, how
can I tell which form has submitted?


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


Re: [PHP] General question...

2003-06-12 Thread Jason Wong
On Thursday 12 June 2003 21:53, Valentin wrote:

Please use a descriptive subject!

 is it possible with php:
 first to pass request to another URL and after that to get the html
 responce as a string and put it into php $variable?

Simplest: fopen()

For alternatives, search archives.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
It pays in England to be a revolutionary and a bible-smacker most of
one's life and then come round.
-- Lord Alfred Douglas
*/


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



Re: [PHP] Re: Using register_globals

2003-06-12 Thread Jim McNeely
I'm a bit of a neophyte with php, and I've read through lots of prior 
posts and the php.net online docs, but some of this is still not 
registering in my head. TIA for your patience.

I've got a script I include at the head of each of my scripts that 
checks $_POST['username'] and $_POST['password'] against a database, 
and exits to an error page if it doesn't check out. Every link is a 
post where it passes these two values. So if you open any page in the 
whole thing it has to have the actual value of a real username and 
password or it exits to an error page asking for these values.

This seems to have been working fine, but when I installed a newer 
version of php it started making noise about register globals being 
off. Upon further reading, it seems SESSIONS are insecure, COOKIES are 
insecure, POSTS and GETS are insecure. It seems to me that you would 
have to write some exceptionally stupid code for these things to be 
really openly insecure, so I must be missing something.

After a point it seems like if you leave your machine off or disconnect 
it from the network that would be the most secure but you have to pass 
this info somehow. What is the accepted practice for passing user info 
into variables?

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


Re: [PHP] General question...

2003-06-12 Thread Valentin
hi Jason,
In my site I use a payment system, but unfortunately, there is a moment
when the client must enter his card data into the page owned by the
company that makes transactions (sorry for this descriptive bad english).
The problem is that the design of this page is quite different then mine and
I would like to get the html responce and redesign at run time by php and
display what I would like to be.



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



RE: [PHP] Re: Vars inside an sql query [Regular expression question]

2003-06-12 Thread Monu Ogbe
Hi, 

I'll join the conversation, because I have a similar problem.  

PHP interpolates variable values in strings if these are enclosed in 
double quotes:

e.g., 

  $string = select * FROM `table` where id='$value' order by name;

PHP does not interpolate variables contained in strings delimited by 
single quotes.  That much is clear.

What seems to happen in Ben's case is that strings retrieved from the 
database are treated as if they are delimited by single quotes.

I have the same trouble in the case of strings retrieved from a file.

I have not been able to find a function that FORCES the variables 
within a single-quoted string to be translated.

I am currently looking into heredocs because the heredoc construct, 
like double-quoted strings, does perform interpolation.

I'll report back if this works, but would love to hear if there is a
simpler solution.

Thanks, 

Monu

Sorry this is more correct :

-- starting query.php
select * FROM `table` where id='$value' order by name
-- ending query.php

Hatem Ben [EMAIL PROTECTED] a écrit dans le message de news:
[EMAIL PROTECTED]
 Oh, ok this is how i want to do it exactly :
  query.php
 ?php
 $query = select * FROM `table` where id='$value' order by name;
 ?

  parse.php
 ?php
 $fcontents = join('' , file('query.php'));
 preg_match_all(/^('\$(.*)')/si, $fcontents,$matches);
 print_r($matches)
 ?

 Thanks

 Chris Hayes [EMAIL PROTECTED] a écrit dans le message de news:
 [EMAIL PROTECTED]
  At 13:54 12-6-03, you wrote:
  I got a headache doing this, i need to get vars inside an sql
query.
For
  example :
  
  $query = select * FROM `table` where id='$value' order by name;
  preg_match_all(/^('\$(.*)')/si, $query,$matches);
 
 
  That doesn't work as the new string already is like select * FROM
 `table`
  where id='2' order by name assuming $value was 2...
 
  True, so try using
 
  $query = select * FROM `table` where id='__VALUE__' order by
name;
 
  if you insist on doing it this way.
 
  If you decide to keep trying with the $value, you need to know that
  variables inside double quotes are entered on the spot, while not
so
 with
  'single quotes'.
 
 
  Also it is nice to know that the $ has a special position in
 preg_matching,
  i kept this mail from a post from december in this list:
 
such as $, you must escape it twice. For example:
   
$matchme = \$example;
if (preg_match(/\$example/, $matchme)) {
   
will not be matched because PHP interprets the \$ and passes it
as $.
Instead, you must do this:
   
if (preg_match(/\\\$example/, $matchme)) {
 



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



RE: [PHP] Re: Vars inside an sql query [Regular expression question]

2003-06-12 Thread Jay Blanchard
[snip]
  $string = select * FROM `table` where id='$value' order by name;
[/snip]

I know it ain't pretty, but the coding style we have accepted is
this

  $string = select * FROM `table` where id = ' . $value . ' order by
name ;

or (we requite caps on reserved words)...

  $string = SELECT * ;
  $string .= FROM `table` ;
  $string .= WHERE id = ' . $value . ' ;
  $string .= ORDER BY name ;

No ambiguity and cleaner on longer queries.

It's all in preference I suppose.

Jay

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



Re: [PHP] General question...

2003-06-12 Thread Marek Kilimajer
Do you think the users will trust your site that much they will be 
willing to give you their credit card information? How would they know 
you won't keep this information?

Valentin wrote:
hi Jason,
In my site I use a payment system, but unfortunately, there is a moment
when the client must enter his card data into the page owned by the
company that makes transactions (sorry for this descriptive bad english).
The problem is that the design of this page is quite different then mine and
I would like to get the html responce and redesign at run time by php and
display what I would like to be.




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


RE: [PHP] piping email directly into PHP

2003-06-12 Thread Adrian Teasdale
Thanks Brent, now that's an interesting angle I'd not thought about :)  

Thanks for this

Ade

 -Original Message-
 From: Brent Baisley [mailto:[EMAIL PROTECTED]
 Sent: 12 June 2003 13:30
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] piping email directly into PHP
 
 
 You may also want to look into dbmail (dbmail.org), which is a mail 
 server that uses Postgres or Mysql as it's repository. I haven't played 
 with it yet, but I would think you would be able to query the database 
 like any other database you create.
 
 On Wednesday, June 11, 2003, at 05:31 PM, Adrian Teasdale wrote:
 
  Hi there
 
  We are wanting to create a little help/crm tool for internal use.  
  Rather
  than reading (and parsing) in an email from a pop account, is it now
  possible to pipe email in directly to a database via PHP?  If so, any
  pointers on how to do it and anything to watch out for?
 
  Thanks in advance
 
  Ade
 
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 -- 
 Brent Baisley
 Systems Architect
 Landover Associates, Inc.
 Search  Advisory Services for Advanced Technology Environments
 p: 212.759.6400/800.759.0577
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 

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



[PHP] Re: A simple request from a simple person

2003-06-12 Thread KK
header(location: mypage.php);


Mark Roberts [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Obviously relatively new to php

I would like to know how to do a simple redirect from a php page.

For example in ASP I do response.redirect(thispage.com)

Want to do the same thing in php.

I have tried to go through the documentation, but can't seem to get focused
on the proper and simplest way to do it.

A little help would be appreciated. Thanks.

Mark Roberts
Sr. Systems Analyst






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



RE: [PHP] Re: Vars inside an sql query [Regular expression question]

2003-06-12 Thread Monu Ogbe
Ben, 

heredocs seem to do just what you are asking. 

http://www.onlamp.com/pub/a/php/2003/04/10/php_heredocs.html

If I can include() a file inside this construct, then it will 
solve my problem too :-?

Monu

-Original Message-
From: Monu Ogbe 
Sent: 12 June 2003 14:12
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Re: Vars inside an sql query [Regular expression
question]


Hi, 

I'll join the conversation, because I have a similar problem.  

PHP interpolates variable values in strings if these are enclosed in 
double quotes:

e.g., 

  $string = select * FROM `table` where id='$value' order by name;

PHP does not interpolate variables contained in strings delimited by 
single quotes.  That much is clear.

What seems to happen in Ben's case is that strings retrieved from the 
database are treated as if they are delimited by single quotes.

I have the same trouble in the case of strings retrieved from a file.

I have not been able to find a function that FORCES the variables 
within a single-quoted string to be translated.

I am currently looking into heredocs because the heredoc construct, 
like double-quoted strings, does perform interpolation.

I'll report back if this works, but would love to hear if there is a
simpler solution.

Thanks, 

Monu

Sorry this is more correct :

-- starting query.php
select * FROM `table` where id='$value' order by name
-- ending query.php

Hatem Ben [EMAIL PROTECTED] a écrit dans le message de news:
[EMAIL PROTECTED]
 Oh, ok this is how i want to do it exactly :
  query.php
 ?php
 $query = select * FROM `table` where id='$value' order by name;
 ?

  parse.php
 ?php
 $fcontents = join('' , file('query.php'));
 preg_match_all(/^('\$(.*)')/si, $fcontents,$matches);
 print_r($matches)
 ?

 Thanks

 Chris Hayes [EMAIL PROTECTED] a écrit dans le message de news:
 [EMAIL PROTECTED]
  At 13:54 12-6-03, you wrote:
  I got a headache doing this, i need to get vars inside an sql
query.
For
  example :
  
  $query = select * FROM `table` where id='$value' order by name;
  preg_match_all(/^('\$(.*)')/si, $query,$matches);
 
 
  That doesn't work as the new string already is like select * FROM
 `table`
  where id='2' order by name assuming $value was 2...
 
  True, so try using
 
  $query = select * FROM `table` where id='__VALUE__' order by
name;
 
  if you insist on doing it this way.
 
  If you decide to keep trying with the $value, you need to know that
  variables inside double quotes are entered on the spot, while not
so
 with
  'single quotes'.
 
 
  Also it is nice to know that the $ has a special position in
 preg_matching,
  i kept this mail from a post from december in this list:
 
such as $, you must escape it twice. For example:
   
$matchme = \$example;
if (preg_match(/\$example/, $matchme)) {
   
will not be matched because PHP interprets the \$ and passes it
as $.
Instead, you must do this:
   
if (preg_match(/\\\$example/, $matchme)) {
 



-- 
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] General question...

2003-06-12 Thread Valentin

Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Do you think the users will trust your site that much they will be
 willing to give you their credit card information? How would they know
 you won't keep this information?


I'm going to make only cosmetic changes like font size, alignments and
colours...
But I don't know... may be you are right... anyway.

Thank you



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



Re: [PHP] A simple request from a simple person

2003-06-12 Thread Marek Kilimajer
Location header requires full uri (at least that's what is in the rfc):
header(Location: http://www.server.com/wherever.php;); exit();
Jay Blanchard wrote:
[snip]
I would like to know how to do a simple redirect from a php page.
[/snip]
Look up 'header' on php.net

header(Location: wherever.php); exit();

HTH!

Jay 



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


[PHP] Easier way to delete all entries in an array?

2003-06-12 Thread James E Hicks III
There's got to be an easier way, is there?

for ($i=0; $i  count($the_array); $i++){
array_pop($the_array);
}

James E Hicks III
Noland Company
2700 Warwick Blvd
Newport News, VA 23607
757-928-9000 ext 435
[EMAIL PROTECTED] 

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



Re: [PHP] Easier way to delete all entries in an array?

2003-06-12 Thread Chris Hayes
At 16:13 12-6-03, you wrote:
There's got to be an easier way, is there?

for ($i=0; $i  count($the_array); $i++){
array_pop($the_array);
}
$the_array=array(); ?

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


Re: [PHP] PHP extensions and multiple source files?

2003-06-12 Thread Marek Kilimajer
Simply list *.c all files as arguments to gcc:

gcc one.c two.c three.c -shared -o my_ext.so

Ed wrote:
Howdy folks!

Is there a way to have multiple *.c source files and still end up with a single *.so while using gcc?  How would that be reflected in the config.m4 file?

I searched for examples in the source tree, but did not find one.  I tried different things, but ended up with multiple *.so's.  I have been using *.h for a few pieces, but compiling gets long and the source a bit unwieldy.

Thanks!


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


Re: [PHP] Re: Vars inside an sql query [Regular expression question]

2003-06-12 Thread Hatem Ben
I agree with you Jay, but those cases are already done, and i got no problem
with RE there

Thanks anyway
Hatem


- Original Message -
From: Jay Blanchard [EMAIL PROTECTED]
To: Monu Ogbe [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, June 12, 2003 3:17 PM
Subject: RE: [PHP] Re: Vars inside an sql query [Regular expression
question]


[snip]
  $string = select * FROM `table` where id='$value' order by name;
[/snip]

I know it ain't pretty, but the coding style we have accepted is
this

  $string = select * FROM `table` where id = ' . $value . ' order by
name ;

or (we requite caps on reserved words)...

  $string = SELECT * ;
  $string .= FROM `table` ;
  $string .= WHERE id = ' . $value . ' ;
  $string .= ORDER BY name ;

No ambiguity and cleaner on longer queries.

It's all in preference I suppose.

Jay

--
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: PHP and XML-RPC on MS Windows

2003-06-12 Thread Evandro Sestrem
Erich,

Yes, it's possible to do the same.

What XML-RPC implementation to PHP are you using?


Evandro Sestrem

Erich Kolb [EMAIL PROTECTED] escreveu na mensagem
news:[EMAIL PROTECTED]
 What do I have to do in order to use the XML-RPC functionality on a
Windows
 based machine?  It was fairly easy to drop the .inc files into the PHP
 include directory on a Linux box, but I am not sure if it is possible to
do
 the same on a Windows machine.





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



Re: [PHP] General question...

2003-06-12 Thread Brian McGarvie
it detracts from the experiance of user consistency if you are suddenly in a
nice site then presented with a crappy looking payment page ;)

Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Do you think the users will trust your site that much they will be
 willing to give you their credit card information? How would they know
 you won't keep this information?

 Valentin wrote:
  hi Jason,
  In my site I use a payment system, but unfortunately, there is a
moment
  when the client must enter his card data into the page owned by the
  company that makes transactions (sorry for this descriptive bad
english).
  The problem is that the design of this page is quite different then mine
and
  I would like to get the html responce and redesign at run time by php
and
  display what I would like to be.
 
 
 




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



[PHP] Vars inside an sql query [Regular expression question] - Again

2003-06-12 Thread Hatem Ben
I'm asking again the same question, coz i guess my question wasn't clear.

 i just need to retreive vars inside query.txt, my regular expression seems to be 
correct for me, but i don't find why it doesn't wrk

-- Starting query.txt
select * FROM `table` where id='$value' order by name
-- Ending query.txt


-- Starting parse.php
?php
$fcontents = join('' , file('query.txt'));
preg_match_all(/^('\$(.*)')/si, $fcontents,$matches);
print_r($matches)
?
- Ending parse.php


rewriting query is another question, that i agree also.

Thanks
Hatem


[PHP] Re: your mail

2003-06-12 Thread Philip Olson
  Looks still broken to me :)
 
 yup, but I don't get the problem, everything seems fine on my box.. maybe
 a problem with vim comments ? can you commit the _right_ WS fix ?
 
 thanks in advance :)

TABS are EVIL! :)

Regards,
Philip


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



Re: [PHP] Vars inside an sql query [Regular expression question]- Again

2003-06-12 Thread Marek Kilimajer
preg_match_all(/^('\$(.*)')/si, $fcontents,$matches);
 ^^
you don't allow any character between start of the string and single quote.
preg_match_all(/^.*('\$(.*)')/si, $fcontents,$matches);
Hatem Ben wrote:
I'm asking again the same question, coz i guess my question wasn't clear.

 i just need to retreive vars inside query.txt, my regular expression seems to be correct for me, but i don't find why it doesn't wrk

-- Starting query.txt
select * FROM `table` where id='$value' order by name
-- Ending query.txt
-- Starting parse.php
?php
$fcontents = join('' , file('query.txt'));
preg_match_all(/^('\$(.*)')/si, $fcontents,$matches);
print_r($matches)
?
- Ending parse.php
rewriting query is another question, that i agree also.

Thanks
Hatem


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


RE: [PHP] Vars inside an sql query [Regular expression question] - Again

2003-06-12 Thread Monu Ogbe
Right then.  

Here's what I have done, and it works:

===Contents of query.txt===
?php
$fcontents = QUERY
select * FROM `table` where id='$value' order by name
QUERY;
?
===End Contents of query.txt===

Then:

===Contents of parse.php===
?php
include('query.txt');
preg_match_all(/^('\$(.*)')/si, $fcontents,$matches);
print_r($matches)
?
===End Contents of parse.php===

Now, whereas this works, I am still looking for a way to 
store and interpolate variables contained in query.txt 
without the kludge of having to embed the assignment of 
$fcontents inside the file as above :-(

Have fun, 

Monu

-Original Message-
From: Hatem Ben [mailto:[EMAIL PROTECTED]
Sent: 12 June 2003 14:59
To: [EMAIL PROTECTED]
Subject: [PHP] Vars inside an sql query [Regular expression question] -
Again


I'm asking again the same question, coz i guess my question wasn't
clear.

 i just need to retreive vars inside query.txt, my regular expression
seems to be correct for me, but i don't find why it doesn't wrk

-- Starting query.txt
select * FROM `table` where id='$value' order by name
-- Ending query.txt


-- Starting parse.php
?php
$fcontents = join('' , file('query.txt'));
preg_match_all(/^('\$(.*)')/si, $fcontents,$matches);
print_r($matches)
?
- Ending parse.php


rewriting query is another question, that i agree also.

Thanks
Hatem

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



Re: [PHP] Easier way to delete all entries in an array?

2003-06-12 Thread Wendell Brown
On Thu, 12 Jun 2003 10:13:10 -0400, James E Hicks III wrote:

There's got to be an easier way, is there?

for ($i=0; $i  count($the_array); $i++){
   array_pop($the_array);
}

Maybe this:

unset( $the_array );




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



Re: [PHP] Vars inside an sql query [Regular expression question] - Again

2003-06-12 Thread Hatem Ben
It's not working also

- Original Message -
From: Marek Kilimajer [EMAIL PROTECTED]
To: Hatem Ben [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, June 12, 2003 5:23 PM
Subject: Re: [PHP] Vars inside an sql query [Regular expression question] -
Again


 preg_match_all(/^('\$(.*)')/si, $fcontents,$matches);
   ^^
 you don't allow any character between start of the string and single
quote.
 preg_match_all(/^.*('\$(.*)')/si, $fcontents,$matches);


 Hatem Ben wrote:
  I'm asking again the same question, coz i guess my question wasn't
clear.
 
   i just need to retreive vars inside query.txt, my regular expression
seems to be correct for me, but i don't find why it doesn't wrk
 
  -- Starting query.txt
  select * FROM `table` where id='$value' order by name
  -- Ending query.txt
 
 
  -- Starting parse.php
  ?php
  $fcontents = join('' , file('query.txt'));
  preg_match_all(/^('\$(.*)')/si, $fcontents,$matches);
  print_r($matches)
  ?
  - Ending parse.php
 
 
  rewriting query is another question, that i agree also.
 
  Thanks
  Hatem
 


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



RE: [PHP] Easier way to delete all entries in an array?

2003-06-12 Thread Monu Ogbe
Or perhaps,

$the_array = array();

Monu

-Original Message-
From: Wendell Brown [mailto:[EMAIL PROTECTED]
Sent: 12 June 2003 16:31
To: James E Hicks III; [EMAIL PROTECTED]
Subject: Re: [PHP] Easier way to delete all entries in an array?


On Thu, 12 Jun 2003 10:13:10 -0400, James E Hicks III wrote:

There's got to be an easier way, is there?

for ($i=0; $i  count($the_array); $i++){
   array_pop($the_array);
}

Maybe this:

unset( $the_array );




-- 
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] Re: Using register_globals

2003-06-12 Thread Philip Olson

Won't this topic just die? :)

register_globals is not insecure, users are insecure.  Yes, you
can write insecure code with it on or off, and secure code with
it on or off.  By users I mean people who write code, and people
who use it (the evil users are the ones that use the website,
and pass along evil REQUEST data).

In short, read these:

  http://www.php.net/variables.external
  http://www.php.net/security.registerglobals

It should be pretty clear that register_globals = off is preferred
but it's up to you, this is why we have PHP directives.  Turning
of your computer is indeed the ideal security measure!

Regards,
Philip


On Thu, 12 Jun 2003, Jim McNeely wrote:

 I'm a bit of a neophyte with php, and I've read through lots of prior 
 posts and the php.net online docs, but some of this is still not 
 registering in my head. TIA for your patience.
 
 I've got a script I include at the head of each of my scripts that 
 checks $_POST['username'] and $_POST['password'] against a database, 
 and exits to an error page if it doesn't check out. Every link is a 
 post where it passes these two values. So if you open any page in the 
 whole thing it has to have the actual value of a real username and 
 password or it exits to an error page asking for these values.
 
 This seems to have been working fine, but when I installed a newer 
 version of php it started making noise about register globals being 
 off. Upon further reading, it seems SESSIONS are insecure, COOKIES are 
 insecure, POSTS and GETS are insecure. It seems to me that you would 
 have to write some exceptionally stupid code for these things to be 
 really openly insecure, so I must be missing something.
 
 After a point it seems like if you leave your machine off or disconnect 
 it from the network that would be the most secure but you have to pass 
 this info somehow. What is the accepted practice for passing user info 
 into variables?
 
 
 -- 
 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] Easier way to delete all entries in an array?

2003-06-12 Thread James E Hicks III
The following has solved my problem. Thanks to all who helped.

$the_array=array();

-Original Message-
From: Chris Hayes [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 12, 2003 10:14 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Easier way to delete all entries in an array?


At 16:13 12-6-03, you wrote:
There's got to be an easier way, is there?

for ($i=0; $i  count($the_array); $i++){
 array_pop($the_array);
}
$the_array=array(); ?


-- 
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] Vars inside an sql query [Regular expression question] - Again

2003-06-12 Thread Hatem Ben
Well, it's finally working, but still very confusing ... thanks all

?php

$fcontents = join('' , file('query.txt'));

preg_match_all('/(\'\$(.*)\')/si', $fcontents,$matches);

print_r($matches)

?

Regards,
Hatem

- Original Message -
From: Hatem Ben [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: Marek Kilimajer [EMAIL PROTECTED]
Sent: Thursday, June 12, 2003 4:35 PM
Subject: Re: [PHP] Vars inside an sql query [Regular expression question] -
Again


 It's not working also

 - Original Message -
 From: Marek Kilimajer [EMAIL PROTECTED]
 To: Hatem Ben [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Thursday, June 12, 2003 5:23 PM
 Subject: Re: [PHP] Vars inside an sql query [Regular expression
question] -
 Again


  preg_match_all(/^('\$(.*)')/si, $fcontents,$matches);
^^
  you don't allow any character between start of the string and single
 quote.
  preg_match_all(/^.*('\$(.*)')/si, $fcontents,$matches);
 
 
  Hatem Ben wrote:
   I'm asking again the same question, coz i guess my question wasn't
 clear.
  
i just need to retreive vars inside query.txt, my regular expression
 seems to be correct for me, but i don't find why it doesn't wrk
  
   -- Starting query.txt
   select * FROM `table` where id='$value' order by name
   -- Ending query.txt
  
  
   -- Starting parse.php
   ?php
   $fcontents = join('' , file('query.txt'));
   preg_match_all(/^('\$(.*)')/si, $fcontents,$matches);
   print_r($matches)
   ?
   - Ending parse.php
  
  
   rewriting query is another question, that i agree also.
  
   Thanks
   Hatem
  


 --
 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] General question...

2003-06-12 Thread Jason Paschal
ppl, you're missing the point.  you keep re-stating his problem.  he knows 
it's not good to make the 3rd party gateway so obvious.  he's looking for a 
way to make it transparent, so it looks like it's actually part of his site.

i think there should be a way to do it.  maybe use the fsock stuff to pass 
the data (security is an issue, and i'm not familiar with the fsock 
functions much less how they'd be affected if you in a secure section of 
your site).

good luck.

From: Valentin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP] General question...
Date: Thu, 12 Jun 2003 15:53:39 +0200
hi all,

is it possible with php:
first to pass request to another URL and after that to get the html 
responce
as a string and put it into php $variable?

best,



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus

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


[PHP] array

2003-06-12 Thread Diana Castillo
If I write a code like this,
$room_type=array();
$room_type[0][0]=4;
echo BRvalue in array is .$room_type[0][0];
yet I dont get any results out, what did i do wrong?



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



Re: [PHP] Vars inside an sql query [Regular expression question]- Again

2003-06-12 Thread Marek Kilimajer
Now I noticed you did not escape backslash that was supposed to escape 
the dolar sign.

preg_match_all(/^.*('\\\$(.*)')/si, $fcontents,$matches);
  ^ ^
Hatem Ben wrote:
Well, it's finally working, but still very confusing ... thanks all

?php

$fcontents = join('' , file('query.txt'));

preg_match_all('/(\'\$(.*)\')/si', $fcontents,$matches);

print_r($matches)

?

Regards,
Hatem
- Original Message -
From: Hatem Ben [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: Marek Kilimajer [EMAIL PROTECTED]
Sent: Thursday, June 12, 2003 4:35 PM
Subject: Re: [PHP] Vars inside an sql query [Regular expression question] -
Again


It's not working also

- Original Message -
From: Marek Kilimajer [EMAIL PROTECTED]
To: Hatem Ben [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, June 12, 2003 5:23 PM
Subject: Re: [PHP] Vars inside an sql query [Regular expression
question] -

Again



preg_match_all(/^('\$(.*)')/si, $fcontents,$matches);
 ^^
you don't allow any character between start of the string and single
quote.

preg_match_all(/^.*('\$(.*)')/si, $fcontents,$matches);

Hatem Ben wrote:

I'm asking again the same question, coz i guess my question wasn't
clear.

i just need to retreive vars inside query.txt, my regular expression
seems to be correct for me, but i don't find why it doesn't wrk

-- Starting query.txt
select * FROM `table` where id='$value' order by name
-- Ending query.txt
-- Starting parse.php
?php
$fcontents = join('' , file('query.txt'));
preg_match_all(/^('\$(.*)')/si, $fcontents,$matches);
print_r($matches)
?
- Ending parse.php
rewriting query is another question, that i agree also.

Thanks
Hatem


--
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: array

2003-06-12 Thread R'twick Niceorgaw
Your code works fine here (Apache 1.3.27/PHP 4.3.2)
However you can try

 $room_type=array();
$room_type[0]=Array();
 $room_type[0][0]=4;
 echo BRvalue in array is .$room_type[0][0];

HTH
R'twick
Diana Castillo [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 If I write a code like this,
 $room_type=array();
 $room_type[0][0]=4;
 echo BRvalue in array is .$room_type[0][0];
 yet I dont get any results out, what did i do wrong?





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



Re: [PHP] array

2003-06-12 Thread Philip Olson
On Thu, 12 Jun 2003, Diana Castillo wrote:

 If I write a code like this,
 $room_type=array();
 $room_type[0][0]=4;
 echo BRvalue in array is .$room_type[0][0];
 yet I dont get any results out, what did i do wrong?

Nothing wrong with this code, it will work.  Your
error must be somewhere else.

var_dump($room_type);

Regards,
Philip


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



Re: [PHP] array

2003-06-12 Thread Leif K-Brooks
Nothing as far as I can tell.  It works fine for me.

Diana Castillo wrote:

If I write a code like this,
$room_type=array();
$room_type[0][0]=4;
echo BRvalue in array is .$room_type[0][0];
yet I dont get any results out, what did i do wrong?


 

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


Re: [PHP] array

2003-06-12 Thread Diana Castillo
you ´re right, I had used the same variable name as something else in
between ! thanks.
- Original Message -
From: Leif K-Brooks [EMAIL PROTECTED]
To: Diana Castillo [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, June 12, 2003 5:58 PM
Subject: Re: [PHP] array


 Nothing as far as I can tell.  It works fine for me.

 Diana Castillo wrote:

 If I write a code like this,
 $room_type=array();
 $room_type[0][0]=4;
 echo BRvalue in array is .$room_type[0][0];
 yet I dont get any results out, what did i do wrong?
 
 
 
 
 

 --
 The above message is encrypted with double rot13 encoding.  Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.





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



RE: [PHP] Headers in body - what am I doing wrong???

2003-06-12 Thread -{ Rene Brehmer }-
At 22:31 11-06-2003, Jennifer Goodie wrote:
// pull fields from form query
$to = [EMAIL PROTECTED];
$name = $HTTP_POST_VARS['name'];
$address = $HTTP_POST_VARS['address'];
$listname = $HTTP_POST_VARS['listname'];
$action = strtoupper($HTTP_POST_VARS['action']);

// build headers
$from = \$name\ $address\r\n;
$message = $action. .$listname. .$name.\r\n;
$message .= EXIT\r\n;

$headers = MIME-Version: 1.0\r\n;
$headers .= Content-type: text/plain; charset=iso-8859-1\r\n;
$headers .= From: .$from.\r\n;
$headers .= Reply-to: .$from.\r\n;
You have an extra \r\n.  There is one contained in the variable $from so the
line $headers .= From: .$from.\r\n; is putting \r\n\r\n which signifies
the end of the headers and the begining of the message body.
Stupid me ... so simple, of course ... thanks ... first thing to go is the 
eyes...

Rene

--
Rene Brehmer
aka Metalbunny
http://metalbunny.net/
References, tools, and other useful stuff...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] uploading files after passing vars between forms

2003-06-12 Thread Artoo
Hey

I'm confused!

Do I use move_uploaded_file() or copy() and what is the first parameter of
both in the following case:

form portion of upload.htm
-- 
FORM NAME=Uploading ENCTYPE=multipart/form-data
ACTION=confirmation.php METHOD=POST onSubmit=return validate() 
input name=superdat type=file size=30
INPUT TYPE=hidden name=MAX_SIZE value=10
INPUT TYPE=hidden name=filepath
input type=submit name=submit value=Click here for preview
/FORM

Upload.htm asks for the image to be uploaded and passes of to
confirmation.php which allows the user to either send the photo or go back
and change the photo. and uses hidden values to pass the variables form
upload.htm

form prortion of confirmation.php
 
form action=send_file.php method=post enctype=multipart/form-data
? print img src=\$filepath\ width=\100\ hight=\80\;?/div
p align=center
input type=submit NAME=send_photo value=Send to server!   input
type=button name=edit value=Chage the photo onClick=history.go(-1)
input type=hidden name=superdat value=?php echo $superdat; ?
input type=hidden name=temp_name value=?php echo
$_FILES['superdat']['tmp_name']; ?
input type=hidden name=file_name value=?php echo
$_FILES['superdat']['name']; ?
input type=hidden name=file_size value=?php echo
$_FILES['superdat']['size']; ?
input type=hidden name=MAX_SIZE value=10
/form
input type=hidden name=temp_name value=?php echo
$_FILES['superdat']['tmp_name']; ?
input type=hidden name=file_name value=?php echo
$_FILES['superdat']['name']; ?
input type=hidden name=file_size value=?php echo
$_FILES['superdat']['size']; ?
input type=hidden name=MAX_SIZE value=10
/form

Then send_file.php first cheks to see if the user had pressed the send to
server button. I still have to work on the Change the photo button.

If send to server was pressed, 'send_file.php' first checks to see if that
file already exists on the server. If it does it displays a message to the
user. If it does not exist, the file is copied onto the server.

send_file.php


  PHP:

--

  ? $path=/usr/local/home/website1/httpdocs;
  $file_path = $path./images/.$file_name;
  if($_POST['send_photo'])
  {
  if (file_exists($file_path))
 {
  ? /divh1strong? echo $file_name; ?, already
exists./strong/h1h2
? exit();
}
if ( copy($file_name, $file_path) )
   {
   ?h1P/PThank you for ? echo $file_name; ?. Your uload has
succesfully uploaded./h1?
   }
   else
   {
  print ERROR;
 exit();
   }
  }


--



I get  Warning: Unable to open '' for reading: No such file or
directory...

I did have print statements for each of the vars being passed into
send_file.php to make sure they were seen. And they were.

What fucntion should I use the move_uploaded_file() or copy() and what's the
function's first argument so that the file is copied to the server?

Thanks



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



Re: [PHP] Headers in body - what am I doing wrong???

2003-06-12 Thread -{ Rene Brehmer }-
It's not future when I send them ... my clock's within the 15 second limit 
my NTP sync allows... but maybe the time difference causes ezmlm to do some 
dancing when sending it out ?? I know listserv based lists can get confused 
about the time differences...

but thanks anyway ;-)

Rene

At 22:50 11-06-2003, Chris Hayes wrote:
(darn, this one was already answered, i hate it that some people ask 
questions with a future time.)
--
Rene Brehmer
aka Metalbunny
http://metalbunny.net/
References, tools, and other useful stuff...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] uploading files after passing vars between forms

2003-06-12 Thread Marek Kilimajer
Don't forget uploaded files are removed after confirmation.php finishes. 
You need to move them to a temporary directory.

Artoo wrote:
Hey

I'm confused!

Do I use move_uploaded_file() or copy() and what is the first parameter of
both in the following case:
form portion of upload.htm
-- 
FORM NAME=Uploading ENCTYPE=multipart/form-data
ACTION=confirmation.php METHOD=POST onSubmit=return validate() 
input name=superdat type=file size=30
INPUT TYPE=hidden name=MAX_SIZE value=10
INPUT TYPE=hidden name=filepath
input type=submit name=submit value=Click here for preview
/FORM

Upload.htm asks for the image to be uploaded and passes of to
confirmation.php which allows the user to either send the photo or go back
and change the photo. and uses hidden values to pass the variables form
upload.htm
form prortion of confirmation.php
 
form action=send_file.php method=post enctype=multipart/form-data
? print img src=\$filepath\ width=\100\ hight=\80\;?/div
p align=center
input type=submit NAME=send_photo value=Send to server!   input
type=button name=edit value=Chage the photo onClick=history.go(-1)
input type=hidden name=superdat value=?php echo $superdat; ?
input type=hidden name=temp_name value=?php echo
$_FILES['superdat']['tmp_name']; ?
input type=hidden name=file_name value=?php echo
$_FILES['superdat']['name']; ?
input type=hidden name=file_size value=?php echo
$_FILES['superdat']['size']; ?
input type=hidden name=MAX_SIZE value=10
/form
input type=hidden name=temp_name value=?php echo
$_FILES['superdat']['tmp_name']; ?
input type=hidden name=file_name value=?php echo
$_FILES['superdat']['name']; ?
input type=hidden name=file_size value=?php echo
$_FILES['superdat']['size']; ?
input type=hidden name=MAX_SIZE value=10
/form

Then send_file.php first cheks to see if the user had pressed the send to
server button. I still have to work on the Change the photo button.
If send to server was pressed, 'send_file.php' first checks to see if that
file already exists on the server. If it does it displays a message to the
user. If it does not exist, the file is copied onto the server.
send_file.php

  PHP:

--
  ? $path=/usr/local/home/website1/httpdocs;
  $file_path = $path./images/.$file_name;
  if($_POST['send_photo'])
  {
  if (file_exists($file_path))
 {
  ? /divh1strong? echo $file_name; ?, already
exists./strong/h1h2
? exit();
}
if ( copy($file_name, $file_path) )
   {
   ?h1P/PThank you for ? echo $file_name; ?. Your uload has
succesfully uploaded./h1?
   }
   else
   {
  print ERROR;
 exit();
   }
  }

--


I get  Warning: Unable to open '' for reading: No such file or
directory...
I did have print statements for each of the vars being passed into
send_file.php to make sure they were seen. And they were.
What fucntion should I use the move_uploaded_file() or copy() and what's the
function's first argument so that the file is copied to the server?
Thanks





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


Re: [PHP] 4 hours staring - can't see clear.

2003-06-12 Thread John Taylor-Johnston
Lars, Much thanks. Life saving :)
Ignatius, I like your idea. Thanks to you too.
John


 if (isset($var[$key]['Option']))
 {
 // Flag that we got one this time round.
 $found = true;
 // Get the translated name from $var.
 $record[$var[$key]['Option']] = addslashes(trim($val));
 }

 $sep = '';
 $sql = insert into .values (;
 foreach ($record as $name=$val)
 {
 $sql .= $sep . ' . addslashes($val) . ';
 $sep = ',';
 }
 $sql .= ')';


Fw: [PHP] uploading files after passing vars between forms

2003-06-12 Thread Kevin Stone

- Original Message -
From: Artoo [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, June 12, 2003 10:16 AM
Subject: [PHP] uploading files after passing vars between forms


 Hey

 I'm confused!

 Do I use move_uploaded_file() or copy() and what is the first parameter of
 both in the following case:

... SNIP...
 I get  Warning: Unable to open '' for reading: No such file or
 directory...

 I did have print statements for each of the vars being passed into
 send_file.php to make sure they were seen. And they were.

 What fucntion should I use the move_uploaded_file() or copy() and what's
the
 function's first argument so that the file is copied to the server?

 Thanks

Hi,

Your problem isn't your code, it's your method.  The temp file is
automatically deleted after confirmation.php dies.  Therefore by the time
you send the tmp_name through to the send_file.php it no longer exists.
What you're going to have to do is copy() the tmp file to a permenant
location within confirmation.php.  And then post that information to
send_file.php with an added subroutine to delete the file if the user goes
back to change some info.

Confirmations are normally only used durring descructive actions so you may
consider ditching the confirmation screen all together.

HTH,
Kevin



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



Re: [PHP] uploading files after passing vars between forms

2003-06-12 Thread Artoo
I didn't know that  Thanks for the info.


Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Don't forget uploaded files are removed after confirmation.php finishes.
 You need to move them to a temporary directory.

 Artoo wrote:
  Hey
 
  I'm confused!
 
  Do I use move_uploaded_file() or copy() and what is the first parameter
of
  both in the following case:
 
  form portion of upload.htm
  -- 
  FORM NAME=Uploading ENCTYPE=multipart/form-data
  ACTION=confirmation.php METHOD=POST onSubmit=return validate() 
  input name=superdat type=file size=30
  INPUT TYPE=hidden name=MAX_SIZE value=10
  INPUT TYPE=hidden name=filepath
  input type=submit name=submit value=Click here for preview
  /FORM
 
  Upload.htm asks for the image to be uploaded and passes of to
  confirmation.php which allows the user to either send the photo or go
back
  and change the photo. and uses hidden values to pass the variables form
  upload.htm
 
  form prortion of confirmation.php
   
  form action=send_file.php method=post
enctype=multipart/form-data
  ? print img src=\$filepath\ width=\100\ hight=\80\;?/div
  p align=center
  input type=submit NAME=send_photo value=Send to server!   input
  type=button name=edit value=Chage the photo
onClick=history.go(-1)
  input type=hidden name=superdat value=?php echo $superdat; ?
  input type=hidden name=temp_name value=?php echo
  $_FILES['superdat']['tmp_name']; ?
  input type=hidden name=file_name value=?php echo
  $_FILES['superdat']['name']; ?
  input type=hidden name=file_size value=?php echo
  $_FILES['superdat']['size']; ?
  input type=hidden name=MAX_SIZE value=10
  /form
  input type=hidden name=temp_name value=?php echo
  $_FILES['superdat']['tmp_name']; ?
  input type=hidden name=file_name value=?php echo
  $_FILES['superdat']['name']; ?
  input type=hidden name=file_size value=?php echo
  $_FILES['superdat']['size']; ?
  input type=hidden name=MAX_SIZE value=10
  /form
 
  Then send_file.php first cheks to see if the user had pressed the send
to
  server button. I still have to work on the Change the photo button.
 
  If send to server was pressed, 'send_file.php' first checks to see if
that
  file already exists on the server. If it does it displays a message to
the
  user. If it does not exist, the file is copied onto the server.
 
  send_file.php
 
 
PHP:

 --
--
  --
 
? $path=/usr/local/home/website1/httpdocs;
$file_path = $path./images/.$file_name;
if($_POST['send_photo'])
{
if (file_exists($file_path))
   {
? /divh1strong? echo $file_name; ?, already
  exists./strong/h1h2
  ? exit();
  }
  if ( copy($file_name, $file_path) )
 {
 ?h1P/PThank you for ? echo $file_name; ?. Your uload has
  succesfully uploaded./h1?
 }
 else
 {
print ERROR;
   exit();
 }
}
 

 --
--
  --
 
 
 
  I get  Warning: Unable to open '' for reading: No such file or
  directory...
 
  I did have print statements for each of the vars being passed into
  send_file.php to make sure they were seen. And they were.
 
  What fucntion should I use the move_uploaded_file() or copy() and what's
the
  function's first argument so that the file is copied to the server?
 
  Thanks
 
 
 




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



[PHP] Re: General question...

2003-06-12 Thread Bobby Patel
You can try using the cURL package with PHP. I use it with a system call.

$curl_path = /usr/bin/curl; # or full path of curl

$post = 'amount=3.40merchant_id=2351235'; #POST  key value pairs with ,
these variables will be POSTed to site

$command = $curl_path -d \$post\ $gateway_url;

exec($command, $responce);

the $responce variable holds any out put from the site.

Then you  will have to parse the HTML (which I hate).

The above technique is best for when the site you call post back variables
(thus no parsing).

Now, this is with PHP with no cURL package, if you have it installed than
maybe you can use the cURL Library to do the above.

Valentin [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 hi all,

 is it possible with php:
 first to pass request to another URL and after that to get the html
responce
 as a string and put it into php $variable?

 best,





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



Re: [PHP] Re: mail() function exchange

2003-06-12 Thread Diana
I totally agree with your first sentence *grin*.
Anyways, I won`t be able to use your class because my
server is kind of locked in their network, meaning I
don`t have the possibility to connect outside, only to
their servers (NT servers). And as Exchange servers
don`t use SMTP (meaning the whole protocol is NOT
used, so your classes won`t help me), I`m not able to
send mails at all. Only like he offered me to put an
extra box in the network which will relay the mails
from my linux server. 
Does anyone know about the way exchange servers work,
mapi and mapisend? The only thing I found was how to
program that in VB (and being able to talk to Exchange
servers), but it seems like this is not possible for
my penguin :) (VB on Linux??? sounds stupid)
I found in old archives of this mailinglist that some
people asked this question before (how to implement a
mail function for exchange servers in php) but no one
knew it. One hint was to use ldap. anyone any idea
about this? ANY help is appreciated, I will follow the
threads started about ldap but right now it does not
look like it has a lot to do with the mail stuff. 

Another hint might be the COM interface (I saw VB code
they used this) but php offers only very few things on
this and as I have no idea of microsofts concepts that
doesn`t help :(

Please email me for suggestions!!! Wold be great to
implement something new in php ;). If anyone knows
documents about how outlook  exchange work I would
like to see them! Thanks :)
Diana 



 --- Manuel Lemos [EMAIL PROTECTED] schrieb:  Hello,
 
 On 06/11/2003 05:38 PM, Diana wrote:
  Hi, 
  just today I stumbled into the same problem. It is
  true, I got this answer from an expert:
 
  Unfortunately this will not work.  SMTP relaying
 is
  disabled on all the
  Exchange connector servers and a standard Exchange
  mailbox server does 
  not
  support SMTP.  The only way that you can send SMTP
  email from within 
  our company is to use the Internal MailSweeper. 
 And
  to allow this we need 
  the IP
  Address of the box that will be sending the
 messages
  so that we can 
  include
  it in the authenticated list.  We have to have
 things
  set up this way 
  for
  Security reasons.
  
  One other thing I should have mentioned.  Outlook
 uses
  mapi to send on 
  the
  Exchange servers.  So we can use the mapisend
 command
  but I do not know 
  if
  your application would support this.  I think that
  this may also need a
  valid Outlook profile to work.
  
  
  I don`t understand that either, because I am
 trying to
  use my Linux server (inside my companys network)
 to
  deliver mails to the exchange server via sendmail.
 
  If anyone knows more about this topic, let me
  know.sorry that this obviously does not belong
 to
  a php list, but I deleted the original email 
 could
  not find the email address of the author of this
 topic
  :(
 
 I wonder about his expertise. Authentication was
 meant for security reasons.
 
 Anyway, you do no not need to relay in the company
 SMTP server unless 
 outside access is blocked in some firewall.
 
 If you are using Linux, you just need to use the
 mail() function because 
 it just uses sendmail by default.
 
 If you still have problems, just use the classes
 that I mentioned 
 enabling direct delivery mode in the SMTP sending
 attributes. That does 
 the same as sendmail but at least if it fails you
 can enable debugging 
 to see what the SMTP protocol dialog reveals.
 
 
 
   --- Manuel Lemos [EMAIL PROTECTED] schrieb: 
 Hello,
  
 On 06/10/2003 04:44 PM, Matthias Wulkow wrote:
 
 a friend of mine is trying to set up an automated
 
 mailing function.
 
 The platform is Windows  he's using the last PHP
 
 release at this
 
 time.
 He asks me how to do it with Exchange, because it
 
 doesn't speak SMTP
 
 or not correctly? What is the matter? Is that
 
 true? But that's not
 
 really the question... could somebody point me to
 
 some documents where
 
 I could find out, what has to be done to make it
 
 work?
 
 I do not see what he means by not speaking SMTP
 correctly. Anyway, if it 
 receives e-mail that you get, it also can relay
 messages that you send. 
 I think in the worst case you need to
 authenticate.
 
 In that case you may want to try this class for
 composing and sending 
 messages. It comes with a sub class for sending
 messages via SMTP that 
 supports authentication.
 
 http://www.phpclasses.org/mimemessage
 
 You also need this class for the actual message
 delivery:
 
 http://www.phpclasses.org/smtpclass


__

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Logos und Klingeltöne fürs Handy bei http://sms.yahoo.de

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



Re: [PHP] Re: mail() function exchange

2003-06-12 Thread Mark

--- Diana [EMAIL PROTECTED] wrote:
 I totally agree with your first sentence *grin*.
 Anyways, I won`t be able to use your class because my
 server is kind of locked in their network, meaning I
 don`t have the possibility to connect outside, only to
 their servers (NT servers). And as Exchange servers
 don`t use SMTP (meaning the whole protocol is NOT
 used, so your classes won`t help me), I`m not able to
 send mails at all. Only like he offered me to put an
 extra box in the network which will relay the mails
 from my linux server. 
 Does anyone know about the way exchange servers work,
 mapi and mapisend? The only thing I found was how to
 program that in VB (and being able to talk to Exchange
 servers), but it seems like this is not possible for
 my penguin :) (VB on Linux??? sounds stupid)
 I found in old archives of this mailinglist that some
 people asked this question before (how to implement a
 mail function for exchange servers in php) but no one
 knew it. One hint was to use ldap. anyone any idea
 about this? ANY help is appreciated, I will follow the
 threads started about ldap but right now it does not
 look like it has a lot to do with the mail stuff. 
 
 Another hint might be the COM interface (I saw VB code
 they used this) but php offers only very few things on
 this and as I have no idea of microsofts concepts that
 doesn`t help :(
 
 Please email me for suggestions!!! Wold be great to
 implement something new in php ;). If anyone knows
 documents about how outlook  exchange work I would
 like to see them! Thanks :)
 Diana 

I can't comment on how your company's Exchange servers are
configured, but they absolutely *can* talk SMTP. We are using a
web-based application that sends email notifications through our
internal Exchange servers.

Now, they can be set up with SMTP turned off, or so that only certain
other hosts can relay through them (send mail), and that might be
what he's talking about when he says the authenticated list. I
believe it's simply a list of hosts that are allowed to relay through
the Exchange SMTP server.

You'd be fine using SMTP on a connector server. It will relay the
mail to the appropriate mailbox server (assuming they've separate the
functions). 

Out of curiosity, why not give them the IP address and let them add
the host to the authenticated sender list, as he offered? Or did I
miss a part of the converation (very possible).


 
 
 
  --- Manuel Lemos [EMAIL PROTECTED] schrieb:  Hello,
  
  On 06/11/2003 05:38 PM, Diana wrote:
   Hi, 
   just today I stumbled into the same problem. It is
   true, I got this answer from an expert:
  
   Unfortunately this will not work.  SMTP relaying
  is
   disabled on all the
   Exchange connector servers and a standard Exchange
   mailbox server does 
   not
   support SMTP.  The only way that you can send SMTP
   email from within 
   our company is to use the Internal MailSweeper. 
  And
   to allow this we need 
   the IP
   Address of the box that will be sending the
  messages
   so that we can 
   include
   it in the authenticated list.  We have to have
  things
   set up this way 
   for
   Security reasons.
   
   One other thing I should have mentioned.  Outlook
  uses
   mapi to send on 
   the
   Exchange servers.  So we can use the mapisend
  command
   but I do not know 
   if
   your application would support this.  I think that
   this may also need a
   valid Outlook profile to work.
   
   
   I don`t understand that either, because I am
  trying to
   use my Linux server (inside my companys network)
  to
   deliver mails to the exchange server via sendmail.
  
   If anyone knows more about this topic, let me
   know.sorry that this obviously does not belong
  to
   a php list, but I deleted the original email 
  could
   not find the email address of the author of this
  topic
   :(
  
  I wonder about his expertise. Authentication was
  meant for security reasons.
  
  Anyway, you do no not need to relay in the company
  SMTP server unless 
  outside access is blocked in some firewall.
  
  If you are using Linux, you just need to use the
  mail() function because 
  it just uses sendmail by default.
  
  If you still have problems, just use the classes
  that I mentioned 
  enabling direct delivery mode in the SMTP sending
  attributes. That does 
  the same as sendmail but at least if it fails you
  can enable debugging 
  to see what the SMTP protocol dialog reveals.
  
  
  
--- Manuel Lemos [EMAIL PROTECTED] schrieb: 
  Hello,
   
  On 06/10/2003 04:44 PM, Matthias Wulkow wrote:
  
  a friend of mine is trying to set up an automated
  
  mailing function.
  
  The platform is Windows  he's using the last PHP
  
  release at this
  
  time.
  He asks me how to do it with Exchange, because it
  
  doesn't speak SMTP
  
  or not correctly? What is the matter? Is that
  
  true? But that's not
  
  really the question... could somebody point me to
  
  some documents where
  
  I could find 

Re: [PHP] How to find if a string is an integer?

2003-06-12 Thread Felipe Desiderati
 Felipe Desiderati wrote:
  try this:
 
  if (ereg(^[0-9]+$, $_POST[var_int))
  echo is int;

 That's not the best regexp. It doesn' take into account negative
 integers and isn't there a [[:numeric:]] or something like regexp that
 would work better.

 I'm looking for the simplest method and the one that takes the less
 processing power :)

 Calling up the regular expression engine dounds pretty processing
 intensive ...

Sorry, I don´t know that you needed an effective snipet. And you are right,
I only writed for positive integers. Try something like apply 2 type cast
simunltaneous.

if ( (string) ((int) $_POST[var_int]) == $_POST[var_int])
echo is int;

And sorry for my english,

[]´s Felipe


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



Re: [PHP] Re: How to format a strign with a generic mask??

2003-06-12 Thread Felipe Desiderati
Thanks, helps a lot!!

[]´s Felipe

 Felipe Desiderati [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 I need a simple function that takes a string and formats
  with a generic mask. Like this example above:
 
 $string1 = 12345678
 $string2 = 11062003
 
 echo format_string (#.###.###-#, $string1);  // -- Returns 1.234.567-8
 echo format_string (##/##/, $string1);  // -- Returns 11/06/2003
 
 Does anybody here have an idea to how to do this?


 Here is a function that does what you want, with
 a test stand.  HTH!


 ?php

 function format_string($mask, $contents, $ch = '#') {

 $c = 0;
 $str = ;

 for($m = 0; $m  strlen($mask); $m++)
 if ($mask[$m] == $ch) {
 $str .= $contents[$c];
 $c++;
 }
 else
 $str .= $mask[$m];

 return($str);
 }

 ?
 html
 body
 form action=mask.php method=get
 Mask: input type=text name=mask value=?php echo
 $_GET['mask']; ?/br/
 Content: input type=text name=cont value=?php echo
 $_GET['cont']; ?/br/
 Maskchar: input type=text name=ch value=?php echo
 $_GET['ch']; ?/br/
 input type=submit
 /form


 bResult:/b ?php echo format_string($_GET['mask'], $_GET['cont'],
 $_GET['ch']); ?br/
 /body
 /html

 --
 Hugh Bothwell [EMAIL PROTECTED] Kingston ON Canada
 v3.1 GCS/E/AT d- s+: a- C+++ L+$ P+ E- W+++$ N++ K? w++ M PS+
 PE++ Y+ PGP+ t-- 5++ !X R+ tv b DI+++ D-(++) G+ e(++) h-- r- y+




 --
 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] w32api functions?

2003-06-12 Thread DvDmanDT
Hello everyone... I was wondering why the w32api functions were removed? And
will they come back? Else, will the 4.2.3 version work with 4.3.2? I really
want those functions for educational purposes you see...

Thanks in advance // DvDmanDT



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



Re: [PHP] Re: mail() function exchange

2003-06-12 Thread Diana
Hi,
my company set their server up not to talk SMTP
(disabled all -- that guy told me), and my tries to
connect or talk to any of their Exchange servers
failed :( so he must be true. Got onto their NT
servers though ;)
All the company uses Outlook  Exchange,  they use
mapi to talk to each other. If a manager can`t be in
the network, he`s connected via VPN  uses Outlook as
well. They`ve got a trust relationship between their
NT servers  the Exchange ones,  lots of domains
joined. 
As I said, I don`t have a clue of Exchange so correct
me if something sounds strange. 
To your suggestions: of course that would be easy for
me to tell them to set up a new box for me. They`ll do
that. But who likes the easy way ;)?
No, just my curiosity, maybe someone knows how the
protocol or whatever these M$ servers use is working 
I could try to implement that. Would make my project
more portable inside the company (They plan to use it
on other sites as well), so they wouldn`t have
problems with setting up separate Internal
Mailsweepers everytime :).

Can you tellme more about :
 You'd be fine using SMTP on a connector server. It
 will relay the
 mail to the appropriate mailbox server 
is that working even if SMTP is not enabled? The guy
told me that SMTP is not enabled by default on
Exchange servers and they didn`t change that! (that`s
the reason for me to ask how that system works in the
wholehow does outlook send the mail to the
exchange server? Could it be that all the users just
access something like a directory on the exchange
server when starting their outlook (not a local
program!  not working when the exchange server
crashed ;)). Maybe that`s the LDAP part? 
Anyone enlighten me please..

by the way, a lot of people ask these questions
see here

http://www.phpbuilder.com/mail/php3-list/199908/0344.php

http://www.linuxsa.org.au/mailing-list/2000-07/954.html

http://www.faqts.com/knowledge_base/view.phtml/aid/13043/fid/21


 
 I can't comment on how your company's Exchange
 servers are
 configured, but they absolutely *can* talk SMTP. We
 are using a
 web-based application that sends email notifications
 through our
 internal Exchange servers.
 
 Now, they can be set up with SMTP turned off, or so
 that only certain
 other hosts can relay through them (send mail), and
 that might be
 what he's talking about when he says the
 authenticated list. I
 believe it's simply a list of hosts that are allowed
 to relay through
 the Exchange SMTP server.
 
 You'd be fine using SMTP on a connector server. It
 will relay the
 mail to the appropriate mailbox server (assuming
 they've separate the
 functions). 
 
 Out of curiosity, why not give them the IP address
 and let them add
 the host to the authenticated sender list, as he
 offered? Or did I
 miss a part of the converation (very possible).
 
 
  


__

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Logos und Klingeltöne fürs Handy bei http://sms.yahoo.de

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



Re: [PHP] How to find if a string is an integer?

2003-06-12 Thread Alex Earl
snip
 Sorry, I don´t know that you needed an effective snipet. And you are
 right,
 I only writed for positive integers. Try something like apply 2 type cast
 simunltaneous.

 if ( (string) ((int) $_POST[var_int]) == $_POST[var_int])
 echo is int;



Why not just use the is_int() function?

www.php.net/is_int


Alex

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



RE: [PHP] w32api functions?

2003-06-12 Thread Roedel, Mark

Removed?

$PHPDIR/ext/w32api still seems to exist in the 4.3.2 I just installed.
Did you compile your own, or download a prebuilt binary?


---
Mark Roedel   | Blessed is he who has learned to laugh
Systems Programmer|  at himself, for he shall never cease
LeTourneau University |  to be entertained.
Longview, Texas, USA  |  -- John Powell


 -Original Message-
 From: DvDmanDT [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, June 12, 2003 1:31 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] w32api functions?
 
 
 Hello everyone... I was wondering why the w32api functions 
 were removed? And will they come back? Else, will the 4.2.3
 version work with 4.3.2? I really want those functions for
 educational purposes you see...
 
 Thanks in advance // DvDmanDT

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



Re: [PHP] w32api functions?

2003-06-12 Thread DvDmanDT
Prebuilt.. Compiling myself is to complicated... But check the manual...
4.2.0-4.2.3 is the only versions suporting it it says...
Mark Roedel [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]

Removed?

$PHPDIR/ext/w32api still seems to exist in the 4.3.2 I just installed.
Did you compile your own, or download a prebuilt binary?


---
Mark Roedel   | Blessed is he who has learned to laugh
Systems Programmer|  at himself, for he shall never cease
LeTourneau University |  to be entertained.
Longview, Texas, USA  |  -- John Powell


 -Original Message-
 From: DvDmanDT [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 12, 2003 1:31 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] w32api functions?


 Hello everyone... I was wondering why the w32api functions
 were removed? And will they come back? Else, will the 4.2.3
 version work with 4.3.2? I really want those functions for
 educational purposes you see...

 Thanks in advance // DvDmanDT



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



Re: [PHP] How to find if a string is an integer?

2003-06-12 Thread CPT John W. Holmes
 snip
  Sorry, I don´t know that you needed an effective snipet. And you are
  right,
  I only writed for positive integers. Try something like apply 2 type
cast
  simunltaneous.
 
  if ( (string) ((int) $_POST[var_int]) == $_POST[var_int])
  echo is int;
 


 Why not just use the is_int() function?

 www.php.net/is_int

Please try to use is_int() on a value passed from a form and see why.

Also, in the beginning of this thread, the OP already said that is_int() had
been tried.

---John Holmes...


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



Re: [PHP] How to find if a string is an integer?

2003-06-12 Thread Alex Earl
 snip
  Sorry, I don´t know that you needed an effective snipet. And you are
  right,
  I only writed for positive integers. Try something like apply 2 type
 cast
  simunltaneous.
 
  if ( (string) ((int) $_POST[var_int]) == $_POST[var_int])
  echo is int;
 


 Why not just use the is_int() function?

 www.php.net/is_int

 Please try to use is_int() on a value passed from a form and see why.

 Also, in the beginning of this thread, the OP already said that is_int()
 had
 been tried.

 ---John Holmes...


I guess I missed the first part of the thread then.

Thanks for the info.

Alex



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



Re: [PHP] How to find if a string is an integer?

2003-06-12 Thread DvDmanDT
To be honest, I haven't really understood what three of them does... Is it
the same value without type casting?
Jean-Christian Imbeault [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
 Dvdmandt wrote:
  It's not that killing... :p
  preg_match(#^-?[0-9]+$#,$_POST[var_int]);

 Not *that's* a mouthful ...

  I was also thinking about that === operator.. And this:
  if(((string)((int)$_POST[var_int]))==$_POST[var_int])

 Cute. Might actually work too! Wonder if there would be any difference
 in using == or === in your suggestion?

 Jc




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



[PHP] 4.3.2 -- does connection_status() actually work?

2003-06-12 Thread Per Jessen
Shouldn't the following work - or rather why doesn't it :


ignore_user_abort(0);
 
for( $i=100; $i; $i-- )
{
if ( connection_status() ) exit(0);
print  blurp.br/; flush();
sleep(1);
}
print Done.br/;

This is php4.3.2 on apache 2.0.45. 


/Per

-- 
Per Jessen, Zurich
http://timian.jessen.ch - an analog report formatter using XSLT.
http://www.dansk.org - for alle danskere i udlandet!


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



Re: [PHP] w32api functions?

2003-06-12 Thread DvDmanDT
Just wanted to download sources... But that's kinda impossible... 404 on
every single mirror, both bz and gz...

Hmm... I guess I'll go for snaps then... :p Someone, please fix this...
Dvdmandt [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
 Prebuilt.. Compiling myself is to complicated... But check the manual...
 4.2.0-4.2.3 is the only versions suporting it it says...
 Mark Roedel [EMAIL PROTECTED] skrev i meddelandet
 news:[EMAIL PROTECTED]

 Removed?

 $PHPDIR/ext/w32api still seems to exist in the 4.3.2 I just installed.
 Did you compile your own, or download a prebuilt binary?


 ---
 Mark Roedel   | Blessed is he who has learned to laugh
 Systems Programmer|  at himself, for he shall never cease
 LeTourneau University |  to be entertained.
 Longview, Texas, USA  |  -- John Powell


  -Original Message-
  From: DvDmanDT [mailto:[EMAIL PROTECTED]
  Sent: Thursday, June 12, 2003 1:31 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] w32api functions?
 
 
  Hello everyone... I was wondering why the w32api functions
  were removed? And will they come back? Else, will the 4.2.3
  version work with 4.3.2? I really want those functions for
  educational purposes you see...
 
  Thanks in advance // DvDmanDT





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



Re: [PHP] How to find if a string is an integer?

2003-06-12 Thread Jason Wong
On Friday 13 June 2003 03:49, DvDmanDT wrote:
 To be honest, I haven't really understood what three of them does... Is it
 the same value without type casting?

It takes into account the variable type as well:

  (1 == '1')  // true
  (1 === '1') // false

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
All is well that ends well.
-- John Heywood
*/


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



Re: [PHP] How to find if a string is an integer?

2003-06-12 Thread Brent Baisley
Jumping in a little late here, but what about is_numeric()?
Haven't tried it, but the php manual for is_int says:
Note:  To test if a variable is a number or a numeric string (such as 
form input, which is always a string), you must use is_numeric().

On Thursday, June 12, 2003, at 03:31 PM, CPT John W. Holmes wrote:

Please try to use is_int() on a value passed from a form and see why.

Also, in the beginning of this thread, the OP already said that 
is_int() had
been tried.

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How to find if a string is an integer?

2003-06-12 Thread Alex Earl
 Jumping in a little late here, but what about is_numeric()?
 Haven't tried it, but the php manual for is_int says:
 Note:  To test if a variable is a number or a numeric string (such as
 form input, which is always a string), you must use is_numeric().


The problem with is_numeric() is that something like 4e4 comes up as
true, because it could be construed as a HEX value.

Alex

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



[PHP] Error display

2003-06-12 Thread John Nichel
I have error reporting set to E_ALL, but no matter what I do, no errors 
display.  Is there somewhere else in the .ini that I have to set something?

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


Re: [PHP] Error display

2003-06-12 Thread Alex Earl
 I have error reporting set to E_ALL, but no matter what I do, no errors
 display.  Is there somewhere else in the .ini that I have to set
 something?


I believe there is a print_errors or show_errors directive in the php.ini
file. Check on php.net for sure.

Alex

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



Re: [PHP] Error display

2003-06-12 Thread John Nichel
Belay this question.  Found it.

display_errors = On

John Nichel wrote:
I have error reporting set to E_ALL, but no matter what I do, no errors 
display.  Is there somewhere else in the .ini that I have to set something?




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


Re: [PHP] Error display

2003-06-12 Thread John Nichel
Alex Earl wrote:
I have error reporting set to E_ALL, but no matter what I do, no errors
display.  Is there somewhere else in the .ini that I have to set
something?


I believe there is a print_errors or show_errors directive in the php.ini
file. Check on php.net for sure.
Alex

Thanks guys.

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


[PHP] Vmailmgr Functions

2003-06-12 Thread John Nichel
On PHPBuilder.com, they have functions listed for Vmailmgr in their 
manual, whereas on PHP.net, no such functions exist.  Do these functions 
exist but not documented on PHP.net?

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


RE: [PHP] Headers in body - what am I doing wrong???

2003-06-12 Thread Jeff Harris
On Jun 12, 2003, -{ Rene Brehmer }- claimed that:

|You have an extra \r\n.  There is one contained in the variable $from so the
|line $headers .= From: .$from.\r\n; is putting \r\n\r\n which signifies
|the end of the headers and the begining of the message body.
|
|Stupid me ... so simple, of course ... thanks ... first thing to go is the
|eyes...
|
|Rene

Eyes are the THIRD thing to go. Second is memory. I can't remember the
first thing to go, though.

Jeff
-- 
Registered Linux user #304026.
lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import
Key fingerprint = 52FC 20BD 025A 8C13 5FC6  68C6 9CF9 46C2 B089 0FED
Responses to this message should conform to RFC 1855.



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



  1   2   >