OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
[suspicious - maybe spam] php-general Digest 7 Mar 2005 16:33:58 -0000 Issue 3324

php-general-digest-helplists.php.net
Date: Mon Mar 07 2005 - 10:33:58 CST


php-general Digest 7 Mar 2005 16:33:58 -0000 Issue 3324

Topics (messages 210136 through 210171):

Re: Document root, preferred way to find it???
        210136 by: Tom Rogers

[suspicious - maybe spam] Re: Help with dates
        210137 by: Mattias Thorslund

mac os x - not getting headers already sent error
        210138 by: Jonathan Haddad
        210141 by: Burhan Khalid

SOLVED: Re: [PHP] Document root, preferred way to find it???
        210139 by: Leif Gregory
        210140 by: Tom Rogers
        210159 by: Leif Gregory

pspell replace
        210142 by: Noodles
        210144 by: Noodles

Re: Download with header() - file corrupted
        210143 by: Werner Jäger

testing
        210145 by: Greg

Re: Inline Frame and php
        210146 by: Greg

Timeouts during large uploads, very slow queries etc
        210147 by: zzapper
        210157 by: Chris Rose
        210165 by: zzapper

Shoutbox without sql dbase
        210148 by: Greg

Re: Semi-OT: Anti-password trading/sharing solutions
        210149 by: Greg

[ignore] testing connection
        210150 by: Greg

FTP functions
        210151 by: Vaibhav Sibal

A more ecconomical way with control statements??
        210152 by: Ross Hulford
        210154 by: Stanislav Kuhn

fsockopen and session_start
        210153 by: Pedro Garre

Pear DB class not PHP5 strict compatible?
        210155 by: Richard Davey
        210156 by: M. Sokolewicz

Re: Pop-up message
        210158 by: Greg

A general question
        210160 by: Vaibhav Sibal
        210162 by: Kim Madsen

Problem with Tabs and Newlines
        210161 by: Phusion
        210163 by: Jay Blanchard
        210164 by: trlists.clayst.com

Randomize an array?
        210166 by: Brian Dunning
        210167 by: M. Sokolewicz
        210168 by: Brian Dunning
        210169 by: Jay Blanchard

Re: Weird WMV/Media Player behaviour (Loading media file twice)
        210170 by: Jared Williams

Re: Improving a MySQL Search
        210171 by: James Nunnerley

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Hi,

Monday, March 7, 2005, 1:08:27 PM, you wrote:
LG> Hello Tom,

LG> Sunday, March 6, 2005, 6:18:54 PM, you wrote:
TR>> and let me see what it prints

LG> Still not quite there.

LG> Site root
LG> **************
LG> File name: C:\Sambar\docs\test\test.php
LG> Script: /test.php
LG> Document root: C:\Sambar\docs\test\test.php
LG> Base: test.php
LG> Include: C:\Sambar\docs\test\include
LG> OS: winnt
LG> Include: C:\Sambar\docs\test\include;.;C:\php5\pear

LG> **************

LG> Site root/folder1
LG> ***************
LG> File name: C:\Sambar\docs\test\folder1\test.php
LG> Script: /folder1/test.php
LG> Document root: C:\Sambar\docs\test\folder1\test.php
LG> Base: test.php
LG> Include: C:\Sambar\docs\test\folder1\include
LG> OS: winnt
LG> Include: C:\Sambar\docs\test\folder1\include;.;C:\php5\pear

LG> ***************

LG> Site root/folder1/folder2
LG> ***************
LG> File name: C:\Sambar\docs\test\folder1\folder2\test.php
LG> Script: /folder1/folder2/test.php
LG> Document root: C:\Sambar\docs\test\folder1\folder2\test.php
LG> Base: test.php
LG> Include: C:\Sambar\docs\test\folder1\folder2\include
LG> OS: winnt
LG> Include:
LG> C:\Sambar\docs\test\folder1\folder2\include;.;C:\php5\pear

LG> ***************

LG> Thanks.

LG> Cheers,
LG> Leif Gregory

LG> --
LG> TB Lists Moderator (and fellow registered end-user)
LG> PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F
LG> Web Site <http://www.PCWize.com>

Ok I see where is is going wrong, try this:

<?php
if(isset($_SERVER["SCRIPT_FILENAME"])){
        $file_name = str_replace('\\','/',$_SERVER['SCRIPT_FILENAME']);
        echo "File name: $file_name<br>";
        
        $script = str_replace('\\','/',$_SERVER['SCRIPT_NAME']);
        echo "Script: $script<br>";
        
        $document_root = str_replace($script,'',$file_name);
        echo "Document root: $document_root<br>";
        
        $base = basename($document_root);
        echo "Base: $base<br>";
        
        $include = str_replace($base,'include',$document_root);
        echo "Include: $include<br>";
        
        $os = strtolower(PHP_OS);
        echo "OS: $os<br>";

        $lk = ':';
        $org_include = ini_get("include_path");
        if(preg_match('/^win/i',$os)) $lk = ';';
        
        ini_set("include_path",$include.$lk.$org_include);
        echo "Include: ".ini_get("include_path")."<br>";
}

--
regards,
Tom

attached mail follows:


Check out:
http://pear.php.net/package/Date

According to the description, it lets you compare dates that date pre
1970 and post 2038.

/Mattias

(If I could only get off ezmlm's "suspicious user list". I think there
isn't much I can do, it's my ISP rejecting some PHP list postings.)

Kevin wrote:

>Greetings Mr Mattias,
>
>I wish it was so simple. Because the dates that may need calculating can be
>before 1970.
>
>THis function I have.. and it's semi-working, but I've noticed
>irregularities during the conversion.
>
>Thanks for your suggestion!!
>
>Yours,
>
>Kevin
>"Mattias Thorslund" <mattiasinreach.com> wrote in message
>news:422BCBDA.1090309inreach.com...
>
>
>>M. Sokolewicz wrote:
>>
>>
>>
>>>well, you can simply use the unix timestamp, since the amount of days
>>>/ seconds since 0 AD/BC will be a constant (it won't change, trust
>>>me), you can simply add it to that, and add a wrapper function to
>>>php's time(). You'll be working with VERY big numbers in that case, so
>>>you can also do it the other way around; store the amount of DAYS
>>>since 0 AD/BC till Jan 1st 1970, add time()/86400, and you'll have the
>>>amount of days since 0 AD/BC in an integer (or float, depending on how
>>>many days that really are).
>>>
>>>You'll just need to find that constant somewhere :)
>>>
>>>
>>>
>>Can't be too hard to calculate it:
>>
>>1970 * 365 + 1 day for each leap year. Note the rules for leap year, of
>>course.
>>
>>/Mattias
>>
>>--
>>More views at http://www.thorslund.us
>>
>>
>
>
>

