Re: [PHP] explode string at new line

2007-06-05 Thread Paul Novitski

At 6/5/2007 10:50 PM, Jim Lucas wrote:

Windows uses \r\n newlines; *nix uses \n; Mac uses \r.

...

PHP Code:
$txt = preg_replace('/\r\n|\r/', "\n", $txt);



Another way to write that PCRE pattern is /\r\n?/ (one carriage 
return followed by zero or one linefeed).


I recall also running into \n\r although I can't recall which system uses it.

As an alternative to PCRE, we can pass arrays to PHP's replace functions, e.g.:

$txt = str_replace(array("\r\n", "\n\r", "\r"), "\n", $txt);

Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re: [PHP] undefined GD function [SOLVED]

2007-06-05 Thread C.R.Vegelin
Thanks for your advice, 


As mentioned, I am using IIS 5.1 and ..
the problem was solved "after" restarting my machine.
BTW, IIS can also restarted with iisreset.

Regards, Cor


- Original Message - 
From: "Richard Lynch" <[EMAIL PROTECTED]>

To: "C.R.Vegelin" <[EMAIL PROTECTED]>
Cc: "[EMAIL PROTECTED]" 
Sent: Tuesday, June 05, 2007 11:30 PM
Subject: Re: [PHP] undefined GD function



getimagesize is okay, because it's not really really a GD function,
even though it's lumped in there...

Did you restart Apache? (or the whole machine if you run IIS)?

On Mon, June 4, 2007 5:38 am, C.R.Vegelin wrote:

Hi All,

I am testing some GD functions, but I'm getting "undefined function"
errors.
I checked php.ini and changed
;extension=php_gd2.dll
to
extension=php_gd2.dll

The php.ini file contains: extension_dir = "c:/php/ext"
and this directory does contain php_gd2.dll (version 5.2.0.0)
I am using Windows XP, PHP 5.2.0 and IIS 5.1.

The function getimagesize($filename); is okay,
but imagecreatetruecolor($width, $height); says "undefined function".

I would appreciate some hints.

TIA, Cor







--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?




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



Re: [PHP] explode string at new line

2007-06-05 Thread Chris

Jim Lucas wrote:

Chris wrote:

Davi wrote:

Em Terça 05 Junho 2007 23:52, [EMAIL PROTECTED] escreveu:

That's exactly correct. Except I /think/ you should use "\n" instead of
'\n'.



Thank you for the reply... =)

I'll check this... BTW:

array explode ( string $delimiter, string $string [, int $limit] )

So, I was wrong...
The right way, probaly, is:

$str=explode("\n",$_POST["my_text"]);


If it's coming from a  you'll want to use "\r\n" because a 
textarea uses both a carriage return (\r) and newline (\n) to separate.


Otherwise each element of the array will have a \r on the end which 
may end up causing you some issues later on.


