php-general Digest 16 Jul 2008 19:26:05 -0000 Issue 5572

Topics (messages 276902 through 276930):

Re: How can i get the location of an exit()/die() from within 
register_shutdown_function()?
        276902 by: Chris
        276904 by: Mathijs van Veluw
        276908 by: Thijs Lensselink
        276909 by: tedd
        276911 by: Eric Butera
        276912 by: Mathijs van Veluw
        276913 by: Eric Butera
        276914 by: Mathijs van Veluw
        276915 by: Mathijs van Veluw
        276925 by: tedd
        276929 by: Eric Butera
        276930 by: tedd

Re: Downloading a file
        276903 by: Tom Chubb
        276910 by: Robbert van Andel

ÂÅÓÅÄËÉ Ó ÕÎÉËÁÌØÎÙÍ ×ÓÔÒÏÅÎÎÙÍ ÇÒÉÌÅÍ ÄÌÑ ÄÁÞÉ á
        276905 by: ïÔ ïïï äÁÞÎÙÊ ÄÏÍ ñ

Re: Changing PHP.ini
        276906 by: Jay Blanchard

Re: Byte range support
        276907 by: Manuel Vacelet

Re: Freelance PHP development in India
        276916 by: Ryan S
        276919 by: Manuel Lemos

Re: Math Weirdness
        276917 by: Shawn McKenzie
        276918 by: Jason Pruim
        276920 by: Jay Blanchard
        276922 by: Daniel Brown

implementing a website search feature using php
        276921 by: Sudhakar
        276923 by: Robert Cummings
        276926 by: tedd
        276927 by: Eric Butera

Copying Multiple Files from One Server to Another Server
        276924 by: Wei, Alice J.

Re: is there a problem with php script pulling HTML out of database as it 
writes the page??
        276928 by: Daniel Brown

Administrivia:

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

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

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


----------------------------------------------------------------------
--- Begin Message ---
Mathijs van Veluw wrote:
> Hello there,
> 
> I have an shutdown function to catch fatal-errors etc..
> Now when there is an exit() somewhere i get an empty message from
> get_last_error().
> I want to know the location of this exit() or die().
> 
> Is there a way to get the file and line-number from where the exit/die
> originated?

debug_backtrace ?

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

--- End Message ---
--- Begin Message ---
Chris wrote:
Mathijs van Veluw wrote:
Hello there,

I have an shutdown function to catch fatal-errors etc..
Now when there is an exit() somewhere i get an empty message from
get_last_error().
I want to know the location of this exit() or die().

Is there a way to get the file and line-number from where the exit/die
originated?

debug_backtrace ?


This won't work from within the register_shutdown_function() function.
This because the scope is cleared, and the debug_backtrace starts from within 
the register_shutdown_function() function.

--- End Message ---
--- Begin Message ---
Quoting Mathijs van Veluw <[EMAIL PROTECTED]>:

Hello there,

I have an shutdown function to catch fatal-errors etc..
Now when there is an exit() somewhere i get an empty message from
get_last_error().
I want to know the location of this exit() or die().

Is there a way to get the file and line-number from where the exit/die
originated?

Thx in advance.

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

I don't think this is possible in PHP. When exit(0); is called. PHP execution stops. In the manual there is a small comment about exit inside a register_shutdown_function

[snip]
Multiple calls to register_shutdown_function() can be made, and each will be called in the same order as they were registered. If you call exit() within one registered shutdown function, processing will stop completely and no other registered shutdown functions will be called.
[/snip]

--- End Message ---
--- Begin Message ---
At 9:23 AM +0200 7/16/08, Mathijs van Veluw wrote:
Hello there,

I have an shutdown function to catch fatal-errors etc..
Now when there is an exit() somewhere i get an empty message from get_last_error().
I want to know the location of this exit() or die().

Is there a way to get the file and line-number from where the exit/die originated?

Thx in advance.

Mathijs:

For MySQL failures I use:

$result = mysql_query($query) or die(report($query,__LINE__ ,__FILE__));


function report($query, $line, $file)
        {
echo($query . '<br>' .$line . '<br/>' . $file . '<br/>' . mysql_error());
        }

Perhaps you can modify that for your use.

Cheers,

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

--- End Message ---
--- Begin Message ---
On Wed, Jul 16, 2008 at 3:23 AM, Mathijs van Veluw
<[EMAIL PROTECTED]> wrote:
> Hello there,
>
> I have an shutdown function to catch fatal-errors etc..
> Now when there is an exit() somewhere i get an empty message from
> get_last_error().
> I want to know the location of this exit() or die().
>
> Is there a way to get the file and line-number from where the exit/die
> originated?
>
> Thx in advance.

The way I handle this is by throwing exceptions in my code.  So let's
say that there is a db connection/query failure for whatever reason.
Instead of using query() or die() which is not user friendly, I throw
an exception which bubbles up.  Once it hits the top then I can catch
it, log it accordingly, and show the user a friendlier error page
saying Oops!

With an exception you get exactly what you want, a full-blown stack
trace complete with paths, line numbers etc.  You also get the ability
to be graceful about what you show to the end user.

...but I have the feeling that you're already dealing with a situation
in lots of existing code.  Perhaps you could combine some suggestions
in this thread and replace your die/exit statements with a custom
function which logs a debug_backtrace() and then really dies, but
gracefully of course.  :)

As an aside, if I were to see some jibberish about a query and line
numbers when I click a link I'd leave that site.  (And for the
archives) It is a security vuln to show full file paths to an end
user.  If someone is tampering with your system we shouldn't give them
any more information than they can already get.

--- End Message ---
--- Begin Message ---
Eric Butera wrote:
On Wed, Jul 16, 2008 at 3:23 AM, Mathijs van Veluw
<[EMAIL PROTECTED]> wrote:
Hello there,

I have an shutdown function to catch fatal-errors etc..
Now when there is an exit() somewhere i get an empty message from
get_last_error().
I want to know the location of this exit() or die().

Is there a way to get the file and line-number from where the exit/die
originated?

Thx in advance.

The way I handle this is by throwing exceptions in my code.  So let's
say that there is a db connection/query failure for whatever reason.
Instead of using query() or die() which is not user friendly, I throw
an exception which bubbles up.  Once it hits the top then I can catch
it, log it accordingly, and show the user a friendlier error page
saying Oops!

With an exception you get exactly what you want, a full-blown stack
trace complete with paths, line numbers etc.  You also get the ability
to be graceful about what you show to the end user.

...but I have the feeling that you're already dealing with a situation
in lots of existing code.  Perhaps you could combine some suggestions
in this thread and replace your die/exit statements with a custom
function which logs a debug_backtrace() and then really dies, but
gracefully of course.  :)

As an aside, if I were to see some jibberish about a query and line
numbers when I click a link I'd leave that site.  (And for the
archives) It is a security vuln to show full file paths to an end
user.  If someone is tampering with your system we shouldn't give them
any more information than they can already get.

Well i don't use 'OR die()' stuff. But exceptions.

For some reason from within the register_shutdown_function() function i get an 
empty error message.
This only occurs, as far as i know, when there is an exit somewhere.

I want to trace where this comes from.

But i think that this isn't possible, as i looked on the web and there arn't 
any solutions.

Thx for the help.

--- End Message ---
--- Begin Message ---
On Wed, Jul 16, 2008 at 9:41 AM, Mathijs van Veluw
<[EMAIL PROTECTED]> wrote:
> Well i don't use 'OR die()' stuff. But exceptions.
>
> For some reason from within the register_shutdown_function() function i get
> an empty error message.
> This only occurs, as far as i know, when there is an exit somewhere.
>
> I want to trace where this comes from.
>
> But i think that this isn't possible, as i looked on the web and there arn't
> any solutions.
>
> Thx for the help.