--
More views at http://www.thorslund.us

attached mail follows:


I do all my development on mac os x. sometimes, to debut a script, i
output the query to the page. quite often the page sends headers to go
to another page. When i do this, i comment out the header() function
and read the results. When i'm done i remove the comment

Sometimes I've forgotten to take out the debugging output. Now, on my
server here, the page redirects and loads fine. But in the live
environment, it craps out and people are left staring at a blank page.

The test server is the same computer i'm developing on.

Anyone know why this happens, and how i can fix it?

Jon Haddad

attached mail follows:


Jonathan Haddad wrote:
> I do all my development on mac os x. sometimes, to debut a script, i
> output the query to the page. quite often the page sends headers to go
> to another page. When i do this, i comment out the header() function
> and read the results. When i'm done i remove the comment
>
> Sometimes I've forgotten to take out the debugging output. Now, on my
> server here, the page redirects and loads fine. But in the live
> environment, it craps out and people are left staring at a blank page.

This means that on the live server, error_reporting is at such a level
that the Warning that is generated by php -- the "Cannot modify header
information output started at ...." line isn't displayed, and since
there is output to the client, the header() call fails, which is why you
are left with a white screen.

You can use output buffering to avoid such a problem; there is also the
header_sent() function.

HTH

attached mail follows:


Hello Tom,

Sunday, March 6, 2005, 10:00:17 PM, you wrote:
TR> Ok I see where is is going wrong, try this:

Oooooh, very close. Although you have it at $document_root and all
that needs to be added is '/include' like below:

$include = $document_root . '/include';

Otherwise it's one directory too far up because you're replacing the
site root 'test' (in this case) with 'include'.

We wanted: 'C:/Sambar/docs/test/include'

Here's from your script.

Site root:
**********

File name: C:/Sambar/docs/test/test.php
Script: /test.php
Document root: C:/Sambar/docs/test
Base: test
Include: C:/Sambar/docs/include
OS: winnt
Include: C:/Sambar/docs/include;.;C:\php5\pear

**********

Site root/folder1
**********

File name: C:/Sambar/docs/test/folder1/test.php
Script: /folder1/test.php
Document root: C:/Sambar/docs/test
Base: test
Include: C:/Sambar/docs/include
OS: winnt
Include: C:/Sambar/docs/include;.;C:\php5\pear

**********

Site root/folder1/folder2
**********

File name: C:/Sambar/docs/test/folder1/folder2/test.php
Script: /folder1/folder2/test.php
Document root: C:/Sambar/docs/test
Base: test
Include: C:/Sambar/docs/include
OS: winnt
Include: C:/Sambar/docs/include;.;C:\php5\pear

**********

After my change:

File name: C:/Sambar/docs/test/folder1/folder2/test.php
Script: /folder1/folder2/test.php
Document root: C:/Sambar/docs/test
Base: test
Include: C:/Sambar/docs/test/include
OS: winnt
Include: C:/Sambar/docs/test/include;.;C:\php5\pear

The other two folders moving back up the tree are the same result.

So the final looks like:
************************

if(isset($_SERVER["SCRIPT_FILENAME"])){
        $file_name = str_replace('\\','/',$_SERVER['SCRIPT_FILENAME']);
        echo "File name: $file_name<br>";
        
        $script = str_replace('\\','/',$_SERVER['SCRIPT_NAME']);
        echo "Script: $script<br>";
        
        $document_root = str_replace($script,'',$file_name);
        echo "Document root: $document_root<br>";
        
        $base = basename($document_root);
        echo "Base: $base<br>";
        
        //$include = str_replace($base,'include',$document_root);
        $include = $document_root . '/include';
        echo "Include: $include<br>";
        
        $os = strtolower(PHP_OS);
        echo "OS: $os<br>";

        $lk = ':';
        $org_include = ini_get("include_path");
        if(preg_match('/^win/i',$os)) $lk = ';';
        
        ini_set("include_path",$include.$lk.$org_include);
        echo "Include: ".ini_get("include_path")."<br>";
}

************************

It's a great effort and looks bulletproof. Can you shoot any holes in
mine? A full explanation at:
http://www.devtek.org/tutorials/dynamic_document_root.php

I only throw mine back out there because it's shorter. I think it's
solid, but only because I haven't broken it yet. :-)

Both our solutions suffer the same problem. They have to be on every
page that requires an include, because we can't rely on a new host
having our code in their auto_prepend file

**********

function dynRoot()
{
  $levels = substr_count($_SERVER['PHP_SELF'],"/");

  for ($i=0; $i < $levels - 1; $i++)
  {
    $relativeDir .= "../";
  }

  return $relativeDir;
}

include(dynRoot() . 'includes/somefile.php')

**********

Thanks again!

Cheers,
Leif Gregory

--
TB Lists Moderator (and fellow registered end-user)
PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F
Web Site <http://www.PCWize.com>

attached mail follows:


Hi,

Monday, March 7, 2005, 3:57:50 PM, you wrote:
LG> Hello Tom,

LG> Sunday, March 6, 2005, 10:00:17 PM, you wrote:
TR>> Ok I see where is is going wrong, try this:

LG> Oooooh, very close. Although you have it at $document_root and all
LG> that needs to be added is '/include' like below:

LG> $include = $document_root . '/include';

LG> Otherwise it's one directory too far up because you're replacing the
LG> site root 'test' (in this case) with 'include'.

LG> We wanted: 'C:/Sambar/docs/test/include'

LG> Here's from your script.

LG> Site root:
LG> **********

LG> File name: C:/Sambar/docs/test/test.php
LG> Script: /test.php
LG> Document root: C:/Sambar/docs/test
LG> Base: test
LG> Include: C:/Sambar/docs/include
LG> OS: winnt
LG> Include: C:/Sambar/docs/include;.;C:\php5\pear

LG> **********

LG> Site root/folder1
LG> **********

LG> File name: C:/Sambar/docs/test/folder1/test.php
LG> Script: /folder1/test.php
LG> Document root: C:/Sambar/docs/test
LG> Base: test
LG> Include: C:/Sambar/docs/include
LG> OS: winnt
LG> Include: C:/Sambar/docs/include;.;C:\php5\pear

