php-general Digest 11 Jun 2006 14:02:40 -0000 Issue 4179

2006-06-11 Thread php-general-digest-help

php-general Digest 11 Jun 2006 14:02:40 - Issue 4179

Topics (messages 237746 through 237758):

Re: sending mail via php and unix box-clients thinks it's spam
237746 by: blackwater dev
237753 by: David Robley
237755 by: Dimiter Ivanov

Re: How to re-order an array
237747 by: jekillen
237749 by: Larry Garfield
237751 by: Paul Novitski

Re: Tables vs. databases
237748 by: Anthony Ettinger

Re: Running Scripts from the Command Line in Linux
237750 by: OOzy Pal

$B#1#0?M$r?)$($?!$*$$$7$#%5%$%H!*!*!*(B
237752 by: á

$B%a%C%;!%8$G$9(B
237754 by: [EMAIL PROTECTED]

remove keys from array
237756 by: Ahmed Abdel-Aliem

transform RDF to HTML via XSL and PHP
237757 by: Mario Pavlov

Simultaneous post/get?
237758 by: tedd

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:
php-general@lists.php.net


--
---BeginMessage---

Here is what I use as the header:

   $header=From:[EMAIL PROTECTED]: text/html;

Thanks!

On 5/31/06, Richard Lynch [EMAIL PROTECTED] wrote:


On Tue, May 30, 2006 12:45 pm, blackwater dev wrote:
 I have a site running on a linux box.  If I use my mail server via an
 email
 client, the email works fine but if I send email through the mail
 function,
 clients mark it as spam.  I see the line in php.ini for SMTP but that
 says
 windows only.  How do I tell php to use my mail server?

While it is possible that the IP has been logged as a spammer, it's
more likely that the email headers are tripping you up...

Compare the two sets of email headers and see what you get, and also
look at the information provided by the spam filters about WHY they
think it's spam.

--
Like Music?
http://l-i-e.com/artists.htm



---End Message---
---BeginMessage---
blackwater dev wrote:

 Here is what I use as the header:
 
 $header=From:[EMAIL PROTECTED]: text/html;

I think you need a space in there:

  $header=From: [EMAIL PROTECTED]: text/html;

 Thanks!
 
 On 5/31/06, Richard Lynch [EMAIL PROTECTED] wrote:

 On Tue, May 30, 2006 12:45 pm, blackwater dev wrote:
  I have a site running on a linux box.  If I use my mail server via an
  email
  client, the email works fine but if I send email through the mail
  function,
  clients mark it as spam.  I see the line in php.ini for SMTP but that
  says
  windows only.  How do I tell php to use my mail server?

 While it is possible that the IP has been logged as a spammer, it's
 more likely that the email headers are tripping you up...

 Compare the two sets of email headers and see what you get, and also
 look at the information provided by the spam filters about WHY they
 think it's spam.

 --
 Like Music?
 http://l-i-e.com/artists.htm







Cheers
-- 
David Robley

(C) 1992 Wild Bill's Machine Gun Shop and House of Wax.
Today is Boomtime, the 16th day of Confusion in the YOLD 3172. 
---End Message---
---BeginMessage---

On 6/11/06, David Robley [EMAIL PROTECTED] wrote:

blackwater dev wrote:

 Here is what I use as the header:

 $header=From:[EMAIL PROTECTED]: text/html;


As Richard Lynch, suggested you need to check the headers from both the emails.
Send exatcly the same mails to yourself, using both methods, and then
using your mail client, check the FULL headers, and compare them.
---End Message---
---BeginMessage---


On Jun 10, 2006, at 5:32 PM, Rafael wrote:

	Since you asked for some theory... theorically, you won't rely on 
javascript to prepare/validate/whatever some data to the server, 
that's what server-side scripts are for.
Note: you may use JS to make things quicker if possible, or to 
pre-digest the data, but you shall not rely entirely on JS.
You misunderstand my question. I know the limitations of javascript. 
The server won't respond to events registered in the browser. I write 
tons of forms that are all processed
by the client with javascript. I have written ferocious regex filters 
that hack apart form submissions before they even leave the client. I 
have set it up so if the client doesn't
have javascript enabled, the form won't submit if it is going to the 
server. That is why as much as possible I shift form processing to the 
client as much as possible, for
security and to off load work to the client. I use php to dynamically 
write js files when necessary, anticipating what data will be 
requested.
This is a problem that is more a matter of programming theory. I have 
posted to javascript forums and lists and have never got a response.
I will be applying this to dhtml which the server won't and can't do 
but may help things along with Ajax.
Just a simple suggestion about how to reorder arrays if you have a few 
words and suggestions. I'm not looking for free training.
I have been learning and using php and javascript for some 

php-general Digest 12 Jun 2006 02:29:43 -0000 Issue 4180

2006-06-11 Thread php-general-digest-help

php-general Digest 12 Jun 2006 02:29:43 - Issue 4180

Topics (messages 237759 through 237775):

Re: Simultaneous post/get?
237759 by: Stut
237761 by: tedd
237762 by: Stut
237764 by: tedd
237765 by: Stut
237766 by: tedd
237771 by: Lowell Allen

limiting downloads
237760 by: Michelle Konzack
237763 by: tedd

Re: remove keys from array
237767 by: Rabin Vincent
237772 by: Afan Pasalic

MySpace stuff?
237768 by: Brian Dunning
237774 by: Thorsten Suckow-Homberg

Re: How to re-order an array
237769 by: Rafael

Re: parsing out quoted text
237770 by: Stian Berger

Re: transform RDF to HTML via XSL and PHP
237773 by: Anthony Ettinger

Re: mail() function dying half way through. [SOLVED]
237775 by: Dave M G

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:
php-general@lists.php.net


--
---BeginMessage---

tedd wrote:

I am trying to use ajax to accomplish this.

The following statement works great and does what I want:

input type=submit value=Submit onClick=javascript:sndReq() 

However, when I place the statement within a form, like thus --

form method=post enctype=multipart/form-data input
type=hidden name=MAX_FILE_SIZE value=3 input
type=hidden name=stage value=1 input type=submit
value=Submit onClick=javascript:sndReq()  /form

-- the statement appears to no longer work.


The form is being submitted to the current URL which will stop any 
javascript executing at the time. What you need to do is prevent the 
form from being submitted, or control when it is submitted. Instead of 
using the onclick attribute on the button you should be using the 
onsubmit attribute in the form tag to control this. Fairly good 
explanation of this here:


http://www.htmlcodetutorial.com/forms/_FORM_onSubmit.html

-Stut
---End Message---
---BeginMessage---
At 3:21 PM +0100 6/11/06, Stut wrote:
tedd wrote:
I am trying to use ajax to accomplish this.

The following statement works great and does what I want:

input type=submit value=Submit onClick=javascript:sndReq() 

However, when I place the statement within a form, like thus --

form method=post enctype=multipart/form-data input
type=hidden name=MAX_FILE_SIZE value=3 input
type=hidden name=stage value=1 input type=submit
value=Submit onClick=javascript:sndReq()  /form

-- the statement appears to no longer work.

The form is being submitted to the current URL which will stop any javascript 
executing at the time. What you need to do is prevent the form from being 
submitted, or control when it is submitted. Instead of using the onclick 
attribute on the button you should be using the onsubmit attribute in the form 
tag to control this. Fairly good explanation of this here:

http://www.htmlcodetutorial.com/forms/_FORM_onSubmit.html

-Stut

-Stut:

Great suggestion, but I think an upload file a different critter.

http://www.htmlcodetutorial.com/forms/_INPUT_TYPE_FILE.html

For example, I took my above code and changed it like so --

form method=post enctype=multipart/form-data 
onSubmit=javascript:sndReq()
input type=file name=image value=3
input type=hidden name=stage value=1
input type=submit value=submit
/form

-- and the result was the same. The file uploaded, but nothing happened.

I also took the code you referenced, exactly as-was and I changed the FORM 
statement to --

form method=post enctype=multipart/form-data onSubmit=return 
TestDataCheck()

-- and it didn't work the way one would expect either.

Apparently, the built-in upload-file thing has it's own way of processing 
events. What do you think?

Thanks for your time.

tedd

-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com
---End Message---
---BeginMessage---

tedd wrote:

At 3:21 PM +0100 6/11/06, Stut wrote:

The form is being submitted to the current URL which will stop any
javascript executing at the time. What you need to do is prevent
the form from being submitted, or control when it is submitted.
Instead of using the onclick attribute on the button you should be
using the onsubmit attribute in the form tag to control this.
Fairly good explanation of this here:

http://www.htmlcodetutorial.com/forms/_FORM_onSubmit.html

-Stut


-Stut:

Great suggestion, but I think an upload file a different critter.

http://www.htmlcodetutorial.com/forms/_INPUT_TYPE_FILE.html

For example, I took my above code and changed it like so --

form method=post enctype=multipart/form-data
onSubmit=javascript:sndReq() input type=file name=image
value=3 input type=hidden name=stage value=1 input
type=submit value=submit /form

-- and the result was the same. The 

Re: [PHP] How to re-order an array

2006-06-11 Thread Paul Novitski

At 06:44 PM 6/9/2006, jekillen wrote:
...
A script begins with one indexed array (not associative) and one 
other indexed array

with the same values in a different order, the final order.
I want to create an interim array and progressively re order the 
array until it matches
slot for slot one of the original arrays. At this point the script 
is considered completed.
One important factor is that I'm looking to write this in javascript 
and the interim

array will be altered by the actions of a web page user.



You've asked your question in such abstract terms it's hard to know 
what logic to suggest.  Can you provide a concrete mini-example of 
the kind of array transformation you want to occur?


Paul 


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



Re: [PHP] sending mail via php and unix box-clients thinks it's spam

2006-06-11 Thread David Robley
blackwater dev wrote:

 Here is what I use as the header:
 
 $header=From:[EMAIL PROTECTED]: text/html;

I think you need a space in there:

  $header=From: [EMAIL PROTECTED]: text/html;

 Thanks!
 
 On 5/31/06, Richard Lynch [EMAIL PROTECTED] wrote:

 On Tue, May 30, 2006 12:45 pm, blackwater dev wrote:
  I have a site running on a linux box.  If I use my mail server via an
  email
  client, the email works fine but if I send email through the mail
  function,
  clients mark it as spam.  I see the line in php.ini for SMTP but that
  says
  windows only.  How do I tell php to use my mail server?

 While it is possible that the IP has been logged as a spammer, it's
 more likely that the email headers are tripping you up...

 Compare the two sets of email headers and see what you get, and also
 look at the information provided by the spam filters about WHY they
 think it's spam.

 --
 Like Music?
 http://l-i-e.com/artists.htm







Cheers
-- 
David Robley

(C) 1992 Wild Bill's Machine Gun Shop and House of Wax.
Today is Boomtime, the 16th day of Confusion in the YOLD 3172. 

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



Re: [PHP] sending mail via php and unix box-clients thinks it's spam

2006-06-11 Thread Dimiter Ivanov

On 6/11/06, David Robley [EMAIL PROTECTED] wrote:

blackwater dev wrote:

 Here is what I use as the header:

 $header=From:[EMAIL PROTECTED]: text/html;


As Richard Lynch, suggested you need to check the headers from both the emails.
Send exatcly the same mails to yourself, using both methods, and then
using your mail client, check the FULL headers, and compare them.

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



[PHP] remove keys from array

2006-06-11 Thread Ahmed Abdel-Aliem

hi all
when i have array in the form of :
Array ( [0] = 2 [ID] = 2 [1] = asdasd [CategoryName] = asdasd ) )
how can i make it in the form of :
Array ( [ID] = 2 [CategoryName] = asdasd ) )