Well if this is a very specific issue that you're trying to resolve
perhaps you could try and figure out how the user triggered the error.
 You could just save the remote address and request uri, do some
access log searching and re-produce the path the user took through
your site.  This has been a helpful technique for me several times.
One of the main problems for me is that I know how to use the systems
I build, so I wouldn't click on stuff in the weird order some users
do.

--- End Message ---
--- Begin Message ---
Eric Butera wrote:
On Wed, Jul 16, 2008 at 9:41 AM, Mathijs van Veluw
<[EMAIL PROTECTED]> wrote:
Well i don't use 'OR die()' stuff. But exceptions.

For some reason from within the register_shutdown_function() function i get
an empty error message.
This only occurs, as far as i know, when there is an exit somewhere.

I want to trace where this comes from.

But i think that this isn't possible, as i looked on the web and there arn't
any solutions.

Thx for the help.

Well if this is a very specific issue that you're trying to resolve
perhaps you could try and figure out how the user triggered the error.
 You could just save the remote address and request uri, do some
access log searching and re-produce the path the user took through
your site.  This has been a helpful technique for me several times.
One of the main problems for me is that I know how to use the systems
I build, so I wouldn't click on stuff in the weird order some users
do.

Well it is an cronjobed php script that executs several other scripts depending 
on the time.
Something within those cronjobs triggers the shutdown function without an exit, 
which i find very strange.
I think i have to debug it to trace the exact steps what its doing, because 
there is no exit within that script.

--- End Message ---
--- Begin Message ---
Eric Butera wrote:
On Wed, Jul 16, 2008 at 9:41 AM, Mathijs van Veluw
<[EMAIL PROTECTED]> wrote:
Well i don't use 'OR die()' stuff. But exceptions.

For some reason from within the register_shutdown_function() function i get
an empty error message.
This only occurs, as far as i know, when there is an exit somewhere.

I want to trace where this comes from.

But i think that this isn't possible, as i looked on the web and there arn't
any solutions.

Thx for the help.

Well if this is a very specific issue that you're trying to resolve
perhaps you could try and figure out how the user triggered the error.
 You could just save the remote address and request uri, do some
access log searching and re-produce the path the user took through
your site.  This has been a helpful technique for me several times.
One of the main problems for me is that I know how to use the systems
I build, so I wouldn't click on stuff in the weird order some users
do.

Well it is an cronjobed php script that executs several other scripts depending 
on the time.
Something within those cronjobs triggers the shutdown function without an exit, 
which i find very strange.
I think i have to debug it to trace the exact steps what its doing, because 
there is no exit within that script.


--- End Message ---
--- Begin Message ---
At 9:15 AM -0400 7/16/08, Eric Butera wrote:
As an aside, if I were to see some jibberish about a query and line
numbers when I click a link I'd leave that site.  (And for the
archives) It is a security vuln to show full file paths to an end
user.  If someone is tampering with your system we shouldn't give them
any more information than they can already get.

It can certainly help you for debugging, but I agree, it's not for production.

tedd

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

--- End Message ---
--- Begin Message ---
On Wed, Jul 16, 2008 at 1:53 PM, tedd <[EMAIL PROTECTED]> wrote:
> At 9:15 AM -0400 7/16/08, Eric Butera wrote:
>>
>> As an aside, if I were to see some jibberish about a query and line
>> numbers when I click a link I'd leave that site.  (And for the
>> archives) It is a security vuln to show full file paths to an end
>> user.  If someone is tampering with your system we shouldn't give them
>> any more information than they can already get.
>
> It can certainly help you for debugging, but I agree, it's not for
> production.
>
> tedd

I register an error handler & a shutdown function on new features so
that I can get error reports via email.  I hate trying to sift thru
logs and junk so I really need it in my face.  Of course this is a
performance hit as it actually has to send emails and parse errors,
but after I haven't got any mails in a while I turn it off.

