php-general Digest 5 Jun 2007 10:38:19 -0000 Issue 4830

Topics (messages 256057 through 256077):

Re: Removing a row from an Array
        256057 by: Jay Blanchard
        256058 by: Peter Lauri
        256059 by: Roberto Mansfield
        256060 by: Ken Kixmoeller -- reply to ken.kixmoeller.com
        256061 by: Ken Kixmoeller -- reply to ken.kixmoeller.com
        256062 by: Al
        256063 by: Ken Kixmoeller -- reply to ken.kixmoeller.com
        256067 by: Al
        256076 by: M. Sokolewicz

Re: php5 and sendmail
        256064 by: Arvind Autar
        256065 by: Jim Lucas
        256066 by: Jim Lucas
        256068 by: Chris

uploading big images.
        256069 by: Yamil Ortega
        256070 by: Chris

Urgent::Implementing PKI in PHP
        256071 by: Renuka Marwah

Re: Double checking - I should turn off "magic quotes"
        256072 by: Dave M G

Printing MSSQL-Query ERROR description in PHP
        256073 by: karthi keyan
        256077 by: Darren Whitlen

TableName with space
        256074 by: karthi keyan
        256075 by: Chris

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 ---
[snip]
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)?
[/snip]

http://us2.php.net/manual/en/function.array-pop.php

--- End Message ---
--- Begin Message ---
Using array_pop wouldn't do it, as it just removes the last element.

You could use unset() for the rows you don't want to keep.

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


> -----Original Message-----
> From: Jay Blanchard [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 04, 2007 9:25 PM
> To: Ken Kixmoeller -- reply to [EMAIL PROTECTED]; php-
> [EMAIL PROTECTED]
> Subject: RE: [PHP] Removing a row from an Array
> 
> [snip]
> 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)?
> [/snip]
> 
> http://us2.php.net/manual/en/function.array-pop.php
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Can't you just unset() the values you don't want?

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)?
> 
> thanks - - -
> 
> Ken

--- End Message ---
--- Begin Message ---

On Jun 4, 2007, at 2:25 PM, Jay Blanchard wrote:

http://us2.php.net/manual/en/function.array-pop.php

Thanks, Jay ---

I did see that function, but forgot about it when I asked the question. I should have added that *any* array row among many could be the one that needs to be removed. I couldn't figure out how to reorder the array so that POP would work.

Ken

--- End Message ---
--- Begin Message ---

On Jun 4, 2007, at 3:29 PM, Peter Lauri wrote:


You could use unset() for the rows you don't want to keep.


Ah --- yes, that looks like it would do it. I was expecting something to find something array-specific.

Thank you, Pater and Roberto

--- End Message ---
--- Begin Message ---
What determines the rows you want to keep?

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)?

thanks - - -

Ken

--- End Message ---
--- Begin Message ---
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.
--- End Message ---
--- Begin Message ---
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.

--- End Message ---
--- Begin Message --- 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.

--- End Message ---
--- Begin Message ---
Hello all,

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.

<?php
// 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?

--- End Message ---
--- Begin Message ---
Arvind Autar wrote:
Hello all,

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.

<?php
// 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?

Well, a little more information would be nice, like OS
and what is your setting in your php.ini file for sendmail set to?

Suggestion, maybe you need to set headers?  Valid from line might help.

Are you sure that it is not working?  Maybe GMail is flagging it as spam.

--
Jim Lucas

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

Unknown

--- End Message ---
--- Begin Message ---
Arvind Autar wrote:
I defiend the distrobution of linux, FC6 (fedora core 6), my php.ini is set
correcty afaik

[mail function]
; For Win32 only.
SMTP = srv1.mydomain.nl
smtp_port = 25

; For Win32 only.
sendmail_from = [EMAIL PROTECTED]

; For Unix only.  You may supply arguments as well (default: "sendmail -t
-i").
sendmail_path = /usr/sbin/sendmail

I'm not that keen with php, so could you help me out?




2007/6/5, Jim Lucas <[EMAIL PROTECTED]>:

Arvind Autar wrote:
> Hello all,
>
> 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.
>
> <?php
> // 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?
>
Well, a little more information would be nice, like OS
and what is your setting in your php.ini file for sendmail set to?

Suggestion, maybe you need to set headers?  Valid from line might help.

Are you sure that it is not working?  Maybe GMail is flagging it as spam.

--
Jim Lucas

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

Unknown



I would comment out the windows only parts and restart apache and see if things 
work then

--
Jim Lucas

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

Unknown

--- End Message ---
--- Begin Message ---
Arvind Autar wrote:
Hello all,

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.

<?php
// 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?

Check your mail server logs to see if it makes it to the mail server and then what happens to it.

It could be that it's being flagged as spam because of the content as Jim suggested.

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

--- End Message ---
--- Begin Message ---
 

Hi, me again. I need to tell you that im completely new in LAMP, so please
don´t get tired with my silly questions :-).

 

I was able to upload and create thumb images with the same size. But now, I
am realizing that I can´t upload images bigger than 1 MB, I don´t know why.

I load the image through the upload image.php, then I check it with the
check_image.php file, and then, I show the result in the browser with the

 Show image file, but as I told you, only works with files less than 1 mb.
With bigger images, I only get a blank page without any errors.

 

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

 

Thanks in advance.


--- End Message ---
--- Begin Message ---
Yamil Ortega wrote:
Hi, me again. I need to tell you that im completely new in LAMP, so please
don´t get tired with my silly questions :-).

I was able to upload and create thumb images with the same size. But now, I
am realizing that I can´t upload images bigger than 1 MB, I don´t know why.

I load the image through the upload image.php, then I check it with the
check_image.php file, and then, I show the result in the browser with the

 Show image file, but as I told you, only works with files less than 1 mb.
With bigger images, I only get a blank page without any errors.

Create a phpinfo page and see what your

upload_max_filesize

is set to.

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

--- End Message ---
--- Begin Message ---
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

Thx
Renuka

--- End Message ---
--- Begin Message ---
Robert , PHP General,

Thank you for replying and explaining the situation clearly.
Neither! It means using mysql_real_escape_string():
http://www.php.net/manual/en/function.mysql-real-escape-string.php

I have now made it so each and every queries to the database pass through mysql_real_escape_string.

I've also turned off magic quotes on my host and on my testing environment, and made it so my code tests for the existence of magic quotes before adding and stripping slashes.

I was wondering if there are some recommended tests I can try to see how well I am protected against MySQL injection. I was searching via Google because I thought I had seen before a site that listed 10 common injection attacks. But I can't find it now, and seem to be only coming across proprietary software for sale.

Can someone recommend some MySQL code that I can use to test my code?

--
Dave M G
Ubuntu Feisty 7.04
Kernel 2.6.20-15-386

--- End Message ---
--- Begin Message ---
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.

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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.

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

--- End Message ---
--- Begin Message ---
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/

--- End Message ---

Reply via email to