Re: [PHP] simple math computation..

2004-10-04 Thread Matthew Fonda
Howdy.

It seems to work fine for me, perhaps you have a typo along the lines
some where.



echoes 800

-- 
Regards,
Matthew Fonda

On Sun, 2004-10-03 at 23:26, Louie Miranda wrote:
> the percent of 20% is = .20 right?
> how can i compute the correct value for this?
> 
> my $totalCost is $4,000 and when i compute it to .20 using this method..
> 
> $shippingestimate = $totalCost * .20;
> 
> i get the value for the shippingestimate = $0.8 which is wrong.. it should $800
> what seems to be wrong?
> 
> -- 
> Louie Miranda
> http://www.axishift.com

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



Re: [PHP] simple math computation..

2004-10-04 Thread Louie Miranda
i found the culprit. i remembered, that i use to pass the value with..

number_format($totalCost, 2, ".", ",")

so the values being received by my computation has a "," comma 4,000
so that is why i always get wrong values.

thanks again!


On Mon, 04 Oct 2004 00:02:32 -0700, Matthew Fonda <[EMAIL PROTECTED]> wrote:
> Howdy.
> 
> It seems to work fine for me, perhaps you have a typo along the lines
> some where.
> 
>  $totalCost = 4000;
> $shippingestimate = $totalCost * .20;
> echo $shippingestimate;
> ?>
> 
> echoes 800
> 
> --
> Regards,
> Matthew Fonda
> 
> 
> 
> On Sun, 2004-10-03 at 23:26, Louie Miranda wrote:
> > the percent of 20% is = .20 right?
> > how can i compute the correct value for this?
> >
> > my $totalCost is $4,000 and when i compute it to .20 using this method..
> >
> > $shippingestimate = $totalCost * .20;
> >
> > i get the value for the shippingestimate = $0.8 which is wrong.. it should $800
> > what seems to be wrong?
> >
> > --
> > Louie Miranda
> > http://www.axishift.com
> 
> 



-- 
Louie Miranda
http://www.axishift.com

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



Re: [PHP] Newbie needs help with MySQL and multiple databases

