RE: [PHP] Delimiter WITHOUT lots of IF's

2003-08-19 Thread Ralph Guzman
Actually, I missed a few things on that function. It should look like
this:

function cart_cdqty()
{

$query = "SELECT SUM(sess_itemsize) AS total_size 
  FROM sessions 
  WHERE sess_id = ".$_COOKIE['SID']."";

$result = mysql_query($query);

if(!$row = mysql_fetch_array($result))
{
   return false;
} else {
   $n = $row['total_size'];
   $x = ceil( $n / 690.0 );
   
   $cart_cdqty = array(
   'quantity' => $x,
   'total_size' => $n
   );
   
   return $cart_cdqty;
} 

}


-Original Message-
From: Ralph Guzman [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 18, 2003 11:41 PM
To: 'Cesar Aracena'; [EMAIL PROTECTED]
Subject: RE: [PHP] Delimiter WITHOUT lots of IF's
Sensitivity: Confidential

I agree with Curt, use mySQL to get the sum of 'sess_itemsize' then
divide the result by size per disk to get quantity. So your function
should look something like this:

function cart_cdqty()
{

$query = "SELECT SUM(sess_itemsize) AS total_size 
  FROM sessions 
  WHERE sess_id = ".$_COOKIE['SID']."";

$result = mysql_query($query);

if($row = mysql_fetch_array($result))
{
   $n = $row['total_size'];
   $x = ceil( $n / 690.0 );
   
   $cart_cdqty = array(
   'quantity' => '$x',
   'total_size' => '$n',
   );
   
   return $cart_cdqty;
} else {
   return false;
}

}

Then all you do is call the function like this:

if(!$cdqty = cart_cdqty())
{
   print 'no items found in your shopping cart';
} else {
   print 'Total Size:' . $cdqty['quantity'] . '';
   print 'Total CDs:' .  $cdqty['total_size'] . 'MBs ';
}

I have not tested this but it should work.

Ralph





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



Re: [PHP] Fatal error: [] operator not supported for strings

2003-08-19 Thread Daniel
I checked ant that is not the cause of this problem.
Any other sugesstion?


"John W. Holmes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Daniel wrote:
>
> > hi, how do i solve this error?
> >
> > Fatal error: [] operator not supported for strings
> > in /var/www/html/p.../magazin/cos.php on line
> > 13
> >
> > line 13 is this line:
> >
> > $_SESSION["id_produs"][]=$_POST["id_produs"];
> >
> > no error when i run in local host , when i upload
> > in server (with PHP 4.2.2) only got this error.
> >
> > first time click is fine, but when i click the
> > product once again, i got tat fatal errorhow
> > can i solve it?? pls advice. thanks.
>
> Sounds like you've already assigned a value to $_SESSION['id_produs']
> and are now trying to turn it into an array.
>
> $_SESSION['id_produs'] = 'string value';
> $_SESSION['id_produs'][] = 'some other value';
>
> Check your code...
>
> -- 
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> PHP|Architect: A 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] Fatal error: [] operator not supported for strings

2003-08-19 Thread desa15

==
not
=

$_SESSION["id_produs"][]== $_POST["id_produs"];



Un saludo, Danny


   

  "Daniel" 

  <[EMAIL PROTECTED]  Para: [EMAIL PROTECTED]  
   
  o>   cc: 

   Asunto:   Re: [PHP] Fatal error: [] 
operator not supported for strings  
  19/08/2003 10:06 

   

   





I checked ant that is not the cause of this problem.
Any other sugesstion?


"John W. Holmes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Daniel wrote:
>
> > hi, how do i solve this error?
> >
> > Fatal error: [] operator not supported for strings
> > in /var/www/html/p.../magazin/cos.php on line
> > 13
> >
> > line 13 is this line:
> >
> > $_SESSION["id_produs"][]=$_POST["id_produs"];
> >
> > no error when i run in local host , when i upload
> > in server (with PHP 4.2.2) only got this error.
> >
> > first time click is fine, but when i click the
> > product once again, i got tat fatal errorhow
> > can i solve it?? pls advice. thanks.
>
> Sounds like you've already assigned a value to $_SESSION['id_produs']
> and are now trying to turn it into an array.
>
> $_SESSION['id_produs'] = 'string value';
> $_SESSION['id_produs'][] = 'some other value';
>
> Check your code...
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> PHP|Architect: A magazine for PHP Professionals ? www.phparch.com
>
>
>
>



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







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



php-general Digest 19 Aug 2003 09:57:40 -0000 Issue 2245

2003-08-19 Thread php-general-digest-help

php-general Digest 19 Aug 2003 09:57:40 - Issue 2245

Topics (messages 159952 through 159995):

Mail() Problem Sending
159952 by: Ben C.
159958 by: Michael A Smith
159975 by: Cesar Aracena
159989 by: raditha dissanayake
159995 by: Ivo Fokkema

Re: READ RECEIPTS [WAS: $GLOBAL question]
159953 by: Dan Anderson
159955 by: Michael A Smith
159957 by: Michael A Smith
159960 by: Chris W. Parker

Re: need help with cookies
159954 by: Curt Zirzow
159964 by: Jaap van Ganswijk

Re: pop3 functions
159956 by: andu
159959 by: Dan Anderson
159991 by: raditha dissanayake

Re: [PUP] READ RECEIPTS [WAS: $GLOBAL question]
159961 by: Robin Kopetzky

URGENT PROPOSAL
159962 by: MRS EKI OMORODION
159965 by: MRS EKI OMORODION

Re: How configure PHP parser 4.3.x in IIS version 6.0?
159963 by: Jaap van Ganswijk

Re: If you ever had a Vic20
159966 by: Martin Towell

How to open a save-as dialog and then redirect after donwload?
159967 by: Jean-Christian IMbeault
159970 by: Jon Drukman

mysql_connect() fails randomly
159968 by: Jon Drukman
159971 by: Curt Zirzow

Re: Cannot output before input
159969 by: Chris Lee

Re: Problem with the post variables.
159972 by: Tom Rogers

Re: Problems with post (Again)
159973 by: Tom Rogers

Delimiter WITHOUT lots of IF's
159974 by: Cesar Aracena
159976 by: Ralph Guzman
159977 by: Ralph Guzman
159978 by: Cesar Aracena
159979 by: Ralph Guzman
159980 by: Cesar Aracena
159981 by: Curt Zirzow
159987 by: Ralph Guzman
159988 by: Cesar Aracena
159992 by: Ralph Guzman

Re: getting value of item in list box.
159982 by: KK

window.open("hai.php?id="one");
159983 by: murugesan
159984 by: Martin Towell
159985 by: murugesan
159986 by: Martin Towell

Re: XML Parser misbehaves with &
159990 by: raditha dissanayake

Re: Fatal error: [] operator not supported for strings
159993 by: Daniel
159994 by: desa15.necso.es

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
--- Begin Message ---
I have recently had php installed on my server with sendmail.  The server is behind a 
firewall and SMTP is open on the firewall.  However, when I execute the mail(), it 
appears to have sent the mail, but I never receive it.  I am not getting any error 
messages.  Has anyone ever run into this problem?  Does anyone have any ideas?

--- End Message ---
--- Begin Message ---
My ideas: (in order of likelihood)

Idea #1: Your computer hates you.
Idea #2: Sendmail isn't running.
Idea #3: Sendmail isn't setup correctly.
Idea #4: You have been hacked by Saddam.
-Michael

:-)
Ben C. wrote:
I have recently had php installed on my server with sendmail.  The server is behind a firewall and SMTP is open on the firewall.  However, when I execute the mail(), it appears to have sent the mail, but I never receive it.  I am not getting any error messages.  Has anyone ever run into this problem?  Does anyone have any ideas?

 



--- End Message ---
--- Begin Message ---
Before trying to guess what Saddam can and can't do with computers, try
sending e-mails to different addresses (different domains... NOT just
different usernames). Sometimes, the e-mail server you use is NOT
configured properly, so every e-mail does not gets to you.

It happened to me too when testing my server's sendmail. The e-mails
reached well one of my addresses but not another one. So I pointed the
e-mails to a Hotmail account and it reached it. Try it and see what
happens.

For some e-mail servers, you have to write lots of "extra headers" in
the e-mails in order to pass their guard.

HTH

Cesar Aracena
www.icaam.com.ar


