Re: [PHP] Re: how do I use php://memory?

2010-01-30 Thread Shawn McKenzie
Daniel P. Brown wrote:
 (Typing from the DROID, so forgive the top-posting.)
 
 Shawn, would you take a few moments to submit this as a bug at
 http://bugs.php.net/? I know you well enough that, if you say the docs suck,
 they probably do.
 
 On Jan 29, 2010 10:47 PM, Shawn McKenzie nos...@mckenzies.net wrote:
 
 Eric Lee wrote:
 On Sat, Jan 30, 2010 at 9:00 AM, Shawn McKenzie nos...@mckenzies.net
 wrote:

 ...
 So maybe it only works with an open file/stream resource? Hard to tell
 with no docs.
 
 
 --
 
 Thanks!
 -Shawn
 http://www.spidean.com
 

Done.  Thanks Dan.  http://bugs.php.net/bug.php?id=50886

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Re: how do I use php://memory?

2010-01-30 Thread Daniel Brown
On Sat, Jan 30, 2010 at 12:18, Shawn McKenzie nos...@mckenzies.net wrote:

 Done.  Thanks Dan.  http://bugs.php.net/bug.php?id=50886

Thank you, sir.  I thanked you on Facebook when I saw the report
come in, but wanted to thank you properly here as well.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Looking for hosting or dedicated servers?  Ask me how we can fit your budget!

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



[PHP] Re: how do I use php://memory?

2010-01-29 Thread Shawn McKenzie
Mari Masuda wrote:

 Has anyone ever successfully used php://memory before?  If so, what
 can I do to use it in my code?  Thank you.

No, but I was intrigued to try it, so I tested this:

$text = 'Some text.';
file_put_contents('php://memory', $text);
echo file_get_contents('php://memory');

And it returned nothing.  The docs suck on this and it apparently
doesn't work.  I see others use it with fopen(), but there is no mention
of which file functions it works with and which it doesn't.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Re: how do I use php://memory?

2010-01-29 Thread Eric Lee
On Sat, Jan 30, 2010 at 9:00 AM, Shawn McKenzie nos...@mckenzies.netwrote:

 Mari Masuda wrote:

  Has anyone ever successfully used php://memory before?  If so, what
  can I do to use it in my code?  Thank you.

 No, but I was intrigued to try it, so I tested this:

 $text = 'Some text.';
 file_put_contents('php://memory', $text);
 echo file_get_contents('php://memory');

 And it returned nothing.  The docs suck on this and it apparently
 doesn't work.  I see others use it with fopen(), but there is no mention
 of which file functions it works with and which it doesn't.



Shawn

I did a sample test from the manual with fopen like this,


?php

$fp = fopen('php://memory', 'r+');

if ($fp)
{
fputs($fp, line 1\n);
}

rewind($fp);
echo stream_get_contents($fp);

?

console output

F:\wc\trunkphp -f m.php
line 1



Regards,
Eric,

--
 Thanks!
 -Shawn
 http://www.spidean.com

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




Re: [PHP] Re: how do I use php://memory?

2010-01-29 Thread Shawn McKenzie
Eric Lee wrote:
 On Sat, Jan 30, 2010 at 9:00 AM, Shawn McKenzie nos...@mckenzies.netwrote:
 
 Mari Masuda wrote:

 Has anyone ever successfully used php://memory before?  If so, what
 can I do to use it in my code?  Thank you.
 No, but I was intrigued to try it, so I tested this:

 $text = 'Some text.';
 file_put_contents('php://memory', $text);
 echo file_get_contents('php://memory');

 And it returned nothing.  The docs suck on this and it apparently
 doesn't work.  I see others use it with fopen(), but there is no mention
 of which file functions it works with and which it doesn't.


 
 Shawn
 
 I did a sample test from the manual with fopen like this,
 
 
 ?php
 
 $fp = fopen('php://memory', 'r+');
 
 if ($fp)
 {
 fputs($fp, line 1\n);
 }
 
 rewind($fp);
 echo stream_get_contents($fp);
 
 ?
 
 console output
 
 F:\wc\trunkphp -f m.php
 line 1
 
 
 
 Regards,
 Eric,

So maybe it only works with an open file/stream resource? Hard to tell
with no docs.


-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Re: how do I use php://memory?

2010-01-29 Thread Daniel P. Brown
(Typing from the DROID, so forgive the top-posting.)

Shawn, would you take a few moments to submit this as a bug at
http://bugs.php.net/? I know you well enough that, if you say the docs suck,
they probably do.

On Jan 29, 2010 10:47 PM, Shawn McKenzie nos...@mckenzies.net wrote:

Eric Lee wrote:
 On Sat, Jan 30, 2010 at 9:00 AM, Shawn McKenzie nos...@mckenzies.net
wrote:

...
So maybe it only works with an open file/stream resource? Hard to tell
with no docs.


--

Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubsc...


[PHP] Re: How do I remove unused GET parameters from the URL?

2010-01-20 Thread Nathan Rixham
Daevid Vincent wrote:
 BTW, I want to use GET so that the page can be bookmarked for future
 searches of the same data (or modified easily with different dates, etc.),
 so that's why I don't use POST.
 

to do as you say on the clientside you'd probably be best to write a
short js script to build the get url from the form data; and on the
serverside just take the klunky approach you mentioned.

worth thinking about scenarios where a field is empty on the initial
search though; but a user may want to modify it by entering in a value
to a previously blank field (which would at this point be stripped); so
maybe removal isn't the best option.

possibly worth considering having a GET url which (p)re-populates the
form (rather than direct to the search results) so the search can be
easily modified before submitting it..?

also you could just pass the url through to an url shrinker; if you use
the api of bit.ly or suchlike you could do this serverside; and reap the
benefits of stats for each search too.

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



Re: [PHP] Re: How do I extract link text from anchor tag as well as the URL from the href attribute

2009-08-22 Thread Raymond Irving
Hello,

You might also want to try using the Raxan framework:

require_once 'raxan/pdi/gateway.php';

$page = new RichWebPage('page.html');
echo $page['a']-text(); // this will get the text betwen the a tag
 
To get the image element use:

$elm = $page['a img']-node(0);

You can download Raxan here:
http://raxanpdi.com/downloads.html

__
Raymond Irving

--- On Sat, 8/22/09, Manuel Lemos mle...@acm.org wrote:

From: Manuel Lemos mle...@acm.org
Subject: [PHP] Re: How do I extract link text from anchor tag as well as the 
URL from the href attribute
To: chrysanhy phpli...@hyphusonline.com
Cc: php-general@lists.php.net
Date: Saturday, August 22, 2009, 1:07 AM

Hello,