LG> **********

LG> Site root/folder1/folder2
LG> **********

LG> File name: C:/Sambar/docs/test/folder1/folder2/test.php
LG> Script: /folder1/folder2/test.php
LG> Document root: C:/Sambar/docs/test
LG> Base: test
LG> Include: C:/Sambar/docs/include
LG> OS: winnt
LG> Include: C:/Sambar/docs/include;.;C:\php5\pear

LG> **********

LG> After my change:

LG> File name: C:/Sambar/docs/test/folder1/folder2/test.php
LG> Script: /folder1/folder2/test.php
LG> Document root: C:/Sambar/docs/test
LG> Base: test
LG> Include: C:/Sambar/docs/test/include
LG> OS: winnt
LG> Include: C:/Sambar/docs/test/include;.;C:\php5\pear

LG> The other two folders moving back up the tree are the same result.

LG> So the final looks like:
LG> ************************

LG> if(isset($_SERVER["SCRIPT_FILENAME"])){
LG> $file_name =
LG> str_replace('\\','/',$_SERVER['SCRIPT_FILENAME']);
LG> echo "File name: $file_name<br>";
        
LG> $script = str_replace('\\','/',$_SERVER['SCRIPT_NAME']);
LG> echo "Script: $script<br>";
        
LG> $document_root = str_replace($script,'',$file_name);
LG> echo "Document root: $document_root<br>";
        
LG> $base = basename($document_root);
LG> echo "Base: $base<br>";
        
LG> //$include = str_replace($base,'include',$document_root);
LG> $include = $document_root . '/include';
LG> echo "Include: $include<br>";
        
LG> $os = strtolower(PHP_OS);
LG> echo "OS: $os<br>";

LG> $lk = ':';
LG> $org_include = ini_get("include_path");
LG> if(preg_match('/^win/i',$os)) $lk = ';';
        
LG> ini_set("include_path",$include.$lk.$org_include);
LG> echo "Include: ".ini_get("include_path")."<br>";
LG> }

LG> ************************

LG> It's a great effort and looks bulletproof. Can you shoot any holes in
LG> mine? A full explanation at:
LG> http://www.devtek.org/tutorials/dynamic_document_root.php

LG> I only throw mine back out there because it's shorter. I think it's
LG> solid, but only because I haven't broken it yet. :-)

LG> Both our solutions suffer the same problem. They have to be on every
LG> page that requires an include, because we can't rely on a new host
LG> having our code in their auto_prepend file

LG> **********

LG> function dynRoot()
LG> {
LG> $levels = substr_count($_SERVER['PHP_SELF'],"/");

LG> for ($i=0; $i < $levels - 1; $i++)
LG> {
LG> $relativeDir .= "../";
LG> }

LG> return $relativeDir;
LG> }

LG> include(dynRoot() . 'includes/somefile.php')

LG> **********

LG> Thanks again!

LG> Cheers,
LG> Leif Gregory

LG> --
LG> TB Lists Moderator (and fellow registered end-user)
LG> PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F
LG> Web Site <http://www.PCWize.com>

I do this for security as I have things in include that I don't want
to be avaiable directly to the browser Also you don't need a path for include
files you can just do:

include('somefile.php');

and it will be found regardless of where the script is located.

--
regards,
Tom

attached mail follows:


Hello Tom,

Sunday, March 6, 2005, 11:20:04 PM, you wrote:
T> I do this for security as I have things in include that I don't
T> want to be avaiable directly to the browser Also you don't need a
T> path for include files you can just do:

Don't necessarily disagree with you there other than if you place the
includes outside the web accessible folders how do you address the
managers of virtual hosts for the ability to modify, delete or add to
their particular include file? Additionally, how do you address
the naming convention of the include file.

i.e.
Site 'A' is using config.php
Site 'B' is using config.inc.php
Site 'C' wants to use config.php

T> include('somefile.php');
T> and it will be found regardless of where the script is located.

That's true enough..

BTW, good to see another TheBat! user here.

Thanks again.

--
Leif (TB lists moderator and fellow end user).

Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB

attached mail follows:


Hi,

After much messing around I've got a custom dictionary working properly,
but I can't seem to find the format for a custom replace file
(custom.repl in examples on php.net).

Can anyone point me in the right direction or give me an example file?

Thanks
Nick

P.S.
In case anyone is wondering the format for a custom dictionary is:

personal_ws-1.1 en 5024
myword
myotherword
...

en being the language you're writing a custom dictionary for and 5024
being the number of words in the dictionary

attached mail follows:


Nevermind I found it myself

Format should be:

personal_repl-1.1 en 0
misspelling replacement

Noodles wrote:
> Hi,
>
> After much messing around I've got a custom dictionary working properly,
> but I can't seem to find the format for a custom replace file
> (custom.repl in examples on php.net).
>
> Can anyone point me in the right direction or give me an example file?
>
> Thanks
> Nick
>
> P.S.
> In case anyone is wondering the format for a custom dictionary is:
>
> personal_ws-1.1 en 5024
> myword
> myotherword
> ...
>
> en being the language you're writing a custom dictionary for and 5024
> being the number of words in the dictionary

attached mail follows:


I solved the problem with inserting this line at the beginning:
ob_end_clean();

all works fine..

I am using php 4 with IIS6 / WinServer 2003

thanks

Werner Jäger wrote:
> I try to download a file wit follow code:
>
> $len = filesize($file);
> $filename = basename($file);
> header("Pragma: public");
> header("Expires: 0");
> header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
> header("Cache-Control: public");
> header("Content-Description: File Transfer");
> header("Content-Type: $ctype");
> $header="Content-Disposition: attachment; filename=".$filename.";";
> header($header );
> header("Content-Transfer-Encoding: binary");
> header("Content-Length: ".$len);
> readfile($file);
> exit;
>
>
> All works pretty well, the filename is correct, the Content Type and the
> file size.
> When I try to open the downloaded file I see nothing.
> The source file on the web server works great.
>
> I played with Content-Transfer-Encoding and tried all values from the RFC
>
> Any ideas?
>
> thank you

attached mail follows:


Just testing guys :)

attached mail follows:


Hi,
Would I be right in assuming that the top frame has the search button but
when searching, the results appear on a new window? or the "main" window?

Greg

