php-general Digest 17 Jul 2004 17:27:20 -0000 Issue 2882
Topics (messages 190812 through 190852):
Re: upload an image and store it in mysql
190812 by: Curt Zirzow
190813 by: i sidhu
190815 by: raditha dissanayake
Re: Embedded Email Directives
190814 by: Curt Zirzow
Re: PHP5 and pass by reference bug.
190816 by: Curt Zirzow
Re: "sendmail_from" not set in php.ini or custom "From:" header missing
190817 by: Justin Patrin
190818 by: Curt Zirzow
Re: PHPEclipse?
190819 by: Lester Caine
RedHat Network Up2Date
190820 by: Ed Lazor
190821 by: Jason Wong
Book Required
190822 by: Harlequin
190823 by: Will Collins
190824 by: Chris
190825 by: Will Collins
190826 by: linux.e75.com
190827 by: Michael Purdy
190829 by: Lester Caine
190831 by: raditha dissanayake
190834 by: Tularis
190837 by: Michelle Konzack
190838 by: Michelle Konzack
190842 by: rush
How can I tell if a path is absolute?
190828 by: Trejkaz Xaoza
190830 by: Michael Ochs
190832 by: Trejkaz Xaoza
190833 by: Tularis
190835 by: Trejkaz Xaoza
190836 by: Jason Barnett
190841 by: Trejkaz Xaoza
190851 by: Curt Zirzow
Re: Getting the primary key from a MySQL insert
190839 by: zareef ahmed
Re: Templates Are Driving me Nuts
190840 by: Skrol 29
190845 by: Sean Malloy
Problem Stuffing Variable Value into an E-mail
190843 by: Harlequin
190848 by: Torsten Roehr
190850 by: Harlequin
Emtying Variables
190844 by: Harlequin
190847 by: Torsten Roehr
CGI / PHP max_exec_time
190846 by: Head
190849 by: Head
190852 by: Curt Zirzow
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
* Thus wrote raditha dissanayake:
> The approach that an overwhelming majority of PHP developers (and other
> developers for that matter) use is to simply store the image on the
> file system. If these images are part of a web application you can then
> store a reference to the image in the database (ie: the filename only).
> Then all you need to do is to query the database and use the result in
> an <img src='...'> nothing could be simpler.
height and width are handy as well.
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
--- End Message ---
--- Begin Message ---
* iNder Sidhu wrotes:-
I use following query to upload the image in database
DATABASE_query_die("INSERT INTO images (`name`, `status`, `image`, `size`, `type`)
VALUES (name.gif', NULL,
0x52306c474f446c685a414179414f594141502f2f2f2f2f3238502f31372f54313976503, '1.624 kb',
'image/gif')");
0x52306c474f446c685a414179414f594141502f2f2f2f2f3238502f31372f54313976503 - This is
base64 code for ur image.
Curt Zirzow <[EMAIL PROTECTED]> wrote:
* Thus wrote raditha dissanayake:
> The approach that an overwhelming majority of PHP developers (and other
> developers for that matter) use is to simply store the image on the
> file system. If these images are part of a web application you can then
> store a reference to the image in the database (ie: the filename only).
> Then all you need to do is to query the database and use the result in
> an nothing could be simpler.
height and width are handy as well.
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
---------------------------------
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
--- End Message ---
--- Begin Message ---
i sidhu wrote:
* iNder Sidhu wrotes:-
I use following query to upload the image in database
DATABASE_query_die("INSERT INTO images (`name`, `status`, `image`, `size`, `type`) VALUES
(name.gif', NULL, 0x52306c474f446c685a414179414f594141502f2f2f2f2f3238502f31372f54313976503,
'1.624 kb', 'image/gif')");
0x52306c474f446c685a414179414f594141502f2f2f2f2f3238502f31372f54313976503 - This is base64 code for ur image.
Hate to say it but this is another step in the wrong direction. Base64
encoding makes the data about 30% bigger not to mention the associated
overheadds of encoding and decoding.
--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--- End Message ---
--- Begin Message ---
* Thus wrote Manuel Lemos:
> Hello,
>
> On 07/16/2004 10:49 PM, Curt Zirzow wrote:
> >>>>remove carriage returns to prevent embedded email directives
> >>>
> >>>In an other thread, I readed that sentence. I'm interested to find more
> >>>information about that. I have some mail forms and want to make them as
> >>>secure and possible, but do not know about what and where should I
> >>>filter.
> >>>
> >>>Should I filter all CR and LF Just in headers or also I should do that
> >>>in the message body? (Which is sent in the SMTP DATA section).
> >>
> >>For SMTP, all lines should be ended with CR+LF, or else messages may be
> >>discarded by spam filters or other programs. However, if you use the
> >>mail() function it may do some filtering on its own.
> >
> >
> >The mail() function does not do any filtering.
>
> Read the source first to learn more about it.
I have read it, and am very familiar with it.
Every time there is a post about mail() and the person is
unfamiliar with properly sending SMTP headers or data to sendmail,
You *claim* its a bug with php's mail() call without knowing
what version of php they are using. You never ask if they are using
windows which uses php's built in sendmail tool. Nor do you never
ask what MTA that sendmail is really representing.
My reponses to you're email's are not targeted against you, but
simply correcting the facts as of current.
As far as what filtering is going on, please enlighten me, this is
the logic of the mail function:
trim leading space and make To: rfc822 compliant
trim leading space and make Subject: rfc822 compliant
open pipe to sendmail
send the To: address
send the Subject:
if headers was sepecified, send those as well
send the message.
close the pipe to sendmail.
Now I do wonder where in the world filtering is going on there.
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
--- End Message ---
--- Begin Message ---
* Thus wrote Daevid Vincent:
> Yeah, I get what references are. The point is that when it was on the user
> to decide, they could do it. Now that PHP5 makes you put the & in the
> function declaration instead of the passing parameter, you don't know what
> the user is going to send. Therefore it renders the & in the function
> declaration a useless thing.
>
> I could have this function
>
> Function add (&$a, &$b)
> {
> return ($a + $b);
> }
>
> And as a user I could use it like so:
>
> $x = 5;
> $y = 10;
> add($x, $y);
>
> Or I could also use it like this:
>
> add(5,10);
>
> But since the function is now responsible in PHP5 to use the & [since
> passing add(&$x, &$y); is now invalid], it makes my function add basically
> useless.
The only time you should pass by reference is when you plan on
modifiying that variable and the caller is going to get a modified
version back:
function foo(&$modify_me) {
$modify_me = 'another value';
}
foo($var);
// var contains now 'another value'
Otherwise, always declare your functions as normal variables.
Or for your example, you provided, that would mean that in your
original code you had called your functions as:
add(&5, &10);
Which is obviosly wrong, so going that route wont really work.
If you're concerned about memory usage, like why do I need to
duplicate memory if I'm just passing variables that will just
simply be read. Well, PHP takes that pretty much into
consideration. And the only time a duplicate is created is when you
modify the variable.
If for example you have:
$var = 'a really long string....';
And you assign that variable to something else:
$var2 = $var;
PHP doesn't allocate all the memory of var for that var2 until
you try to modify the $var2. So not until you do something like:
$var2 .= 'some more text';
PHP then will make a copy of the original $var, and then make
modifications.
The same principle applies to function parameters.
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
--- End Message ---
--- Begin Message ---
On Sat, 17 Jul 2004 12:16:25 +0800, Wudi <[EMAIL PROTECTED]> wrote:
> Script:
> <?php
> mail('[EMAIL PROTECTED]', 'Subject', 'Message', "From: [EMAIL PROTECTED]");
> ?>
>
> Result:
> Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom
> "From:" header missing in D:\ApacheData\htdocs\downloader\mail.php on line 2
>
> Why does the mail() not work?
> How can I send a e-mail without SMTP?
No idea why it doesn't like your From header. Try setting
sendmail_from in the php.ini. You could also try a mailing library,
such as:
http://pear.php.net/package/Mail
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--
--- End Message ---
--- Begin Message ---
* Thus wrote Wudi:
> Script:
> <?php
> mail('[EMAIL PROTECTED]', 'Subject', 'Message', "From: [EMAIL PROTECTED]");
> ?>
>
> Result:
> Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom
> "From:" header missing in D:\ApacheData\htdocs\downloader\mail.php on line 2
>
> Why does the mail() not work?
> How can I send a e-mail without SMTP?
sendmail_from is required to be filled out. You need to specify in
your ini a valid sendmail_from, or use ini_set('sendmail_from',
'[EMAIL PROTECTED]') before your call your mail() function
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
--- End Message ---
--- Begin Message ---
Dan Joseph wrote:
I was wondering, is anyone running Eclipse 3.0 w/PHPEclipse 1.1.0?
I'm having trouble getting it working. I downloaded the July .ZIP file and
unzipped it into the plugins directory. Its not recognizing it. Anyone
have this working?
I have some success with PHPEclipse on Windows, even with PHP5, but it
is still work in progress, so some niggles are to be expected.
That said, the more people who try it out and identify problems, the
quicker it will become more stable ?
As David has said, a rogue zip did get out, and that seems to be still
accessible on some mirrors, so the next snapshot could be worth waiting for.
--
Lester Caine
-----------------------------
L.S.Caine Electronic Services
--- End Message ---
--- Begin Message ---
Is the RedHat Network Up2Date really only on version 4.3.2 of PHP? If so,
any idea why they're so far behind? Any idea of when it will be brought
current?
I have an ISP telling me that the security of their systems rely entirely on
the RedHat Network. They acknowledge that RedHat's behind and that their
security is compromised. It's silly, but they seem to just sit there
blaming RedHat rather than doing anything to protect their customers.
-Ed
--- End Message ---
--- Begin Message ---
On Saturday 17 July 2004 15:01, Ed Lazor wrote:
> Is the RedHat Network Up2Date really only on version 4.3.2 of PHP? If so,
> any idea why they're so far behind? Any idea of when it will be brought
> current?
>
> I have an ISP telling me that the security of their systems rely entirely
> on the RedHat Network. They acknowledge that RedHat's behind and that
> their security is compromised. It's silly, but they seem to just sit there
> blaming RedHat rather than doing anything to protect their customers.
RedHat usually backports majority security fixes to their currently supported
distribution(s). Anyway questions such as these ought to be asked on a RedHat
list.
If you want the latest PHP then compile your own and don't use RedHat's.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Death is God's way of telling you not to be such a wise guy.
*/
--- End Message ---
--- Begin Message ---
Morning
There's loads and loads of books available on the subject of PHP & MySQL.
Does anyone have any recommendations...?
--
-----------------------------
Michael Mason
Arras People
www.arraspeople.co.uk
-----------------------------
--- End Message ---
--- Begin Message ---
PHP & MySQL Web Development is a pretty good one. It does a good job of
giving a fairly thorough explanation on things, considering the broad range
of topics to be covered. I never have really been a fan of the "Fast and
Easy... " series, or the "Learn * In 24 Hours" series.
Will
-----Original Message-----
From: Harlequin [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 17, 2004 2:17 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Book Required
Morning
There's loads and loads of books available on the subject of PHP & MySQL.
Does anyone have any recommendations...?
--
-----------------------------
Michael Mason
Arras People
www.arraspeople.co.uk
-----------------------------
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Harlequin wrote:
Morning
There's loads and loads of books available on the subject of PHP & MySQL.
Does anyone have any recommendations...?
PHP and MySQL Web Development by Luke Welling and Laura Thomson has
always been my favorite.
http://www.samspublishing.com/title/067232525X
That's the 2nd edition (3rd is coming out in October). I have the 1st
edition, I would assume the 2nd and 3rd would be just as well written.
Chris
--- End Message ---
--- Begin Message ---
I apologize for requesting a read receipt. Won't happen again - I hope. :)
-----Original Message-----
From: Will Collins [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 17, 2004 2:27 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Book Required
PHP & MySQL Web Development is a pretty good one. It does a good job of
giving a fairly thorough explanation on things, considering the broad range
of topics to be covered. I never have really been a fan of the "Fast and
Easy... " series, or the "Learn * In 24 Hours" series.
Will
-----Original Message-----
From: Harlequin [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 17, 2004 2:17 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Book Required
Morning
There's loads and loads of books available on the subject of PHP & MySQL.
Does anyone have any recommendations...?
--
-----------------------------
Michael Mason
Arras People
www.arraspeople.co.uk
-----------------------------
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I agree that PHP & MySQL Web Development (By Luke Welling and Laura
Thompson) is a great resource for learning PHP. Armed with that book
and the online PHP manual (with user comments), and you're on your way
to being a well-informed developer.
The second edition (2003) covers PHP 4.3, so it's still quite useful...
I'm pretty sure the third edition will be written to cover 5.0.
Dan
Will Collins wrote:
I apologize for requesting a read receipt. Won't happen again - I hope. :)
-----Original Message-----
From: Will Collins [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 17, 2004 2:27 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Book Required
PHP & MySQL Web Development is a pretty good one. It does a good job of
giving a fairly thorough explanation on things, considering the broad range
of topics to be covered. I never have really been a fan of the "Fast and
Easy... " series, or the "Learn * In 24 Hours" series.
Will
-----Original Message-----
From: Harlequin [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 17, 2004 2:17 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Book Required
Morning
There's loads and loads of books available on the subject of PHP & MySQL.
Does anyone have any recommendations...?
--- End Message ---
--- Begin Message ---
Michael
Your right there is a wide selection available and as such you need to select based on
your particular development slant.
PHP and Mysql Web Development ISBN 0-672-32525-X 2nd Edition by Welling & Thomson is a
good general text.
Did you solve your table results printing question?
Mike
Melb.au
--- End Message ---
--- Begin Message ---
Harlequin wrote:
There's loads and loads of books available on the subject of PHP & MySQL.
It would be nice to find one's that DON'T rely on MySQL ;)
Does anyone have any recommendations...?
Anybody seen a good NON MySQL one.
--
Lester Caine
-----------------------------
L.S.Caine Electronic Services
--- End Message ---
--- Begin Message ---
Lester Caine wrote:
Harlequin wrote:
There's loads and loads of books available on the subject of PHP &
MySQL.
It would be nice to find one's that DON'T rely on MySQL ;)
Does anyone have any recommendations...?
Anybody seen a good NON MySQL one.
Very true it's time to change partners, php's current partner does not
seem to love php all that much.
--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--- End Message ---
--- Begin Message ---
Programming PHP by O`Reilly :)
Lester Caine wrote:
Harlequin wrote:
There's loads and loads of books available on the subject of PHP & MySQL.
It would be nice to find one's that DON'T rely on MySQL ;)
Does anyone have any recommendations...?
Anybody seen a good NON MySQL one.
--- End Message ---
--- Begin Message ---
Am 2004-07-17 08:16:36, schrieb Harlequin:
>Morning
>
>There's loads and loads of books available on the subject of PHP & MySQL.
>
>Does anyone have any recommendations...?
I can recommend Books from O'Reily
Programming PHP
The second book I use is
Practical PostgreSQL
But there is a book for MySQL tooo.
Greetings
Michelle
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/3/88452356 67100 Strasbourg/France IRC #Debian (irc.icq.com)
signature.pgp
Description: Digital signature
--- End Message ---
--- Begin Message ---
Am 2004-07-17 09:29:37, schrieb Lester Caine:
>Harlequin wrote:
>
>>There's loads and loads of books available on the subject of PHP & MySQL.
>
>It would be nice to find one's that DON'T rely on MySQL ;)
O'Reilly: Programming PHP
Practical PostgreSQL
>Anybody seen a good NON MySQL one.
:-)
>Lester Caine
Greetings
Michelle
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/3/88452356 67100 Strasbourg/France IRC #Debian (irc.icq.com)
signature.pgp
Description: Digital signature
--- End Message ---
--- Begin Message ---
"Harlequin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> There's loads and loads of books available on the subject of PHP & MySQL.
>
> Does anyone have any recommendations...?
here are some:
http://www.templatetamer.org/index.php?RecommendedBooks
rush
--
http://www.templatetamer.com/
--- End Message ---
--- Begin Message ---
Hi!
I used to detect whether a path is absolute by seeing if the first character
is a forward slash.
Unfortunately, Windows absolute paths are in a different syntax like "C:\",
and I don't know what other random systems might have for their syntax in
the future.
So, is there a portable way to tell if a path is absolute or not? I thought
about comparing the start of the path with realpath('/'), but this only
works if the path starts with "C:" and fails for "D:" and other drives.
TX
--
'Every sufficiently advanced technology is indistinguishable from magic' -
Arthur C Clarke
'Every sufficiently advanced magic is indistinguishable from technology' -
Tom Graves
Email: Trejkaz Xaoza <[EMAIL PROTECTED]>
Web site: http://xaoza.net/trejkaz/
Jabber ID: [EMAIL PROTECTED]
GPG Fingerprint: 9EEB 97D7 8F7B 7977 F39F A62C B8C7 BC8B 037E EA73
--- End Message ---
--- Begin Message ---
Hi,
maybe you could try it with regular expressions! "[A-Z]:\\" or better
"[C-Z]:\\" because A and B is used just for floppy drives...
Take a look at www.php.net/preg_match/
Bye, Michael
"Trejkaz Xaoza" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Hi!
>
> I used to detect whether a path is absolute by seeing if the first
character
> is a forward slash.
>
> Unfortunately, Windows absolute paths are in a different syntax like
"C:\",
> and I don't know what other random systems might have for their syntax in
> the future.
>
> So, is there a portable way to tell if a path is absolute or not? I
thought
> about comparing the start of the path with realpath('/'), but this only
> works if the path starts with "C:" and fails for "D:" and other drives.
>
> TX
>
> --
> 'Every sufficiently advanced technology is indistinguishable from magic' -
> Arthur C Clarke
> 'Every sufficiently advanced magic is indistinguishable from technology' -
> Tom Graves
>
> Email: Trejkaz Xaoza <[EMAIL PROTECTED]>
> Web site: http://xaoza.net/trejkaz/
> Jabber ID: [EMAIL PROTECTED]
> GPG Fingerprint: 9EEB 97D7 8F7B 7977 F39F A62C B8C7 BC8B 037E EA73
--- End Message ---
--- Begin Message ---
Michael Ochs wrote:
> Hi,
> maybe you could try it with regular expressions! "[A-Z]:\\" or better
> "[C-Z]:\\" because A and B is used just for floppy drives...
> Take a look at www.php.net/preg_match/
I'm not sure if you noticed, but I said I wanted it to be portable.
Sure, "([A-Za-z]:)?[/\\]" would work to some extent, but would it work
perfectly? As far as I can tell, the path "C:/" is _relative_ on Linux and
BSD. Am I wrong?
TX
--
'Every sufficiently advanced technology is indistinguishable from magic' -
Arthur C Clarke
'Every sufficiently advanced magic is indistinguishable from technology' -
Tom Graves
Email: Trejkaz Xaoza <[EMAIL PROTECTED]>
Web site: http://xaoza.net/trejkaz/
Jabber ID: [EMAIL PROTECTED]
GPG Fingerprint: 9EEB 97D7 8F7B 7977 F39F A62C B8C7 BC8B 037E EA73
--- End Message ---
--- Begin Message ---
Trejkaz Xaoza wrote:
Michael Ochs wrote:
Hi,
maybe you could try it with regular expressions! "[A-Z]:\\" or better
"[C-Z]:\\" because A and B is used just for floppy drives...
Take a look at www.php.net/preg_match/
I'm not sure if you noticed, but I said I wanted it to be portable.
Sure, "([A-Za-z]:)?[/\\]" would work to some extent, but would it work
perfectly? As far as I can tell, the path "C:/" is _relative_ on Linux and
BSD. Am I wrong?
TX
c:/ wouldn't even work as a path on unix systems. I don't know how paths
look on MacOS systems, so can't help you with that. However, after
removing the [a-z]: part of the path, you're stuck with an abosulute
path that is of the same type as in Unix. In Unix systems absolute paths
start with a forward-slash (eg. /usr/local or /home/me/, etc). After
removing the c: from eg. c:/this/and/that, you're left with
/this/and/that which looks pretty much the same :)
--- End Message ---
--- Begin Message ---
Tularis wrote:
> c:/ wouldn't even work as a path on unix systems.
[134] [EMAIL PROTECTED]:/tmp> mkdir c:
[135] [EMAIL PROTECTED]:/tmp> ls -la c:/
total 8
drwxr-xr-x 2 trejkaz users 4096 Jul 17 21:01 .
drwxrwxrwt 52 root root 4096 Jul 17 21:01 ..
You were saying?
Anyway it's looking a lot like I'll have to detect the Win32 build of PHP
at runtime, and choose the method based on that. All because PHP doesn't
have an is_absolute function or anything similarly convenient. :-/
TX
--
'Every sufficiently advanced technology is indistinguishable from magic' -
Arthur C Clarke
'Every sufficiently advanced magic is indistinguishable from technology' -
Tom Graves
Email: Trejkaz Xaoza <[EMAIL PROTECTED]>
Web site: http://xaoza.net/trejkaz/
Jabber ID: [EMAIL PROTECTED]
GPG Fingerprint: 9EEB 97D7 8F7B 7977 F39F A62C B8C7 BC8B 037E EA73
--- End Message ---
--- Begin Message ---
Anyway it's looking a lot like I'll have to detect the Win32 build of PHP
at runtime, and choose the method based on that. All because PHP doesn't
have an is_absolute function or anything similarly convenient. :-/
TX
Ahhhh, methinks I have a competitor for a FileSystem Manager :) Perhaps I
misunderstand your problem, but this works fine for me (WinXP) because realpath
[quote]Returns canonicalized absolute pathname[/quote]:
<?php
// we know __FILE__ is an absolute path
$file = __FILE__;
echo realpath(__FILE__) == $file ? 'The same path' : 'Not the same path';
?>
http://www.php.net/realpath
--- End Message ---
--- Begin Message ---
Jason Barnett wrote:
> Ahhhh, methinks I have a competitor for a FileSystem Manager :) Perhaps I
> misunderstand your problem, but this works fine for me (WinXP) because
> realpath
> [quote]Returns canonicalized absolute pathname[/quote]:
>
> <?php
>
> // we know __FILE__ is an absolute path
> $file = __FILE__;
> echo realpath(__FILE__) == $file ? 'The same path' : 'Not the same path';
>
> ?>
>
> http://www.php.net/realpath
That works because the value in __FILE__ seems to be both canonicalised and
absolute.
For an example which breaks, realpath('/home') on my server returns
'/usr/home', so your example would claim that /home is not absolute. Yet,
it is. :-/
TX
--
'Every sufficiently advanced technology is indistinguishable from magic' -
Arthur C Clarke
'Every sufficiently advanced magic is indistinguishable from technology' -
Tom Graves
Email: Trejkaz Xaoza <[EMAIL PROTECTED]>
Web site: http://xaoza.net/trejkaz/
Jabber ID: [EMAIL PROTECTED]
GPG Fingerprint: 9EEB 97D7 8F7B 7977 F39F A62C B8C7 BC8B 037E EA73
--- End Message ---
--- Begin Message ---
* Thus wrote Trejkaz Xaoza:
> Jason Barnett wrote:
> > Ahhhh, methinks I have a competitor for a FileSystem Manager :) Perhaps I
> > misunderstand your problem, but this works fine for me (WinXP) because
> > realpath
> > [quote]Returns canonicalized absolute pathname[/quote]:
> >
> > <?php
> >
> > // we know __FILE__ is an absolute path
> > $file = __FILE__;
> > echo realpath(__FILE__) == $file ? 'The same path' : 'Not the same path';
> >
> > ?>
> >
> > http://www.php.net/realpath
>
> That works because the value in __FILE__ seems to be both canonicalised and
> absolute.
>
> For an example which breaks, realpath('/home') on my server returns
> '/usr/home', so your example would claim that /home is not absolute. Yet,
> it is. :-/
A simple workaround is testing OS:
if (windows)
// use realpath method
} else {
$absolute = $path{0} == '/';
}
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
--- End Message ---
--- Begin Message ---
Hi !
You can user mysql_insert_id() for this purpose.
zareef ahmed
--- Andrew Wood <[EMAIL PROTECTED]> wrote:
> If the primary key in a MySQL DB is an
> autoincrementing integer, is
> there anyway of automatically getting it back when I
> do an insert in
> PHP. In other words taking the status returned by
> mysql_query and
> extracting the PK of the record we just entered?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
=====
Zareef Ahmed :: A PHP Developer in Delhi(India).
Homepage :: http://www.zasaifi.com
__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/
--- End Message ---
--- Begin Message ---
Hello,
Here is a shema to explain Template Engines:
http://www.tinybutstrong.com/index.php?page=template
Some developers complain about Template Engines because they are too complex
or because they are a kind of new language over PHP. The one you will found
on the URL above is expected to be different.
-------------------
Skrol 29
www.skrol29.com
www.tinybutstrong.com
-------------------
"Ee" <[EMAIL PROTECTED]> a �crit dans le message de
news:[EMAIL PROTECTED]
> Dears,
>
> Please help. This template thing is driving my nuts. I though maybe when
> I read more articles things will clear up; however, things got even
> worse. Every article writer has a different idea. Can anyone explain to
> me what are Templates for? What are the advantages of using them? If I
> use a third party template, will my site have a different look or is it
> only a parser that will take my designed template and data and combine
> them. I really don't know.
--- End Message ---
--- Begin Message ---
The template system I use is extremely simple.
Template.php:
<?php
class Template
{
var $Items;
var $_document;
function Template($document)
{
$this->Items = array();
$this->_document = $document;
}
function Render()
{
echo $this->ToString();
}
function ToString()
{
$template = $this->Items;
ob_start();
require($this->_document);
return ob_get_clean();
}
}
?>
and to use it?
templates/index.html:
<html>
<head></head>
<body>
Hello <?=$template['name']?>, it is currently <?=$template['time']?>
</body>
</html>
index.php:
<?php
include_once('Template.php');
$template = new Template('./templates/index.html');
$template->Items['name'] = 'User';
$template->Items['time'] = date('d M Y', time());
$template->Render();
?>
why use it?
Because you keep your html and your php code separate. That is the
goal when using any templating system.
--- End Message ---
--- Begin Message ---
I've generated a page where the user selects and completes a form. One of
these is a free text area with the name "TXT_Question". this is used later
as "$Question = $_Post['TXT_Question'];" but for some reason when I send
this in an e-mail like so:
\nUser has selected eventID:\t$EventID
\nAnd their question is:\t$Question
Nothing gets posted.
Any ideas...?
The form is located at:
http://www.arrasresources.co.uk/pmoclinic/
--
-----------------------------
Michael Mason
Arras People
www.arraspeople.co.uk
-----------------------------
--- End Message ---
--- Begin Message ---
"Harlequin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I've generated a page where the user selects and completes a form. One of
> these is a free text area with the name "TXT_Question". this is used later
> as "$Question = $_Post['TXT_Question'];"
Shouldn't this be $_POST['TXT_Question'] (upper case)?
> but for some reason when I send
> this in an e-mail like so:
>
> \nUser has selected eventID:\t$EventID
> \nAnd their question is:\t$Question
>
> Nothing gets posted.
Why should it be posted? You wrote that you wanted to send the data in an
email.
>
> Any ideas...?
>
> The form is located at:
> http://www.arrasresources.co.uk/pmoclinic/
Regards, Torsten Roehr
--- End Message ---
--- Begin Message ---
yeah.
I should have noticed that. Thanks again Torsten :)
--
-----------------------------
Michael Mason
Arras People
www.arraspeople.co.uk
-----------------------------
"Torsten Roehr" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "Harlequin" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > I've generated a page where the user selects and completes a form. One
of
> > these is a free text area with the name "TXT_Question". this is used
later
> > as "$Question = $_Post['TXT_Question'];"
>
> Shouldn't this be $_POST['TXT_Question'] (upper case)?
>
> > but for some reason when I send
> > this in an e-mail like so:
> >
> > \nUser has selected eventID:\t$EventID
> > \nAnd their question is:\t$Question
> >
> > Nothing gets posted.
>
> Why should it be posted? You wrote that you wanted to send the data in an
> email.
>
> >
> > Any ideas...?
> >
> > The form is located at:
> > http://www.arrasresources.co.uk/pmoclinic/
>
> Regards, Torsten Roehr
--- End Message ---
--- Begin Message ---
What's the best way of emptying my variables once my form has done with them
because although I disconnect from the database if the user refreshes the
screen it sends another e-mail to me.
--
-----------------------------
Michael Mason
Arras People
www.arraspeople.co.uk
-----------------------------
--- End Message ---
--- Begin Message ---
"Harlequin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> What's the best way of emptying my variables once my form has done with
them
> because although I disconnect from the database if the user refreshes the
> screen it sends another e-mail to me.
Even when you reset all variables on the page (e.g. with $_POST = array())
the user can always refresh and therefore re-submit your form.
To avoid this you could do a redirect after processing the form:
// process form here
header('location: ' . $_SERVER['PHP_SELF']); exit;
Of course then you will have to pass any notices for the user via get (or
store it in a session variable).
Hope this helps.
Regards, Torsten Roehr
--- End Message ---
--- Begin Message ---
hello list,
im running a php script from CLI/CGI on linux which has a variable execution
time, some times it doesnt terminates by itself so i have to set a
max_execution_time to terminate the script. My problem is that the
max_exec_time on CGI versions is always 0 (never time out) which produces
zombie php prozesses.
any help/sugesstions ?
thanks - Head
--- End Message ---
--- Begin Message ---
mh i tracked the bug down to be an FOPEN on a URL so i need to set a timeout
on FOPEN hows that possible ? Using php version 4.3.7
"Head" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> hello list,
>
> im running a php script from CLI/CGI on linux which has a variable
execution
> time, some times it doesnt terminates by itself so i have to set a
> max_execution_time to terminate the script. My problem is that the
> max_exec_time on CGI versions is always 0 (never time out) which produces
> zombie php prozesses.
>
> any help/sugesstions ?
>
> thanks - Head
--- End Message ---
--- Begin Message ---
* Thus wrote Head:
> mh i tracked the bug down to be an FOPEN on a URL so i need to set a timeout
> on FOPEN hows that possible ? Using php version 4.3.7
see:
http://php.net/stream_set_timeout
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
--- End Message ---