Re: [PHP] array question

2001-02-23 Thread Christian Reiniger

On Friday 23 February 2001 17:02, Jeff wrote:
> Is there better performance/speed instantiating an array with a
> specified size and then adding elements versus adding elements to an
> array with no size?

Uh, you can't specify the size when instatiating an array ...

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

...1000100011010101101010110100111010113...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP]

2001-02-23 Thread Christian Reiniger

On Friday 23 February 2001 19:27, Don Johnson wrote:
> Yup. Go figure.
>
> Don Johnson
>
> > It works if you execute only the SELECT (without the UPDATE) ?
> >
> > Christian Reiniger
> > LGDC Webmaster (http://sunsite.dk/lgdc/)
> >
> > On Friday 23 February 2001 16:57, Don Johnson wrote:
> >> Yup, the data's correct. The new records all have the
> >> DownloadedDateTime as '-00-00 00:00:00'
> >>
> > >> SELECT * from db_table WHERE (DownloadedDateTime = '-00-00
> > >> 00:00:00')
> > >>
> > >> UPDATE LOW_PRIORITY db_table SET
> > >> DownloadedDateTime=CURRENT_TIMESTAMP WHERE (DownloadedDateTime =
> > >> '-00-00 00:00:00')

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

...1000100011010101101010110100111010113...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP]

2001-02-23 Thread Christian Reiniger

Sorry for the other (empty) mail...

On Friday 23 February 2001 19:27, Don Johnson wrote:
> Yup. Go figure.
>
> Don Johnson
>
> > It works if you execute only the SELECT (without the UPDATE) ?

Then are you 100% sure that you execute the SELECT first (echo something 
on each query and check the order)?
Perhaps you can also post the actual code..

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

...1000100011010101101010110100111010113...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] regex help

2001-02-23 Thread Christian Reiniger

On Friday 23 February 2001 19:33, John Vanderbeck wrote:

> I need to take a string and remove everything from the first "<"
> character to the end of the line.  I'm pretty sure I could do this with
> an ereg_replace(), but I am horrible at regular expressions.  Could
> anyone help me with this?

Well, I prefer preg_* :)

$mystring = preg_replace ('/<.*/', '', $mystring);

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

...1000100011010101101010110100111010113...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: RE: [PHP] special characters with perl,mysql,php

2001-02-24 Thread Christian Reiniger