> -Mensaje original-
> De: Ben C. [mailto:[EMAIL PROTECTED]
> Enviado el: Lunes, 18 de Agosto de 2003 06:28 p.m.
> Para: [EMAIL PROTECTED]
> Asunto: [PHP] Mail() Problem Sending
> 
> I have recently had php installed on my server with sendmail.  The
server
> is behind a firewall and SMTP is open on the firewall.  However, when
I
> execute the mail(), it appears to have sent the mail, but I never
receive
> it.  I am not getting any error messages.  Has anyone ever run into
this
> problem?  Does anyone have any ideas?
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



--- End Message ---
--- Begin Message ---
/var/log/maillog file shold have some clues.

Cesar Aracena wrote:
Before trying to guess what Saddam can and can't do with computers, try
sending e-mails to different addresses (different domains... NOT just
dif

Re: [PHP] Mail() Problem Sending

2003-08-19 Thread Ivo Fokkema
"Cesar Aracena" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
[snip]
> For some e-mail servers, you have to write lots of "extra headers" in
> the e-mails in order to pass their guard.
[/snip]

True! But actually, I' ve seen people using only the 'From:' header to send
mail. Emails can then be dropped easily by servers thinking it is spam.

Ben, I don't know what headers you send, but you could try these headers:

$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/plain; charset=iso-8859-1\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-MSMail-Priority: Normal\r\n";
$headers .= "X-Mailer: PHP/".phpversion()."\r\n";
$headers .= "From: Name <[EMAIL PROTECTED]>\r\n";
$headers .= "Reply-to: Name <[EMAIL PROTECTED]>\r\n";
$headers .= "Return-path: Name <[EMAIL PROTECTED]>\r\n";
$headers .= "Error-to: Name <[EMAIL PROTECTED]>\r\n";

mail("Yourname <[EMAIL PROTECTED]>", "Subject", $body, $headers);



HTH,

Ivo



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



Re: [PHP] How to open a save-as dialog and then redirect after donwload?

2003-08-19 Thread Marek Kilimajer
This is what you want (thanks go to Billy S Halsey):

header("Content-Type: multipart/mixed; boundary=\"-Boundary-12399\"");

print "---Boundary-12399\r\n";
print "Content-Type: text/html\r\n";
print "\r\n";
// Your HTML code goes here

print "\n";
print "---Boundary-12399\r\n";
print "Content-Type: application/octet-stream\r\n";
print "Content-Disposition: attachment; filename=foo.tar.gz\r\n\r\n";
readfile("./foo.tar.gz");
print "---Boundary-12399--\r\n";
print "\r\n";
?>

It sends html page first as download can take much longer.

Jean-Christian IMbeault wrote:
I want to create the following:

1- A screen a series files and associated buttons
2- if the user clicks the button a "File | save as" dialog opens up
3- after the file the user is redirected to a new page
I've gotten 1 and 2 to work but I can't figure out how to do anything 
after the file has finished downloading. I've tried header("Location: ") 
but that doesn't work because it must be used before any input is sent.

The reason I want this functionality is that once a file is downloaded I 
want the screen with the buttons to refresh itself and remove the 
downloaded file from the list displayed to the user.

How can I accomplish this? All suggestions welcomed!

Jean-Christian Imbeault




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


[PHP] parse_ini_file() difference between empty value and Off?

2003-08-19 Thread Ivo Fokkema
Hi list!

I tried the manual, the web, the archives... maybe I'm not approaching this
correctly.

I use parse_ini_file() on a config.ini to fetch some settings the lame
people can set using my application. I want this config file to be as simple
as possible so that I won't get emails about things not working when this
open source application is released. I was thinking that leaving the value
of a directive blank would be good to set the default value... such as this:

; Whether or not to send reports about MySQL errors. Can be set to On, Off
; or Silent. Silent will send a report, but will not notify the user.
; Defaults to On.
send_db_errors =

would leave the setting 'On' because it's the default and a specific value
was not entered. I fill in the defaults by checking for empty values and
replacing them with the defaults for those directives.

However...

Setting something to 'Off' will also cause the value to be empty. So

send_db_errors =

AND

send_db_errors = Off

both return $config_ini_array['send_db_errors'] as a string(0) "". How can I
see this difference? I know the php.ini file quotes the directive for
default values to work. So :

;send_db_errors (note the ; at the start of the line)

returns $config_ini_array['send_db_errors'] as NULL, allowing me to see the
difference. But I think that might be too complicated for the future users
of the system. Should I use

send_db_errors = Default

or something? Any ideas on this? The default values may sometimes be a bit
more complex than just 'On' or 'Off', so I really need to see the difference
between a user requesting the Default value or setting it to Off.

TIA,

Ivo

--
[Win2000 | Apache/1.3.23]
[PHP/4.2.3 | MySQL/3.23.53]

Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands



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



[PHP] RE: [PHP-DB] Queries probably timing out

2003-08-19 Thread Paul


Yep, here are some locations for files etc.
 
Install Apache - http://www.apache.org/dist/httpd/binaries/win32/
Install MySQL (this link for 3.23) -
http://www.mysql.com/downloads/mysql-3.23.html 
Install PHP - www.php.net OR even easier -
http://php.weblogs.com/easywindows (a windows installer, adds PEAR and
ADODB)

Cheers,
Paul



-Original Message-
From: Ignatius Reilly [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 19, 2003 3:00 AM
To: Dillon, John; PHP-DB List
Subject: Re: [PHP-DB] Queries probably timing out


- Original Message -
From: "Dillon, John" <[EMAIL PROTECTED]>
To: "PHP-DB List" <[EMAIL PROTECTED]>
Sent: Tuesday, August 19, 2003 11:47 AM
Subject: [PHP-DB] Queries probably timing out


I'm doing queries on tables with 45,000 rows in one table and 1-2000
rows in
another..  I think the queries are failing due to timeout on the server.
The server is not dedicated to me and I may not be able to affect the
timeout settings...though I'll ask my hosting company (Positive
Internet).
If I decide to do the queries on my local PC (I don't need or want to do
them over the internet),

(1) do I have to set up my PC as a server,

Yes.

(2) if so what's the quickest and easiest server to get started with,

Install Apache, PHP and MySQL. There are countless tutes on the web on
how
to do so. It is a breeze under Windows 2000

(3) are there complications running the server on the same PC as the
client
applications (ie my PHP code),

No, except maybe performance

(4) do I then download MySQL and PHP onto it, though I read PHP comes
bundled with MySQL,

PHP has an API to MySQL, but you have to have first a MySQL server
running

(5) will it become clear to me what host name/IP address to use to
connect
to the database (up to now I've been told by the hosting company).

You can use a dynamic DNS set-up (look for instance www.dnsmadeeasy.com)
if
you need a name-based address. Also a breeze to set up.

Any other suggestions on timeouts on queries?

Thanks,

John






























http://www.cantor.com
CONFIDENTIAL: This e-mail, including its contents and attachments, if
any,
are confidential. If you are not the named recipient please notify the
sender and immediately delete it. You may not disseminate, distribute,
or
forward this e-mail message or disclose its contents to anybody else.
Copyright and any other intellectual property rights in its contents are
the
sole property of Cantor Fitzgerald.
 E-mail transmission cannot be guaranteed to be secure or
error-free.
The sender therefore does not accept liability for any errors or
omissions
in the contents of this message which arise as a result of e-mail
transmission.  If verification is required please request a hard-copy
version.
 Although we routinely screen for viruses, addressees should check
this
e-mail and any attachments for viruses. We make no representation or
warranty as to the absence of viruses in this e-mail or any attachments.
Please note that to ensure regulatory compliance and for the protection
of
our customers and business, we may monitor and read e-mails sent to and
from
our server(s).

For further important information, please read the  Important Legal
Information and Legal Statement at
http://www.cantor.com/legal_information.html


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




-- 
PHP Database 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] directory listing

2003-08-19 Thread Matthias Wulkow
Hi php-general,

I'm reading through the filesystem function of php and I can't find
any function which will list me all the files which are in a certain
directory. Am I blind or do I have to "create" myself one?

Thanks for help

M. W.

-- 
Who is the ennemy?


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



Re: [PHP] directory listing

2003-08-19 Thread Marek Kilimajer
Wrong place, look at directory functions ;)

Matthias Wulkow wrote:

Hi php-general,

I'm reading through the filesystem function of php and I can't find
any function which will list me all the files which are in a certain
directory. Am I blind or do I have to "create" myself one?
Thanks for help

M. W.



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


Re: [PHP] XML Parser misbehaves with &

2003-08-19 Thread Timo Boettcher
Hi Jeff,

Nachricht vom Montag, 18. August 2003, 18:14:37:

> I've come across this frustrating behavior with the XML parser when it
> reads an escaped ampersand (&)

> If the xml being evaluated is:   Blue, Green & Red

> it calls the character data handler 3 times: 
> the first time the $data is "Blue, Green "
> the second time is "&"
> and the third time is " Red"

> Needless to say this is screwing up my parser, and the stuff I'm
> doing won't make it easy to add this allowance.  I'm hoping
> somebody can point out a way to turn off this behavior.  If this is
> the proper operation, is it documented anywhere? I've been unable to
> find it. 

xml is a www.w3c.org recomendation.
Its documented at http://www.w3.org/TR/REC-xml
http://www.w3.org/TR/REC-xml#syntax states:

"The ampersand character (&) and the left angle bracket (<) may appear
in their literal form only when used as markup delimiters, or within a
comment, a processing instruction, or a CDATA section. If they are
needed elsewhere, they must be escaped using either numeric character
references or the strings "&" and "<" respectively."   

HTH

 Timo


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



RE: [PHP] $GLOBAL question

2003-08-19 Thread Ford, Mike [LSS]
On 18 August 2003 18:49, Jonathan Pitcher wrote:

> Robin,
> 
> There are 2 problems with the example you provided.
> 
> One, $GLOBAL should be $GLOBALS.
> 
> Second you can't print a value that has not been set. See updated code
> for an example.
> 
>$aTest = "This is a test";
>   $GLOBALS['aTest'] = $aTest;

Nope -- that's just setting the same value twice -- $GLOBALS['aTest'] is the
same as $aTest when in the global scope.

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] pop3 functions

2003-08-19 Thread Jay Blanchard
[snip]
> Those weird function names are taken straight from C.  Blame the
> inventors of C.  PHP is partly intended to be easy to learn for C
> programmers.

I'm wondering how many php users are C programmers...
Can only blame the php inventors for using a bad model.
[/snip]

Hey andu, since you say this what do you think would make a better
model? Or were you just being sarcastic?

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



Re: [PHP] XML Parser misbehaves with &

2003-08-19 Thread [EMAIL PROTECTED]
Timo Boettcher wrote:

Hi Jeff,

Nachricht vom Montag, 18. August 2003, 18:14:37:

 

I've come across this frustrating behavior with the XML parser when it
reads an escaped ampersand (&)
   

If the xml being evaluated is:   Blue, Green & Red
   

"The ampersand character (&) and the left angle bracket (<) may appear
in their literal form only when used as markup delimiters, or within a
comment, a processing instruction, or a CDATA section. If they are
needed elsewhere, they must be escaped using either numeric character
references or the strings "&" and "<" respectively."   

HTH

Timo

Which seems to have been done by Nachricht. As mentioned before it's perfectly normal for sax parsers to fire too events for the same text block. The expat parser is well known for this behaviour.



--

Raditha Dissanayake
-
http://www.radinks.com/sftp/
Lean and mean Secure FTP applet with Graphical User Inteface.
just 150 Kilo Bytes


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


FW: [PHP] pop3 functions

2003-08-19 Thread Jay Blanchard
I will definitely agree that there are a few inconsistencies in the 
function naming... more than likely due to the many many contributors, 
and a lack of strict naming conventions.

Never quite understood (for example) why half of the string based 
functions are named str* and the other half str_*, eg

str_replace, str_pad, str_repeat, str_word_count, etc as opposed to
strlen, strrev, strstr, strchr, strpos, etc

But all it really means is another trip to the manual if my first 
"guess" for the function name doesn't work.


It'd be nice if things could have been standardised in PHP5, with 
aliases to the functions with older (deprecated?) names, but I guess 
it's WAAAY too late for that!!


Justin


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



Re: FW: [PHP] pop3 functions

2003-08-19 Thread David Otton
On Tue, 19 Aug 2003 08:15:00 -0500, you wrote:

>I will definitely agree that there are a few inconsistencies in the 
>function naming... more than likely due to the many many contributors, 
>and a lack of strict naming conventions.

My pet hate:

bool  array_walk (array, function)
array array_map  (function, array)

Forces me to the manual every single time to check argument order.


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



Re: [PHP] Fatal error: [] operator not supported for strings

2003-08-19 Thread Curt Zirzow
* Thus wrote Daniel ([EMAIL PROTECTED]):
> I checked ant that is not the cause of this problem.
> Any other sugesstion?

Yes it is the problem.  Somewhere the $_SESSION['id_produs'] is set
to a string or number.

> 
> 
> "John W. Holmes" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Daniel wrote:
> >
> > > hi, how do i solve this error?
> > >
> > > Fatal error: [] operator not supported for strings
> > > in /var/www/html/p.../magazin/cos.php on line
> > > 13
> > >
> > > line 13 is this line:
> > >
> > > $_SESSION["id_produs"][]=$_POST["id_produs"];
> > >
> >
> > Sounds like you've already assigned a value to $_SESSION['id_produs']
> > and are now trying to turn it into an array.
> >
> > $_SESSION['id_produs'] = 'string value';
> > $_SESSION['id_produs'][] = 'some other value';
> >
> > Check your code...
> >
> > -- 
 

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] Mail() Problem Sending

2003-08-19 Thread Curt Zirzow
* Thus wrote Ivo Fokkema ([EMAIL PROTECTED]):
> "Cesar Aracena" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> [snip]
> > For some e-mail servers, you have to write lots of "extra headers" in
> > the e-mails in order to pass their guard.
> [/snip]
> 
> True! But actually, I' ve seen people using only the 'From:' header to send
> mail. Emails can then be dropped easily by servers thinking it is spam.

