php-general Digest 25 Jun 2010 13:06:20 -0000 Issue 6815
Topics (messages 306409 through 306423):
Re: Unexpected behaviour from define()
306409 by: James Long
306410 by: Tim Schofield
306411 by: Ashley Sheridan
306412 by: Tim Schofield
306422 by: Richard Quadling
Re: Quick session question
306413 by: Danny
306414 by: Danny
306416 by: Danny
Re: Quick session question [SOLVED]
306415 by: Danny
in_array - what the...
306417 by: Gary .
306418 by: Ford, Mike
306419 by: Gary .
306420 by: Ford, Mike
Re: Making a Password Confirmation in PHP
306421 by: Richard Quadling
306423 by: Andrew Ballard
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
On Thu, Jun 24, 2010 at 02:41:51PM -0700, James Long wrote:
> Perhaps I am missing something basic here.
>
> Why does the LOG_WARNING constant take on a value of 4, when
> it is defined with a value of 1?
>
> Thank you!
>
> Jim
Answering my own question here....
LOG_WARNING is already defined elsewhere it seems, by the
Network function define_syslog_variables:
$ cat bug.php
<?
//define( 'LOG_NORMAL', 0 );
//define( 'LOG_WARNING', 1 );
//define( 'LOG_ERROR', 2 );
echo 'LOG_NORMAL ' . LOG_NORMAL . "\n";
echo 'LOG_WARNING ' . LOG_WARNING . "\n";
echo 'LOG_ERROR ' . LOG_ERROR . "\n";
?>
$ php bug.php
LOG_NORMAL LOG_NORMAL
LOG_WARNING 4
LOG_ERROR LOG_ERROR
$
--- End Message ---
--- Begin Message ---
On 24/06/10 22:41, James Long wrote:
Perhaps I am missing something basic here.
Why does the LOG_WARNING constant take on a value of 4, when
it is defined with a value of 1?
Thank you!
Jim
$ cat bug.php
<?
define( 'LOG_NORMAL', 0 );
define( 'LOG_WARNING', 1 );
define( 'LOG_ERROR', 2 );
echo 'LOG_NORMAL ' . LOG_NORMAL . "\n";
echo 'LOG_WARNING ' . LOG_WARNING . "\n";
echo 'LOG_ERROR ' . LOG_ERROR . "\n";
?>
$ php bug.php
LOG_NORMAL 0
LOG_WARNING 4
LOG_ERROR 2
$
Very strange, as
<?
define( 'LOG_NORMAL', 0 );
define( 'LOG_WARNiNG', 1 );
define( 'LOG_ERROR', 2 );
echo 'LOG_NORMAL ' . LOG_NORMAL . "\n";
echo 'LOG_WARNiNG ' . LOG_WARNiNG . "\n";
echo 'LOG_ERROR ' . LOG_ERROR . "\n";
?>
seems to work fine
Tim
--- End Message ---
--- Begin Message ---
On Thu, 2010-06-24 at 23:02 +0100, Tim Schofield wrote:
> On 24/06/10 22:41, James Long wrote:
> > Perhaps I am missing something basic here.
> >
> > Why does the LOG_WARNING constant take on a value of 4, when
> > it is defined with a value of 1?
> >
> > Thank you!
> >
> > Jim
> >
> >
> > $ cat bug.php
> > <?
> >
> > define( 'LOG_NORMAL', 0 );
> > define( 'LOG_WARNING', 1 );
> > define( 'LOG_ERROR', 2 );
> >
> > echo 'LOG_NORMAL ' . LOG_NORMAL . "\n";
> > echo 'LOG_WARNING ' . LOG_WARNING . "\n";
> > echo 'LOG_ERROR ' . LOG_ERROR . "\n";
> >
> > ?>
> > $ php bug.php
> > LOG_NORMAL 0
> > LOG_WARNING 4
> > LOG_ERROR 2
> > $
> >
>
> Very strange, as
>
> <?
>
> define( 'LOG_NORMAL', 0 );
> define( 'LOG_WARNiNG', 1 );
> define( 'LOG_ERROR', 2 );
>
> echo 'LOG_NORMAL ' . LOG_NORMAL . "\n";
> echo 'LOG_WARNiNG ' . LOG_WARNiNG . "\n";
> echo 'LOG_ERROR ' . LOG_ERROR . "\n";
>
> ?>
>
> seems to work fine
>
> Tim
>
It would, you misspelt LOG_WARNING with a lowercase 'i' ;)
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
On 24/06/10 23:08, Ashley Sheridan wrote:
On Thu, 2010-06-24 at 23:02 +0100, Tim Schofield wrote:
Very strange, as
<?
define( 'LOG_NORMAL', 0 );
define( 'LOG_WARNiNG', 1 );
define( 'LOG_ERROR', 2 );
echo 'LOG_NORMAL ' . LOG_NORMAL ."\n";
echo 'LOG_WARNiNG ' . LOG_WARNiNG ."\n";
echo 'LOG_ERROR ' . LOG_ERROR ."\n";
?>
seems to work fine
Tim
It would, you misspelt LOG_WARNING with a lowercase 'i' ;)
Thanks,
Ash
http://www.ashleysheridan.co.uk
Thats what I was trying to illustrate, it worked with lower case i but
not with upper case, but James has explained it.
Thanks
Tim
--- End Message ---
--- Begin Message ---
On 24 June 2010 22:41, James Long <p...@umpquanet.com> wrote:
<?php
error_reporting(-1);
ini_set('display_errors', 1);
define( 'LOG_NORMAL', 0 );
define( 'LOG_WARNING', 1 );
define( 'LOG_ERROR', 2 );
echo 'LOG_NORMAL ' . LOG_NORMAL . "\n";
echo 'LOG_WARNING ' . LOG_WARNING . "\n";
echo 'LOG_ERROR ' . LOG_ERROR . "\n";
?>
outputs ...
Notice: Constant LOG_WARNING already defined in - on line 4
LOG_NORMAL 0
LOG_WARNING 5
LOG_ERROR 2
I'm on Win32 PHP 5.3.3-RC1 (cli) (built: Jun 17 2010 22:43:29)
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--- End Message ---
--- Begin Message ---
Hi Gaurav,
Creating a "local" folder solved the problem. I can now catch the session
varaibles.
I think that I am too familiar with setting up everything on a local server and
forgot that there are "other" things to consider when you work on the internet.
Thank You
Danny
>On Jun 25 10, Gaurav Kumar :
> 2. Check on the server that are the sessions really getting saved on the
> server?
> 3. Now in case you do not have access to a sessions folder on the server then
> set the session folder name/path to the folder (a new one) you can have access
> to (may be root of your ftp) using session_save_path('/httpdocs/
> 'your-domain-folder/new-session-folder) (provide read/write permission) before
> session_start() in index.php or common header include file. This
> session_save_path() should be declared on every file on the top.
>
> Try the above and let me know if it works.
>
--- End Message ---
--- Begin Message ---
Hi Jim,
I followed Gaurav's tips on creating a "folder" to store the session info in and
it got solved. I can now catch the session variables but I got A LOT of
"include()"
file errors which was solved by following your suggestion on expanding my URL's.
Thank You
Danny
>On Jun 24 10, Jim Lucas :
>
> Nothing looks to be wrong with the session initiation code. The problem is
> more
> the likely the calls to include a remote file. Basically, to expand your
> variables out, you would be doing this:
>
> include ( 'http://localhost/~user/new_project/sql/sql_dflts.inc' ) ;
> include ( 'http://localhost/~user/new_project/fnc/fnc_include_dir.inc' ) ;
>
> If your php.ini settings are stock, then the problem is with the
> allow_url_include directive. It is set to "0" by default.
>
> See here: http://us3.php.net/manual/en/filesystem.configuration.php
>
> Change that setting to '1' and restart your web server, then you should be
> good
> to go.
>
--- End Message ---
--- Begin Message ---
Hi Mari,
I used "localhost" as a substitute for the real url. My mistake I should've told
you guys. Thanks anyway for your input.
Danny
>On Jun 24 10, Mari Masuda :
>
> Maybe you need to change
>
> $_SESSION['server'] = "http://localhost/~user/new_project" ;
>
> to be not localhost.
--- End Message ---
--- Begin Message ---
Hi Guys,
Thanks to all of you who helped me with my problem. I can now continue with my
life :) . I'm happy and the customer is happy ...
Thank you once again.
Danny
--- End Message ---
--- Begin Message ---
If I have an array that looks like
array(1) {
["mac_address"]=>
string(2) "td"
}
and I call
if (in_array($name, self::$aboveArray))
with $name as
string(11) "mac_address"
what should be the result?
Because it is *false* and it is driving me nuts! This despite the fact
that if I do
$foo = self::$aboveArray[$name];
$foo then has the value
string(2) "td"
Am I not understanding what in_array does? Is there some bug in php that
has been present since 5.2.12 and still is? *bangs head against desk*
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Gary . [mailto:php-gene...@garydjones.name]
> Sent: 25 June 2010 08:18
> To: PHP
> Subject: [PHP] in_array - what the...
>
> If I have an array that looks like
> array(1) {
> ["mac_address"]=>
> string(2) "td"
> }
>
> and I call
> if (in_array($name, self::$aboveArray))
> with $name as
> string(11) "mac_address"
>
> what should be the result?
FALSE -- in_array checks the *values*, not the keys, so would be looking at the
"td" for this element.
To do what you want to do, simply do an isset():
if (isset($array['mac_address'])):
// do stuff with $array['mac_address']
else:
// it doesn't exist
endif;
Cheers!
Mike
--
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,
Leeds Metropolitan University, C507, Civic Quarter Campus,
Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom
Email: m.f...@leedsmet.ac.uk
Tel: +44 113 812 4730
To view the terms under which this email is distributed, please go to
http://disclaimer.leedsmet.ac.uk/email.htm
--- End Message ---
--- Begin Message ---
"Ford, Mike" writes:
>> -----Original Message-----
>> If I have an array that looks like
>> array(1) {
>> ["mac_address"]=>
>> string(2) "td"
>> }
>>
>> and I call
>> if (in_array($name, self::$aboveArray))
>> with $name as
>> string(11) "mac_address"
>>
>> what should be the result?
>
> FALSE -- in_array checks the *values*, not the keys, so would be
> looking at the "td" for this element.
Agh! So it does.
You know what's worse? I even looked at the documentation of the
function this morning wondering if that's what the problem was and
*still* didn't see it!
*slinks away in embarrassment*
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Gary . [mailto:php-gene...@garydjones.name]
> Sent: 25 June 2010 09:14
> To: PHP
> Subject: Re: [PHP] in_array - what the...
>
> "Ford, Mike" writes:
> >> -----Original Message-----
> >> If I have an array that looks like
> >> array(1) {
> >> ["mac_address"]=>
> >> string(2) "td"
> >> }
> >>
> >> and I call
> >> if (in_array($name, self::$aboveArray))
> >> with $name as
> >> string(11) "mac_address"
> >>
> >> what should be the result?
> >
> > FALSE -- in_array checks the *values*, not the keys, so would be
> > looking at the "td" for this element.
>
> Agh! So it does.
>
> You know what's worse? I even looked at the documentation of the
> function this morning wondering if that's what the problem was and
> *still* didn't see it!
>
> *slinks away in embarrassment*
Not to worry -- happens to the best of us. (Been there, done that, got a
wardrobe full of T-shirts!)
Cheers!
Mike
--
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,
Leeds Metropolitan University, C507, Civic Quarter Campus,
Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom
Email: m.f...@leedsmet.ac.uk
Tel: +44 113 812 4730
To view the terms under which this email is distributed, please go to
http://disclaimer.leedsmet.ac.uk/email.htm
--- End Message ---
--- Begin Message ---
On 24 June 2010 19:46, Ashley Sheridan <a...@ashleysheridan.co.uk> wrote:
> On Thu, 2010-06-24 at 20:37 +0200, David Česal wrote:
>
>> Yes, it is.
>>
>> D
>>
>> -----Original Message-----
>> From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]
>> Sent: Thursday, June 24, 2010 8:32 PM
>> To: Floyd Resler
>> Cc: PHP
>> Subject: Re: [PHP] Making a Password Confirmation in PHP
>>
>> On Thu, 2010-06-24 at 14:29 -0400, Floyd Resler wrote:
>>
>> > On Jun 24, 2010, at 2:22 PM, Michael Calkins wrote:
>> >
>> > >
>> > > This is very straight forward, if password a and b are not equal to each
>> other, how can I let the user know that with out losing all of the entered
>> information on the registration form?
>> > > I was trying this:
>> > > ---$p1 = "<input type=\"password\" name=\"usr_p1\" />";
>> > > $p2 = "<input type=\"password\" name=\"usr_p2\" />"; // if they
>> > > didn't match return
>> > > $p1 = "<input type=\"password\" name=\"usr_p1\" value=\"" . $p1 .
>> > > "\"/>";--- I was trying to change the value of the variable which shows
>> the input field to have the password already in it.
>> > > and either one would just be echo'd depending on the result.
>> > > Any ideas please?
>> > >
>> > > From,Michael calkinsmichaelcalk...@live.com
>> > >
>> > >
>> > If you aren't opposed to using JavaScript, I'd do it there. If you don't
>> want to use JavaScript then you can load the form data from the $_POST (or
>> $_GET) array that was passed back to your script.
>> >
>> > Take care,
>> > Floyd
>> >
>> >
>> >
>>
>>
>> Is Javascript allowed to read the value of password boxes? I was of the
>> understanding that it couldn't, so checking if a password field matches
>> another is pretty moot.
>>
>> Thanks,
>> Ash
>> http://www.ashleysheridan.co.uk
>>
>>
>>
>
>
> Yes, so it does. That seems like a bit of a flaw in Javascript on
> security grounds.
>
And the fact that a browser will transmit <input type="password"> as
plain text isn't a security issue?
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--- End Message ---
--- Begin Message ---
On Fri, Jun 25, 2010 at 5:35 AM, Richard Quadling <rquadl...@gmail.com> wrote:
> And the fact that a browser will transmit <input type="password"> as
> plain text isn't a security issue?
That's what SSL is for.
Andrew
--- End Message ---