can anyone help me with that plz ?

--
Ahmed Abdel-Aliem
Web Developer
www.SafariStudio.net
+20101108551
registered Linux user number 382789


[PHP] Simultaneous post/get?

2006-06-11 Thread tedd
Hi gang:

What I am trying to do is after the user has selected an image to upload, I 
want to display a gif while a file is being uploaded. (The gif can be seen at: 
http://xn--ovg.com/a4.php )

I am trying to use ajax to accomplish this.

The following statement works great and does what I want:

input type=submit value=Submit onClick=javascript:sndReq() 

However, when I place the statement within a form, like thus --

form method=post enctype=multipart/form-data 
input type=hidden name=MAX_FILE_SIZE value=3
input type=hidden name=stage value=1
input type=submit value=Submit onClick=javascript:sndReq() 
/form

-- the statement appears to no longer work.

The ajax script is using a 'get' and this form is using 'post' -- is this 
something that can't be done (.e., simultaneous post/get) or am I doing it 
wrong, or what's happening here?

Any ideas, suggestions, explanations, or comments welcomed?

Thanks in advance for your time.

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] Simultaneous post/get?

2006-06-11 Thread Stut

tedd wrote:

I am trying to use ajax to accomplish this.

The following statement works great and does what I want:

input type=submit value=Submit onClick=javascript:sndReq() 