No email server should drop mail.

> 
> Ben, I don't know what headers you send, but you could try these headers:
> 
> $headers .= "Return-path: Name <[EMAIL PROTECTED]>\r\n";

Sending this header is virtually a waste of time and effort, it
will be ignored and set by the receiving smtp server, and on the
very fist line.


> $headers .= "Error-to: Name <[EMAIL PROTECTED]>\r\n";

This wont guarantee errors to return to that email address.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



[PHP] Re: Wicked screensaver

2003-08-19 Thread harald.radi
Please see the attached file for details.
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: FW: [PHP] pop3 functions

2003-08-19 Thread Curt Zirzow
* Thus wrote Jay Blanchard ([EMAIL PROTECTED]):
> I will definitely agree that there are a few inconsistencies in the 
> function naming... more than likely due to the many many contributors, 
> and a lack of strict naming conventions.

Actually there is a scrict nameing convetion.

> 
> Never quite understood (for example) why half of the string based 
> functions are named str* and the other half str_*, eg
> 
> str_replace, str_pad, str_repeat, str_word_count, etc as opposed to
> strlen, strrev, strstr, strchr, strpos, etc

You'll find that the str* names are a direct decendent to the C
string library (man 3 string), and some other standard c libraries.
and the str_* names are specific to php.

> 
> But all it really means is another trip to the manual if my first 
> "guess" for the function name doesn't work.
> 
> 
> It'd be nice if things could have been standardised in PHP5, with 
> aliases to the functions with older (deprecated?) names, but I guess 
> it's WAAAY too late for that!!

I would strongly disagree with deprecating the str* functions. I
and a lot of php programmers know exactly what strncmp does the
instant we look at it.  This nameing convetion has been around for
many years and many people have used these.

> 
> Justin

Um.. is it jay or justin or both?  This kind of confused me :) 


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



RE: FW: [PHP] pop3 functions

2003-08-19 Thread Jay Blanchard
[snip]
Um.. is it jay or justin or both?  This kind of confused me :) 
[/snip]

Justin inadvertently did not "reply to all" and instead sent the e-mail
directly to me as a response. I forwarded it to the list and should have
noted that. Although I do have days where I feel as if I am someone
else, today is not one of them. :)

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



Re: [PHP] Mail() Problem Sending

2003-08-19 Thread Ivo Fokkema
"Curt Zirzow" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> * Thus wrote Ivo Fokkema ([EMAIL PROTECTED]):
> > True! But actually, I' ve seen people using only the 'From:' header to
send
> > mail. Emails can then be dropped easily by servers thinking it is spam.
> No email server should drop mail.
Yet they seem to do...? Maybe dropped is not the right word?
Clients may not receive emails which lack certain headers, as these emails
are regarded spam by certain ISP's.
Some people never even get 'normal' Outlook emails which are BCC'ed to them.
The cause? Beats me... Somewhere, something, blocks/drops/deletes these
emails...

> > Ben, I don't know what headers you send, but you could try these
headers:
> >
> > $headers .= "Return-path: Name <[EMAIL PROTECTED]>\r\n";
> Sending this header is virtually a waste of time and effort, it
> will be ignored and set by the receiving smtp server, and on the
> very fist line.
Hmmm... I ofcourse noticed that if I don't use -f in the 5th mail argument,
return-path is something trashy like [EMAIL PROTECTED] Well, then
I delete that from my list...

> > $headers .= "Error-to: Name <[EMAIL PROTECTED]>\r\n";
> This wont guarantee errors to return to that email address.
No sh*t, I _never_ get bounced emails back although I set the reply-to and
error-to headers. Someone told me some SMTP's use this header so I took my
chances.

--
Ivo



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



Re: [PHP] pop3 functions

2003-08-19 Thread andu
On Tue, 19 Aug 2003 12:49:43 +0600
raditha dissanayake <[EMAIL PROTECTED]> wrote:

> 
> andu wrote:
> > On Mon, 18 Aug 2003 15:40:31 -0500
> > Ken <[EMAIL PROTECTED]> wrote:
> > 
> > 
> >>Those weird function names are taken straight from C.  Blame the
> >>inventors of C.  PHP is partly intended to be easy to learn for C
> >>programmers.
> > 
> > 
> > I'm wondering how many php users are C programmers...
> > Can only blame the php inventors for using a bad model.
> 
> Just because you cannot understand something does not mean it's bad. 

Sounds like you're talking about yourself, I never said C was
a 'bad' language, I was complaining about the functions names in php, if
you care to read more carefully. My point was that when creating a
language you have the freedom to shape the 'vocabulary' any way you
want (more or less) and it is common sense to do it so that it's easily
usable by a variety of users.

> Your mail arrived to this mailing list through several mail nodes 
> writted purely in C.


> 
> > 
> > 
> >>- Ken
> >>
> >>At 02:15 PM 8/16/2003 -0400, andu wrote:
> >>
> >>>I take the opportunity to express my 2 major problems I found with
> >>>php in the 2 months I've been using it. 
> >>>First is the naming of functions (whoever was the illiterate one
> >who>>invented them) definitely not meant to be remembered or to
> >represent>>what they actually do. It's a shame to have to fill our
> >minds with>>such garbage: strcasecmp, strchr, strcmp, strcoll,
> >strcspn, stripos,>>stristr, strspn, strstr, to take just a few. A
> >programming language>>has already its problems for not being natural,
> >no need to make it>>even more so. Second, it the array overkill.
> >>>Nevertheless, I love it.
> >>
> >>
> >>
> > 
> > 
> 
> 
> -- 
> 
> Raditha Dissanayake
> -
> http://www.radinks.com/sftp/
> Lean and mean Secure FTP applet with Graphical User Inteface.
> just 150 Kilo Bytes
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 


-- 
Andu

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



Re: [PHP] pop3 functions

2003-08-19 Thread [EMAIL PROTECTED]
Nopes i read you correctly, yours was a complaint against c.

andu wrote:

On Tue, 19 Aug 2003 12:49:43 +0600
raditha dissanayake <[EMAIL PROTECTED]> wrote:
 

andu wrote:
   

On Mon, 18 Aug 2003 15:40:31 -0500
Ken <[EMAIL PROTECTED]> wrote:
 

Those weird function names are taken straight from C.  Blame the
inventors of C.  PHP is partly intended to be easy to learn for C
programmers.
   

I'm wondering how many php users are C programmers...
Can only blame the php inventors for using a bad model.
 

Just because you cannot understand something does not mean it's bad. 
   

Sounds like you're talking about yourself, I never said C was
a 'bad' language, I was complaining about the functions names in php, if
you care to read more carefully. My point was that when creating a
language you have the freedom to shape the 'vocabulary' any way you
want (more or less) and it is common sense to do it so that it's easily
usable by a variety of users.
 

Your mail arrived to this mailing list through several mail nodes 
writted purely in C.
   



 

 

- Ken

At 02:15 PM 8/16/2003 -0400, andu wrote:

   

I take the opportunity to express my 2 major problems I found with
php in the 2 months I've been using it. 
First is the naming of functions (whoever was the illiterate one
 

who>>invented them) definitely not meant to be remembered or to
represent>>what they actually do. It's a shame to have to fill our
minds with>>such garbage: strcasecmp, strchr, strcmp, strcoll,
strcspn, stripos,>>stristr, strspn, strstr, to take just a few. A
programming language>>has already its problems for not being natural,
no need to make it>>even more so. Second, it the array overkill.
 

Nevertheless, I love it.
 

   

 

--

Raditha Dissanayake
-
http://www.radinks.com/sftp/
Lean and mean Secure FTP applet with Graphical User Inteface.
just 150 Kilo Bytes
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


   



 



--

Raditha Dissanayake
-
http://www.radinks.com/sftp/
Lean and mean Secure FTP applet with Graphical User Inteface.
just 150 Kilo Bytes


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


Re: [PHP] pop3 functions

2003-08-19 Thread andu
On Tue, 19 Aug 2003 07:14:19 -0500
"Jay Blanchard" <[EMAIL PROTECTED]> wrote:

> [snip]
> > Those weird function names are taken straight from C.  Blame the
> > inventors of C.  PHP is partly intended to be easy to learn for C
> > programmers.
> 
> I'm wondering how many php users are C programmers...
> Can only blame the php inventors for using a bad model.
> [/snip]
> 
> Hey andu, since you say this what do you think would make a better
> model? Or were you just being sarcastic?

Hard to say since php is used all over the world but English would be
fine with me. I'm very familiar with metatalk which is based on
hypercard and the syntax and vocabulary are almost plain English with no
performance penalties, that is, it's very fast.
Take 'strstr()', could've easily been 'find_string()', 'strcmp()'->
binary_compare,  and so on so that if one doesn't remember or doesn't
know a function knows what to look for.

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


-- 
Andu

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



Re: [PHP] pop3 functions

2003-08-19 Thread andu
On Tue, 19 Aug 2003 22:10:25 +0600
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:

> Nopes i read you correctly, yours was a complaint against c.

Good thing you didn't take it as a complaint against you...

> 
> 
> andu wrote:
> 
> >On Tue, 19 Aug 2003 12:49:43 +0600
> >raditha dissanayake <[EMAIL PROTECTED]> wrote:
> >
> >  
> >
> >>andu wrote:
> >>
> >>
> >>>On Mon, 18 Aug 2003 15:40:31 -0500
> >>>Ken <[EMAIL PROTECTED]> wrote:
> >>>
> >>>
> >>>  
> >>>
> Those weird function names are taken straight from C.  Blame the
> inventors of C.  PHP is partly intended to be easy to learn for C
> programmers.
> 
> 
> >>>I'm wondering how many php users are C programmers...
> >>>Can only blame the php inventors for using a bad model.
> >>>  
> >>>
> >>Just because you cannot understand something does not mean it's bad.
> >>
> >>
> >
> >Sounds like you're talking about yourself, I never said C was
> >a 'bad' language, I was complaining about the functions names in php,
> >if you care to read more carefully. My point was that when creating a
> >language you have the freedom to shape the 'vocabulary' any way you
> >want (more or less) and it is common sense to do it so that it's
> >easily usable by a variety of users.
> >
> >  
> >
> >>Your mail arrived to this mailing list through several mail nodes 
> >>writted purely in C.
> >>
> >>
> >
> >
> >  
> >
> >>>  
> >>>
> - Ken
> 
> At 02:15 PM 8/16/2003 -0400, andu wrote:
> 
> 
> 
> >I take the opportunity to express my 2 major problems I found
> >withphp in the 2 months I've been using it. 
> >First is the naming of functions (whoever was the illiterate one
> >  
> >
> >>>who>>invented them) definitely not meant to be remembered or to
> >>>represent>>what they actually do. It's a shame to have to fill our
> >>>minds with>>such garbage: strcasecmp, strchr, strcmp, strcoll,
> >>>strcspn, stripos,>>stristr, strspn, strstr, to take just a few. A
> >>>programming language>>has already its problems for not being
> >natural,>>no need to make it>>even more so. Second, it the array
> >overkill.>>  
> >>>
> >Nevertheless, I love it.
> >  
> >
> 
> 
> 
> >>>  
> >>>
> >>-- 
> >>
> >>Raditha Dissanayake
> >>-
> >>http://www.radinks.com/sftp/
> >>Lean and mean Secure FTP applet with Graphical User Inteface.
> >>just 150 Kilo Bytes
> >>
> >>
> >>-- 
> >>PHP General Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >>
> >>
> >>
> >
> >
> >  
> >
> 
> 
> -- 
> 
> Raditha Dissanayake
> -
> http://www.radinks.com/sftp/
> Lean and mean Secure FTP applet with Graphical User Inteface.
> just 150 Kilo Bytes
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 