"Todd Cary" <toddaristesoftware.com> wrote in message
news:4223B7A4.1080402aristesoftware.com...
> My client insists on using inline Frames that uses my php pages. As an
> example, this is on one page:
>
> <IFRAME target="_top" frameborder="0"
> SRC="search.php?search_text=<?echo($search_text);?>" WIDTH=592 HEIGHT=282>
> </IFRAME>
>
> This works well with the "control" being given to search.php. What I do
> not understand is that within search.php, I have a statement that is
> suppose to pass "control" to anther page. The line is
>
> header("location: http://192.168.0.23/mypath/mypage.php");
>
> Rather than going to the page, it opens mypage.php in the inline frame.
>
> Is there a way to "leave" the inline frame?
>
> [Excuse my nomenclature e.g. "control", "leave"]
>
> Todd

attached mail follows:


>I am running a simple Upload script in PHP using a HTML Form with a File field. The user can browse their computer and upload a file. It works great, except for large files, where the browser will timeout. The timeout appears to happen after about 5 minutes. Any ideas on how to get around this?
>
I dont think this is just a PHP problem.
I 've had it with 2 other scripting languages.

AFAIK the client browser timesout rather than the upload application. ie the client's browser thinks
nothings going on and timesout.

I did read of a nasty fix, where you have a simple frameset where the app is in the main Frame and
there's a tiny "invisible" frame where a piece of javaScript periodically refreshes or write's a
character to the frame to fool your browser.

Has ANYONE got any experience/views on this

zzapper (vim, cygwin, wiki & zsh)
--

vim -c ":%s%s*%CyrnfrTfcbafbeROenzSZbbyranne%|:%s)[R-T]) )Ig|:norm G1VGg?"

http://www.vim.org/tips/tip.php?tip_id=305 Best of Vim Tips

attached mail follows:


> >I am running a simple Upload script in PHP using a HTML Form with a
File
> field. The user can browse their computer and upload a file. It
works
> great, except for large files, where the browser will timeout. The
> timeout appears to happen after about 5 minutes. Any ideas on how to
get
> around this?
> >
> I dont think this is just a PHP problem.
> I 've had it with 2 other scripting languages.
>
> AFAIK the client browser timesout rather than the upload application.
ie
> the client's browser thinks
> nothings going on and timesout.
>
> I did read of a nasty fix, where you have a simple frameset where the
app
> is in the main Frame and
> there's a tiny "invisible" frame where a piece of javaScript
periodically
> refreshes or write's a
> character to the frame to fool your browser.
>
> Has ANYONE got any experience/views on this
>
> zzapper (vim, cygwin, wiki & zsh)

http://sourceforge.net/projects/megaupload/

Maybe this will help? I've been looking for a PHP replacement of
something as graceful as ASPUpload and this is the closest I can find.

Thanks.
 
Kind Regards,
Chris Rose

attached mail follows:


On Mon, 7 Mar 2005 13:54:07 -0000, wrote:

>>
>> zzapper (vim, cygwin, wiki & zsh)
>
>http://sourceforge.net/projects/megaupload/
>
>Maybe this will help? I've been looking for a PHP replacement of
>something as graceful as ASPUpload and this is the closest I can find.
>
Chris,
Supercool, but I would also be interested in other solutions. May be I can also use the progress
meter part for sending bulk emails

zzapper (vim, cygwin, wiki & zsh)
--

vim -c ":%s%s*%CyrnfrTfcbafbeROenzSZbbyranne%|:%s)[R-T]) )Ig|:norm G1VGg?"

http://www.vim.org/tips/tip.php?tip_id=305 Best of Vim Tips

attached mail follows:


Hi all,
I was wondering if anyone has come across (or even using) a shoutbox that
doesnt require an sql dbase. While it isnt hard to access one id prefer to
write everything to a file (wanting to learn how to write, append etc files)
I tried one but for some reason the script processing turned into some
random java script about symwindow openning etc -has anyone heard of this
or know what it means?

Thanks all

Greg

attached mail follows:


Come here to get help, not abuse
for what its worth:
sql dbase with fields
username pass ip time
if duplicate username/passowrd then check that IPs match and dont do
anything
if IPs <> match then kick both users off / disable username/password

go figure the code out yourself
here is the "idea" which is the most you have got out of anyone