However, when I place the statement within a form, like thus --

form method=post enctype=multipart/form-data input
type=hidden name=MAX_FILE_SIZE value=3 input
type=hidden name=stage value=1 input type=submit
value=Submit onClick=javascript:sndReq()  /form

-- the statement appears to no longer work.


The form is being submitted to the current URL which will stop any 
javascript executing at the time. What you need to do is prevent the 
form from being submitted, or control when it is submitted. Instead of 
using the onclick attribute on the button you should be using the 
onsubmit attribute in the form tag to control this. Fairly good 
explanation of this here:


http://www.htmlcodetutorial.com/forms/_FORM_onSubmit.html

-Stut

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



[PHP] limiting downloads

2006-06-11 Thread Michelle Konzack
Hello *,

I am on over 100 Mailinglists and want to make my archive (monthly
tarbals) public availlable.  my problem is, that they are around
20 GByte compressed archives and I want to prevent peoples to suck
the whole archive at once...

I was trying several things but failed.

Does anyone have a code sniplet which limit clients to, e.g. four
downloads, per day?

I think, I must use a database or something like this, because I
must track th IP, date, time, and the used download client...

I think, downloads limiting by creating accounts with passwords
will not help since spamer can create Yahoo or Hotmail accounts
faster than you can stop it...