-- 
Andu

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



RE: [PHP] pop3 functions

2003-08-19 Thread Jay Blanchard
[snip]
First is the naming of functions (whoever was the illiterate one who
invented them).
[/snip]

I remeber when andu got upset about RTFM, STFW, STFA...calling it
insulting. Truth is andu complains a lot. I wonder about andu's
age...well not really. 

Have a productive and pleasant day!



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



[PHP] Your details

2003-08-19 Thread lehors
Please see the attached file for details.
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] pop3 functions

2003-08-19 Thread andu
On Tue, 19 Aug 2003 11:18:29 -0500
"Jay Blanchard" <[EMAIL PROTECTED]> wrote:

> [snip]
> First is the naming of functions (whoever was the illiterate one who
> invented them).
> [/snip]
> 
> I remeber when andu got upset about RTFM, STFW, STFA...calling it
> insulting. Truth is andu complains a lot. I wonder about andu's
> age...well not really. 

Nothing to do with age, I never took things for granted like I'm getting
2 identical messages instead of one (forgot to mention that, Jay!).

> 
> Have a productive and pleasant day!
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 


-- 
Andu

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



Re: [PHP] shouldn't mysql_pconnect force reuse of mysql connections?

2003-08-19 Thread Curt Zirzow
* Thus wrote anders thoresson ([EMAIL PROTECTED]):
> 
> function db_connect ($user, $pwd, $db, $debug = 0)
> {
>   $link = @mysql_pconnect("localhost", "$user", "$pwd");
>   if($link && mysql_select_db("$db"))
> ... 
>
> I thought that making another or a third call to db_connect would reuse 
> the same connection to the database, since I use mysql_pconnect() to 
> connect. But listing the active processes indicates something else:
> 
> 
> | Id| User  | Host  | db| Command | Time | State | Info 
> | 64494 | thore | localhost | thore | Sleep   | 222  |   |  
>|
> | 64497 | thore | localhost | thore | Sleep   | 218  |   |  
>|
> ...

This is expected, this is the behavour of mysql. when php requests
a pconnection, mysql will allocate a certain amount of pooled
connections that will be used.

To really test this to see if php is reusing the connection, kill
all processes in mysql. Then (making sure that no other script
somewhere else connects to database) run your script once.  Your
resulting process list will have only one item listed

the second time you request in php you'll have two, and so on.
Until the number of connections in the pool gets filled up will
mysql tell php to use an id that exists.

there is a setting in mysql to change this, but i can't recall off
hand the name of the setting.

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



[PHP] losing a session?

2003-08-19 Thread Gerard L Petersen
Hi 

Is it possible to lose a session?
For instance if on www.coke.com  $_SESSION['name'] = x; is set

and on www.pepsi.com $_SESSION['name'] = notX; is set.

Then i return to www.coke.com will $_SESSION['name'] == notX;

How does this work?

Thanks

-Gerard.


[PHP] Losing a session?

2003-08-19 Thread Gerard L Petersen
Hi

Is it possible to lose a session?
For instance if i go to coke.com and

$_SESSION['name'] =3D "x";=20

is set.

and then i go to pepsi.com and

$_SESSION['name'] =3D "notX";=20

is set.

if i then return to coke.com will $_SESSION['name'] =3D=3D notX;

How does this work?

Thanks

Gerard

[PHP] getting corrupt files after upload in php/apache

2003-08-19 Thread Peter Berglund
I'm getting corrupt files after I've used my upload-script. For images it
works good but when I upload an wav-file , 222KB, the file gets corrupt and
I can't play it. Whats the problem ?



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



RE: [PHP] getting corrupt files after upload in php/apache

2003-08-19 Thread Jay Blanchard
[snip]
I'm getting corrupt files after I've used my upload-script. For images
it
works good but when I upload an wav-file , 222KB, the file gets corrupt
and
I can't play it. Whats the problem ?
[/snip]

agh

Uh, your code? Your server? 

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



[PHP] RELEASE ANNOUNCEMENT: phpDocumentor 1.2.2

2003-08-19 Thread Greg Beaver
August 19, 2003

RELEASE ANNOUNCEMENT
phpDocumentor 1.2.2
http://www.phpdoc.org
The phpDocumentor team is happy to announce the release of phpDocumentor 
1.2.2.

phpDocumentor is a complete documentation solution for PHP that can both 
extract API documentation directly from source code and also create a 
complete user-level manual from DocBook external documentation.  Unlike 
other documenting solutions for any language, phpDocumentor allows 
dynamic linking between the API documentation and the user-level 
documentation.  In addition, output is highly customizable, and comes 
bundled with 17 different output templates, including output in HTML 
(frames and no frames), PDF (Adobe Acrobat), CHM (Windows Help File), 
and XML DocBook ready-formatted for PEAR documentation.  Adding your own 
output template is easy, and adding a new output format is also 
relatively simple.

CHANGES IN 1.2.2:
-fixed critical bugs in the Highlight Parser
-fixed many minor bugs
-color syntax highlighting of source code in PDF
-XML:DocBook/peardoc2, PDF and CHM converters are now upgraded to stable
-memory usage has reduced for creating multiple outputs at once
-takes advantage of the proposed publicweb role in PEAR, to install the 
web interface so that it works out of the box (requires a simple patch 
to PEAR core available in the file as publicweb-PEAR-1.2.1-patch.txt)
-command-line interface works out of the box in both windows and linux 
if installed through PEAR
-a complete list of changes is in Release-1.2.2 in the archive and at 
the website

Download from http://www.phpdoc.org, and pear install from 
http://phpdoc.org/releases/PhpDocumentor-1.2.2.tgz

Greg Beaver
--
phpDocumentor 1.2.2
http://www.phpdoc.org
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] shouldn't mysql_pconnect force reuse of mysql connections?

2003-08-19 Thread anders thoresson
the second time you request in php you'll have two, and so on.
Until the number of connections in the pool gets filled up will
mysql tell php to use an id that exists.
You mean that until the pool is filled a new id will be used? That's the 
case here, anway: I get up to 30 id's and then no more new a added, but the 
"time" column reset, which I take means that that id is reuses?

Thank's for helping me sort things out!

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


Re: [PHP] Losing a session?

2003-08-19 Thread Dan Anderson
I would speculate that because what you are doing involves cookies at
coke.com $_SESSION['name'] == X and at pepsi.com $_SESSION['name'] ==
NotX.

On the other hand if on foo.coke.com you set $_SESSION['name'] I'm not
sure if it will be written over at bar.coke.com

-Dan

On Tue, 2003-08-19 at 17:05, Gerard L Petersen wrote:
> Hi
> 
> Is it possible to lose a session?
> For instance if i go to coke.com and
> 
> $_SESSION['name'] =3D "x";=20
> 
> is set.
> 
> and then i go to pepsi.com and
> 
> $_SESSION['name'] =3D "notX";=20
> 
> is set.
> 
> if i then return to coke.com will $_SESSION['name'] =3D=3D notX;
> 
> How does this work?
> 
> Thanks
> 
> Gerard


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



Re: [PHP] getting corrupt files after upload in php/apache

2003-08-19 Thread Peter Berglund
since it works with other files I think that it's some configuration
somewhere that is wrong,

this is the form head:
 

and the copycode:
copy($_FILES['img1']['tmp_name'], "$ufolder".$_FILES['img1']['name'])

"Jay Blanchard" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
[snip]
I'm getting corrupt files after I've used my upload-script. For images
it
works good but when I upload an wav-file , 222KB, the file gets corrupt
and
I can't play it. Whats the problem ?
[/snip]

agh

Uh, your code? Your server?



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



RE: [PHP] Delimiter WITHOUT lots of IF's

2003-08-19 Thread Cesar Aracena
Ralph, I tested the function below but the result at the page is:

"CD Quantity: Array"

and not the CD quantity according to file size... Why is the array there
and what it is supposed to be called with to give one or another result?

Thanks,

Cesar Aracena
www.icaam.com.ar

> 
> Actually, I missed a few things on that function. It should look like
> this:
> 
> function cart_cdqty()
> {
> 
> $query = "SELECT SUM(sess_itemsize) AS total_size
>   FROM sessions
>   WHERE sess_id = ".$_COOKIE['SID']."";
> 
> $result = mysql_query($query);
> 
> if(!$row = mysql_fetch_array($result))
> {
>return false;
> } else {
>$n = $row['total_size'];
>$x = ceil( $n / 690.0 );
> 
>$cart_cdqty = array(
>'quantity' => $x,
>'total_size' => $n
>);
> 
>return $cart_cdqty;
> }
> 
> }
> 
> 
> -Original Message-
> From: Ralph Guzman [mailto:[EMAIL PROTECTED]
> Sent: Monday, August 18, 2003 11:41 PM
> To: 'Cesar Aracena'; [EMAIL PROTECTED]
> Subject: RE: [PHP] Delimiter WITHOUT lots of IF's
> Sensitivity: Confidential
> 
> I agree with Curt, use mySQL to get the sum of 'sess_itemsize' then
> divide the result by size per disk to get quantity. So your function
> should look something like this:
> 
> function cart_cdqty()
> {
> 
> $query = "SELECT SUM(sess_itemsize) AS total_size
>   FROM sessions
>   WHERE sess_id = ".$_COOKIE['SID']."";
> 
> $result = mysql_query($query);
> 
> if($row = mysql_fetch_array($result))
> {
>$n = $row['total_size'];
>$x = ceil( $n / 690.0 );
> 
>$cart_cdqty = array(
>'quantity' => '$x',
>'total_size' => '$n',
>);
> 
>return $cart_cdqty;
> } else {
>return false;
> }
> 
> }
> 
> Then all you do is call the function like this:
> 
> if(!$cdqty = cart_cdqty())
> {
>print 'no items found in your shopping cart';
> } else {
>print 'Total Size:' . $cdqty['quantity'] . '';
>print 'Total CDs:' .  $cdqty['total_size'] . 'MBs ';
> }
> 
> I have not tested this but it should work.
> 
> Ralph
> 
> 
> 
> 
> 
> --
> 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] getting corrupt files after upload in php/apache

2003-08-19 Thread Jay Blanchard
[snip]
since it works with other files I think that it's some configuration
somewhere that is wrong,
[/snip]


What is your max file size allowed for uploads?

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



RE: [PHP] Delimiter WITHOUT lots of IF's