"Dan" <infohostinthebox.net> wrote in message
news:4223BAB2.1050906hostinthebox.net...
> Richard Lynch wrote:
>> Dan Trainor wrote:
>>
>> I'm not quite sure why you chose the PHP community as a recipient --
>> There
>> are quite a few Apache modules out there.
>>
>> And Modules such as mod_auth_mysql and mod_auth_ldap (?) and, really, any
>> old mod_auth_XYZ module would be a closer "match" for what you want, I
>> think.
>>
>> I know absolutely nothing about how ProxyPass, iProtect, and PureMember
>> work, however, so perhaps there is something about them that just screams
>> "use PHP to do this" [I doubt it though]
>>
>> It seems to me, however, that you're still a bit off-target on
>> PHP-General, as your target audience is not those who use PHP, but those
>> who wrote it and maintain it, particularly the Apache Module part of it.
>>
>> I believe, in fact, that the Apache Module part of it boils down to the
>> code Rasmus Lerdorf wrote ages and ages ago, and that mostly Rasmus (I
>> think) has maintained since then.
>>
>> Perhaps with Apache 2, somebody else stepped up to write/maintain that
>> code, and I'm under-informed.
>>
>> Or maybe Rasmus hasn't touched that code in ages, and somebody else is
>> doing it now. Apologies to those individuals who I've slighted by not
>> naming them at this time.
>>
>> At any rate, you're trying to get in contact with a handful of people by
>> sending email to thousands. Bad Idea #1.
>>
>> NOTE: Contacting Rasmus directly and offering him $$$ to do this would
>> maybe not be a Bad Idea. Asking him to do it for free would be really
>> stupid.
>>
>> Next, let's look at your proposal:
>>
>> You want something that Member Sites need, to avoid the theft/sharing of
>> username/passwords.
>>
>> So, in particular, only for-pay Member Sites need this, mostly, as
>> there's
>> not much point in stealing/sharing a username/password if you can just
>> get
>> one for free.
>>
>> So, basically, it's a for-profit motivator that drives this request.
>>
>> Yet nowhere do I see an offer of recompense for the developers who write
>> this software for you. Bad Idea #2.
>>
>> I highly recommend you figure out what it would be worth to you and some
>> of your colleagues/friends to have an OpenSource solution to rival the
>> current proprietary technologies.
>>
>> Take up a collection or form a very loose consortium with some of your
>> colleagues to fund the project.
>>
>> Then write up a specification for what you want done, and make an offer
>> to
>> PAY somebody and fund the resources needed to get the project from its
>> current state (gleam in your eye) to a usable state.
>>
>> You could and probably should still make it OpenSource -- Perhaps with
>> "Funded by: " attributions on all source code and materials to plug your
>> consortium and its members -- and then when it's at the stage of
>> usefulness that you need, you will probably find that some people are
>> willing to maintain it for little or no money at all.
>>
>> Right now, though, you've got a lot of people seeing:
>>
>> "I want you to work for me for free so I can save thousands of dollars
>> every month"
>>
>> That ain't gonna happen, dude.
>>
>> People wrote PHP and Apache and other OpenSource software because THEY
>> needed it for THEIR own use, and were willing to give it to you for FREE
>> because they knew that giving away 10,000 free copies would get them one
>> (1) more Developer to help build/improve the software.
>>
>> They did *NOT* do it because they wanted you to be able to run your
>> company on free software.
>>
>> Which is not to say that they *MIND* that you can do that -- Only that
>> they're not going to just up and code something just because *YOU* happen
>> to need it to run your company more efficiently.
>>
>> You've got zero incentive for the Developer here -- They don't need the
>> Module you want, and you're not paying them. [shrug]
>>
>
>
> Go ahead and look at my first email. For some reason you didn't get the
> idea that I was looking for solutions. Ideas. I wasn't looking for
> anything solid.
>
> The reason why I wrote to the PHP community was to get some ideas. Aside
> from the two people who have sent me hatemail today, the PHP comunity is
> very intelligent, very clever, and might have worked on something like
> this in the past. That's the information that I was after.
>
> Rasmus? Waht's he got to do with anything? Sure, I value and credit the
> work he's put into PHP, but I really think that using his name in this
> context has no point.
>
> Who asked anyone to write any software for me? Again, let's focus on the
> primary purpose of this email - to gather information so that I can do
> some further investigation.
>
> You know, you're right. It's stupid for me to think that Open Source
> software is used in for-profit situations. PHP, Apache, MySQL, Linux in
> general - it's really stupid to think that they might actually help
> someone make money, isn't it. This is what you are saying, as per "Stupid
> Idea #2".
>
> I'm not going to get into an argue with you over the moral values of Open
> Source software. I understand them fully. Gratitude and in some cases
> money is given to people left and right for their technical abilities by
> myself and others. I will always regret not being ABLE to contribute
> more.
>
> But again, who said anything about actually using a product? Again - try
> to understand the real idea of this email. I'm not being selfish, I'm not
> being an ingrate, I am simply using tools that are freely available to me
> to create something successful. If this involves me not contributing back
> to these people until I start actually making money, then that's how it's
> going to be. It's an unfortunate side-effect to not having money to just
> blow it out my ass.
>
> Thanks for your time
> -dant

attached mail follows:


ignore please, just testing connection :)

attached mail follows:


Hi
I checked ou the ftp functions of PHP, what I wanted to ask was that
if I connect to a remote server and issue and ftp_fget() command the
file will be downloaded to the server running the PHP code and Apache
webserver or the client machine from which we are calling it ? In the
sense for example I have a client machine running on windows XP, I
launch the mozilla firefox browser in that and call for the
ftp_code.php on my server (http://server). The ftp_code.php contains a
code which connects to a remote ftp server and then using the
ftp_fget() function downloads a file from the remote server. Now where
will this file be downloaded ?

Though I have an inkling that since PHP is a server side scripting
language, the file will be downloaded to the server only... But i
still wanted to confirm

Please confirm

Thanks in advance

Vaibhav Sibal

attached mail follows:


if (empty($samosa)){
// do nothing

}

else {

setcookie("cookie[samosa]", "$samosa");

}

if (empty($pakora)){
// do nothing

}

else {

setcookie("cookie[pakora]", "$pakora");

}

It goes on like this for the whole menu I am looking for a more effiecient
way to do this. The inputs are text boxes taking values from 0-9.

Thanks

Ross

attached mail follows:


in the form:
...
<input type=text name=cookie_vars[samosa]>
<input type=text name=cookie_vars[pakora]>
...

in the script
...
foreach($_REQUEST['cookie_vars'] $var_name as $var_val)
  if (!empty($var))
    setcookie("cookie[$var_name]", "$var_val");
...

Stan

-----Original Message-----
From: Ross Hulford [mailto:rossaztechost.com]
Sent: 07 March 2005 12:59
To: php-generallists.php.net
Subject: [PHP] A more ecconomical way with control statements??

if (empty($samosa)){
// do nothing

}

else {

setcookie("cookie[samosa]", "$samosa");

}

if (empty($pakora)){
// do nothing

}

else {

setcookie("cookie[pakora]", "$pakora");

}

It goes on like this for the whole menu I am looking for a more effiecient
way to do this. The inputs are text boxes taking values from 0-9.

Thanks

Ross

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

attached mail follows:


*This message was transferred with a trial version of CommuniGate(tm) Pro*

Hi,

I am using fsockopen to simulate a POST to another page (test_post.php) within
the same server.

Data sent to the socket is:
  "POST $uri HTTP/1.1\r\n".
  "Host: $host\n". "User-Agent: mandapost\r\n".
  "Cookie: ".session_name()."=". session_id()."\r\n".
  "Content-Type: application/x-www-form-urlencoded\r\n".
  "Content-Length: $contentlength\r\n".
  "Connection: close\r\n\r\n".
  "$my_post_variables\r\n";

$_SESSION is used to hold some variables.

test_post.php is:
<?php
session_start();
echo "User".$_SESSION["user"];
...

The problem is that session_start creates a new session instead of using the
session_id indicated in the cookie.

A user comment in the online PHP manual says:
"Just for info, session_start() blocks if another PHP using the same session
is still running in background. It seems it's waiting the other PHP to
finish... and sometimes it can be a problem. Create 2 different sessions by
setting 2 different names : session_name() solve the problem."

The above comment seems correct and PHP hangs until some time-out or something
occurs. The previous session is not started anyway.
I tried to change the name with use session_name, to change the ID with
session_regenerate_id, also some tests with session_id, ...
I also tried to send data to the sockect using PHPSESSID and $_COOKIE instead
of session_name and session_id.

This is my current code:
<?php
$previous_name = session_name("MASIVO");
//sessionid($previous_name);

session_start();
//session_regenerate_id();

echo "##".$previous_name."##".$_COOKIE[$previous_name]."##"; // (1)
echo "User".$_SESSION["user"];

(1) It is correct: ##PHPSESSID##09a169b69eccbf2dd49407c5d4cc84aa##

And this is what the socket returns:
HTTP/1.1 200 OK Date: Mon, 07 Mar 2005 13:43:51 GMT Server: Apache/1.3.28
(Unix) PHP/4.3.3 mod_ssl/2.8.15 OpenSSL/0.9.7c X-Powered-By: PHP/4.3.3
Set-Cookie: MASIVO=79241c1fb5309b6487f689eb30c65caa; path=/ Expires: Thu, 19
Nov 1981 08:52:00 GMT Cache-Control: private, max-age=10800, pre-check=10800
Last-Modified: Mon, 7 Mar 2005 13:38:57 GMT Connection: close
Transfer-Encoding: chunked Content-Type: text/html c7
##PHPSESSID##09a169b69eccbf2dd49407c5d4cc84aa##
Notice: Undefined index: user in ... etzetera

I am running out of ideas. Could anyboy help ?

Thanks,

Pedro.

attached mail follows:


Hi,

   Having heard good things about the PEAR DB package I wanted to try
   it out on a new project. I'm using PHP 5.0.3, ran the go-pear and
   installed the latest version but upon including it in my script it
   brings up rafts of errors such as:

Strict Standards: Assigning the return value of new by reference is deprecated in D:\dev\php-5.0.3\PEAR\DB.php on line 470

   I run PHP with E_ALL | E_STRICT because it's the best way for me to
   catch all errors and keep my code sensible - do the Pear packages
   not also work in this environment or am I just out of luck re: the
   DB package itself?

   It included and worked fine when I switched to PHP 4, but that
   isn't an option for this project.

Best regards,

Richard Davey
--
 http://www.launchcode.co.uk - PHP Development Services
 "I am not young enough to know everything." - Oscar Wilde

attached mail follows:


Richard Davey wrote:
> Hi,
>
> Having heard good things about the PEAR DB package I wanted to try
> it out on a new project. I'm using PHP 5.0.3, ran the go-pear and
> installed the latest version but upon including it in my script it
> brings up rafts of errors such as:
>
> Strict Standards: Assigning the return value of new by reference is deprecated in D:\dev\php-5.0.3\PEAR\DB.php on line 470
>
> I run PHP with E_ALL | E_STRICT because it's the best way for me to
> catch all errors and keep my code sensible - do the Pear packages
> not also work in this environment or am I just out of luck re: the
> DB package itself?
>
> It included and worked fine when I switched to PHP 4, but that
> isn't an option for this project.
>
> Best regards,
>
> Richard Davey
PEAR uses a lot of (IMHO ugly) hacks to circumvent bugs in (very) early
php versions. Back when PHP 4 was released there was a bug with
assigning objects to variables, at a certain point people found out that
by using $a &= new class; circumvented that bug, and didn't pose any
real problem in later versions, so PEAR uses that still. As of PHP
5.0.0, this is considered bad behaviour, but since PEAR should be usable
for old versions of PHP aswell, it still keeps this syntax.

I personally find most PEAR packages extremely bloated, and badly coded,
but that's just a personal opinion. However, you can edit the package
yourself and replace the &= new to = new :)