Or should I pass the downloads via this nifty PIC/IMAGE verification,
where $USER must type in the numbers/letters created by a php script?

Greetings
Michelle Konzack


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
# Debian GNU/Linux Consultant #
Michelle Konzack   Apt. 917  ICQ #328449886
   50, rue de Soultz MSM LinuxMichi
0033/6/6192519367100 Strasbourg/France   IRC #Debian (irc.icq.com)

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



Re: [PHP] Simultaneous post/get?

2006-06-11 Thread tedd
At 3:21 PM +0100 6/11/06, Stut wrote:
tedd wrote:
I am trying to use ajax to accomplish this.

The following statement works great and does what I want:

input type=submit value=Submit onClick=javascript:sndReq() 

However, when I place the statement within a form, like thus --

form method=post enctype=multipart/form-data input
type=hidden name=MAX_FILE_SIZE value=3 input
type=hidden name=stage value=1 input type=submit
value=Submit onClick=javascript:sndReq()  /form

-- the statement appears to no longer work.

The form is being submitted to the current URL which will stop any javascript 
executing at the time. What you need to do is prevent the form from being 
submitted, or control when it is submitted. Instead of using the onclick 
attribute on the button you should be using the onsubmit attribute in the form 
tag to control this. Fairly good explanation of this here:

http://www.htmlcodetutorial.com/forms/_FORM_onSubmit.html

-Stut

-Stut:

Great suggestion, but I think an upload file a different critter.

http://www.htmlcodetutorial.com/forms/_INPUT_TYPE_FILE.html

For example, I took my above code and changed it like so --

form method=post enctype=multipart/form-data 
onSubmit=javascript:sndReq()
input type=file name=image value=3
input type=hidden name=stage value=1
input type=submit value=submit
/form

-- and the result was the same. The file uploaded, but nothing happened.

I also took the code you referenced, exactly as-was and I changed the FORM 
statement to --

form method=post enctype=multipart/form-data onSubmit=return 
TestDataCheck()

-- and it didn't work the way one would expect either.

Apparently, the built-in upload-file thing has it's own way of processing 
events. What do you think?

Thanks for your time.

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] Simultaneous post/get?