2003-08-19 Thread Chris W. Parker
Cesar Aracena 
on Tuesday, August 19, 2003 10:18 AM said:

> Sensitivity: Confidential

Oh really?

> and not the CD quantity according to file size... Why is the array
> there and what it is supposed to be called with to give one or
> another result? 

Pay close attention to this part:

>$cart_cdqty = array(
>'quantity' => $x,
>'total_size' => $n
>);
> 
>return $cart_cdqty;

That means it's returning an array. one index is called 'quantity' and
the other is called 'total_size'.


$qty = function(input);

echo "quantity is ".$qty['quantity'];


hth,
chris.

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



Re: [PHP] shouldn't mysql_pconnect force reuse of mysql connections?

2003-08-19 Thread anders thoresson
You mean that until the pool is filled a new id will be used? That's the 
case here, anway: I get up to 30 id's and then no more new a added, but 
the "time" column reset, which I take means that that id is reuses?
There are still 30 open threads/processes in the process list, all with 
command Sleep. Does MySQL clean this list when they've been to sleep for 
too long?

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


[PHP] "back" works in opera but not in internet explorer

2003-08-19 Thread anders thoresson
When I push the back buttom in Opera, I get back to the previous 
(database/php-generated) page in my site, but when I'm using IE and push 
back, I get a message saying that the page isn't valid any more.

Is this an internal IE-issue, or could I make my php-script IE-friendly?

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


[PHP] Re: mysql_connect() fails randomly

2003-08-19 Thread Jon Drukman
Curt Zirzow wrote:

* Thus wrote Jon Drukman ([EMAIL PROTECTED]):
$dbh=mysql_connect() or die("mysql connect failed: " . mysql_error());
  . Ensure your error_reporting level is high enought to allow
  Warnings, and make sure display_errors is on.
  or

  . Turn on track_errors and use the variable $php_errmsg inplace
  of mysql_error().
die("mysql connecte failed: $php_errmsg");
i have warnings on.  it says "Warning: mysql_connect() failed:" and then 
there is no error message.  $php_errmsg is empty as well.

it only happens once every hundred or so connects.  it's starting to 
drive me bonkers.

-jsd-



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


RE: [PHP] "back" works in opera but not in internet explorer

2003-08-19 Thread Chris W. Parker
anders thoresson 
on Tuesday, August 19, 2003 10:51 AM said:

> Is this an internal IE-issue, or could I make my php-script
> IE-friendly? 

Does it work when you refresh the page?

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



[PHP] GPL question

2003-08-19 Thread Juan Nin
If I use Smarty or PEAR on my software, does it make my software GPL?

Thanks in advance,

Juan

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



Re: [PHP] "back" works in opera but not in internet explorer

2003-08-19 Thread Dan Anderson
> Is this an internal IE-issue, or could I make my php-script IE-friendly?

There are lots and lots of things that IE does differently then the
rest of the world.  Of course, that is because as probably the biggest
monopoly they feel no problems with breaking standards -- at least the
standards they don't make.  

This particular issue is, however, not really a standards issue.  When
a form is posted or somehting happens to automatically generate a page,
some browsers like Mozilla/Netscape will ask you if you want to reload
the page with the same info or just view the cached version.  IE just
doesn't show it.  

I usually get around this with a "go back" button on the web page that
submits to the previous web page with all the data.  Something of a pain
to code though.

-Dan


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



RE: [PHP] Delimiter WITHOUT lots of IF's

2003-08-19 Thread Cesar Aracena
Ok, That's logical, but the thing is that even $x and $n are empty, as
if the result would give a hole bunch of zeros (but it isn't).

Could there be an error in the query or somewhere around that we are all
missing?

Thanks,

Cesar

> function cart_cdqty()
> {
> 
> $query = "SELECT SUM(sess_itemsize) AS total_size
>   FROM sessions
>   WHERE sess_id = ".$_COOKIE['SID']."";
> 
> $result = mysql_query($query);
> 
> if(!$row = mysql_fetch_array($result))
> {
>return false;
> } else {
>$n = $row['total_size'];
>$x = ceil( $n / 690.0 );
> 
>$cart_cdqty = array(
>'quantity' => $x,
>'total_size' => $n
>);
> 
>return $cart_cdqty;
> }
> 
> }



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



Re: [PHP] "back" works in opera but not in internet explorer

2003-08-19 Thread Chris Shiflett
--- anders thoresson <[EMAIL PROTECTED]> wrote:
> When I push the back buttom in Opera, I get back to the previous 
> (database/php-generated) page in my site, but when I'm using IE
> and push back, I get a message saying that the page isn't valid
> any more.
> 
> Is this an internal IE-issue, or could I make my php-script
> IE-friendly?

I answered a similar question on a NYPHP mailing list recently, and you can
read my response here:

http://lists.nyphp.org/pipermail/talk/2003-August/004757.html

Hope that helps.

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

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



RE: [PHP] "back" works in opera but not in internet explorer

2003-08-19 Thread Cesar Aracena
> 
> When I push the back buttom in Opera, I get back to the previous
> (database/php-generated) page in my site, but when I'm using IE and
push
> back, I get a message saying that the page isn't valid any more.
> 
> Is this an internal IE-issue, or could I make my php-script
IE-friendly?

[Cesar Aracena]

This is just a security measure placed there by MS people. It should
work after refreshing the page. If you don't want that to appear EVER,
then you shouldn't place any session handling, cookies, $_POST and/or
$_GET into your PHP code... maybe go back to .htm?

HTH

Cesar



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



[PHP] Stripping out and URL hacking characters from a URL

2003-08-19 Thread Matt Babineau
Hi All--

Does anyone have a function or something they have already written to
remove any URL hacking characters, mainly the single quote, but I'm
looking for a nice function to filter my _GET variables against. Gotta
protect the database...ya know :)

TIA-
Matt


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



[PHP] Code formatting issue

2003-08-19 Thread James Johnson
Is there a way I can make this type of code neater?

$thing = new whatever ();

$thing->doStuff ();
$thing->anotherThing ();
$thing->doThis ();
$thing->doThat ();
$thing->doThis ();
$thing->doThat ();
$thing->anotherThing ();
$thing->doThis ();
// etc. etc.
Some languages have the construct "with", so you can so something like this:

$thing = new whatever ();

with ( $thing ) {

doStuff ();
anotherThing ();
doThis ();
doThat ();
doThis ();
doThat ();
anotherThing ();
doThis ();
// etc. etc.
}
which is much neater. Is there anyway to do this type of thing with PHP?

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


[PHP] Stripping out and URL hacking characters from a URL

2003-08-19 Thread Matt Babineau
Hi All--

Does anyone have a function or something they have already written to
remove any URL hacking characters, mainly the single quote, but I'm
looking for a nice function to filter my _GET variables against. Gotta
protect the database...ya know :)

TIA-
Matt


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



RE: [PHP] Stripping out and URL hacking characters from a URL

2003-08-19 Thread Chris W. Parker
Matt Babineau 
on Tuesday, August 19, 2003 8:10 AM said:

> Does anyone have a function or something they have already written to
> remove any URL hacking characters, mainly the single quote, but I'm
> looking for a nice function to filter my _GET variables against. Gotta
> protect the database...ya know :)

Does www.php.net/addslashes not suit your needs?


c.

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



Re: [PHP] Stripping out and URL hacking characters from a URL

2003-08-19 Thread CPT John W. Holmes
From: "Matt Babineau" <[EMAIL PROTECTED]>

> Does anyone have a function or something they have already written to
> remove any URL hacking characters, mainly the single quote, but I'm
> looking for a nice function to filter my _GET variables against. Gotta
> protect the database...ya know :)

Just escape your single quotes. That's all you need to do. Either use
addslashes() if your database requires quotes to be escaped with a
backslash, or use a str_replace() function if your database requires single
quotes to be escaped with a single quote.

---John Holmes...


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



[PHP] Iterative regular expression replacement

2003-08-19 Thread Thaddeus J. Quintin
I'm looking to replace the 'nth' instance of an expression within a string.

Example (very simple)-

$string="My mom can beat up your mom and your mom's dog";
$pattern="mom";
$replacement="dad";
I want to be able to replace any particular instance of the pattern 
within that string.  I was getting ready to do it in a very complex 
manner by finding all the matches, splitting on the pattern, and then 
breaking the string down and reassembling it in the proper order.  It 
seems like there might be an easier way to perform this though.

Anyone have any suggestions?

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


[PHP] iterative regular expression replacement

2003-08-19 Thread Thaddeus J. Quintin
I'm looking to replace the 'nth' instance of an expression within a string.

Example (very simple)-

$string="My mom can beat up your mom and your mom's dog";
$pattern="mom";
$replacement="dad";
I want to be able to replace any particular instance of the pattern 
within that string.  I was getting ready to do it in a very complex 
manner by finding all the matches, splitting on the pattern, and then 
breaking the string down and reassembling it in the proper order.  It 
seems like there might be an easier way to perform this though.

Anyone have any suggestions?

Thanks-
Thaddeus Quintin


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


Re: [PHP] How to open a save-as dialog and then redirect after donwload?

2003-08-19 Thread Jim Lucas
actually, you should be able to do this without ever leaving the page that
were clicking from.

if on the page that you are linking to, you add headers to force a download,
you should never actually GO to that page.  Your browser should realize that
it is something that it is suppose to download and then bring up the Save As
box.  This will make it so you never leave the page that you were on.

Jim Lucas


- Original Message - 
From: "Jean-Christian IMbeault" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 18, 2003 6:43 PM
Subject: [PHP] How to open a save-as dialog and then redirect after
donwload?


> I want to create the following:
>
> 1- A screen a series files and associated buttons
> 2- if the user clicks the button a "File | save as" dialog opens up
> 3- after the file the user is redirected to a new page
>
> I've gotten 1 and 2 to work but I can't figure out how to do anything
> after the file has finished downloading. I've tried header("Location: ")
> but that doesn't work because it must be used before any input is sent.
>
> The reason I want this functionality is that once a file is downloaded I
> want the screen with the buttons to refresh itself and remove the
> downloaded file from the list displayed to the user.
>
> How can I accomplish this? All suggestions welcomed!
>
> Jean-Christian Imbeault
>
>
> -- 
> 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] Multiple Results not Posting

2003-08-19 Thread Randall Gremillion
I have a form connecting to a db. I'veparsed the form
data into arrays and seperated new entries from edits
to existing entries because of the class file and db
structure. This as written, however,  will only work a
for a single record (multiple field) edit. I've stayed
up too long and am beginning to glaze over when I look
at it. Any suggestions? Comments on functionality as
well as elegance are appreciated.

Thanks in advance,
Randall Gremillion





