php-general Digest 18 Jul 2004 05:31:12 -0000 Issue 2883

Topics (messages 190853 through 190881):

Re: RedHat Network Up2Date
        190853 by: Curt Zirzow
        190873 by: Jason Wong

Re: Book Required
        190854 by: Lester Caine
        190856 by: Josh Close
        190858 by: janet.valade.com

Re: if((strtolower(substr($author, 0, 1)) == $ausenquiry))
        190855 by: Skippy

building php to have mysqli support...
        190857 by: bruce
        190859 by: Thomas Seifert
        190879 by: bruce

Re: Emtying Variables
        190860 by: PHP
        190869 by: Trejkaz Xaoza

Is "Function Constants" the Correct Term?
        190861 by: gohaku
        190862 by: Curt Zirzow
        190863 by: John W. Holmes

php.net like doc pages
        190864 by: \[php\]Walter
        190865 by: Justin Patrin
        190874 by: Ed Lazor

Compare two TXT files
        190866 by: C.F. Scheidecker Antunes
        190868 by: Paul Chvostek
        190870 by: Justin Patrin
        190871 by: raditha dissanayake

Re: How can I tell if a path is absolute?
        190867 by: Trejkaz Xaoza

Re: Embedded Email Directives
        190872 by: Manuel Lemos

php 5 rpm spec file?
        190875 by: bclem.imaginative-enterprises.com

easiest way to CREATE XML with PHP5?
        190876 by: CD Baby
        190877 by: Robert Cummings
        190878 by: Manuel Lemos

old guy newbie needs some help
        190880 by: Bob Imperial
        190881 by: bruce

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 Jason Wong:
> 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.

I dont know what is more evil.. backports or Microsoft :)



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 Sunday 18 July 2004 01:42, Curt Zirzow wrote:

> I dont know what is more evil.. backports or Microsoft :)

No contest, M$, hands down.

-- 
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
------------------------------------------
/*
Sex has no calories
                -- Murphy's Laws on Sex n4
*/

--- End Message ---
--- Begin Message ---
Tularis wrote:

Programming PHP by O`Reilly :)

Write-up says it STILL uses MySQL as it's database material ;(

Since I'm pushing PHP5 into all new sites, I'll wait for a PHP5 book :)

The Firebird Bible ( which has taken two years to write ) is being printed at the moment and should be out by next month - not sure how much of the PHP chapters actually made it in the final manuscript.

--
Lester Caine
-----------------------------
L.S.Caine Electronic Services

--- End Message ---
--- Begin Message ---
Here's a php5 book, and there's a few others.

http://www.oreilly.com/catalog/learnphp5/index.html


On Sat, 17 Jul 2004 19:28:37 +0100, Lester Caine <[EMAIL PROTECTED]> wrote:
> Tularis wrote:
> 
> > Programming PHP by O`Reilly :)
> 
> Write-up says it STILL uses MySQL as it's database material ;(
> 
> Since I'm pushing PHP5 into all new sites, I'll wait for a PHP5 book :)
> 
> The Firebird Bible ( which has taken two years to write ) is being
> printed at the moment and should be out by next month - not sure how
> much of the PHP chapters actually made it in the final manuscript.
> 
> 
> 
> --
> Lester Caine
> -----------------------------
> L.S.Caine Electronic Services
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
-Josh

--- End Message ---
--- Begin Message ---
In a message dated 7/17/2004 11:25:41 AM Pacific Daylight Time,
[EMAIL PROTECTED] writes:

>Tularis wrote:

>> Programming PHP by O`Reilly :)

>Write-up says it STILL uses MySQL as it's database material ;(

I don't know what Write-up you are refering to. The book is not tied to
MySQL. It mentions it only as one of the many databases that PHP supports.
The examples that I see, unless I missed something, on accessing a database
from PHP use PEAR DB. So, I think this Write-up is misleading.

Programming PHP an excellent book.

It's not clear to me what you mean by NON MYSQL books, so I don't know what
to recommend. There are other books that teach PHP without focusing on MySQL.
 For instance, Core PHP programming has chapters for several different
databases. PHP Developer's Cookbook shows how to make your programs database
independent. PHP cookbook mainly shows database access using PEAR DB. PHP
Bible focuses on MySQL and Oracle when showing how to write scripts for
database use. There are others. 

>Since I'm pushing PHP5 into all new sites, I'll wait for a PHP5 book :)

There are PHP 5 books available now. Already. For instance, Learning PHP 5 by
Sklar and PHP 5 Fast and Easy Web Development by Meloni. Core PHP programming
discusses PHP 5. And others. More PHP 5 books are due any day that you can
pre-order at Amazon or elsewhere. 

If you are looking for a PHP 5 non-MySQL book, PHP 5 for Dummies is available
now and is not focused on MySQL. It has examples in the database access
chapter from MySQL, Oracle, PostgreSQL, and others. And shows how to use PEAR
DB. 

Janet 


--------------------------------
Janet Valade
Author, PHP 5 for Dummies
PHP & MySQL for Dummies

--- End Message ---
--- Begin Message ---
On Mon, 12 Jul 2004 15:22:05 -0400 John Taylor-Johnston
<[EMAIL PROTECTED]> wrote:
> So how would I recode $ausenquiry so if ausenquiry=e, it will choose words
> that begin with "e", "é" sorted this way:

Before the actual sort, use strtr() with a translation array on a copy of the
string. Use the strtr() to transform all occurances of similar characters to
only one ie. "é" becomes "e". Then you can search for "e" and it will match.

If you have special characters in the search string too, use the translation
for it as well. Basically, it's all about bringing the strings you work with
to a common denominator.

-- 
Skippy - Romanian Web Developers - http://ROWD.ORG

--- End Message ---
--- Begin Message ---
hi...

i'm trying to upgrade/install php-4.3.8 to include mysqli support. i'm
running on a rh8.0 linux with mysql-4.x.

i used the php-4.3.8 src rpm, and built using the following config

./configure  --with-apxs2=/usr/sbin/apxs --with-config-file-path=/etc --with
-mysql  --with-mysqli=/usr/bin/mysql_config --with-ldap --with-pgsql

i then used the following commands..

make clean
./configure
make
make install

everything seemed to go ok, as everything appeared to run to completion and
i didn't see any errors... i do appear to have created a new libphp4.so....

however, when i look in the php-dist.ini it has no mention of "mysqli"...

so my question, have i screwed up somewhere?? or am i just looking for the
php.ini file in the wrong location.

has anybody managed to get php to work so you can actually use both
mysql/mysqli???

pointers/criticisms/assistance is greatly appreciated! searching through
google/php.net/etc.. hasn't turned up information on where i've gone wrong.

thanks..

-bruce

--- End Message ---
--- Begin Message ---
On Sat, 17 Jul 2004 13:11:41 -0700, Bruce wrote:

> has anybody managed to get php to work so you can actually use both
> mysql/mysqli???
> 
> pointers/criticisms/assistance is greatly appreciated! searching through
> google/php.net/etc.. hasn't turned up information on where i've gone wrong.
> 
> thanks..
> 
> -bruce

the docs say its for mysql-4.1.x and higher (you probably have
mysql-4.0.x) 
http://de.php.net/mysqli
also I think its php5 only.


thomas

--- End Message ---
--- Begin Message ---
hi...

after further reading/screams... it appears that only php-5.0.0 supports the
"mysqli" interface. however, there appear to be numerous issues/problems
with getting this up/running.

my setup.
i have rh8.0 linux, with php-5.0.0 source.

i'm trying to build from souce, to do the configure/make/make install.

i have tried the following configure statements... they all seem to go
through the process with no error....

./configure  --with-apxs2=/usr/sbin/apxs --with-config-file-path=/etc --with
-mysql=/usr  --with-mysqli=/usr/bin/mysql_config --with-ldap --with-pgsql


./configure  --with-config-file-path=/etc --with-mysql=/usr/local/mysql  --w
ith-mysqli=/usr/local/mysql/bin/mysql_config --with-apxs2=/usr/sbin/apxs --w
ith-ldap --with-pgsql


./configure  --disable-all --with-pcre-regex --with-config-file-path=/etc --
with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config 
--with-apxs2=/usr/sbin/apxs --with-ldap --with-pgsql


./configure  --with-config-file-path=/etc --with-mysql=/usr/local/mysql  --w
ith-mysqli=/usr/local/mysql/bin/mysql_config --with-ldap --with-pgsql


after each configure step, i then did a "make clean", followed by a "make".
never have been able to get the "make" to work...

in fact it dies with the following errors...

gcc  -Iext/mysqli/ -I/usr/src/php-5.0.0/ext/mysqli/ -DPHP_ATOM_INC -I/usr/sr
c/php-5.0.0/include -I/usr/src/php-5.0.0/main -I/usr/src/php-5.0.0 -I/usr/sr
c/php-5.0.0/Zend -I/usr/include/libxml2 -I/usr/local/mysql/include  -I/usr/s
rc/php-5.0.0/TSRM  -g -O2  -c /usr/src/php-5.0.0/ext/mysqli/mysqli.c -o
ext/mysqli/mysqli.o  && echo > ext/mysqli/mysqli.lo
In file included from /usr/src/php-5.0.0/ext/mysqli/mysqli.c:31:
/usr/src/php-5.0.0/ext/mysqli/php_mysqli.h:50: parse error before
"MYSQL_STMT"
/usr/src/php-5.0.0/ext/mysqli/php_mysqli.h:50: warning: no semicolon at end
of struct or union
/usr/src/php-5.0.0/ext/mysqli/php_mysqli.h:54: parse error before '}' token
/usr/src/php-5.0.0/ext/mysqli/php_mysqli.h:54: warning: data definition has
no type or storage class
/usr/src/php-5.0.0/ext/mysqli/php_mysqli.h:116: parse error before '*' token
/usr/src/php-5.0.0/ext/mysqli/mysqli.c:91: parse error before '*' token
/usr/src/php-5.0.0/ext/mysqli/mysqli.c: In function `php_clear_stmt_bind':
/usr/src/php-5.0.0/ext/mysqli/mysqli.c:93: `stmt' undeclared (first use in
this function)
/usr/src/php-5.0.0/ext/mysqli/mysqli.c:93: (Each undeclared identifier is
reported only once
/usr/src/php-5.0.0/ext/mysqli/mysqli.c:93: for each function it appears in.)
/usr/src/php-5.0.0/ext/mysqli/mysqli.c: In function
`mysqli_objects_free_storage':
/usr/src/php-5.0.0/ext/mysqli/mysqli.c:145: parse error before ')' token
/usr/src/php-5.0.0/ext/mysqli/mysqli.c: In function `zm_startup_mysqli':
/usr/src/php-5.0.0/ext/mysqli/mysqli.c:445: `STMT_ATTR_UPDATE_MAX_LENGTH'
undeclared (first use in this function)
/usr/src/php-5.0.0/ext/mysqli/mysqli.c:495: `MYSQL_NO_DATA' undeclared
(first use in this function)
/usr/src/php-5.0.0/ext/mysqli/mysqli.c: In function
`php_mysqli_fetch_into_hash':
/usr/src/php-5.0.0/ext/mysqli/mysqli.c:604: `MYSQL_STMT' undeclared (first
use in this function)
/usr/src/php-5.0.0/ext/mysqli/mysqli.c:604: parse error before ')' token
make: *** [ext/mysqli/mysqli.lo] Error 1

i've seen various issues relating to this on google, but no real solution..

any ideas/comments/pointers/etc.. i need to be able to do transactional
processing which means i need to start looking at "mysqli" which means i
need php-5.0.0!!!

thanks

-bruce



-----Original Message-----
From: bruce [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 17, 2004 1:12 PM
To: [EMAIL PROTECTED]
Subject: [PHP] building php to have mysqli support...


hi...

i'm trying to upgrade/install php-4.3.8 to include mysqli support. i'm
running on a rh8.0 linux with mysql-4.x.

i used the php-4.3.8 src rpm, and built using the following config

./configure  --with-apxs2=/usr/sbin/apxs --with-config-file-path=/etc --with
-mysql  --with-mysqli=/usr/bin/mysql_config --with-ldap --with-pgsql

i then used the following commands..

make clean
./configure
make
make install

everything seemed to go ok, as everything appeared to run to completion and
i didn't see any errors... i do appear to have created a new libphp4.so....

however, when i look in the php-dist.ini it has no mention of "mysqli"...

so my question, have i screwed up somewhere?? or am i just looking for the
php.ini file in the wrong location.

has anybody managed to get php to work so you can actually use both
mysql/mysqli???

pointers/criticisms/assistance is greatly appreciated! searching through
google/php.net/etc.. hasn't turned up information on where i've gone wrong.

thanks..

-bruce

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

--- 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.
>
> -- 
> -----------------------------
>  Michael Mason
>  Arras People
>  www.arraspeople.co.uk
> -----------------------------

Hello,

I don't know if there is really a best way to do this but, some good ways:
- The first step is to avoid multiple submits with the same form when the
user submits severals times. You have to add a small script to avoid this:
<script language="JavaScript">
var SubmitCount = 0;

function CheckSubmit() {
    if (SubmitCount == 0) {
        SubmitCount++;
        pPost.submit();
     }
    else {
    // Anti stress alert ;-))
    alert("The form has been sent. Please wait.... take time to drink a
coffee.");
    return false;
    }
}
</script>

<form action="myscript.php" method="post" name="myscript">
    <input type=... your form here...

    <input name="submit" type="button" value="Sumit"
onClick="CheckSubmit();">
</form>

- The second step is to avoid the refresh process:
You can use a redirect: header('location: ' . $_SERVER['PHP_SELF']); exit;
And you can also used a php variable to detect multiple submit:
The client side code becomes:
-- mypage.html
<script language="JavaScript">
var SubmitCount = 0;

function CheckSubmit() {
    if (SubmitCount == 0) {
        SubmitCount++;
        pPost.submit();
     }
    else {
    // Anti stress alert ;-))
    alert("The form has been sent. Please wait....");
    return false;
    }
}
</script>

<form action="myscript.php" method="post" name="myscript">
    <input type="hidden" value="[[CONTROL]]" name="control">
    ...
    <input type=... your form here...>
    ...
    <input name="submit" type="button" value="Sumit"
onClick="CheckSubmit();">
</form>

-- myscript.php
// When you display the page with the form
// Load the form page
$template =& new CTemplate("mypage.html");
// Put the control value
$template->assign("[[CONTROL]]", "" . time() . mt_rand());
...

// When you get the form data
// Two cases:
if ($_SESSION['sav_control'] != $_POST['control']) {
    // Really the first time: the sav_control variable has not been set
    // your code to process the form data

    // Keep the control variable
    $_SESSION['sav_control'] =  $_POST['control'];

    // Display the next page
    ...
}
else {
    // Not the first time: the sav_control variable has been set
    // Display the next page
    ...
}

So, if the user uses the back button, you keep in a session that this form
has already been sent.

Sorry if I use a template style... I think it is a better way to have a good
split between HTML and PHP and it's always easier when you want to explain
something ;-)

Hope this helps... Regards
Patrick

--- End Message ---
--- Begin Message ---
Php wrote:
> And you can also used a php variable to detect multiple submit:

Even better would be using a token which you give to the user when the form
is displayed.  That way they can't accidentally submit the form on first
entry to the site (and believe me, this can happen, because Konqueror
occasionally remembers a form submission page was in its window the last
time it was run, and tries to reload the page!)

You would generate a random number during the process of displaying the
form, then store that random number into the user's session under that
form's ID.  The number would have to be put into a hidden form field in the
HTML as well.

Then when they submit, you compare the value they send with the value you
have stored in their session.

The frameworks on Java like Struts can automate this.  Perhaps that MVC.PHP
which claims to be a port of Struts can also automate it.

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 everyone,
I have been experimenting with defining functions as constants.
Below is what I am using to test "Function Constants":

<pre>
<?
define(LOGIN,"user");
define(PASS,"pass");
define(DB,"mysql");

define(DBLOGIN,dblogin(LOGIN,PASS,DB));
DBLOGIN;
$set = mysql_query("Select user FROM user limit 1,1");
$results = mysql_fetch_array($set);
echo "Results: ",$results["user"];

define(DBLOGIN,dblogin("user","incorrect_pass",DB));
DBLOGIN;
//Should print error

$set = mysql_query("Select user FROM user limit 1,1");
$results = mysql_fetch_array($set);
echo "Results: ",$results["user"];


function dblogin($login,$pass,$db) { $mysql = mysql_connect("localhost",$login,$pass); mysql_select_db($db,$mysql); } ?> </pre>

I would like to know what the right term for this kind of constant since a search for "function constants" php
did not return any relevant results.
I would also like to know why I was able to redefine DBLOGIN, I always thought redefining constants could
not be done.


Thanks in advance.
-gohaku

--- End Message ---
--- Begin Message ---
* Thus wrote gohaku:
> Hi everyone,
> I have been experimenting with defining functions as constants.
> Below is what I am using to test "Function Constants":
> 
> <pre>
> <?
> define(LOGIN,"user");
> define(PASS,"pass");
> define(DB,"mysql");
> 
> define(DBLOGIN,dblogin(LOGIN,PASS,DB));

This is simply not allowed.

see:
  http://php.net/define


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 ---
Curt Zirzow wrote:

* Thus wrote gohaku:

Hi everyone,
I have been experimenting with defining functions as constants.
Below is what I am using to test "Function Constants":

<pre>
<?
define(LOGIN,"user");
define(PASS,"pass");
define(DB,"mysql");

define(DBLOGIN,dblogin(LOGIN,PASS,DB));


This is simply not allowed.

see:
  http://php.net/define

damn... I had just rewritten my entire application to use this!!

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
Anyone know a blog (I think) that will let me create documentation and let
users add their comments to the tail of it, just like php.net can do??

Thanks

Walter

--- End Message ---
--- Begin Message ---
You could always use a wiki. ;-) I've found tikiwiki to be very well
suited to such things.

On Sat, 17 Jul 2004 17:44:29 -0500, [php]Walter <[EMAIL PROTECTED]> wrote:
> Anyone know a blog (I think) that will let me create documentation and let
> users add their comments to the tail of it, just like php.net can do??
> 
> Thanks
> 
> Walter
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> !DSPAM:40f9a9c826601654356116!
> 
> 


-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

--- End Message ---
--- Begin Message ---
phpNuke is also popular.

> -----Original Message-----
> You could always use a wiki. ;-) I've found tikiwiki to be very well
> suited to such things.
> 
> On Sat, 17 Jul 2004 17:44:29 -0500, [php]Walter <[EMAIL PROTECTED]>
> wrote:
> > Anyone know a blog (I think) that will let me create documentation and
> let
> > users add their comments to the tail of it, just like php.net can do??

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

Is there a more efficient way to compare 2 TXT files other than reading line by line ?

What I was doing was reading line by line and compare both files, if one line is different the loops are interrupted and the function returns true.

Any ideas?

Thanks in advance.
--- End Message ---
--- Begin Message ---
On Sat, Jul 17, 2004 at 07:07:44PM -0600, C.F. Scheidecker Antunes wrote:
> 
> Is there a more efficient way to compare 2 TXT files other than reading 
> line by line ?
> 
> What I was doing was reading line by line and compare both files, if one 
> line is different the loops are interrupted and the function returns true.
> 
> Any ideas?

If all you're trying to do is determine whether the files are different,
and the files are relatively small, then it might be easiest to do
something like:

  function filediff($foo, $bar) {
    $f_foo = file_get_contents($foo);
    $f_bar = file_get_contents($bar);
    return ($f_foo == $f_bar);
  }

Note that this has the opposite return value of your existing function:
it returns true if the files are THE SAME, like the unix "diff" command.

Alternately, if you want to know what differences exist between files,
you could load the files into arrays with the file() function, then use
the array_diff() function to spit out a list of lines in one file but
not the other.

Or, you could tell us more about what you're actually trying to do.  :)

p

-- 
  Paul Chvostek                                             <[EMAIL PROTECTED]>
  Operations / Abuse / Whatever
  it.canada, hosting and development                   http://www.it.ca/

--- End Message ---
--- Begin Message ---
That sounds pretty efficient to me if all you want is whether they're
different. If you actually want to know how different, you could use
something like levenshtein() to compare the contents of the files as
strings.
http://www.php.net/manual/en/function.levenshtein.php

Or, for a more full solution, you could use PEAR::Text_Diff
http://pear.php.net/package/Text_Diff

On Sat, 17 Jul 2004 19:07:44 -0600, C.F. Scheidecker Antunes
<[EMAIL PROTECTED]> wrote:
> Hello all,
> 
> Is there a more efficient way to compare 2 TXT files other than reading
> line by line ?
> 
> What I was doing was reading line by line and compare both files, if one
> line is different the loops are interrupted and the function returns true.
> 
> Any ideas?
> 
> Thanks in advance.
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> !DSPAM:40f9cc90104731699226006!
> 
> 


-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

--- End Message ---
--- Begin Message ---
C.F. Scheidecker Antunes wrote:

Hello all,

Is there a more efficient way to compare 2 TXT files other than reading line by line ?

What I was doing was reading line by line and compare both files, if one line is different the loops are interrupted and the function returns true.

Any ideas?

how about invoking the diff command?


-- 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 ---
Curt Zirzow wrote:
> A simple workaround is testing OS:
> 
> if (windows)
>   // use realpath method
> } else {
>   $absolute = $path{0} == '/';
> }

I don't know what the "realpath" method is since every one I've been given
that involves realpath so far doesn't work.

But here's what I'm doing now:

    function is_absolute($path)
    {
        $regex = (PHP_OS == 'WINNT' || PHP_OS == 'WIN32')
            ? "/^([a-z][A-Z]:)?[\/\\]/"
            : "/^\//";

        return (boolean) preg_match($regex, $path);
    }

Does that look safe enough?  It works for Linux but since I have no Windows
environments to test on I have no idea if it works properly on Windows.

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 ---
Hello,

On 07/17/2004 03:11 AM, 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.

If you pay more attention you may notice that I always say that it *sounds* like a PHP bug. I am not even saying that is necessarily a PHP bug.


After almost 5 years helping people that post messages asking for help about mail function problems, it is easy for me to make early diagnostics just from the sympthoms.

If somebody presents a correctly written piece of code that uses the mail() function and still have problems, those problems have to be somewhere else than the user code. It is rarely in the involved MTA, so it may only be in the user enviroment configuration or in the PHP mail() function implementation.

Certain sympthoms are usually related to bugs in the mail() function. You do not have to be wizard to realize that, just have reasonable experience on the subject will do.



My reponses to you're email's are not targeted against you, but
simply correcting the facts as of current.

So, you probably need to pay more attention because you seem to be departing from wrong assumptions.



As far as what filtering is going on, please enlighten me, this is
the logic of the mail function:

I don't know what you think I mean when I say filtering. To make it clear, filtering for me is processing some input to produce some output. In this case the inputs are the mail function arguments and output is the message that is fed to the MTA. It may not only remove, but also add or change characters. All that is filtering to me.



  trim leading space and make To: rfc822 compliant
  trim leading space and make Subject: rfc822 compliant

These actions are filtering.

  open pipe to sendmail
  send the To: address
  send the Subject:
  if headers was sepecified, send those as well

PHP adds several line feeds. These are filtering to me as well.

  send the message.
  close the pipe to sendmail.


Now I do wonder where in the world filtering is going on there.

What I wonder is why did you just mentioned what the mail function does when it calls sendmail!


AFAIK, PHP does not come with a built-in sendmail tool for Windows, unlike you mention above. Maybe you know something that I am not aware.

What I know is that when sendmail is not available, PHP calls Win32 code to send the message relaying in an SMTP server. There is plenty of filtering done there as you may see when reading the source.

--

Regards,
Manuel Lemos

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

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

--- End Message ---
--- Begin Message ---
I know this is a bit early to ask, but I thought I'd ask it anyway.

Does anyone have an rpm spec file for php 5 yet?


If I don't get any responses to this question, I'll build on and sent it to the 
list.

Have a great night!

-Brent

--- End Message ---
--- Begin Message ---
I see all these articles and tutorials about reading and parsing XML files.

But what about creating and writing XML files with PHP5?

Is the DOM the only way?
It seems like such a bloated overkill.
I just want to make simple little XML files like this:

<music>
<album upc="123456789">
  <artist>Pink Floyd</artist>
   <title>Dark Side of the Moon</title>
   <songs>
     <song num="1">
       <title>Comfortably Numb</title>
       <length>4:32</length>
     </song>
     <song num="2">
       <title>Some Other Song Title</title>
       <length>6:15</length>
     </song>
   </songs>
</album>
</music>


Any suggestions?

--- End Message ---
--- Begin Message ---
On Sun, 2004-07-18 at 00:40, CD Baby wrote:
> I see all these articles and tutorials about reading and parsing XML files.
> 
> But what about creating and writing XML files with PHP5?
> 
> Is the DOM the only way?
> It seems like such a bloated overkill.
> I just want to make simple little XML files like this:
> 
> <music>
> <album upc="123456789">
>   <artist>Pink Floyd</artist>
>    <title>Dark Side of the Moon</title>
>    <songs>
>      <song num="1">
>        <title>Comfortably Numb</title>
>        <length>4:32</length>
>      </song>
>      <song num="2">
>        <title>Some Other Song Title</title>
>        <length>6:15</length>
>      </song>
>    </songs>
> </album>
> </music>

fprintf()

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

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

On 07/18/2004 01:40 AM, Cd Baby wrote:
I see all these articles and tutorials about reading and parsing XML files.

But what about creating and writing XML files with PHP5?

Is the DOM the only way?
It seems like such a bloated overkill.
I just want to make simple little XML files like this:

You may want to try this class. It generates automatically indented XML documents as nicely as you present.


http://www.phpclasses.org/xmlwriter


--

Regards,
Manuel Lemos

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

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

--- End Message ---
--- Begin Message ---
While I realize this is elementary to most of you, I am just getting started
with php, moving from coldfusion :)
I am currently reading through the chapter on sessions and running into a
little issue that after making many changes to my php.ini file, I continue
to get the following errors while running this:

 <?php

  session_start();

 echo "<p>Your session ID is ".session_id()."</p>";

 ?>

Errors:

Warning: session_start(): open(/tmp\sess_ff8651f382492ae56f436690d81ff124,
O_RDWR) failed: No such file or directory (2) in
c:\inetpub\wwwroot\phptest\listing10.1.php on line 15

Warning: session_start(): Cannot send session cookie - headers already sent
by (output started at c:\inetpub\wwwroot\phptest\listing10.1.php:13) in
c:\inetpub\wwwroot\phptest\listing10.1.php on line 15

Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at
c:\inetpub\wwwroot\phptest\listing10.1.php:13) in
c:\inetpub\wwwroot\phptest\listing10.1.php on line 15

Your session ID is ff8651f382492ae56f436690d81ff124


Warning: Unknown(): open(/tmp\sess_ff8651f382492ae56f436690d81ff124, O_RDWR)
failed: No such file or directory (2) in Unknown on line 0

Warning: Unknown(): Failed to write session data (files). Please verify that
the current setting of session.save_path is correct (/tmp) in Unknown on
line 0

sorry this is so elementary but have to start somewhere, I am running php 4
on a win2k box w/IIS5.
Though this does return a session id it's obviously not persistent on
reload, an example of a session.save_path on a windows box would be great

TIA  just another old guy trying to learn new stuff.

--- End Message ---
--- Begin Message ---
bob...

when using the sesion_start(), it needs to be the 1st thing on the page...

------
<?
  session_start();
.
.
.
?>
<html>
....
....
<?
  $_SESSION['foo'] = 40;
?>
....
</html>
------

i don't recall if there has to be anything within the php.ini file set to
enable sessions...

the reason you're getting the error msg, is that your page has essentially
already "sent" some initial header information to the client by the time it
saw your session_start function...

you can get around this by buffering the output, before you send it...

good luck..


-----Original Message-----
From: Bob Imperial [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 17, 2004 10:18 PM
To: [EMAIL PROTECTED]
Subject: [PHP] old guy newbie needs some help


While I realize this is elementary to most of you, I am just getting started
with php, moving from coldfusion :)
I am currently reading through the chapter on sessions and running into a
little issue that after making many changes to my php.ini file, I continue
to get the following errors while running this:

 <?php

  session_start();

 echo "<p>Your session ID is ".session_id()."</p>";

 ?>

Errors:

Warning: session_start(): open(/tmp\sess_ff8651f382492ae56f436690d81ff124,
O_RDWR) failed: No such file or directory (2) in
c:\inetpub\wwwroot\phptest\listing10.1.php on line 15

Warning: session_start(): Cannot send session cookie - headers already sent
by (output started at c:\inetpub\wwwroot\phptest\listing10.1.php:13) in
c:\inetpub\wwwroot\phptest\listing10.1.php on line 15

Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at
c:\inetpub\wwwroot\phptest\listing10.1.php:13) in
c:\inetpub\wwwroot\phptest\listing10.1.php on line 15

Your session ID is ff8651f382492ae56f436690d81ff124


Warning: Unknown(): open(/tmp\sess_ff8651f382492ae56f436690d81ff124, O_RDWR)
failed: No such file or directory (2) in Unknown on line 0

Warning: Unknown(): Failed to write session data (files). Please verify that
the current setting of session.save_path is correct (/tmp) in Unknown on
line 0

sorry this is so elementary but have to start somewhere, I am running php 4
on a win2k box w/IIS5.
Though this does return a session id it's obviously not persistent on
reload, an example of a session.save_path on a windows box would be great

TIA  just another old guy trying to learn new stuff.

--- End Message ---

Reply via email to