On Saturday 24 February 2001 07:49, Mitchell Hagerty wrote:
> The special character I'm concerned with at the moment is the back tick
> ` which mysql doesn't like on an insert. I was looking for a way not to
> parse the entire file evertime I inserted or extracted them from the
> database. Its simple enough todo in perl and php just seems like it
> would burn alot of cpu time.
>
> I was actually hoping mysql would have a way to encode it on the way in
> and decode on the way out. That way php or perl would be irrelevant.
> Guess not :\

Well, as someone else already said, addslashes () is the tool of choice 
for the way in, and for he way out you don't need to do anything.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"The number of Unix installations has grown to 10, with more expected."
 -- The Unix Programmer's Manual, 2nd Edition, June 1972

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Class methods in PHP

2001-02-24 Thread Christian Reiniger

On Saturday 24 February 2001 17:05, Kevin Beckford wrote:
> Is there class methods in php?

Well, there are classes, classes can have methods, there are methods to 
handle classes, methods to inspect methods, methods to inspect classes 
and propably more.

I have no idea what you mean with your question, but I hope that some 
part of the above answers it...

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"The number of Unix installations has grown to 10, with more expected."
 -- The Unix Programmer's Manual, 2nd Edition, June 1972

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] isset()

2001-02-24 Thread Christian Reiniger

On Saturday 24 February 2001 17:18, PHPBeginner.com wrote:
> in my preceding email I've written:
>
> if($var!='')
>
> will fix your all your worries without an intervention of a strings
> function.

Except that it will throw a warning in PHP4 if $var is not set.
=> isset () should be used.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"The number of Unix installations has grown to 10, with more expected."
 -- The Unix Programmer's Manual, 2nd Edition, June 1972

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] isset()

2001-02-25 Thread Christian Reiniger

On Sunday 25 February 2001 09:01, Mark Maggelet wrote:

> >> if($var!='')
> >>
> >> will fix your all your worries without an intervention of a

> >Except that it will throw a warning in PHP4 if $var is not set.
> >=> isset () should be used.
>
> man, this is like the thread that will not die. isset() will return
> true for an empty string, which is not what he wants. the right thing
> to do is use
>
> if((isset($var))&&($var!=""))

I never said *only* isset() should be used :)

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Never doubt that a small group of thoughtful, committed people can
change the world...
Indeed, it's the only thing that ever has."

- Margaret Mead

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] My system don't store session data, anybody can help me!!

2001-02-26 Thread Christian Reiniger

On Monday 26 February 2001 10:26, Securez wrote:

>  session_start();
>
> if( !isset( $c)) {
> session_register("c");
> $c = 1;
> }
>
> echo $c . "";
>
> ?>
> reload
>
> this example that works fine in other system with the same
> configuration, don't work in my machine, everytime he say 1.

Well, you never change $c, so it of course always says 1

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

...1000100011010101101010110100111010113...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Printing long strings

2001-02-26 Thread Christian Reiniger

On Monday 26 February 2001 14:38, PHPBeginner.com wrote:

> > Yes, you could use stripslashes($string) on it's output, in this way 
it
> will be no different as it was inputted.

>  -Original Message-
> From: Clayton Dukes [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 26, 2001 9:57 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Printing long strings
>
>
>   How can I get php to print a long string and ignore any of the
> characters in the string?
>
>   ie:
>   $string = "so   print $string;

Hmm, perhaps he looks for a way to let the *browser* preserve the string 
(and not e.g. parse the "<" as start of a tag).
htmlentities () ist the function of choice then...

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"use the source, luke." (obi-wan gnuobi)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] isset()

2001-02-26 Thread Christian Reiniger

On Monday 26 February 2001 18:07, Johnson, Kirk wrote:
> Wow, I hope you all will forgive me for one last go around on this
> thread :)
>
> Technically, what does "set" mean? It is not the same as "is
> registered" or "has a value", right? What is "is set"? Is it
> "introduced to the global namespace"?

"introduced to the *current* namespace"

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"use the source, luke." (obi-wan gnuobi)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Another question about using shmop!

2001-02-28 Thread Christian Reiniger

On Wednesday 28 February 2001 00:15, you wrote:
> > Does it provide a faster performance, if I use these rather than
> > store things in mysql DB, I know this might be stupid, but I have to
> > make sure this.
>
> I belive shared memory is *much* faster than MySQL.

Well, I'd say it depends. For only a bit of simple data it's fine. But 
for more the optimizations of a database (indices etc) may make the db 
faster (remember most of the DB will be in RAM as well).
And a database is just *much* simpler and safer to use.

> Shared memory is not for the faint of heart.

> I can't think of any more, but that's mostly because I consider shared
> memory "too tricky for me" and have never played with it...

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

CPU not found. retry, abort, ignore?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] File downloading?

2001-02-28 Thread Christian Reiniger

On Wednesday 28 February 2001 01:06, you wrote:
> > Great, thanks.
> > I looked at the file(), but it sounded like is was just for
> > local file use.
>
> oops, should've been include(). Sorry :)

include () is surely wrong for that. fpassthru (as someone else 
mentioned), file() and (my personal favourite) readfile() are the 
functions of choice

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

CPU not found. retry, abort, ignore?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Move a file from dir to another or delete file..?

2001-02-28 Thread Christian Reiniger

On Wednesday 28 February 2001 06:51, you wrote:

> Well I would like to move a file from one directoy to
> another using php and a web browser.
> I could just find a function to move an uploaded file
> but not a normal file which is allready there in some
> directory.

look at the filesystem functions:
rename () (or safer: copy()+unlink())
unlink()

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

CPU not found. retry, abort, ignore?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] what is wrong with this sniplet?

2001-02-28 Thread Christian Reiniger

On Wednesday 28 February 2001 22:40, you wrote:
> people,
> I tried to write out email using sniplet below, the email will write
> out the hyper link so that reciever can click on the link to go to the
> page. What happen is that the reciever recieve the actual link instead
> of the hyper link I made, so I wonder what did I do wrong. I have mad
> sure that the email software I used to test can read html format ( I
> use outlook express).
>
>   $mailTo  =   "[EMAIL PROTECTED]";
>   $mailSubject = "test";
>   $mailBody= "Dear sir, \n\n";
>   $mailBody= "Below is the link you can click on, \n\n";
>   $mailBody   .= "Please Click  href=\"www.php.net\">Here to view the request
> details"; $mailHeaders = "From: [EMAIL PROTECTED]\n";
>   mail($mailTo, $mailSubject, $mailBody, $mailHeaders);

Add a "Content-Type: text/html" to $mailHeaders (& add a http:// to the 
link)

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

CPU not found. retry, abort, ignore?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] multiple databases

2001-02-28 Thread Christian Reiniger

On Wednesday 28 February 2001 09:42, you wrote:

> Is it a wise idea to have a PHP web application running on multiple
> databases? Everything I've done to date has run off one database, no

If you get *really much* traffic, it's wise to split things up to 2 or 3 
databases (each on a dedicated machine):

* Normal data
* Session data
* evtl. Cached pages / parts

> each of which should be able to be backed up to a floppy. Not all

If each part fits on a floppy, forget it. For these sizes it'n not worth 
the effort (and can, in fact, slow down things)

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

CPU not found. retry, abort, ignore?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] How to insert time and date into mysql?

2001-02-28 Thread Christian Reiniger

On Monday 28 February 2000 19:15, you wrote:
> How can I insert time and date into mysql table,
> if the table i have to insert has a field of type time, and a field of
> type date.
>
> Then how can I insert it in PHP, if I use time() function??

Look at the MySQL manual, function FROM_UNIXTIME()

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Never doubt that a small group of thoughtful, committed people can
change the world...
Indeed, it's the only thing that ever has."

- Margaret Mead

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] require on compressed files

2001-03-01 Thread Christian Reiniger

On Wednesday 28 February 2001 22:58, you wrote:

> I am trying to get the expected behavior of:
> require("filename.gz");
> or
> require("filename.bz2");
> to work properly.

Why do you want to do that? If that file is just a normal include file, 
compression just adds unneccessary overhead. If it's some file you don't 
know the contents of, don't include it (that would mean executing 
arbitrary code on your server)

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

What luck for the rulers that men do not think.

- Adolf Hitler

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] about include

2001-03-01 Thread Christian Reiniger

On Thursday 01 March 2001 09:59, you wrote:
> hi,
>everytime i add include function to a script it will answer like:
>  Warning: Failed opening 'common.php' for inclusion
> (include_path='/usr/local/apache/htdocs:/home/httpd/mydomain') in
> /home/httpd/mydomain/h24h/foro/admin/index.php on line 23
>
> and lines 22 and 25 have:
>chdir("/home/httpd/mydomain/phorum/");
>include "common.php";

The chdir doesn't affect include () in any way. It looks for "common.php" 
in the include path, i.e.
/usr/local/apache/htdocs/common.php  or
/home/httpd/mydomain/common.php

Writing include ('phorum/common.php') will work in your setup

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

What luck for the rulers that men do not think.

- Adolf Hitler

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Javascript and Php

2001-03-02 Thread Christian Reiniger

On Thursday 01 March 2001 13:19, you wrote:

> I'd like to include an inc file once a button id cliked!

You can only request a new page. Period.
PHP runs on the server, button clicks are evaluated on the client 
(browser).

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The use of COBOL cripples the mind; its teaching should, therefore,
be regarded as a criminal offence.

- Edsger W. Dijkstra

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Bitwise solution?

2001-03-02 Thread Christian Reiniger

On Thursday 01 March 2001 20:58, you wrote:

> But that would give me a value of a variable variable.
> And I need a numerical value so
>
> $var1 ="joe";
> $var2 = date( "U" );
>
> echo "$var1$var2";
>
> won't do me any good.

Ahhh. You want to use the mcrypt functions or simply crypt() ?

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The use of COBOL cripples the mind; its teaching should, therefore,
be regarded as a criminal offence.

- Edsger W. Dijkstra

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Munging hidden/form variables

2001-03-02 Thread Christian Reiniger

On Friday 02 March 2001 00:22, you wrote:
> I can think of one way that you can take in an attempy to prevent
> this.
> It is not totally fool proof but it will make it more difficult
> to send spoof data:
>
> 1) Check your HTTP refereer when the form is submitted. If the
> referer is not from your host then don't process the form.
> Of course this can be faked quite easily if this person knows
> what (s)he doing.

And it would prevent people who don't sent Referrer headers from using 
the form

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The use of COBOL cripples the mind; its teaching should, therefore,
be regarded as a criminal offence.

- Edsger W. Dijkstra

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] php and javascript

2001-03-02 Thread Christian Reiniger

On Friday 02 March 2001 06:21, you wrote:
> Hello,
>
> Are there any good examples of producing embedded javascript code in a
> php file?



  sglfjh s



-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The use of COBOL cripples the mind; its teaching should, therefore,
be regarded as a criminal offence.

- Edsger W. Dijkstra

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Help - I can't create jpegs with GD

2001-03-02 Thread Christian Reiniger

On Friday 02 March 2001 06:46, you wrote:
> I can't create or manipulate jpegs, but pngs work fine. I am using a
> hosting service. They installed GD 1.8.4 with jpeg support a few days
> ago, but I'm thinking they did it wrong. I'm using code I know works
> because it's straight out of the PHP Cookbook. What do I need to tell
> them to correct the problem?

Depends on what errors you get. "I can't create or manipulate jpegs" 
isn't particularly helpful...

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The use of COBOL cripples the mind; its teaching should, therefore,
be regarded as a criminal offence.

- Edsger W. Dijkstra

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] whats the message count ?

2001-03-02 Thread Christian Reiniger

On Thursday 01 March 2001 12:51, you wrote:

> 2. i can order "old" mails from the script who managed this folder
> right ? but i need to say what number i want.. like i want number
> 499-550 .. so my question what number do we have actually ? (i suppose
> it started with one, but where are we right now?)

Look at the headers of one of the messages. They contain a line of the 
form
X-From_: [EMAIL PROTECTED]

The 42156 in there is the message number

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The use of COBOL cripples the mind; its teaching should, therefore,
be regarded as a criminal offence.

- Edsger W. Dijkstra

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] last inserted record

2001-03-03 Thread Christian Reiniger

On Saturday 03 March 2001 05:16, you wrote:

> i'm having a little bit of problems with a little mysql table i'm
> using. the table has no primary key nor index nor nothing.
>
> i was wondering if it's possible to select the last inserted record of
> a table with this characteristics.

Add a primary key. now. Accesses without that will be painfully slow.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"These are the people who proudly call themselves "hackers" --
not as the term is now abused by journalists to mean a computer
criminal, but in its true and original sense of an enthusiast,
an artist, a tinkerer, a problem solver, an expert."

- ESR

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Content-Type: image/gif and send the image in hex

2001-03-04 Thread Christian Reiniger

On Sunday 04 February 2001 05:53, you wrote:
> Hi all,
>
> I'm trying to make a demonstration script (using PHP) that demonstrates
> the use of MIME types in HTTP headers. It should send the Content-Type
> header and than sends an image to the browser in hex.

What do you mean with "in hex"? Hex is a number system. It only exists to 
make handling binary data easier for humans.

> I run the script in my browser and get the bare decimal values
> displayed and not the GIF image:

Aha. So you just want to "send the image".

> I also tried to use:
> header("Content-type: image/gif");
> But no success.
> I don't want to use the header() function cause it doesn't help my
> demostration script show the workings.

Well, you *need* the header ("Content-type: image/gif"); to tell the 
browser that you're sending a gif. It can not determine that by itself.

If you don't send the header the browser will try to interpret you gif 
image as HTML code, which usually gives, well, fascinating results :)

> // 7x1 pixel GIF image data
> $img = array (
> 0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x07, 0x00, 0x01, 0x00, 0xF7,
> 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00,
> 0x80, 0x80, 0x00, 0x80, 0x00,

[...]

> ) ;

> // Write content type to browser
> echo "Content-Type: image/gif\n\n";
>
> // Write GIF image data to browser
> foreach ($img as $val){
>   echo $val;
> }

Try
echo pack ('c*', $img);

Or if that doesn't work:

foreach ($img as $val) {
echo pack ('c', $val);
}


-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

...1000100011010101101010110100111010113...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP web based mailing list administrator

2001-03-04 Thread Christian Reiniger

On Saturday 03 March 2001 13:59, you wrote:
> Yes, they are about. Try hotscripts.com.

And if you don't insist that the manager is written in PHP, try GNU 
Mailman. It comes with its own /very nice) web-based admin software.

> > does there exist a web based mailing list administrator in PHP (Tying
> > in with some open source mailing list software)?
> > Ideally, something like egroups (now groups.yahoo.com). I just want
> > to be able to easily administrate (or have other people administrate)
> > mailing lists. I have access to my own server (linux, php4, ...)
> > thanks!
-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

...1000100011010101101010110100111010113...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] NETSCAPE screws up query string : more problems!

2001-03-05 Thread Christian Reiniger

On Sunday 04 March 2001 20:38, you wrote:
> Julian,
> i tried :
>
>  href=\"pro_page1.php3?title=".urlencode($myrow[title])."\">
>
> instead
>
>  href=\"pro_page1.php3?title='".urlencode($myrow[title])."'\">
>
> notice the single quote ' missing. And that WORKED!!!
> It displayed the right value in the next PHP page.
> Unfortunately there's another problem. it only
> DISPLAYED the right value...but when it adds the value
> in the database...it adds with the plus + sign. i.e.,
> it adds : Project+One instead of Project One.

try rawurlencode instead of urlencode

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Very funny, Scotty! Now beam up my clothes...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] input textfield value cat!

2001-03-05 Thread Christian Reiniger

On Monday 05 March 2001 17:29, you wrote:
> I'm using a variable!
> >

Well, you *still* need to have quotes around it:



> >Make sure you have quotes around the value.
> >
> >

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

...to paraphrase Churchill, while representative  democracy may be
terrible, it's still the best system that large corporations can buy.

- David Weinberger JOHO January 25, 2000

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] passing variable via url

2001-03-05 Thread Christian Reiniger

On Monday 05 March 2001 17:43, you wrote:

> using PHP 3.x on Linux, I've always been able to pass along a variable
> like http://www.domain.com/index.php3?foo=bar
>
> and then I could print out this with something like
> echo $foo;
> would print out "bar"
>
> I've recently installed the latest PHP4 onto a Windows2000 server, I'm
> trying the same thing here, a simple test, and
> echo $foo;
>
> gives me nothing
>
> however including a PHPINFO() on the page displays this:
> HTTP_GET_VARS["foo"] bar
>
> I'm I missing something here ?

Check whether register_globals is set to "on"

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

...to paraphrase Churchill, while representative  democracy may be
terrible, it's still the best system that large corporations can buy.

- David Weinberger JOHO January 25, 2000

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Get text between

2001-03-06 Thread Christian Reiniger

On Monday 05 March 2001 23:09, you wrote:
> I need some help with a program, I need to get every
> instance of text between  GET TEXT HERE
>  and save the results in a variable. Does anyone
> have some example code of how to do it along with how
> to put the results into just one variable?

Hmm, try
preg_match_all ('/]+>([^<]+)<\/a>/', $Subject, $Matches);

$Matches [0] [1],
$Matches [1] [1],
$Matches [2] [1]
etc

will contain the text afterwards.


-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Pretty cool, the kind of power information technology puts in our hands
these days.

- Securityfocus on probing 3600 hosts for known problems in 3 weeks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] speeding a site with lots of includes

2001-03-06 Thread Christian Reiniger

On Monday 05 March 2001 23:20, you wrote:
> An app I am currently developing has grown a lot. It currently
> handles aproximately 12 includes, more or less 13 thousand lines
> of code.
>
> By doing some benchmarks, i realized that the bottleneck is the
> include() payload.

Are you sure it's the include() ? Or is it the parsing time for the 13k 
LOC (much more likely)?

> How can I optimize a program like this one ?

Have a look at zend optimizer or apc cache 
(apc.communityconnect.(com|org|net))

Another way would be to clean up your code (if you haven't already done 
this). Often this can drastically cut down on code size (a cleanup I did 
recently roughly halved code size) while improving clarity and 
maintainability

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Pretty cool, the kind of power information technology puts in our hands
these days.

- Securityfocus on probing 3600 hosts for known problems in 3 weeks


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Sites Using PHP - For a presentation

2001-03-06 Thread Christian Reiniger

On Monday 05 March 2001 23:44, you wrote:

> I am looking for some big name sites using PHP.
> I will be doing a presentation next month and would like to show a list
> of sites that are using PHP.

Well, sourceforge.net is pretty big (and complex).

http://www.securityspace.com/s_survey/data/index.html
might also provide some info, and with 
http://uptime.netcraft.com/up/graph you can look at some popular sites 
yourself

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Pretty cool, the kind of power information technology puts in our hands
these days.

- Securityfocus on probing 3600 hosts for known problems in 3 weeks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] exec timing out, want to leave process running in bg

2001-03-07 Thread Christian Reiniger

On Wednesday 07 March 2001 06:37, you wrote:
> Hi,
>
> Well there are many ways to run a process in the
> background, my favorite way is detaching the process
> or the program or process from within, so if it's a c
> program pretty easy, but incase you dont have the
> source, then you can use this:
>
> exec("mp3123 -y -Z --all 1>/dev/null/ 2>&1 &");

better add "nohup" to that:
exec("nohup mp3123 -y -Z --all 1>/dev/null/ 2>&1 &");

> well that simply puts the stdout and stderr in the
> same file /dev/null, and puts it into the background.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

What luck for the rulers that men do not think.

- Adolf Hitler

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Show output of program in realtime on website

2001-01-10 Thread Christian Reiniger

On Wednesday 10 January 2001 00:08, Stefan Scherf wrote:

> the program "main" produces x times an output with an delay of 1 second
> between each output.
>
> I want to show this output in "realtime" on a website (this should
> become a progress-bar).

> Does anybody know how to realise this?

Write a custom browser for this and tell all your visitors to use it. 
Seriously - you can't control how the browsers buffer the received data, 
when they render it etc.

That said - make sure that PHP output buffering is off

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Those who will not reason, are bigots,
those who cannot, are fools,
and those who dare not, are slaves.

- George Gordon Noel Byron (1788-1824), [Lord Byron]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Show output of program in realtime on website

2001-01-10 Thread Christian Reiniger

On Wednesday 10 January 2001 13:11, Stefan Scherf wrote:

> maybe the problem is in the c-programm "main":
>
> int main() {
>int i;
>for(i=0;i<10;i++) {
>   printf("Output: %i\n",i);

The "\n" triggers a buffer flush if I'm not completely mistaken, so there 
shouldn't be a problem

>   sleep(1);
>}
>return;

Your compiler should throw an error here - main is declared as "int" but 
doesn't return a value

> }

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Those who will not reason, are bigots,
those who cannot, are fools,
and those who dare not, are slaves.

- George Gordon Noel Byron (1788-1824), [Lord Byron]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] looking for a PHP editor

2001-01-10 Thread Christian Reiniger

On Wednesday 10 January 2001 15:50, Miles Thompson wrote:

> you use because you know how it behaves. For a Windows environment I'll
> endorse jeremy's recommendation of Ultraedit -- my hammer of choice. It

seconded.

> For Linx, etc.? I don't have a hammer yet. I feel obligated to use VIM,

My personal favourite is fte. Its only problem is that it doesn't have 
real PHP highlighting, but I got used to switching between HTML and C 
mode...

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Those who will not reason, are bigots,
those who cannot, are fools,
and those who dare not, are slaves.

- George Gordon Noel Byron (1788-1824), [Lord Byron]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] MySQL SELECT performance suggestions

2001-01-10 Thread Christian Reiniger

On Wednesday 10 January 2001 20:58, [EMAIL PROTECTED] wrote:

> I have PHP perform SELECT queries on the table, and I need to display
> the results in a format of: "viewing $top to ($top+$depth) of $numrows
> found"
>
> I haven't found a way to determine $numrows without performing a second
> SELECT in this format:

look for mysql_num_rows ()

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Drink wet cement. Get stoned.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP simulator

2001-01-11 Thread Christian Reiniger

On Thursday 11 January 2001 00:08, Todd Cary wrote:

> <<<
> Did I completely miss the point?
>
> Yes and No.  I have my Win 2K system in my office on which I do PHP
> development.  However, sometimes I am on the road with a "simple"
> Notebook computer (450 MHz and 6 GHz drive).  It would be nice to "play
> around" with PHP and see if it will run.

*simple* 
I have PHP running nicely on a Pentium 90 with 48MB RAM which also 
happens to be the file-/mail-/smb-/cvs-/... server in my house. So don't 
worry about your "simple" notebook being too slow :)

(granted - that computer here runs on Linux without any GUI, but still...)


-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

This is JohnC IMHO, I compaired tri-word groupings here and in his plan
and got a good match.

- /. posting discussing the likelihood that an AC post that claimed to be
posted by John Carmack during his honeymoon (and having the login info at
home) was actually from him.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] mixing HTML and PHP code

2001-01-12 Thread Christian Reiniger

On Friday 12 January 2001 00:26, [EMAIL PROTECTED] wrote:

> > echo "";
> > echo "";
> > echo "$title";
> > echo " if ($time_to_write_the_web_page) {
>
>   // write the web page.
> echo "
> 
> 
> $title
> ";

One reason why I don't like the "echo" route: I lose the syntax 
highlighting for the HTML that way. String constants should be 
highlighted as, well, string constants normally, but when they contain 
HTML code that's just plain ugly.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Pretty cool, the kind of power information technology puts in our hands
these days.

- Securityfocus on probing 3600 hosts for known problems in 3 weeks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Simple form not passing variables, Why??

2001-01-13 Thread Christian Reiniger

On Saturday 13 January 2001 00:36, jeff fitzmyers wrote:

> The code below does not work. What could be causing

> Please enter user name here:
> 

Pull out your favourite HTML documentation and read again through the 
discussion of the  tag

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The use of COBOL cripples the mind; its teaching should, therefore,
be regarded as a criminal offence.

- Edsger W. Dijkstra

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] filemtime or getlastmod

2001-01-14 Thread Christian Reiniger

On Sunday 14 January 2001 17:54, Christian Binder wrote:

> The only problem is, that my following script only shows one date (IMO:
> of the first value (.)), and not create the date of each file.

> // get unix-timestamp form each file in subdirectory
> $unixdatum=getlastmod($datei[$i]);

Read again through the getlastmod() docs. That function returns the 
modification time of the *currently executed PHP script*.
Use filemtime() instead and it will work


-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Install once, run forever. Linux.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] regular expression

2001-01-15 Thread Christian Reiniger

On Monday 15 January 2001 09:03, Fai wrote:
> ^.+@.+\\..+$  This regular expression can check if the email address is
> valid. But it cannot validate the email address with two "@", does

I use this code:

/*
 * Check whether the supplied string is a
 * (syntactically) valid email address
 * Only does a very rough check. Checking for complete
 * validity is nearly impossible.
 */
function pbIsMailAddress ($Address)
{
// strip comments
while (preg_match ('/\([^()]*\)/', $Address))
$Address = preg_replace ('/\([^()]*\)/', '', $Address);

// strip leading/trailing whitespace
$Address = trim ($Address);

// check for basic form
return preg_match ('/^[^@]+@[\w-]+(\.[\w-]+)+$/', $Address);
}

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Software is like sex: the best is for free" -- Linux Torvalds

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Check browsers image displaying

2001-01-16 Thread Christian Reiniger

On Tuesday 16 January 2001 09:30, Vlad wrote:
> Hi all!
> How can I check (in PHP code) if the target browser supports image
> displaying or not?

PHP manual/misc. functions/get_browser()

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

What luck for the rulers that men do not think.

- Adolf Hitler

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] How to handle multiple lines in PHP?

2001-01-16 Thread Christian Reiniger

On Tuesday 16 January 2001 17:12, david klein wrote:

> Does anyone know how to handle this? One idea is to convert the  LINE CHAR> to "" before putting it into the database, but how can
> we detect the  in PHP?   Or is there any other ways?

Search the list archives. I already posted a solution for this (complete, 
working source code) some time ago.
Here it is:
Date: Fri, 5 Jan 2001 18:08:51 +0100

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Never doubt that a small group of thoughtful, committed people can
change the world...
Indeed, it's the only thing that ever has."

- Margaret Mead

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Question concerning performance

2001-01-17 Thread Christian Reiniger

On Wednesday 17 January 2001 11:37, jeremy wrote:
> Example ONE:  (in just parse mode)
> [cut]---
>  print "blah blah blah blah blah blah blah";
> print "" . $Var1 . "" . $Var2 . "";
> ?>
> [/cut]--
>
> Example TWO:  (in html && parse mode)
> [cut]---
> blah blah blah blah blah blah blah
> 
> [/cut]--
>
> Now, let me elaborate. I'm quite aware that the above 2 code segments
> will both be fast enough for me not to care.  BUT, within an
> application that has 1000 lines of code per page (hypothetically),
> everything begins to matter, and the more cpu-clicks I can save, the
> happier I'll be.

With big applications the *main* thing that matters is maintainability. 
In other words: Make it work, make it work well, make it maintainable and 
*then* make it as fast as possible while *keeping* it maintainable (and 
working of course)

> The 2 examples will turn out the same results to the browser, but which
> will do it faster?

Don't care about it. The difference is most lileky in th 0.1% range.
Look at bigger optimizations first, then benchmark and if it still is too 
slow (and only then) optimize further.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka", but "That's funny..."

- Isaac Asimov

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] preg_replace pain!

2001-01-18 Thread Christian Reiniger

On Thursday 18 January 2001 07:40, Nicholas Pappas wrote:

> I was hoping someone could help me with this regular expression...
>
>   $pattern = "/\[b\](.*)\[\/b\]/Ui";
> $message = preg_replace($pattern, "\\1", $message);
>
>   The above works for:
>   [b]bold text[/b]
>
>   But does not work for:
>   [b]bold text
> w/ newline[/b]

add a "s" modifier to the expression and

=>

$pattern = "/\[b\](.*)\[\/b\]/Uis";

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"use the source, luke." (obi-wan gnuobi)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] a text formating & cpu question

2001-01-19 Thread Christian Reiniger

On Thursday 18 January 2001 23:05, Noel Akins wrote:
> Question 2:
> Is there a way for php to detect the cpu speed of a users computer?

If you're on a Linux machine you can read /proc/cpuinfo and pick out the 
speed entry.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

...to paraphrase Churchill, while representative  democracy may be
terrible, it's still the best system that large corporations can buy.

- David Weinberger JOHO January 25, 2000

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Search Engines and PHP

2001-01-23 Thread Christian Reiniger

On Tuesday 23 January 2001 09:23, Kristofer Widholm wrote:
> >If you want to be totally searchengine-safe, do not use variables on
> > the url, do not rely on cookies and do not rely on POST variables for
> > the pages you want to have the searchengine spider.
>
> How the heck do you build a dynamic site without URL variables,
> cookies, or POST variables?

Search phpbuilder.com for an article called "Writing dynamic pages with 
search engines in mind" or so.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

This is JohnC IMHO, I compaired tri-word groupings here and in his plan
and got a good match.

- /. posting discussing the likelihood that an AC post that claimed to be
posted by John Carmack during his honeymoon (and having the login info at
home) was actually from him.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Newbie frustration!

2001-01-24 Thread Christian Reiniger

On Tuesday 23 January 2001 22:03, Gerry wrote:

> All I need is to be able to learn how to load everything from a script
> and  how to call the script with a URL to the directory.
> eg.  {
> include "header,nav, fetch content,footer";
> else "?";
> }
> ?>
>
> http://mysite.com/Yarns/"> Yarns

Read
http://www.phpbuilder.com/columns/tim19990117.php3

Basically you create "virtual directories", e.g. a PHP script named 
"Yarns" which simply include()s your one "real" script.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The use of COBOL cripples the mind; its teaching should, therefore,
be regarded as a criminal offence.

- Edsger W. Dijkstra

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] file or fopen to fetch a web page???

2001-01-24 Thread Christian Reiniger

On Wednesday 24 January 2001 01:25, Richard Lynch wrote:
> > I wonder myself, which method is better to fetch a web page:
> >
> >$file = fopen($url, "r");
> >$page = fread($file, 5);
> >
> > or
> >
> >$file = join('', file($url));
>
> Probably about the same either way...

Perhaps. In an earlier version of PHP I had a problem where the above 
code (fopen...) read *more* than the page length. I.e. the page was e.g. 
20k big and the fread appended ~5k of junk to it.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The use of COBOL cripples the mind; its teaching should, therefore,
be regarded as a criminal offence.

- Edsger W. Dijkstra

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: WG: [PHP] Shared Memory with Yast-installed mod_php4 from SuSE.

2001-01-24 Thread Christian Reiniger

On Wednesday 24 January 2001 09:55, Thomas Weber wrote:
> Thanks Stathis i tried it twice to compile it, ./configure ,
> make, make install. but i don't get a new libphp4.so! I found only
> a libphp4.a wich is 9MB (the original libphp4.so is only 2.5MB .

You forgot the --with-apxs switch to ./configure

Also , try doing a
strip --strip-unneeded libphp4.so
afterwards

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The use of COBOL cripples the mind; its teaching should, therefore,
be regarded as a criminal offence.

- Edsger W. Dijkstra

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Splitting at word count

2001-01-26 Thread Christian Reiniger

On Thursday 25 January 2001 21:06, H. Wade Minter wrote:
> Does anyone have a good idea on how to split after a certain number of
> words?

Attached is code that semi-intelligently limits strings to a certain 
number of characters. Perhaps that helps you.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"use the source, luke." (obi-wan gnuobi)


= ($MaxChars - $Threshold))
		$Work = substr ($Work, 0, $Pos);

	$Work .= ' ...';

return $Work;
}


?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


Re: [PHP] Get rid of da Zero's

2001-01-26 Thread Christian Reiniger

On Thursday 25 January 2001 23:27, Ethan Nelson wrote:

> It needs to quit shaving zero's when it hits the decimal point.
>
> 40.00 into 40
> 45.50 into 45.5
> 40.25 into 40.25

Hmm,
$ValWithoutZ = (double) $ValWithZ;

should work fine (i.e. interpreting the number as floating-point value 
instead of as string)

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"use the source, luke." (obi-wan gnuobi)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] array size

2001-01-26 Thread Christian Reiniger

On Friday 26 January 2001 22:35, Giancarlo wrote:

> > how many elements i can insert in an array?
> thank you!

I'd say up to 2^31 or until your memory is full (which is likely to occur 
earlier)

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Even idiots can handle computers, and many do.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] updating time fields

2001-01-26 Thread Christian Reiniger

On Friday 26 January 2001 05:42, Kurth Bemis wrote:
> i am wondering if anyone has written a snippet to process the current
> date or mktime into a mysql timestamp feild.

$CurrentTime = time ();

$Query = "INSERT INTO mytable (timestampfield) VALUES 
(FRON_UNIXTIME($CurrentTime))"

=> MySQL already provides functions for that.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Even idiots can handle computers, and many do.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] phpinfo ?

2001-01-27 Thread Christian Reiniger

On Friday 26 January 2001 23:54, John Guynn wrote:
> I've always used the echo and it does work under PHP4...just tested it
> on www.teamkaos.org before I made my post.

Sure it works as well :)
But look closely at the output - with 
echo phpinfo ();
phpinfo prints out the, well, info, and *then* you echo the returnvalue 
of phpinfo () (an integer).
So the output generated by your version will have some little number at 
the end.


-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

(A)bort (R)etry (P)retend this never happened ...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Apache

2001-01-29 Thread Christian Reiniger

On Sunday 28 January 2001 03:57, [ rswfire ] wrote:

> 1.  Why does $PHP_SELF include /php/php.exe in the variable?  How can I
> stop it from doing that?

You're using PHP as CGI. Try using the shared module.

> 2.  Same thing with $SCRIPT_NAME as $PHP_SELF except it does not
> include the filename.

It does, except it does not??

> 3.  How can I turn on directory browsing?  I am receiving a Forbidden
> error whenever there isn't a default document in a directory.

search for "Options " in your apache configs and add an "Inexes" to it

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

This is JohnC IMHO, I compaired tri-word groupings here and in his plan
and got a good match.

- /. posting discussing the likelihood that an AC post that claimed to be
posted by John Carmack during his honeymoon (and having the login info at
home) was actually from him.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Sending Download Header

2001-01-30 Thread Christian Reiniger

On Sunday 28 January 2001 17:52, Natasha wrote:
> The filename is just the name, the content is what
> matters, and also wanted to know if echoing binary
> data is ok ?

Yes. That's what application/octet-stream means: binary data.

> and what about images, can i send it through octect
> stream ? will they turn up right ?

Usually yes, but you should use the proper MIME type for them 
(image/jpeg, image/png, image/gif etc) just to be sure

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"World domination. Fast." (Linus Torvalds about Linux)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] email headers!

2001-01-30 Thread Christian Reiniger

On Tuesday 30 January 2001 12:06, kaab kaoutar wrote:

> how can i add Bcc Cc and others to my email?
> i use
> $headers="Bcc:[EMAIL PROTECTED]\nCc:[EMAIL PROTECTED]";
> mail($email,$subject,$body,$headers))
> but i receive it only once ?

I guess your mail server is simply too intelligent - it recognizes that 
all addresses are the same and only sends it once :)
Usually this is desired behavior


-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"World domination. Fast." (Linus Torvalds about Linux)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PC<->Mac

2001-01-31 Thread Christian Reiniger

On Tuesday 30 January 2001 17:26, Markus H. Maussner wrote:

> is there a PHP function wich translates from Mac to PC ?

Look for the "Recode" extension

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

...to paraphrase Churchill, while representative  democracy may be
terrible, it's still the best system that large corporations can buy.

- David Weinberger JOHO January 25, 2000

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Can you do this

2001-01-31 Thread Christian Reiniger

On Wednesday 31 January 2001 16:03, Boget, Chris wrote:

> Now, say I have a function where one of the arguments
> is passed by reference and is modified within the function.
> I can call this function on one line
>
> myFunc( &$modifiedVariable );
>
> and print out the value (if any) of $modifiedVariable on
> the next
>
> echo $modifiedVariable.
>
> So what I am wondering is if you can turn those two
> statements into one?  The function is going to get evaluated
> first we already know,  but I am not certain how I could
> get the (new) value of $modifiedVariable.  

What about using normal pass-by-value and returning the result?

function MyFunc ($SomeVal)
{
  $SomeVal += 42;
  return $SomeVal;
}

echo MyFunc ($StrangeVal);

Anyway - functions that get their parameters by reference and modify them 
can cause much trouble, so better be careful with that.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

I saw God - and she was black.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] What is "foo"?

2001-01-31 Thread Christian Reiniger

On Wednesday 31 January 2001 19:35, SED wrote:

> Probably some of you are laughing while reading this :) But I have seen
> the word "foo" used so many time (in programming) from different

Read
http://www.tuxedo.org/~esr/jargon/html/entry/foo.html
for a detailed explanation :)

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Those who will not reason, are bigots,
those who cannot, are fools,
and those who dare not, are slaves.

- George Gordon Noel Byron (1788-1824), [Lord Byron]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Include " quotes inside textbox

2001-02-02 Thread Christian Reiniger

On Thursday 01 February 2001 19:07, Karl J. Stubsjoen wrote:

> I'm trying to pass back a link to the user in a textbox (so they can
> copy and paste it elsewhere), however my textbox is being parsed
> incorrectly by the browser because of the " quotes which happen in the
> link I'm passing - basically the HTML for the text box is getting
> parsed together with the HTML for the passed link and  the results
> are messed up.

I think you want to use htmlentities ():

echo "" . 
  htmlentities ($Content) . "";

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka", but "That's funny..."

- Isaac Asimov

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Why?? SPRINTF("SELECT sequence,prodnum,childdesc....);

2001-02-02 Thread Christian Reiniger

On Thursday 01 February 2001 23:40, Karl J. Stubsjoen wrote:
> What is the purpose of the SPRINTF in this instance?
>
>
> SPRINTF("SELECT
> equence,prodnum,childdesc,onhand,openorders,avlallocate,bakorder,webpri
>cing FROM prodaval");

There isn't any. Remove it.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka", but "That's funny..."

- Isaac Asimov

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re:What version of Linux?

2001-02-02 Thread Christian Reiniger

On Friday 02 February 2001 05:32, John Hinsley wrote:

> > I want to install my personal server on a old Intel 486 machine, 36
> > Mb RAM, 2 Gb HardDisk, VGA, to develop in PHP. What version of Linux
> > do I need to install?

> But I'm unsure of what you "really" intend using this machine for. Do
> you really want a home network (in which case conventional wisdom
> suggests that the server should be the most powerful box on site) or

Well, you'll have great trouble getting several 100k hits per day on a 
home server, so a small machine completely suffices :)

The most important thing here should be to *not* install a GUI, simply 
because nobody will sit at that machine anyway and running GUIs consume 
too much of your precious RAM.
SuSE, Debian or perhaps Red Hat should be fine for this.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Google results 1-10 of about 142,000,000 for e. Search took 0.18 seconds.

- http://www.google.com/search?q=e

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] configuring headers in mail() ...

2001-02-02 Thread Christian Reiniger

On Friday 02 February 2001 08:20, Maxim Maletsky wrote:

> FROM: "J-Door Newsletter" < [EMAIL PROTECTED] 
<mailto:[EMAIL PROTECTED]> >

(1) Better write "From:" , not "FROM:". It shouldn't matter, but some 
clients may assume the Firstletteriscap form


(2) An email address may take one of the following forms:
"Real name" <[EMAIL PROTECTED]>
[EMAIL PROTECTED] (Real Name)
[EMAIL PROTECTED]

Nesting, as you do it, is not allowed.

>  $from = '"' . $POSTED['from_name'] . '" <' . $POSTED['from_email'] . 
>'>';

Your problem here is that $POSTED['from_email'] is
"[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>" instead of
"[EMAIL PROTECTED]"


Also note that "mailto:" is a HTML-ism and has no place in mail headers!

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Google results 1-10 of about 142,000,000 for e. Search took 0.18 seconds.

- http://www.google.com/search?q=e

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Tab character

2001-02-02 Thread Christian Reiniger

On Friday 02 February 2001 12:24, Martin A. Marques wrote:

[\t is tab?]
> > > yes (depending)
> >
> > On what?
>
> It depends on the charset you use.

No. the return value of ord('\t') may differ depending on the charset, 
but '\t' itself always is a tab character :)

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Google results 1-10 of about 142,000,000 for e. Search took 0.18 seconds.

- http://www.google.com/search?q=e

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Future plans (4.1) ?

2001-02-02 Thread Christian Reiniger

On Friday 02 February 2001 14:47, Rasmus Lerdorf wrote:

> > So If possible I'd like to hear from the developers if
> > they have a TODO that includes such things for a 4.X
> > release?

> As for better OO.  I think many of the things people ask for, like
> visibility (public,private,protected) class properties, aren't actually
> features that add functionality, but more just convenience features
> that could be implemented in user space.

I disagree. Just as with strong typing (which I hope will be added to 
PHP5 (optional - see how it's planned for Perl6)), language-enforced OO 
visibility makes it possible that the *compiler* (interpreter) 
immediately catches a bug that could hide for ages otherwise.
Errare humanum est - conventions can't prevent mistakes.

> For example, you could establish a convention that said that any class
> property that starts with an _underscore should be considered a private
> property, and one would hope that your UML tool could be configured to
> understand that.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Google results 1-10 of about 142,000,000 for e. Search took 0.18 seconds.

- http://www.google.com/search?q=e

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re:What version of Linux?

2001-02-03 Thread Christian Reiniger

On Saturday 03 February 2001 04:36, John Hinsley wrote:

> > > > I want to install my personal server on a old Intel 486 machine,
> > > > 36 Mb RAM, 2 Gb HardDisk, VGA, to develop in PHP. What version of

> > Well, you'll have great trouble getting several 100k hits per day on
> > a home server, so a small machine completely suffices :)
>
> Yes, yes. But you assume that our friend wants to use the 486 box as an
> Intranet server, to run cgi and php scripts on, and punt out HTML
> documents to the rest of his network, and pretty much that alone.
>
> I simply was _not_ prepared to make that assumption, which is why I
> asked for more detail :-0

Point taken :)

> If you're going to the hastle of building a home network, you might
> consider using the more powerful machine as an all singing, all dancing
> fileserver, application server and intranet server (pick your choice)!

Well, my home server is a wimpy P90 with 48MB RAM. It serves as web 
server (all my technical docs, php website testing, more), web cache 
(WWWoffle), web filter (junkbuster), file server (nfs and samba), 
masquerading internet gateway, firewall, mail server (also processing my 
pretty big .procmailrc), print server and propably also something else :)
Ah, yes. MySQL for my php stuff also runs on it.

The only problem I have with its performance is that it's only connected 
to my other machines via 10 MBit ethernet (well, and the ram is a bit on 
the low side). The processor's limits aren't reached by a long shot.

> The 486 could be used as a Windows box connected to the server and/or
> as an X client (in which case 32Mb of RAM would be just fine).

I'd say a combination of good text editor + browser requires more 
resources than a apache+PHP+mysql in such a scenario. And don't forget 
that you have to sit in front of the development (client) box all day and 
getting a decent graphics card for a 486 is *hard*

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

A - American Association Against Acronym Abuse

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] select prob.

2001-02-03 Thread Christian Reiniger

On Saturday 03 February 2001 17:23, PHPBeginner.com wrote:

> then, why don't you instead have it NULL, like:
>
>   
> Select your country
> ---

if no "value" is specified, the text in the  field is taken as 
value, i.e. $form['country'] == "Select your country" etc

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Never doubt that a small group of thoughtful, committed people can
change the world...
Indeed, it's the only thing that ever has."

- Margaret Mead

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Querying MySQL using 'AND' / 'OR'

2001-02-03 Thread Christian Reiniger

On Saturday 03 February 2001 15:02, James, Yz wrote:

> $sql = "SELECT * FROM table
> WHERE username = '$username' AND password = '$password' AND
> site = 'theirsite' OR site = 'all'";

> So, without writing some if statements, is there any way of rewriting
> that $sql check so that it checks whether the user is an admin of
> either the individual subdirectory, or all of the sites?  Like
>
> username: foo  password: bar site: all
>
> or
>
> username: foo  password: bar site: subdirectory

Simply use brackets to specify the evaluation order:

SELECT * FROM table
 WHERE (username = '$username' AND password = '$password') AND
 (site = 'theirsite' OR site = 'all')

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Never doubt that a small group of thoughtful, committed people can
change the world...
Indeed, it's the only thing that ever has."

- Margaret Mead

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Problem compilieng PHP4

2001-02-03 Thread Christian Reiniger

On Saturday 03 February 2001 19:45, Thomas Weber wrote:

> linux/limits.h: No such file or directory
> linux/errno.h: No such file or directory
>
> Both these files are in /usr/inclue/. Why does the make not find these
> files?

You mean there are both
/usr/include/linux/limits.h
/usr/include/linux/errno.h

If not, install the kernel-headers or kernel-source package

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Never doubt that a small group of thoughtful, committed people can
change the world...
Indeed, it's the only thing that ever has."

- Margaret Mead

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] CGI vs PHP

2001-02-04 Thread Christian Reiniger

On Saturday 03 February 2001 22:03, phpLover wrote:
> I am sorry if my question is confusing. What I mean is that CGI is
> excellent in handling flat file data base, reading and writing files
> line by line, word by wor. So is PHP equally strong?

That's exactly what he meant - CGI is an interface specification, PHP is 
a programming language. You can use PHP via CGI :)

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Never doubt that a small group of thoughtful, committed people can
change the world...
Indeed, it's the only thing that ever has."

- Margaret Mead

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: Fw: [PHP] Problem compiling PHP4 Nr. 2

2001-02-04 Thread Christian Reiniger

On Saturday 03 February 2001 22:03, Thomas Weber wrote:
> I have solved the problem. But now i have another problem:
>
> Look at this screenshot: http://electic.hn.org/tunix.gif

The webserver doesn't send a proper Content-Type: Header.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Never doubt that a small group of thoughtful, committed people can
change the world...
Indeed, it's the only thing that ever has."

- Margaret Mead

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Is this a missing feature?

2001-02-04 Thread Christian Reiniger

On Sunday 04 February 2001 07:31, John Luxford wrote:

> function foo (&$hash) {
>while (list ($k, $v) = each ($hash)) {
>   echo "$k :: $v\n";
>}
> }

> // but what I want to say is something like this
>
> foo (["one" => "value", "two" => "value"]);

foo () is declared to take a reference to a variable. This only works 
with "real" variables, not the temporary ones returned from array() etc.
Modify it to
 function foo ($hash) {

and it will work

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Never doubt that a small group of thoughtful, committed people can
change the world...
Indeed, it's the only thing that ever has."

- Margaret Mead

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re:What version of Linux?

2001-02-04 Thread Christian Reiniger

On Sunday 04 February 2001 05:03, John Hinsley wrote:

> > Well, my home server is a wimpy P90 with 48MB RAM. It serves as web
> > server (all my technical docs, php website testing, more), web cache
[...]
> > else :) Ah, yes. MySQL for my php stuff also runs on it.
>
> That's pretty impressive!

Well, Linux makes it possible *cough* :)

> > The only problem I have with its performance is that it's only
> > connected to my other machines via 10 MBit ethernet (well, and the
> > ram is a bit on the low side). The processor's limits aren't reached
> > by a long shot.
>
> It'd be interesting to do some benchmarking on it. My guess (nothing
> more) is that the limitations are RAM, disk read/write speed and
> network speed in that order.

disk r/w speed isn't really an issue. If it is, it's because the machine 
doesn't have enough RAM to buffer the stuff. Network speed should be at 
the top of that list for fileserving, but for PHP stuff 10MBit is 
completely sufficient.
Processor performance *is* somehow a point for PHP - on my more complex 
pages I have script parsing times of 0.5-0.7 seconds, plus 1-1.5s for DB 
queries, output generation etc (yes, I do cache such heavy pages. just 
took that as example)

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Never doubt that a small group of thoughtful, committed people can
change the world...
Indeed, it's the only thing that ever has."

- Margaret Mead

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Is this a missing feature?

2001-02-04 Thread Christian Reiniger

On Sunday 04 February 2001 20:09, Lux wrote:

> > Now, let me tell you that somehow I agreed with you :) cause I love
> > Python way
> > of dealing with arrays, but we are in PHP, so we have to figure PHP
> > way,

> Let's make PHP our favourite language!  If another has a better
> feature, take it.

But the feature is useless :)

Let me elaborate:

You declared your function as
 function foo (&$hash)

That is you take a reference to that parameter ($hash). That's only 
useful if you want to modify that parameter in such a way that the caller 
also notices that modification.
Now if you pass an anonymous array to the function, you could modify 
that, but after your function exits that array is automatically 
destroyed, before the caller can do anything with it.

So if you don't have a good reason to use a reference in that place (I 
very much assume you don't), use normal pass-by-value. In PHP4 that's 
just as fast as pass-by-reference (read 
http://www.zend.com/zend/art/ref-count.php)


-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka", but "That's funny..."

- Isaac Asimov

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Replacing A Word in HTML page

2001-02-04 Thread Christian Reiniger

On Sunday 04 February 2001 19:23, phpLover wrote:
> Thanks for your answerm but what does eregi_replace() do?

Exactly the thing that's written in the documentation for it :)

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka", but "That's funny..."

- Isaac Asimov

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Email Selected Data

2001-02-04 Thread Christian Reiniger

On Sunday 04 February 2001 21:31, [EMAIL PROTECTED] wrote:

> for ($i=0; $i<$num_rows; $i++)
>  {
> mysql_data_seek($SQLResult, $i);
>   $array=mysql_fetch_array($SQLResult);
> $content=printf("First Name: %s\nLast Name: %s\n",$array['FirstName'],

Re-read the documentation for "printf". You want to use sprintf() here.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka", but "That's funny..."

- Isaac Asimov

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP hosting - the final frontier.

2001-02-04 Thread Christian Reiniger

On Sunday 04 February 2001 23:18, Robert Covell wrote:
> I understand your concerns, but with this type of logic this mailing
> list not not be around.  Niether would Linux, Apache, MySql or anyother
> open source tool that so many people utilize today.  We would all be on
> NT instead of Linux and using IIS with ASP instead of PHP.  Do think
> Ramsus when he started out on PHP/FI was thinking I am only one person
> I shouldn't even try to make it because the big guys are more reliable.

That's comparing apples to oranges. If all of Rasmus's computers fail 
while he's on holiday for 3 weeks, who cares? (Sorry Rasmus :)
If some machine at a hosting company shows glitches while the only admin 
is sick, things will be very bad for the hosted people/companies.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka", but "That's funny..."

- Isaac Asimov

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Is this a missing feature?

2001-02-04 Thread Christian Reiniger

On Monday 05 February 2001 00:51, Lux wrote:
> > But the feature is useless :)

> function a ($hash, $text = "") {
>$attr_text = "";
>while (list ($k, $v) = each ($hash)) {
>   $attr_text .= " $k=\"$v\"";
>}
>return "$text";
> }

> // what also doesn't work
> // echo a (array("href" => "http://www.google.com/", "target" =>
> "_blank"), "Visit Google!");

Works fine for me, sorry (php 4.0.4)


> // another example
>
> echo a ($attrs = array ("href" => "http://www.google.com/"),
>  img ($attrs = array (
>  "src" =>
> "http://www.google.com/images/title_homepage4.gif", "alt" => "Visit
> Google!",
>  "border" => "0")
>  )
> );

works, rewritten to 
echo a (array ("href" => "http://www.google.com/"),
img (array (
"src" => "http://www.google.com/images/title_homepage4.gif",
"alt" => "Visit Google!",
"border" => "0")
)
   );


> /* now ideally, this could be written much more cleanly, perhaps...
>
> echo a(['href' => [http://www.google.com/'],
>  img(['src' =>
> 'http://www.google.com/images/title_homepage4.gif', 'alt' => 'Visit
> Google!', 'border' => '0'])
> );
>
> */


So it basically boils down to "array (a => b)" versus "[a => b]"
And I personally feel the array () notation is at least as nice as the [] 
one. Well, it's a matter of taste. But it certainly isn't harder to read, 
not detrimental on cleanness and elegance of the code.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka", but "That's funny..."

- Isaac Asimov

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] attempt to use an empty IV with mcrypt

2001-02-05 Thread Christian Reiniger

On Monday 05 February 2001 06:13, [EMAIL PROTECTED] wrote:
> I get the following warning when I turn on logging...
>
>
> Warning: attempt to use an empty IV, which is NOT recommend in
> /home/local/apache/htdocs/encrypt.php on line 21
>
>
> Here is the code

and which line is Nr. 21?

> $key = "testing";
> $input = "Secret data";
>
> $encrypted_data = mcrypt_ecb (MCRYPT_DES, $key, $input,
> MCRYPT_ENCRYPT);
>
> print "The CypherText in DES ECB is ".bin2hex
> ($encrypted_data)."\n";
>
>
> $encrypted_data = mcrypt_ecb (MCRYPT_TWOFISH, $key, $input,
> MCRYPT_ENCRYPT);
>
> print "The CypherText in TWOFISH ECB is ".bin2hex
> ($encrypted_data)."\n";
>
> $encrypted_data = mcrypt_cbc (MCRYPT_TWOFISH, $key, $input,
> MCRYPT_ENCRYPT);
>
> print "The CypherText in TWOFISH CBC is ".bin2hex
> ($encrypted_data)."\n";
>
> ?>

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Pretty cool, the kind of power information technology puts in our hands
these days.

- Securityfocus on probing 3600 hosts for known problems in 3 weeks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] please help (network admin via web)

2001-02-05 Thread Christian Reiniger

On Monday 05 February 2001 08:01, niraj shah wrote:

> I am a 20 year old student doing a research project and I would like to
> have network administration via web. That is I want to change IP
> address os the system via web, want to do dns settings and also would
> like to do proxy setting via web using PHP scripts. I am working on
> RedHat 6.2 using apache as my web server.

Perhapy Webmin could help you?
http://www.webmin.com/webmin/

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Pretty cool, the kind of power information technology puts in our hands
these days.

- Securityfocus on probing 3600 hosts for known problems in 3 weeks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] manage number of rows displayed

2001-02-05 Thread Christian Reiniger

On Monday 05 February 2001 21:23, [EMAIL PROTECTED] wrote:

> After I run a query, how do I set the number of rows returned to
> display as 3 or 4 columns in a page instead of one column as usual?

Ok, I gather from this that you use some Utility X to query database Y 
(you don't do it in PHP), and now want to know how to change the settings 
of X. Correct?

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Pretty cool, the kind of power information technology puts in our hands
these days.

- Securityfocus on probing 3600 hosts for known problems in 3 weeks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Breaking up a line and using the text?

2001-02-05 Thread Christian Reiniger

On Monday 05 February 2001 13:59, jaskirat wrote:

> $string = ereg_replace(" ","\n",$string)

simpler and faster: str_replace(), explode() and split()

> >Original line
> > Hi my name is Sam Rose
> >
> >Which can then be broken down into
> > Hi
> > My
> > Names
> > is
> > Sam Rose

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka", but "That's funny..."

- Isaac Asimov

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Making a object from one class available to all objects in the calling class

2001-02-05 Thread Christian Reiniger

On Monday 05 February 2001 15:52, Stephen Maher wrote:
> Hi,
> 
> Can someone advise on the following.
> 
> class class_y
> {
> function test() {
> return "test";
> }
> }
> 
> class  class_x
> {
> function x {
> $n = new $y;
> }
> 
> function z {
> $n->test();
> }
> }
> 
> I need the object of class_y available to the other objects of classx
> but I cant figure out how I do this. Any ideas?

class class_x
{
 function x { 
 $this->n = new $y; 
 } 
  
     function z { 
 $this->n->test(); 
 } 

 var n;
} 


-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka", but "That's funny..."

- Isaac Asimov

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] include files

2001-02-05 Thread Christian Reiniger

On Monday 05 February 2001 18:15, David VanHorn wrote:

> I know this works, in footer.inc, to pull up nomenu.
> 
>
> However, is there a more "generic" way to specify the server root as
> the path? I'd rather not expose my directory structure in the PHP code.
> I tried various versions of ../ and ../../ without success.

Set the include_patz in php.ini and include everything relative to that 
path

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

(A)bort (R)etry (P)retend this never happened ...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] simple config. question

2001-02-05 Thread Christian Reiniger

On Monday 05 February 2001 20:14, Shane McBride wrote:
> Unless I am mistaken, I am pretty sure you need to have sometype of
> .php extension. Unless you could put a line in the httpd.conf file
> like: AddType application/x-httpd-php .html

Well, that's exactly the right way :)

Perhaps a more "generous" setup would be even better though:

AddType application/x-httpd-php .html .htm .php3 .php .phtml

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

(A)bort (R)etry (P)retend this never happened ...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Automating tasks in PHP?

2001-02-05 Thread Christian Reiniger

On Monday 05 February 2001 21:48, James, Yz wrote:
> Hi all.  This is, what might turn out to be a stupid question  But
> I'll ask it anyway ;)
>
> Is there any way of automating tasks in php scripts, WITHOUT having
> them open?  Ie, having some method or other to send out an email
> automatically, once a week, as a newsletter, based on data / criteria
> from a database?

Somehow this question comes up about once a day. Search the ML archives 
for "cron"

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

(A)bort (R)etry (P)retend this never happened ...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] last inserted record

2001-03-08 Thread Christian Reiniger

On Thursday 08 March 2001 06:42, you wrote:
> Assuming that you do have a primary key, how can you grab the last
> record you inserted?  Can you use @@IDENTITY, or something like that?

For that I'd add another field - type "timestamp".
In MySQL, timestamp fields are automatically set to NOW() on each insert 
and update *if* they are not set to something else in it (the insert or 
update)

Or simply add some timestamp or datetime field that you "manually" set to 
NOW() on each insert (if you don't want the date to be changed on an 
UPDATE).

> On Saturday 03 March 2001 05:16, you wrote:
> > i'm having a little bit of problems with a little mysql table i'm
> > using. the table has no primary key nor index nor nothing.
> >
> > i was wondering if it's possible to select the last inserted record
> > of a table with this characteristics.
>
> Add a primary key. now. Accesses without that will be painfully slow.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Very funny, Scotty! Now beam up my clothes...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Regex Masters: Please inspect this regex- Pulling urls out of page

2001-03-08 Thread Christian Reiniger

On Thursday 08 March 2001 09:19, you wrote:
> I'm putting together a regex to pull all of the urls out of a web page.
> Not the href tag, but just the url part of that tag.
>
> Here's what I've come up with:
>
> preg_match_all('/<.*href\s*=\s*(\"|\')?(.*?)(\s|\"|\'|>)/i', $html,
> $matches);
> foreach($matches[2] as $m) print "$m\n";
>
> All regex masters please tell me if I'm missing something. It's working
> well, but I'm still learning about perl regex and I'd like any input if
> at all possible.

Pretty good. Some minor things:
(1) "<.*href" will also match  example of 
href="hello"

(2) You're pretty lax on the tag syntax - you don't require quotes to 
match, don't require quotes at all etc

I'd rewrite it to
'/<\s*a\s*href\s*=\s*("|\')(.*?)\\1\s*>/i'

> What's a good way to exclude things like javascript: urls and other non
> URI info? I guess what I'm really looking for is all the http urls, no
> ftp, mms etc... or anything like that.

Use the following regexes on your result to get only the types you want:

$HostName = '([a-zA-Z][\w-]*(\.[a-zA-Z][\w-]*)+)';
$HostIP   = '(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})';
$Host = '(' . $HostName . '|' . $HostIP . ')';
$HTTPPath = '(([\w\.\/~\?%=\-]|&)+)';
$FTPPath  = '(\/[^\/\s]*)*\/?';
$Port = '(:\d+)?';
$HTTPURL = 'http:\/\/' . $Host . $Port . $HTTPPath;
$WWWAddress = 'www\.' . $HostName . $Port . $HTTPPath;
$FTPURL = 'ftp:\/\/' . $Host . $FTPPath;

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Very funny, Scotty! Now beam up my clothes...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] last inserted record

2001-03-08 Thread Christian Reiniger

On Thursday 08 March 2001 10:31, you wrote:

> > On Thursday 08 March 2001 06:42, you wrote:
> > > Assuming that you do have a primary key, how can you grab the last
> > > record you inserted?  Can you use @@IDENTITY, or something like
> > > that?
> >
> > For that I'd add another field - type "timestamp".
> > In MySQL, timestamp fields are automatically set to NOW() on each
> > insert and update *if* they are not set to something else in it (the
> > insert or update)
>
> I would prefer using mysql_insert_id() if possible.
> http://www.php.net/manual/en/function.mysql-insert-id.php

Which however only works (1) with autoincrement keys and (2) for the last 
insert you did using the same mysql connection, i.e. if you do an insert 
in foo.php, mysql_insert_id () won't show anything in bar.php

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Very funny, Scotty! Now beam up my clothes...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Sessions Kill all

2001-03-08 Thread Christian Reiniger

On Thursday 08 March 2001 03:45, you wrote:
> Is there a way as a server admin to kill all sessions to a site.  I
> need a way to logout all members to a site.

Well, usually you'd keep the session data in a database, so you can just 
empty the sessioninfo table.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

...1000100011010101101010110100111010113...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] need help w/ Split()

2001-03-08 Thread Christian Reiniger

On Thursday 08 March 2001 18:43, you wrote:
> I am attempting to take a line of text (a list) that has been entered
> into a form and split it into the appropriate parts, placing them into
> an array.  I am splitting the input on commas, semi-colons, and spaces.
>
> Problem 1:  Is with "white space".  If the input has spaces after a
> comma, it splits on the comma, but enters each "space" as a separate
> element of the array.
>
> Problem 2: Is with "white space" also.  If the input has just spaces
> between the appropriate parts, then it will split on the first "space",
> but enter the rest of the "spaces" as separate elements of the array.
>
> Here my code:
>   $course_list = preg_split("/[\,\;\s*]/", $input_list);

You can't put the asterisk in the character class - it's taken as literal 
asterisk in there.

try preg_split("/([\,\;]\s*)|(\s+)/", $input_list);

i.e. "either (',' or ';' eventually followed by spaces) or (at least one 
space)"

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

...1000100011010101101010110100111010113...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] weeks

2001-03-08 Thread Christian Reiniger

On Thursday 08 March 2001 18:49, you wrote:
> Anyone know offhand a way to organize the output from a query by week? 
> I'm writing a work log app and I want the admin to see everyone's work
> ordered first by lastname, and then by date.  But only want that week's
> data to show up, and maybe a dropdown with previous weeks available. 
> Don't go thinking about an answer, cuz I'm doing that, but if anyone
> already knows how to solve this problem or part of it, lemme know. 
> Thanks once again.

for MySQL add a WHERE (WEEK(yourtimefield) = WEEK(NOW()))

this will have the problem that it will show all of week X even if you're 
on 23:55 on the last day of that week

WHERE ((yourtimefield >= NOW()) AND (yourtimefield <= DATE_ADD(NOW(), 
INTERVAL 1 WEEK))

might be better

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

...1000100011010101101010110100111010113...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Sessions Kill all

2001-03-08 Thread Christian Reiniger

On Thursday 08 March 2001 07:17, you wrote:
> Does anybody know where I could get more info on storing session data
> in a database rather than the default way?

Hmm, perhaps phpbuilder.com has an article on it. Alternatively I could 
send you some of my code

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

...1000100011010101101010110100111010113...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Classes and Kernel CPU Load?

2001-03-10 Thread Christian Reiniger

On Saturday 10 March 2001 16:24, you wrote:
> I have Scripts that seem to cause imense Kernel (not user) CPU Load
> under Solaris,
> could this be caused by using classes?

That would be very strange. I rely heavily on classes, and have 
absolutely no problems with them.

> What else could cause an immense increase in Kernel CPU Load?

Try removing more stuff to narrow things down a bit.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka", but "That's funny..."

- Isaac Asimov

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] MySQL problem - stumped

2001-03-10 Thread Christian Reiniger

On Saturday 10 March 2001 19:58, you wrote:
> The following code is giving an me problems, I can't figure it out to
> save my soul.  The last line gives:
>
> Here is the code:
>
> $link = db_connect();
> $query = "UPDATE Users SET firstname='$firstname', lastname='$lastname'
> WHERE username='$user' && password='$password'";
> $result = mysql_query($query, $link);
> $err = mysql_error();
> echo "Errors:".$err;
> $rows = mysql_affected_rows($result);
>
> And here is the output:
> Errors:
> Warning: Supplied argument is not a valid MySQL-Link resource in
> //*//**..***/db.php on line 147
>
> Line 147, is the last line in the above snippet.  I cleared out the
> path name for security, no offense intended :)

This one?
> $rows = mysql_affected_rows($result);

Try
$rows = mysql_affected_rows($link);

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The use of COBOL cripples the mind; its teaching should, therefore,
be regarded as a criminal offence.

- Edsger W. Dijkstra

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




<    1   2   3   4   5   >