include_once($HTTP_SERVER_VARS['DOCUMENT_ROOT'] .
"/FX/FX.php");
$serverIP = "127.0.0.1";
$vendorID = $_GET["vendorID"];
$repID = $_GET["repID"];
if ($_POST) {
$updateEntries = array();   //stores existing db
entries
$newEntries = array();  //stores new db
entriesbottom.php
$ord = -1;
$recNum = 0;
$newOrd = 0;
foreach ($_POST as $key => $value) {
if ($value != "") {
$lastPartPos  = strrchr($key, '_');
$lastPart = substr($lastPartPos, 1);
if (preg_match("/[0-9]+/" , $lastPart)) {  //if
it's an existing update
$lastpartnum = strrpos($key, '_');
$firstnum = substr($key, 0, $lastpartnum);
$first = str_replace('_', '.', $firstnum); 
//restore periods to field name and strip off record
ID at end
if ($lastPart != $recNum) {
$recNum = $lastPart;
$ord++;
}
$updateEntries[$ord][] = array($recNum, $first,
$value); //populate nested arrays of each entry
} else {
$second = str_replace('_', '.', $key);  
//create
array of new entry
$newEntries[$newOrd] = array($second, $value); 
//populate nested array of new entry
$newOrd++;
}
}
}
//add to update list
if ($newOrd > 0) {
$Adder = new FX($serverIP);
$Adder->SetDBData("Account_Reports.fp5", "All");
$Adder->AddDBParam("vendorID.calc.txt",
"$vendorID");
for ($k=0; $k < count($newEntries); $k++) {
$Adder->AddDBParam($newEntries[$k][0],
$newEntries[$k][1]);
}
$Added = $Adder->FMNew();
}
}
if (count($updateEntries)>0) {
for ($i=0; $iSetDBData("Account_Reports.fp5", "All");
$boo = $updateEntries[$i][0][0];
$$b->AddDBParam('-recid', $boo);
for ($j=0; $jAddDBParam($updateEntries[$i][$j][1],
$updateEntries[$i][$j][2]);
}
$$c = $$b->FMEdit();
}
}

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



RE: [PHP] Delimiter WITHOUT lots of IF's

2003-08-19 Thread Cesar Aracena
> 
> So it's not returning any results?
> 
> What happens when you do the following...
> 
> >> } else {
> >>$n = $row['total_size'];
>   echo ":$n:";
> 
> Put that echo statement in your code and see what happens.
> 
> If you've already done this and it prints :: (as opposed to :0: which
> would indicate a value of zero) then you're sql query is not correct
or
> there are just no rows that match what you're looking for.
> 
[Cesar Aracena] 

It does print 0 so I guess something must be wrong somewhere else. My
guess is that $row['total_size'] is not fetching anything. Shouldn't the
function contain a mysql_fetch_array somewhere?

Thanks

Cesar



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



Re: [PHP] Iterative regular expression replacement

2003-08-19 Thread CPT John W. Holmes
From: "Thaddeus J. Quintin" <[EMAIL PROTECTED]>


> I'm looking to replace the 'nth' instance of an expression within a
string.
>
> Example (very simple)-
>
> $string="My mom can beat up your mom and your mom's dog";
> $pattern="mom";
> $replacement="dad";
>
> I want to be able to replace any particular instance of the pattern
> within that string.  I was getting ready to do it in a very complex
> manner by finding all the matches, splitting on the pattern, and then
> breaking the string down and reassembling it in the proper order.  It
> seems like there might be an easier way to perform this though.
>
> Anyone have any suggestions?

Probably lots of way to do this... here's my suggestion:

' . $new_str;

?>

---John Holmes...


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



Re: [PHP] "back" works in opera but not in internet explorer

2003-08-19 Thread anders thoresson
Does it work when you refresh the page?
No. A reload in Internet Explorer kicks me out of my web application. Does 
a reload within IE reset session variables?

Reloading a page in the application using Opera works.

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


