php-general Digest 29 Jun 2003 14:26:10 -0000 Issue 2146

Topics (messages 153304 through 153318):

Re: Cookies and Macs
        153304 by: Justin French

error_log function
        153305 by: Ole Brumm
        153311 by: Jaap van Ganswijk

Re: Another newbie
        153306 by: Ray Hunter

Re: New PCRE features
        153307 by: Ray Hunter

Re: PHP and Macromedia Flash
        153308 by: Daniel J. Rychlik

web site security: how to hide login info for mysql-connection
        153309 by: anders thoresson
        153315 by: Mike Morton

PHP & Java
        153310 by: Jan Bro

Re: $_POST problem >> SUPERGLOBALS
        153312 by: esctoday.com | Wouter van Vliet

File Uploads!
        153313 by: Catalin Trifu
        153314 by: Tom Rogers
        153316 by: Tom Rogers
        153317 by: Catalin Trifu

PHPSESSID Length?
        153318 by: Henrik Hudson

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 ---
There should be no differences in PC/Mac/Linux implementations of cookies,
for common browsers.  I've never had a problem.

- which browsers were you testing with?

- did those browsers have cookies switched on, with a security level low
enough to accept yours?

- can you show us a small test script that proves your problem, and upload
it somewhere for us to test?

Justin






on 28/06/03 10:42 AM, Joshua Chapman ([EMAIL PROTECTED]) wrote:

> I wrote a script that used cookies to track users (the cookie contains the
> user's ID#). However, there was a problem when it came to the Mac users, the
> cookie that was assigned to them never stuck so every time they hit a page the
> script generated a new ID for them, made it very difficult to track them. Do
> Macs just handle cookies differently than PCs? What can I do to get a cookie
> to stick on a Mac so I can pull the data from it later?
> 
> Thanks in advance!
> 
> - Joshua Chapman
> webmaster of faxonautolit.com


--- End Message ---
--- Begin Message ---
I have just implemented the error_log function on my web site, as I find this 
feature very useful. I have chosen to write to a file on the server.

my question is: How can I make error_log write each error message on a NEW line 
in the file I have chosen. Now, every message is written on a long line, which 
is not very user friendly. I have tried to put \n on the end of the message, but 
it didn`t have any effect.

Any comments appreciated :-)

- Peter -

------------------------------------------------------------
Få din egen @start.no-adresse gratis på http://www.start.no/

--- End Message ---
--- Begin Message ---
At 2003-06-29 03:55 +0200, Ole Brumm wrote:
>I have just implemented the error_log function on my web site, as I find this 
>feature very useful. I have chosen to write to a file on the server.
>
>my question is: How can I make error_log write each error message on a NEW line 
>in the file I have chosen. Now, every message is written on a long line, which 
>is not very user friendly. I have tried to put \n on the end of the message, but 
>it didn`t have any effect.

When you want to be able to look at the log file
using some crummy Windows tool, make sure to
use "\r\n". Borland tools and Wordpad for
example can handle "\n"-only files, but IE
and Notepad not.

Also make sure you use double quotes and not
single quotes.

I'm using this under Unix and it works fine:
error_log(serialize($A)."\n",3,$log);

$log = the name of the file to log to
$A = is an array with data that I want to log

Greetings,
Jaap


--- End Message ---
--- Begin Message ---
Jay,

I would start out by reading up on the oop stuff and then maybe look at
some software development sites...there are many and most have
sufficient info to get you started.

There are tons of design patterns out there which will more than help
you code out too...(http://www.phppatterns.com) is a great site.

Plus there are many great software design mags for php and other
languages...that might be an option.

I saved the best for last...

There are so many great projects out there that you can help out with
any of them...that will allow you to work and learn from others...also
if you dont have the time then i strongly suggest review code from some
projects...like horde that have a solid framework...by review the code u
can see style and design stratiges...

Hope that helps out...

--
BigDog





On Sat, 2003-06-28 at 14:10, Jay Fitzgerald wrote:
> I have been writing PHP for almost a year now and someone on phpfreaks told 
> me the other day that my code was very sloppy.
> 
> Since I want to more more into programming than design, can anyone 
> recommend where to learn how to make sure your code is clean, optimized and 
> as error-free as it can get? Even if it is the style of how to write the 
> code, please let me know....I know noone can be the perfect programmer, but 
> I would at least like to be a decent programmer :)
> 
> Jay
> 


--- End Message ---
--- Begin Message ---
Thanks Andrei,

we truly appreciate it...i will definitely put it to use...

--
BigDog


On Sat, 2003-06-28 at 18:28, Andrei Zmievski wrote:
> Some news on PCRE front:
> 
> 1. I've upgraded the bundled PCRE library to version 4.3 which has some
>    interesting new features. 
> 
> 2. I added new parameter to preg_match* functions that can be used to
>    specify the starting offset of the subject string to start matching
>    from. The offset can be positive or negative, like for substr().
> 
> 3. Also implemented support for named subpatterns (introduced with PCRE
>    4.3). This means you can do something like:
> 
>    <?
>    preg_match('!(\d+)(?P<ahh>\.\d+)?!', 'ab 55.5 bb', $match);
>    var_dump($match);
>    ?>
> 
>    With the result being:
> 
>     array(4) {
>       [0]=>
>       string(4) "55.5"
>       [1]=>
>       string(2) "55"
>       ["ahh"]=>
>       string(2) ".5"
>       [2]=>
>       string(2) ".5"
>     }
> 
>    Note that the named subpattern is also available under a positional
>    numeric key, as before. What this means for backwards compatibility
>    is that you should not do count($match) anymore to obtain the number
>    of captured subpatterns or number of matches. For latter, use the
>    return value of preg_match* functions, and for former, you should
>    already know how many subpatterns you have from your regexp.
> 
> 4. You can use \Q..\E to ignore regexp metacharacters in the pattern.
>    For example:
> 
>     !\w+\Q.$.\E$!
> 
>     Will match one or more word characters, followed by literals .$. and
>     anchored at the end of the string.
> 
> 5. You can use possesive quantifiers, similar to Java's regexps. These
>    are:
> 
>     ?+, *+, ++, and {,}+
> 
>    See PCRE docs or Java docs for more information.
> 
> 6. There is now support for recursive calls to individual subpatterns.
>    That is, instead of using (?R) you can use (?1), (?2) and so on. Or
>    use named subpatterns: (?P>foo) will refer recursively to named
>    subpattern 'foo'. Once again see PCRE docs for more info.
> 
> 7. There is a new feature by the name of "callouts", but there is not
>    interface to it yet. Basically, it allows user to receive control at
>    a specified matching point in the pattern and inspect, continue, or
>    interrupt the matching. I'm not sure how useful this would be for PHP
>    users as the information provided is fairly low-level. See
>    'pcrecallout' PCRE man page for more info. If there are enough
>    interested people, I will add support for it.
> 
> That's about it for now.
> 
> -Andrei
> 
> "What's a polar bear?"
> "A rectangular bear after a coordinate transform."
>     -- Bill White ([EMAIL PROTECTED])


--- End Message ---
--- Begin Message ---
If anyone is intrested in this, please take a look.  This is really cool
stuff.

This use flash to present data that was passed from a PHP script that was
pulled from a MySQL db.

Really cool stuff.
http://actionscript-toolbox.com/samplemx_php.php

-Dan


----- Original Message ----- 
From: "Daniel J. Rychlik" <[EMAIL PROTECTED]>
To: "Daniel J. Rychlik" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, June 28, 2003 7:26 PM
Subject: Re: [PHP] PHP and Macromedia Flash


> Anyone have any experience with PHPObject from
> http://ghostwire.com/resources/phpobject/
>
> ----- Original Message ----- 
> From: "Daniel J. Rychlik" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Saturday, June 28, 2003 6:13 PM
> Subject: Re: [PHP] PHP and Macromedia Flash
>
>
> > Well, at least I know its possible.  Im guessing that an action script
of
> > some kind pulls the the xml data and displays the new information or
> button.
> > I wish that you could just pass it directly to the flash object, that
> would
> > be nice....
> >
> > -Dan
> >
> > ----- Original Message ----- 
> > From: "Andrew McCombe" <[EMAIL PROTECTED]>
> > To: "Daniel J. Rychlik" <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>
> > Sent: Saturday, June 28, 2003 6:09 PM
> > Subject: Re: [PHP] PHP and Macromedia Flash
> >
> >
> > > On Sun, 2003-06-29 at 00:00, Daniel J. Rychlik wrote:
> > > > Does anyone know if you can dynamically update a flash swf file with
a
> > PHP script ?
> > > >
> > > > For instance in menu navigation I was thinking of using a flash
object
> > to display an interactive menu and have in my main class a way to update
> the
> > links or buttons from page to page.
> > > >
> > > > Thanks in advance,
> > > > Dan
> > >
> > > Yes you can.  I'm currently writing a script that uses php to pull
info
> > > in from a mysql db and passes the results back to flash as xml.
> > >
> > > Don't ask me how the flash part works though, i don't do that part.
> > >
> > > Regards
> > > Andrew McCombe
> > >
> > >
> > >
> >
> >
> > -- 
> > 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 --- Hi,

At the moment I store username, password and database for my MySQL connections in a file called settings.php to avoid putting them in my php files direct. On a Linux server, what extra steps can I take to prevent others from accessing settings.php?

Somewhere, I've read that settings.php should be placed in a directory outside the html/php-directories. Today, my web directory is /home/anders/public_html and subdirectories to public_html. Should settings.php be placed in /home/anders/include?

--
anders thoresson

--- End Message ---
--- Begin Message ---
Anders:

> Somewhere, I've read that settings.php should be placed in a directory
> outside the html/php-directories. Today, my web directory is
> /home/anders/public_html and subdirectories to public_html. Should
> settings.php be placed in /home/anders/include?

That is correct - you are always best to keep password and such outside the
web root where possible.  As many people have pointed out on this list - it
is a best practices thing that should be done.

Be aware that wherever you store the settings folder, your php.ini should
have that path in it's include_directories setting, and the webserver must
have read permissions for that file.


--
Cheers

Mike Morton

****************************************************
*
* Tel: 905-465-1263
* Email: [EMAIL PROTECTED]
*
****************************************************

"Indeed, it would not be an exaggeration to describe the history of the
computer industry for the past decade as a massive effort to keep up with
Apple."
- Byte Magazine

Given infinite time, 100 monkeys could type out the complete works of
Shakespeare. Win 98 source code? Eight monkeys, five minutes.
-- NullGrey 


--- End Message ---
--- Begin Message ---
Hi I hope there is anybody out there familiar with PHP and Java.
I've got the following Code:
<?php
  $instan  = new Java("DBUser");
  echo "$instan ";
 $system = new Java("java.util.Vector");
  echo"$system ";

?>

If I only use one of the two objects, which one doesn't matter, it works.
IF I try to initiate them both PHP.exe is closing down on me.
In Apache error log I get the folowing error:
[Sun Jun 29 10:58:32 2003] [error] [client 127.0.0.1] Premature end of
script headers: c:/apache/php4/php.exe

Other than that I've seem to have a good configured System, as there are no
more errors.



I run a win2000 with apache 1.3.2
with php 4.3.1

thx
Jan



--- End Message ---
--- Begin Message ---
Let's explain this thing with the superglobals now once again .. so that
everybody knows it ...

In newer versions of PHP some superglobal arrays are available...

$_GET[]     - For any variable passed through the query string (in the URL,
or address bar in a http://www.domain.com/page.php?foo=bar&foo2=bar2 syntax)
but also fields submitted through a form with a tag like <FORM method="GET">
$_POST[]    - For any field submitted from a form with tag like <FORM
method="POST">
$_COOKIE[]  - For any cookie set and available for the script you're
running.
---------------
$_REQUEST[] - Merges the above three together. I think I mentioned them in
the default order of importance. Post overriding cookie, get overriding
post.

$_FILES[]   - Also for information send by a form, but now only the <INPUT
type="FILE" name="fieldname"> entries are listed. Remember to use this kind
of form tag: <form enctype="multipart/form-data" action="_URL_"
method="post"> .. espeically "method=post" and "enctype=multipart/form-data"
are essential. Prior to PHP4.3 the $_FILES superglobal was also included in
$_REQUEST, but don't rely on that to happen since it will make your scripts
fail in a newer version and have you look for a bug which is almost
impossible to find.

$_SESSION[] - Session vars set. When using $_SESSION, you should not use
session_start() of functions like that. A session usually exists untill a
user closes his/her browser window. Or 30 minutes has expired, whatever
comes first. (The 30 minutes is a setting in php.ini and can be overriden,
if i'm right about that)

$_ENV[]     - info about the user's default shell, homedir and stuff like
that. The user as which your PHP script is running on the server, that is.
NOT the user visiting your page.

$_SERVER[]  - info about the server and the script which is running.. For
example $_SERVER['php_self'] gives you the filename of the script,
$_SERVER['PHP_AUTH_USER'] for the apache basic authentication username..

-----

So, now I hope this has been cleared out for everybody.. And that I'll still
be in time to see my fav bands play at ParkPop, one of the biggest free open
air pop festivals I think in Europe.. just around the corner of my house
here in The Hague.

Salutes,
Wouter

-----Oorspronkelijk bericht-----
Van: Jason Wong [mailto:[EMAIL PROTECTED]
Verzonden: vrijdag 27 juni 2003 22:46
Aan: [EMAIL PROTECTED]
Onderwerp: Re: [PHP] $_POST problem


On Saturday 28 June 2003 04:32, Sparky Kopetzky wrote:

> I've got my script kinda running but am unable to retrieve any values with
> $_POST. I turned on register_globals in the php.ini and am using this url:

If you're going to be using $_POST (which you should) then you should
*disable* register_globals.

> http://www.fttta.com/auction.php?action=reg. (Sorry, it's local for
now...)
>
> I'm using this kind of line to check for values:
> elseif ('reg' == $_POST['action'])
> {
>     do something;
> }

Does print_r($_POST) show your variables?

If not are you using the POST method in your form?

If so what version of PHP are you using?

--
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
------------------------------------------
/*
Even the best of friends cannot attend each other's funeral.
                -- Kehlog Albran, "The Profit"
*/


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



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

    This is the error I get in the log file:
[error] PHP Warning:  POST Content-Length of 11184886 bytes exceeds the
limit of 8388608 bytes in Unknown on line 0

    This is absolutely correct. The problem is
this error does not reach my PHP script and I
have no idea how can I tell my user he posted
a file which exceds the size.
    The $_FILES is empty, same for $HTTP_...
    Any idea is appreciated.

Cheers,
Catalin



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

Sunday, June 29, 2003, 9:49:43 PM, you wrote:
CT>         Hi,

CT>     This is the error I get in the log file:
CT> [error] PHP Warning:  POST Content-Length of 11184886 bytes exceeds the
CT> limit of 8388608 bytes in Unknown on line 0

CT>     This is absolutely correct. The problem is
CT> this error does not reach my PHP script and I
CT> have no idea how can I tell my user he posted
CT> a file which exceds the size.
CT>     The $_FILES is empty, same for $HTTP_...
CT>     Any idea is appreciated.

CT> Cheers,
CT> Catalin


check out

$_FILES['userfile']['error'] it should give some clues


UPLOAD_ERR_OK
Value: 0; There is no error, the file uploaded with success. 

UPLOAD_ERR_INI_SIZE
Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini. 

UPLOAD_ERR_FORM_SIZE
Value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in 
the html form. 

UPLOAD_ERR_PARTIAL
Value: 3; The uploaded file was only partially uploaded. 

UPLOAD_ERR_NO_FILE
Value: 4; No file was uploaded


-- 
regards,
Tom


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

Sunday, June 29, 2003, 10:17:43 PM, you wrote:
TR> Hi,

TR> Sunday, June 29, 2003, 9:49:43 PM, you wrote:
CT>>         Hi,

CT>>     This is the error I get in the log file:
CT>> [error] PHP Warning:  POST Content-Length of 11184886 bytes exceeds the
CT>> limit of 8388608 bytes in Unknown on line 0

CT>>     This is absolutely correct. The problem is
CT>> this error does not reach my PHP script and I
CT>> have no idea how can I tell my user he posted
CT>> a file which exceds the size.
CT>>     The $_FILES is empty, same for $HTTP_...
CT>>     Any idea is appreciated.

CT>> Cheers,
CT>> Catalin

Maybe you have to wind up the post_max_size in php.ini and then control with
MAX_FILE_SIZE in the form for the error to show up in the $_FILES
array....



-- 
regards,
Tom


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

    I already tried $_FILES['userfile']['error'], but
as I already said the $_FILES is empty, completely empty

Cheers,
Catalin


"Tom Rogers" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> Sunday, June 29, 2003, 9:49:43 PM, you wrote:
> CT>         Hi,
>
> CT>     This is the error I get in the log file:
> CT> [error] PHP Warning:  POST Content-Length of 11184886 bytes exceeds
the
> CT> limit of 8388608 bytes in Unknown on line 0
>
> CT>     This is absolutely correct. The problem is
> CT> this error does not reach my PHP script and I
> CT> have no idea how can I tell my user he posted
> CT> a file which exceds the size.
> CT>     The $_FILES is empty, same for $HTTP_...
> CT>     Any idea is appreciated.
>
> CT> Cheers,
> CT> Catalin
>
>
> check out
>
> $_FILES['userfile']['error'] it should give some clues
>
>
> UPLOAD_ERR_OK
> Value: 0; There is no error, the file uploaded with success.
>
> UPLOAD_ERR_INI_SIZE
> Value: 1; The uploaded file exceeds the upload_max_filesize directive in
php.ini.
>
> UPLOAD_ERR_FORM_SIZE
> Value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive that was
specified in the html form.
>
> UPLOAD_ERR_PARTIAL
> Value: 3; The uploaded file was only partially uploaded.
>
> UPLOAD_ERR_NO_FILE
> Value: 4; No file was uploaded
>
>
> --
> regards,
> Tom
>



--- End Message ---
--- Begin Message ---
Hey List-

I'm trying to figure out how to make the PHPSESSID cookie be longer then 32 
characters? 

One can set the entropy file and entropy length, but if my understanding of 
entropy is correct then that just helps randomize the 32 chars and not not 
actually make a string that much longer or shorter.

Can't seem to find anything in the archives or Google. 

Then again, is a 32-length string sufficient for protecting a browser session 
length of "session"?

Thanks.

Henrik
-- 
Henrik Hudson
[EMAIL PROTECTED]

"`If there's anything more important than my ego
around, I want it caught and shot now.'" 
        --Hitchhikers Guide to the Galaxy

--- End Message ---

Reply via email to