2006-06-11 Thread Stut

tedd wrote:

At 3:21 PM +0100 6/11/06, Stut wrote:

The form is being submitted to the current URL which will stop any
javascript executing at the time. What you need to do is prevent
the form from being submitted, or control when it is submitted.
Instead of using the onclick attribute on the button you should be
using the onsubmit attribute in the form tag to control this.
Fairly good explanation of this here:

http://www.htmlcodetutorial.com/forms/_FORM_onSubmit.html

-Stut


-Stut:

Great suggestion, but I think an upload file a different critter.

http://www.htmlcodetutorial.com/forms/_INPUT_TYPE_FILE.html

For example, I took my above code and changed it like so --

form method=post enctype=multipart/form-data
onSubmit=javascript:sndReq() input type=file name=image
value=3 input type=hidden name=stage value=1 input
type=submit value=submit /form

-- and the result was the same. The file uploaded, but nothing
happened.

I also took the code you referenced, exactly as-was and I changed
the FORM statement to --

form method=post enctype=multipart/form-data onSubmit=return
TestDataCheck()

-- and it didn't work the way one would expect either.

Apparently, the built-in upload-file thing has it's own way of
processing events. What do you think?


Maybe I'm not understanding what you're trying to do. I think you're 
trying to show an animated GIF before starting the file upload. Is that 
right? If it is, this is what you need to do...


The form, with onsubmit=return sndReq(). sndReq does the AJAX image 
thing (although I don't know why you're using AJAX here, but it doesn't 
matter). sndReq *must* return false!!


When the AJAX request completes the response presumably gets handled by 
another JS function. That function does whatever it needs to with the 
AJAX response, and then submits the form. I'm not sure if 
programmatically submitting a form calls the onsubmit handler, you'll 
have to check that. If it does just make sure sndReq does nothing on the 
second call except return true - that will tell the form it's ok to do 
the submit.


Another way you might want to consider for this is to use an iframe. Set 
the target of the form to an iframe, that way the JS running in the main 
page will not get stopped.


Hope that helps.

-Stut

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



Re: [PHP] limiting downloads

2006-06-11 Thread tedd
At 1:51 PM +0200 6/10/06, Michelle Konzack wrote:
Hello *,

I am on over 100 Mailinglists and want to make my archive (monthly
tarbals) public availlable.  my problem is, that they are around
20 GByte compressed archives and I want to prevent peoples to suck
the whole archive at once...

I was trying several things but failed.

Does anyone have a code sniplet which limit clients to, e.g. four
downloads, per day?

I think, I must use a database or something like this, because I
must track th IP, date, time, and the used download client...

I think, downloads limiting by creating accounts with passwords
will not help since spamer can create Yahoo or Hotmail accounts
faster than you can stop it...

Or should I pass the downloads via this nifty PIC/IMAGE verification,
where $USER must type in the numbers/letters created by a php script?

Greetings
Michelle Konzack

Michelle:

If it was my problem, I would have people register and store their registration 
(logon and password) in a dB and require them to accept cookies. I think that 
would both slow-down and limit downloads.

As for PIC/IMAGE thing it's called CAPTCHLA and that would help keep out 
spammers, but you would cut out the visually impaired. You might want to read 
this:

http://www.access-matters.com/2005/05/22/quiz-115-did-a-captcha-catch-ya/

hth's

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] Simultaneous post/get?

2006-06-11 Thread tedd
At 4:35 PM +0100 6/11/06, Stut wrote:

-snip-

Maybe I'm not understanding what you're trying to do. I think you're trying to 
show an animated GIF before starting the file upload. Is that right? If it is, 
this is what you need to do...

That's exactly what I'm trying to do.

The form, with onsubmit=return sndReq(). sndReq does the AJAX image thing 
(although I don't know why you're using AJAX here,

I'm using ajax because it's a method to inject an image in a DOM div without 
having to reload the current page.

My method is pretty straightforward.

1. Present the user with a page that has the typical Choose File and Submit 
button for uploading an image file.

2. After the user selects the file he/she wants to upload, they then click 
Submit and the file uploads (a wait) and then they go to the next step on 
another page.

All I want to do is present an image during the wait.

Is there an easier way to do this?

I'll investigate your suggestion to look into iframes.

Thanks.

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] Simultaneous post/get?