- tul

attached mail follows:


not knowing much about php myself but you could ask phpBB about their
private msgs. i cant recall whther it is a mod that pops the window up on
receiving a msg or whether the user is online (probably configurable). But
as far as direction, that is where i would be heading :)
Greg

"Richard Lynch" <ceol-i-e.com> wrote in message
news:3331.66.99.91.45.1109632823.squirrelwww.l-i-e.com...
> Lester Caine wrote:
>> At the risk of being shouted at because *I* know it's not a PHP problem!
>
> Actually, it's a client problem :-)
>
>> I have a page that is being refreshed every 30 seconds or so, and
>> displays a list of 'tickets' waiting to be dealt with on a list from a
>> database query. No problems there, but a couple of sites now want me to
>> add a pop-up warning when a ticket is added that has a staff ID matching
>> the logged in user.
>
> Your first task is to convince the client what an incredibly stupid idea
> this is.
>
> And that it won't work with all the popup blockers.
>
> And if it did work, it would just annoy the [bleep] out of their users.
>
> I know I'm preaching to the choir, here, but I have to go on record with
> this statement.
>
>> I can drive a sounder in the target browser, but need kicking in the
>
> A sounder? You mean like make my browser make noise? ICK!!!
>
>> right direction for a method of adding a pop-up window. Ideally it needs
>> to be browser agnostic, which is where the problem comes given the
>> pop-up blockers and other 'toys' that are being added to the browser end
>> of things.
>
> You're not going to defeat the popup blockers in the long run.
>
> You are better off using clean simple code in an onLoad in your body tag
> to open the new window. Something like:
> <body onLoad="window.open(URL);">
> where the URL loads in that user's recently added items.
>
> Either the users will accept the popup and whitelist it in their popup
> blocker, or they won't.
>
> And if a lot of them don't accept it, as they shouldn't, that tells you
> right there what a dumb idea this was. :-)
>
> But running around to find code to "defeat" the popup blockers will be a
> total waste of time -- and you'll end up with something so hacked and so
> un-maintainable that you'll have to fix it every six months, even if the
> popup blockers don't find workarounds to block your workarounds that popup
> the windows that they don't want popped up.
>
>> So can anybody point me in the right direction for a CURRENT method of
>> achieving this, many of the bits I've found so far are somewhat
>> antiquated, and fail in one way or another :(
>
> Perhaps it would be better to segregate the tickets into those associated
> with the User logged in, and those that are not.
>
> Or to at least sort them that way, regardless of their other sorting
> options.
>
> For that matter, don't even *BOTHER* to show me items that aren't mine,
> unless I specifically ask for them.
>
> Build a system that detects tickets that sit un-assigned for too long, and
> randomly assigns them, or, better yet, assigns them based on factors such
> as:
> Ticket features (IE, interface tickets to interface team members)
> Productivity (IE, don't assign as many tickets to your slow team members
> as your fast ones)
> User Status (IE, if I'm on vacation, don't assign me anything)
> .
> .
> .
>
> That way, no tickets is left sitting there "too long" but nobody has to
> deal with tickets that aren't assigned to them.
>
> Just an idea.
>
> In general, though, I only mean:
>
> Come back at the client with more than just "That's a dumb idea" (which it
> is)
>
> Come back with a "Here's a MUCH better way to do this" proposal.
>
> "That's a dumb idea" just gets you more headaches.
>
> A solution for a better solution makes you look real smart. :-)
>
> Yes, this may turn out to be a waste of your time, because the client is
> REALLY dead set on these popups, and you'll end up being miserable about
> them not taking your proposal as well... Time to start looking for a new
> client. :-v
>
> --
> Like Music?
> http://l-i-e.com/artists.htm