2004-10-04 Thread - Edwin -
Hi,
(B
(BOn Monday 04 October 2004 12:09, Matthew wrote:
(B> Hi, im fairly new to php and mysql and need a little help. im
(B> running a forum community and would like to have it run on
(B> multiple databases because of performance issues others have
(B> encountered using the same software on on database. My
(B> question is is it possible to have the software connect to 2
(B> different databases depending on which is needed?
(B
(BYes.
(B
(B> and if so 
(B> will users need to login again when accessing the second
(B> database (their user info will only be on the second
(B> database.)
(B
(BNo. As have been mentioned, this should be transparent. In other 
(Bwords, (in a sense) your *scripts* logs in to the database and 
(Bnot you nor your users :)
(B
(B> Thank You 
(B
(BHTH,
(B
(B-- 
(B- E - copperwalls was here ;)
(B
(B-- 
(BPHP General Mailing List (http://www.php.net/)
(BTo unsubscribe, visit: http://www.php.net/unsub.php

[PHP] different behaviour converting float to integer

2004-10-04 Thread Tomas Kuliavas

When php 5.0.2 converts float to integer, it uses biggest possible integer
value. Other php versions overflow and use negalive integers.

How to reproduce it:
echo (int)0xde120495;

Expected result (php 5.0.1, 4.3.9 and 4.1.2):

-569244523

Actual result (only php 5.0.2):
--
2147483647

Is this a standard behaviour of all future php versions or some error in php?

OS details: Linux Debian Sarge

PHP compilation details (vanilla php-5.0.2.tar.bz2):
./configure --disable-debug --with-apxs=/somepath/apache/bin/apxs
--prefix=/somepath/php
--with-config-file-path=/somepath/
--with-pcre-regex --enable-mbstring --enable-session --disable-all
--with-gettext=shared,/usr

php.ini details:
error_reporting=E_ALL
display_errors=on
register_globals=off
asp_tags=on
short_tags=off

Please CC to my email.
-- 
Tomas

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



[PHP] How do I know whether PHP is installed as CGI or Apache Module.

2004-10-04 Thread Mulley, Nikhil
Hi All,
 
Is there any way out finding ,How do the PHP is installed ,whether as Apache Module or 
CGI.
 
Thanks,
Nikhil.


Re: [PHP] Re: PHP (anti) crash policy?

2004-10-04 Thread Olaf van der Spek
David Bevan wrote:
On October 3, 2004 12:46, Olaf van der Spek wrote:
Manuel Lemos wrote:
Hello,
On 10/03/2004 12:27 PM, Olaf Van Der Spek wrote:
I think that making all failed memory allocations recoverable is not
viable because more PHP C code that makes memory allocations assumes
it only returns if it succeeds. Trying to change that everywhere
memory is allocated is and monster job that I doubt that any PHP core
developer will agree on doing.
You could just create a new function for that: alloc_no_exception
There's no need to change every call, you'd only need to change the
calls that can take a NULL result.
I find it hard to justify such function
Why?
I think a large number of data handling functions would benefit from
such a function.
And it'd make PHP more robust.

Olaf, PHP is an open source language is it not?  Since you're so smart why 
don't YOU write the code?
Because I don't have time to fix every bug (I encounter) in every open 
source app I use.
And I don't know the internals of the PHP code to be sure my patch works 
and doesn't break anything else.

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


[PHP] Re: different behaviour converting float to integer

2004-10-04 Thread M. Sokolewicz
You might want to ask this on the internals list (cc'd)
Tomas Kuliavas wrote:
When php 5.0.2 converts float to integer, it uses biggest possible integer
value. Other php versions overflow and use negalive integers.
How to reproduce it:
echo (int)0xde120495;
Expected result (php 5.0.1, 4.3.9 and 4.1.2):

-569244523
Actual result (only php 5.0.2):
--
2147483647
Is this a standard behaviour of all future php versions or some error in php?
OS details: Linux Debian Sarge
PHP compilation details (vanilla php-5.0.2.tar.bz2):
./configure --disable-debug --with-apxs=/somepath/apache/bin/apxs
--prefix=/somepath/php
--with-config-file-path=/somepath/
--with-pcre-regex --enable-mbstring --enable-session --disable-all
--with-gettext=shared,/usr
php.ini details:
error_reporting=E_ALL
display_errors=on
register_globals=off
asp_tags=on
short_tags=off
Please CC to my email.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: output a PDF, over header(). causes corruption on the file?

2004-10-04 Thread Daniel Schierbeck
Louie Miranda wrote:
Im trying to output a pdf over a browser so i can hide the url link to
it. but this one causes corruption.
Try this..
http://dev.axishift.com/php/getpdf.php
i got this part..
"Note: There is a bug in Microsoft Internet Explorer 4.01 that
prevents this from working. There is no workaround. There is also a
bug in Microsoft Internet Explorer 5.5 that interferes with this,
which can be resolved by upgrading to Service Pack 2 or later. "
but im using netscape, and it still has error.
here's the basic source for it..

// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');
// The PDF source is in original.pdf
readfile('original.pdf');
?> 

what other alternatives can you suggest? i need this asap! please help.
Are you sure that you don't have any whitespace before or after the PHP 
tags? Try using exit(); after readfile();

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


[PHP] Re: [PHP-DEV] Re: different behaviour converting float to integer

2004-10-04 Thread Derick Rethans
On Mon, 4 Oct 2004, M. Sokolewicz wrote:

> You might want to ask this on the internals list (cc'd)
>
> Tomas Kuliavas wrote:
> > When php 5.0.2 converts float to integer, it uses biggest possible integer
> > value. Other php versions overflow and use negalive integers.

There is already a bug report for it, no need to continue this
discussion.

Derick

-- 
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org

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



[PHP] Using php4 AND php5

2004-10-04 Thread Dobermann
Hi all,
I'd like to know how to install both php 4 and 5 on the same server, 
for example with .php4 and .php5 extensions.

I tried editing some part of the source code to change the way Apache 
calls php (with application/x-httpd types) but I never get apache to 
start :(

I heard about compiling one version as module and the other as cgi but 
did not try myself...

If anybody has an idea... :)
Thanks
dob
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] stand alone php

2004-10-04 Thread Jay Blanchard
[snip]
Is there any app that converts php to a stand alone
version?

like a windows .exe program.
[/snip]

Have a look at http://www.priadoblender.com

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



Re: [PHP] Using php4 AND php5

2004-10-04 Thread Bostjan Skufca @ domenca.com
Compile another apache apache with php5 and make it listen on port 81, use 
different pid file and different error_log, recompile your current apache 
with modules mod_rewrite and mod_proxy and mod_proxy_http enabled. Then make 
current apache forward all .php5 requests to second apache via proxy module 
like this:

RewriteEngine   On
RewriteRule (.*)\.php5$ http://%{HTTP_HOST}:81$1.php [P]
(add this to each virtual host definition)

the trick about logs is that everything is logged with your primary apache 
server, so you do not need to open all vhost logs on your secondary apache - 
you need errorlog though :)

regards,
Bostjan


On Monday 04 of October 2004 13:44, Dobermann wrote:
> Hi all,
>
> I'd like to know how to install both php 4 and 5 on the same server,
> for example with .php4 and .php5 extensions.
>
> I tried editing some part of the source code to change the way Apache
> calls php (with application/x-httpd types) but I never get apache to
> start :(
>
> I heard about compiling one version as module and the other as cgi but
> did not try myself...
>
> If anybody has an idea... :)
>
> Thanks
> dob

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



Re: [PHP] How do I know whether PHP is installed as CGI or Apache Module.

2004-10-04 Thread raditha dissanayake
Mulley, Nikhil wrote:
Hi All,
Is there any way out finding ,How do the PHP is installed ,whether as Apache Module or CGI.
 

phpinfo()
Thanks,
Nikhil.
 


--
Raditha Dissanayake.

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


[PHP] [PHP Attachement Problems

2004-10-04 Thread PHP Junkie
Ave,

I created a form which can accept 2 file attachments and send an HTML
Email... Everything works great... The files even get attached and sent, the
ONLY problem is... The PDF file I'm sending attached open up empty! They are
all blank.. Like everything has been wiped off from them!!

Here's my code.. 

 method=post
ENCTYPE="multipart/form-data" name="f1" id="f1" >

  
From
(Name):

  
  
From
(Email):

  
  
To
(First,Last):


  
  
To
(Email):

  
  
Subject:

  
  
Message:

Test Message

  
  
Attachment
1 

  
  
Attachment
2 

  


  

","$from_name
<$from>",$subject);
 $m->mailbody($message_html, $message_html);
 if( $file1) {
$m->attachFile_raw($file1,$file1_name,$file1_type);
 };
 if( $file2)
{$m->attachFile_raw($file2,$file2_name,$file2_type);};
 $m->send();
?>

mailbody("This is simply text","This is HTML
text");
* $m->attach("example.html","text/html",$filebody);
* $m->attachFile("resume.gif","image/gif");
* $m->send();
*/

class CMIMEMail {
 var $to;
 var $boundary;
 var $smtp_headers;
 var $filename_real;
 var $body_plain;
 var $body_html;
 var $atcmnt;
 var $atcmnt_type;
 
 function CMIMEMail($to,$from,$subject,$priority=3) {
   $this->to=$to; $this->from=$from;
   $this->subject=$subject; $this->priority=$priority;
   $this->boundary="=_NextPart_".time()."_".md5(time())."_";
 }
 function  mailbody( $plain, $html="" ) {
   $this->body_plain=$plain;
   $this->body_html=$html;
 }
 function  attach( $name, $content_type, $data ) {
 }
 function  attachfile_raw( $fname, $mailFileName, $content_type ) {
   if([EMAIL PROTECTED]($fname,"r")) {
$this->atcmnt[$mailFileName]=fread($f,filesize($fname));
$this->atcmnt_type[$mailFileName]=$content_type;
fclose($f);
  } 
 }
 function  attachfile( $fname, $content_type ) {
attachfile_raw($fname,$fname,$content_type);
 }
 function  clear() {
   unset( $atcmnt );
   unset( $atcmnt_type );
 }
 function  makeheader() {
   $out ="From: ".$this->from."\n";
   $out.="Reply-To: ".$this->from."\n";
   $out.="MIME-Version: 1.0\n".
"Content-Type: multipart/mixed;\n\t boundary=\"".$this->boundary."\"\n".
"X-Priority: ".$this->priority."\n".
"X-Mailer: phpMimeMail ( http://www.informed-sources.com/ )\n";
   return $out;
 }
 function  makebody() {
   $boundary2= "=_NextAttachedPart_".time()."_".md5(time()+101)."_";
   $out="";
   if( " ".$this->body_html!=" " ) {
 $out="\nThis is a multi-part message in MIME format.\n\n";
 $out.="--".$this->boundary."\nContent-Type:
multipart/alternative;\n\tboundary=\"$boundary2\"\n";
 $out.="$body_plan\n".
   "--$boundary2\nContent-Type: text/plain\n".
#   "Content-Disposition: inline\n".
   "Content-Transfer-Encoding: quoted-printable\n\n".
   $this->body_plain.
   "\n\n--$boundary2\n".
   "Content-Type: text/html\n".
#   "Content-Disposition: attachment;\n\tfilename=\"message.html\"\n".
   "Conent-Transfer-Encoding: quoted-printable\n".
   "\n$this->body_html\n\n".
   "--$boundary2--\n";
   } else {
 $out="\n\n".$this->body_plain."\n\n";
 $out.="--".$this->boundary."\n".
"Content-Type: text/plain\n".
"Content-Transfer-Encoding: quoted-printable\n\n".
$this->body_plain.
"\n\n--".$this->boundary.
"\n";
   }
   if( is_array( $this->atcmnt_type ) ) {
 reset( $this->atcmnt_type);
 while( list($name, $content_type) = each($this->atcmnt_type) ) {
   $out.="\n--".$this->boundary."\nContent-Type:
application/pdf\nContent-Transfer-Encoding: base64\nContent-Disposition:
attachment; filename=\"$name\"\n\n".
 chunk_split(base64_encode($this->atcmnt[$name]))."\n";
 }   
   }
   $out.="\n--".$this->boundary."--\n";
   return $out;
 }
 function  send(){
   mail( $this->to, $this->subject, $this->makebody(),$this->makeheader() );
   echo "";
 }
}

?>

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



[PHP] Re: PHP (anti) crash policy?

2004-10-04 Thread Olaf van der Spek
Manuel Lemos wrote:
Hello,
On 10/03/2004 01:46 PM, Olaf Van Der Spek wrote:
Why?
I think a large number of data handling functions would benefit from 
such a function.
And it'd make PHP more robust.

Because it is an hack to work around the lack of support for detection 
of corrupted data in zlib.

In the end you will be able to handle the failure of zlib but you will 
not be able to tell whether it failed because the file was too large to 
decompress or because it failed due to corrupted data.

I think it would be better that zlib would be able to detect corrupted 
data so you could eventually tell the user that the file is corrupted 
instead of misleading with a message saying there was not enough memory.
I know zlib itself doesn't crash due to invalid input.
However, even in that case, what do you do with valid input that causes 
out of memory errors?

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


[PHP] session timeout

2004-10-04 Thread Philip Thompson
Hi all.
I have users log into my site to perform certain actions. However, I 
want to create a timed session so that it automatically logs them out 
after a certain amount of time. I am using 
`session_set_cookie_params()` to create the amount of available time 
that the user is logged in.

But my question is: how do I test to see if the session has timed out? 
Once the session time has elapsed, are the $_SESSION variables 
automatically destroyed or what?

Thanks in advance,
~Philip
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] session timeout

2004-10-04 Thread afan
# store entry time to session
$_SESSION['entry_time'] = time();

# checking if session expired
if((time() - $_SESSION['entry_time']) > 3600)  #session expired after 1 hour
{
  header('login.php');
  exit;
}

-afan


> Hi all.
>
> I have users log into my site to perform certain actions. However, I
> want to create a timed session so that it automatically logs them out
> after a certain amount of time. I am using
> `session_set_cookie_params()` to create the amount of available time
> that the user is logged in.
>
> But my question is: how do I test to see if the session has timed out?
> Once the session time has elapsed, are the $_SESSION variables
> automatically destroyed or what?
>
> Thanks in advance,
> ~Philip
>
> --
> 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] session timeout

2004-10-04 Thread Greg Donald
On Mon, 04 Oct 2004 09:54:15 -0500, Philip Thompson <[EMAIL PROTECTED]> wrote:
> I have users log into my site to perform certain actions. However, I
> want to create a timed session so that it automatically logs them out
> after a certain amount of time. I am using
> `session_set_cookie_params()` to create the amount of available time
> that the user is logged in.

session.gc_maxlifetime sets the session lifetime.

> But my question is: how do I test to see if the session has timed out?

if(isset($_SESSION['some_session_var']))

> Once the session time has elapsed, are the $_SESSION variables
> automatically destroyed or what?

Session garbage collection occurs occasionally when session_start() is called.


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

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



Re: [PHP] session timeout

2004-10-04 Thread Marek Kilimajer
Philip Thompson wrote:
Hi all.
I have users log into my site to perform certain actions. However, I 
want to create a timed session so that it automatically logs them out 
after a certain amount of time. I am using `session_set_cookie_params()` 
to create the amount of available time that the user is logged in.
Cookies are not reliable, as they are client side. One can easily extend 
this period to infinity. You should instead store the login time in a 
session variable and check this variable on each request.

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


[PHP] objects - is that possible at runtime in php4 or php5 ?

2004-10-04 Thread Alawi Albaity
I want to create and defined variables of an object in runtime , is
that possible ?
I can do that with arrays but I want the access it as variable from
obbject it self and not like member of an array are defined on object
before I load it !

-- 
Alawi Albaity
Jeddah - KSA
Mobile : +966506660442

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



Re: [PHP] objects - is that possible at runtime in php4 or php5 ?

2004-10-04 Thread Marek Kilimajer
Alawi Albaity wrote:
I want to create and defined variables of an object in runtime , is
that possible ?
I can do that with arrays but I want the access it as variable from
obbject it self and not like member of an array are defined on object
before I load it !
What about trying it before asking?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PGP commands problem

2004-10-04 Thread Alexandru E. Ungur
Hi all,

I have a little problem with signing e-mails from PHP.
The little piece of code giving me headaches is this:

 $tmp_file");
exec("cat $tmp_file | pgp -sta -u Alex -o $tmp_file");
?>

If I run it from shell with 
# php -f pgp_sign.php
it works as expected, I get one temporary file containing
the unsigned data, and one secondfile with an extra ".asc"
extension, with the data signed with the chosen key.

If I run it from the browser however it just shows loading
loading..., loading... forever! It never gives an error (well,
I did not wait forever, that's true, my time on Earth is limited ;)
and it never gets "loaded" either. When I look at the files
that it should create, I see the first is created ok, but the
second is not. The test script, does belong to nobody user, 
just like the /home/nobody and just like the user the apache
is run under:

httpd.conf:
...
User nobody
Group nobody
...

PHP Safe Mode is Off and in the error log I see this:

Pretty Good Privacy(tm) Version 6.5.8
(c) 1999 Network Associates Inc.
Uses the RSAREF(tm) Toolkit, which is copyright RSA Data Security, Inc.
Export of this software may be restricted by the U.S. government.

Pretty Good Privacy(tm) Version 6.5.8
(c) 1999 Network Associates Inc.
Uses the RSAREF(tm) Toolkit, which is copyright RSA Data Security, Inc.
Export of this software may be restricted by the U.S. government.


Has anybody had any similar experience? Has anybody worked it out? :)
If anybody could help I would really appreciate,
Thank you in advance,

Have a nice day everyone,
Alex

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



[PHP] Session.gc_maxlifetime?

2004-10-04 Thread Suhas
Hello,

I just want to make sure that I understand this concept.

When i read thr' docs,

session.gc_maxlifetime specifies the number of seconds after which
data will be seen as 'garbage' and cleaned up

and default value is 1440.

My guess is :

A.  1440 seconds from last visit to the page (where session id is used), 
B. 1440 seconds from session_start() function call

My general understanding is a session can be idle for 1440 seconds. If
a php page tried to refer to a session which is been idle more than
1440 seconds, there is very little chance that page will access to
session data.


Can any one please explain or send links or more docs on this?

Thanks in adv,

Suhas

-- 
Suhas Pharkute.

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



[PHP] bitwize '&' operator trouble

2004-10-04 Thread Jim Grill
I ran across this problem with php 5.0.2 in Linux. This problem did not exist before 
and this code was used in php 5.0.0, 5.0.1, 5.0.2-dev, and several other cvs snaps 
along the way -all on Linux.

\n";

// Netmask = fullmask - number of hosts.
$netmask = pow(2, 32) - $numHosts;

print "netmask: $netmask\n";
print "human readable netmask: " . long2ip($netmask) . "\n";

// address to number
$ipLong = ip2long($ip);

print "ip2long ip: $ipLong\n";

// here is where the problem is:
print "(\$ipLong & \$netmask): ".($ipLong & $netmask)."\n";
// PHP 5.0.2-dev (cli) (built: Sep 21 2004 14:39:26)
// prints out "-1062731776"
//PHP 5.0.2 (cli) (built: Sep 24 2004 13:58:57)
// prints out "1084751872"

// ...and so the following always fails:
// If the ip is not equal to (itself & netmask) it cannot be on the network boundary
if ($ipLong != ($ipLong & $netmask))
 echo "Ip NOT on network boundary!";
else
 echo "Ip IS on network boundary!";
?>

I'm sure there are other ways to test if an ip is on a the network boundary of a given 
CIDR and I'll appreciate any examples of that. However, I am more interested in why 
and'ing these two numbers returns a different value now. I'm unable to find any clues 
in the docs.

Thanks,

Jim Grill

Re: [PHP] Session.gc_maxlifetime?

2004-10-04 Thread Marek Kilimajer
Suhas wrote:
Hello,
I just want to make sure that I understand this concept.
When i read thr' docs,
session.gc_maxlifetime specifies the number of seconds after which
data will be seen as 'garbage' and cleaned up
and default value is 1440.
My guess is :
A.  1440 seconds from last visit to the page (where session id is used), 
B. 1440 seconds from session_start() function call
C is correct - 1440 seconds from session_write_close(), either called 
explicitly by your script or implicitly when your script ends. But it 
happens not long after session_start(), so you might consider it the same.

My general understanding is a session can be idle for 1440 seconds. If
a php page tried to refer to a session which is been idle more than
1440 seconds, there is very little chance that page will access to
session data.
You are right
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Session.gc_maxlifetime?

2004-10-04 Thread Vail, Warren
This is my understanding;

When you use session_start(); in your script it sets a condition that will
cause a session write of the contents of the $_SESSION array to the session
repository (by default a file whose name contains the session ID) when the
script has ended.  At that time the record timestamp (file last modified
date/time) should be modified or reset to the current time.  To answer your
question below, I believe technically the timestamp is very close to the
script end time for a script containing a session_start() call (not the
actual time of the session_start() call is executed).

Periodically the gc (garbage cleanup) process is invoked, at which time all
sessions whose timestamp is checked to see how old they are and if they
precede the current timestamp minus the gc_maxlifetime value, they are to be
removed from the repository.

Notice that the processing above is accomplished when the script has ended
(sent it's last output to the browser).  By invoking the gc process at this
time it never has a direct impact on the response time or the users
experience, unless they are awfully fast with the mouse.  I have in the past
found that the GC routines are not invoked every invocation of a script, but
rather a "probability" factor causes the GC routine to be invoked on only
some percentage of the calls to session start to avoid adding needless load
to the server (i.e. say 10% of all script executions may trigger a call to
the GC routine).  To offset this I had to make sure that when
session_start() retrieved old session values (session_read), I had to add
checks to make sure I wasn't reading an old session that had expired but had
just not been cleaned up yet.

You can learn a lot about sessions by coding and testing your own
session_handler routines;

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

There are lots of other good tutorials in books on php programming.

Warren Vail


-Original Message-
From: Suhas [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 04, 2004 9:30 AM
To: php-general
Subject: [PHP] Session.gc_maxlifetime?


Hello,

I just want to make sure that I understand this concept.

When i read thr' docs,

session.gc_maxlifetime specifies the number of seconds after which data will
be seen as 'garbage' and cleaned up

and default value is 1440.

My guess is :

A.  1440 seconds from last visit to the page (where session id is used), 
B. 1440 seconds from session_start() function call

My general understanding is a session can be idle for 1440 seconds. If a php
page tried to refer to a session which is been idle more than 1440 seconds,
there is very little chance that page will access to session data.


Can any one please explain or send links or more docs on this?

Thanks in adv,

Suhas

-- 
Suhas Pharkute.

-- 
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] I'm looking to have a simple webpage send an email . ..

2004-10-04 Thread news.php.net
Can anyone help me out?  I just need a simple single webpage to send an
email from the server.

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



Re: [PHP] Session.gc_maxlifetime?

2004-10-04 Thread John Holmes
> From: Suhas <[EMAIL PROTECTED]>
> 
> My general understanding is a session can be idle for 
> 1440 seconds. If a php page tried to refer to a session
> which is been idle more than
> 1440 seconds, there is very little chance that page will
> access to session data.

Not quite. As long as a session file exists that matches the session ID passed to the 
page, it'll load the data. This occurs even if the session file is older than the 
maxlifetime limit. 

Here's how this works. By default, there is a 1% chance that a visit to a page with 
session_start() will trigger garbage collection. _IF_ garbage collection is triggered, 
it'll look in the session directory and delete session files that older than the 
maxlifetime setting (using the last access time, i think). If a request is made for a 
session ID whose matching file has been deleted, then the file is just created again, 
empty. 

Since garbage collection is triggered randomly, some session files can live for over 
the maxlifetime setting. If you have low traffic to your site, the 1% chance of 
triggering garbage collection may only occur every couple hours. So session lifetime 
will effectively be anywhere from 1440 seconds to hours. If you have a high-traffic 
site, then the lifetimes stay around the maxlifetime limit and only go over slightly. 

If you want to ensure sessions are timed out at a set time, then store the time the 
session is created within the session itself, check it upon each access for a "time 
out", and update the time upon each user action. I prefer the "good enough" solution 
of garbage collection, though, since most programs don't require a hard time out value.

---John Holmes...

UCCASS - PHP Survey System
http://www.bigredspark.com/survey.html

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



[PHP] RE: **[SPAM]** [PHP] I'm looking to have a simple webpage send an email . ..

2004-10-04 Thread Jay Blanchard
[snip]
Can anyone help me out?  I just need a simple single webpage to send an
email from the server.
[/snip]

http://www.php.net/mail

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



Re: [PHP] I'm looking to have a simple webpage send an email . ..

2004-10-04 Thread Jason Davidson
"news.php.net" <[EMAIL PROTECTED]> wrote: 
> 
> Can anyone help me out?  I just need a simple single webpage to send an
> email from the server.
> 

http://ca.php.net/manual/en/ref.mail.php

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

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



Re: [PHP] I'm looking to have a simple webpage send an email . ..

2004-10-04 Thread raditha dissanayake
news.php.net wrote:
Can anyone help me out?  I just need a simple single webpage to send an
email from the server.
 

Since your name is 'news.php.net' you should be well aware that you 
ought to RTFM before posting in newsgroups.

--
Raditha Dissanayake.

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


Re: [PHP] I'm looking to have a simple webpage send an email . ..

2004-10-04 Thread John Nichel
news.php.net wrote:
Can anyone help me out?  I just need a simple single webpage to send an
email from the server.
Oh, I'm going to guess that php's mail functions will help...there's 
even a manual entry for it.

http://us2.php.net/mail
Answers are usually found in a four step process...
RTFM
STFA
STFW
Mailing List
Your question is answered in the first step (as well as in the second 
and third).

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


[PHP] Parse file and input into DB

2004-10-04 Thread Robert Sossomon
What I would like to do is upload a file and have PHP parse the file and 
dump the information into a MySQL database, putting the information into 
select tables.  I believe I can do everything EXCEPT parse the page. 
Anyone have some insight (or direct links) to some examples on what to 
use to do it?

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


Re: [PHP] Parse file and input into DB

2004-10-04 Thread Matt M.
> What I would like to do is upload a file and have PHP parse the file and
> dump the information into a MySQL database, putting the information into
> select tables.  I believe I can do everything EXCEPT parse the page.
> Anyone have some insight (or direct links) to some examples on what to
> use to do it?


what format will the uploaded file be in?  csv?

http://us2.php.net/manual/en/function.fgetcsv.php

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



Re: [PHP] Parse file and input into DB

2004-10-04 Thread John Nichel
Robert Sossomon wrote:
What I would like to do is upload a file and have PHP parse the file and 
dump the information into a MySQL database, putting the information into 
select tables.  I believe I can do everything EXCEPT parse the page. 
Anyone have some insight (or direct links) to some examples on what to 
use to do it?
What's the format of the file?
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Parse file and input into DB -> More

2004-10-04 Thread Robert Sossomon
Whoops.
I am planning to do an upload of HTML files that are written from Belarc 
Advisor or from another utility that checks your system and creates a 
profile.

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


[PHP] Can anyone help me with Attachments?

2004-10-04 Thread PHP Junkie
Ave,

I'm trying to send Attachments via a mail script... The only problem is, my
attached files go corrupted or damaged, and I don't understand why! Can
anyone help me? I've already made 2 posts earlier with my code and all and
no one responded. Really need some help here.

Thanks,
Junkie

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



Re: [PHP] I'm looking to have a simple webpage send an email . ..

2004-10-04 Thread Philip Thompson
John,
On Oct 4, 2004, at 1:25 PM, John Nichel wrote:
Answers are usually found in a four step process...
RTFM
STFA
STFW
Mailing List
Can you clarify these abbr.? I think I understand the first one, but 
what are the next two? Hehe

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


[PHP] Generating MySQL Tables

2004-10-04 Thread Pete

Is MySQL off topic for this list?  If so, I apologise.

I am supplied with various text (CSV, etc) data files, which I need to
manually massage before I import into the main database.  I feel that I
can deal with them better by turning them into SQL tables first.  I know
about LOAD DATA INFILE, but this requires a table to exist, and I don't
know the format of the table until I receive the text file.

Is there any simple way of automatically creating a table and then
importing the data?

If not, I think that I will have to create a dummy table, with, say, 50
blob fields (some text fields are 'a paragraph full'), and work from
there.

Of course, it doesn't need to be fast to run.

-- 
Pete Clark

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



Re: [PHP] I'm looking to have a simple webpage send an email . ..

2004-10-04 Thread Greg Donald
On Mon, 04 Oct 2004 15:31:12 -0500, Philip Thompson <[EMAIL PROTECTED]> wrote:
> > RTFM
> > STFA
> > STFW
> > Mailing List

RTFM = Read the fine manual.
* http://www.php.net/docs.php

STFA = Search the fine archives.
* http://marc.theaimsgroup.com/?l=php-general

STFW = Search the fine web.
* http://google.com

Mailing list.
* Last resort, you are here.


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

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



Re: [PHP] Generating MySQL Tables

2004-10-04 Thread John Nichel
Pete wrote:
Is MySQL off topic for this list?
Yes.
http://lists.mysql.com/
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] I'm looking to have a simple webpage send an email . ..

2004-10-04 Thread John Nichel
Philip Thompson wrote:
John,
On Oct 4, 2004, at 1:25 PM, John Nichel wrote:
Answers are usually found in a four step process...
RTFM
STFA
STFW
Mailing List

Can you clarify these abbr.? I think I understand the first one, but 
what are the next two? Hehe
They deal with Searching The Archives, and Searching The Web.
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Can anyone help me with Attachments?

2004-10-04 Thread Marek Kilimajer
PHP Junkie wrote:
Ave,
I'm trying to send Attachments via a mail script... The only problem is, my
attached files go corrupted or damaged, and I don't understand why! Can
anyone help me? I've already made 2 posts earlier with my code and all and
no one responded. Really need some help here.
View the attachment in a text editor, you might see php warnings in it.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Generating MySQL Tables

2004-10-04 Thread Greg Donald
On Mon, 4 Oct 2004 22:32:40 +0200, Pete <[EMAIL PROTECTED]> wrote:
> 
> Is MySQL off topic for this list?  If so, I apologise.

There is a php-db list that is more on-topic than php-general, but so
long as your already here :)

> I am supplied with various text (CSV, etc) data files, which I need to
> manually massage before I import into the main database.  I feel that I
> can deal with them better by turning them into SQL tables first.  I know
> about LOAD DATA INFILE, but this requires a table to exist, and I don't
> know the format of the table until I receive the text file.

Most csv files I have dealt with contained a header row.  You can
parse that out and make a create table query with it using text
fields.  You could then insert the data and have MySQL analyze and
suggest better optimal fields than the text fields.  Kind of a kludge
but if you need to be general this way woudl work although it's pretty
inefficient compared to knowing the data up front.

You might want to check out the PEAR File package, it does a lot of
the same things you will be doing:

http://pear.php.net/package/File


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

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



[PHP] Best and easy html text area replacement tool?

2004-10-04 Thread Bosky, Dave
I'm looking for an easy to use html textarea replacement script and figured
this was the place to locate the most popular.

 

Thanks,

Dave

 

 

 



HTC Disclaimer:  The information contained in this message may be privileged and 
confidential and protected from disclosure. If the reader of this message is not the 
intended recipient, or an employee or agent responsible for delivering this message to 
the intended recipient, you are hereby notified that any dissemination, distribution 
or copying of this communication is strictly prohibited.  If you have received this 
communication in error, please notify us immediately by replying to the message and 
deleting it from your computer.  Thank you.


[PHP] Function declaration failing on return value

2004-10-04 Thread Whil Hentzen
Don't get too excited; this is an awfully lame newbie question.

I'm trying out my first functions and can't get past some sort of stupid 
syntax mistake I'm making. I've cut the following snippet directly out of the 
online PHP manual and put it in a PH page, like so:


Test function

Square of number/b>

 





When I run the php page, I get

Parse error: parse error, unexpected T_RETURN in /var/www/html/afi/sq.php on 
line 12

I've experimented with a half dozen different functions and variations, and 
I'm always getting the same 'unexpected T_RETURN' error. This is pretty basic 
but I'm outa clues.

I've searched the archives for the last 3 mo for T_RETURN (and user-defined 
functions) as well as the online doc; no relevant hits. 

Thanks,

-- 
Whil

Moving to Linux: Freedom, Choice, Security, Opportunity
http://www.hentzenwerke.com

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



Re: [PHP] Function declaration failing on return value

2004-10-04 Thread Matthew Sims
> Don't get too excited; this is an awfully lame newbie question.

Too late, I'm already excited.

>
> I'm trying out my first functions and can't get past some sort of stupid
> syntax mistake I'm making. I've cut the following snippet directly out of
> the
> online PHP manual and put it in a PH page, like so:
>
> 
> Test function
> 
> Square of number/b>
>
>   function square($num)
>  {
> return $num * $num;
>  }
>  echo square(4);  // outputs '16'.
>  ?>
>
> 
> 
> 
>
> When I run the php page, I get
>
> Parse error: parse error, unexpected T_RETURN in /var/www/html/afi/sq.php
> on
> line 12
> --
> Whil
>

function square($num) {

  $result = $num * $num;
  return $result;

}

-- 
--Matthew Sims
--

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



[PHP] Question about handling credit cards

2004-10-04 Thread Ed Lazor
I'm looking at online stores and it seems like a lot of them maintain copies
of credit card numbers.  Is this true?  That seems like a "bad thing" to me,
especially in terms of liability and risk of hackers.  On the flip side, it
seems like there are legitimate reasons.  For example, if you bill the
customer when products ship, rather than when the order is received.  Or, if
the customer decides to have instock items ship now and back ordered items
ship when they arrive - which results in two shipping charges.

How do you guys handle this?

-Ed

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



Re: [PHP] Function declaration failing on return value

2004-10-04 Thread Matthew Fonda
Howdy,

It seems to work just fine for me, perhaps you have a syntax error
somewhere else, such as a missing ; or $ or {. Check and make you you
have no typo's, it seems to work perfectly for me.


-- 
Regards,
Matthew Fonda

On Mon, 2004-10-04 at 13:59, Whil Hentzen wrote:
> Don't get too excited; this is an awfully lame newbie question.
> 
> I'm trying out my first functions and can't get past some sort of stupid 
> syntax mistake I'm making. I've cut the following snippet directly out of the 
> online PHP manual and put it in a PH page, like so:
> 
> 
> Test function
> 
> Square of number/b>
> 
>   function square($num)
>  {
> return $num * $num;
>  }
>  echo square(4);  // outputs '16'.
>  ?> 
> 
> 
> 
> 
> 
> When I run the php page, I get
> 
> Parse error: parse error, unexpected T_RETURN in /var/www/html/afi/sq.php on 
> line 12
> 
> I've experimented with a half dozen different functions and variations, and 
> I'm always getting the same 'unexpected T_RETURN' error. This is pretty basic 
> but I'm outa clues.
> 
> I've searched the archives for the last 3 mo for T_RETURN (and user-defined 
> functions) as well as the online doc; no relevant hits. 
> 
> Thanks,
> 
> -- 
> Whil
> 
> Moving to Linux: Freedom, Choice, Security, Opportunity
> http://www.hentzenwerke.com

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



Re: [PHP] Question about handling credit cards

2004-10-04 Thread Matthew Fonda
The best way to store credit card numbers is to have them encrypted when
they are stored in the database, and decrypted when they need to be
used, that way it will be safer for the most part

On Mon, 2004-10-04 at 14:49, Ed Lazor wrote:
> I'm looking at online stores and it seems like a lot of them maintain copies
> of credit card numbers.  Is this true?  That seems like a "bad thing" to me,
> especially in terms of liability and risk of hackers.  On the flip side, it
> seems like there are legitimate reasons.  For example, if you bill the
> customer when products ship, rather than when the order is received.  Or, if
> the customer decides to have instock items ship now and back ordered items
> ship when they arrive - which results in two shipping charges.
> 
> How do you guys handle this?
> 
> -Ed
-- 
Regards,
Matthew Fonda

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



Re: [PHP] Function declaration failing on return value

2004-10-04 Thread Whil Hentzen
On Monday 04 October 2004 16:43, Matthew Sims wrote:
> > Don't get too excited; this is an awfully lame newbie question.
>
> Too late, I'm already excited.

Sorry 'bout that.

> >  >  function square($num)
> >  {
> > return $num * $num;
> >  }
> >  echo square(4);  // outputs '16'.
> >  ?>
> >
> > 
> > 
> > 
> >


> function square($num) {
>
>   $result = $num * $num;
>   return $result;
>
> }

Well, under the category of "That's weird", I changed the function to:

http://www.hentzenwerke.com

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



Re: [PHP] Function declaration failing on return value

2004-10-04 Thread Whil Hentzen
On Monday 04 October 2004 17:00, Matthew Fonda wrote:
> Howdy,
>
> It seems to work just fine for me, perhaps you have a syntax error
> somewhere else, such as a missing ; or $ or {. Check and make you you
> have no typo's, it seems to work perfectly for me.

I cut this directly out of the online manual and put it into my PHP page. If 
I've got a typo, then there's an error in the manual.

I also cut the entire PHP page into my email. Nothing missing or hidden.

I'm stumped.

I retyped everything in changed all the names... now it works. Looks like 
there are hidden chars in the html that I cut out from the online manual.

"That's weird".

Thanks!
-- 
Whil

Moving to Linux: Freedom, Choice, Security, Opportunity
http://www.hentzenwerke.com

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



[PHP] PHP "make install" writes to httpd.conf

2004-10-04 Thread Robert Cummings
Anyway to choke PHP's behaviour of adding the following to httpd.conf
when you make install:

LoadModule php4_module /some_dumb_location/libphp4.so

I use a customized layout for my compilations, and this always messes
things up since apache doesn't complain about the location, and then it
stops accepting connections on the configured ports. At any rate, I
don't think it's PHP's business to be modifying my httpd.conf file
without my say so, or at least it should give me an option to opt out :)

PHP even ignores that my httpd.conf has perms 444 *heh*.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] UPS Online Tools and PHP?

2004-10-04 Thread Ed Lazor
Has anyone integrated the UPS Online Tools with their site using PHP?

 

http://www.ups.com/content/us/en/bussol/offering/technology/automated_shippi
ng/online_tools.html

 

-Ed

 



[PHP] Recursive Interpolation

2004-10-04 Thread Chuck Wolber

Greetings,

I've seen a few posts from the middle of last year discussing the problem 
of recursive interpolation:

http://marc.theaimsgroup.com/?l=php-general&m=105543152906744&w=2
http://marc.theaimsgroup.com/?l=php-general&m=105542523331255&w=2

It seems there's a HEREDOC method of hacking through this problem. In the 
meantime, is there any other way?

Here's a description of a problem I'm having and how it would be nice to 
see it solved:

Database *FIELD* with text data in it. The text data contains sentences 
interspersed with $foo['bar'] array variables. The idea is that when one 
selects this field, PHP will interpolate $foo['bar'] with the currently 
defined $foo array variable. This allows for "form letter" like dispatches 
to be created.

Given a variable $text that contains data retrieved with array variables, 
It'd be useful to see something: $text_i = interpolate($text) which 
recursively interpolates based on variables in the current namespace.

Granted, this opens up a *WHOLE* mountain of problems (circular references 
anyone?). Is there any traction on an idea like this? Any other solutions 
that aren't so hackish as HEREDOCs?

Thanks,

-Chuck

-- 
http://www.quantumlinux.com 
 Quantum Linux Laboratories, LLC.
 ACCELERATING Business with Open Technology

 "The measure of the restoration lies in the extent to which we apply 
  social values more noble than mere monetary profit." - FDR

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



[PHP] something wrong with $_SERVER var

2004-10-04 Thread Merlin
Hi there,
I am experiencing a strange behaviour with $_SERVER vars.
Somehow the var: $_SERVER[SERVER_PORT]  seems to be 443 even if
it is 80. I had following statement inside my app:
if ($_SERVER[SERVER_PORT] == '443' AND !$SSL){
header("Location:http://".$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI]);
exit;
}
This was to redirect ssl url to standard protocol (due to relative links on the 
page).

Some users with IE could not load any pages anymore (ssl was disabled). The 
normal url was not loadable and only a white screen showed up. Did not happen 
with firefox most of the time. But why?? The server port was not 443 so the 
statemetn could never become true?!

Any ideas? I am lost :-(
Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Best and easy html text area replacement tool?

2004-10-04 Thread Greg Donald
On Mon, 4 Oct 2004 16:50:17 -0400, Bosky, Dave <[EMAIL PROTECTED]> wrote:
> I'm looking for an easy to use html textarea replacement script and figured
> this was the place to locate the most popular.

What is a "html textarea replacement script" ?

I could be wrong but it sounds like javascript, not PHP.


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

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



Re: [PHP] something wrong with $_SERVER var

2004-10-04 Thread Chuck Wolber
On Tue, 5 Oct 2004, Merlin wrote:

> I am experiencing a strange behaviour with $_SERVER vars.
> Somehow the var: $_SERVER[SERVER_PORT]  seems to be 443 even if
> it is 80. I had following statement inside my app:
> 
> if ($_SERVER[SERVER_PORT] == '443' AND !$SSL){
>   header("Location:http://".$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI]);
>   exit;
> }


You can start by putting a space between the "Location:" and the rest of 
your URL.

-Chuck


-- 
http://www.quantumlinux.com 
 Quantum Linux Laboratories, LLC.
 ACCELERATING Business with Open Technology

 "The measure of the restoration lies in the extent to which we apply 
  social values more noble than mere monetary profit." - FDR

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



[PHP] email templating system

2004-10-04 Thread adwinwijaya
Hello php-general,

Currently I use Smarty for page templating system, and I am happy with
this. But is there any way to produce a file with smarty instead of
displaying it as a page.

I want to use this as email templating, I want to create an email and
I have a template like smarty and I want to assign it just like
smarty. Is there any templating system that suitable for me ?


Example:
[email.tpl]

Hello {$user},

Welcome to {$name_of_web}

regards,
{$system_administrator}

[email.php]

$email->assign('user', $user);
$email->assign('system_administrator', $system_administrator);
$email->assign('name_of_web', $name_of_web);
$email->send('/templates/email.tpl') ;




-- 
Best regards,
adwin

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



Re: [PHP] email templating system

2004-10-04 Thread John Holmes
adwinwijaya wrote:
Hello php-general,
Currently I use Smarty for page templating system, and I am happy with
this. But is there any way to produce a file with smarty instead of
displaying it as a page.
I want to use this as email templating, I want to create an email and
I have a template like smarty and I want to assign it just like
smarty. Is there any templating system that suitable for me ?
Example:
[email.tpl]
Hello {$user},
Welcome to {$name_of_web}
regards,
{$system_administrator}
[email.php]
$email->assign('user', $user);
$email->assign('system_administrator', $system_administrator);
$email->assign('name_of_web', $name_of_web);
$message = $email->fetch('/templates/email.tpl');
mail($to,$subject,$message);
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re[2]: [PHP] email templating system

2004-10-04 Thread adwinwijaya
Hello John,

Tuesday, October 5, 2004, 11:43:34 AM, you wrote:

JH> X-Apparently-To: [EMAIL PROTECTED] via
JH> 216.109.117.233; Mon, 04 Oct 2004 18:44:39 -0700
JH> X-Originating-IP: [216.92.131.4]
JH> Return-Path:
JH> <[EMAIL PROTECTED]>
JH> Received: from 216.92.131.4  (HELO pb1.pair.com) (216.92.131.4)
JH>   by mta127.mail.sc5.yahoo.com with SMTP; Mon, 04 Oct 2004 18:44:39 -0700
JH> Received: (qmail 77197 invoked by uid 1010); 5 Oct 2004 01:44:21 -
JH> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
JH> Precedence: bulk
JH> list-help: 
JH> list-unsubscribe: 
JH> list-post: 
JH> Delivered-To: mailing list [EMAIL PROTECTED]
JH> Received: (qmail 77146 invoked by uid 1010); 5 Oct 2004 01:44:21 -
JH> Delivered-To: [EMAIL PROTECTED]
JH> Delivered-To: [EMAIL PROTECTED]
JH> X-Ironport-AV: i="3.85,122,1094443200"; 
JH>d="scan'208"; a="380869305:sNHT13028200"
JH> Message-ID: <[EMAIL PROTECTED]>
JH> Date: Mon, 04 Oct 2004 21:43:34 -0400
JH> From: John Holmes <[EMAIL PROTECTED]>
JH> User-Agent: Mozilla Thunderbird 0.7.3 (Windows/20040803)
JH> X-Accept-Language: en-us, en
JH> MIME-Version: 1.0
JH> To: adwinwijaya <[EMAIL PROTECTED]>
JH> CC: [EMAIL PROTECTED]
JH> References: <[EMAIL PROTECTED]>
JH> In-Reply-To: <[EMAIL PROTECTED]>
JH> Content-Type: text/plain; charset=windows-1252; format=flowed
JH> Content-Transfer-Encoding: 8bit
JH> Subject: Re: [PHP] email templating system

JH> adwinwijaya wrote:
>> Hello php-general,
>> 
>> Currently I use Smarty for page templating system, and I am happy with
>> this. But is there any way to produce a file with smarty instead of
>> displaying it as a page.
>> 
>> I want to use this as email templating, I want to create an email and
>> I have a template like smarty and I want to assign it just like
>> smarty. Is there any templating system that suitable for me ?
>> 
>> 
>> Example:
>> [email.tpl]
>> 
>> Hello {$user},
>> 
>> Welcome to {$name_of_web}
>> 
>> regards,
>> {$system_administrator}
>> 
>> [email.php]
>> 
>> $email->assign('user', $user);
>> $email->assign('system_administrator', $system_administrator);
>> $email->assign('name_of_web', $name_of_web);

$message = $email->>fetch('/templates/email.tpl');
JH> mail($to,$subject,$message);

no, This is not what I mean. I know about mail() function.
I just want to create email, but I want it like smarty, have if, for
etc in the email template.



-- 
Best regards,
adwin

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



[PHP] returning values/information from perl apps to php apps..

2004-10-04 Thread bruce
hi...

i'm trying to return values/information from a perl app to a php app. what's
the best way??

foo.php

blah
res = system(dog.pl)
.
.

---
dog.pl

$vars
.
.
.

--

the issue i'm having is that perl only seems to allow an app to have an
'exit' value of a short int. i need to return values that might be multiple
arrarys. should i simply write the perl return values into an output file,
and read the output vars from the output file in the php file...

comments/thoughts/etc

thanks

-bruce

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



Re: [PHP] email templating system

2004-10-04 Thread John Holmes
adwinwijaya wrote:
$message = $email->>fetch('/templates/email.tpl');
JH> mail($to,$subject,$message);
no, This is not what I mean. I know about mail() function.
I just want to create email, but I want it like smarty, have if, for
etc in the email template.
Yes, that is what you mean. fetch() is going to parse the smarty "email" 
template (where you have your IF, FOR, smarty variables, etc) and return 
the parsed template to you. Then you stick that into mail().

If you want to use $email->send(), then you'll have to modify the smarty 
class or write a class that extends smarty and implements the send() 
method.

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


Re: [PHP] returning values/information from perl apps to php apps..

2004-10-04 Thread John Holmes
bruce wrote:
i'm trying to return values/information from a perl app to a php app. what's
the best way??
[snip]
the issue i'm having is that perl only seems to allow an app to have an
'exit' value of a short int. i need to return values that might be multiple
arrarys. should i simply write the perl return values into an output file,
and read the output vars from the output file in the php file...
There are some notes on the apache_note() manual page that suggest it 
could be useful. Perhaps you could put a serialized value into an apache 
note in Perl and then retrieve it in PHP?

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


Re[2]: [PHP] email templating system

2004-10-04 Thread adwinwijaya
Hello John,
Tuesday, October 5, 2004, 11:59:19 AM, you wrote:

JH> Yes, that is what you mean. fetch() is going to parse the smarty "email"
JH> template (where you have your IF, FOR, smarty variables, etc) and return
JH> the parsed template to you. Then you stick that into mail().

JH> If you want to use $email->send(), then you'll have to modify the smarty
JH> class or write a class that extends smarty and implements the send()
JH> method.

Oh .. that's right John, I just know that smarty has fetch() method :(
... thanks for your help :)

-- 
Best regards,
adwin

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



[PHP] Memory Usage

2004-10-04 Thread Juan Pablo Herrera
Hi!
I need management the use of the memory when a php script is execute. How
can i do it?.I know mysql_free_result for free all memory associated with the result,
is it all?.
Regards,
JP

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



[PHP] RE: returning values/information from perl apps to php apps..

2004-10-04 Thread bruce
eric...

how does using serialize allow the information from the perl app to be used
by the php parent app. unless you're implying that the serialized
information is stored in an external file, that's then read by the php
calling/parent app...

-bruce


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
Eric Germann
Sent: Monday, October 04, 2004 7:49 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: returning values/information from perl apps to php apps..


Php::serialize

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
bruce
Sent: Monday, October 04, 2004 9:55 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: returning values/information from perl apps to php apps..

hi...

i'm trying to return values/information from a perl app to a php app. what's
the best way??

foo.php

blah
res = system(dog.pl)
.
.

---
dog.pl

$vars
.
.
.

--

the issue i'm having is that perl only seems to allow an app to have an
'exit' value of a short int. i need to return values that might be multiple
arrarys. should i simply write the perl return values into an output file,
and read the output vars from the output file in the php file...

comments/thoughts/etc

thanks

-bruce



___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

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



[PHP] Re: returning values/information from perl apps to php apps..

2004-10-04 Thread Randy J. Ray
the issue i'm having is that perl only seems to allow an app to have an
'exit' value of a short int. i need to return values that might be multiple
arrarys. should i simply write the perl return values into an output file,
and read the output vars from the output file in the php file...
I believe that PHP has facilities for executing external processes and saving 
the text of the output (I've done just a sprinkling of PHP, so I'm limited 
there). But if that is the case, there is nothing preventing you from having 
the Perl application print out the desired data in a structured format 
(comma-separated values, tab-separated, or even mock-XML) and having the PHP 
then parse it. Indeed, if you output it as XML, I believe that PHP has classes 
built-in that would allow you to effectively go straight to having a DOM 
representation of the data.

Randy
--
[EMAIL PROTECTED]  http://www.rjray.org http://www.svsm.org
Always code as if the guy who ends up maintaining your code will be a violent
psychopath who knows where you live.  -- Rick Osborne
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Recursive Interpolation

2004-10-04 Thread Chuck Wolber
On Mon, 4 Oct 2004, Chuck Wolber wrote:

> Database *FIELD* with text data in it. The text data contains sentences 
> interspersed with $foo['bar'] array variables. The idea is that when one 
> selects this field, PHP will interpolate $foo['bar'] with the currently 
> defined $foo array variable. This allows for "form letter" like 
> dispatches to be created.

The method I've come up with in the meantime, I believe is much more 
effective than heredocs, but still an ugly hack:


function interpolate ($text, $msg_variable) {
$msg_key = '_FP_VAR_';
   
   
foreach (array_keys($msg_variable) as $key) {
$token = $msg_key.$key;
$text = preg_replace("/$token/", "$msg_variable[$key]", $text);
}
   
   
return ($text);
}




-- 
http://www.quantumlinux.com 
 Quantum Linux Laboratories, LLC.
 ACCELERATING Business with Open Technology

 "The measure of the restoration lies in the extent to which we apply 
  social values more noble than mere monetary profit." - FDR

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



[PHP] [Newbie Guide] For the benefit of new members

2004-10-04 Thread Gnanavel
1. If you have any queries/problems about PHP 
try http://www.php.net/manual/en first. You 
can download a copy and use it offline also. 

Please also try 
http://www.php.net/manual/faq.php 
for answers to frequently answered questions 
about PHP (added by Christophe Chisogne).

2. Try http://www.google.com next. Searching 
for "php YOUR QUERY" may fetch you relevant 
information within the first 10 results.

3. There is a searchable archive of the 
mailing list discussion at 
http://phparch.com/mailinglists. Many of the 
common topics are discussed repeatedly, and 
you may get answer to your query from the 
earlier discussions. 

For example: One of the repeatedly discussed 
question in the list is "Best PHP editor". 
Everyone has his/her favourite editor. 
You can get all the opinions by going through 
the list archives. If you want a chosen list 
try this link : 
http://www.thelinuxconsultancy.co.uk/phpeditors/
(contributed by Christophe Chisogne).

4. Not sure if PHP is working or you want 
find out what extensions are available to 
you?

Just put the following code into a file with 
a .php extension and access it through your 
webserver:

 

If PHP is installed you will see a page with 
a lot of information on it. If PHP is not 
installed (or not working correctly) your 
browser will try to download the file.

(contributed by Teren and reworded by Chris W 
Parker)

5. If you are stuck with a script and do not 
understand what is wrong, instead of posting 
the whole script, try doing some research 
yourself. One useful trick is to print 
the variable/sql query using print or echo 
command and check whether you get what you 
expected. 

After diagnosing the problem, send the 
details of your efforts (following steps 1, 
2 & 3) and ask for help.

6. PHP is a server side scripting language. 
Whatever processing PHP does takes place 
BEFORE the output reaches the client. 
Therefore, it is not possible to access 
users' computer related information (OS, 
screen size etc) using PHP. Nor can you 
modify any the user side settings. You need 
to go for JavaScript and ask the question in 
a JavaScript list.

On the other hand, you can access the 
information that is SENT by the user's 
browser when a client requests a page from 
your server. You can find details about 
browser, OS etc as reported by 
this request. - contributed by Wouter van 
Vliet and reworded by Chris W Parker.

7. Provide a clear descriptive subject line. 
Avoid general subjects like "Help!!", "A 
Question" etc. Especially avoid blank 
subjects. 

8. When you want to start a new topic, open a 
new mail composer and enter the mailing list 
address [EMAIL PROTECTED] instead of 
replying to an existing thread and replacing 
the subject and body with your message.

9. Only quote the relevant parts of
an email when replying. Do not Quote
everything (including huge code snippets) 
only to say "I agree", for instance.
[contribued by Paul Waring]

10. It's always a good idea to post back to 
the list once you've solved your problem. 
People usually add [SOLVED] to the subject 
line of their email when posting solutions. 
By posting your solution you're helping the 
next person with the same question. 
[contribued by Chris W Parker]

11. Ask smart questions 
http://catb.org/~esr/faqs/smart-questions.html
[contributed by Jay Blanchard)

12. Do not send your email to the list with 
attachments. If you don't have a place to 
upload your code, try the many pastebin 
websites (such as www.pastebin.com).
[contributed by Burhan Khalid]

Following these guidelines will ensure that 
you get effective responses from the list
members. Otherwise, your questions might not 
be answered.

Hope you have a good time programming with 
PHP.
-- 
Integrated Management Tools for leather 
industry
--
http://www.leatherlink.net
S.Gnanavel,
BSG LeatherLink (P) Ltd,
Chennai - 600106

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



RE: [PHP] Recursive Interpolation

2004-10-04 Thread Michael Sims
Chuck Wolber wrote:
> The method I've come up with in the meantime, I believe is much more
> effective than heredocs, but still an ugly hack:
>
> function interpolate ($text, $msg_variable) {
> $msg_key = '_FP_VAR_';
>
> foreach (array_keys($msg_variable) as $key) {
> $token = $msg_key.$key;
> $text = preg_replace("/$token/", "$msg_variable[$key]",
> $text); }
>
> return ($text);
> }

What's ugly about it?  I saw your earlier post I was actually planning on
responding and suggesting something exactly like you just came up with.  My
version had the $token surrounded by markers, such as

This is a ?:token:?

but that's the only difference.  I think it's fairly clean and logical.

The only problem I can see with this approach is that it's inefficient as
$msg_variable gets larger or the $text gets larger, since you're iterating
through every key of the former, even if the token isn't in $text, and you
run preg_replace() once for each token, but that shouldn't hurt you unless
you really have a heavy traffic site, IMHO.

I toyed around with using preg_replace_callback() for this eariler, but the
only problem with it is that you can't create a callback that accepts more
than just one variable (the array of matches).  This means I couldn't get
the equivalent of your $msg_variable passed to the callback, so I had to
make it global in the callback function (yuk).  If it weren't for that it'd
be a perfect solution, because preg_replace_callback would only be called
once and the function wouldn't need to iterate through all of $msg_variable.
It's times like that that I miss Perl's more powerful variable scoping
rules.  Ah well...

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



RE: [PHP] Best and easy html text area replacement tool?

2004-10-04 Thread Warren Vail
I guess I have no patience with the "topic police" since it's difficult to
develop a good PHP "user interface" without the use of JavaScript, and I
consider anything that involves getting the most out of PHP "on topic", but
since I'm in charge of absolutely nothing, all I can do is provide a little
information.

I've actually used a couple of these JavaScript add-on's and like the
structure and reliability of HTMLAREA.

http://www.interactivetools.com/products/htmlarea/

It provides a nice plug-in interface that other developers have used to make
JavaScript extensions available that includes;
* Image Upload Manager
* Spell Checking (On a Unix/Linux host)
* Enhanced Table Formatting
* Multiple Language Capability (haven't look too close at this one)
* Even something for Audio (haven't looked at this, either)
* And probably some that I haven't mentioned (doing this from memory).

And the price is the same as PHP (free).

Good luck,

Warren Vail

-Original Message-
From: Bosky, Dave [mailto:[EMAIL PROTECTED]
Sent: Monday, October 04, 2004 1:50 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Best and easy html text area replacement tool?

I'm looking for an easy to use html textarea replacement script and figured
this was the place to locate the most popular.



Thanks,

Dave









HTC Disclaimer:  The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of this
message is not the intended recipient, or an employee or agent responsible
for delivering this message to the intended recipient, you are hereby
notified that any dissemination, distribution or copying of this
communication is strictly prohibited.  If you have received this
communication in error, please notify us immediately by replying to the
message and deleting it from your computer.  Thank you.

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



[PHP] Help needed Postgresql and PHP

2004-10-04 Thread suma parakala
Hi
I am developing an application using php and postgresql . My problem is I 
need to retrieve name and addresses from table(postgres sql table)  and 
print letter (body of letter will be same). Kindly help /Suggest how i can 
do this
Thanks
Suma

_
Looking for a soulmate?  http://www.shaadi.com/ptnr.php?ptnr=hmltag Log onto 
Shaadi.com.

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