--- End Message ---
--- Begin Message ---
At 2:18 PM -0400 7/16/08, Eric Butera wrote:
On Wed, Jul 16, 2008 at 1:53 PM, tedd <[EMAIL PROTECTED]> wrote:
 At 9:15 AM -0400 7/16/08, Eric Butera wrote:

 As an aside, if I were to see some jibberish about a query and line
 numbers when I click a link I'd leave that site.  (And for the
 archives) It is a security vuln to show full file paths to an end
 user.  If someone is tampering with your system we shouldn't give them
 any more information than they can already get.

 It can certainly help you for debugging, but I agree, it's not for
 production.

 tedd

I register an error handler & a shutdown function on new features so
that I can get error reports via email.  I hate trying to sift thru
logs and junk so I really need it in my face.  Of course this is a
performance hit as it actually has to send emails and parse errors,
but after I haven't got any mails in a while I turn it off.

I don't really know how others debug, I work alone. But, I do all my stuff online and use the following function:

function report($query, $line, $file)
        {
echo($query . '<br>' .$line . '<br/>' . $file . '<br/>' . mysql_error());
        }

That gives me immediate notice of where the error occurred and what the error was. When I take my code to production, I simply comment out the echo().

I used to use a global to do that (show/not show errors), but consider all my error stuff in is one file, it's easy enough to comment out what I don't want to show.

Cheers,

tedd


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

--- End Message ---
--- Begin Message ---
On 16/07/2008, Robbert van Andel <[EMAIL PROTECTED]> wrote:
>
> I am having trouble getting a file to download to work in Internet
> Explorer.
> The site works fine in FireFox.   The page retrieves the contents of a file
> from a database and outputs the following
>
>
>
> <?PHP
>
>
>
> header("Content-type: application/octet-stream");
>
> header("Content-Disposition: attachment;
> filename=\"{$data['filename']}\"");
>
> header("Content-Description: PHP Generated Data");
>
> echo $data['file'];
>
>
>
> ?>
>
>
>
> Where $data['filename'] is the name of the file as stored in the database
> and $data['file'] is the contents of the file.  The script used to download
> the file is called view.php.  As I mentioned, this works great in FireFox
> but with Internet Explorer, I get the following error:
>
>
>
> Internet Explorer cannot download view.php from www.yourdomain.com.
>
>
>
> Internet Explorer was not able to open this Internet site. The requested
> site is either unavailable or cannot be found. Please try again later.
>
>
>
> Any help would be greatly appreciated.
>
>
>
> Robbert
>
>
Start here:
http://www.google.co.uk/search?source=ig&hl=en&rlz=&q=php+download+file+internet+explorer+headers&meta
=

--- End Message ---
--- Begin Message ---
Thanks, that did the trick.  I'd done a google search before but didn't come
up with any answers but hadn't added headers to the search phrase.

 