on 08/16/2009 04:33 AM chrysanhy said the following:
 I have the following code to extract the URLs from the anchor tags of an
 HTML page:
 
 $html = new DOMDocument();
 $htmlpage-loadHtmlFile($location);
 $xpath = new DOMXPath($htmlpage);
 $links = $xpath-query( '//a' );
 foreach ($links as $link)
 { $int_url_list[$i++] = $link-getAttribute( 'href' ) . \n; }
 
 If I have a link a href=http://X.com;/a, how do I extract the
 corresponding  which is displayed to the user as the text of the link
 (if it's an image tag, I would like a DOMElement for that).
 Thanks

You may want to try this HTML parser class that comes with filter class
and an example script named test_get_html_links.php  that does exactly
what you ask.

http://www.phpclasses.org/secure-html-filter

-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



[PHP] Re: How do I extract link text from anchor tag as well as the URL from the href attribute

2009-08-21 Thread Manuel Lemos
Hello,

on 08/16/2009 04:33 AM chrysanhy said the following:
 I have the following code to extract the URLs from the anchor tags of an
 HTML page:
 
 $html = new DOMDocument();
 $htmlpage-loadHtmlFile($location);
 $xpath = new DOMXPath($htmlpage);
 $links = $xpath-query( '//a' );
 foreach ($links as $link)
 { $int_url_list[$i++] = $link-getAttribute( 'href' ) . \n; }
 
 If I have a link a href=http://X.com;/a, how do I extract the
 corresponding  which is displayed to the user as the text of the link
 (if it's an image tag, I would like a DOMElement for that).
 Thanks

You may want to try this HTML parser class that comes with filter class
and an example script named test_get_html_links.php  that does exactly
what you ask.

http://www.phpclasses.org/secure-html-filter

-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



[PHP] Re: How do I extract link text from anchor tag as well as the URL from the href attribute

2009-08-16 Thread Ralph Deffke

try

$link-nodeValue()

or

$link-getContent()

im not shure which one works on an image link which is indeed a child of a
so u could also check if the node has a child, if so its an image with, in
good practice. an alt attribute to use

haven't tried but should work. let me know pls

ralph_def...@yahoo.de


chrysanhy phpli...@hyphusonline.com wrote in message
news:88827b190908160033n226b370bqe2ab70732811...@mail.gmail.com...
 I have the following code to extract the URLs from the anchor tags of an
 HTML page:

 $html = new DOMDocument();
 $htmlpage-loadHtmlFile($location);
 $xpath = new DOMXPath($htmlpage);
 $links = $xpath-query( '//a' );
 foreach ($links as $link)
 { $int_url_list[$i++] = $link-getAttribute( 'href' ) . \n; }

 If I have a link a href=http://X.com;/a, how do I extract the
 corresponding  which is displayed to the user as the text of the link
 (if it's an image tag, I would like a DOMElement for that).
 Thanks




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



Re: [PHP] Re: How do I extract link text from anchor tag as well as the URL from the href attribute

2009-08-16 Thread chrysanhy
It did not work. Both gave me a Call to undefined method fatal error.

On Sun, Aug 16, 2009 at 1:43 AM, Ralph Deffke ralph_def...@yahoo.de wrote:


 try

 $link-nodeValue()

 or

 $link-getContent()

 im not shure which one works on an image link which is indeed a child of a
 so u could also check if the node has a child, if so its an image with, in
 good practice. an alt attribute to use

 haven't tried but should work. let me know pls

 ralph_def...@yahoo.de


 chrysanhy phpli...@hyphusonline.com wrote in message
 news:88827b190908160033n226b370bqe2ab70732811...@mail.gmail.com...
  I have the following code to extract the URLs from the anchor tags of an
  HTML page:
 
  $html = new DOMDocument();
  $htmlpage-loadHtmlFile($location);
  $xpath = new DOMXPath($htmlpage);
  $links = $xpath-query( '//a' );
  foreach ($links as $link)
  { $int_url_list[$i++] = $link-getAttribute( 'href' ) . \n; }
 
  If I have a link a href=http://X.com;/a, how do I extract the
  corresponding  which is displayed to the user as the text of the link
  (if it's an image tag, I would like a DOMElement for that).
  Thanks
 



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




[PHP] Re: How do I extract link text from anchor tag as well as the URL from the href attribute

2009-08-16 Thread Ralph Deffke
did u try it something like this

foreach ($links as $link) {
$int_url_list[$i][href] = $link-getAttribute( 'href' );
$int_url_list[$i++][linkText] = $link-getContent(  ); // nodeValue();
}
that should work

send ur code then please
ralph_def...@yahoo,de


chrysanhy phpli...@hyphusonline.com wrote in message
news:88827b190908160033n226b370bqe2ab70732811...@mail.gmail.com...
 I have the following code to extract the URLs from the anchor tags of an
 HTML page:

 $html = new DOMDocument();
 $htmlpage-loadHtmlFile($location);
 $xpath = new DOMXPath($htmlpage);
 $links = $xpath-query( '//a' );
 foreach ($links as $link)
 { $int_url_list[$i++] = $link-getAttribute( 'href' ) . \n; }

 If I have a link a href=http://X.com;/a, how do I extract the
 corresponding  which is displayed to the user as the text of the link
 (if it's an image tag, I would like a DOMElement for that).
 Thanks




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



Re: [PHP] Re: How do I extract link text from anchor tag as well as the URL from the href attribute

2009-08-16 Thread chrysanhy
WHile waiting for suggestions for extracting the link text from the DOM, I
tried a brute force approach using the URLs I had found with getAttribute(),
but found myself baffled by my results. I boiled down my issue with this
approach to the following snippet.

$htmldata =EOB
http://www.protools.com/users/user_story.cfm?story_id=1162amp;lang=1;quot;Creating

Surround Mixes with Tim Weidner/aquot; img height=11
src=new.gif width=28
- iMagnification/i engineer talks about mixing the album at
the
iProTools/i site, by Jim Batchco
http://www.beyondmusic.com/MediaPlayer/Yes/DontGo.html;quot;Don't
Goquot; Video/aa href=
http://fi.soneraplaza.net/kaista/musiq/kaistatv/0,8883,201392,00.html;/a
img height=11 src=new.gif width=28 - Presented by Beyond
Music
(a href=http://www.apple.com/quicktime/download/;QuickTime/a

Required)
EOB;
$url = 'http://www.beyondmusic.com/MediaPlayer/Yes/DontGo.html';
$posn = strpos($url, $htmldata);
echo URL |$url| position is |$posn|;

Running this gives me:

URL |http://www.beyondmusic.com/MediaPlayer/Yes/DontGo.html| position is ||

I've tried lots of functions, and even regular expressions, but I cannot get
the code to find the URL in the HTML. While I still hope for a DOM solution
to getting this link text, WHY can't the code find the URL in the HTML
snippet?

On Sun, Aug 16, 2009 at 9:29 AM, chrysanhy phpli...@hyphusonline.comwrote:

 I pasted the code exactly as you have it, and I got the following:

 *Fatal error*: Call to undefined method DOMElement::getContent()

 I got the same thing with nodeValue().


 On Sun, Aug 16, 2009 at 7:35 AM, Ralph Deffke ralph_def...@yahoo.dewrote:

 did u try it something like this

 foreach ($links as $link) {
$int_url_list[$i][href] = $link-getAttribute( 'href' );
$int_url_list[$i++][linkText] = $link-getContent(  ); //
 nodeValue();
 }
 that should work

 send ur code then please
 ralph_def...@yahoo,de


 chrysanhy phpli...@hyphusonline.com wrote in message
 news:88827b190908160033n226b370bqe2ab70732811...@mail.gmail.com...
  I have the following code to extract the URLs from the anchor tags of an
  HTML page:
 
  $html = new DOMDocument();
  $htmlpage-loadHtmlFile($location);
  $xpath = new DOMXPath($htmlpage);
  $links = $xpath-query( '//a' );
  foreach ($links as $link)
  { $int_url_list[$i++] = $link-getAttribute( 'href' ) . \n; }
 
  If I have a link a href=http://X.com;/a, how do I extract the
  corresponding  which is displayed to the user as the text of the
 link
  (if it's an image tag, I would like a DOMElement for that).
  Thanks
 



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





Re: [PHP] Re: How do I extract link text from anchor tag as well as the URL from the href attribute

2009-08-16 Thread Ralph Deffke
well the immage goes inside the a.. img... /a

on ur html the node a has no value however u should not get a error

this is pergect jtml link
a href=thema.htmimg src=button4.jpg width=160 height=34
border=0 alt=THEMA/a

ralph

chrysanhy phpli...@hyphusonline.com wrote in message
news:88827b190908160943t2254137fve43771c7e4f8c...@mail.gmail.com...
 WHile waiting for suggestions for extracting the link text from the DOM, I
 tried a brute force approach using the URLs I had found with
getAttribute(),
 but found myself baffled by my results. I boiled down my issue with this
 approach to the following snippet.

 $htmldata =EOB

http://www.protools.com/users/user_story.cfm?story_id=1162amp;lang=1;quot;Creating

 Surround Mixes with Tim Weidner/aquot; img height=11
 src=new.gif width=28
 - iMagnification/i engineer talks about mixing the album
at
 the
 iProTools/i site, by Jim Batchco
 http://www.beyondmusic.com/MediaPlayer/Yes/DontGo.html;quot;Don't
 Goquot; Video/aa href=

http://fi.soneraplaza.net/kaista/musiq/kaistatv/0,8883,201392,00.html;/a
 img height=11 src=new.gif width=28 - Presented by
Beyond
 Music
 (a
href=http://www.apple.com/quicktime/download/;QuickTime/a

 Required)
 EOB;
 $url = 'http://www.beyondmusic.com/MediaPlayer/Yes/DontGo.html';
 $posn = strpos($url, $htmldata);
 echo URL |$url| position is |$posn|;

 Running this gives me:

 URL |http://www.beyondmusic.com/MediaPlayer/Yes/DontGo.html| position is
||

 I've tried lots of functions, and even regular expressions, but I cannot
get
 the code to find the URL in the HTML. While I still hope for a DOM
solution
 to getting this link text, WHY can't the code find the URL in the HTML
 snippet?

 On Sun, Aug 16, 2009 at 9:29 AM, chrysanhy
phpli...@hyphusonline.comwrote:

  I pasted the code exactly as you have it, and I got the following:
 
  *Fatal error*: Call to undefined method DOMElement::getContent()
 
  I got the same thing with nodeValue().
 
 
  On Sun, Aug 16, 2009 at 7:35 AM, Ralph Deffke
ralph_def...@yahoo.dewrote:
 
  did u try it something like this
 
  foreach ($links as $link) {
 $int_url_list[$i][href] = $link-getAttribute( 'href' );
 $int_url_list[$i++][linkText] = $link-getContent(  ); //
  nodeValue();
  }
  that should work
 
  send ur code then please
  ralph_def...@yahoo,de
 
 
  chrysanhy phpli...@hyphusonline.com wrote in message
  news:88827b190908160033n226b370bqe2ab70732811...@mail.gmail.com...
   I have the following code to extract the URLs from the anchor tags of
an
   HTML page:
  
   $html = new DOMDocument();
   $htmlpage-loadHtmlFile($location);
   $xpath = new DOMXPath($htmlpage);
   $links = $xpath-query( '//a' );
   foreach ($links as $link)
   { $int_url_list[$i++] = $link-getAttribute( 'href' ) . \n; }
  
   If I have a link a href=http://X.com;/a, how do I extract
the
   corresponding  which is displayed to the user as the text of the
  link
   (if it's an image tag, I would like a DOMElement for that).
   Thanks
  
 
 
 
  --
  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] Re: How do I extract link text from anchor tag as well as the URL from the href attribute

2009-08-16 Thread Ralph Deffke
this worked here:
?php

$html = new DOMDocument();
$html-loadHtmlFile(testHtml.html);
$links = $html-getElementsByTagName('a');
echo pre;

foreach ($links as $item) {
  echo $item-getAttribute( 'href' ). \n;
  echo --- . $item-nodeValue . \n;
}

echo /pre;

?

Im sending u the 2 files directly in a minute. it came out, as I thought
earlier that u have to check if the a tags has got children to extract
image links.

ralph_def...@yahoo.de


chrysanhy phpli...@hyphusonline.com wrote in message
news:88827b190908160943t2254137fve43771c7e4f8c...@mail.gmail.com...
 WHile waiting for suggestions for extracting the link text from the DOM, I
 tried a brute force approach using the URLs I had found with
getAttribute(),
 but found myself baffled by my results. I boiled down my issue with this
 approach to the following snippet.

 $htmldata =EOB

http://www.protools.com/users/user_story.cfm?story_id=1162amp;lang=1;quot;Creating

 Surround Mixes with Tim Weidner/aquot; img height=11
 src=new.gif width=28
 - iMagnification/i engineer talks about mixing the album
at
 the
 iProTools/i site, by Jim Batchco
 http://www.beyondmusic.com/MediaPlayer/Yes/DontGo.html;quot;Don't
 Goquot; Video/aa href=

http://fi.soneraplaza.net/kaista/musiq/kaistatv/0,8883,201392,00.html;/a
 img height=11 src=new.gif width=28 - Presented by
Beyond
 Music
 (a
href=http://www.apple.com/quicktime/download/;QuickTime/a

 Required)
 EOB;
 $url = 'http://www.beyondmusic.com/MediaPlayer/Yes/DontGo.html';
 $posn = strpos($url, $htmldata);
 echo URL |$url| position is |$posn|;

 Running this gives me:

 URL |http://www.beyondmusic.com/MediaPlayer/Yes/DontGo.html| position is
||

 I've tried lots of functions, and even regular expressions, but I cannot
get
 the code to find the URL in the HTML. While I still hope for a DOM
solution
 to getting this link text, WHY can't the code find the URL in the HTML
 snippet?

 On Sun, Aug 16, 2009 at 9:29 AM, chrysanhy
phpli...@hyphusonline.comwrote:

  I pasted the code exactly as you have it, and I got the following:
 
  *Fatal error*: Call to undefined method DOMElement::getContent()
 
  I got the same thing with nodeValue().
 
 
  On Sun, Aug 16, 2009 at 7:35 AM, Ralph Deffke
ralph_def...@yahoo.dewrote:
 
  did u try it something like this
 
  foreach ($links as $link) {
 $int_url_list[$i][href] = $link-getAttribute( 'href' );
 $int_url_list[$i++][linkText] = $link-getContent(  ); //
  nodeValue();
  }
  that should work
 
  send ur code then please
  ralph_def...@yahoo,de
 
 
  chrysanhy phpli...@hyphusonline.com wrote in message
  news:88827b190908160033n226b370bqe2ab70732811...@mail.gmail.com...
   I have the following code to extract the URLs from the anchor tags of
an
   HTML page:
  
   $html = new DOMDocument();
   $htmlpage-loadHtmlFile($location);
   $xpath = new DOMXPath($htmlpage);
   $links = $xpath-query( '//a' );
   foreach ($links as $link)
   { $int_url_list[$i++] = $link-getAttribute( 'href' ) . \n; }
  
   If I have a link a href=http://X.com;/a, how do I extract
the
   corresponding  which is displayed to the user as the text of the
  link
   (if it's an image tag, I would like a DOMElement for that).
   Thanks
  
 
 
 
  --
  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] Re: How do I extract link text from anchor tag as well as the URL from the href attribute

2009-08-16 Thread chrysanhy
The code snippet below worked! Thank you so much for your time helping me
with this!

On Sun, Aug 16, 2009 at 11:26 AM, Ralph Deffke ralph_def...@yahoo.dewrote:

 this worked here:
 ?php

 $html = new DOMDocument();
 $html-loadHtmlFile(testHtml.html);
 $links = $html-getElementsByTagName('a');
 echo pre;

 foreach ($links as $item) {
  echo $item-getAttribute( 'href' ). \n;
  echo --- . $item-nodeValue . \n;
 }

 echo /pre;

 ?

 Im sending u the 2 files directly in a minute. it came out, as I thought
 earlier that u have to check if the a tags has got children to extract
 image links.

 ralph_def...@yahoo.de


 chrysanhy phpli...@hyphusonline.com wrote in message
 news:88827b190908160943t2254137fve43771c7e4f8c...@mail.gmail.com...
  WHile waiting for suggestions for extracting the link text from the DOM,
 I
  tried a brute force approach using the URLs I had found with
 getAttribute(),
  but found myself baffled by my results. I boiled down my issue with this
  approach to the following snippet.
 
  $htmldata =EOB
 
 http://www.protools.com/users/user_story.cfm?story_id=1162amp;lang=1
 quot;Creating
 
  Surround Mixes with Tim Weidner/aquot; img height=11
  src=new.gif width=28
  - iMagnification/i engineer talks about mixing the album
 at
  the
  iProTools/i site, by Jim Batchco
  http://www.beyondmusic.com/MediaPlayer/Yes/DontGo.html;quot;Don't
  Goquot; Video/aa href=
 
 http://fi.soneraplaza.net/kaista/musiq/kaistatv/0,8883,201392,00.html
 /a
  img height=11 src=new.gif width=28 - Presented by
 Beyond
  Music
  (a
 href=http://www.apple.com/quicktime/download/;QuickTime/a
 
  Required)
  EOB;
  $url = 'http://www.beyondmusic.com/MediaPlayer/Yes/DontGo.html';
  $posn = strpos($url, $htmldata);
  echo URL |$url| position is |$posn|;
 
  Running this gives me:
 
  URL 
  |http://www.beyondmusic.com/MediaPlayer/Yes/DontGo.html|http://www.beyondmusic.com/MediaPlayer/Yes/DontGo.html%7Cposition
   is
 ||
 
  I've tried lots of functions, and even regular expressions, but I cannot
 get
  the code to find the URL in the HTML. While I still hope for a DOM
 solution
  to getting this link text, WHY can't the code find the URL in the HTML
  snippet?
 
  On Sun, Aug 16, 2009 at 9:29 AM, chrysanhy
 phpli...@hyphusonline.comwrote:
 
   I pasted the code exactly as you have it, and I got the following:
  
   *Fatal error*: Call to undefined method DOMElement::getContent()
  
   I got the same thing with nodeValue().
  
  
   On Sun, Aug 16, 2009 at 7:35 AM, Ralph Deffke
 ralph_def...@yahoo.dewrote:
  
   did u try it something like this
  
   foreach ($links as $link) {
  $int_url_list[$i][href] = $link-getAttribute( 'href' );
  $int_url_list[$i++][linkText] = $link-getContent(  ); //
   nodeValue();
   }
   that should work
  
   send ur code then please
   ralph_def...@yahoo,de
  
  
   chrysanhy phpli...@hyphusonline.com wrote in message
   news:88827b190908160033n226b370bqe2ab70732811...@mail.gmail.com...
I have the following code to extract the URLs from the anchor tags
 of
 an
HTML page:
   
$html = new DOMDocument();
$htmlpage-loadHtmlFile($location);
$xpath = new DOMXPath($htmlpage);
$links = $xpath-query( '//a' );
foreach ($links as $link)
{ $int_url_list[$i++] = $link-getAttribute( 'href' ) . \n; }
   
If I have a link a href=http://X.com;/a, how do I extract
 the
corresponding  which is displayed to the user as the text of the
   link
(if it's an image tag, I would like a DOMElement for that).
Thanks
   
  
  
  
   --
   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] Re: How do I remove an array element from within a recursive function?

2009-02-27 Thread Boyd, Todd M.
 -Original Message-
 From: Chris [mailto:dmag...@gmail.com]
 Sent: Thursday, February 26, 2009 8:48 PM
 To: Daevid Vincent
 Cc: php-general@lists.php.net; Shawn McKenzie
 Subject: Re: [PHP] Re: How do I remove an array element from within a
 recursive function?
 
 Daevid Vincent wrote:
  I tried that and it still doesn't work. I even tried this hardcore
  test:
 
  public static final function removeMenuItems($menuItems,
 $removeArray)
  {
  foreach($menuItems as $value)
  {
  unset($value);
  }
  }
 
 You don't unset the value, you unset the key.
 
 ?php
 
 $items = array('menu1', 'menu2', 'menu3');
 
 echo Before:\n;
 print_r($items);
 
 foreach ($items as $_menuKey = $value) {
   if ($value == 'menu2') {
   unset($items[$_menuKey]);
   }
 }
 
 echo After:\n;
 print_r($items);
 
 
 $ php test.php
 Before:
 Array
 (
  [0] = menu1
  [1] = menu2
  [2] = menu3
 )
 After:
 Array
 (
  [0] = menu1
  [2] = menu3
 )

I would have gone with array_splice() on this one, I think. However, I
believe it will mangle associative arrays. Glad to know that there's a
way to use unset() on these, as I was unaware of it.

3 this list! :D

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



Re: [PHP] Re: How do I remove an array element from within a recursive function? [solved]

2009-02-27 Thread Daevid Vincent
OMG! How retarded am I. Duh. of course... For some reason I thought you
could use the  reference because it was a pointer to the actual
object

menuItem::removeMenuItems($navArray['dart'], array('Login',
'Lost Password'));

public static final function removeMenuItems($menuItems, $removeArray)
{
foreach($menuItems as $key = $value)
if (is_array($value-children))
menuItem::removeMenuItems($value-children, 
$removeArray);
elseif (in_array($value-menu, $removeArray))
unset($menuItems[$key]);
}



-Original Message-
From: Chris dmag...@gmail.com
To: Daevid Vincent dae...@daevid.com
Cc: php-general@lists.php.net, Shawn McKenzie nos...@mckenzies.net
Subject: Re: [PHP] Re: How do I remove an array element from within a
recursive function?
Date: Fri, 27 Feb 2009 13:47:38 +1100


Daevid Vincent wrote:
 I tried that and it still doesn't work. I even tried this hardcore
 test:
 
 public static final function removeMenuItems($menuItems, $removeArray)
 {
 foreach($menuItems as $value)
 {
 unset($value);
 }
 }

You don't unset the value, you unset the key.

?php

$items = array('menu1', 'menu2', 'menu3');

echo Before:\n;
print_r($items);

foreach ($items as $_menuKey = $value) {
if ($value == 'menu2') {
unset($items[$_menuKey]);
}
}

echo After:\n;
print_r($items);


$ php test.php
Before:
Array
(
 [0] = menu1
 [1] = menu2
 [2] = menu3
)
After:
Array
(
 [0] = menu1
 [2] = menu3
)





[PHP] Re: How do I remove an array element from within a recursive function?

2009-02-26 Thread Shawn McKenzie
Daevid Vincent wrote:
  I'm trying to remove [menu] == 'Login' from the array, but despite
finding the element, it never removes.
 isn't that what the  reference stuff is for?

Yes, but foreach can't modify an array unless you use a reference in the
foreach also.  Try this:

foreach($menuItems as $value)


 
 menuItem::removeMenuItems($navArray['dart'], array('Login', 'Lost Password'));
 
 
   public static final function removeMenuItems($menuItems, $removeArray)
   {
   foreach($menuItems as $value)
   {
   if (is_array($value-children))
   menuItem::removeMenuItems($value-children, 
 $removeArray);
   else
   {
   //echo *** CHECKING .$value-menu. against 
 .implode(',',$removeArray). ***;
   if (in_array($value-menu, $removeArray))
   {
   //echo *** REMOVING .$value-menu. 
 ***;
   unset($value);
   }
   }
   }
   }
 


-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: How do I remove an array element from within a recursive function?

2009-02-26 Thread Shawn McKenzie
Shawn McKenzie wrote:
 Daevid Vincent wrote:
   I'm trying to remove [menu] == 'Login' from the array, but despite
 finding the element, it never removes.
 isn't that what the  reference stuff is for?
 
 Yes, but foreach can't modify an array unless you use a reference in the
 foreach also.  Try this:
 
 foreach($menuItems as $value)
 
 
 menuItem::removeMenuItems($navArray['dart'], array('Login', 'Lost 
 Password'));


  public static final function removeMenuItems($menuItems, $removeArray)
  {
  foreach($menuItems as $value)
  {
  if (is_array($value-children))
  menuItem::removeMenuItems($value-children, 
 $removeArray);
  else
  {
  //echo *** CHECKING .$value-menu. against 
 .implode(',',$removeArray). ***;
  if (in_array($value-menu, $removeArray))
  {
  //echo *** REMOVING .$value-menu. 
 ***;
  unset($value);
  }
  }
  }
  }

 
 

Also, I'm not sure what happens here:

if (is_array($value-children))
menuItem::removeMenuItems($value-children, $removeArray);
else
{

Your function defines that var as a reference so you don't have to use a
reference in the call.  Don't know if it does anything but throw a
deprecated notice though.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Re: How do I remove an array element from within a recursive function?

2009-02-26 Thread Daevid Vincent
I tried that and it still doesn't work. I even tried this hardcore
test:

public static final function removeMenuItems($menuItems, $removeArray)
{
foreach($menuItems as $value)
{
unset($value);
}
}


-Original Message-
From: Shawn McKenzie nos...@mckenzies.net
To: php-general@lists.php.net
Subject: [PHP] Re: How do I remove an array element from within a
recursive function?
Date: Thu, 26 Feb 2009 20:10:20 -0600


Daevid Vincent wrote:
  I'm trying to remove [menu] == 'Login' from the array, but despite
finding the element, it never removes.
 isn't that what the  reference stuff is for?

Yes, but foreach can't modify an array unless you use a reference in the
foreach also.  Try this:

foreach($menuItems as $value)


 
 menuItem::removeMenuItems($navArray['dart'], array('Login', 'Lost Password'));
 
 
   public static final function removeMenuItems($menuItems, $removeArray)
   {
   foreach($menuItems as $value)
   {
   if (is_array($value-children))
   menuItem::removeMenuItems($value-children, 
 $removeArray);
   else
   {
   //echo *** CHECKING .$value-menu. against 
 .implode(',',$removeArray). ***;
   if (in_array($value-menu, $removeArray))
   {
   //echo *** REMOVING .$value-menu. 
 ***;
   unset($value);
   }
   }
   }
   }
 


-- 
Thanks!
-Shawn
http://www.spidean.com





Re: [PHP] Re: How do I remove an array element from within a recursive function?

2009-02-26 Thread Chris

Daevid Vincent wrote:

I tried that and it still doesn't work. I even tried this hardcore
test:

public static final function removeMenuItems($menuItems, $removeArray)
{
foreach($menuItems as $value)
{
unset($value);
}
}


You don't unset the value, you unset the key.

?php

$items = array('menu1', 'menu2', 'menu3');

echo Before:\n;
print_r($items);

foreach ($items as $_menuKey = $value) {
if ($value == 'menu2') {
unset($items[$_menuKey]);
}
}

echo After:\n;
print_r($items);


$ php test.php
Before:
Array
(
[0] = menu1
[1] = menu2
[2] = menu3
)
After:
Array
(
[0] = menu1
[2] = menu3
)

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


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



[PHP] Re: how do i allow more than 2 threads of php to run?

2008-12-09 Thread Gal Gur-Arie
Rene Veerman wrote:
 i'm getting freezes for the 3rd to Nth concurrent request on my
 homeserver (got root, on debian4 + apache2).
 how can i allow more threads? like 50 or so?
 
 
Any chance that you're using session and checking it from the same
browser from different tabs (using same session ID)?

If the answer is yes. than you might want to look at the following
function: session_write_close()

http://www.php.net/manual/en/function.session-write-close.php


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



Re: [PHP] Re: how do i allow more than 2 threads of php to run?

2008-12-09 Thread Rene Veerman

Gal Gur-Arie wrote:

Rene Veerman wrote:
  

i'm getting freezes for the 3rd to Nth concurrent request on my
homeserver (got root, on debian4 + apache2).
how can i allow more threads? like 50 or so?




Any chance that you're using session and checking it from the same
browser from different tabs (using same session ID)?

If the answer is yes. than you might want to look at the following
function: session_write_close()

http://www.php.net/manual/en/function.session-write-close.php


  

YEEEAH! this fixed it!
ur a lifesaver :)


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



Re: [PHP] Re: how do i get a printout of original multipart post data

2007-12-01 Thread Olav Mørkrid
thanks, but that won't work. i need to see post data from other people
out there, not my own data. still a mystery to me why php doesn't let
developers see incoming raw data.

On 01/12/2007, Dan [EMAIL PROTECTED] wrote:
 Olav Mørkrid [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  hello
 
 
  how can i get a raw and untouched printout of a multipart/form-data
  POST? i need this to analyze what certain user agents do wrong when
  uploading files.
 
  what happens is that php just fails to put files into $_FILES, and
  gives no way of seeing the original posting and exactly what is wrong
  with it.
 
  according to the manual, neither always_populate_raw_post_data nor
  php://input work for multipart/form-data.

 Go get Ethereal http://www.ethereal.com/ start the program, set which
 network card you want to use (you probably only have one), start capture.
 You'll now see all the packets going down the wire.  Go ahead and do the
 post and you'll be able to see the post data.

 - Dan

 --
 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] Re: how do i get a printout of original multipart post data

2007-12-01 Thread Nathan Nobbe
On Dec 1, 2007 2:13 PM, Olav Mørkrid [EMAIL PROTECTED] wrote:

 thanks, but that won't work. i need to see post data from other people
 out there, not my own data. still a mystery to me why php doesn't let
 developers see incoming raw data.


i think this is what youre looking for:
*$HTTP_RAW_POST_DATA*

see also
http://www.php.net/manual/en/ini.core.php#ini.always-populate-raw-post-data*
*
-nathan


[PHP] Re: how do i get a printout of original multipart post data

2007-11-30 Thread Dan
Olav Mørkrid [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

hello


how can i get a raw and untouched printout of a multipart/form-data
POST? i need this to analyze what certain user agents do wrong when
uploading files.

what happens is that php just fails to put files into $_FILES, and
gives no way of seeing the original posting and exactly what is wrong
with it.

according to the manual, neither always_populate_raw_post_data nor
php://input work for multipart/form-data.


Go get Ethereal http://www.ethereal.com/ start the program, set which 
network card you want to use (you probably only have one), start capture. 
You'll now see all the packets going down the wire.  Go ahead and do the 
post and you'll be able to see the post data.


- Dan 


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



[PHP] Re: How do I specify a local file for fopen()?

2007-11-05 Thread Colin Guthrie
Jon Westcot wrote:
 Hi all:
 
 I've been beating my head against a brick wall trying to figure this
 out and I'm still no closer than I was two weeks ago.
 
 How do I specify a local file on my computer to use with fopen() on
 the server?

Keep on beating it until you get the concept of client-server computing :p

There is no standard way a webserver can access information on the
client's computer. Enabling this kind of interaction would be a complete
no-no from a security perspective and it would also require that a
channel be opened *from* the server *to* the client (which is the
opposite way round - e.g. the client becomes a server and the server
becomes a client!

 I've checked and the allow_url_fopen setting is set to On.  I use the
 html input type=file to let me browse to the file.  This,
 however, forces me to also POST the entire file to the server, which
 I DO NOT WANT it to do.  I just wanted to be able to use the Browse
 button to get to the file name.  But, even when I do this, the file
 name returned in the $_FILES array doesn't give me a file name that
 fopen() will actually open.

This is how you send files to the webserver. If you want the server to
access the files on the client then you have to either send them or
provide some way for the client to become a server in some capacity
through the running of a local application (or Java Applet), and then
you have to make sure you can negotiate any firewall and NAT'ed gateways
that may be inbetween!


 Do I somehow have to get the server to recognize my computer as an
 http-based address?  If so, how do I do this?  The computer that has
 the file to be opened is a Windows-based computer (running WinXP or
 Vista), and it obviously has an Internet connection.  Do I need to
 retrieve, from the server, my computer's IP address and use that, in
 whole or in part, to reference the file to be opened?  If so, how?

It's one of the ways, or you could just setup the client to do a samba
share and mount it on the server, or any number of other techniques.
Obviously this architecture only has legs in a very locked down and
standard environment - it's no good for the open internet.

 While I'm asking questions, does anyone know how to keep the file
 referenced in the input type=file setup from actually being sent?
 All I think I really need is the NAME of the file, not its actual
 contents, since I'm hoping to use fopen() to open the file and then
 to use fgetcsv() to retrieve the contents.

The name gives you nothing, as there is no way to hook back to the
client! You're approach is fundamentally wrong.


 ANY help you all can send my way will be greatly appreciated!

Depending what you want your app to do you need to look at running
something locally on the client. One method that spring to mind would be
a Java applet that can run load up the local files and then manipulate
them accordingly, potentially speaking to webservices provided by your
server in the process.


Col

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



RE: [PHP] Re: How do I specify a local file for fopen()?

2007-11-05 Thread admin
I simply do this

$file=/home/images/index.html;
$output = fopen($file, w);



-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Colin Guthrie
Sent: Monday, November 05, 2007 4:06 AM
To: php-general@lists.php.net
Subject: [PHP] Re: How do I specify a local file for fopen()?

Jon Westcot wrote:
 Hi all:
 
 I've been beating my head against a brick wall trying to figure this
 out and I'm still no closer than I was two weeks ago.
 
 How do I specify a local file on my computer to use with fopen() on
 the server?

Keep on beating it until you get the concept of client-server computing :p

There is no standard way a webserver can access information on the
client's computer. Enabling this kind of interaction would be a complete
no-no from a security perspective and it would also require that a
channel be opened *from* the server *to* the client (which is the
opposite way round - e.g. the client becomes a server and the server
becomes a client!

 I've checked and the allow_url_fopen setting is set to On.  I use the
 html input type=file to let me browse to the file.  This,
 however, forces me to also POST the entire file to the server, which
 I DO NOT WANT it to do.  I just wanted to be able to use the Browse
 button to get to the file name.  But, even when I do this, the file
 name returned in the $_FILES array doesn't give me a file name that
 fopen() will actually open.

This is how you send files to the webserver. If you want the server to
access the files on the client then you have to either send them or
provide some way for the client to become a server in some capacity
through the running of a local application (or Java Applet), and then
you have to make sure you can negotiate any firewall and NAT'ed gateways
that may be inbetween!


 Do I somehow have to get the server to recognize my computer as an
 http-based address?  If so, how do I do this?  The computer that has
 the file to be opened is a Windows-based computer (running WinXP or
 Vista), and it obviously has an Internet connection.  Do I need to
 retrieve, from the server, my computer's IP address and use that, in
 whole or in part, to reference the file to be opened?  If so, how?

It's one of the ways, or you could just setup the client to do a samba
share and mount it on the server, or any number of other techniques.
Obviously this architecture only has legs in a very locked down and
standard environment - it's no good for the open internet.

 While I'm asking questions, does anyone know how to keep the file
 referenced in the input type=file setup from actually being sent?
 All I think I really need is the NAME of the file, not its actual
 contents, since I'm hoping to use fopen() to open the file and then
 to use fgetcsv() to retrieve the contents.

The name gives you nothing, as there is no way to hook back to the
client! You're approach is fundamentally wrong.


 ANY help you all can send my way will be greatly appreciated!

Depending what you want your app to do you need to look at running
something locally on the client. One method that spring to mind would be
a Java applet that can run load up the local files and then manipulate
them accordingly, potentially speaking to webservices provided by your
server in the process.


Col

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

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



[PHP] Re: How do I specify a local file for fopen()?

2007-11-05 Thread Colin Guthrie
[EMAIL PROTECTED] wrote:
 I simply do this
 
 $file=/home/images/index.html;
 $output = fopen($file, w);

I'd read the post again! The OP was asking how the *server* could open a
file on the *client*. You've just describe how the *server* opens a file
on the *server* (e.g. itself).

Quite different I'm sure you'll agree!

Col

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



RE: [PHP] Re: How do I specify a local file for fopen()?

2007-11-05 Thread admin
I would like to change my answer to that question. Due to my lack in desire, to 
read the entire email at first
I have made a bad judgment error in exactly what you was trying to do.

Yes trying to open a file on your local computer from the server is not a good 
idea. 
HOW EVER.
There are many options.
A FTP option
$handle = fopen(ftp://user:[EMAIL PROTECTED]/somefile.txt, w);
Providing you have the ftp port open into your network/computer for ftp access.

Personally I would never do that.


-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Colin Guthrie
Sent: Monday, November 05, 2007 4:06 AM
To: php-general@lists.php.net
Subject: [PHP] Re: How do I specify a local file for fopen()?

Jon Westcot wrote:
 Hi all:
 
 I've been beating my head against a brick wall trying to figure this
 out and I'm still no closer than I was two weeks ago.
 
 How do I specify a local file on my computer to use with fopen() on
 the server?

Keep on beating it until you get the concept of client-server computing :p

There is no standard way a webserver can access information on the
client's computer. Enabling this kind of interaction would be a complete
no-no from a security perspective and it would also require that a
channel be opened *from* the server *to* the client (which is the
opposite way round - e.g. the client becomes a server and the server
becomes a client!

 I've checked and the allow_url_fopen setting is set to On.  I use the
 html input type=file to let me browse to the file.  This,
 however, forces me to also POST the entire file to the server, which
 I DO NOT WANT it to do.  I just wanted to be able to use the Browse
 button to get to the file name.  But, even when I do this, the file
 name returned in the $_FILES array doesn't give me a file name that
 fopen() will actually open.

This is how you send files to the webserver. If you want the server to
access the files on the client then you have to either send them or
provide some way for the client to become a server in some capacity
through the running of a local application (or Java Applet), and then
you have to make sure you can negotiate any firewall and NAT'ed gateways
that may be inbetween!


 Do I somehow have to get the server to recognize my computer as an
 http-based address?  If so, how do I do this?  The computer that has
 the file to be opened is a Windows-based computer (running WinXP or
 Vista), and it obviously has an Internet connection.  Do I need to
 retrieve, from the server, my computer's IP address and use that, in
 whole or in part, to reference the file to be opened?  If so, how?

It's one of the ways, or you could just setup the client to do a samba
share and mount it on the server, or any number of other techniques.
Obviously this architecture only has legs in a very locked down and
standard environment - it's no good for the open internet.

 While I'm asking questions, does anyone know how to keep the file
 referenced in the input type=file setup from actually being sent?
 All I think I really need is the NAME of the file, not its actual
 contents, since I'm hoping to use fopen() to open the file and then
 to use fgetcsv() to retrieve the contents.

The name gives you nothing, as there is no way to hook back to the
client! You're approach is fundamentally wrong.


 ANY help you all can send my way will be greatly appreciated!

Depending what you want your app to do you need to look at running
something locally on the client. One method that spring to mind would be
a Java applet that can run load up the local files and then manipulate
them accordingly, potentially speaking to webservices provided by your
server in the process.


Col

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

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



[PHP] Re: How do I get ini_set('output_handler', '') to work?!

2006-10-27 Thread Tom Atkinson
You can't test it like that. When you use system('php') you invoke a new 
instance of php that has the default values. You are apparently already 
familiar with ini_set() so why not use ini_get() to test if your code works?


Daevid Vincent wrote:

What am I doing wrong...

In my php.ini I have this for my web pages (and I want it): 


  output_handler = ob_gzhandler

But this causes my command line script to not show output until the very
end.

I thought I could disable it at the top of a script, but it's not working!?!

#!/usr/bin/php -q
?php
  ini_set('output_handler', 'mb_output_handler'); 
  system('php -i | grep output_handler');

?

[EMAIL PROTECTED] ./myscript.php
output_handler = ob_gzhandler = ob_gzhandler
zlib.output_handler = no value = no value


If I comment out the line in the php.ini file, then things work great (and
what exactly is the output_handler being used if I don't specify one? It
just says 


  output_handler = no value = no value

I tried to put this in my script too but it doesn't make any difference:

  ini_set('output_handler', ''); 
or
  ini_set('output_handler', null); 


[EMAIL PROTECTED] ./myscript.php
output_handler = ob_gzhandler = ob_gzhandler
zlib.output_handler = no value = no value

UGH!


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



Re: [PHP] RE: How do I prevent a session from rebuilding itself?

2006-07-12 Thread John Wells

On 7/12/06, Daevid Vincent [EMAIL PROTECTED] wrote:


 I am thinking you are killing the first session, rming the
 files, then
 creating a new session. At the end of the page the data that was in
 memory is getting written to the new session file.

Yes. That's what is happening as I said. I don't want it to re-write.



Just to be clear, what exactly are you trying to do?  Are you trying
to kill a session, as in log a person off?  Then do so within PHP:

[code]
// set $_SESSION to empty array
$_SESSION = array();

// if saving session in cookie, clear that out too
if(isset($_COOKIE[session_name()]))
{
setcookie(session_name(),'',time() - 4800,'/');
}

// destroy session completely
session_destroy();
[/code]

HTH,
John W

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



RE: [PHP] RE: How do I prevent a session from rebuilding itself?

2006-07-12 Thread Daevid Vincent
 Just to be clear, what exactly are you trying to do?  Are you trying to
logout a user

No.

We write enterprise level software probably far surpassing what PHP was ever
intended for.

However, our GUI is web based (LAMP).

We have fail over cluster nodes. If a user is logged into one via a virtual
IP, the browser sees it as transparent. When a node fails, it fails over
fine (again, the browser still sees the same VIP). But the sess_ file is not
on the new node -- by design. We purposely don't copy the /tmp/sess_ files.
What we want is, since the session is gone, that $_SESSION['login'] is (in
theory) missing/false [although it seems that PHP RAM takes precedence over
HD now and this didn't used to be the case] that the user should be
re-prompted to login.

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



Re: [PHP] RE: How do I prevent a session from rebuilding itself?

2006-07-12 Thread Jochem Maas
Daevid Vincent wrote:
 Just to be clear, what exactly are you trying to do?  Are you trying to
 logout a user
 
 No.
 
 We write enterprise level software probably far surpassing what PHP was ever
 intended for.

hmm.

 
 However, our GUI is web based (LAMP).

so the GUI uses php but the rest doesn't?
kind of nullifies the statement aboveif thats the case.

 
 We have fail over cluster nodes. If a user is logged into one via a virtual
 IP, the browser sees it as transparent. When a node fails, it fails over
 fine (again, the browser still sees the same VIP). But the sess_ file is not
 on the new node -- by design. We purposely don't copy the /tmp/sess_ files.
 What we want is, since the session is gone, that $_SESSION['login'] is (in
 theory) missing/false [although it seems that PHP RAM takes precedence over
 HD now and this didn't used to be the case] that the user should be
 re-prompted to login.

so the user is prompted to login in again if a cluster node he happened to
be talking to fails whats the point of the transparency then? I really don't
care if my browsers sees the IP consistently - I'd rather just stay logged in.

have you considered that your enterprise level software might require a custom
session handler (see 
http://php.net/manual/en/function.session-set-save-handler.php)
maybe some kind of mysql cluster running a master-slave config? which would
potentially give you real transparency in case of a failed node.

 

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



RE: [PHP] RE: How do I prevent a session from rebuilding itself?

2006-07-12 Thread Daevid Vincent
  We write enterprise level software probably far surpassing 
 what PHP was ever intended for.
  
  However, our GUI is web based (LAMP).
 
 so the GUI uses php but the rest doesn't?
 kind of nullifies the statement aboveif thats the case.

Not really. We use DBUS calls to Ruby and C/C++ code.
We manipulate networks. TCP/IP. UDP. LDAP. Iptables. Etc.
We use RDBMS tricks to transfer data.
SOAP. XML. And all sorts of other tactics to work around the limitations of
PHP5.

But that is all besides the point.

  We have fail over cluster nodes. If a user is logged into 
 one via a virtual
  IP, the browser sees it as transparent. When a node fails, 
 it fails over
  fine (again, the browser still sees the same VIP). But the 
 sess_ file is not
  on the new node -- by design. We purposely don't copy the 
 /tmp/sess_ files.
  What we want is, since the session is gone, that 
 $_SESSION['login'] is (in
  theory) missing/false [although it seems that PHP RAM takes 
 precedence over
  HD now and this didn't used to be the case] that the user should be
  re-prompted to login.
 
 so the user is prompted to login in again if a cluster node 
 he happened to
 be talking to fails whats the point of the transparency 
 then? I really don't
 care if my browsers sees the IP consistently - I'd rather 
 just stay logged in.

Because. That's also irrelevent. And for the record. They DO stay logged in.

That's the whole problem I'm trying to get around!
For various reasons beyond the scope of this discussion (some related to
security),
We wish for the user to re-authenticate.

d

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



[PHP] RE: How do I prevent a session from rebuilding itself?

2006-07-11 Thread Daevid Vincent
 The session data that you store in $_SESSION is written to 
 the files in your /tmp dir.
 Are you sure your session files are getting written to that directory?

Yes.

 You are sure those aren't old session files from a previous configuration?

Positive. I wipe the /tmp dir clean. Login to my page (user/pw,
authentication, etc). See the sess_ file created. Delete the file. Reload
the page, and a new sess_ file is created (with a new session ID hash). I
would expect my session to be invalid and force me to login again as I do
this kind of thing at the top of every page in the header:

if ( !is_bool($_SESSION['login']) || $_SESSION['login'] != true ) 
{ 
exit(SCRIPTlocation.href='/index.php';/SCRIPT);
}

 Are you working with a project/site on that box that uses 
 custom session handlers? 

No.

 Perhaps some of your sites write to that dir, but 
 the session in question are getting written to your database.

No.

 If everything you've said is 100% accurate, then I would check for 
 Gremlins. The session data only exists in memory or in those session 
 files in the /tmp dir.

Yes.

 The symptoms you see could be caused by:
 1. Starting a session
 2. Saving data into the $_SESSION super global.
 3. rm'ing all of the session files.
 4. Closing your current session.
 -- all done in the same page.

We do write to $_SESSION all the time. For example at the top of each page
we update the timestamp so we know if we should auto logout the user after
10 minutes...

 I am thinking you are killing the first session, rming the 
 files, then 
 creating a new session. At the end of the page the data that was in 
 memory is getting written to the new session file.

Yes. That's what is happening as I said. I don't want it to re-write.

Ironically we used to have this problem with our PHP bug tracking system,
where every few hours or whatever, people would get logged off. Turned out
that some cron was purging all of /tmp. I fear that this 'bug' was 'fixed'
in PHP 5 or something and so in a 'helpful' way, PHP restores the session
from memory. I do NOT want that to happen.

 Regards,
 Mrs. O'Toole
 
 Daevid Vincent wrote:
  I've noticed a 'feature' that seems to be causing me some pain.
  
  When a user logs in, we store various pieces of info and 
 their user class in
  a $_SESSION variables.
  
  This includes a flag saying that they've ben authenticated.
  
  I would expect that if I 'rm -rf /tmp/sess_*' that the user 
 would get
  prompted to re-login (since the flag is not set).
  
  However what actually happens, is that PHP silently just 
 re-creates the
  session with a new unique identifier but with all the same 
 data in it. GRRR.
  
  How can I force this to NOT happen (either via php.ini or 
 via some function
  or directive call in each page load)?
  
  ÐÆ5ÏÐ 
 
 

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



[PHP] Re: How do I make a HTML tree for a set of nodes?

2006-06-05 Thread David Robley
Niels wrote:

 Hi,
 
 
 I have a set of nodes. Each node has a parent and so the set can be
 thought of as a tree. I want to show that tree somehow on a webpage,
 served by PHP. I cannot use Dot/Graphwiz for various reasons. What I'm
 looking for is an output of DIVs or tablecells, showing the nodes and
 their connections. It's not a trivial task, IMO, but doable. Possibly
 somebody has already made something similiar, but I can't find anything on
 Google. Can anybody point me to helpful information?
 
 Thanks,
 Niels

For the concept of storage, you might want to look at

http://www.sitepoint.com/article/hierarchical-data-database

For a very simple implementation of the idea for display and editing,

http://www.auseinet.com/test/treeedit.php

I can provide the code for the above if you want it.



Cheers
-- 
David Robley

Death is a nonmaskable interrupt.
Today is Sweetmorn, the 10th day of Confusion in the YOLD 3172. 

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



[PHP] Re: How do I make a HTML tree for a set of nodes?

2006-06-05 Thread Niels
On Monday 05 June 2006 13:32, David Robley wrote:

 Niels wrote:
 
 Hi,
 
 
 I have a set of nodes. Each node has a parent and so the set can be
 thought of as a tree. I want to show that tree somehow on a webpage,
 served by PHP. I cannot use Dot/Graphwiz for various reasons. What I'm
 looking for is an output of DIVs or tablecells, showing the nodes and
 their connections. It's not a trivial task, IMO, but doable. Possibly
 somebody has already made something similiar, but I can't find anything
 on Google. Can anybody point me to helpful information?
 
 Thanks,
 Niels
 
 For the concept of storage, you might want to look at
 
 http://www.sitepoint.com/article/hierarchical-data-database
 

This I had already found. But it's a very basic article, and it's not about
how to transform a set of data into a nice looking piece of HTML. It does
show some cool trees, but the display_tree function shown just uses
indents, like my own.

 For a very simple implementation of the idea for display and editing,
 
 http://www.auseinet.com/test/treeedit.php
 
 I can provide the code for the above if you want it.
 
Thanks, but this is more or less what I have. If you can add branches to
that, I'd like to hear more.


Thank you for your answer, I appreciate it!
Niels

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



[PHP] Re: How do I make a HTML tree for a set of nodes?

2006-06-04 Thread Rafael
	Well, if you're asking for some recommendation on how to show it, I 
would suggest to use lists (either ordered -OL- or unordered -UL- 
depends on you), or maybe even data-lists (DL), so you would get

  +- parent 1
  |  +- child 1
  |  \- child 2
  +- parent 2
 \- sub-parent1
+- sub-child 1
\- sub-child 2
into something like
  ul
li parent 1
 ul
   lichild 1/li
   lichild 2/li
 /ul
/li
li parent 2
 ul
   li sub-parent 1
ul
  lisub-child 1/li
  lisub-child 2/li
/ul
   /li
 /ul
/li
  /ul

	Now, if you're asking for code, send what you've tried so far, and 
maybe someone will be able to help you (either correcting your code, or 
sending another way to do it)


Niels wrote:

I have a set of nodes. Each node has a parent and so the set can be thought
of as a tree. I want to show that tree somehow on a webpage, served by PHP.
I cannot use Dot/Graphwiz for various reasons. What I'm looking for is an
output of DIVs or tablecells, showing the nodes and their connections. It's
not a trivial task, IMO, but doable. Possibly somebody has already made
something similiar, but I can't find anything on Google. Can anybody point
me to helpful information?

--
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: how do i select this list

2006-03-16 Thread Barry

Mark wrote:

THANKS THAT WORKED GREAT



You might need this in the future:
http://dev.mysql.com/doc/refman/5.0/en/index.html

Thare are lot's of examples, also the problem you stated is described there.

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



[PHP] Re: how do i select this list

2006-03-15 Thread João Cândido de Souza Neto
$query = mysql_query(SELECT * FROM leaderboard WHERE comp_id = $comp_id
ORDER by points DESC, margin ASC );

Mark wrote:

 The query below gives me a list of usernames with the highest point score
 at the top. There is also a secondary points list which i need to use to
 rank players if there POINTS are the same.
 
 ie:
 username  points margin
 paul2624
 mark   2311
 john2310
 
 I want to rank 'john above 'mark' as his margin points are lower. I can't
 rank by margin alone and i need ranking by points (Desc) first then by
 lowest margin.
 how can i change this statement below to achieve this.
 
 Thanks
 
 $query = mysql_query(SELECT * FROM leaderboard WHERE comp_id = $comp_id
 ORDER by points DESC );

-- 
---
João Cândido de Souza Neto
Web Developer

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



[PHP] Re: how do i select this list

2006-03-15 Thread Mark
THANKS THAT WORKED GREAT


João Cândido de Souza Neto [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 $query = mysql_query(SELECT * FROM leaderboard WHERE comp_id = $comp_id
 ORDER by points DESC, margin ASC );

 Mark wrote:

 The query below gives me a list of usernames with the highest point score
 at the top. There is also a secondary points list which i need to use to
 rank players if there POINTS are the same.

 ie:
 username  points margin
 paul2624
 mark   2311
 john2310

 I want to rank 'john above 'mark' as his margin points are lower. I can't
 rank by margin alone and i need ranking by points (Desc) first then by
 lowest margin.
 how can i change this statement below to achieve this.

 Thanks

 $query = mysql_query(SELECT * FROM leaderboard WHERE comp_id = $comp_id
 ORDER by points DESC );

 -- 
 ---
 João Cândido de Souza Neto
 Web Developer 

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



Re: [PHP] Re: How do I read Exif data without a file?

2006-02-26 Thread Sameer N Ingole

Niels wrote:


I think you misunderstand the situation.

[snip]


I've got a database of images (image data) and their exif data, I'm not
uploading any files. I want to make new entries in that DB, new images that
are thumbnails of the present images. I can do that without creating files,
but I can't get exif data of these thumbnails, because there are no files.
The exif data for the thumbnails isn't the same as for the full images.
In PHP its not easy to keep EXIF data of JPEG or TIF files as it is if 
you use PHP functions to recreate the temporary files in some dir.


Basically when you use tempnam() it creates a temporary file. To get the 
thumbnails you must rewrite the resized file to some place (if you want 
real thumbnail image). You cannot preserve exif data with any of PHP 
functions available. You probably have to use some specially developed 
code to write exif data. I tried this class


http://www.zonageek.com/software/php/jpeg/

I tried to use it but either it could not write all the exif data or I 
was not calling required functions properly.. It requires pear..


Other you can try is http://pel.sourceforge.net/

But both of these will require you to write a resized image and then 
write exif data (common for both, original and resized) retrieved from 
the original image to the new thumbnail you generated with additional 
image specific exif info.


Best is to maintain thumbnails.. with exif data written in it too.

Regards,

--
Sameer N. Ingole
Blog: http://weblogic.noroot.org/
---
Better to light one candle than to curse the darkness.

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



Re: [PHP] Re: How do I read Exif data without a file?

2006-02-26 Thread tedd

Sameer said:

To get the thumbnails you must rewrite the resized file to some 
place (if you want real thumbnail image).



No, that's not correct. You can take an image from a db, create a 
thumbnail while it is in memory and display it. You don't need to 
make it a file first.


tedd
--

http://sperling.com

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



Re: [PHP] Re: How do I read Exif data without a file?

2006-02-26 Thread Sameer N Ingole

tedd wrote:

Sameer said:

To get the thumbnails you must rewrite the resized file to some place 
(if you want real thumbnail image).



No, that's not correct. You can take an image from a db, create a 
thumbnail while it is in memory and display it. You don't need to make 
it a file first.
That *is* correct. You must rewrite the resized file to some place and 
that place can be /dev/foo (memory or disk). I did not say you must 
write it to /disk/.



Regards,

--
Sameer N. Ingole
Blog: http://weblogic.noroot.org/
---
Better to light one candle than to curse the darkness.


PS: Please reply to the list only. You probably hit reply all. I got two 
copies of same message.


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



Re: [PHP] Re: How do I read Exif data without a file?

2006-02-26 Thread tedd

tedd wrote:

Sameer said:

To get the thumbnails you must rewrite the resized file to some 
place (if you want real thumbnail image).



No, that's not correct. You can take an image from a db, create a 
thumbnail while it is in memory and display it. You don't need to 
make it a file first.
That *is* correct. You must rewrite the resized file to some place 
and that place can be /dev/foo (memory or disk). I did not say you 
must write it to /disk/.


Sameer N. Ingole


I don't want to argue semantics of what is a file, nor diction, but 
if that is what you meant, then what *is* clear is that your 
statement wasn't.


tedd

--

http://sperling.com

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



Re: [PHP] Re: How do I read Exif data without a file?

2006-02-26 Thread Niels
On Sunday 26 February 2006 10:59, Sameer N Ingole wrote:

 In PHP its not easy to keep EXIF data of JPEG or TIF files as it is if
 you use PHP functions to recreate the temporary files in some dir.
 
 Basically when you use tempnam() it creates a temporary file. To get the
 thumbnails you must rewrite the resized file to some place (if you want
 real thumbnail image). You cannot preserve exif data with any of PHP
 functions available. You probably have to use some specially developed
 code to write exif data. I tried this class
 
 http://www.zonageek.com/software/php/jpeg/
 
 I tried to use it but either it could not write all the exif data or I
 was not calling required functions properly.. It requires pear..
 
 Other you can try is http://pel.sourceforge.net/
 
 But both of these will require you to write a resized image and then
 write exif data (common for both, original and resized) retrieved from
 the original image to the new thumbnail you generated with additional
 image specific exif info.
 
 Best is to maintain thumbnails.. with exif data written in it too.
 
 Regards,
 

Thank you for your answer. I wasn't trying to write exif data to an image,
just to read it. I've got it all working now.


//Niels

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



[PHP] Re: How do I read Exif data without a file?

2006-02-25 Thread Niels
On Saturday 25 February 2006 16:36, Niels wrote:

 Hi,
 
 I have some images in a database -- I mean, the actual data. There are no
 files.
 
 I want to read Exif data for these images, but the read_exif_data()
 function wants a file. I suppose I could write the images to temp files,
 but that's a bit wasteful. And where would I write them? Is there a folder
 I can count on being allowed to write to?
 
 Thanks,
 Niels

Answering myself: I solved this with tempnam(). I'm not completely sure
about the portability, and of course it's a waste to write a file at all.
And it could pose a security problem as well. Ho hum.

//Niels

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



Re: [PHP] Re: How do I read Exif data without a file?

2006-02-25 Thread chris smith
  I have some images in a database -- I mean, the actual data. There are no
  files.
 
  I want to read Exif data for these images, but the read_exif_data()
  function wants a file. I suppose I could write the images to temp files,
  but that's a bit wasteful. And where would I write them? Is there a folder
  I can count on being allowed to write to?
 
 Answering myself: I solved this with tempnam(). I'm not completely sure
 about the portability, and of course it's a waste to write a file at all.
 And it could pose a security problem as well. Ho hum.

You only need to do it once - then store it back in the database. That
info isn't going to change.

When you store the image in the database you can get the info and store it then.

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



Re: [PHP] Re: How do I read Exif data without a file?

2006-02-25 Thread Niels
On Saturday 25 February 2006 23:42, chris smith wrote:

  I have some images in a database -- I mean, the actual data. There are
  no files.
 
  I want to read Exif data for these images, but the read_exif_data()
  function wants a file. I suppose I could write the images to temp
  files, but that's a bit wasteful. And where would I write them? Is
  there a folder I can count on being allowed to write to?
 
 Answering myself: I solved this with tempnam(). I'm not completely sure
 about the portability, and of course it's a waste to write a file at all.
 And it could pose a security problem as well. Ho hum.
 
 You only need to do it once - then store it back in the database. That
 info isn't going to change.
 
 When you store the image in the database you can get the info and store it
 then.

No, I can't. I've got some images, with exif information in the DB. I'm now
generating thumbnails for them, and also storing those in the DB. No files
at all, and therefore I can't read exif data for the thumbnails.

As I said I've solved the problem by writing a temporary file and reading
exif from that. Not pretty or efficient, but it works.


//Niels

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



Re: [PHP] Re: How do I read Exif data without a file?

2006-02-25 Thread chris smith
  Answering myself: I solved this with tempnam(). I'm not completely sure
  about the portability, and of course it's a waste to write a file at all.
  And it could pose a security problem as well. Ho hum.
 
  You only need to do it once - then store it back in the database. That
  info isn't going to change.
 
  When you store the image in the database you can get the info and store it
  then.

 No, I can't. I've got some images, with exif information in the DB. I'm now
 generating thumbnails for them, and also storing those in the DB. No files
 at all, and therefore I can't read exif data for the thumbnails.

So how do you GET the images into the database? from the filesystem
(whether you are uploading through a form or importing it, it's still
on the filesystem at some point). Generate the exif once (using your
tempnam workaround) then update the database.. so you only need to do
it once.

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



Re: [PHP] Re: How do I read Exif data without a file?

2006-02-25 Thread Niels
On Saturday 25 February 2006 23:55, chris smith wrote:

  Answering myself: I solved this with tempnam(). I'm not completely
  sure about the portability, and of course it's a waste to write a file
  at all. And it could pose a security problem as well. Ho hum.
 
  You only need to do it once - then store it back in the database. That
  info isn't going to change.
 
  When you store the image in the database you can get the info and store
  it then.

 No, I can't. I've got some images, with exif information in the DB. I'm
 now generating thumbnails for them, and also storing those in the DB. No
 files at all, and therefore I can't read exif data for the thumbnails.
 
 So how do you GET the images into the database? from the filesystem
 (whether you are uploading through a form or importing it, it's still
 on the filesystem at some point). Generate the exif once (using your
 tempnam workaround) then update the database.. so you only need to do
 it once.

I think you misunderstand the situation.

I've got a database of images (image data) and their exif data, I'm not
uploading any files. I want to make new entries in that DB, new images that
are thumbnails of the present images. I can do that without creating files,
but I can't get exif data of these thumbnails, because there are no files.
The exif data for the thumbnails isn't the same as for the full images.


//Niels

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



[PHP] Re: How do i display a neat table of returned mysql data?

2005-11-30 Thread Ciprian Constantinescu
First of all this is not automatic. You can do this with a foreach loop. If
you want nice presentations, you might as well try http://smarty.php.net


Dave Carrera [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi List,

 I have some mysql table data that i would like to display back to the
 web user in a neat and tidy way using php.

 Data:

 col1   col2   col3
 test   1.99   F
 test   1.99   F
 test   1.99   F
 test   0.99   F
 test   1.99   F
 bang 2.99   F
 bang 3.99   F
 bang 4.49   F
 bang 2.99   F
 bang 2.99   F

 Table display i am hoping to display:
 First the unique name of col1 as a header

 tabletrtdtest/tdtdbang/td/tr/table

 Second a row each for each col2 and col3 where header above = col1 so
 the finished table looks like this

 test   bang
 1.99   F2.99   F
 1.99   F3.99   F
 1.99   F4.49   F
 0.99   F2.99   F
 1.99   F2.99   F

 I will really appreiciate and help you may give with this question.

 Thank you in advance

 Dave C


smime.p7s
Description: S/MIME cryptographic signature


Re: [PHP] Re: How do I POST data with headers make the browser follow?

2005-10-07 Thread cron
Print out the form and on the body  tag put some javascript to do the post 
stuff


ex:
body onLoad=formName.submit();
form style=display:none
/form

style=display:none, this will hide form from the user

- Original Message - 
From: Ragnar [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Friday, October 07, 2005 1:30 AM
Subject: [PHP] Re: How do I POST data with headers  make the browser 
follow?




Message-ID: [EMAIL PROTECTED]
To: php-general@lists.php.net
Date: Thu, 06 Oct 2005 15:04:41 +0200
From: Petr Smith [EMAIL PROTECTED]
Subject: Re: How do I POST data with headers  make the browser follow?


I have to apologize if this issue has been discussed in detail before but

I

couldn't find anything obvious so far.

What I need/want to do is to :

1. Take POST data from a form (no problem)
2. Do whatever i need to on the target page (no problem)
3. Pass some other data on to a 3rd page as a POST
   request.
4. Get the browser to follow to said 3rd page.


All this is happening via SSL.

So basically what i am trying to do is to fake whatever happens
at a normal POST request that is handled by the browser.

Now point 4. in my example above is giving me a massive headache,
I have managed to pass data on to the 3rd page as POST quite comfortably
using cURL but the browser doesn't follow (ie. the URL in the address bar
remains unchanged).

I did see that there is a FOLLOWLOCATION option you can set in cURL when

you

do you request, and though wicked, just what I needed only to find out
that it's not working (probably because I understand what it does wrong).

Pretty pretty please if anyone knows a solution for the above, let me

know.


Oh, and I'd also like to add that the information I am trying to get to

the

3rd page in the example is sensitive (Credit Card details etc.), so $_GET
and $_COOKIE are out of the question.



Hi,

it seems you have no understanding how http protocol works.. I can't
learn you the whole thing, but I can give you some hints. Read something
about HTTP
(http://www.digital-web.com/articles/powering_the_web_with_http/),
install some network sniffer (ethereal, HttpWatch for IE - great tool
for beginners) and see what happens.

- you cannot force browser to POST something somewhere with PHP. You
have to realize, that PHP is running on server, but the browser is the
client.
- you cannot use curl to do it. With curl it all happens on the server.
If you want to use curl, you have to use same technique used by web
based anonymous proxy. Return all loaded data to client, rewrite urls
to your script, handle everything correctly until client closes browser.
Very complex stuff
- followlocation has nothing to do with browser. it only says to curl to
evaluate Location header and do auto-redirection
- sensitive information? GET, POST, COOKIE, everything could be
intercepted
- your only help is javascript. You can generate something like this to
client browser with php. But you couldn't hide sensitive information
this way.
body onload=document.forms.myform.submit()
form name=myform method=post
input type=hidden name=... value=...
/form
- think about your problem and possible solutions again



Petr


Hi Petr,

thanks for the reply, first off i certainly didn't claim to be an expert 
on

the HTTP, which is why i was asking the question I did.
I do realise that PHP runs on the server and can't force the browser to do
anything directly, I was merely wondering why header(Location:); got the
browser to follow and if there was a way for me to get the same behaiviour
working when PHP was posting data.

Anyway, I will look at my problem at hand again and will try something 
else.


Thanks for the tips.


--
Highspeed-Freiheit. Bei GMX supergünstig, z.B. GMX DSL_Cityflat,
DSL-Flatrate für nur 4,99 Euro/Monat*  http://www.gmx.net/de/go/dsl

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




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



[PHP] Re: How do I POST data with headers make the browser follow?

2005-10-06 Thread Petr Smith

I have to apologize if this issue has been discussed in detail before but I
couldn't find anything obvious so far.

What I need/want to do is to :

1. Take POST data from a form (no problem)
2. Do whatever i need to on the target page (no problem)
3. Pass some other data on to a 3rd page as a POST
   request.
4. Get the browser to follow to said 3rd page.


All this is happening via SSL.

So basically what i am trying to do is to fake whatever happens
at a normal POST request that is handled by the browser.

Now point 4. in my example above is giving me a massive headache,
I have managed to pass data on to the 3rd page as POST quite comfortably
using cURL but the browser doesn't follow (ie. the URL in the address bar
remains unchanged).

I did see that there is a FOLLOWLOCATION option you can set in cURL when you
do you request, and though wicked, just what I needed only to find out
that it's not working (probably because I understand what it does wrong).

Pretty pretty please if anyone knows a solution for the above, let me know. 


Oh, and I'd also like to add that the information I am trying to get to the
3rd page in the example is sensitive (Credit Card details etc.), so $_GET
and $_COOKIE are out of the question.


Hi,

it seems you have no understanding how http protocol works.. I can't 
learn you the whole thing, but I can give you some hints. Read something 
about HTTP 
(http://www.digital-web.com/articles/powering_the_web_with_http/), 
install some network sniffer (ethereal, HttpWatch for IE - great tool 
for beginners) and see what happens.


- you cannot force browser to POST something somewhere with PHP. You 
have to realize, that PHP is running on server, but the browser is the 
client.
- you cannot use curl to do it. With curl it all happens on the server. 
If you want to use curl, you have to use same technique used by web 
based anonymous proxy. Return all loaded data to client, rewrite urls 
to your script, handle everything correctly until client closes browser. 
Very complex stuff
- followlocation has nothing to do with browser. it only says to curl to 
evaluate Location header and do auto-redirection

- sensitive information? GET, POST, COOKIE, everything could be intercepted
- your only help is javascript. You can generate something like this to 
client browser with php. But you couldn't hide sensitive information 
this way.

body onload=document.forms.myform.submit()
form name=myform method=post
input type=hidden name=... value=...
/form
- think about your problem and possible solutions again

Petr

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



[PHP] Re: How do I POST data with headers make the browser follow?

2005-10-06 Thread Ragnar
Message-ID: [EMAIL PROTECTED]
To: php-general@lists.php.net
Date: Thu, 06 Oct 2005 15:04:41 +0200
From: Petr Smith [EMAIL PROTECTED]
Subject: Re: How do I POST data with headers  make the browser follow?

 I have to apologize if this issue has been discussed in detail before but
I
 couldn't find anything obvious so far.
 
 What I need/want to do is to :
 
 1. Take POST data from a form (no problem)
 2. Do whatever i need to on the target page (no problem)
 3. Pass some other data on to a 3rd page as a POST
request.
 4. Get the browser to follow to said 3rd page.
 
 
 All this is happening via SSL.
 
 So basically what i am trying to do is to fake whatever happens
 at a normal POST request that is handled by the browser.
 
 Now point 4. in my example above is giving me a massive headache,
 I have managed to pass data on to the 3rd page as POST quite comfortably
 using cURL but the browser doesn't follow (ie. the URL in the address bar
 remains unchanged).
 
 I did see that there is a FOLLOWLOCATION option you can set in cURL when
you
 do you request, and though wicked, just what I needed only to find out
 that it's not working (probably because I understand what it does wrong).
 
 Pretty pretty please if anyone knows a solution for the above, let me
know. 
 
 Oh, and I'd also like to add that the information I am trying to get to
the
 3rd page in the example is sensitive (Credit Card details etc.), so $_GET
 and $_COOKIE are out of the question.

Hi,

it seems you have no understanding how http protocol works.. I can't 
learn you the whole thing, but I can give you some hints. Read something 
about HTTP 
(http://www.digital-web.com/articles/powering_the_web_with_http/), 
install some network sniffer (ethereal, HttpWatch for IE - great tool 
for beginners) and see what happens.

- you cannot force browser to POST something somewhere with PHP. You 
have to realize, that PHP is running on server, but the browser is the 
client.
- you cannot use curl to do it. With curl it all happens on the server. 
If you want to use curl, you have to use same technique used by web 
based anonymous proxy. Return all loaded data to client, rewrite urls 
to your script, handle everything correctly until client closes browser. 
Very complex stuff
- followlocation has nothing to do with browser. it only says to curl to 
evaluate Location header and do auto-redirection
- sensitive information? GET, POST, COOKIE, everything could be
intercepted
- your only help is javascript. You can generate something like this to 
client browser with php. But you couldn't hide sensitive information 
this way.
body onload=document.forms.myform.submit()
form name=myform method=post
   input type=hidden name=... value=...
/form
- think about your problem and possible solutions again

Petr

Hi Petr,

thanks for the reply, first off i certainly didn't claim to be an expert on
the HTTP, which is why i was asking the question I did.
I do realise that PHP runs on the server and can't force the browser to do
anything directly, I was merely wondering why header(Location:); got the
browser to follow and if there was a way for me to get the same behaiviour
working when PHP was posting data.

Anyway, I will look at my problem at hand again and will try something else.

Thanks for the tips.


-- 
Highspeed-Freiheit. Bei GMX supergünstig, z.B. GMX DSL_Cityflat,
DSL-Flatrate für nur 4,99 Euro/Monat*  http://www.gmx.net/de/go/dsl

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



[PHP] Re: How do I create an Outlook calendar entry?

2005-06-24 Thread David Dorward
Daevid Vincent wrote:

 I was on Avis' car rental site the other day and booked a reservation,
 then they had a button that automatically added an entry into MS Outlook
 for the details, dates, times, etc. it was very nice!

 I am guessing I have to use COM

Wouldn't that require the webserver to be running on your workstation? :)

Its most likely just giving you a datafile in some standard calendar format
that Outlook understands. Possibly iCal (I don't know if Outlook supports
it, but lots of calendar software seems to these days).

Google should help you find a way to generate iCal files.

-- 
David Dorward   http://blog.dorward.me.uk/   http://dorward.me.uk/
 Home is where the ~/.bashrc is

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



[PHP] Re: How do I link to the root directory of the server?

2005-05-05 Thread Shaun
Sorry for double posting, these took an hour to appear in my newsreader and 
I thought there was a problem with the first one I sent

Shaun [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi,

 I have a file called application.php and in this file I define all of the 
 directories in my site:

 class object {};
 $CFG = new object;

 $CFG-wwwroot = http://www.mydomain.com;
 $CFG-dirroot  = /usr/home/myaccount/public_html;

 $CFG-admindir = $CFG-wwwroot/admin;
 $CFG-claimsdir_adm = $CFG-admindir/claims;
 $CFG-clientsdir   = $CFG-admindir/clients;
 $CFG-cssdir = $CFG-wwwroot/css;
 $CFG-expense_categoriesdir = $CFG-admindir/expense_categories;
 $CFG-projectsdir   = $CFG-admindir/projects;
 $CFG-shoppingdir  = $CFG-wwwroot/shopping;
 ...

 This works very well and means if I change a directory name or move a 
 directory I only have to update this file. application.php is included on 
 every page so all I have to do to link to another directory would be 
 something like:

 pClick a href=?php echo $CFG-expense_categoriesdir; 
 ??action=add_expense_categoryhere/a to add a category/p

 The problem with this is that the URL's include the 
 http://www.mydomain.com/ and are therefore not relative links. Is there a 
 way to link to the root directory from wherever I am within the directory 
 structure?

 Thanks for your advice 

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



[PHP] Re: How do I su to another account??

2004-11-11 Thread Jason
Well if you are using apache as your webserver you can use a module 
which supports this feature... mod_chroot, mod_ruid or mod_suid2 is what 
you want.

Or just as a suggestion if you don't want to change the running 
environment of apache I recommend having your script set a flag (temp 
file or something) then write a shell or php script running through a 
cron job to check for the temporary file before it executes.

Scott Fletcher wrote:
How do I su (switch user) to another account from the nobody in php?  I
haven't got it to work, so I get the impression that it is either I'm doing
it all wrong in PHP script or that the nobody doesn't have the authority to
do so.
Have anyone who ever successfully do it please post a sample script?
Thanks,
 Scott

--
Jason Gerfen
[EMAIL PROTECTED]
And remember... If the ladies
 don't find you handsome, they
 should at least find you handy...
 ~The Red Green show
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: How do I su to another account??

2004-11-11 Thread Scott Fletcher
Um, I'll look into it.  Thanks...  Scott

Jason [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Well if you are using apache as your webserver you can use a module
 which supports this feature... mod_chroot, mod_ruid or mod_suid2 is what
 you want.

 Or just as a suggestion if you don't want to change the running
 environment of apache I recommend having your script set a flag (temp
 file or something) then write a shell or php script running through a
 cron job to check for the temporary file before it executes.

 Scott Fletcher wrote:
  How do I su (switch user) to another account from the nobody in php?  I
  haven't got it to work, so I get the impression that it is either I'm
doing
  it all wrong in PHP script or that the nobody doesn't have the authority
to
  do so.
 
  Have anyone who ever successfully do it please post a sample script?
 
  Thanks,
   Scott


 -- 
 Jason Gerfen
 [EMAIL PROTECTED]

 And remember... If the ladies
   don't find you handsome, they
   should at least find you handy...
   ~The Red Green show

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



[PHP] Re: How do I produce a random database query for each day or week?

2004-10-01 Thread Merlin
Hello Gray,
could you possibly use some case clauses? Lets say you use 7 case clauses for 
the week. And each day has a random number. So you do a random on Monday and 
then you sort it out int the monday case statement and so on.

Just an idea,
Merlin
I.A. Gray wrote:
Hi,
My brain is working very slowly this morning (maybe that is because of
having 5hrs sleep...)
Could someone help me with this problem.
I would like to show a different CD with information on it, on the home page
each week- a kind of 'recording of the week' and I would also like to have
on the same page something that changes every day.
The recordings are in a MYSQL database and I would like all of them (there
are 29 at present) to be shown over how ever long it would take to get
through them (in this case 29 weeks) and then once they have all been shown
this would then repeat.  I would like them to be shown in a random order and
make sure that the recording hasn't been shown within the 29.  The same goes
for the other project which uses a mysql database which I would like to
rotate daily (in this case there are 103 items)
Obviously if I use PHP random functions this will always return a random
number, but how do I produce a random number which relates to the day or
week of the year?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: How do I write to an XML file

2004-01-12 Thread Manuel Lemos
Hello,

On 01/12/2004 05:20 AM, Tim Burgan wrote:
Hello,

I'm wondering if anyone can help me or point me in the right direction
regarding how I can write to an XML file.
I'm new to PHP - I've just figured out how to basically write data to a
text file.
What I want to do is have a user submit data (email address  a question)
via a form that is written to the xml file, then have a  support person
add an answer to the xml file.
You may want to try this class to simplify the composition and output 
XML documents. Then you can just save the output to a file using the 
usual fopen/fwrite/close functions.

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: How do I do this select?

2004-01-11 Thread Manuel Vázquez Acosta
select distinct user.userId, fu.UserID as FriendID, fu.Name as FriendName
  from user, friendlist as f, user as fu
  where f.userkey = user.userkey and f.friendkey = fu.userkey
  order by user.userId, friendId;


Chris W [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I sent this to the mysql list but it doesn't seem to be working so I was
 hoping someone here could help.

 I have the following 2 tables.

 CREATE TABLE User (
UserKey   INT NOT NULL AUTO_INCREMENT,
UserIDCHAR(16) NOT NULL UNIQUE ,
Name  VARCHAR(20),
PRIMARY KEY (UserKey)
 );

 CREATE TABLE FriendList(
UserKey INT NOT NULL,
FriendKey   INT NOT NULL,
PRIMARY KEY (UserKey, FriendKey)
 );

 The second table is a many to many relationship table.  I want to select
   every row from FriendList and link it to userID so the out put looks
 something like this.

 UserID   FriendID  FriendName
 ax x-name
 ay y-name
 az z-name
 ba a-name
 bc c-name
 bz z-name
 cb b-name
 cx x-name


 This will give me sort of what I am looking for, but it shows the
 UserKey in the first column and I want the UserID.  I have tried a few
 others but just got errors.

 SELECT f.UserKey, UserID FriendID, Name FriendName
 FROM User u, FriendList f
 WHERE f.FriendKey = u.UserKey
 ORDER BY f.UserKey, FriendID;

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



[PHP] Re: How do I squelch warnings (without editing php.ini)?

2003-09-15 Thread Curt Zirzow
On Mon, 15 Sep 2003 13:20:05 -0400, Dan Anderson [EMAIL PROTECTED] 
wrote:

I am running a script that occasionally utters a few warnings when the
user does something dumb (but it does not kill the script).  Is there a
way to turn off warnings within a script?  I really don't want my users
to see them.
You can  lazily suppress errors on the fly like so
 @call_func();
the @ will suppress error messages being sent directly to the browser.

Curt	

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


[PHP] Re: How do I call a function in a Class from another function inthe same class

2003-08-16 Thread adam
 typically problem!
have you used $this-tehotherfunction();
or just use therotherfunction();???
if you call from your class to a members method , you have use $this!!!
And read more about oo-method!
cheers

Donpro wrote:
Hi,
 
I have two functions in a class where one calls the other.  When creating my
object I get an error:
 
Call to undefined function
 
I dont understand why the function can't be seen?
 
 
Thanks,
Don

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.507 / Virus Database: 304 - Release Date: 8/4/2003
 



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


[PHP] Re: how do i get assosciative name in foreach

2003-08-14 Thread Cristiano Duarte
 foreach ($array as $element)
 {
   // assuming get_assoc gets the assosciative name
   if (get_assoc($element) == 'element1')
 {get_assoc($element) do_something(); }
   elseif ( == 'element1')
 { do_somethingelse(); }
 }

I don't know if this is what you want but:

foreach ($array as $index=$element)
{
  // assuming get_assoc gets the assosciative name
  switch ($index) {
case 'element1':
do_something();
break;
default:
do_somethingelse();
   }
}


Cristiano Duarte

Dan Anderson [EMAIL PROTECTED] escreveu na mensagem
news:[EMAIL PROTECTED]
 I want to send an assosciative array to a foreach loop.  Is there any
 way to get the name?

 For instance, now I have:

 ?php

 $array['element1']['name'] = 'element1';
 $array['element1']['value'] = 'value1';
 $array['element2']['name'] = 'element2';
 $array['element2']['value'] = 'value1';

 foreach ($array as $element)
 {
   if ($element['name'] == 'element1')
 { do_something(); }
   elseif ($element['name'] == 'element1')
 { do_somethingelse(); }
 }

 ?

 I want to do:

 ?php

 $array['element1'] = 'element1';
 $array['element2'] = 'element2';

 foreach ($array as $element)
 {
   // assuming get_assoc gets the assosciative name
   if (get_assoc($element) == 'element1')
 {get_assoc($element) do_something(); }
   elseif ( == 'element1')
 { do_somethingelse(); }
 }

 ?

 Is what I want possible?

 Thanks in advance,

 Dan




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



[PHP] Re: How do I use $HTTP_*_VARS[]

2003-06-30 Thread Catalin Trifu
   Hi,

I presume in the previous version you used register_globals=On
the trick is that you will have to chenge most of the scripts now.
Now that you have moved to 4.2.3 version,
you should use the $_SERVER, $_REQUEST, $_POST, etc...
variables instead of $HTTP_*_VARS
Btw. It's agood idea to leave register_globals off.

Cheers,
Catalin

Ivan Carey [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello,
 I would like to be able to use $HTTP_*_VARS[].

 When I was using  PHP 4.0.4PL1 I had no provlems sending form variables or
 any other type of variables such as url variables from one page to
another.
 Now with PHP 4.2.3 I am unable to send variables from one page to another
 unless I turn on register_globals.

 How do I use $HTTP_*_VARS[] without a lot of recoding of all pages or do I
 simply leave register_globals on.
 Or is ther another way?

 Thankyou,
 Ivan




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



[PHP] Re: How do I display new lines in a textearea?

2003-06-06 Thread Bobby Patel
this is discussed in the posted comments under the function section of nl2br
on php.net.

But from what I remember there is no br2nl() (unfortunately).

just goto php.net/nl2br and search the posted comments for br2nl


Bobby


Petre Agenbag [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi

 I want to have a textarea that contains details read from a mysql table,
 but I want to echo each row so that it is on a new line. What is the
 new-line character for a textarea? ( in effect the reverse of nl2br()
 )

 Thanks






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



[PHP] Re: How do I grab the first X characters of a string?

2003-06-04 Thread Kai Poppe
$short_string = substr($long_string, 0, $length);

Erich Kolb [EMAIL PROTECTED] schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
 How do I grab the first X characters of a string?





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



Re: [PHP] Re: How do i valadate an email address?

2003-03-29 Thread Justin French
http://www.killersoft.com/downloads/pafiledb.php?action=fileid=4

Justin


On 03/27/2003 03:44 AM, Philip J. Newman wrote:
 How would i check that an e-mail has the right parts in it. for example.
 
 username @ domain . ext


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



[PHP] Re: How do i valadate an email address?

2003-03-27 Thread Gudmund Vatn
Philip J. Newman wrote:

 How would i check that an e-mail has the right parts in it. for example.

 username @ domain . ext

 Thanks

 / Jim Bob

Many people just check it like this:
if (strpos($emailVar), '@')  0) {
echo 'Email is validated';
} else {
echo 'Please supply a correct email address, don\'t you try no fancy
stuff with me!';
}

But this function from the pear class Validate, is more complete (can even
check the domain):

function validateEmail($email, $check_domain = false)
{
if (ereg('^[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.
 '[-!#$%\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.
 '[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email))
{
if ($check_domain  function_exists('checkdnsrr')) {
list (, $domain)  = explode('@', $email);
if (checkdnsrr($domain, 'MX') || checkdnsrr($domain, 'A')) {
return true;
}
return false;
}
return true;
}
return false;
}

Cheers!


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



[PHP] Re: How do i valadate an email address?

2003-03-27 Thread Manuel Lemos
Hello,

On 03/27/2003 03:44 AM, Philip J. Newman wrote:
How would i check that an e-mail has the right parts in it. for example.

username @ domain . ext
You may want to try this class that provides different levels of e-mail 
address validation:

http://www.phpclasses.org/emailvalidation

--

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


[PHP] Re: How do I display the script file name?

2003-02-27 Thread Mark Harwood
echo $_SERVER['PHP_SELF'];


Stephen Ford [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 How can I display the script file name? Presumably something like-:

 ?php
 echo $ScriptFileName;
 ?

 While I'm learning php and developing various Web page versions, I want to
 be sure the that the display is from the appropriate script.

 Regards
 Stephen Ford, Surrey, UK






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



RE: [PHP] Re: How do I force a 'timeout' in a loop for that itteration, or conversley how to timeout a 'ping request?

2003-02-10 Thread Daevid Vincent
On linux it says:

-t ttl  Set the IP Time to Live for multicasted packets.  This flag
only
 applies if the ping destination is a multicast address.

 -Original Message-
 From: Philip Hallstrom [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, February 07, 2003 4:31 PM
 To: Daevid Vincent
 Cc: [EMAIL PROTECTED]
 Subject: [PHP] Re: How do I force a 'timeout' in a loop for 
 that itteration, or conversley how to timeout a 'ping request?
 
 
 Not sure on linux, but on freebsd ping's man page says:
 
 -t timeout Specify a timeout, in seconds, before ping exits regardless
 of how many packets have been recieved.
 
 On Fri, 7 Feb 2003, Daevid Vincent wrote:
 
  I'm trying to automate finding pingable domains given an IP 
 or a domain.
  The problem is that some domains don't actually return 
 pings, and on
  Linux, it just sits there forever (ugh!). So... Can someone 
 tell me how
  to 'abort' or 'timeout' an itteration of a loop. Maybe 
 start a timer and
  then check if a number of millis has gone by? But it seems 
 that won't
  work b/c PHP isn't threaded, it will just hang at the exec() command
  right? Converseley, anyone know how to force a /bin/ping to
  automatically timeout (sans hitting CTRL+C)? I 'man ping' 
 but it didn't
  seem to have that option.
  Here is the code I'm using...
 
  $typeArray = array ('www' = false,
  'ftp' = false,
  'mail' = false,
  'exchange' = false,
  'owa' = false,
  'dns' = false,
  'dns1' = false,
  'dns2' = false,
  'dns3' = false,
  'router' = false,
  'firewall' = false,
  'fw' = false,
  'fw1' = false,
  'sql' = false,
  'db' = false,
  'database' = false,
  'crm' = false
  );
 
  reset($typeArray);
  while ( list($key, $val) = each($typeArray) )
  {
  $testDomain = $key...$domain;
  $pingtest = exec(/bin/ping -c 1 -q .$testDomain);
  //echo IFONT SIZE=-3pingtest of .$testDomain. =
  .$pingtest./FONT/IBR\n;
  if ( strstr($pingtest,rtt min) )
  {
  $typeArray[$key] = gethostbyname($testDomain);
  echo INPUT TYPE='checkbox' NAME='IPcheckbox[]'
  VALUE='.$typeArray[$key].' CHECKED.$testDomain.
  (.$typeArray[$key].)BR\n;
  $ipCounter++;
  }
  //sleep(3);
  }
  if ($ipCounter == 0)
  echo BNo pingable domains found in our test
  list/BBR;
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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




[PHP] Re: How do I force a 'timeout' in a loop for that itteration, orconversley how to timeout a 'ping request?

2003-02-07 Thread Philip Hallstrom
Not sure on linux, but on freebsd ping's man page says:

-t timeout Specify a timeout, in seconds, before ping exits regardless
of how many packets have been recieved.

On Fri, 7 Feb 2003, Daevid Vincent wrote:

 I'm trying to automate finding pingable domains given an IP or a domain.
 The problem is that some domains don't actually return pings, and on
 Linux, it just sits there forever (ugh!). So... Can someone tell me how
 to 'abort' or 'timeout' an itteration of a loop. Maybe start a timer and
 then check if a number of millis has gone by? But it seems that won't
 work b/c PHP isn't threaded, it will just hang at the exec() command
 right? Converseley, anyone know how to force a /bin/ping to
 automatically timeout (sans hitting CTRL+C)? I 'man ping' but it didn't
 seem to have that option.
 Here is the code I'm using...

 $typeArray = array (  'www' = false,
   'ftp' = false,
   'mail' = false,
   'exchange' = false,
   'owa' = false,
   'dns' = false,
   'dns1' = false,
   'dns2' = false,
   'dns3' = false,
   'router' = false,
   'firewall' = false,
   'fw' = false,
   'fw1' = false,
   'sql' = false,
   'db' = false,
   'database' = false,
   'crm' = false
   );

   reset($typeArray);
   while ( list($key, $val) = each($typeArray) )
   {
   $testDomain = $key...$domain;
   $pingtest = exec(/bin/ping -c 1 -q .$testDomain);
   //echo IFONT SIZE=-3pingtest of .$testDomain. =
 .$pingtest./FONT/IBR\n;
   if ( strstr($pingtest,rtt min) )
   {
   $typeArray[$key] = gethostbyname($testDomain);
   echo INPUT TYPE='checkbox' NAME='IPcheckbox[]'
 VALUE='.$typeArray[$key].' CHECKED.$testDomain.
 (.$typeArray[$key].)BR\n;
   $ipCounter++;
   }
   //sleep(3);
   }
   if ($ipCounter == 0)
   echo BNo pingable domains found in our test
 list/BBR;


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



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




[PHP] Re: How do I include specific files?

2002-12-02 Thread Kevin Lowe
Hi Roddie,

The require or include functions will do this for you, see
http://www.php.net/manual/en/function.include.php

Paths are absolute to the file system, not where the web server path starts,

eg suppose your file is at
/usr/home/www/riddie/phpscripts/somedir/script.php

you would include a file (into script.php) from the phpscripts directory
using either

require('/usr/home/www/riddie/phpscripts/myincfile.php')
or
require('../myincfile.php')

but
require('/phpscripts/myincfile.php') would not work as php does not work
from paths set by the webserver.

HTH,

Kevin


Roddie Grant [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I'm new to PHP, but from Lasso I'm used to the following sort of
arrangement
 (in pseudo-code)

 Search for matching records
 If number found=1
   include /folder/subfolder/file1
 If number found1
  include /folder/subfolder/file2
 If number found=0
  include /anotherfolder/subfolder/file99

 where the included file contains the appropriate code for displaying a
list,
 a detailed record etc. In fact the whole page is made up almost entirely
 from a succession of included files.

 The paths all hang from the root as with HTML (for example img
 src=/images-folder-at-root-level/image.gif).

 In PHP the include_path stops this process in its tracks. I'm with an ISP
so
 I don't suppose I can control include_path (.:/usr/local/lib/php). Are
there
 any other options?

 TIA

 Roddie Grant
 [EMAIL PROTECTED]




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




[PHP] Re: How do I run a command as root?

2002-12-02 Thread Luke van Blerk
Thanks for all the replys. I'll be checking out sudo.

p.s I forgot to put 'in a script'

Luke Van Blerk [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi

 I'm trying to find out how to run a command on the server as root. Does
 anybody know how to do this?

 Thanks
 Luke





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




[PHP] Re: How do I Install PHP on Apache 2.0?

2002-11-24 Thread Stephan Seidt
Hi,

You must build a shared library by configuring php with --with-apxs2.

On Sun, 24 Nov 2002 09:42:40 -0500
[EMAIL PROTECTED] (Tweak2x) wrote:

 can somebody please help me? I cant figure it out.
 
 

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




[PHP] Re: How do I Install PHP on Apache 2.0?

2002-11-24 Thread Tweak2x
how do i do that?

Stephan Seidt [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

 You must build a shared library by configuring php with --with-apxs2.

 On Sun, 24 Nov 2002 09:42:40 -0500
 [EMAIL PROTECTED] (Tweak2x) wrote:

  can somebody please help me? I cant figure it out.
 
 



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




[PHP] Re: How do I Install PHP on Apache 2.0?

2002-11-24 Thread Stephan Seidt
windows, unix ?


On Sun, 24 Nov 2002 10:26:21 -0500
[EMAIL PROTECTED] (Tweak2x) wrote:

 how do i do that?
 
 Stephan Seidt [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi,
 
  You must build a shared library by configuring php with --with-apxs2.
 
  On Sun, 24 Nov 2002 09:42:40 -0500
  [EMAIL PROTECTED] (Tweak2x) wrote:
 
   can somebody please help me? I cant figure it out.
  
  
 
 

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




[PHP] Re: How do I Install PHP on Apache 2.0?

2002-11-24 Thread Tweak2x
windows xp pro

Stephan Seidt [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 windows, unix ?


 On Sun, 24 Nov 2002 10:26:21 -0500
 [EMAIL PROTECTED] (Tweak2x) wrote:

  how do i do that?
 
  Stephan Seidt [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   Hi,
  
   You must build a shared library by configuring php with --with-apxs2.
  
   On Sun, 24 Nov 2002 09:42:40 -0500
   [EMAIL PROTECTED] (Tweak2x) wrote:
  
can somebody please help me? I cant figure it out.
   
   
 
 



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




[PHP] Re: How do i make an upload script?

2002-11-14 Thread Tweak2x
ok, this is upload.php:

form enctype=multipart/form-data action=upload.php method=post
input type=hidden name=MAX_FILE_SIZE value=1000
Send this file: input name=userfile type=file
input type=submit value=Send File
/form


what else do i need?
@ Edwin [EMAIL PROTECTED] wrote in message
news:20021112124140.71748.qmail;pb1.pair.com...

 Tweak2x [EMAIL PROTECTED] wrote in message
 news:20021112123023.55841.qmail;pb1.pair.com...
  How do i make an upload script?

   http://us.php.net/manual/en/features.file-upload.php

 - E




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




RE: [PHP] Re: How do i make an upload script?

2002-11-14 Thread Jon Haworth
Hi,

   How do i make an upload script?
 
  http://us.php.net/manual/en/features.file-upload.php
 
 ok, this is upload.php:
 
 form enctype=multipart/form-data action=upload.php method=post
 input type=hidden name=MAX_FILE_SIZE value=1000
 Send this file: input name=userfile type=file
 input type=submit value=Send File
 /form

Yup, copied and pasted from the manual page, that should work.

 
 what else do i need?

1. A script to receive the uploads
2. A file to upload

The manual page you linked to above will be of use in completing stage 1 -
there's a bit further down that you need to copy and paste as well. Read the
user comments as well, as they will answer questions that will inevitably
come up.

Stage 2 - well, you're on your own, but there should be something on your
hard drive that's suitable.

Cheers
Jon



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




RE: [PHP] Re: How do i make an upload script?

2002-11-14 Thread brucedickey
Jon,

There's bulk-emailer on hotscripts.com. You could look at its code.

Bruce

-Original Message-
From: Jon Haworth [mailto:jhaworth;witanjardine.co.uk]
Sent: Thursday, November 14, 2002 5:37 AM
To: 'Tweak2x'; [EMAIL PROTECTED]
Subject: RE: [PHP] Re: How do i make an upload script?


Hi,

   How do i make an upload script?
 
  http://us.php.net/manual/en/features.file-upload.php
 
 ok, this is upload.php:
 
 form enctype=multipart/form-data action=upload.php method=post
 input type=hidden name=MAX_FILE_SIZE value=1000
 Send this file: input name=userfile type=file
 input type=submit value=Send File
 /form

Yup, copied and pasted from the manual page, that should work.

 
 what else do i need?

1. A script to receive the uploads
2. A file to upload

The manual page you linked to above will be of use in completing stage 1 -
there's a bit further down that you need to copy and paste as well. Read the
user comments as well, as they will answer questions that will inevitably
come up.

Stage 2 - well, you're on your own, but there should be something on your
hard drive that's suitable.

Cheers
Jon



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

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




[PHP] Re: How do i make an upload script?

2002-11-12 Thread @ Edwin

(B"Tweak2x" [EMAIL PROTECTED] wrote in message
(B[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
(B How do i make an upload script?
(B
(B  http://us.php.net/manual/en/features.file-upload.php
(B
(B- E
(B
(B
(B-- 
(BPHP General Mailing List (http://www.php.net/)
(BTo unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: How do I use a Javascript variable in PHP?

2002-09-23 Thread Ivo

You could do this ONLY by passing the var to a new URL with the desired php
(your script).
Otherwise the php will be executed (on the server) before JS (which will be
executed on the client after receiving the php result page)

regards

Ivo

Tom [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi all,



 I hope this is the right place to pose my question, so here goes: -



 I have a javascript function called calcMonth() and given a number it will
 return a date i.e. month = calcMonth( 57 )   -  month will be 'sept 2002'



 The problem I`m having is at the beginning of my PHP file I`m calling this
 calcMonth() then doing a load of php stuff and then trying to use the
 javascript month variable, but to no avail: -



 print tdinput type=text class=claimreadonly readonly
name=POST_monthdisp
 value=javascript:month; size=10 tabindex=99/td;



 The result is, the browser displays the words 'javascript:month;' - not a
 month number



 I`ve looked everywhere for an answer from persistent javascript data to
 using framesets to hold the variable but to no avail.



 I know its quite a bit of javascript, but its mixed in  with PHP too so I
 thought it`d be the right place.



 Anyways, I hope someone can provide the answer to my problem.



 Thanks in advance,

 Tom






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




[PHP] Re: How do I upgrade my version of PHP?

2002-09-12 Thread David Robley

In article [EMAIL PROTECTED], [EMAIL PROTECTED] says...
 Could you explain what man patch does or is? I haven't updated using a
 patch before. Thanks.
 
  From: [EMAIL PROTECTED]
  Newsgroups: php.general
  Date: Wed, 11 Sep 2002 23:14:55 +0200
  To: [EMAIL PROTECTED]
  Subject: Re: How do I upgrade my version of PHP?
  
  You should use the patch command, feel free to man patch.
  
  --
  
  Nicos - CHAILLAN Nicolas
  [EMAIL PROTECTED]
  www.WorldAKT.com - Hébergement de sites Internet
  
  Monty [EMAIL PROTECTED] a écrit dans le message de news:
  [EMAIL PROTECTED]
  I've downloaded the patch file for 4.2.2 to 4.2.3 from the PHP website,
  but,
  not sure what to do with this file. I have a Linux 7.x server. Can anyone
  tell me how to patch my version of PHP or point me to a source that
  explains
  how this is done?
  
  Thanks!

patch is a *nix program to apply patches such as the one you have 
downloaded. man is a *nix program which displays help about the program 
supplied as an argument to man - so 'man patch' will show you the manual 
page for patch.

-- 
David Robley

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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




[PHP] Re: How do I upgrade my version of PHP?

2002-09-11 Thread nicos

You should use the patch command, feel free to man patch.

--

Nicos - CHAILLAN Nicolas
[EMAIL PROTECTED]
www.WorldAKT.com - Hébergement de sites Internet

Monty [EMAIL PROTECTED] a écrit dans le message de news:
[EMAIL PROTECTED]
 I've downloaded the patch file for 4.2.2 to 4.2.3 from the PHP website,
but,
 not sure what to do with this file. I have a Linux 7.x server. Can anyone
 tell me how to patch my version of PHP or point me to a source that
explains
 how this is done?

 Thanks!




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




[PHP] Re: How do I upgrade my version of PHP?

2002-09-11 Thread Monty

Could you explain what man patch does or is? I haven't updated using a
patch before. Thanks.

 From: [EMAIL PROTECTED]
 Newsgroups: php.general
 Date: Wed, 11 Sep 2002 23:14:55 +0200
 To: [EMAIL PROTECTED]
 Subject: Re: How do I upgrade my version of PHP?
 
 You should use the patch command, feel free to man patch.
 
 --
 
 Nicos - CHAILLAN Nicolas
 [EMAIL PROTECTED]
 www.WorldAKT.com - Hébergement de sites Internet
 
 Monty [EMAIL PROTECTED] a écrit dans le message de news:
 [EMAIL PROTECTED]
 I've downloaded the patch file for 4.2.2 to 4.2.3 from the PHP website,
 but,
 not sure what to do with this file. I have a Linux 7.x server. Can anyone
 tell me how to patch my version of PHP or point me to a source that
 explains
 how this is done?
 
 Thanks!
 
 
 


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




[PHP] Re: How do I keep a page from caching in I.E

2002-09-06 Thread Krzysztof Dziekiewicz

4.09.2002, 17:48, Victor V. Evtushenko wrote:

 Donpro wrote:
 Hi,
 
 Using I.E. 5.5. I can't seem to keep a page from caching.  When I click on

 Have you read HOWTO: Prevent Caching in Internet Explorer?
 http://support.microsoft.com/default.aspx?scid=kb;EN-US;q234067

According to the description I inserted header('Expires: -1');
It is fine if it is Internet Explorer.
But e.g. Opera ignore the header. After BACK it displays old
content. I even switched off all cache options in preferences but it
does not help.

 the browser BACK button, I get the cached page so I have to click on Refresh
 to get the actual page content.  I've placed the following at the top of the
 HTML file but it doesn't seem to do anything. Any help would be appreciated.


Krzysztof Dziekiewicz


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




Re: [PHP] Re: How do I keep a page from caching in I.E

2002-09-06 Thread Casey Allen Shobe

I know this problem.  Konqueror, Netscape, Mozilla, and Opera are all broken.  
They use cache regardless of whether or not they should when you use the back 
button.  I know of no way around it.

What especially pisses me off is that Mozilla, shortly before 1.0, worked 
properly, even when you used the back button, as IE does.  But the 1.0 
release broke it, as though they did it intentionally.

Here's what I use, though it really only works in IE where the back button is 
concerned:

// Don't allow browsers to cache data
header ('Last-Modified: '.gmdate(D, d M Y H:i:s).' GMT');
header ('Expires: '.gmdate(D, d M Y H:i:s).' GMT');
header ('Cache-Control: no-cache, must-revalidate');
header ('Pragma: no-cache');

If anyone has any further information, I would appreciate it.  Are there 
workarounds in PHP?  Or do I need to complain to the web browser makers?

- Casey

On Friday 06 September 2002 05:44 am, Krzysztof Dziekiewicz wrote:
 4.09.2002, 17:48, Victor V. Evtushenko wrote:
  Donpro wrote:
  Hi,
 
  Using I.E. 5.5. I can't seem to keep a page from caching.  When I click
  on
 
  Have you read HOWTO: Prevent Caching in Internet Explorer?
  http://support.microsoft.com/default.aspx?scid=kb;EN-US;q234067

 According to the description I inserted header('Expires: -1');
 It is fine if it is Internet Explorer.
 But e.g. Opera ignore the header. After BACK it displays old
 content. I even switched off all cache options in preferences but it
 does not help.

  the browser BACK button, I get the cached page so I have to click on
  Refresh to get the actual page content.  I've placed the following at
  the top of the HTML file but it doesn't seem to do anything. Any help
  would be appreciated.

 Krzysztof Dziekiewicz

-- 
Casey Allen Shobe / Network Security Analyst  PHP Developer
SecureWorks, Inc. / 404.327.6339 x169 / Fax: 404.728.0144
[EMAIL PROTECTED] / http://www.secureworks.net
Content is my own and does not necessarily represent my company.

Lost Terminal.

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




[PHP] Re: How do I keep a page from caching in I.E

2002-09-04 Thread Victor V. Evtushenko

Hi,

Donpro wrote:
 Hi,
 
 Using I.E. 5.5. I can't seem to keep a page from caching.  When I click on

Have you read HOWTO: Prevent Caching in Internet Explorer?
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q234067

 the browser BACK button, I get the cached page so I have to click on Refresh
 to get the actual page content.  I've placed the following at the top of the
 HTML file but it doesn't seem to do anything. Any help would be appreciated.


Victor.


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




[PHP] Re: how do I send information to a php page from a menu list

2002-09-02 Thread lallous

Hello Ivan,

   select name=selcategoryid value=0

Don't set a value for that tag!

  echo option name=\selcategoryid\
value=\$faqcatsid\$faqcats/option;
no need to name the option tag too, setting the value will be enough.


when you submit your form,  faqbycat.php will receive $selcategoryid as the
user chose from that select list.

Elias,

Ivan Carey [EMAIL PROTECTED] wrote in message
005801c2527c$dcb00260$0201a8c0@ivan">news:005801c2527c$dcb00260$0201a8c0@ivan...
Hello,
how do I send information to a php page from a menu list?

When a user selects an item from the list I would like to be able to send
selcategoryid to faqbycat.php without the use of a submit button.

Is it done by using the onChange event? if so how may this be done?

The code I am using presently is below

form action=faqbycat.php
 select name=selcategoryid value=0
  option name=selcategoryid value=0 selectedSelect a
Category/option
   ?php
   //display list of provider names
while ($myrowcating=MySQL_fetch_array($resultcatdet))
 {
  $faqcatsid=stripslashes($myrowcating[breastfaqcatid]);
  $faqcats=stripslashes($myrowcating[breastfaqcat]);
  echo option name=\selcategoryid\
value=\$faqcatsid\$faqcats/option;
 }//while ($myrowadmintitles=MySQL_fetch_array($admintilteresult))
   ?
 /select
 brbr
 input type=Submit name=selbycat value=Show FAQ's by Category
/form

Thanks for your answer,
Ivan




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




[PHP] Re: how do I send information to a php page from a menu list

2002-09-02 Thread Erwin

Ivan Carey wrote:
 Hello,
 how do I send information to a php page from a menu list?

 When a user selects an item from the list I would like to be able to
 send selcategoryid to faqbycat.php without the use of a submit
 button.

 Is it done by using the onChange event? if so how may this be done?

try:
select name=selcategoryid onChange=JavaScript: this.submit();

Grtz Erwin



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




[PHP] Re: how do I send information to a php page from a menu list

2002-09-02 Thread Javier Montserat

different approach using JavaScript...

script language=JavaScript
// drop down redirect
function doRedirect(value) {
   if ((value != ) || (value != 0)) {
  self.location=value;
   } else {
 alert('Please Make a Selection');
 return false;
  }
}

//--
/script

form
select name=name 
onchange=javascript:dropdown(this.options[this.selectedIndex].value)
   option value=0lt; make a selection gt;
   option value=your_php_page.php?? echo $your_value1 ?? echo 
$your_value1 ?/option
   option value=your_php_page.php?? echo $your_value2 ?? echo 
$your_value2 ?/option
/select
/form


Bueno,

Javier

--=_NextPart_000_0055_01C252D0.ADA4A940
Content-Type: text/plain;
charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hello,
how do I send information to a php page from a menu list?

When a user selects an item from the list I would like to be able to =
send selcategoryid to faqbycat.php without the use of a submit button.

Is it done by using the onChange event? if so how may this be done?

The code I am using presently is below

form action=3Dfaqbycat.php
 select name=3Dselcategoryid value=3D0
  option name=3Dselcategoryid value=3D0 selectedSelect a =
Category/option
   ?php
   //display list of provider names
while ($myrowcating=3DMySQL_fetch_array($resultcatdet))
 {
  $faqcatsid=3Dstripslashes($myrowcating[breastfaqcatid]);   =20
  $faqcats=3Dstripslashes($myrowcating[breastfaqcat]);
  echo option name=3D\selcategoryid\ =
value=3D\$faqcatsid\$faqcats/option;
 }//while =
($myrowadmintitles=3DMySQL_fetch_array($admintilteresult))
   ?=20
 /select
 brbr
 input type=3DSubmit name=3Dselbycat value=3DShow FAQ's by =
Category
/form =20

Thanks for your answer,
Ivan

--=_NextPart_000_0055_01C252D0.ADA4A940--



_
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


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




[PHP] Re: How do I customize the User-Agent when opening a remote file?

2002-08-16 Thread lallous

one of the solutions is not using fopen() instead use another class that is
able to post to pages and retrieve them.

check phpclasses.org


Dallas Thunder [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 How do I customize the User-Agent when using fopen() or file() to open a
 remote file?

 PHP use PHP/4.2.3-dev on my system as the User-Agent when I using file()
 function to retrive a remote file.  Howerver, some servers will refuse to
 serve browsers other than Mozilla compatible and return a 403 code.  Is
 there any method to let me define User-Agent for my own?  Thanks!









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




[PHP] Re: How do I show the sourse code?

2002-07-28 Thread JJ Harrison

research the php function htmlspecialchars().

I replaces  with lt;  and  with gt; etc.


--
JJ Harrison
[EMAIL PROTECTED]
www.tececo.com

I often get confused with lt; and gt; so they may be in the wrong order
but I am sure you get the idea.

ØYstein HåLand [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I have seen on some of the script-sites around some nice ways of
presenting
 the source code. Often in nice colors. So, the natural question is: how is
 that done (cause I don't think anyone has the patience to put lt; and
gt;
 around all the )





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




[PHP] Re: How do I show the sourse code?

2002-07-28 Thread David Robley

In article [EMAIL PROTECTED], [EMAIL PROTECTED] says...
 I have seen on some of the script-sites around some nice ways of presenting
 the source code. Often in nice colors. So, the natural question is: how is
 that done (cause I don't think anyone has the patience to put lt; and gt;
 around all the )

If you are using php v4 you can do this with show_source(), or if using 
apache, you can configure it to serve source code with syntax highlighting 
rather than parsing the code.

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




Re: [PHP] Re: How do I validate input using php?

2002-07-25 Thread Miguel Cruz

On Wed, 24 Jul 2002, Mike Mannakee wrote:
 Here's the code I use to validate emails:
 
 function check_email($email)
  {
   global $email;
   $regex=^([a-z0-9_]|\\-|\\.)+(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$;
   return eregi($regex, $email, $trash);
  }

Please search the archives on this topic; it's been covered exhaustively,
and each time it comes up we get 25 bad functions and eventually one good
one. The above function will bark at valid domains (.museum, etc.) and
will allow patently invalid domains (anything containing _).

miguel


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




  1   2   >