attached mail follows:


How can I click on a link which is linked to a JPG file and instead of
displaying it in the browser save it somewhere on the local machine or
open in a different software ?

Please help very urgent

Thanks
vaibhav

attached mail follows:


Fra: Vaibhav Sibal [mailto:vaibhavsibalgmail.com]
Sendt: 7. marts 2005 15:26
Til: php-generallists.php.net
Emne: [PHP] A general question

> How can I click on a link which is linked to a JPG file and instead of
> displaying it in the browser save it somewhere on the local machine or
> open in a different software ?

http://dk.php.net/manual/en/function.header.php

> Please help very urgent

:-)

--
Sincerly
Kim Madsen

attached mail follows:


I'm having problems with a function I created to display filesystems.
The problem is that I can't get tabs (\t) or newlines (\n) to work.

  function filesystems () {
    $df = `df -kP`;
    $mounts = preg_split('/\n/', $df);
    $row = "Filesystem\t" . "Size\n";
    for ($i = 1, $max = sizeof($mounts); $i < $max; $i++) {
      $row .= $mounts[$i];
      $row .= "\n";
    }
    $result = $row;
    echo $result;
  }

...

<table border="1" cellspacing="0" cellpadding="0" width="600" align="center">
  <tr>
    <td width="600"><? filesystems(); ?></td>
  </tr>
</table>

I just put filesystem and size on the first line to test the \t for
creating a tab. The \t and \n don't seem to work. What am I doing
wrong here? Thanks for any help you can give me.

attached mail follows:


[snip]
I just put filesystem and size on the first line to test the \t for
creating a tab. The \t and \n don't seem to work. What am I doing
wrong here? Thanks for any help you can give me.
[/snip]

/t and /n do not work for HTML output. If you view the source of your
HTML output you will see that the tabs and newlines are used properly.
You will have to substitute an HTML equivalent.

attached mail follows:


On 7 Mar 2005 Jay Blanchard wrote:

> /t and /n do not work for HTML output. If you view the source of your
> HTML output you will see that the tabs and newlines are used properly.
> You will have to substitute an HTML equivalent.

The HTML equivalent would likely be tables -- but if he uses <pre> then
the tabs and newlines should work.

For the original poster -- in other words, near the start:

    $row = "<pre>Filesystem\t" . "Size\n";

and near the end:

    $row .= "</pre>\n"

If you don't mind the monospaced font then that should work -- though
you are at the mercy of whatever the browser uses for tab spacing.

--
Tom

attached mail follows:


I have a Magpie RSS feed in an array, and I want to output it in random
order. What's the best (fastest) way to do this?

- Brian

attached mail follows:


Brian Dunning wrote:

> I have a Magpie RSS feed in an array, and I want to output it in random
> order. What's the best (fastest) way to do this?
>
> - Brian
easiest:
array_rand()

http://www.php.net/array_rand

attached mail follows:


On Mar 7, 2005, at 7:40 AM, M. Sokolewicz wrote:

> array_rand()

But that's likely to give me the same element more than once. I want to
output the entire array but in a random order, like a shuffled deck of
cards.

- Brian

attached mail follows:


[snip]
> array_rand()

But that's likely to give me the same element more than once. I want to
output the entire array but in a random order, like a shuffled deck of
cards.
[/snip]

Wow,..... http://www.php.net/shuffle

attached mail follows:


> Does anyone have any idea why this is happening and how I can avoid
> this double request?

Try checking the UserAgent for each request.
http://support.microsoft.com/default.aspx?scid=kb;en-us;293792

attached mail follows:


Further to my email last week, I've now indexed all the fields that get searched
on (i.e. sql statement is similar to "select x, y from table where x='blah'" - x
is the indexed field).

Is that the correct field to index?