2006-06-11 Thread Stut

tedd wrote:

At 4:35 PM +0100 6/11/06, Stut wrote:
The form, with onsubmit=return sndReq(). sndReq does the AJAX 
image thing (although I don't know why you're using AJAX here,


I'm using ajax because it's a method to inject an image in a DOM div 
without having to reload the current page.


All I want to do is present an image during the wait.

Is there an easier way to do this?


There is no need to hit the server for this. Simply include display:
none; in the style for either the img tag or the div containing it so
it's not shown when the page initially loads. In the onsubmit for the
form change that display to 'block' to show the image. This also avoids
the need to postpone posting the form since the image has already loaded.

Image...

img id=waitimg src=/whatever.gif style=display: none; /

Form...

form ... onsubmit=document.getElementById('waitimg').style.display =
'block'; return true;


I'll investigate your suggestion to look into iframes.


Ignore that. An iframe is not the best way to solve this.

-Stut

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



Re: [PHP] Simultaneous post/get?

2006-06-11 Thread tedd
At 5:46 PM +0100 6/11/06, Stut wrote:
tedd wrote:
At 4:35 PM +0100 6/11/06, Stut wrote:
The form, with onsubmit=return sndReq(). sndReq does the AJAX image thing 
(although I don't know why you're using AJAX here,

I'm using ajax because it's a method to inject an image in a DOM div without 
having to reload the current page.

All I want to do is present an image during the wait.

Is there an easier way to do this?

There is no need to hit the server for this. Simply include display:
none; in the style for either the img tag or the div containing it so
it's not shown when the page initially loads. In the onsubmit for the
form change that display to 'block' to show the image. This also avoids
the need to postpone posting the form since the image has already loaded.

Image...

img id=waitimg src=/whatever.gif style=display: none; /

Form...

form ... onsubmit=document.getElementById('waitimg').style.display =
'block'; return true;

Bingo!

That works slick ! While I *think* I know css, it would have taken me a long 
while before I would have turned to css to solve this.

Your solution works much better than the convoluted code I was writing. It's 
clear that I need to understand js better.

Thanks much Stut.

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] remove keys from array

2006-06-11 Thread Rabin Vincent

On 6/11/06, Ahmed Abdel-Aliem [EMAIL PROTECTED] wrote:

when i have array in the form of :
Array ( [0] = 2 [ID] = 2 [1] = asdasd [CategoryName] = asdasd ) )
how can i make it in the form of :
Array ( [ID] = 2 [CategoryName] = asdasd ) )


To remove a single element you can use unset: unset($arr[0]);. To
remove all the elements with integer indices you could just loop, check,
and unset those ones.

What do you need to do this for? Your examples looks like arrays got
from mysql_fetch_array. If this is so, using mysql_fetch_assoc() instead
of that will get you only the associative array.

Rabin

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



[PHP] MySpace stuff?

2006-06-11 Thread Brian Dunning
Has anyone made some classes for automating MySpace activities: a  
friend adder, comment poster, etc.? Thanks...


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



Re: [PHP] Re: How to re-order an array

2006-06-11 Thread Rafael

jekillen wrote:
[···]
You misunderstand my question. I know the limitations of javascript. The 
server won't respond to events registered in the browser. I write tons 
of forms that are all processed
by the client with javascript. I have written ferocious regex filters 
that hack apart form submissions before they even leave the client. I 
have set it up so if the client doesn't
have javascript enabled, the form won't submit if it is going to the 
server. That is why as much as possible I shift form processing to the 
client as much as possible, for
security and to off load work to the client. I use php to dynamically 
write js files when necessary, anticipating what data will be requested.


	I didn't (misunderstood), what I told you is that you cannot rely on 
javascript (actually, that would be anything coming from the client) 
You need to do validate on the server, and it doesn't matter if you 
already did it on the client or not (simply because you cannot know that 
for sure)