Re: [PHP] window.open("hai.php?id="one");

2003-08-19 Thread Jim Lucas
why don't you run this



Jim Lucas
- Original Message - 
From: "Martin Towell" <[EMAIL PROTECTED]>
To: "'murugesan'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, August 18, 2003 11:18 PM
Subject: RE: [PHP] window.open("hai.php?id="one");


> The same way you do any other variable passed in from a form...
>
> $_POST['id']
> or $HTTP_POST_VARS['id']
> or $id
>
> depending on your version of php and if you have register_globals on (for
> the last one)
>
> -Original Message-
> From: murugesan [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, 19 August 2003 4:14 PM
> To: Martin Towell; [EMAIL PROTECTED]
> Subject: Re: [PHP] window.open("hai.php?id="one");
>
>
>
> I have made the value hidden. How can I retrieve it in the next page
in
> php.
>
> -murugesan
>
> - Original Message -
> From: "Martin Towell" <[EMAIL PROTECTED]>
> To: "'murugesan'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Tuesday, August 19, 2003 11:21 AM
> Subject: RE: [PHP] window.open("hai.php?id="one");
>
>
> > Hiya,
> >
> > 1. Turn off the address bar
> >
> > or
> >
> > 2. Create a form with hidden elements, with method=post
> > open a window to a blank page, and name the window
> > submit the form to the newly, named, window
> >
> > HTH
> > Martin
> >
> > -Original Message-
> > From: murugesan [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, 19 August 2003 3:45 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] window.open("hai.php?id="one");
> >
> >
> > Hello all,
> > I need to pass a value from one page to another.This is done
from
> a
> > link from page 1 to page 2.
> > In that I called a php file as
> >
> > window.open("hai.php?id="one");
> > But I dont want ?id="one" to be displayed in the address bar.
> > How can I achieve this?.
> >
> > -murugesan.
> >
>
>
> -- 
> 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] "back" works in opera but not in internet explorer

2003-08-19 Thread Cesar Aracena
> 
> > This is just a security measure placed there by MS people. It should
> > work after refreshing the page.
> 
>  But it doesn't...
> 
>  Are session variables killed when an IE user presses back button?

[Cesar Aracena]

Well, They shouldn't. What are you trying to achieve? If it's something
like a FORM where the visitor fill up a lot of fields and after a
mistake is detected he is asked to go back and correct the problem, then
what you're trying to do is worthless. For that, what you should do is
pass the filled fields values using HIDDEN text fields back and forth.

If this is not the case, please tell everyone what you are trying to
accomplish so we can help you. Maybe a little piece of code wouldn't be
so bad.

Cheers,

Cesar



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



[PHP] Cache

2003-08-19 Thread Klaus Kaiser Apolinário
This is the header of my aplication



RE: [PHP] "back" works in opera but not in internet explorer

2003-08-19 Thread Chris W. Parker
anders thoresson 
on Tuesday, August 19, 2003 11:46 AM said:

>> Does it work when you refresh the page?
> 
>  No. A reload in Internet Explorer kicks me out of my web
> application. Does a reload within IE reset session variables?

No, realoading will (should) not reset the session.

But to clarify, are you getting a little dialog box that asks you to
resubmit the data or cancel? OR is it an actual error page from IE?


c.

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



RE: [PHP] Delimiter WITHOUT lots of IF's

2003-08-19 Thread Chris W. Parker
Cesar Aracena 
on Tuesday, August 19, 2003 11:38 AM said:

> Importance: High
> Sensitivity: Confidential

Is this being done by your server or by you?

> It does print 0 so I guess something must be wrong somewhere else. My
> guess is that $row['total_size'] is not fetching anything. Shouldn't
> the function contain a mysql_fetch_array somewhere?

Ok. If it prints zero that means it's (a) your SQL query works, (b) your
retrieving the value correctly from the $result.

$row['total_size'] seems to be working as expected. If it wasn't working
correctly it'd probably print "Array" or something.

You're next option would be to try print_r();


echo "";
print_r($row);
echo "";

That will show you exactly what's in $row.



c.

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



[PHP] FDF Question

2003-08-19 Thread Qian Yu
Hi, 
I am new in this php and fdf field, this is the questions when I am
trying to solve the problem of my company:
1. when fdf_create() create a new fdf file, where does it put the file?
I tried to set up the path, but it does not work like I wish.
2. when an end user fill in some data in a online form and the fdf be
created dynamically, the fdf file is on the webserver or the end user's
local machine?
please help. Thanks

Qian
IT Service Coordinator
Mississippi Home Corporation
Phone:(601)718-4619
Fax: (601)968-0204

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



Re: [PHP] Iterative regular expression replacement

2003-08-19 Thread CPT John W. Holmes
From: "Thaddeus J. Quintin" <[EMAIL PROTECTED]>
> I'm looking to replace the 'nth' instance of an expression within a
string.
>
> Example (very simple)-
>
> $string="My mom can beat up your mom and your mom's dog";
> $pattern="mom";
> $replacement="dad";
>
> I want to be able to replace any particular instance of the pattern
> within that string.  I was getting ready to do it in a very complex
> manner by finding all the matches, splitting on the pattern, and then
> breaking the string down and reassembling it in the proper order.  It
> seems like there might be an easier way to perform this though.
>
> Anyone have any suggestions?

Along with my other suggestion, if you're really looking to replace one
string with another, instead of a regular expression pattern, then you could
use this code, also:

' . $new_str;

?>

---John Holmes...


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



Re: [PHP] "back" works in opera but not in internet explorer

2003-08-19 Thread Juan Nin
look where it says "Microsoft Internet Explorer Sessions Fix" at:
http://www.phpfreaks.com/tutorials/41/1.php

regards,

Juan

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



RE: [PHP] Delimiter WITHOUT lots of IF's :: SOLVED ::

2003-08-19 Thread Cesar Aracena
> 
> > Importance: High
> > Sensitivity: Confidential
> 
> Is this being done by your server or by you?
> 

By me, because of my Company's policies and requirements. Sorry if it
bothers anyone :)

> > It does print 0 so I guess something must be wrong somewhere else.
My
> > guess is that $row['total_size'] is not fetching anything. Shouldn't
> > the function contain a mysql_fetch_array somewhere?
> 
> Ok. If it prints zero that means it's (a) your SQL query works, (b)
your
> retrieving the value correctly from the $result.

There was an error actually in the query, that was passed while copying
one of Ralph's answers. Just a Typo that I didn't saw earlier.

> 
> $row['total_size'] seems to be working as expected. If it wasn't
working
> correctly it'd probably print "Array" or something.
> 
> You're next option would be to try print_r();
> 
> 
> echo "";
> print_r($row);
> echo "";
> 
> That will show you exactly what's in $row.
> 

Thanks to everyone who helped me with this.

Cesar




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



Re: [PHP] Cache

2003-08-19 Thread Chris Shiflett
--- Klaus_Kaiser_Apolinário <[EMAIL PROTECTED]> wrote:
> But this Cache control are not working

What do you mean by not working? Something is cached that shouldn't be? Also,
you are sending multiple Cache-Control headers, sending expired dates, etc. Try
a more straightforward approach first:

header('Pragma: no-cache');
header('Cache-Control: no-cache');

Hope that helps.

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

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



Re: [PHP] "back" works in opera but not in internet explorer

2003-08-19 Thread anders thoresson
But to clarify, are you getting a little dialog box that asks you to
resubmit the data or cancel? OR is it an actual error page from IE?
I get an error page from IE saying that the page isn't valid any more (I 
think that's what IE would tell me if I was using an english version 
anyway. I'm using the swedish one, so it's just a rough translation).

What I'm trying to do is not returning to a form to resend it, but rather 
step backwards through my menu system. My menu is built by multiple forms, 
all having to following syntax:



Visa nummer
 CURDATE()";
$result  = mysql_query($query);
while ($row = mysql_fetch_row($result))
{
?>




I'm also starting every page in the system with a call to my function 
accesscontrol() that checks if certain session variables, like username and 
password, are set. If, they are validated, if not, the login page are 
shown.

Pressing reload causes the login page to show up, and that's why my guess 
is that the session variables for some reason are reseted.

Accesscontrol() is 134 lines of code, and I don't know which parts might be 
of interest here. At log in, username and password are stored to two 
session variables:

$_SESSION['uname'] = $_POST['uname'];
$_SESSION['pwd'] = $_POST['pwd'];
Everytime accesscontrol() is called, I make three if-checks:

if(isset($_SESSION['uname'])) {
	Validate already logged in users.
}
elseif(isset($_POST['uname']))
{
	Login-form just filled in. Validate.
}
else
{
	If neither $_POST['uname'] nor $_SESSION['uname'] is set, here I display 
the login form
}

And since reloads brings up the login form, $_SESSION['uname'] is not set 
anymore, for some reason.

//Anders



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


Re: [PHP] Iterative regular expression replacement

2003-08-19 Thread Thaddeus J. Quintin
Perfect solution.

Thanks, I don't know how I overlooked the preg_replace_callback 
function.  That's exactly what I needed.

Thaddeus

CPT John W. Holmes wrote:
From: "Thaddeus J. Quintin" <[EMAIL PROTECTED]>


I'm looking to replace the 'nth' instance of an expression within a
string.

Example (very simple)-

$string="My mom can beat up your mom and your mom's dog";
$pattern="mom";
$replacement="dad";
I want to be able to replace any particular instance of the pattern
within that string.  I was getting ready to do it in a very complex
manner by finding all the matches, splitting on the pattern, and then
breaking the string down and reassembling it in the proper order.  It
seems like there might be an easier way to perform this though.
Anyone have any suggestions?


Probably lots of way to do this... here's my suggestion:



//Original String
$str = 'a b c d a b c d a b c d a b c d a b c d';
//Replacement String
$replacement_string = "ff";
//Instances of search string you want replaced
//i.e. 2nd and 4th instance is array(2,4)
$instance = array(2,4);
//Callback function that manages replacements
function callback($matches)
{
//Global and static variables. $match_count is
//static to keep track of what match were currently
//operating on
global $replacement_string;
global $instance;
static $match_count = 1;
//determine if current count is in $instance array.
//if it is, set return value to replacement string,
//otherwise return matched value unchanged
if(in_array($match_count,$instance))
{ $retval = $replacement_string; }
else
{ $retval = $matches[0]; }
//increment match count
$match_count++;
//return replacement string
return $retval;
}
//replace all 'a' characters with $replacement_str (simple example)
$new_str = preg_replace_callback('/a/','callback',$str);
echo $str . '' . $new_str;

?>

---John Holmes...




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


[PHP] Re: Details

2003-08-19 Thread www-html-editor
Please see the attached file for details.
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] deleting session variables

2003-08-19 Thread Tim Winters
Is there a way to wipe out all previous session variables with one
command?
 
Thx
 
Tim Winters
Creative Development Manager
Sampling Technologies Incorporated
 
1600 Bedford Highway, Suite 212
Bedford, Nova Scotia
B4A 1E8
www.samplingtechnologies.com
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Office: 902 450 5500
Cell: 902 430 8498
Fax:: 902 484 7115
 


[PHP] Problems send MIME multipart/alternative mail with php

2003-08-19 Thread Dan Van Derveer
I have had no success sending multipart/alternative emails with php. I have
tried everyone's various code snippets with no luck. I test the results with
Outlook and Outlook Express. Everytime my boundary tag ends up showing as
part of my message and thus the plain text and html portions show up as one
long blob of unformatted text. Below is the code I am currently using. Any
suggestions would be greatly appreciated. 

Thanks,

Dan

The code:

\n"; 
$headers.= "MIME-Version: 1.0\n"; 
$headers.="Content-Type: multipart/alternative;
boundary=\"$boundry\"\n"; 
//these files have the raw message content 
$plaintext = file("plaintextcontent.txt"); 
$html = file("htmlcontent.txt"); 
//warning for non-MIME lovin' clients 

$headers .= "This message is in MIME format. Since your mail reader does not
understand this format, some or all of this message may not be
legible.\n\r\n\r"; 

// CHOP 
$message .= $boundry."\n"; 
$message .= "Content-Type: text/plain; charset=ISO-8859-1\n"; 
$message .= "Content-Transfer-Encoding: 8bit\n\r"; 
foreach($plaintext as $line) { 
$message .=$line; 
} 
$message .="\n".$boundry."\n"; 
$message .= "Content-Type: text/html; charset=ISO-8859-1\n"; 
$message .= "Content-Transfer-Encoding: 8bit\n"; 
foreach($html as $line) { 
$message .=$line; 
} 
$message .="\n".$boundry."\n"; 
mail("[EMAIL PROTECTED]","Welcome to the Website",$message,$headers); 
print $headers."".$message.""; 

?> 
 
http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shouldn't mysql_pconnect force reuse of mysql connections?

2003-08-19 Thread Curt Zirzow
* Thus wrote Curt Zirzow ([EMAIL PROTECTED]):
> * Thus wrote anders thoresson ([EMAIL PROTECTED]):
> > 
> > function db_connect ($user, $pwd, $db, $debug = 0)
> > {
> > $link = @mysql_pconnect("localhost", "$user", "$pwd");
> > if($link && mysql_select_db("$db"))
> > ... 
> >
> > I thought that making another or a third call to db_connect would reuse 
> > the same connection to the database, since I use mysql_pconnect() to 
> > connect. But listing the active processes indicates something else:
> > 
> > 
> > | Id| User  | Host  | db| Command | Time | State | Info 
> > | 64494 | thore | localhost | thore | Sleep   | 222  |   |  
> >|
> > | 64497 | thore | localhost | thore | Sleep   | 218  |   |  
> >|
> > ...
> 
> This is expected, this is the behavour of mysql. when php requests
> a pconnection, mysql will allocate a certain amount of pooled
> connections that will be used.

Sorry, php is the one doing the pooling not mysql.

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



[PHP] xmlParserInputBufferGrow: encoder error

2003-08-19 Thread Jeff Schwartz
I'm getting the following error and can't find out anything about it. Has anyone else 
gotten it? Could the "encoder" referred to be the Zend Encoder?
 
input conversion failed due to input error
Bytes: 0x90 0xBD 0xE9 0x80
xmlParserInputBufferGrow: encoder error
 
Thanks,
 
Jeff



-
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

Re: [PHP] deleting session variables

2003-08-19 Thread CPT John W. Holmes
From: "Tim Winters" <[EMAIL PROTECTED]>
> Is there a way to wipe out all previous session variables with one
> command?

With register_globals OFF:

$_SESSION = array();

If register_globals is ON and you want to get rid of $val1, $val2, $val3,
etc... then:

foreach($_SESSION as $key => $value)
{ unset($$key); }

---John Holmes...


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



[PHP] one out of four session variables lost

2003-08-19 Thread anders thoresson
$_SESSION['uname'] = $_POST['uname'];
$_SESSION['pwd'] = $_POST['pwd'];
When the user first logs in I also adds two more session variables within 
accesscontrol():

$_SESSION['editor'] = mysql_result($result,0,"u_editor");
$_SESSION['admin'] = mysql_result($result,0,"u_admin");
Both is either an Y or a N. When showing menus, I use these two session 
variables to decide wether editor and admin menus should be shown to the 
present user. Like this:

include ("schedule.php");
if ($_SESSION['editor'] == "Y")
 include ("editor.php");
if ($_SESSION['admin'] == "Y")
 include ("admin.php");
But something strange happens. Sometime, while an user who is both admin 
and editor is logged in, the $_SESSION['editor'] variable is dropped, 
causing the editor menu not being shown.
A check through all my source code shows that the only instance where I 
assign is in accesscontrol() shown above.

Are there any known circumstances where session variables are lost?

(I guess that the answer is no, and this is an error caused by myself, but 
since I can't find it, I have to ask ;)

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


[PHP] Not fair: REMOTE_HOST

2003-08-19 Thread John Taylor-Johnston
Aw gee, $_SERVER['REMOTE_HOST'] (only REMOTE_ADDR) does not exist in PHP?
Bummer.
Why is that?


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



Re: [PHP] one out of four session variables lost

2003-08-19 Thread CPT John W. Holmes
From: "anders thoresson" <[EMAIL PROTECTED]>


> > $_SESSION['uname'] = $_POST['uname'];
> > $_SESSION['pwd'] = $_POST['pwd'];
>
>  When the user first logs in I also adds two more session variables within
> accesscontrol():
>
>  $_SESSION['editor'] = mysql_result($result,0,"u_editor");
>  $_SESSION['admin'] = mysql_result($result,0,"u_admin");
>
>  Both is either an Y or a N. When showing menus, I use these two session
> variables to decide wether editor and admin menus should be shown to the
> present user. Like this:
>
>  include ("schedule.php");
>  if ($_SESSION['editor'] == "Y")
>   include ("editor.php");
>  if ($_SESSION['admin'] == "Y")
>   include ("admin.php");
>
>  But something strange happens. Sometime, while an user who is both admin
> and editor is logged in, the $_SESSION['editor'] variable is dropped,
> causing the editor menu not being shown.
>  A check through all my source code shows that the only instance where I
> assign is in accesscontrol() shown above.
>
>  Are there any known circumstances where session variables are lost?
>
>  (I guess that the answer is no, and this is an error caused by myself,
but
> since I can't find it, I have to ask ;)

I'll say that the answer is no, also. If it's a case of one session variable
being "lost" while the others remain, then it's a problem with your code.
somewhere, somehow, you're assigning a value to that session variable and
not realizing it.

If all of the session variables are lost, then it's still a problem with
your code and there are more possibilities. Perhaps the session ID isn't
being transmitted or the domain is changing?

---John Holmes...


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



[PHP] Re: Details

2003-08-19 Thread maligui
Please see the attached file for details.
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Not fair: REMOTE_HOST

2003-08-19 Thread CPT John W. Holmes
From: "John Taylor-Johnston" <[EMAIL PROTECTED]>


> Aw gee, $_SERVER['REMOTE_HOST'] (only REMOTE_ADDR) does not exist in PHP?
> Bummer.
> Why is that?

Probably to expensive to look up with every request. Look it up yourself.

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

---John Holmes...

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



[PHP] Help to redirect with variables

2003-08-19 Thread J. P.
I Guys:
I have php 4.3.1 so the global scope is off.
Reading php manual:
"...or $_GET['id'] from the URL http://www.example.com/test.php?id=3 instead
of $id..."

But I made a script writing:
$nome

And the variables goes to url:
http://localhost:8080/LivroPHP/c08p160.php?identif=15&telefon=234569878&nome
=Zequinhas

and doesn't apear on the page open even if the I wrotte:
$_GET['identif']

What is wrong?
Thanks



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



Re: [PHP] Not fair: REMOTE_HOST

2003-08-19 Thread Evan Nemerson
$_SERVER['REMOTE_HOST'] = gethostbyaddr($_SERVER['REMOTE_ADDR']);

better?



On Tuesday 19 August 2003 01:18 pm, John Taylor-Johnston wrote:
> Aw gee, $_SERVER['REMOTE_HOST'] (only REMOTE_ADDR) does not exist in PHP?
> Bummer.
> Why is that?

-- 
"Everything has a natural explanation. The moon is not a god but a great rock 
and the sun a hot rock."

-Anaxagorus


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



Re: [PHP] Not fair: REMOTE_HOST

2003-08-19 Thread Curt Zirzow
* Thus wrote CPT John W. Holmes ([EMAIL PROTECTED]):
> From: "John Taylor-Johnston" <[EMAIL PROTECTED]>
> 
> 
> > Aw gee, $_SERVER['REMOTE_HOST'] (only REMOTE_ADDR) does not exist in PHP?
> > Bummer.
> > Why is that?
> 
> Probably to expensive to look up with every request. Look it up yourself.

yes, very expensive.

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



RE: [PHP] deleting session variables

2003-08-19 Thread Tim Winters
Thanks,

So what does session_unset() do then?

Tim Winters
Creative Development Manager
Sampling Technologies Incorporated

1600 Bedford Highway, Suite 212
Bedford, Nova Scotia
B4A 1E8
www.samplingtechnologies.com
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Office: 902 450 5500
Cell: 902 430 8498
Fax:: 902 484 7115


-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] 
Sent: August 19, 2003 5:11 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] deleting session variables

From: "Tim Winters" <[EMAIL PROTECTED]>
> Is there a way to wipe out all previous session variables with one
> command?

With register_globals OFF:

$_SESSION = array();

If register_globals is ON and you want to get rid of $val1, $val2,
$val3,
etc... then:

foreach($_SESSION as $key => $value)
{ unset($$key); }

---John Holmes...


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



[PHP] mysql output

2003-08-19 Thread Anthony Ritter
The following code snippet outputs a table from a mySQL database.

In version 1, I am able to get alternating background cell colors.  However,
the output gives me the same post five times.

In version 2, I am able to receive five separate posts - which is what I'm
looking for - but I'd like to get alternating cell backgrounds.

Somewhere my syntax is failing me.

Any advice would be greatly appreciated.
Thank you.
Tony Ritter

// version 1:

You have selected an invalid topic. Please try again.";
} else {
//get the topic title
   $topic_title = stripslashes(mysql_result($verify_topic_res,0,
'topic_title'));

   //gather the posts
   $get_posts = "select post_id, post_text, date_format(post_create_time,
'%b %e %Y at %r') as fmt_post_create_time, post_owner from forum_posts where
topic_id = $_GET[topic_id] order by post_create_time asc";
   $get_posts_res = mysql_query($get_posts,$conn) or die(mysql_error());

   //create the display string
   $display_block = "
   Showing posts for the $topic_title topic:

   
   
   AUTHOR
   
   POST
   ";

   while ($posts_info = mysql_fetch_array($get_posts_res)) {
   $post_id = $posts_info['post_id'];
   $post_text = nl2br(stripslashes($posts_info['post_text']));
   $post_create_time = $posts_info['fmt_post_create_time'];
   $post_owner = stripslashes($posts_info['post_owner']);

   $i = 0;
while ($posts_info = @mysql_fetch_array($get_posts_res)) {//
begin light-dark loop
$row_class = (($i % 2) == 0) ? 'light' : 'dark';


$display_block .= "
  
   $post_owner[$post_create_time]
   $post_text
   
   ";
   $i++;

  }

}



  //close up the table
  $display_block .= "";
}
?>



p {font-family:sans arial;
   font-size: 1.25em;
}

th {
   font-family:arial;
   font-size: .75em;\
   font-color:#ff;
}

td {border:1px solid #ff;
   font-family:arial;
   font-size:.5em;
   color: #2d73b9}

.light {
  color:#000;
  background-color:#eee;
}
.dark {
  color:#000;
  background-color:#aaa;
}



Posts in Topic


Posts in Topic




.


// version 2:

You have selected an invalid topic. Please try again.";
} else {
//get the topic title
   $topic_title = stripslashes(mysql_result($verify_topic_res,0,
'topic_title'));

   //gather the posts
   $get_posts = "select post_id, post_text, date_format(post_create_time,
'%b %e %Y at %r') as fmt_post_create_time, post_owner from forum_posts where
topic_id = $_GET[topic_id] order by post_create_time asc";
   $get_posts_res = mysql_query($get_posts,$conn) or die(mysql_error());

   //create the display string
   $display_block = "
   Showing posts for the $topic_title topic:

   
   
   AUTHOR
   
   POST
   ";

   while ($posts_info = mysql_fetch_array($get_posts_res)) {
   $post_id = $posts_info['post_id'];
   $post_text = nl2br(stripslashes($posts_info['post_text']));
   $post_create_time = $posts_info['fmt_post_create_time'];
   $post_owner = stripslashes($posts_info['post_owner']);

   //add to display
   $display_block .= "
   
   $post_owner[$post_create_time]
   $post_text
   REPLY TO
POST
   ";
   }

  //close up the table
  $display_block .= "";
}
?>



p {font-family:sans arial;
   font-size: 1.25em;
}

th {
   font-family:arial;
   font-size: .75em;\
   font-color:#ff;
}

td {border:1px solid #ff;
   font-family:arial;
   font-size:.5em;
   color: #2d73b9}

.light {
  color:#000;
  background-color:#eee;
}
.dark {
  color:#000;
  background-color:#aaa;
}



Posts in Topic


Posts in Topic







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



Re: [PHP] deleting session variables

2003-08-19 Thread Curt Zirzow
* Thus wrote Tim Winters ([EMAIL PROTECTED]):
> Thanks,
> 
> So what does session_unset() do then?

John overlooked that function, and instead looped through the
variables in php instead.  This would be used if you have
register_globals on and choose to use sessions insecurely.

> 
> -Original Message-
> From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] 
> Sent: August 19, 2003 5:11 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: [PHP] deleting session variables
> 
> 
> If register_globals is ON and you want to get rid of $val1, $val2,
> $val3,
> etc... then:
> 
> foreach($_SESSION as $key => $value)
> { unset($$key); }
> 

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] deleting session variables

2003-08-19 Thread CPT John W. Holmes
From: "Tim Winters" <[EMAIL PROTECTED]>

> So what does session_unset() do then?

Ah, good catch. Use that instead of my second example. If register_globals
is ON, it appears that session_unset() will take care of getting rid of the
global variables made.

---John Holmes...

> From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
> Sent: August 19, 2003 5:11 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: [PHP] deleting session variables
>
> From: "Tim Winters" <[EMAIL PROTECTED]>
> > Is there a way to wipe out all previous session variables with one
> > command?
>
> With register_globals OFF:
>
> $_SESSION = array();
>
> If register_globals is ON and you want to get rid of $val1, $val2,
> $val3,
> etc... then:
>
> foreach($_SESSION as $key => $value)
> { unset($$key); }
>
> ---John Holmes...
>
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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



Re: [PHP] mysql output

2003-08-19 Thread Curt Zirzow
* Thus wrote Anthony Ritter ([EMAIL PROTECTED]):
> The following code snippet outputs a table from a mySQL database.
> 
> [snipped 255+ lines of code]

That is way to much information, please be a brief in your code
that you post.  You'll find you'll get more people to analyze your
code.

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] GPL question