My table structure is now as follows:
CREATE TABLE `syslog` (
  `ID` int(100) NOT NULL auto_increment, `unixtime` int(20) NOT NULL default
'0', `date` date default NULL, `time` time default NULL, `device_id`
varchar(255) default NULL, `log_id` varchar(255) default NULL, `type`
varchar(255) default NULL, `subtype` varchar(255) default NULL, `pri`
varchar(255) default NULL, `SN` varchar(255) default NULL, `duration`
varchar(255) default NULL, `policyid` varchar(255) default NULL, `proto`
varchar(255) default NULL, `service` varchar(255) default NULL, `status`
varchar(255) default NULL, `src` varchar(255) default NULL, `srcname`
varchar(255) default NULL, `dst` varchar(255) default NULL, `dstname`
varchar(255) default NULL, `src_int` varchar(255) default NULL, `dst_int`
varchar(255) default NULL, `sent` varchar(255) default NULL, `rcvd`
varchar(255) default NULL, `sent_pkt` varchar(255) default NULL, `rcvd_pkt`
varchar(255) default NULL, `src_port` varchar(255) default NULL, `dst_port`
varchar(255) default NULL, `vpn` varchar(255) default NULL, `tran_ip`
varchar(255) default NULL, `tran_port` varchar(255) default NULL, `user`
varchar(255) NOT NULL default '', `ui` varchar(255) NOT NULL default '',
`action` varchar(255) NOT NULL default '', `reason` varchar(255) NOT NULL
default '', `msg` varchar(255) NOT NULL default '', `vd` varchar(255) NOT
NULL default '', `hostname` varchar(255) NOT NULL default '', `module`
varchar(255) NOT NULL default '', `submodule` varchar(255) NOT NULL default
'', `virdb` varchar(255) NOT NULL default '', `idsdb` varchar(255) NOT NULL
default '', `libav` varchar(255) NOT NULL default '', `aven` varchar(255) NOT
NULL default '', `imap` varchar(255) NOT NULL default '', `smtp` varchar(255)
NOT NULL default '', `pop3` varchar(255) NOT NULL default '', `http`
varchar(255) NOT NULL default '', `ftp` varchar(255) NOT NULL default '',
`fcni` varchar(255) NOT NULL default '', `fdni` varchar(255) NOT NULL default
'', `idsmn` varchar(255) NOT NULL default '', `idssn` varchar(255) NOT NULL
default '', `rbldb` varchar(255) NOT NULL default '', `seq` varchar(255) NOT
NULL default '', `old_sintf` varchar(255) NOT NULL default '', `old_dintf`
varchar(255) NOT NULL default '', `old_saddr` varchar(255) NOT NULL default
'', `old_daddr` varchar(255) NOT NULL default '', `old_schd` varchar(255) NOT
NULL default '', `old_svr` varchar(255) NOT NULL default '', `old_act`
varchar(255) NOT NULL default '', `old_nat` varchar(255) NOT NULL default '',
`old_log` varchar(255) NOT NULL default '', `new_sintf` varchar(255) NOT NULL
default '', `new_dintf` varchar(255) NOT NULL default '', `new_saddr`
varchar(255) NOT NULL default '', `new_daddr` varchar(255) NOT NULL default
'', `new_schd` varchar(255) NOT NULL default '', `new_svr` varchar(255) NOT
NULL default '', `new_act` varchar(255) NOT NULL default '', `new_nat`
varchar(255) NOT NULL default '', `new_log` varchar(255) NOT NULL default '',
`sport` varchar(255) NOT NULL default '', `dport` varchar(255) NOT NULL default
'', `cat` varchar(255) NOT NULL default '', `cat_desc` varchar(255) NOT NULL
default '', `url` varchar(255) NOT NULL default '', `from` varchar(255) NOT
NULL default '', `to` varchar(255) NOT NULL default '', `file` varchar(255)
NOT NULL default '', `virus` varchar(255) NOT NULL default '', `intf`
varchar(255) NOT NULL default '', `attack_id` varchar(255) NOT NULL default
'', `dir_disp` varchar(255) NOT NULL default '', `tran_disp` varchar(255) NOT
NULL default '', `name` varchar(255) NOT NULL default '', `local` varchar(255)
NOT NULL default '', `remote` varchar(255) NOT NULL default '', `assigned`
varchar(255) NOT NULL default '', `stat` varchar(255) NOT NULL default '',
`loc_ip` varchar(255) NOT NULL default '', `loc_port` varchar(255) NOT NULL
default '', `rem_ip` varchar(255) NOT NULL default '', `rem_port`
varchar(255) NOT NULL default '', `out_if` varchar(255) NOT NULL default '',
`vpn_tunnel` varchar(255) NOT NULL default '', `init` varchar(255) NOT NULL
default '', `mode` varchar(255) NOT NULL default '', `stage` varchar(255) NOT
NULL default '', `dir` varchar(255) NOT NULL default '', `spi` varchar(255)
NOT NULL default '', `old_status` varchar(255) NOT NULL default '',
`new_status` varchar(255) NOT NULL default '', `passwd` varchar(255) NOT NULL
default '', `sintf` varchar(255) NOT NULL default '', `dintf` varchar(255)
NOT NULL default '', `saddr` varchar(255) NOT NULL default '', `daddr`
varchar(255) NOT NULL default '', `schd` varchar(255) NOT NULL default '',
`svr` varchar(255) NOT NULL default '', `act` varchar(255) NOT NULL default
'', `nat` varchar(255) NOT NULL default '', `log` varchar(255) NOT NULL
default '', `in_spi` varchar(255) NOT NULL default '',
  `out_spi` varchar(255) NOT NULL default '', `error` varchar(255) NOT NULL
default '', `seqno` varchar(255) NOT NULL default '', `field` varchar(255)
NOT NULL default '', `old` varchar(255) NOT NULL default '', `new`
varchar(255) NOT NULL default '', `gateway` varchar(255) NOT NULL default '',
`interface` varchar(255) NOT NULL default '', `old_device` varchar(255) NOT
NULL default '', `old_distance` varchar(255) NOT NULL default '', `old_dst`
varchar(255) NOT NULL default '', `new_device` varchar(255) NOT NULL default
'', `new_distance` varchar(255) NOT NULL default '', `new_dst` varchar(255)
NOT NULL default '', `device` varchar(255) NOT NULL default '', `distance`
varchar(255) NOT NULL default '', `icmp_id` varchar(255) NOT NULL default '',
`icmp_type` varchar(255) NOT NULL default '', `icmp_code` varchar(255) NOT NULL
default '',
  PRIMARY KEY (`ID`), KEY `unixtime` (`unixtime`), KEY `subtype` (`subtype`),
 KEY `type` (`type`), KEY `src` (`src`), KEY `dst` (`dst`), KEY `dst_port`
(`dst_port`), KEY `src_port` (`src_port`), KEY `srcname` (`srcname`))
TYPE=MyISAM AUTO_INCREMENT=1481721 ;

Sorry for it being so long, but that's the table!
Currently there are 1.5 million (1,500,00) records, and searching the table for
the last 10 records is taking up to 40 seconds.
e.g. select unixtime, type, subtype, src, dst, msg, pri from syslog where
type='ips' ORDER BY unixtime DESC LIMIT 10
Does anyone have any suggestions for improving the search?

Cheers
James

--------------------------------------------------------------------------------

From: Gareth Williams [mailto:garethvenditor.com]
Sent: Fri 04/03/2005 13:17
To: James Nunnerley
Cc: php-generallists.php.net
Subject: Re: [PHP] Improving a MySQL Search

Create some indexes. I spend most of my day messing around with a
table of 2000000 records, and indexes increased the speed from 40
seconds to 55 minutes for a query, down to the longest being less than
5 seconds.

On 28 Feb 2005, at 16:42, James Nunnerley wrote:

> I'm creating a serious of pages that show various aspects from a Syslog
> output.
>
> The main information is currently stored in one MySQL table - which
> after
> having been run for about 2 and a bit months has got nearly 1000000
> records.
> With this amount of information, it's taking a large time to carryout
> even
> the simplest query.
>
>
>
> Someone has suggested I look at setting up an archive, for slower
> searches,
> and a more recent table for quicker searching, but I'm reluctant to do
> this,
> as it would take quite a bit of time to copy all the information
> across as
> it stands, and then also to run a cron which transfers between the
> live and
> archive.
>
>
>
> Can anyone suggest some quick easy methods for speeding up the search?
>
>
>
> Cheers
>
> James
>