This is a problem that is more a matter of programming theory. I have 
posted to javascript forums and lists and have never got a response.
I will be applying this to dhtml which the server won't and can't do but 
may help things along with Ajax.
Just a simple suggestion about how to reorder arrays if you have a few 
words and suggestions. I'm not looking for free training.
I have been learning and using php and javascript for some five years 
and have developed my own approach to testing and debugging
and such. So I am not really a newby. I have made the dumb mistakes of 
asking for help from forums and lists when it was just a dumb
syntax error that I couldn't expect anyone but my self to find, which i 
have in 99.9% of the cases. Some times it is nice to get some
quick help from a list and I will try to return the favor when ever 
possible to the next person looking for help that I have some answers for.


	Well, I asked you for the actual (JS) code you're using (the one that 
didn't work in all the intended browsers), that way someone might be 
able to help you (I will if I can)

--
Atentamente / Sincerely,
J. Rafael Salazar Magaña

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



[PHP] Re: parsing out quoted text

2006-06-11 Thread Stian Berger

On Fri, 09 Jun 2006 14:53:09 +0200, sam [EMAIL PROTECTED] wrote:



$str='bass electric organ bagpipes';

$parser($str);

$query=SELECT * FROM table WHERE tb_instr = bass
 AND tb_instr = electric organ //quoted phrase
 AND tb_instr = bagpipes;


Anybody know where I can just copy code that will do the above?

thanks


I once for just the fun of it, made a regular expression to solve
this kind of problem. I haven't tried it in production enviroment,
but only on some basic examples. It should support both single and
double quotes.