I was wondering about this, I seem to recall that window/mac/*nix all do 
it differently.


With a little Google'ing I came across this.

http://www.sitepoint.com/forums/printthread.php?t=54074

This was written in 2002, so I am not sure about the Mac = "\r".
Since they are using *nix now, it could be "\n" not sure

But the article had this to say:

Line breaks
People want to know how they can retain textarea line breaks in HTML. 
You should store text in the database in its original format (e.g. with 
just newlines) and then use nl2br() to convert newlines to HTML  
tags on display (thanks to the people here for teaching me that :)). 
That's all good, except for one problem with nl2br(): it doesn't seem to 
convert \r newlines (edit: this has now been fixed in PHP 4.2.0).


Windows uses \r\n newlines; *nix uses \n; Mac uses \r.

nl2br() works correctly on text from Windows/*nix because they contain 
\n. However, if you get text from a Mac, nl2br() will not convert its 
newlines (again, fixed in PHP 4.2.0). To remedy this, I use the 
following bit of code to convert \r\n or \r to \n before inserting it 
into the database. It won't hurt anything and ensures that nl2br() will 
work on the \n only newlines on display. Also, it has the side effect of 
saving 1 byte in the database per newline from Windows (by storing only 
\n instead of \r\n). :)


PHP Code:
$txt = preg_replace('/\r\n|\r/', "\n", $txt);


Fair enough :)

I guess my thinking was since a textarea is a html 'standard' it would 
be consistent across all browsers/systems. I guess not :)


--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] export to csv

2007-06-05 Thread Jim Lucas

Haig (Home) wrote:

Hi everyone, I have a small problem when exporting mysql into csv format.

 


The export works fine. The problem is, if the mysql table has a carriage
return, opening the csv file in excel will display a square box where the
carriage return is.

 


Displaying the table on a web page is fine.

 


Thanks for any help.

 


Haig

 


 


$csv_output = 'column1';

$csv_output .= "\015\012";

$result = mysql_query("select * from table"); 

while($row = mysql_fetch_array($result)) 


   {

  $csv_output .= '"'.$row[column1].'"';



In a more recent post, the op asked a question that is related to this, 
in a way.


Here is what I think your solution would look like

$data = preg_replace("!\r\n|\n|\r!", "\r\n", $row['column1']);
$csv_output .= '"' . $data . '"';

Reason being is that Windows uses "\r\n" for line endings.  More than 
likely you are outputting "\n"  This would cause windows to display one 
of those funky boxes that you are talking about.


PS. be sure and use quotes around your array key names, otherwise you 
might cause a PHP Notice on different systems.




  $csv_output .= "\015\012";

   }

header("Content-type: application/vnd.ms-excel");

header("Content-disposition:  attachment; filename=" .

date("Y-m-d")."_my_report".".csv");

   print $csv_output;

   exit;  


mysql_close();

   }

 





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



Re: [PHP] explode string at new line

2007-06-05 Thread Jim Lucas

Chris wrote:

Davi wrote:

Em Terça 05 Junho 2007 23:52, [EMAIL PROTECTED] escreveu:

That's exactly correct. Except I /think/ you should use "\n" instead of
'\n'.



Thank you for the reply... =)

I'll check this... BTW:

array explode ( string $delimiter, string $string [, int $limit] )

So, I was wrong...
The right way, probaly, is:

$str=explode("\n",$_POST["my_text"]);


If it's coming from a  you'll want to use "\r\n" because a 
textarea uses both a carriage return (\r) and newline (\n) to separate.


Otherwise each element of the array will have a \r on the end which may 
end up causing you some issues later on.


I was wondering about this, I seem to recall that window/mac/*nix all do 
it differently.


With a little Google'ing I came across this.

http://www.sitepoint.com/forums/printthread.php?t=54074

This was written in 2002, so I am not sure about the Mac = "\r".
Since they are using *nix now, it could be "\n" not sure

But the article had this to say:

Line breaks
People want to know how they can retain textarea line breaks in HTML. 
You should store text in the database in its original format (e.g. with 
just newlines) and then use nl2br() to convert newlines to HTML  
tags on display (thanks to the people here for teaching me that :)). 
That's all good, except for one problem with nl2br(): it doesn't seem to 
convert \r newlines (edit: this has now been fixed in PHP 4.2.0).


Windows uses \r\n newlines; *nix uses \n; Mac uses \r.

nl2br() works correctly on text from Windows/*nix because they contain 
\n. However, if you get text from a Mac, nl2br() will not convert its 
newlines (again, fixed in PHP 4.2.0). To remedy this, I use the 
following bit of code to convert \r\n or \r to \n before inserting it 
into the database. It won't hurt anything and ensures that nl2br() will 
work on the \n only newlines on display. Also, it has the side effect of 
saving 1 byte in the database per newline from Windows (by storing only 
\n instead of \r\n). :)


PHP Code:
$txt = preg_replace('/\r\n|\r/', "\n", $txt);

Hope this helps

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



Re: [PHP] explode string at new line

2007-06-05 Thread Davi
Em Quarta 06 Junho 2007 00:18, Chris escreveu:
> Davi wrote:
> > Em Terça 05 Junho 2007 23:52, [EMAIL PROTECTED] escreveu:
> >> That's exactly correct. Except I /think/ you should use "\n" instead of
> >> '\n'.
> >
> > So, I was wrong...
> > The right way, probaly, is:
> >
> > $str=explode("\n",$_POST["my_text"]);
>
> If it's coming from a  you'll want to use "\r\n" because a
> textarea uses both a carriage return (\r) and newline (\n) to separate.
>
> Otherwise each element of the array will have a \r on the end which may
> end up causing you some issues later on.
>

Yes. Is a textarea. Thank you very much! =D


-- 
Davi Vidal
[EMAIL PROTECTED]
[EMAIL PROTECTED]
--
"Religion, ideology, resources, land,
spite, love or "just because"...
No matter how pathetic the reason,
it's enough to start a war. "

Por favor não faça top-posting, coloque a sua resposta abaixo desta linha.
Please don't do top-posting, put your reply below the following line.



pgpctEzLbMQgx.pgp
Description: PGP signature


Re: [PHP] explode string at new line

2007-06-05 Thread Chris

Davi wrote:

Em Terça 05 Junho 2007 23:52, [EMAIL PROTECTED] escreveu:

That's exactly correct. Except I /think/ you should use "\n" instead of
'\n'.



Thank you for the reply... =)

I'll check this... BTW:

array explode ( string $delimiter, string $string [, int $limit] )

So, I was wrong...
The right way, probaly, is:

$str=explode("\n",$_POST["my_text"]);


If it's coming from a  you'll want to use "\r\n" because a 
textarea uses both a carriage return (\r) and newline (\n) to separate.


Otherwise each element of the array will have a \r on the end which may 
end up causing you some issues later on.


--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] explode string at new line

2007-06-05 Thread Davi
Em Terça 05 Junho 2007 23:52, [EMAIL PROTECTED] escreveu:
> That's exactly correct. Except I /think/ you should use "\n" instead of
> '\n'.
>

Thank you for the reply... =)

I'll check this... BTW:

array explode ( string $delimiter, string $string [, int $limit] )

So, I was wrong...
The right way, probaly, is:

$str=explode("\n",$_POST["my_text"]);


Thank you very much.


-- 
Davi Vidal
[EMAIL PROTECTED]
[EMAIL PROTECTED]
--
"Religion, ideology, resources, land,
spite, love or "just because"...
No matter how pathetic the reason,
it's enough to start a war. "

Por favor não faça top-posting, coloque a sua resposta abaixo desta linha.
Please don't do top-posting, put your reply below the following line.



pgpS3oEAG6jIw.pgp
Description: PGP signature


Re: [PHP] explode string at new line

2007-06-05 Thread heavyccasey

That's exactly correct. Except I /think/ you should use "\n" instead of '\n'.

On 6/5/07, Davi <[EMAIL PROTECTED]> wrote:


Hi all.

I've the fowlling string:

$_POST["my_text"]="hi...\nthis is my multi-line\ntext";

Can I use explode to have something like:

$str[0]="hi...";
$str[1]="this is my multi-line";
$str[2]="text";

$str=explode($_POST["my_text"],'\n');


TIA and sorry the *very* poor english.


--
Davi Vidal
[EMAIL PROTECTED]
[EMAIL PROTECTED]
--
"Religion, ideology, resources, land,
spite, love or "just because"...
No matter how pathetic the reason,
it's enough to start a war. "

Por favor não faça top-posting, coloque a sua resposta abaixo desta linha.
Please don't do top-posting, put your reply below the following line.





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



[PHP] explode string at new line

2007-06-05 Thread Davi

Hi all.

I've the fowlling string:

$_POST["my_text"]="hi...\nthis is my multi-line\ntext";

Can I use explode to have something like:

$str[0]="hi...";
$str[1]="this is my multi-line";
$str[2]="text";

$str=explode($_POST["my_text"],'\n');


TIA and sorry the *very* poor english.


-- 
Davi Vidal
[EMAIL PROTECTED]
[EMAIL PROTECTED]
--
"Religion, ideology, resources, land,
spite, love or "just because"...
No matter how pathetic the reason,
it's enough to start a war. "

Por favor não faça top-posting, coloque a sua resposta abaixo desta linha.
Please don't do top-posting, put your reply below the following line.



pgpwspUVrKaj0.pgp
Description: PGP signature


Re: [PHP] Draw function diagram

2007-06-05 Thread Khorosh Irani

Hi
I worked alittle with gd
It is my code for y(x)=sin(x)+cos(x):

   function Graph($rangeLow, $rangeHigh, $step)
   {
   $img = ImageCreate($this->width, $this->height);
   $background_color = imagecolorallocate($img, 0, 0, 0);
   $white = ImageColorAllocate($img, 255, 255, 255);
   imageline($img, $this->width/2, 0,$this->width/2 , $this->height,
$white);
   imageline($img, 0, $this->height/2, $this->width, $this->height/2,
$white);
   for ($x=rangeLow;$x<=$rangeHigh,$x+=$step)
   {
y=sin(x)*cos(x);//custom function
//i dont know what should write here but i know that I should
write imageline() function
}
   header("Content-type: image/jpeg");
   ImageJpeg($img);
   imagedestroy($img);
   }


could anyone write a simple code that complete this code
I want to learn it
I dont want to use any software package
Thanks


On 6/6/07, Richard Lynch <[EMAIL PROTECTED]> wrote:


On Tue, June 5, 2007 4:36 pm, Khorosh Irani wrote:
> Hello
> I have a function like (y(x)=sin(x)) that i convert it to post fix and
> then
> execute it.means that i coud get y for each x value
> now I have a simple question
> I want to draw diagram of function.
> how I should do this
> I dont work with gd and also i donot now how I should done this.but i
> think
> that i should get a range for x and get y for each x but i dont know
> how I
> shold draw diagram after this

Start working with GD would be my first answer...

If you can't use GD, then I would guess that somewhere "out there"
there may exist a software package that you can pass "sin(x)" to it,
and it will create a graph for you...  No idea what it's called,
though...

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?




[PHP] php_ldap.dll and PHP 4.4.7

2007-06-05 Thread Mike Walsh
I have upgraded my development area to PHP 4.4.7 and I can no longer use the 
LDAP extension.  I only have 4-5 extensions enabled (GD2, PDF, ZIP, IMAP, 
LDAP) but I get the following error from LDAP:

PHP Warning: Unknown(): Unable to load dynamic library 
'./extensions\php_ldap.dll' - The specified module could not be found. in 
Unknown on line 0

All of the other extensions are loaded just fine.  Anyone know what is 
causing this?  The extension is where it is supposed to be.

Mike


-- 
Mike Walsh - mike underscore walsh at mindspring dot com 

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



Re: [PHP] Which simple XML functions to use?

2007-06-05 Thread Jochem Maas
Marten Lehmann wrote:
> Hello,
> 
> mostly dealing with XML through the Perl-module XML::Simple I'm looking
> for a simple solution within PHP. PHP4 and PHP5 is available but the DOM
> XML-stuff seems to be bloated.
> 
> What I'm looking is a function that receives an XML-document as a
> string, which parses the document which all its tags and attributes and
> which then returns an associative array.
> 
> Is there anything available which comes close to my expectations?

simpleXML, which although it actually returns objects allows array like
access by virtue of the fact that the objects implement the necessary array 
overload
interfaces available in SPL.

some usage examples:
http://lerdorf.com/php/flickr_api.phps
http://talks.php.net/show/torkey06/16

http://www.devshed.com/c/a/PHP/Loading-XML-Strings-with-simpleXML-in-PHP-5/1/

> 
> Regards
> Marten
> 

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



[PHP] Which simple XML functions to use?

2007-06-05 Thread Marten Lehmann

Hello,

mostly dealing with XML through the Perl-module XML::Simple I'm looking 
for a simple solution within PHP. PHP4 and PHP5 is available but the DOM 
XML-stuff seems to be bloated.


What I'm looking is a function that receives an XML-document as a 
string, which parses the document which all its tags and attributes and 
which then returns an associative array.


Is there anything available which comes close to my expectations?

Regards
Marten

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



Re: [PHP] Making thumbs same size

2007-06-05 Thread Richard Lynch
On Mon, June 4, 2007 1:44 am, Humani Power wrote:
> Hey hi!!.
> //get dimensions of the thumbnail
>
> $thumb_width=$width*0.10;
> $thumb_height=$height*.10;

It's really up to YOU to choose the thumbnail constant size
and to decide what to do about the aspect ratio
You could crop or fill with black, or transparent or...

But making the thumbnail be 1/10th the original is your problem.

Here is one possibility:
$thumb_width = 50;
$thumb_height = ($height/$width) * 50;
You now have an image 50 wide and proportional height to the original.

Here is another:
$thumb_height = 50;
$thumb_width = ($width/$height) * 50;
That one is 50 tall and proptional width to original.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] indexes and arrays

2007-06-05 Thread Richard Lynch


On Tue, June 5, 2007 10:01 am, blueboy wrote:
>I have an array of facilities, how do I define them all in one go
> so I do
> not get the undefined index error?
>
>

http://php.net/isset

You also could make an array of checkboxes instead of hand-typing all
that...

$facilities = array(5=>'Credit Cards Accepted', 6=>'Towels',
7=>'Luggage Storage');

foreach($facilities as $f_id => $f_name){
  $checked = isset($_POST['facilitiies'][$f_id]) ? 'checked="checked"
: '';
  ?>
/> input name="facilities[5] " type="checkbox" id="facilities[5] "
> value="Credit Cards Accepted"  echo
> 'checked="checked" '; }?>>
>   Credit Cards Accepted 
>  value="Towels"  'checked="checked" '; }?>>
>   Towels 
>  value="Luggage Storage"  'checked="checked" '; }?>>
>   Luggage Storage 
>  value="Telephone/Fax Facilities"  ($_POST['facilities'][8]!='') {
> echo 'checked="checked" '; }?>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] returning the index number part2

2007-06-05 Thread Richard Lynch
This will tell you how:


On Tue, June 5, 2007 11:16 am, blueboy wrote:
>
> if I have an array of  3  images
>
> 
> 
>  1.
> 
> 
> 
>  2.
> 
> 
> 
> 3.
> 
> 
> 
> 
> How do I access the filename? Like this?
>
> echo $fileName1 = $_FILES['userfile']['name'][0];
> echo $fileName2 = $_FILES['userfile']['name'][1];
> echo $fileName3 = $_FILES['userfile']['name'][2];
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] works in 4.4.2 - breaks in 5.2.1

2007-06-05 Thread Richard Lynch
Does the xmlString print out?

Cuz my first guess is they turned off RAW_POST_DATA in the upgrade, so
it's just blank...

On Tue, June 5, 2007 11:34 am, Jim Berkey wrote:
> I'm familiar with actionscript, but pretty new to php . . .I have a
> guestbook script that worked fine until my host upgraded to php 5.2.1
> - can anyone tell me what part of my if statement or variable is
> breaking in 5.2.1? I send the new data with Flash using
> xml.sendAndLoad, to the xml file via standalone php file shown below.
> tia,
> jimbo
>
>  $file = fopen("guestbook.xml", "w+") or die("Can't open XML file");
> $xmlString = $HTTP_RAW_POST_DATA;
> if(!fwrite($file, $xmlString)){
> print "Error writing to XML-file";
> }
> print $xmlString."\n\n";
> fclose($file);
>
> exit;
> ?>
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Strings

2007-06-05 Thread Richard Lynch
It would really help if you didn't use funky characters for quote that
aren't quote in your email.

It would help even more if you copy/paste your actual script.

On Tue, June 5, 2007 12:50 pm, Steve Marquez wrote:
> The following code works:
>
> 
> $image = ³²;
>
> if ($image == NULL) {
> print ³False!²;
> }else{
> print ³$var²;
> }
>
> ?>
>
> However, this does not:
>
> 
> $image = ³²;
>
> if ($image == NULL) {
> print ³False!²;
> }else{
> print ³²;
> }
>
> ?>
>
> It seems that if I add a string, rather than just the variable, then
> does
> not work. I am getting an unexpected T_IS_EQUAL error.
>
> --
> Thanks,
> Steve Marquez
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] undefined GD function

2007-06-05 Thread Richard Lynch
getimagesize is okay, because it's not really really a GD function,
even though it's lumped in there...

Did you restart Apache? (or the whole machine if you run IIS)?

On Mon, June 4, 2007 5:38 am, C.R.Vegelin wrote:
> Hi All,
>
> I am testing some GD functions, but I'm getting "undefined function"
> errors.
> I checked php.ini and changed
> ;extension=php_gd2.dll
> to
> extension=php_gd2.dll
>
> The php.ini file contains: extension_dir = "c:/php/ext"
> and this directory does contain php_gd2.dll (version 5.2.0.0)
> I am using Windows XP, PHP 5.2.0 and IIS 5.1.
>
> The function getimagesize($filename); is okay,
> but imagecreatetruecolor($width, $height); says "undefined function".
>
> I would appreciate some hints.
>
> TIA, Cor
>
>
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Security for uploaded PDF files

2007-06-05 Thread Richard Lynch
On Mon, June 4, 2007 7:37 am, Al wrote:
> I have an application, with mild security, that approved users can
> upload pdf
> files.  Obviously, the security for executables with a simple pdf
> extension
> bothers me.
>
> I's like some suggestions on how I can protect against errant files
> with a pdf
> guise?

PDF files have to start with %PDF and the version number, for starters.

You could also try to run them through xpdf and see if it bitches or
not -- I think it even has a command line switch to do just that.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Double checking - I should turn off "magic quotes"

2007-06-05 Thread Richard Lynch
On Mon, June 4, 2007 9:25 am, Dave M G wrote:
> Since my database is MySQL, does that mean using addslashes() and
> stripslashes()? In other words manually doing what magic quotes was
> doing automatically?

Please start reading here:
http://phpsec.org

And, for the record, no, addslashes is NOT the right answer for MySQL.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Double checking - I should turn off "magic quotes"

2007-06-05 Thread Richard Lynch
On Mon, June 4, 2007 9:02 am, Dave M G wrote:
> I've read on the manual that it's "preferred to code with magic quotes
> off and to instead escape the data at runtime, as needed":
>
> Recently, while configuring my PHP so as to install the GD libraries,
> that the default option was to have magic quotes turned on.

What version of PHP did you install?...

I'm pretty sure they turned MQ off by default in PHP5...

> I just want to double check here what to do. Should I disable magic
> quotes on my server?

YES!

Turn the dang thing off!

> Also, I'm developing code that I hope others can use. For the purposes
> of portability, is it safe to assume that most environments will have
> magic quotes off, and build for that?

Nope.

Use something not unlike:
if (ini_get('magic_quotes_gpc')){
  array_map('stripslashes', $_GET);
  array_map('stripslashes', $_POST);
  array_map('stripslashes', $_COOKIE);
  array_map('stripslashes', $_REQUEST);
}

> So I should disable magic quotes on my testing environment and do my
> own
> escaping?

Yes.

The issue is that you want to FILTER and VALIDATE before you ESCAPE,
and you only want to ESCAPE the data actually going into the DB, and
use the correct escape function for that DB.

> While I'm asking about escaping, is converting characters like
> apostrophes and ampersands to hex characters before storing them in a
> MySQL database a safe way to go?

Don't try to roll your own.  Use mysql_real_escape_string

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Removing a row from an Array

2007-06-05 Thread Richard Lynch
On Mon, June 4, 2007 2:13 pm, Ken Kixmoeller -- reply to
[EMAIL PROTECTED] wrote:
> Hey - - - - - - --
>
> To do this, I am:
>
>   - looping through the array
>   - copying the rows that I want to *keep* to a temp array, and
>   - replacing the original array with the "temp' one.
>
> Seems convoluted, but I couldn't find any function to remove a row of
> an array. Am I missing something (other than a few brain cells)?

http://php.net/unset

As in, unset($array['goner']);

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Fwd: php5 and sendmail

2007-06-05 Thread Richard Lynch
On Mon, June 4, 2007 5:09 pm, Jim Lucas wrote:
>> ; For Unix only.  You may supply arguments as well (default:
>> "sendmail -t
>> -i").
>> sendmail_path = /usr/sbin/sendmail

Is /usr/bin/sendmail where it actually is?
Should be, but you never know with distros like FC6

Do you not need the -t and/or -i bits?
sendmail_path = "/usr/bin/sendmail -t -i"

Hmmm.  Mine has the -t bit and not -i bit.  Guess you need whatever
you need on your server, with your sendmail setup...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Fwd: php5 and sendmail

2007-06-05 Thread Richard Lynch
On Mon, June 4, 2007 4:55 pm, Arvind Autar wrote:
> Firstly, I'm not subcsribed so please CC me.
>
> The issue, I'm running FC6 with php5 and sendmail. I can use mail and
> send
> mail with client inlc telnet sessions. However, mailing with php is
> just not
> working.
>
> This is what I'm using.
>
>  // The message
> $message = "Line 1\nLine 2\nLine 3";
>
> // In case any of our lines are larger than 70 characters, we should
> use
> wordwrap()
> $message = wordwrap($message, 70);
>
> // Send
> mail('[EMAIL PROTECTED]', 'My Subject', $message);
> ?>
>
> Anyone got a clue?

Here are some clues:

Show us EXACTLY what you have in php.ini for the sendmail setting.

Check your sendmail logs to see what happens when PHP tries to send
email.

su to the PHP User and try to send email from the command line.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Printing MSSQL-Query ERROR description in PHP

2007-06-05 Thread Richard Lynch
On Mon, June 4, 2007 11:02 pm, karthi keyan wrote:
>   Is there any way to print the reason why the query has been failed,
> like the way MySQL-PHP has mysql_error()?

Gee, I dunno.

You think there might be?

Maybe it's in the manual?!

http://us2.php.net/manual/en/ref.mssql.php

There are only 40 functions there.

You are already using at least 5 of those, if you have anything
working at all.

20 of them are so obviously named that they cannot possibly be what
you want.

Did you put even 10 SECONDS into this before posting?!

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] TableName with space

2007-06-05 Thread Richard Lynch
On Mon, June 4, 2007 11:51 pm, karthi keyan wrote:

>   How can I create a table with spaces "Order details" in MSSQL using
> PHP?
>   I am able to create manually the table name with space by providing
> the name in Double Quotes. Is there a way out to do this using PHP?

If it worked manually with double quotes, then it probably would work
in PHP with double quotes...

$query = "create table \"Dumb Idea\" (dumb_id int)";

PHP pretty much just passes the query to the MSSQL program, and it's
up to MSSQL to accept/reject it.

If that doesn't work, try ` in place of \"

I think it's daft to create table names with spaces, but there ya go.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Draw function diagram

2007-06-05 Thread Richard Lynch
On Tue, June 5, 2007 4:36 pm, Khorosh Irani wrote:
> Hello
> I have a function like (y(x)=sin(x)) that i convert it to post fix and
> then
> execute it.means that i coud get y for each x value
> now I have a simple question
> I want to draw diagram of function.
> how I should do this
> I dont work with gd and also i donot now how I should done this.but i
> think
> that i should get a range for x and get y for each x but i dont know
> how I
> shold draw diagram after this

Start working with GD would be my first answer...

If you can't use GD, then I would guess that somewhere "out there"
there may exist a software package that you can pass "sin(x)" to it,
and it will create a graph for you...  No idea what it's called,
though...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



RE: [PHP] Draw function diagram

2007-06-05 Thread Jay Blanchard
[snip]
I want to draw diagram of function.
how I should do this
I dont work with gd ...
[/snip]

You will have to work with GD unless you want to do a text plot

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



[PHP] Draw function diagram

2007-06-05 Thread Khorosh Irani

Hello
I have a function like (y(x)=sin(x)) that i convert it to post fix and then
execute it.means that i coud get y for each x value
now I have a simple question
I want to draw diagram of function.
how I should do this
I dont work with gd and also i donot now how I should done this.but i think
that i should get a range for x and get y for each x but i dont know how I
shold draw diagram after this
Thanks
Excuse me for my bad english


Re: [PHP] Strings

2007-06-05 Thread Jochem Maas
Pastor Steve wrote:
> Thank you. 
> 
> I tried what you suggested below and it gave me an unexpected
> T_CONSTANT_ESCAPED_STRING error.
> 
> Would this be valid: (I am typing in my Entourage, but I am writing the code
> in Dreamweaver. You are probably seeing the quotes that Entourage (my email
> application) is giving you.)
> 
> > $image = "";
>> if ($image == NULL) {
>> print "False";
>> } else {
>>
>> ?>
>> 
>> >
>> }
>>
> ?>
> 
> It works if $image is not NULL. However, if it is empty, then it gives me an

$image is never NULL in your example - empty is not exactly the same as NULL,
although NULL is considered empty.

anyway, just for fun chew on this and see if something sticks:

';
}

?>

> error. I am very much so a novice and appreciate your patience.

okay novice - post the error - even gurus (thats not me) can't mind read. :-

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



Re: [PHP] Strings

2007-06-05 Thread Steve Marquez
I got it to work! I just had to place the HTML elements outside of the PHP
code.

Thanks for your help.

--
Steve Marquez

on 6/5/07 2:02 PM Jochem Maas ([EMAIL PROTECTED]) wrote:

> Robert Cummings wrote:
>> > On Tue, 2007-06-05 at 19:57 +0200, Jochem Maas wrote:
>>> >> do you notice the totally weird string delimiters in your original post?
>>> >> using either single quotes or double quotes (if you want variables named
>>> inside
>>> >> the string to be interpolated). read up on php strings here:
>>> >>
>>> >> http://php.net/string
>> > 
>> > He's probably using MS-Word to write code... those look very similar to
>> > dumb-quotes. Have you notice they open with a superscript 3 and close
>> > with a superscript 2?
> 
> I did notice what chars they were, but couldn't be sure how/why they were
> there.
> I was hoping 'weird' was a close enough approximation :-P
> 
>> > 
>> > Cheers,
>> > Rob.
> 




Re: [PHP] Strings

2007-06-05 Thread Jochem Maas
Pastor Steve wrote:
> Thank you. 
> 
> I tried what you suggested below and it gave me an unexpected
> T_CONSTANT_ESCAPED_STRING error.
> 
> Would this be valid: (I am typing in my Entourage, but I am writing the code
> in Dreamweaver. 

get a real text editor before you go mad.
textpad or ultraedit or something like that - check the list archives,
there are plenty of threads related to 'whats the best editor'

> You are probably seeing the quotes that Entourage (my email
> application) is giving you.)

setup your email client to use plaintext or get another one.
it will save lots of headache if you intend to make use of mailinglists
like this one.

> 
> > $image = "";
>> if ($image == NULL) {
>> print "False";
>> } else {
>>
>> ?>
>> 
>> >
>> }
>>
> ?>
> 
> It works if $image is not NULL. However, if it is empty, then it gives me an
> error. I am very much so a novice and appreciate your patience.
> 
> Thanks,
> 
> Steve Marquez
> 
> on 6/5/07 1:04 PM Richard S. Crawford ([EMAIL PROTECTED]) wrote:
> 
>> On Tuesday 05 June 2007 10:50:15 Steve Marquez wrote:
 It seems that if I add a string, rather than just the variable, then does
 not work. I am getting an unexpected T_IS_EQUAL error.
>> Your string delimiters are very strange; I'm not sure if your code has those
>> in it or not, so I can't really diagnose your problem.
>>
>> At any rate, make sure your code looks like this:
>>
>> >
>> $image = "";
>> if ($image == NULL) {
>> print "False";
>> } else {
>> print "";
>> }
>>
>> ?>
>>
>> If that still gives you problems, you could try replacing the second print
>> statement with this:
>>
>> print "";
>>
>> just to see if the problem is with the string or is some strange 
>> interpolation
>> issue.
> 
> 
> 

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



Re: [PHP] Strings

2007-06-05 Thread Jochem Maas
Robert Cummings wrote:
> On Tue, 2007-06-05 at 19:57 +0200, Jochem Maas wrote:
>> do you notice the totally weird string delimiters in your original post?
>> using either single quotes or double quotes (if you want variables named 
>> inside
>> the string to be interpolated). read up on php strings here:
>>
>>  http://php.net/string
> 
> He's probably using MS-Word to write code... those look very similar to
> dumb-quotes. Have you notice they open with a superscript 3 and close
> with a superscript 2?

I did notice what chars they were, but couldn't be sure how/why they were there.
I was hoping 'weird' was a close enough approximation :-P

> 
> Cheers,
> Rob.

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



[PHP] How to clone an entire XML node including childnodes?

2007-06-05 Thread Eric Wiener
Basically I am trying to turn something like this:

 

Hello Joe, nice to meet you

 

into this:

 

Hello Joe, nice to meet you

 

by making a new node, inserting before the old node and then removing
the old node.

 

The problem is that I am populating the value of the new node with the
$oldNode->nodeValue property which apparently only includes text, not
child nodes, so I end up with:

 

Hello Joe, nice to meet you

 

How do you get the entire node value including any subnodes that may
appear within?

 

 

This is basically a variation on my previous post about how to
DomDocument->renameNode().



Re: [PHP] works in 4.4.2 - breaks in 5.2.1

2007-06-05 Thread Jim Berkey
Thanks, sorry to expose my extreme ignorance. Glad I could provide some comic 
relief, though :-)
I appreciate the advice, will study php interfacing with mysql and set it up 
better. Will also study on pr0n spam and race conditions so I don't contribute 
to more bad code. You are probably right about the HTTP_RAW_POST_DATA being at 
the source of it. My studies on php.net found http_post_data, but not 
http_raw_post_data.
I'll keep studying.
jimbo

*** REPLY SEPARATOR  ***

On 6/5/2007 at 7:52 PM Jochem Maas wrote:

>Jim Berkey wrote:
>> I'm familiar with actionscript, but pretty new to php . . .I have a
>guestbook script that worked fine until my host upgraded to php 5.2.1 -
>can anyone tell me what part of my if statement or variable is breaking in
>5.2.1? I send the new data with Flash using xml.sendAndLoad, to the xml
>file via standalone php file shown below.
>> tia,
>> jimbo
>
>aside from the fact that this script has a big fat race condition waiting
>to happen,
>and you should probably be using a database for storage, and that it seems
>to be possible
>to inject just about *anything* into the guestbook.xml file (pr0n spam
>anyone?) ...
>what exactly is going wrong?
>
>at a guess $HTTP_RAW_POST_DATA is not set so nothing is being written, you
>should use something like the following to get the data instead
>(the comment is optional ;-):
>
>   // $xmlString is completely unvalidated/unsantized and could contain all
>sorts of crap!
>   $xmlString = file_get_contents('php://input');
>
>also STFW, there is plenty out there regarding your problem, (including
>stuff
>related specifically to flash), e.g.:
>
>http://www.phpbuilder.com/board/showthread.php?t=10304087
>
>>
>> > $file = fopen("guestbook.xml", "w+") or die("Can't open XML file");
>> $xmlString = $HTTP_RAW_POST_DATA;
>> if(!fwrite($file, $xmlString)){
>> print "Error writing to XML-file";
>> }
>> print $xmlString."\n\n";
>> fclose($file);
>>
>> exit;
>> ?>
>>
>>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

i

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



Re: [PHP] Strings

2007-06-05 Thread Pastor Steve
Thank you. 

I tried what you suggested below and it gave me an unexpected
T_CONSTANT_ESCAPED_STRING error.

Would this be valid: (I am typing in my Entourage, but I am writing the code
in Dreamweaver. You are probably seeing the quotes that Entourage (my email
application) is giving you.)

 
> $image = "";
> if ($image == NULL) {
> print "False";
> } else {
> 
> ?>
> 
>  
> }
> 
?>

It works if $image is not NULL. However, if it is empty, then it gives me an
error. I am very much so a novice and appreciate your patience.

Thanks,

Steve Marquez

on 6/5/07 1:04 PM Richard S. Crawford ([EMAIL PROTECTED]) wrote:

> On Tuesday 05 June 2007 10:50:15 Steve Marquez wrote:
>> > It seems that if I add a string, rather than just the variable, then does
>> > not work. I am getting an unexpected T_IS_EQUAL error.
> 
> Your string delimiters are very strange; I'm not sure if your code has those
> in it or not, so I can't really diagnose your problem.
> 
> At any rate, make sure your code looks like this:
> 
>  
> $image = "";
> if ($image == NULL) {
> print "False";
> } else {
> print "";
> }
> 
> ?>
> 
> If that still gives you problems, you could try replacing the second print
> statement with this:
> 
> print "";
> 
> just to see if the problem is with the string or is some strange interpolation
> issue.




Re: [PHP] Strings

2007-06-05 Thread Robert Cummings
On Tue, 2007-06-05 at 11:04 -0700, Richard S. Crawford wrote:
> On Tuesday 05 June 2007 10:50:15 Steve Marquez wrote:
> > It seems that if I add a string, rather than just the variable, then does
> > not work. I am getting an unexpected T_IS_EQUAL error.
> 
> Your string delimiters are very strange; I'm not sure if your code has those 
> in it or not, so I can't really diagnose your problem.
> 
> At any rate, make sure your code looks like this:
> 
>  
> $image = "";
> if ($image == NULL) {
>   print "False";
> } else {
>   print "";
> }
> 
> ?>

Heheh, it probably already "looks" like that... just isn't actually
that :)

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

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



Re: [PHP] Strings

2007-06-05 Thread Richard S. Crawford
On Tuesday 05 June 2007 10:50:15 Steve Marquez wrote:
> It seems that if I add a string, rather than just the variable, then does
> not work. I am getting an unexpected T_IS_EQUAL error.

Your string delimiters are very strange; I'm not sure if your code has those 
in it or not, so I can't really diagnose your problem.

At any rate, make sure your code looks like this:

";
}

?>

If that still gives you problems, you could try replacing the second print 
statement with this:

print "";

just to see if the problem is with the string or is some strange interpolation 
issue.

-- 
Richard S. Crawford (http://www.mossroot.com)
Editor In Chief, Daikaijuzine (http://www.daikaijuzine.com)
AIM: Buffalo2K / GTalk: [EMAIL PROTECTED]
"We are here to help each other get through this thing, whatever it is."
(Kurt Vonnegut, 1922 - 2007)

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



Re: [PHP] Strings

2007-06-05 Thread Robert Cummings
On Tue, 2007-06-05 at 19:57 +0200, Jochem Maas wrote:
> do you notice the totally weird string delimiters in your original post?
> using either single quotes or double quotes (if you want variables named 
> inside
> the string to be interpolated). read up on php strings here:
> 
>   http://php.net/string

He's probably using MS-Word to write code... those look very similar to
dumb-quotes. Have you notice they open with a superscript 3 and close
with a superscript 2?

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

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



RE: [PHP] Strings

2007-06-05 Thread Jim Moseby
> 
> your syntax is broken because of the weird quotes it seems.


I agree.  After replacing all the superscripted 2's and 3's with proper
quotes, the examples both work as expected.

JM

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



Re: [PHP] returning the index number part2

2007-06-05 Thread Robert Cummings
On Tue, 2007-06-05 at 09:33 -0700, Jim Lucas wrote:
> Robert Cummings wrote:
> > On Tue, 2007-06-05 at 17:16 +0100, blueboy wrote:
> >> if I have an array of  3  images
> >>
> >> 
> >> 
> >>  1.
> >> 
> >> 
> >> 
> >>  2.
> >> 
> >> 
> >> 
> >> 3.
> >> 
> >> 
> >> 
> >>  >>
> >> How do I access the filename? Like this?
> >>
> >> echo $fileName1 = $_FILES['userfile']['name'][0];
> >> echo $fileName2 = $_FILES['userfile']['name'][1];
> >> echo $fileName3 = $_FILES['userfile']['name'][2];
> > 
> > No, like this:
> > 
> > echo $fileName1 = $_FILES['userfile'][1]['name'];
> > echo $fileName2 = $_FILES['userfile'][2]['name'];
> > echo $fileName3 = $_FILES['userfile'][3]['name'];
> > 
> > Cheers,
> > Rob.
> I suggest to the op that they use print_r() on $_FILES and all will be 
> revealed

You mean:

echo "\n";
print_r( $_FILES );
echo "\n\n";

:)

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

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



Re: [PHP] returning the index number

2007-06-05 Thread Jochem Maas
Robert Cummings wrote:
> On Tue, 2007-06-05 at 11:43 -0400, Robert Cummings wrote:
>> On Tue, 2007-06-05 at 16:39 +0100, blueboy wrote:
>>> I have an array of files to be uploaded

...


>>   $i = 0;
>>> foreach ($_FILES['userfile']['name'] as $value) {
>>>
>>>   echo $value
>> $i++;
>>>   }
> 
> I should be shot for the above... use the following:

I was half way through arranging it ;-)

> 
> foreach ($_FILES['userfile']['name'] as $i => $value)
> {
> echo $value;
> }
> 
> Cheers,
> Rob.

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



Re: [PHP] Strings

2007-06-05 Thread Jochem Maas
do you notice the totally weird string delimiters in your original post?
using either single quotes or double quotes (if you want variables named inside
the string to be interpolated). read up on php strings here:

http://php.net/string

Steve Marquez wrote:
> The following code works:
> 
>  
> $image = ³²;
> 
> if ($image == NULL) {
> print ³False!²;
> }else{
> print ³$var²;
> }
> 
> ?>
> 
> However, this does not:
> 
>  
> $image = ³²;
> 
> if ($image == NULL) {
> print ³False!²;
> }else{
> print ³²;
> }
> 
> ?>
> 
> It seems that if I add a string, rather than just the variable, then does

'add a string' - huh? I don't understand what you mean, I'm (sure I'm) not
the only one (to quote Lennon).

> not work. I am getting an unexpected T_IS_EQUAL error.

your syntax is broken because of the weird quotes it seems.

> 
> --
> Thanks,
> Steve Marquez
> 

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



Re: [PHP] works in 4.4.2 - breaks in 5.2.1

2007-06-05 Thread Jochem Maas
Jim Berkey wrote:
> I'm familiar with actionscript, but pretty new to php . . .I have a guestbook 
> script that worked fine until my host upgraded to php 5.2.1 - can anyone tell 
> me what part of my if statement or variable is breaking in 5.2.1? I send the 
> new data with Flash using xml.sendAndLoad, to the xml file via standalone php 
> file shown below. 
> tia,
> jimbo

aside from the fact that this script has a big fat race condition waiting to 
happen,
and you should probably be using a database for storage, and that it seems to 
be possible
to inject just about *anything* into the guestbook.xml file (pr0n spam anyone?) 
...
what exactly is going wrong?

at a guess $HTTP_RAW_POST_DATA is not set so nothing is being written, you
should use something like the following to get the data instead
(the comment is optional ;-):

// $xmlString is completely unvalidated/unsantized and could contain 
all sorts of crap!
$xmlString = file_get_contents('php://input');

also STFW, there is plenty out there regarding your problem, (including stuff
related specifically to flash), e.g.:

http://www.phpbuilder.com/board/showthread.php?t=10304087

> 
>  $file = fopen("guestbook.xml", "w+") or die("Can't open XML file");
> $xmlString = $HTTP_RAW_POST_DATA; 
> if(!fwrite($file, $xmlString)){
> print "Error writing to XML-file";
> }
> print $xmlString."\n\n";
> fclose($file);
> 
> exit;
> ?>
> 
> 

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



[PHP] Strings

2007-06-05 Thread Steve Marquez
The following code works:



However, this does not:

²;
}

?>

It seems that if I add a string, rather than just the variable, then does
not work. I am getting an unexpected T_IS_EQUAL error.

--
Thanks,
Steve Marquez


[PHP] Re: How can I DomDocument->renameNode?

2007-06-05 Thread Eric Wiener

Thanks for the reply, but the solution needs to be in PHP, not
JavaScript.

-Original Message-
From: tedd [mailto:[EMAIL PROTECTED] 
Sent: Sunday, June 03, 2007 3:20 PM
To: php-general@lists.php.net
Subject: [PHP] Re: How can I DomDocument->renameNode?

>I have tried making a new node, inserting it before the old node then
>removing the old node but I could not figure out how to get the
>nodeValue to include the child nodes, so they get stripped out leaving
>only the text value.


You might try something like this:

function replaceNode() {
var inChoice =
document.getElementById("grafCount").selectedIndex;
var inText = document.getElementById("textArea").value;

var newText = document.createTextNode(inText);
var newGraf = document.createElement("p");
newGraf.appendChild(newText);

var allGrafs = nodeChangingArea.getElementsByTagName("p");
var oldGraf = allGrafs.item(inChoice);

nodeChangingArea.replaceChild(newGraf,oldGraf);
}

  tedd
-- 
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] works in 4.4.2 - breaks in 5.2.1

2007-06-05 Thread Jim Berkey
I'm familiar with actionscript, but pretty new to php . . .I have a guestbook 
script that worked fine until my host upgraded to php 5.2.1 - can anyone tell 
me what part of my if statement or variable is breaking in 5.2.1? I send the 
new data with Flash using xml.sendAndLoad, to the xml file via standalone php 
file shown below.
tia,
jimbo





Re: [PHP] returning the index number part2

2007-06-05 Thread Jim Lucas

Robert Cummings wrote:

On Tue, 2007-06-05 at 17:16 +0100, blueboy wrote:

if I have an array of  3  images



 1.



 2.



3.





No, like this:

echo $fileName1 = $_FILES['userfile'][1]['name'];
echo $fileName2 = $_FILES['userfile'][2]['name'];
echo $fileName3 = $_FILES['userfile'][3]['name'];

Cheers,
Rob.

I suggest to the op that they use print_r() on $_FILES and all will be revealed

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] returning the index number

2007-06-05 Thread Jim Lucas

Robert Cummings wrote:

On Tue, 2007-06-05 at 11:43 -0400, Robert Cummings wrote:

On Tue, 2007-06-05 at 16:39 +0100, blueboy wrote:

I have an array of files to be uploaded




 2.



3.



I can get the name


  $i = 0;

foreach ($_FILES['userfile']['name'] as $value) {

  echo $value

$i++;

  }


I should be shot for the above... use the following:

foreach ($_FILES['userfile']['name'] as $i => $value)
{
echo $value;
}

Cheers,
Rob.

I was going to say something :D

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] indexes and arrays

2007-06-05 Thread Jim Lucas


>Towels 



--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Unknown

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



Re: [PHP] returning the index number part2

2007-06-05 Thread Robert Cummings
On Tue, 2007-06-05 at 17:16 +0100, blueboy wrote:
> if I have an array of  3  images
> 
> 
> 
>  1.
> 
> 
> 
>  2.
> 
> 
> 
> 3.
> 
> 
> 
>  
> How do I access the filename? Like this?
> 
> echo $fileName1 = $_FILES['userfile']['name'][0];
> echo $fileName2 = $_FILES['userfile']['name'][1];
> echo $fileName3 = $_FILES['userfile']['name'][2];

No, like this:

echo $fileName1 = $_FILES['userfile'][1]['name'];
echo $fileName2 = $_FILES['userfile'][2]['name'];
echo $fileName3 = $_FILES['userfile'][3]['name'];

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

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



[PHP] returning the index number part2

2007-06-05 Thread blueboy

if I have an array of  3  images



 1.



 2.



3.



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



Re: [PHP] returning the index number

2007-06-05 Thread Robert Cummings
On Tue, 2007-06-05 at 11:43 -0400, Robert Cummings wrote:
> On Tue, 2007-06-05 at 16:39 +0100, blueboy wrote:
> > I have an array of files to be uploaded
> > 
> > 
> > 
> > 
> >  2.
> > 
> > 
> > 
> > 3.
> > 
> > 
> > 
> > I can get the name
> > 
> 
>   $i = 0;
> > foreach ($_FILES['userfile']['name'] as $value) {
> > 
> >   echo $value
> $i++;
> >   }

I should be shot for the above... use the following:

foreach ($_FILES['userfile']['name'] as $i => $value)
{
echo $value;
}

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

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



Re: [PHP] returning the index number

2007-06-05 Thread Robert Cummings
On Tue, 2007-06-05 at 16:39 +0100, blueboy wrote:
> I have an array of files to be uploaded
> 
> 
> 
> 
>  2.
> 
> 
> 
> 3.
> 
> 
> 
> I can get the name
> 

  $i = 0;
> foreach ($_FILES['userfile']['name'] as $value) {
> 
>   echo $value
$i++;
>   }
> 
> but I want the index position, any ideas?

See additions above.

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

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



[PHP] returning the index number

2007-06-05 Thread blueboy
I have an array of files to be uploaded




 2.



3.



I can get the name

foreach ($_FILES['userfile']['name'] as $value) {

  echo $value
  }

but I want the index position, any ideas?

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



Re: [PHP] Display Errors (was thumbs)

2007-06-05 Thread Robert Cummings
On Tue, 2007-06-05 at 11:07 -0400, tedd wrote:
> At 10:48 AM -0400 6/5/07, Robert Cummings wrote:
> >On Tue, 2007-06-05 at 16:29 +0200, Zoltán Németh wrote:
> >>
> >>  I agree with the above idea. Errors should be logged (and possibly sent
> >>  in notification mail to the developer or something like that), not
> >>  displayed to the outside world, as they can expose sensitive information
> >>  about your setup.
> >
> >It however convenient to have errors displayed on the page when doing
> >development. Since I like as many config settings as possible to be
> >attached to the project itself I usually keep at least 3 config files:
> >
> > PROJECT/
> > configs/
> > config.live.php
> > config.dev.php
> > config.shared.php
> >
> >So config.live and config.dev both include config.shared but set any
> >live or dev specific settings outside of the shared config. Then on any
> >given dev or live server I create a softlink config.php in PROJECT/ that
> >points to either config.live.php or config.dev.php. This way all the
> >configs can live in CVS and they don't step on each other's toes :)
> 
> Just a thought -- wouldn't a simpler solution be 
> just using a global session variable, or 
> constant, such as $production = true or false and 
> then including your error routines accordingly?

Yeah, that's in my config file ;) But, for clarity's sake I more often
than not separate my dev and live configs. Then if I want to compare
them I can use the diff command to see what's different between them.

Can't say I ever use the session since it could only apply after some
kind of authentication and not all pages require authentication.

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

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



Re: [PHP] Making thumbs same size

2007-06-05 Thread Robert Cummings
On Tue, 2007-06-05 at 10:59 -0400, tedd wrote:
>
> http://www.webbytedd.com/b/thumb/index.php

I think you're cheating BTW... no matter what I put in for $_GET['s'], I
always get your doggy, and I don't see your script testing for *cough*
inappropriate access attempts ;)

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

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



[PHP] Display Errors (was thumbs)

2007-06-05 Thread tedd

At 10:48 AM -0400 6/5/07, Robert Cummings wrote:

On Tue, 2007-06-05 at 16:29 +0200, Zoltán Németh wrote:


 I agree with the above idea. Errors should be logged (and possibly sent
 in notification mail to the developer or something like that), not
 displayed to the outside world, as they can expose sensitive information
 about your setup.


It however convenient to have errors displayed on the page when doing
development. Since I like as many config settings as possible to be
attached to the project itself I usually keep at least 3 config files:

PROJECT/
configs/
config.live.php
config.dev.php
config.shared.php

So config.live and config.dev both include config.shared but set any
live or dev specific settings outside of the shared config. Then on any
given dev or live server I create a softlink config.php in PROJECT/ that
points to either config.live.php or config.dev.php. This way all the
configs can live in CVS and they don't step on each other's toes :)


Just a thought -- wouldn't a simpler solution be 
just using a global session variable, or 
constant, such as $production = true or false and 
then including your error routines accordingly?


Just opening the idea for discussion.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] indexes and arrays

2007-06-05 Thread blueboy
   I have an array of facilities, how do I define them all in one go so I do 
not get the undefined index error?


input name="facilities[5] " type="checkbox" id="facilities[5] " 
value="Credit Cards Accepted" >
  Credit Cards Accepted 
>
  Towels 
>
  Luggage Storage 
> 

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



Re: [PHP] Making thumbs same size

2007-06-05 Thread tedd

 > Also, in my readings, I have read several books

 that say keeping any sort of error reporting code
 in your public script is not a good idea. In
 other words, don't give possible evil-doers any
 information. So, I should remove the error
 reporting statements as well.


Yeah... I thought maybe you left that there intentionally since you're
exposing your code :)

Cheers,
Rob.


and


I agree with the above idea. Errors should be logged (and possibly sent
in notification mail to the developer or something like that), not
displayed to the outside world, as they can expose sensitive information
about your setup.

greets
Zoltán Németh


Ok, I think I got the idea across in the remarks.

http://www.webbytedd.com/b/thumb/index.php


PS: I thought that at least someone would tell me that my dog was cute.


PS: Your dog is cute :)


Thanks, she is a cute attack dog. Weighting in at 
almost 5 pounds she'll do some serious damage to 
your ankles and maybe to your pant leg too, if 
she stands on her rear legs.


Thanks for your reviews.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Urgent::Implementing PKI in PHP

2007-06-05 Thread Jochem Maas
Renuka Marwah wrote:
> We have a website in PHP where we want to implement PKI. The scenario is
> that there would be some registered dealers who woud have to buy Digital
> signatures. When they come to our website they would input several
> information through PHP designed forms and use the digital signatures to
> sign the data.
> 
> We wanted to use OpenSSL for the same. However what I fail to understand
> is how to implement the OpenSSL functions for implementing the client side
> of this, which would involve encryption using Private key etc, since PHP
> would be parsed at the server only.
> 
> Please respond, it is an urgent requirement

just about every phper coming to the list has an urgent problem,
should you be given special treatment?

start SingTFW and reading about the relevant technology, e.g:

http://www.google.nl/search?q=PKI+web+browser

and then determine whether your requirement is actually possible (in so far as 
I understood it),
from what I gather there is no way to 'sign' the data in a form, the PKI
is used to authenticate and authorize the HTTP connection - which will be
running over SSL, given that fact why would you need to 'sign' the form data?

> 
> Thx
> Renuka
> 


some developer got laid off by an over priced executive who hired an offshore
team to replace said developer for a fraction of the cost, said team can't do 
the
work, and can't be bothered to figure out how, so they go to the nearest 
mailing list
to ask for a ready-made answer ... where they come across some talented 
developer
who has plenty of time to hand out high quality ready-made answers because he 
has
been recently laid off.


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



Re: [PHP] Making thumbs same size

2007-06-05 Thread Robert Cummings
On Tue, 2007-06-05 at 16:29 +0200, Zoltán Németh wrote:
>
> I agree with the above idea. Errors should be logged (and possibly sent
> in notification mail to the developer or something like that), not
> displayed to the outside world, as they can expose sensitive information
> about your setup.

It however convenient to have errors displayed on the page when doing
development. Since I like as many config settings as possible to be
attached to the project itself I usually keep at least 3 config files:

PROJECT/
configs/
config.live.php
config.dev.php
config.shared.php

So config.live and config.dev both include config.shared but set any
live or dev specific settings outside of the shared config. Then on any
given dev or live server I create a softlink config.php in PROJECT/ that
points to either config.live.php or config.dev.php. This way all the
configs can live in CVS and they don't step on each other's toes :)

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

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



Re: [PHP] Making thumbs same size

2007-06-05 Thread Zoltán Németh
2007. 06. 5, kedd keltezéssel 10.17-kor tedd ezt írta:
> At 3:33 PM +0200 6/5/07, Zoltán Németh wrote:
> >2007. 06. 5, kedd keltezéssel 09.17-kor tedd ezt írta:
> >>  At 9:56 AM -0400 6/4/07, Robert Cummings wrote:
> >>  >On Mon, 2007-06-04 at 09:50 -0400, tedd wrote:
> >>  >>
> >>  >>  Don't scale, resample. See here:
> >>  >>
> >  > >>  http://www.webbytedd.com/b/thumb/index.php
> >  > >
> >
> >  > PS: It's always pays to have someone 
> >knowledgeable review your code -- thanks.
> >
> >one more note:
> >you have ignore_user_abort(); in the beginning of the script, but
> >according to the manual ( http://php.net/ignore_user_abort ) it should
> >be used like ignore_user_abort(TRUE); otherwise it only returns the
> >current setting...
> 
> Zoltán:
> 
> Ah yes, I see. I'll remove that statement 
> altogether. That statement is only to keep 
> processes running (regardless of the user's 
> actions) to their completion, like updating a dB. 
> The code I provide in the demo simply presents a 
> thumbnail to the user and if the user is not 
> there, then why continue anyway? Thus, no reason 
> to continue, right?
> 
> However, there seems to be some disagreement 
> about what the ignore_user_abort() returns.

the return value is an int (1/0), although the parameter should be
boolean, that is a source of confusion.
but the parameter must be specified in order to set the setting,
regardless of the return value ;)

> 
> Also, in my readings, I have read several books 
> that say keeping any sort of error reporting code 
> in your public script is not a good idea. In 
> other words, don't give possible evil-doers any 
> information. So, I should remove the error 
> reporting statements as well.
> 
> Any thoughts?

I agree with the above idea. Errors should be logged (and possibly sent
in notification mail to the developer or something like that), not
displayed to the outside world, as they can expose sensitive information
about your setup.

greets
Zoltán Németh

> 
> Cheers,
> 
> tedd
> 
> PS: I thought that at least someone would tell me that my dog was cute.

PS: Your dog is cute :)

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



Re: [PHP] Making thumbs same size

2007-06-05 Thread Robert Cummings
On Tue, 2007-06-05 at 10:17 -0400, tedd wrote:
> At 3:33 PM +0200 6/5/07, Zoltán Németh wrote:
> >2007. 06. 5, kedd keltezéssel 09.17-kor tedd ezt írta:
> >>  At 9:56 AM -0400 6/4/07, Robert Cummings wrote:
> >>  >On Mon, 2007-06-04 at 09:50 -0400, tedd wrote:
> >>  >>
> >>  >>  Don't scale, resample. See here:
> >>  >>
> >  > >>  http://www.webbytedd.com/b/thumb/index.php
> >  > >
> >
> >  > PS: It's always pays to have someone 
> >knowledgeable review your code -- thanks.
> >
> >one more note:
> >you have ignore_user_abort(); in the beginning of the script, but
> >according to the manual ( http://php.net/ignore_user_abort ) it should
> >be used like ignore_user_abort(TRUE); otherwise it only returns the
> >current setting...
> 
> Zoltán:
> 
> Ah yes, I see. I'll remove that statement 
> altogether. That statement is only to keep 
> processes running (regardless of the user's 
> actions) to their completion, like updating a dB. 
> The code I provide in the demo simply presents a 
> thumbnail to the user and if the user is not 
> there, then why continue anyway? Thus, no reason 
> to continue, right?
> 
> However, there seems to be some disagreement 
> about what the ignore_user_abort() returns.
> 
> Also, in my readings, I have read several books 
> that say keeping any sort of error reporting code 
> in your public script is not a good idea. In 
> other words, don't give possible evil-doers any 
> information. So, I should remove the error 
> reporting statements as well.

Yeah... I thought maybe you left that there intentionally since you're
exposing your code :)

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

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



Re: [PHP] Printing MSSQL-Query ERROR description in PHP

2007-06-05 Thread Stut

karthi keyan wrote:

  Is there any way to print the reason why the query has been failed, like the 
way MySQL-PHP has mysql_error()?


Hmm, where to look for information on the MSSQL functions in PHP.

Hey, I got a crazy plan. Let's try looking in the MSSQL part of the PHP 
manual. Come navigate there with me: http://php.net/mssql


Let's scroll down to find the function list. Ahh, there is it. Hmm, what 
we got here the... bind, close, connect, data_seek. Nope, none of those. 
Let's keep going.


Oooh, do you see what I see? mssql_get_last_message - that sounds 
promising. What does the description say? "Returns the last message from 
the server". Well, if there's been an error in the last query we tried 
to run it makes sense that the last message from the server would 
contain the error message.


Hey, how about this. You try that and let us know whether you learnt 
something from this lesson.


-Stut

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



Re: [PHP] Printing MSSQL-Query ERROR description in PHP

2007-06-05 Thread Jim Lucas

karthi keyan wrote:

Hi,
   
  Is there any way to print the reason why the query has been failed, like the way MySQL-PHP has mysql_error()?
   
  Regards,

KARTHIK.

   
-

 Download prohibited? No problem! CHAT from any browser, without download.


Is this what you are looking for?

http://us.php.net/manual/en/function.mssql-get-last-message.php

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] Making thumbs same size

2007-06-05 Thread tedd

At 3:33 PM +0200 6/5/07, Zoltán Németh wrote:

2007. 06. 5, kedd keltezéssel 09.17-kor tedd ezt írta:

 At 9:56 AM -0400 6/4/07, Robert Cummings wrote:
 >On Mon, 2007-06-04 at 09:50 -0400, tedd wrote:
 >>
 >>  Don't scale, resample. See here:
 >>

 > >>  http://www.webbytedd.com/b/thumb/index.php
 > >

 > PS: It's always pays to have someone 
knowledgeable review your code -- thanks.


one more note:
you have ignore_user_abort(); in the beginning of the script, but
according to the manual ( http://php.net/ignore_user_abort ) it should
be used like ignore_user_abort(TRUE); otherwise it only returns the
current setting...


Zoltán:

Ah yes, I see. I'll remove that statement 
altogether. That statement is only to keep 
processes running (regardless of the user's 
actions) to their completion, like updating a dB. 
The code I provide in the demo simply presents a 
thumbnail to the user and if the user is not 
there, then why continue anyway? Thus, no reason 
to continue, right?


However, there seems to be some disagreement 
about what the ignore_user_abort() returns.


Also, in my readings, I have read several books 
that say keeping any sort of error reporting code 
in your public script is not a good idea. In 
other words, don't give possible evil-doers any 
information. So, I should remove the error 
reporting statements as well.


Any thoughts?

Cheers,

tedd

PS: I thought that at least someone would tell me that my dog was cute.
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] uploading big images.

2007-06-05 Thread Stut

Yamil Ortega wrote:

I think it is a PHP.ini file configuration or something. Can you help me?


So why not check there before posting here? I mean seriously, the option 
couldn't be more obvious considering that it's called upload_max_filesize.


-Stut

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



Re: [PHP] Making thumbs same size

2007-06-05 Thread Zoltán Németh
2007. 06. 5, kedd keltezéssel 09.17-kor tedd ezt írta:
> At 9:56 AM -0400 6/4/07, Robert Cummings wrote:
> >On Mon, 2007-06-04 at 09:50 -0400, tedd wrote:
> >>
> >>  Don't scale, resample. See here:
> >>
> >>  http://www.webbytedd.com/b/thumb/index.php
> >
> >Hi Tedd,
> >
> >In your script you have:
> >
> > ini_set( 'register_globals', '0' );
> >
> >The line is pointless, it can't be reached until after such globals have
> >been registered.
> >
> >Also you have:
> >
> > ob_start();
> >
> >Why use output buffering? You don't actually do anything with the buffer
> >other than flushing it :)
> >
> >Cheers,
> >Rob.
> 
> Rob:
> 
> What?!
> 
> I didn't do that.  No one saw me do it and can't prove it. Besides, I 
> changed the code. :-)
> 
> My explanation, legacy remnants.
> 
> Cheers,
> 
> tedd
> 
> PS: It's always pays to have someone knowledgeable review your code -- thanks.

one more note:
you have ignore_user_abort(); in the beginning of the script, but
according to the manual ( http://php.net/ignore_user_abort ) it should
be used like ignore_user_abort(TRUE); otherwise it only returns the
current setting...

greets
Zoltán Németh

> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 

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



Re: [PHP] Making thumbs same size

2007-06-05 Thread Robert Cummings
On Tue, 2007-06-05 at 09:17 -0400, tedd wrote:
> At 9:56 AM -0400 6/4/07, Robert Cummings wrote:
>
> I didn't do that.  No one saw me do it and can't prove it. Besides, I 
> changed the code. :-)
> 
> My explanation, legacy remnants.

I can relate. I've worked on code, changed my mind, ripped out 80% of
one way then taken another route and forgot to remove variables and
stuff. Then a year later looked at the code with a big WTF :) When that
happens I usually check out the CVS logs to re-assure myself I wasn't
being an idiot :)

> PS: It's always pays to have someone knowledgeable review your code -- thanks.

Bleh, you flatter me. Flattery will get you nowhere ;)

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

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



Re: [PHP] Making thumbs same size

2007-06-05 Thread tedd

At 9:56 AM -0400 6/4/07, Robert Cummings wrote:

On Mon, 2007-06-04 at 09:50 -0400, tedd wrote:


 Don't scale, resample. See here:

 http://www.webbytedd.com/b/thumb/index.php


Hi Tedd,

In your script you have:

ini_set( 'register_globals', '0' );

The line is pointless, it can't be reached until after such globals have
been registered.

Also you have:

ob_start();

Why use output buffering? You don't actually do anything with the buffer
other than flushing it :)

Cheers,
Rob.


Rob:

What?!

I didn't do that.  No one saw me do it and can't prove it. Besides, I 
changed the code. :-)


My explanation, legacy remnants.

Cheers,

tedd

PS: It's always pays to have someone knowledgeable review your code -- thanks.
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] TableName with space

2007-06-05 Thread karthi keyan
Hi,
   
  Double qoutes inside a PHP script is not working for spaces. I got the 
answer. We have to use square bracket from PHP.
   
  $query = "create table [order details]";

Chris <[EMAIL PROTECTED]> wrote:
  karthi keyan wrote:
> Hi,
> 
> How can I create a table with spaces "Order details" in MSSQL using PHP?
> I am able to create manually the table name with space by providing the name 
> in Double Quotes. Is there a way out to do this using PHP?

Put double quotes around it in php - rather simple really.

$qry = 'create table "my table name"  ';

-- 
Postgresql & php tutorials
http://www.designmagick.com/



-
 Here’s a new way to find what you're looking for - Yahoo! Answers 

Re: [PHP] Re: Removing a row from an Array

2007-06-05 Thread Al

I miss keyed, it's preg_grep().  Had "array" on my mind.

M. Sokolewicz wrote:
I've never heard of, nor seen array_grep() before and AFAIK it's also 
not a built-in php function. Check it at http://www.php.net/array_grep, 
it doesn't exist. No need to advise that which does not exist :)


- Tul

Al wrote:

Can you be more specific? Show us a line of code, or so.

There are lots of functions that may fit your needs, array_filter(), 
array_walk(), preg_grep(), etc.


I've found array_grep() to be super in many cases.
Returns the array consisting of the elements of the input array that 
match the given pattern. OR, that don't match the pattern.


Most require array_values() to resync the keys.


Ken Kixmoeller -- reply to [EMAIL PROTECTED] wrote:

On Jun 4, 2007, at 3:27 PM, Al wrote:



What determines the rows you want to keep?



User selection. The array is essentially a "shopping cart"-type of 
object.


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



Re: [PHP] TableName with space

2007-06-05 Thread Miles Thompson

On 6/5/07, karthi keyan <[EMAIL PROTECTED]> wrote:


Hi,

  How can I create a table with spaces "Order details" in MSSQL using PHP?
  I am able to create manually the table name with space by providing the
name in Double Quotes. Is there a way out to do this using PHP?

  Thanks
  Karthik.



Why would you want to? Apart from not having to change / search through
lines of legacy code.

Use order_details or orderDetails or  OrderDetails or orderdetails but DON'T
curse yourself with a space  in a table which you will have to quote every
time it's used.

Cheers - Miles


Re: [PHP] Re: Printing MSSQL-Query ERROR description in PHP

2007-06-05 Thread Darren Whitlen



look at the subject ;)
that's how I guessed what he wants



Woops, missed that. You have a good point there :)

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



Re: [PHP] Re: Printing MSSQL-Query ERROR description in PHP

2007-06-05 Thread Zoltán Németh
2007. 06. 5, kedd keltezéssel 11.50-kor Darren Whitlen ezt írta:
> Zoltán Németh wrote:
> > 2007. 06. 5, kedd keltezéssel 11.38-kor Darren Whitlen ezt írta:
> >> karthi keyan wrote:
> >>> Hi,
> >>>
> >>>   Is there any way to print the reason why the query has been failed, 
> >>> like the way MySQL-PHP has mysql_error()?
> >>>
> >>>   Regards,
> >>> KARTHIK.
> >>>
> >>>
> >>> -
> >>>  Download prohibited? No problem! CHAT from any browser, without download.
> >> I'm confused, mysql_error() does return the error description from mysql.
> >>
> >> Try running this query on one of your databases:
> >>
> >> $rs = mysql_query("SELECT non_existant_column WHERE some_column = 1") or 
> >> die(mysql_error());
> >>
> >> Running that will print out the error in the query. (Intended errors heres)
> > 
> > the OP wants something similar to mysql_query for mssql. so mysql_query
> > won't solve his problem.
> > 
> > greets
> > Zoltán Németh
> > 
> >> Darren
> >>
> 
> Ah. You failed to mention anything about the mssql part.

look at the subject ;)
that's how I guessed what he wants

> Perhaps search google for "mssql error description"? Just an idea...
> 
> Other than that, thats my mssql help exhausted.

I cannot help either...

greets
Zoltán Németh

> Darren
> 

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



Re: [PHP] Re: Printing MSSQL-Query ERROR description in PHP

2007-06-05 Thread Darren Whitlen

Zoltán Németh wrote:

2007. 06. 5, kedd keltezéssel 11.38-kor Darren Whitlen ezt írta:

karthi keyan wrote:

Hi,
   
  Is there any way to print the reason why the query has been failed, like the way MySQL-PHP has mysql_error()?
   
  Regards,

KARTHIK.

   
-

 Download prohibited? No problem! CHAT from any browser, without download.

I'm confused, mysql_error() does return the error description from mysql.

Try running this query on one of your databases:

$rs = mysql_query("SELECT non_existant_column WHERE some_column = 1") or 
die(mysql_error());


Running that will print out the error in the query. (Intended errors heres)


the OP wants something similar to mysql_query for mssql. so mysql_query
won't solve his problem.

greets
Zoltán Németh


Darren



Ah. You failed to mention anything about the mssql part.
Perhaps search google for "mssql error description"? Just an idea...

Other than that, thats my mssql help exhausted.
Darren

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



Re: [PHP] Re: Printing MSSQL-Query ERROR description in PHP

2007-06-05 Thread Zoltán Németh
2007. 06. 5, kedd keltezéssel 11.38-kor Darren Whitlen ezt írta:
> karthi keyan wrote:
> > Hi,
> >
> >   Is there any way to print the reason why the query has been failed, like 
> > the way MySQL-PHP has mysql_error()?
> >
> >   Regards,
> > KARTHIK.
> > 
> >
> > -
> >  Download prohibited? No problem! CHAT from any browser, without download.
> 
> I'm confused, mysql_error() does return the error description from mysql.
> 
> Try running this query on one of your databases:
> 
> $rs = mysql_query("SELECT non_existant_column WHERE some_column = 1") or 
> die(mysql_error());
> 
> Running that will print out the error in the query. (Intended errors heres)

the OP wants something similar to mysql_query for mssql. so mysql_query
won't solve his problem.

greets
Zoltán Németh

> 
> Darren
> 

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



[PHP] Re: Printing MSSQL-Query ERROR description in PHP

2007-06-05 Thread Darren Whitlen

karthi keyan wrote:

Hi,
   
  Is there any way to print the reason why the query has been failed, like the way MySQL-PHP has mysql_error()?
   
  Regards,

KARTHIK.

   
-

 Download prohibited? No problem! CHAT from any browser, without download.


I'm confused, mysql_error() does return the error description from mysql.

Try running this query on one of your databases:

$rs = mysql_query("SELECT non_existant_column WHERE some_column = 1") or 
die(mysql_error());


Running that will print out the error in the query. (Intended errors heres)

Darren

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