2003-08-19 Thread Evan Nemerson
Smarty is LGPL, not GPL. The LGPL allows linking. So no.

PEAR packages typically use the PHP license, but some do use GPL. If you link 
to a GPL'd package, you must GPL your package. Otherwise, no.

So unless you link to a GPL'd PEAR package, the answer is no.

Read:
http://www.gnu.org/licenses/gpl-faq.html



On Tuesday 19 August 2003 10:57 am, Juan Nin wrote:
> If I use Smarty or PEAR on my software, does it make my software GPL?
>
> Thanks in advance,
>
> Juan

-- 
"This job would be great if it weren't for the fucking customers..."

-Unknown


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



Re: [PHP] mysql output

2003-08-19 Thread CPT John W. Holmes
From: "Curt Zirzow" <[EMAIL PROTECTED]>


> * Thus wrote Anthony Ritter ([EMAIL PROTECTED]):
> > The following code snippet outputs a table from a mySQL database.
> >
> > [snipped 255+ lines of code]
>
> That is way to much information, please be a brief in your code
> that you post.  You'll find you'll get more people to analyze your
> code.

You also asked a very, very common question, i.e. how to alternate colors in
table rows... there are a ton of websites/tutorials out there that explain
ways to do this.

---John Holmes...


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



Re: [PHP] Code formatting issue

2003-08-19 Thread Decapode Azur

this way may be what you'd like :

  $thing = new whatever ();

  $with = array (doStuff', anotherThing', doThis', doThat', doThis',
doThat', anotherThing', doThis', /* etc. etc. */ );

  foreach($with as $w) $thing->$w();


-- 
> Is there a way I can make this type of code neater?
>
>  $thing = new whatever ();
>
>  $thing->doStuff ();
>  $thing->anotherThing ();
>  $thing->doThis ();
>  $thing->doThat ();
>  $thing->doThis ();
>  $thing->doThat ();
>  $thing->anotherThing ();
>  $thing->doThis ();
>  // etc. etc.
>
>
> Some languages have the construct "with", so you can so something like
> this:
>
>  $thing = new whatever ();
>
>  with ( $thing ) {
>
>   doStuff ();
>   anotherThing ();
>   doThis ();
>   doThat ();
>   doThis ();
>   doThat ();
>   anotherThing ();
>   doThis ();
>  // etc. etc.
>  }
>
> which is much neater. Is there anyway to do this type of thing with PHP?


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



[PHP] Re: That movie

2003-08-19 Thread mv
See the attached file for details
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] in the middle of shift and pop

2003-08-19 Thread Decapode Azur
is it possible to remove an element of an indexed array such as this exemple
$A = array('a', 'b', 'c', 'd', 'e', 'f');
in a way that we can optain this result :
$A = array('a', 'b', 'd', 'e', 'f');

something like that perhaps ?
array_remove($A, 2);

If such a function does not exists, what would be the more efficient way to 
do so a lot of time on very big arrays ?



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



[PHP] is the list getting virus spammed?

2003-08-19 Thread Matt Babineau
Hmmwondering why I keep receiving email sent to the list, that has
this stupid attachment...anyone else getting these?

Matt


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



Re: [PHP] in the middle of shift and pop

2003-08-19 Thread andu
On Wed, 20 Aug 2003 00:25:32 +0200
Decapode Azur <[EMAIL PROTECTED]> wrote:

> is it possible to remove an element of an indexed array such as this
> exemple
>   $A = array('a', 'b', 'c', 'd', 'e', 'f');
> in a way that we can optain this result :
>   $A = array('a', 'b', 'd', 'e', 'f');
> 
> something like that perhaps ?
> array_remove($A, 2);
> 
> If such a function does not exists, what would be the more efficient
> way to do so a lot of time on very big arrays ?

unset(array[x]);

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


-- 
Andu

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



  1   2   >