In case anyone is interested in the solution, my script included
session_start and I found that by adding session_cache_limiter("none")
before session_start resolved the problem
(http://bytes.com/forum/thread554529.html) 

 

Robbert

 

From: Tom Chubb [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 16, 2008 1:41 AM
To: Robbert van Andel
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Downloading a file

 

On 16/07/2008, Robbert van Andel <[EMAIL PROTECTED]> wrote: 

I am having trouble getting a file to download to work in Internet Explorer.
The site works fine in FireFox.   The page retrieves the contents of a file
from a database and outputs the following



<?PHP



header("Content-type: application/octet-stream");

header("Content-Disposition: attachment; filename=\"{$data['filename']}\"");

header("Content-Description: PHP Generated Data");

echo $data['file'];



?>



Where $data['filename'] is the name of the file as stored in the database
and $data['file'] is the contents of the file.  The script used to download
the file is called view.php.  As I mentioned, this works great in FireFox
but with Internet Explorer, I get the following error:



Internet Explorer cannot download view.php from www.yourdomain.com.



Internet Explorer was not able to open this Internet site. The requested
site is either unavailable or cannot be found. Please try again later.



Any help would be greatly appreciated.



Robbert


Start here:

http://www.google.co.uk/search?source=ig
<http://www.google.co.uk/search?source=ig&hl=en&rlz=&q=php+download+file+int
ernet+explorer+headers&meta>
&hl=en&rlz=&q=php+download+file+internet+explorer+headers&meta=


--- End Message ---
--- Begin Message ---
                                                        
                КЛАССИЧЕСКИЕ ПАВИЛЬОНЫ-БЕСЕДКИ
                
с уникальным встроенным грилем для дачи, сада, кафе,            ресторана       
                                        &nbsp;  
                                        
                Festivo 8-K                             
Kota            8-K                             
                скандинавское
                качество
                *
                оригинальность
                конструкции
                *
                скорость
                сборки
                                8(495) 504-83-85 
                8(812)313-59-10(11)
                8(495)410-87-34
                                                e-mail:                 [EMAIL 
PROTECTED]       
                                                                                
                
                                                

[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
[snip] By visiting php.info in a web browser I have confirmed the
location of my php.ini file as /usr/local/php5/lib/php.ini. I open that
file and 
edit the line:

; - display_errors = Off

and change it to

display_errors = On

I then retstart Appache and visit php.info which still reports 
display_errors = Off. What else can I do?
[/snip]

Make sure that you do not have more than one php.ini

--- End Message ---
--- Begin Message ---
On Tue, Jul 15, 2008 at 3:53 PM, Manuel Vacelet
<[EMAIL PROTECTED]> wrote:
> Hello all,
>
> How can I make my php apps aware of byte range HTTP request ?
>
> I have a script that output data to user if she's granted to do so.
> But as of today, if download fails, she must restart the download from
> the beginning because my server (my php script) doesn't support "range
> byte requests" (actually, this is what curl and wget claims!)

FYI, I found what I was looking for in PEAR HTTP Download package:
http://pear.php.net/package/HTTP_Download

-- Manuel

--- End Message ---
--- Begin Message ---
No apologies necessary, good luck!

 Cheers!
R




----- Original Message ----
From: Denis L. Menezes <[EMAIL PROTECTED]>
To: Ryan S <[EMAIL PROTECTED]>; Wolf <[EMAIL PROTECTED]>
Cc: PHP General <[EMAIL PROTECTED]>
Sent: Monday, July 14, 2008 3:31:43 PM
Subject: Re: [PHP] Freelance PHP development in India

Dear Ryan, Wolf.

Apologies for asking from India only. No offence meant.

It is because I am from India and I can personally meet and discuss with the 
programmers. Cost is also an issue. Mine is a startup and the finances are 
low. :-(

Apologies.
Denis


----- Original Message ----- 
From: "Ryan S" <[EMAIL PROTECTED]>
To: "Wolf" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Cc: "PHP General" <[EMAIL PROTECTED]>
Sent: Monday, July 14, 2008 8:34 PM
Subject: Re: [PHP] Freelance PHP development in India


>
>
>
>
> <snip>
>> Dear friends.
>>
>> I am looking for freelance web developers in India.
>>
>> Can contact me?
>>
>
> Why just in India?  There are a number of us available via the world.
>
> Wolf
> </snip>
>
> I'm guessing because he wants a REAL cheap solution...
> what you (probably) charge for 5-7hrs work would probably be the same that 
> someone in india charges for a day or two or the whole project.
>
> HTH
>
> Cheers!
> R
>
>
>
>
>
> -- 
> 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


      

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

on 07/14/2008 01:20 AM Denis L. Menezes said the following:
Dear friends.

I am looking for freelance web developers in India.

Can contact me?

As Thiago mentioned, there is a directory of PHP professionals available for taking PHP jobs that is sorted by country. Here you may find many developers from India:

http://www.phpclasses.org/professionals/country/in/

If you want to post a job of interest to these developers, you may do it here:

http://www.phpclasses.org/post_job.html

--

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/

--- End Message ---
--- Begin Message ---
Jochem Maas wrote:
Robert Cummings schreef:
On Tue, 2008-07-15 at 12:37 -0400, tedd wrote:
At 12:31 PM -0400 7/15/08, Robert Cummings wrote:
Umm... here it is to unlimited precision: ¼

Cheers,
Rob.
Yeah and here's ƒ

Like or not, that's all there is to it.

Weird... you're client bastar-dized my beautiful pi symbol.

no it's the worst round error ever. how exactly do you go
from 3.1 to .25 :-P

Easy, subtract 2.85

-Shawn



Cheers,
Rob.


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

On Jul 16, 2008, at 11:39 AM, Shawn McKenzie wrote:

Jochem Maas wrote:
Robert Cummings schreef:
On Tue, 2008-07-15 at 12:37 -0400, tedd wrote:
At 12:31 PM -0400 7/15/08, Robert Cummings wrote:
Umm... here it is to unlimited precision: ¼

Cheers,
Rob.
Yeah and here's ƒ

Like or not, that's all there is to it.

Weird... you're client bastar-dized my beautiful pi symbol.
no it's the worst round error ever. how exactly do you go
from 3.1 to .25 :-P

Easy, subtract 2.85

And then put it in Jay's pocket since we know he's skimming! If you're lucky maybe he'll cut you in for not telling the boss :P


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





--- End Message ---
--- Begin Message ---
[snip]
And then put it in Jay's pocket since we know he's skimming! If you're  
lucky maybe he'll cut you in for not telling the boss :P
[/snip]

"Allegedly". 

--- End Message ---
--- Begin Message ---
On Tue, Jul 15, 2008 at 3:50 PM, tedd <[EMAIL PROTECTED]> wrote:
>
> Well, someone's client took infinity and turned it into an integral.
>
> tdd

    Yeah, but they stole your 'e' to make up for it.

-- 
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

--- End Message ---
--- Begin Message ---
i want to implement a feature where a user searches with a keyword and
search results are displayed according to the keyword

or phrase entered by the user.

following are the steps i want to follow. please advice if i am missing out
any steps or i can add any step.

1. read the keyword entered by user using $search = $_POST["searchkeyword"];

2. read all the files from the root directory into a variable (as all files
will be saved in the root directory)

3. from step 2 filter and read only files with html and php extensions into
a variable

4. read the entire contents of all html and php files into a variable

5. compare $search with all the individual html and php file contents from
step 4

6. if a match is found with either html or php file then display a brief
title and brief description which will be a link to

the actual file which has the keyword.

7. display search results in a serial order as 1. Brief Title of the page 2.
Brief Title of the page ...

8. at the bottom of the page based on the total number of results found from
step 6 i would like to provide a link to page 1
page 2 page3 ... (i can decide to display only 10 results per page)

please advice.

any help will be greatly appreciated.

thanks.

--- End Message ---
--- Begin Message ---
On Wed, 2008-07-16 at 22:50 +0530, Sudhakar wrote:
> i want to implement a feature where a user searches with a keyword and
> search results are displayed according to the keyword
> 
> or phrase entered by the user.
> 
> following are the steps i want to follow. please advice if i am missing out
> any steps or i can add any step.
> 
> 1. read the keyword entered by user using $search = $_POST["searchkeyword"];
> 
> 2. read all the files from the root directory into a variable (as all files
> will be saved in the root directory)
> 
> 3. from step 2 filter and read only files with html and php extensions into
> a variable
> 
> 4. read the entire contents of all html and php files into a variable
> 
> 5. compare $search with all the individual html and php file contents from
> step 4
> 
> 6. if a match is found with either html or php file then display a brief
> title and brief description which will be a link to
> 
> the actual file which has the keyword.
> 
> 7. display search results in a serial order as 1. Brief Title of the page 2.
> Brief Title of the page ...
> 
> 8. at the bottom of the page based on the total number of results found from
> step 6 i would like to provide a link to page 1
> page 2 page3 ... (i can decide to display only 10 results per page)

Either use something like htdig or Lucene or run a cron that crawls your
files as you indicate above and caches the content to a MySQL (or other
db server) FULLTEXT column. Then query/search accordingly. You can feel
free to re-invent this particular wheel... but you'll probably spend a
lot of time doing it wrong.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
At 10:50 PM +0530 7/16/08, Sudhakar wrote:
i want to implement a feature where a user searches with a keyword and
search results are displayed according to the keyword

-snip-

It sounds like you want a search for a site -- if so, see this:

http://sperling.com/examples/search/

It's a lot less work.

Cheers,

tedd

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

--- End Message ---
--- Begin Message ---
On Wed, Jul 16, 2008 at 1:20 PM, Sudhakar <[EMAIL PROTECTED]> wrote:
> i want to implement a feature where a user searches with a keyword and
> search results are displayed according to the keyword
>
> or phrase entered by the user.
>
> following are the steps i want to follow. please advice if i am missing out
> any steps or i can add any step.
>
> 1. read the keyword entered by user using $search = $_POST["searchkeyword"];
>
> 2. read all the files from the root directory into a variable (as all files
> will be saved in the root directory)
>
> 3. from step 2 filter and read only files with html and php extensions into
> a variable
>
> 4. read the entire contents of all html and php files into a variable
>
> 5. compare $search with all the individual html and php file contents from
> step 4
>
> 6. if a match is found with either html or php file then display a brief
> title and brief description which will be a link to
>
> the actual file which has the keyword.
>
> 7. display search results in a serial order as 1. Brief Title of the page 2.
> Brief Title of the page ...
>
> 8. at the bottom of the page based on the total number of results found from
> step 6 i would like to provide a link to page 1
> page 2 page3 ... (i can decide to display only 10 results per page)
>
> please advice.
>
> any help will be greatly appreciated.
>
> thanks.
>

Zend Search Lucene is pretty nice.

http://framework.zend.com/manual/en/zend.search.lucene.html

--- End Message ---
--- Begin Message ---
Hi,

  I am running into a problem here with handling the files. My client wants me 
to copy all the files to one server over to another server. Currently, I use a 
very slow way that has to handle my code by writing in and out files manually 
as in the following:

$lines3 = file("http://192.168.10.63/test/B1Depth-$id.dat";);
$file3="http://192.168.10.63/test/B1Depth-$id.dat";;
$count3= count($lines3);
$ourFileName3 = "C:/Inetpub/wwwroot/test/B1Depth-$beam_id.dat";
$ourFileHandle3 = fopen($ourFileName3, 'wb') or die("can't open file");
$newFileHandle3 = fopen($ourFileName3, 'a') or die("can't open file");

for ($i = 0; $i<=1; $i++) {

rtrim($lines3[$i]);
echo $lines3[$i] . "<br>";
$content= fwrite($ourFileHandle3, $lines3[$i]);
}

fclose($ourFileHandle3);

for ($i = 2; $i <=$count3; $i++) {

rtrim($lines3[$i]);
echo $lines3[$i] . "<br>";
$content= fwrite($newFileHandle3, $lines3[$i]);
}

fclose($newFileHandle3);

Is there some way that I can do something like a cp and copy it over? Or, how 
should I go about doing this without going through this manually, since I won't 
be able to know how many files that would be needed to be copied?

I would welcome any suggestions on this.

Alice
======================================================
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
On Tue, Jul 15, 2008 at 5:43 PM, Stut <[EMAIL PROTECTED]> wrote:
>
> Code please, we're not mind readers!

    I sensed you would say that, Stuart.  ;-P

-- 
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

--- End Message ---

Reply via email to