$str = 'bass electric organ bagpipes';
preg_match_all(/(?=('|\))[^\\1]+(?=\\1)|[^ \']+/,$str,$match);
/*
$match[0] Array
(
[0] = bass
[1] = electric organ
[2] = bagpipes
)
*/
foreach($match[0] as $key = $value) {
$match[0][$key] = 'tb_instr = '.mysql_escape_string($value).'';
}
$sql = SELECT * FROM table WHERE .implode(' AND ',$match[0]);
print($sql);

//SELECT * FROM table WHERE tb_instr = bass AND
//tb_instr = electric organ AND tb_instr = bagpipes

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



Re: [PHP] Simultaneous post/get?

2006-06-11 Thread Lowell Allen

On Jun 11, 2006, at 2:02 PM, tedd wrote:


At 5:46 PM +0100 6/11/06, Stut wrote:

tedd wrote:

At 4:35 PM +0100 6/11/06, Stut wrote:
The form, with onsubmit=return sndReq(). sndReq does the AJAX 
image thing (although I don't know why you're using AJAX here,


I'm using ajax because it's a method to inject an image in a DOM div 
without having to reload the current page.


All I want to do is present an image during the wait.

Is there an easier way to do this?


There is no need to hit the server for this. Simply include display:
none; in the style for either the img tag or the div containing it so
it's not shown when the page initially loads. In the onsubmit for the
form change that display to 'block' to show the image. This also 
avoids
the need to postpone posting the form since the image has already 
loaded.


Image...

img id=waitimg src=/whatever.gif style=display: none; /

Form...

form ... onsubmit=document.getElementById('waitimg').style.display =
'block'; return true;


Bingo!

That works slick ! While I *think* I know css, it would have taken me 
a long while before I would have turned to css to solve this.


I recall trying this (exactly this I think) a couple months ago and 
finding that it works in most browsers, but not in Windows IE6 (of 
course). Is it working in Windows IE6 for you?


I got a working upload progress bar by using Uber Uploader 
http://sourceforge.net/projects/uber-uploader.


--
Lowell Allen

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



Re: [PHP] remove keys from array

2006-06-11 Thread Afan Pasalic

if you pull this array from mysql use this:
$query = mysql_query(SELECT * FROM table);
$result = mysql_fetch_array($query, MYSQL_ASSOC);

-afan

Rabin Vincent wrote:

On 6/11/06, Ahmed Abdel-Aliem [EMAIL PROTECTED] wrote:

when i have array in the form of :
Array ( [0] = 2 [ID] = 2 [1] = asdasd [CategoryName] = asdasd ) )
how can i make it in the form of :
Array ( [ID] = 2 [CategoryName] = asdasd ) )


To remove a single element you can use unset: unset($arr[0]);. To
remove all the elements with integer indices you could just loop, check,
and unset those ones.

What do you need to do this for? Your examples looks like arrays got
from mysql_fetch_array. If this is so, using mysql_fetch_assoc() instead
of that will get you only the associative array.

Rabin



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



Re: [PHP] transform RDF to HTML via XSL and PHP

2006-06-11 Thread Anthony Ettinger

xsl:template match=rdf:RDF
 html
  body
table border=1
  xsl:for-each select=item
  tr
tdxsl:value-of select=title//td
tdxsl:value-of select=link//td
  /tr
  /xsl:for-each
/table
  /body
  /html
/xsl:template
/xsl:stylesheet



I'ts been awhile, but try the above.

--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

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



Re: [PHP] MySpace stuff?

2006-06-11 Thread Thorsten Suckow-Homberg


Has anyone made some classes for automating MySpace activities: a 
friend adder, comment poster, etc.? Thanks...




http://blog.phpdoc.info/archives/39-MySpace-Welcome-to-Web-0.5-and-a-Y!Maps-toy.html


I don't know if it will help you, but it is worth the read :D

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



Re: [PHP] mail() function dying half way through. [SOLVED]

2006-06-11 Thread Dave M G

Chris, Richard,

Thank you for your advice.

Inserting sleep(1) into the script seems to have done the trick.

I will also look into the other alternatives you suggest, such as 
different mail programs and the error output of mail() to see if I can 
optimize the system further.


Thank you for taking the time to help.

--
Dave M G

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



Re: [PHP] Re: How to re-order an array

2006-06-11 Thread jekillen


On Jun 11, 2006, at 1:21 PM, Rafael wrote:


jekillen wrote:
[···]
You misunderstand my question. I know the limitations of javascript. 
The server won't respond to events registered in the browser. I write 
tons of forms that are all processed
by the client with javascript. I have written ferocious regex filters 
that hack apart form submissions before they even leave the client. I 
have set it up so if the client doesn't
have javascript enabled, the form won't submit if it is going to the 
server. That is why as much as possible I shift form processing to 
the client as much as possible, for
security and to off load work to the client. I use php to dynamically 
write js files when necessary, anticipating what data will be 
requested.


	I didn't (misunderstood), what I told you is that you cannot rely on 
javascript (actually, that would be anything coming from the client) 
You need to do validate on the server, and it doesn't matter if you 
already did it on the client or not (simply because you cannot know 
that for sure)


This is a problem that is more a matter of programming theory. I have 
posted to javascript forums and lists and have never got a response.
I will be applying this to dhtml which the server won't and can't do 
but may help things along with Ajax.
Just a simple suggestion about how to reorder arrays if you have a 
few words and suggestions. I'm not looking for free training.
I have been learning and using php and javascript for some five years 
and have developed my own approach to testing and debugging
and such. So I am not really a newby. I have made the dumb mistakes 
of asking for help from forums and lists when it was just a dumb
syntax error that I couldn't expect anyone but my self to find, which 
i have in 99.9% of the cases. Some times it is nice to get some
quick help from a list and I will try to return the favor when ever 
possible to the next person looking for help that I have some answers 
for.


	Well, I asked you for the actual (JS) code you're using (the one that 
didn't work in all the intended browsers), that way someone might be 
able to help you (I will if I can)

Array.push(), Array.pop(), Array.shift(), Array.unshift().
I thought that if I used Ajax, php could use its push and pop, shift 
and unshift functions, but not all browsers support the asymetric 
requests.
I do screen in the server. But I force the user to have javascript 
enabled and force the form to submit using javascipt, and have a unique 
id as a javascript variable
that is sent along with the form in a hidden field to identify the 
source of the form data. I never use get requests unless they are 
appended to anchor tags, even
in  forms that are not processed by the server (I.E. running javascript 
code with user supplied arguments to functions via form fields, in 
which case an action attribute

isn't even necessary, and like wise a post or get method).
JK


--
Atentamente / Sincerely,
J. Rafael Salazar Magaña

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



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



Re: [PHP] Mail sending program (beginner)

2006-06-11 Thread aci india

Since it was sunday I was not able to thank instently. Thanks for the help.
Thanks to all.
[snipped...]