[PHP] anchor inside form

2009-08-25 Thread leledumbo

If I have an anchor inside form, how can I send form using the anchor without
displaying target url? I've tried the code below but IE says that this.form
is null or empty and Firefox does nothing.

form action=somewhere.php method=get
# Pick me 
/form
-- 
View this message in context: 
http://www.nabble.com/anchor-inside-form-tp25129981p25129981.html
Sent from the PHP - General mailing list archive at Nabble.com.


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



Re: [PHP] wierd behavior on parsing css with no php included

2009-08-25 Thread Ralph Deffke
tx Lucas,

all your recomended solutions made sence for the different pupose.

for my purpose the apache solution worked just great

Files ~ \.css$
php_value default_mimetype text/css
/Files

and
AddType application/x-httpd-php .css

ralph_def...@yahoo.de



Jim Lucas li...@cmsws.com wrote in message
news:4a923946.3020...@cmsws.com...
 Ralph Deffke wrote:
  Hi folks, i did post this also on the Wamp page but maybe someone out
there
  had to solve that problem as well.
 
  systems involved
 
  Firefox 3.0.13
  Firefox 3.5.2
  IE 6
 
  Wamp:
  apache 2.2.11
  PHP 5.2.9  php 5.3
 
  I do parse css files through php
 

 If you state that they have not PHP to parse, then why parse them?  It is
a waist!

  Problem: css files are loaded into the browsers but not interpreted or
used
  on RAW HTML files no php included. The html files are produced with
  phpDocumentor 1.4.2. IE6 uses parts of the css files loaded to display
the
  page, Firefox NOT AT ALL.
 
  I think it might be possible that wamp throughs some wierd characters
into
  the css files or is the header type a problem? It looks like parsing the
css
  through the php engine changes the header of the css to text/html. this
  would explain why IE6 can use them. on the other hand firebug shows the
  loaded css, indicates however that no css is available.
 
  as an reverse check I did load the html files direktly from the disk
with
  file:/// ... and the css are interpreted perfectly. so the source of the
  problem is wamp.
 
  it seems that the @importcsss does the biggest problem.it creates a 404
  error file not found
 
  it seems creating dynamic css files got some secrets involved with the
wamp.
  I'm using this concept since ages on linux with no problem.
 
  on the @includecss it seems that the search for files are changing to
the
  php include path or something.
 
  any idear what to check?
 
  is important for my work to create css dynamicly
 

 My suggestion would be to have php run a script using the
auto_prepend_file ini option

 ; Automatically add files before or after any PHP document.
 auto_prepend_file = fix_headers.php
 auto_append_file =

 Then, in a script called fix_headers.php, somewhere in your path I hope,
you have this.

 ?php

 # The following regex is completely untested.  It is meant to
 $ext = strtolower(preg_replace('|^.*\.([^.]+)$|',
$_SERVER['SCRIPT_NAME']));

 if ( 'css' === $ext ) {
 header('Content-Type: text/css');
 }

 ?

 Another way to get around it is to have apache instruct PHP to change, and
output, the correct
 content type.

 http://httpd.apache.org/docs/1.3/mod/core.html#files
 http://us2.php.net/manual/en/ini.core.php#ini.sect.data-handling
 http://us2.php.net/manual/en/ini.core.php#ini.default-mimetype

 Files ~ \.css$
 php_value default_mimetype text/css
 /Files

 Hope this helps

 Jim Lucas

  ralph_def...@yahoo.de
 
 
 


 -- 
 Jim Lucas

 Some men are born to greatness, some achieve greatness,
 and some have greatness thrust upon them.

 Twelfth Night, Act II, Scene V
  by William Shakespeare



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



[PHP] Re: unset() something that doesn't exist

2009-08-25 Thread Ralph Deffke
yes it does on my machine

and it makes sence since it is not a function its a language construct.

cheers
ralph_def...@yahoo.de

Shawn McKenzie nos...@mckenzies.net wrote in message
news:4a935c42.2010...@mckenzies.net...
 Ralph Deffke wrote:
  causes an error
  Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'$''
in
  C:\wamp\www\TinyCreator\testCrapp6.php on line 42
 
  Tom Worster f...@thefsb.org wrote in message
  news:c6b87877.11463%...@thefsb.org...
  is it the case that unset() does not trigger an error or throw an
  exception
  if it's argument was never set?
 
 
 
 

 What!?!?


 No, It does not cause an error, not even a notice.

 -- 
 Thanks!
 -Shawn
 http://www.spidean.com



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



Re: [PHP] Re: unset() something that doesn't exist

2009-08-25 Thread Stuart
2009/8/25 Ralph Deffke ralph_def...@yahoo.de:
 causes an error
 Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'$'' in
 C:\wamp\www\TinyCreator\testCrapp6.php on line 42

This is a syntax error, not a runtime error. You've clearly done
something wrong.

 Tom Worster f...@thefsb.org wrote in message
 news:c6b87877.11463%...@thefsb.org...
 is it the case that unset() does not trigger an error or throw an
 exception
 if it's argument was never set?

Absolutely.

-Stuart

-- 
http://stut.net/

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



Re: [PHP] Re: unset() something that doesn't exist

2009-08-25 Thread Ralph Deffke
of course its a syntax error, because unset() IS NOT A FUNCTION its a
language construct

ralph

Stuart stut...@gmail.com wrote in message
news:a5f019de0908250201g14e4b61cn73c6cd67da6f...@mail.gmail.com...
 2009/8/25 Ralph Deffke ralph_def...@yahoo.de:
  causes an error
  Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'$''
in
  C:\wamp\www\TinyCreator\testCrapp6.php on line 42

 This is a syntax error, not a runtime error. You've clearly done
 something wrong.

  Tom Worster f...@thefsb.org wrote in message
  news:c6b87877.11463%...@thefsb.org...
  is it the case that unset() does not trigger an error or throw an
  exception
  if it's argument was never set?

 Absolutely.

 -Stuart

 -- 
 http://stut.net/



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



Re: [PHP] anchor inside form

2009-08-25 Thread Ashley Sheridan
On Tue, 2009-08-25 at 00:55 -0700, leledumbo wrote:
 If I have an anchor inside form, how can I send form using the anchor without
 displaying target url? I've tried the code below but IE says that this.form
 is null or empty and Firefox does nothing.
 
 form action=somewhere.php method=get
 # Pick me 
 /form
 -- 
 View this message in context: 
 http://www.nabble.com/anchor-inside-form-tp25129981p25129981.html
 Sent from the PHP - General mailing list archive at Nabble.com.
 
 
You can only send the form from a link (an anchor is a named point in a
page that also uses the a tag) using Javascript. Most people will tell
you this is a bad idea, as you are then relying on the end user to both
have Javascript available _and_ have it switched on (and that they are
not sitting behind a corporate firewall that strips out Javascript which
some do apparently)

Why not just use another submit button? If you don't like the look of a
regular submit, then use an input type=image/ button instead, as
these act like submit buttons for the most part. You can have as many
submit buttons on a form that you like, and if you give them unique
names, you will know which one has been clicked.

Thanks,
Ash
http://www.ashleysheridan.co.uk




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



Re: [PHP] anchor inside form

2009-08-25 Thread leledumbo

 Why not just use another submit button?

Because it's actually an entry in a tree-like menu. I need to send
parameters via get method, and code above is one way I can think of.
-- 
View this message in context: 
http://www.nabble.com/anchor-inside-form-tp25129981p25131146.html
Sent from the PHP - General mailing list archive at Nabble.com.


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



[PHP] Directory Listing

2009-08-25 Thread Tom Chubb
Hi gang,
I'm trying to create a script to read the files in a folder (approx
2000) and get the filename, path and last modified date in a tabulated
format to copy into excel. (We have been issued a CD and need to get
all files documented and assigned to an owner.)

I've tried loads of different scripts but can't get them working with
all the features.
I think the best one to work with is this (although I'm having
problems getting the date but don't worry about that at the moment)

?
error_reporting(E_ALL);
ini_set('display_errors', true);
function getDirectory($path = '.', $ignore = '') {
    $dirTree = array ();
    $dirTreeTemp = array ();
    $ignore[] = '.';
    $ignore[] = '..';

    $dh = @opendir($path);

    while (false !== ($file = readdir($dh))) {

    if (!in_array($file, $ignore)) {
    if (!is_dir($path/$file)) {

    $dirTree[$path][] = $file;

    } else {

    $dirTreeTemp = getDirectory($path/$file, $ignore);
    if (is_array($dirTreeTemp))$dirTree =
array_merge($dirTree, $dirTreeTemp);
    }
    }
    }
    closedir($dh);

    return $dirTree;
}

$ignore = array('.htaccess', 'error_log', 'cgi-bin', 'php.ini', '.ftpquota');

$dirTree = getDirectory('./Tender', $ignore);
?
pre
    ?
    print_r($dirTree);
    ?
/pre

?php
getdirectory('./Tender');
//or
//get_dir_iterative(/*etc.*/);
?






Here is an example of what I'm getting out from the $dirTree array:

Array
(
[./Tender] = Array
(
[0] = 9216_100_REV_V1.0_bound.dwg
)


[./Tender/Tender Docs] = Array
(
[0] = BAA Works Terms v1.1 (22.05.08).pdf
[1] = Contents of Volumes 1 and 2.pdf
[2] = Cover Letter and Instructions.doc

[3] = Form of Tender.doc
)

[./Tender/Tender Docs/Health and Safety Questionnaire] = Array
(
[0] = NT Baggage Tender Questionaire rev2.xls
)


[./Tender/Tender Docs/NTB BH Lighting] = Array
(
[0] = 3J-B-1 PIR.xls
[1] = 3J-B-2B PIR.xls
[2] = 3J-B-2R PIR.xls
[3] = 3J-B-3R PIR.xls

[4] = 3J-D PIR.xls
[5] = 4G-G PIR.xls
[6] = 4J-B-1B PIR.xls
[7] = 4J-B-1R PIR.xls
[8] = 4J-B-2B PIR.xls
[9] = 4J-B-2R PIR.xls

[10] = 4J-B-4 PIR.xls
[11] = 5G-G PIR.xls
)

I'm having problems getting my head round how to get access the array
data so that I can format it how I want, eg:

Folder   Filename
Tender   9216_100_REV_V1.0_bound.dwg
Tender/Tender Docs   BAA Works Terms v1.1 (22.05.08).pdf
Tender/Tender Docs   Contents of Volumes 1 and 2.pdf

etc.

I'm trying to do this at work (php is a hobby and this is the first
time I've tried to use it in my electrical engineering job) in notepad
without any code highlighting, etc. and tearing my hair out to try and
avoid going through the CD manually!

Could anybody please help or let me know which function I need to read
up on? I've tried countless searches on array formatting, etc and not
getting anywhere.

Thanks in advance,

Tom

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



Re: [PHP] anchor inside form

2009-08-25 Thread Ralph Deffke
may be u can use this

a href=urpage.php?var1=somethingvar2=something 

cheers
ralph_def...@yahoo.de

leledumbo leledumbo_c...@yahoo.co.id wrote in message
news:25131146.p...@talk.nabble.com...

  Why not just use another submit button?

 Because it's actually an entry in a tree-like menu. I need to send
 parameters via get method, and code above is one way I can think of.
 -- 
 View this message in context:
http://www.nabble.com/anchor-inside-form-tp25129981p25131146.html
 Sent from the PHP - General mailing list archive at Nabble.com.




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



RE: [PHP] anchor inside form

2009-08-25 Thread Arno Kuhl
-Original Message-
From: leledumbo [mailto:leledumbo_c...@yahoo.co.id] 
Sent: 25 August 2009 09:55 AM
To: php-general@lists.php.net
Subject: [PHP] anchor inside form

If I have an anchor inside form, how can I send form using the anchor
without displaying target url? I've tried the code below but IE says that
this.form is null or empty and Firefox does nothing.

form action=somewhere.php method=get
# Pick me
/form
--

You can use javascript behind a button or image or link to submit the form
from anywhere in your html page. You don't need the anchor but you do need a
form name. Something like:

  href=javascript:document.FormName.submit();

Cheers
Arno


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



RE: [PHP] anchor inside form

2009-08-25 Thread Ashley Sheridan
On Tue, 2009-08-25 at 12:28 +0200, Arno Kuhl wrote:
 -Original Message-
 From: leledumbo [mailto:leledumbo_c...@yahoo.co.id] 
 Sent: 25 August 2009 09:55 AM
 To: php-general@lists.php.net
 Subject: [PHP] anchor inside form
 
 If I have an anchor inside form, how can I send form using the anchor
 without displaying target url? I've tried the code below but IE says that
 this.form is null or empty and Firefox does nothing.
 
 form action=somewhere.php method=get
 # Pick me
 /form
 --
 
 You can use javascript behind a button or image or link to submit the form
 from anywhere in your html page. You don't need the anchor but you do need a
 form name. Something like:
 
   href=javascript:document.FormName.submit();
 
 Cheers
 Arno
 
 
And all it takes for that to break is for someone to turn off
Javascript...

Thanks,
Ash
http://www.ashleysheridan.co.uk




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



[PHP] Re: Directory Listing

2009-08-25 Thread Ralph Deffke
I would say
foreach( $dirTree as $key = $value ){
echo $key .br;
foreach( $value as $v){
echo $v .br;
}
}

something like that

ralph_def...@yahoo.de
Tom Chubb tomch...@gmail.com wrote in message
news:4577934f0908250241i195dc691x3f8c552e72791...@mail.gmail.com...
Hi gang,
I'm trying to create a script to read the files in a folder (approx
2000) and get the filename, path and last modified date in a tabulated
format to copy into excel. (We have been issued a CD and need to get
all files documented and assigned to an owner.)

I've tried loads of different scripts but can't get them working with
all the features.
I think the best one to work with is this (although I'm having
problems getting the date but don't worry about that at the moment)

?
error_reporting(E_ALL);
ini_set('display_errors', true);
function getDirectory($path = '.', $ignore = '') {
$dirTree = array ();
$dirTreeTemp = array ();
$ignore[] = '.';
$ignore[] = '..';

$dh = @opendir($path);

while (false !== ($file = readdir($dh))) {

if (!in_array($file, $ignore)) {
if (!is_dir($path/$file)) {

$dirTree[$path][] = $file;

} else {

$dirTreeTemp = getDirectory($path/$file, $ignore);
if (is_array($dirTreeTemp))$dirTree =
array_merge($dirTree, $dirTreeTemp);
}
}
}
closedir($dh);

return $dirTree;
}

$ignore = array('.htaccess', 'error_log', 'cgi-bin', 'php.ini',
'.ftpquota');

$dirTree = getDirectory('./Tender', $ignore);
?
pre
?
print_r($dirTree);
?
/pre

?php
getdirectory('./Tender');
//or
//get_dir_iterative(/*etc.*/);
?






Here is an example of what I'm getting out from the $dirTree array:

Array
(
[./Tender] = Array
(
[0] = 9216_100_REV_V1.0_bound.dwg
)


[./Tender/Tender Docs] = Array
(
[0] = BAA Works Terms v1.1 (22.05.08).pdf
[1] = Contents of Volumes 1 and 2.pdf
[2] = Cover Letter and Instructions.doc

[3] = Form of Tender.doc
)

[./Tender/Tender Docs/Health and Safety Questionnaire] = Array
(
[0] = NT Baggage Tender Questionaire rev2.xls
)


[./Tender/Tender Docs/NTB BH Lighting] = Array
(
[0] = 3J-B-1 PIR.xls
[1] = 3J-B-2B PIR.xls
[2] = 3J-B-2R PIR.xls
[3] = 3J-B-3R PIR.xls

[4] = 3J-D PIR.xls
[5] = 4G-G PIR.xls
[6] = 4J-B-1B PIR.xls
[7] = 4J-B-1R PIR.xls
[8] = 4J-B-2B PIR.xls
[9] = 4J-B-2R PIR.xls

[10] = 4J-B-4 PIR.xls
[11] = 5G-G PIR.xls
)

I'm having problems getting my head round how to get access the array
data so that I can format it how I want, eg:

Folder   Filename
Tender   9216_100_REV_V1.0_bound.dwg
Tender/Tender Docs   BAA Works Terms v1.1 (22.05.08).pdf
Tender/Tender Docs   Contents of Volumes 1 and 2.pdf

etc.

I'm trying to do this at work (php is a hobby and this is the first
time I've tried to use it in my electrical engineering job) in notepad
without any code highlighting, etc. and tearing my hair out to try and
avoid going through the CD manually!

Could anybody please help or let me know which function I need to read
up on? I've tried countless searches on array formatting, etc and not
getting anywhere.

Thanks in advance,

Tom



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



Re: [PHP] Re: Directory Listing

2009-08-25 Thread Ashley Sheridan
On Tue, 2009-08-25 at 12:06 +0200, Ralph Deffke wrote:
 I would say
 foreach( $dirTree as $key = $value ){
 echo $key .br;
 foreach( $value as $v){
 echo $v .br;
 }
 }
 
 something like that
 
 ralph_def...@yahoo.de
 Tom Chubb tomch...@gmail.com wrote in message
 news:4577934f0908250241i195dc691x3f8c552e72791...@mail.gmail.com...
 Hi gang,
 I'm trying to create a script to read the files in a folder (approx
 2000) and get the filename, path and last modified date in a tabulated
 format to copy into excel. (We have been issued a CD and need to get
 all files documented and assigned to an owner.)
 
 I've tried loads of different scripts but can't get them working with
 all the features.
 I think the best one to work with is this (although I'm having
 problems getting the date but don't worry about that at the moment)
 
 ?
 error_reporting(E_ALL);
 ini_set('display_errors', true);
 function getDirectory($path = '.', $ignore = '') {
 $dirTree = array ();
 $dirTreeTemp = array ();
 $ignore[] = '.';
 $ignore[] = '..';
 
 $dh = @opendir($path);
 
 while (false !== ($file = readdir($dh))) {
 
 if (!in_array($file, $ignore)) {
 if (!is_dir($path/$file)) {
 
 $dirTree[$path][] = $file;
 
 } else {
 
 $dirTreeTemp = getDirectory($path/$file, $ignore);
 if (is_array($dirTreeTemp))$dirTree =
 array_merge($dirTree, $dirTreeTemp);
 }
 }
 }
 closedir($dh);
 
 return $dirTree;
 }
 
 $ignore = array('.htaccess', 'error_log', 'cgi-bin', 'php.ini',
 '.ftpquota');
 
 $dirTree = getDirectory('./Tender', $ignore);
 ?
 pre
 ?
 print_r($dirTree);
 ?
 /pre
 
 ?php
 getdirectory('./Tender');
 //or
 //get_dir_iterative(/*etc.*/);
 ?
 
 
 
 
 
 
 Here is an example of what I'm getting out from the $dirTree array:
 
 Array
 (
 [./Tender] = Array
 (
 [0] = 9216_100_REV_V1.0_bound.dwg
 )
 
 
 [./Tender/Tender Docs] = Array
 (
 [0] = BAA Works Terms v1.1 (22.05.08).pdf
 [1] = Contents of Volumes 1 and 2.pdf
 [2] = Cover Letter and Instructions.doc
 
 [3] = Form of Tender.doc
 )
 
 [./Tender/Tender Docs/Health and Safety Questionnaire] = Array
 (
 [0] = NT Baggage Tender Questionaire rev2.xls
 )
 
 
 [./Tender/Tender Docs/NTB BH Lighting] = Array
 (
 [0] = 3J-B-1 PIR.xls
 [1] = 3J-B-2B PIR.xls
 [2] = 3J-B-2R PIR.xls
 [3] = 3J-B-3R PIR.xls
 
 [4] = 3J-D PIR.xls
 [5] = 4G-G PIR.xls
 [6] = 4J-B-1B PIR.xls
 [7] = 4J-B-1R PIR.xls
 [8] = 4J-B-2B PIR.xls
 [9] = 4J-B-2R PIR.xls
 
 [10] = 4J-B-4 PIR.xls
 [11] = 5G-G PIR.xls
 )
 
 I'm having problems getting my head round how to get access the array
 data so that I can format it how I want, eg:
 
 Folder   Filename
 Tender   9216_100_REV_V1.0_bound.dwg
 Tender/Tender Docs   BAA Works Terms v1.1 (22.05.08).pdf
 Tender/Tender Docs   Contents of Volumes 1 and 2.pdf
 
 etc.
 
 I'm trying to do this at work (php is a hobby and this is the first
 time I've tried to use it in my electrical engineering job) in notepad
 without any code highlighting, etc. and tearing my hair out to try and
 avoid going through the CD manually!
 
 Could anybody please help or let me know which function I need to read
 up on? I've tried countless searches on array formatting, etc and not
 getting anywhere.
 
 Thanks in advance,
 
 Tom
 
 
 
Funnily enough, I've had to dust off an old function I wrote for this
sort of thing this very morning:

function dirTree($dir)
{
$dirs = Array();
if($dh = opendir($dir))
{
$dirCount = 0;
while(false !== ($file = readdir($dh)))
{
// ignore the pseudo . and .. directories
if( $file == '.' || $file == '..')
{
continue;
}
$path = str_replace('//', '/', $dir/$file);
if(is_dir($path))
{
$dirs[$path] = dirTree($path);
$dirCount ++;
}
if(is_file($path) )
{
// process this file

}
}
if($dirCount  0)
{
return $dirs;
}
else
{
return false;
}
}
else
{
return false;
}
}

$dir = /home/user/Documents/;
$tree = dirTree($dir);

The array $tree is a multidimensional array which should make sense to
look at if you do a print_r() on it!

The code looks a bit messy, and could be improved probably a dozen ways,
but it does work, and is 

Re: [PHP] Re: Directory Listing

2009-08-25 Thread Tom Chubb
2009/8/25 Ashley Sheridan a...@ashleysheridan.co.uk:
 On Tue, 2009-08-25 at 12:06 +0200, Ralph Deffke wrote:
 I would say
 foreach( $dirTree as $key = $value ){
     echo $key .br;
     foreach( $value as $v){
         echo $v .br;
     }
 }

 something like that

 ralph_def...@yahoo.de
 Tom Chubb tomch...@gmail.com wrote in message
 news:4577934f0908250241i195dc691x3f8c552e72791...@mail.gmail.com...
 Hi gang,
 I'm trying to create a script to read the files in a folder (approx
 2000) and get the filename, path and last modified date in a tabulated
 format to copy into excel. (We have been issued a CD and need to get
 all files documented and assigned to an owner.)

 I've tried loads of different scripts but can't get them working with
 all the features.
 I think the best one to work with is this (although I'm having
 problems getting the date but don't worry about that at the moment)

 ?
 error_reporting(E_ALL);
 ini_set('display_errors', true);
 function getDirectory($path = '.', $ignore = '') {
 $dirTree = array ();
 $dirTreeTemp = array ();
 $ignore[] = '.';
 $ignore[] = '..';

 $dh = @opendir($path);

 while (false !== ($file = readdir($dh))) {

 if (!in_array($file, $ignore)) {
 if (!is_dir($path/$file)) {

 $dirTree[$path][] = $file;

 } else {

 $dirTreeTemp = getDirectory($path/$file, $ignore);
 if (is_array($dirTreeTemp))$dirTree =
 array_merge($dirTree, $dirTreeTemp);
 }
 }
 }
 closedir($dh);

 return $dirTree;
 }

 $ignore = array('.htaccess', 'error_log', 'cgi-bin', 'php.ini',
 '.ftpquota');

 $dirTree = getDirectory('./Tender', $ignore);
 ?
 pre
 ?
 print_r($dirTree);
 ?
 /pre

 ?php
 getdirectory('./Tender');
 //or
 //get_dir_iterative(/*etc.*/);
 ?






 Here is an example of what I'm getting out from the $dirTree array:

     Array
 (
     [./Tender] = Array
         (
             [0] = 9216_100_REV_V1.0_bound.dwg
         )


     [./Tender/Tender Docs] = Array
         (
             [0] = BAA Works Terms v1.1 (22.05.08).pdf
             [1] = Contents of Volumes 1 and 2.pdf
             [2] = Cover Letter and Instructions.doc

             [3] = Form of Tender.doc
         )

     [./Tender/Tender Docs/Health and Safety Questionnaire] = Array
         (
             [0] = NT Baggage Tender Questionaire rev2.xls
         )


     [./Tender/Tender Docs/NTB BH Lighting] = Array
         (
             [0] = 3J-B-1 PIR.xls
             [1] = 3J-B-2B PIR.xls
             [2] = 3J-B-2R PIR.xls
             [3] = 3J-B-3R PIR.xls

             [4] = 3J-D PIR.xls
             [5] = 4G-G PIR.xls
             [6] = 4J-B-1B PIR.xls
             [7] = 4J-B-1R PIR.xls
             [8] = 4J-B-2B PIR.xls
             [9] = 4J-B-2R PIR.xls

             [10] = 4J-B-4 PIR.xls
             [11] = 5G-G PIR.xls
         )

 I'm having problems getting my head round how to get access the array
 data so that I can format it how I want, eg:

 Folder   Filename
 Tender   9216_100_REV_V1.0_bound.dwg
 Tender/Tender Docs   BAA Works Terms v1.1 (22.05.08).pdf
 Tender/Tender Docs   Contents of Volumes 1 and 2.pdf

 etc.

 I'm trying to do this at work (php is a hobby and this is the first
 time I've tried to use it in my electrical engineering job) in notepad
 without any code highlighting, etc. and tearing my hair out to try and
 avoid going through the CD manually!

 Could anybody please help or let me know which function I need to read
 up on? I've tried countless searches on array formatting, etc and not
 getting anywhere.

 Thanks in advance,

 Tom



 Funnily enough, I've had to dust off an old function I wrote for this
 sort of thing this very morning:

 function dirTree($dir)
 {
        $dirs = Array();
        if($dh = opendir($dir))
        {
                $dirCount = 0;
                while(false !== ($file = readdir($dh)))
                {
                        // ignore the pseudo . and .. directories
                        if( $file == '.' || $file == '..')
                        {
                                continue;
                        }
                        $path = str_replace('//', '/', $dir/$file);
                        if(is_dir($path))
                        {
                                $dirs[$path] = dirTree($path);
                                $dirCount ++;
                        }
                        if(is_file($path) )
                        {
                                // process this file

                        }
                }
                if($dirCount  0)
                {
                        return $dirs;
                }
                else
                {
                        return false;
                }
        }
        else
        {
                return false;
        }
 }

 $dir = /home/user/Documents/;
 $tree = dirTree($dir);

 The array $tree is a multidimensional array which should make sense to
 look at if you do a print_r() on it!

 The code looks a bit messy, and could be improved probably a dozen ways,
 

Re: [PHP] Re: unset() something that doesn't exist

2009-08-25 Thread Tom Worster
On 8/25/09 5:00 AM, Ralph Deffke ralph_def...@yahoo.de wrote:

 of course its a syntax error, because unset() IS NOT A FUNCTION its a
 language construct

that's hard to believe. i can't imagine how the compiler could reliably
predict if the argument will be set or not when the unset line is executed.


 Stuart stut...@gmail.com wrote in message
 news:a5f019de0908250201g14e4b61cn73c6cd67da6f...@mail.gmail.com...
 2009/8/25 Ralph Deffke ralph_def...@yahoo.de:
 causes an error
 Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'$''
 in
 C:\wamp\www\TinyCreator\testCrapp6.php on line 42
 
 This is a syntax error, not a runtime error. You've clearly done
 something wrong.
 
 Tom Worster f...@thefsb.org wrote in message
 news:c6b87877.11463%...@thefsb.org...
 is it the case that unset() does not trigger an error or throw an
 exception
 if it's argument was never set?
 
 Absolutely.
 
 -Stuart
 
 -- 
 http://stut.net/
 
 



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



Re: [PHP] Re: Directory Listing

2009-08-25 Thread Tom Chubb
2009/8/25 Ralph Deffke ralph_def...@yahoo.de:
 I would say
 foreach( $dirTree as $key = $value ){
    echo $key .br;
    foreach( $value as $v){
        echo $v .br;
    }
 }

 something like that

 ralph_def...@yahoo.de
 Tom Chubb tomch...@gmail.com wrote in message
 news:4577934f0908250241i195dc691x3f8c552e72791...@mail.gmail.com...
 Hi gang,
 I'm trying to create a script to read the files in a folder (approx
 2000) and get the filename, path and last modified date in a tabulated
 format to copy into excel. (We have been issued a CD and need to get
 all files documented and assigned to an owner.)

 I've tried loads of different scripts but can't get them working with
 all the features.
 I think the best one to work with is this (although I'm having
 problems getting the date but don't worry about that at the moment)

 ?
 error_reporting(E_ALL);
 ini_set('display_errors', true);
 function getDirectory($path = '.', $ignore = '') {
 $dirTree = array ();
 $dirTreeTemp = array ();
 $ignore[] = '.';
 $ignore[] = '..';

 $dh = @opendir($path);

 while (false !== ($file = readdir($dh))) {

 if (!in_array($file, $ignore)) {
 if (!is_dir($path/$file)) {

 $dirTree[$path][] = $file;

 } else {

 $dirTreeTemp = getDirectory($path/$file, $ignore);
 if (is_array($dirTreeTemp))$dirTree =
 array_merge($dirTree, $dirTreeTemp);
 }
 }
 }
 closedir($dh);

 return $dirTree;
 }

 $ignore = array('.htaccess', 'error_log', 'cgi-bin', 'php.ini',
 '.ftpquota');

 $dirTree = getDirectory('./Tender', $ignore);
 ?
 pre
 ?
 print_r($dirTree);
 ?
 /pre

 ?php
 getdirectory('./Tender');
 //or
 //get_dir_iterative(/*etc.*/);
 ?






 Here is an example of what I'm getting out from the $dirTree array:

    Array
 (
    [./Tender] = Array
        (
            [0] = 9216_100_REV_V1.0_bound.dwg
        )


    [./Tender/Tender Docs] = Array
        (
            [0] = BAA Works Terms v1.1 (22.05.08).pdf
            [1] = Contents of Volumes 1 and 2.pdf
            [2] = Cover Letter and Instructions.doc

            [3] = Form of Tender.doc
        )

    [./Tender/Tender Docs/Health and Safety Questionnaire] = Array
        (
            [0] = NT Baggage Tender Questionaire rev2.xls
        )


    [./Tender/Tender Docs/NTB BH Lighting] = Array
        (
            [0] = 3J-B-1 PIR.xls
            [1] = 3J-B-2B PIR.xls
            [2] = 3J-B-2R PIR.xls
            [3] = 3J-B-3R PIR.xls

            [4] = 3J-D PIR.xls
            [5] = 4G-G PIR.xls
            [6] = 4J-B-1B PIR.xls
            [7] = 4J-B-1R PIR.xls
            [8] = 4J-B-2B PIR.xls
            [9] = 4J-B-2R PIR.xls

            [10] = 4J-B-4 PIR.xls
            [11] = 5G-G PIR.xls
        )

 I'm having problems getting my head round how to get access the array
 data so that I can format it how I want, eg:

 Folder   Filename
 Tender   9216_100_REV_V1.0_bound.dwg
 Tender/Tender Docs   BAA Works Terms v1.1 (22.05.08).pdf
 Tender/Tender Docs   Contents of Volumes 1 and 2.pdf

 etc.

 I'm trying to do this at work (php is a hobby and this is the first
 time I've tried to use it in my electrical engineering job) in notepad
 without any code highlighting, etc. and tearing my hair out to try and
 avoid going through the CD manually!

 Could anybody please help or let me know which function I need to read
 up on? I've tried countless searches on array formatting, etc and not
 getting anywhere.

 Thanks in advance,

 Tom



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



Ended up tidying it up and using Ralph's idea and now working nicely.
(Need to 'view source' to see it properly as I was having issues
copying into excel but this is fine for what I'm trying to do.)

Now I'm having problems getting the file date.
I'm using: $modDate[$file][] = date (d m Y, filemtime($file));
and trying to merge it into the array but I'm missing something. Any
ideas?
Refer to lines 5, 14, 17,


New code:

?
function getDirectory($path = '.', $ignore = '') {
$dirTree = array ();
$dirTreeTemp = array ();
$modDate = array ();
$ignore[] = '.';
$ignore[] = '..';
$dh = @opendir($path);

while (false !== ($file = readdir($dh))) {
if (!in_array($file, $ignore)) {
if (!is_dir($path/$file)) {
$dirTree[$path][] = $file;
$modDate[$file][] = date (d m Y,
filemtime($file));
} else {
$dirTreeTemp = getDirectory($path/$file, $ignore);
if (is_array($dirTreeTemp))$dirTree =
array_merge($dirTree, $dirTreeTemp, $modDate);
//if (is_array($dirTreeTemp))$dirTree =
array_merge($dirTree, $dirTreeTemp);
}
}
}
closedir($dh);
return $dirTree;
}

$ignore = array('.htaccess', 'error_log', 'cgi-bin', 'php.ini', '.ftpquota');
$dirTree = getDirectory('./Tender', $ignore);
getdirectory('./Tender');

echo Gatwick Tender Documents\n;

foreach( $dirTree as $key = $folder ){
   //echo $key . \n; //Don't 

Re: [PHP] Re: unset() something that doesn't exist

2009-08-25 Thread Ralph Deffke
?php

$a = bhsdhjk;

unset();
?

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'$'' in
C:\wamp\www\TinyCreator\testCrapp8.php on line 5


the function! doen't exist its a language construct

http://us.php.net/manual/en/function.unset.php


Stuart stut...@gmail.com wrote in message
news:a5f019de0908250344y17c96d5eqc5cedd944e1f7...@mail.gmail.com...
 2009/8/25 Ralph Deffke ralph_def...@yahoo.de:
  of course its a syntax error, because unset() IS NOT A FUNCTION its a
  language construct

 FFS, stop talking out of your rear end and post line 42 of
 testCrapp6.php. Or not, your choice.

 -Stuart

 -- 
 http://stut.net/

  Stuart stut...@gmail.com wrote in message
  news:a5f019de0908250201g14e4b61cn73c6cd67da6f...@mail.gmail.com...
  2009/8/25 Ralph Deffke ralph_def...@yahoo.de:
   causes an error
   Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`'$''
  in
   C:\wamp\www\TinyCreator\testCrapp6.php on line 42
 
  This is a syntax error, not a runtime error. You've clearly done
  something wrong.
 
   Tom Worster f...@thefsb.org wrote in message
   news:c6b87877.11463%...@thefsb.org...
   is it the case that unset() does not trigger an error or throw an
   exception
   if it's argument was never set?
 
  Absolutely.
 
  -Stuart
 
  --
  http://stut.net/
 
 
 
  --
  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



RE: [PHP] Re: unset() something that doesn't exist

2009-08-25 Thread Aipok
The function is described as void unset  ( mixed $var  [, mixed $var  [,
mixed $...  ]] )

You should use unset($a); in that case.



-Mensaje original-
De: Ralph Deffke [mailto:ralph_def...@yahoo.de] 
Enviado el: martes, 25 de agosto de 2009 13:07
Para: php-general@lists.php.net
Asunto: Re: [PHP] Re: unset() something that doesn't exist

?php

$a = bhsdhjk;

unset();
?

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'$'' in
C:\wamp\www\TinyCreator\testCrapp8.php on line 5


the function! doen't exist its a language construct

http://us.php.net/manual/en/function.unset.php


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



Re: [PHP] Re: unset() something that doesn't exist

2009-08-25 Thread Stuart
2009/8/25 Ralph Deffke ralph_def...@yahoo.de:
 ?php

 $a = bhsdhjk;

 unset();
 ?

 Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'$'' in
 C:\wamp\www\TinyCreator\testCrapp8.php on line 5


 the function! doen't exist its a language construct

 http://us.php.net/manual/en/function.unset.php

Seriously? What part of expecting something confuses you? While it
is true that it's a language construct and not a function that doesn't
mean it's intelligent enough to figure out what you want it to do -
you still have to tell it!!

I mean, come on!!

-Stuart

-- 
http://stut.net/

 Stuart stut...@gmail.com wrote in message
 news:a5f019de0908250344y17c96d5eqc5cedd944e1f7...@mail.gmail.com...
 2009/8/25 Ralph Deffke ralph_def...@yahoo.de:
  of course its a syntax error, because unset() IS NOT A FUNCTION its a
  language construct

 FFS, stop talking out of your rear end and post line 42 of
 testCrapp6.php. Or not, your choice.

 -Stuart

 --
 http://stut.net/

  Stuart stut...@gmail.com wrote in message
  news:a5f019de0908250201g14e4b61cn73c6cd67da6f...@mail.gmail.com...
  2009/8/25 Ralph Deffke ralph_def...@yahoo.de:
   causes an error
   Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
 `'$''
  in
   C:\wamp\www\TinyCreator\testCrapp6.php on line 42
 
  This is a syntax error, not a runtime error. You've clearly done
  something wrong.
 
   Tom Worster f...@thefsb.org wrote in message
   news:c6b87877.11463%...@thefsb.org...
   is it the case that unset() does not trigger an error or throw an
   exception
   if it's argument was never set?
 
  Absolutely.
 
  -Stuart
 
  --
  http://stut.net/
 
 
 
  --
  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



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



RE: [PHP] (was: anchor inside form) js switched on/off

2009-08-25 Thread Arno Kuhl
 
 You can use javascript behind a button or image or link to submit the 
 form from anywhere in your html page. You don't need the anchor but 
 you do need a form name. Something like:
 
   href=javascript:document.FormName.submit();
 
 Cheers
 Arno
 
 
And all it takes for that to break is for someone to turn off Javascript...

Thanks,
Ash
http://www.ashleysheridan.co.uk

-

Ash, from what I've seen you enjoy engaging in a debate. Well here's
something you'll no doubt want to engage in: the number of people who have
javascript switched off vs the number of people using browsers that support
all the latest ajax-type gizmos. I've not seen anyone told not to go the
ajax route, but it's amazing how concerned some people are about whether
javascript is switched on or not (the fact that js is required for ajax
seems to be overlooked). When w3schools was still keeping stats about it
they showed about 5% of users had js switched off (though they conceded the
stats were unreliable - tech types go to w3schools and they're much more
likely to mess with browser settings than the average user). Generally it's
accepted that the average joe doesn't know how to switch js off, or even why
they would want to. When we investigated sites where this is specifically
measured (e.g. a banking site, which I once worked on) users who had js
switched off were prompted to switch it on, and logs showed that 100% of
those users reloaded the page with js switched on (and our stats, during the
launch phase, showed much less than .5% users had js switched off in the
first place). Generally we found that requiring js was a complete non-issue.
I've subsequently found this is true on other sites I've worked on, even
when users are not prompted. With navigation menus using js more frequently
these days and the increased use of ajax, browsing with js switched off is
almost not an option anymore. I'm sure, Ash, you'll tell me how corporate
firewalls strip javascripts - I'd be interested if you can point out an
example and show how common this is. And as for most people telling you js
is a bad idea - is this true? Do you have stats to back up your statement,
or are you just stating your perception as a fact?

A second point, Ash, is that you yourself have mentioned coding javascript,
and have suggested the use of ajax as a solution to others - I presume you
know what the j in ajax is? I've even seen you providing javascript
solutions without any concern as to whether js was switched on or not.
Perhaps your concern about js is selectively applied to certain posts rather
than real-world situations?

BTW I'm not in a debating mood - I've made my point, no doubt Ash you'll
make yours, and I'll leave it at that. But if anyone else has any further
info regarding real-world stats or experience about js switched on or off it
would be very interesting to hear.

Cheers
Arno


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



RE: [PHP] (was: anchor inside form) js switched on/off

2009-08-25 Thread Ashley Sheridan
I'm not saying Javascript is evil, and yes I do know what the J in AJAX
is, I'm not as stupid as I look! I use it for plenty of things, but as
an aid rather than the core functionality.

As for the firewalls stripping Javascript, I don't have a specific
reference myself, but I've read about it a few times online before, and
for your benefit here is an example
http://www.456bereastreet.com/archive/200612/you_cannot_rely_on_javascript_being_available_period/

I don't have any stats to back this up, but I was led to believe that a
lot of specialist browsers (like Braille browsers) were unable to handle
Javascript, or that a lot of Javascript fails because the event handlers
that are used do not translate well outside of a mouse environment.

I said that Javascript was a bad idea in this case because it's for a
form submission, and if I remember correctly, for some sort of shopping
cart-esque site. Having several submit buttons should be able to cope
with this sort of situation provided it is thought out logically.

I do think it is important to try to cater for as wide an audience as
possible, and if that means making sure things work with essential
functionality when Javascript isn't available then so be it. Javascript
should be there to enhance functionality, not be it. This obviously
can't hold true for some situations (imagine Google Docs without
Javascript!) but a lot are often overlooked. I recall seeing some awful
code at my last job, where somebody had thought it was a good idea to
use Javascript for everything, including ALL form submissions. They'd
even made all links look like this:

a style=cursor: hand; onclick=location.href='somepage.cfm';click
me/a

I'd consider this the worst of the worst, and probably something I'll
never see again, but it has made me wary of any solutions that are
Javascript only.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Re: unset() something that doesn't exist

2009-08-25 Thread Stuart
Please don't reply directly unless you intend to pay me for my time.

2009/8/25 Ralph Deffke ralph_def...@yahoo.de:
 sorry but its about the top topic it say it never does an error if u dont
 give an argument

I accept that your English is not great, but given that you should be
a bit more careful.

The OP said is it the case that unset() does not trigger an error or
throw an exception if it's argument was never set?. That does not say
if you don't give an argument. Not even close.

-Stuart

-- 
http://stut.net/

 
 Von: Stuart stut...@gmail.com
 An: Ralph Deffke ralph_def...@yahoo.de
 CC: php-general@lists.php.net
 Gesendet: Dienstag, den 25. August 2009, 14:51:09 Uhr
 Betreff: Re: [PHP] Re: unset() something that doesn't exist

 2009/8/25 Ralph Deffke ralph_def...@yahoo.de:
 ?php

 $a = bhsdhjk;

 unset();
 ?

 Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'$'' in
 C:\wamp\www\TinyCreator\testCrapp8.php on line 5


 the function! doen't exist its a language construct

 http://us.php.net/manual/en/function.unset.php

 Seriously? What part of expecting something confuses you? While it
 is true that it's a language construct and not a function that doesn't
 mean it's intelligent enough to figure out what you want it to do -
 you still have to tell it!!

 I mean, come on!!

 -Stuart

 --
 http://stut.net/

 Stuart stut...@gmail.com wrote in message
 news:a5f019de0908250344y17c96d5eqc5cedd944e1f7...@mail.gmail.com...
 2009/8/25 Ralph Deffke ralph_def...@yahoo.de:
  of course its a syntax error, because unset() IS NOT A FUNCTION its a
  language construct

 FFS, stop talking out of your rear end and post line 42 of
 testCrapp6.php. Or not, your choice.

 -Stuart

 --
 http://stut.net/

  Stuart stut...@gmail.com wrote in message
  news:a5f019de0908250201g14e4b61cn73c6cd67da6f...@mail.gmail.com...
  2009/8/25 Ralph Deffke ralph_def...@yahoo.de:
   causes an error
   Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
 `'$''
  in
   C:\wamp\www\TinyCreator\testCrapp6.php on line 42
 
  This is a syntax error, not a runtime error. You've clearly done
  something wrong.
 
   Tom Worster f...@thefsb.org wrote in message
   news:c6b87877.11463%...@thefsb.org...
   is it the case that unset() does not trigger an error or throw an
   exception
   if it's argument was never set?
 
  Absolutely.
 
  -Stuart
 
  --
  http://stut.net/
 
 
 
  --
  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



 __
 Do You Yahoo!?
 Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz
 gegen Massenmails.
 http://mail.yahoo.com

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



Re: [PHP] Re: unset() something that doesn't exist

2009-08-25 Thread tedd

At 2:31 PM +0100 8/25/09, Stuart wrote:

Please don't reply directly unless you intend to pay me for my time.

2009/8/25 Ralph Deffke ralph_def...@yahoo.de:

 sorry but its about the top topic it say it never does an error if u dont
 give an argument


I accept that your English is not great, but given that you should be
a bit more careful.

The OP said is it the case that unset() does not trigger an error or
throw an exception if it's argument was never set?. That does not say
if you don't give an argument. Not even close.

-Stuart


I can't believe that you are wasting time on this. This guy is beyond clueless.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Speed Issues PHP vs ASP.net

2009-08-25 Thread Igor Escobar
Recently i read this blog post about speed issues comparing PHP with
ASP.net, please, read that and comment what you think about it:
http://misfitgeek.com/blog/aspnet/php-versus-asp-net-ndash-windows-versus-linux-ndash-who-rsquo-s-the-fastest/

The big deal is: I don't know if this bechmark is true or false but, what
are doing the PHP team about speed issues? Results like that maybe results
like this can tarnish the image of language.

So, what do you think about it?


Regards,
Igor Escobar
Systems Analyst  Interface Designer

+ http://blog.igorescobar.com
+ http://www.igorescobar.com
+ @igorescobar (twitter)


RE: [PHP] (was: anchor inside form) js switched on/off

2009-08-25 Thread tedd

At 3:00 PM +0200 8/25/09, Arno Kuhl wrote:

-snip-

BTW I'm not in a debating mood - I've made my point, no doubt Ash you'll
make yours, and I'll leave it at that. But if anyone else has any further
info regarding real-world stats or experience about js switched on or off it
would be very interesting to hear.

Cheers
Arno


Arno:

Yes, I have a point and I agree with Ash because he is right. If you 
don't realize that, then that's your problem.


Additionally, I don't think that any of us need a lesson as to what 
the j stand for in ajax -- I'm not sure who you think you are 
talking too on this list, but welcome to my kill file.


tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



RE: [PHP] Speed Issues PHP vs ASP.net

2009-08-25 Thread kyle.smith
 
-Original Message-
Recently i read this blog post about speed issues comparing PHP with
ASP.net, please, read that and comment what you think about it:
http://misfitgeek.com/blog/aspnet/php-versus-asp-net-ndash-windows-versu
s-linux-ndash-who-rsquo-s-the-fastest/

The big deal is: I don't know if this bechmark is true or false but,
what are doing the PHP team about speed issues? Results like that maybe
results like this can tarnish the image of language.

So, what do you think about it?


--

My main issue with the tests is this:

ASP.NET (C#) is psuedo-byte-code compiled and cached prior to execution.
This is a huge boost to performance.  The tests should be re-done with
something like IonCube compiled PHP.

I think ASP.NET would still win, though.

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



[PHP] Beginner question

2009-08-25 Thread mike bode
I am trying to use PHP on my web site I am developing now. I have installed 
Apache 2.2 and PHP 5.2. My problem is that I can execute PHP code embedded 
in my HTML code, but I can't execute the same cose when I put it into a 
separate .php file that i then call from within the html code. for example:


I have a html file with

body
?php
echo Printing with php;
?
?body

and it works fine.

When I take out the php code and put it inot a file pp.php, and I call that 
file with my browser (localhost/pp.php), it works, too.


But when I change the html code to:

body
script type=text/javascript src=pp.php/script
/body

I get a blank page. this is probably something really stupid, but I have 
been wrecking my head for days now, and I can't figure it out. anybody has 
an idea? 



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



Re: [PHP] Speed Issues PHP vs ASP.net

2009-08-25 Thread Bastien Koert
On Tue, Aug 25, 2009 at 10:37 AM, kyle.smithkyle.sm...@inforonics.com wrote:

 -Original Message-
 Recently i read this blog post about speed issues comparing PHP with
 ASP.net, please, read that and comment what you think about it:
 http://misfitgeek.com/blog/aspnet/php-versus-asp-net-ndash-windows-versu
 s-linux-ndash-who-rsquo-s-the-fastest/

 The big deal is: I don't know if this bechmark is true or false but,
 what are doing the PHP team about speed issues? Results like that maybe
 results like this can tarnish the image of language.

 So, what do you think about it?


 --

 My main issue with the tests is this:

 ASP.NET (C#) is psuedo-byte-code compiled and cached prior to execution.
 This is a huge boost to performance.  The tests should be re-done with
 something like IonCube compiled PHP.

 I think ASP.NET would still win, though.

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



The one big thing missed in the article is portability. While running
ASP.NET under Mono on Linux is possible, its not likely to be as
workable as taking php to almost any other environment.

And really,if you want to learn c# then just go learn java and make it better.

-- 

Bastien

Cat, the other other white meat

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



Re: [PHP] Beginner question

2009-08-25 Thread Ashley Sheridan
On Mon, 2009-08-24 at 23:16 -0600, mike bode wrote:
 I am trying to use PHP on my web site I am developing now. I have installed 
 Apache 2.2 and PHP 5.2. My problem is that I can execute PHP code embedded 
 in my HTML code, but I can't execute the same cose when I put it into a 
 separate .php file that i then call from within the html code. for example:
 
 I have a html file with
 
 body
 ?php
 echo Printing with php;
 ?
 ?body
 
 and it works fine.
 
 When I take out the php code and put it inot a file pp.php, and I call that 
 file with my browser (localhost/pp.php), it works, too.
 
 But when I change the html code to:
 
 body
 script type=text/javascript src=pp.php/script
 /body
 
 I get a blank page. this is probably something really stupid, but I have 
 been wrecking my head for days now, and I can't figure it out. anybody has 
 an idea? 
 
 
Yes, this is not how you use PHP! PHP isn't embedded in HTML, it's
actually the other way round.

You should make the main page a .php page and from there you can include
the necessary HTML parts like so:

?php
include includes/header.html;

// body code here

include includes/footer.html;
?

Thanks,
Ash
http://www.ashleysheridan.co.uk




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



Re: [PHP] Re: unset() something that doesn't exist

2009-08-25 Thread hack988 hack988
php tigger is right i think.

Because of Zend engine parse line by line.(I can't use English give
expression to it with My Poor English).

It mean that (What I think) unset function is right parse but error
for is parameter.

Tigger Display :Warning: Wrong parameter count for unset  what
is your think.
But Developer want it backend  compatibility  that I guess.
See
http://us.php.net/manual/en/function.unset.php

change logs
4.0.1 Added support for multiple arguments.
4.0.0 unset() became an expression. (In PHP 3, unset() would always return 1).


2009/8/25 tedd tedd.sperl...@gmail.com:
 At 2:31 PM +0100 8/25/09, Stuart wrote:

 Please don't reply directly unless you intend to pay me for my time.

 2009/8/25 Ralph Deffke ralph_def...@yahoo.de:

  sorry but its about the top topic it say it never does an error if u
 dont
  give an argument

 I accept that your English is not great, but given that you should be
 a bit more careful.

 The OP said is it the case that unset() does not trigger an error or
 throw an exception if it's argument was never set?. That does not say
 if you don't give an argument. Not even close.

 -Stuart

 I can't believe that you are wasting time on this. This guy is beyond
 clueless.

 Cheers,

 tedd

 --
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com

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



RE: [PHP] Beginner question

2009-08-25 Thread abdulazeez alugo



 To: php-general@lists.php.net
 From: mikebo...@hotmail.com
 Date: Mon, 24 Aug 2009 23:16:02 -0600
 Subject: [PHP] Beginner question
 
 I am trying to use PHP on my web site I am developing now. I have installed 
 Apache 2.2 and PHP 5.2. My problem is that I can execute PHP code embedded 
 in my HTML code, but I can't execute the same cose when I put it into a 
 separate .php file that i then call from within the html code. for example:
 
 I have a html file with
 
 body
 ?php
 echo Printing with php;
 ?
 ?body
 
 and it works fine.
 
 When I take out the php code and put it inot a file pp.php, and I call that 
 file with my browser (localhost/pp.php), it works, too.
 
 But when I change the html code to:
 
 body
 script type=text/javascript src=pp.php/script
 /body
 
 I get a blank page. this is probably something really stupid, but I have 
 been wrecking my head for days now, and I can't figure it out. anybody has 
 an idea? 
 

Hello Bode,
You obviously purposefully asked your browser not to parse you php code. You 
are linking to a javascript instead of a php file. It's this simple; if you are 
create a .php file and u wish to incorporate it in your html code, you should 
use a function called include();. Simply try something like:

body
?php include(pp.php); ?
/body

Let me know what u get from that.

Alugo Abdulazeez
Serving you from Nigeria.
http://www.frangeovic.com

_
With Windows Live, you can organize, edit, and share your photos.
http://www.microsoft.com/middleeast/windows/windowslive/products/photo-gallery-edit.aspx

Re: [PHP] Beginner question

2009-08-25 Thread mike bode

Well, as I said: Beginner ...

I am actually trying to implement some html code that I found on the web, 
which uses php (see: 
http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm). They use the 
method I tried to call a function php and then display a photo album. 
Well, that doesn't work. I am just getting a blank page when I follow their 
instructions. So I thought I try to follow the trail and see where it ends. 
But how do I do that? I was attempting to do so with the script that I 
posted, but apparently that doesn't work. So, how do I find out why  my 
installation does not process the html code that I have posted a link to 
above? How would I implement that on my web site?


Thanks.

Ashley Sheridan a...@ashleysheridan.co.uk wrote in message 
news:1251211648.2799.46.ca...@localhost...

On Mon, 2009-08-24 at 23:16 -0600, mike bode wrote:
I am trying to use PHP on my web site I am developing now. I have 
installed
Apache 2.2 and PHP 5.2. My problem is that I can execute PHP code 
embedded

in my HTML code, but I can't execute the same cose when I put it into a
separate .php file that i then call from within the html code. for 
example:


I have a html file with

body
?php
echo Printing with php;
?
?body

and it works fine.

When I take out the php code and put it inot a file pp.php, and I call 
that

file with my browser (localhost/pp.php), it works, too.

But when I change the html code to:

body
script type=text/javascript src=pp.php/script
/body

I get a blank page. this is probably something really stupid, but I have
been wrecking my head for days now, and I can't figure it out. anybody 
has

an idea?



Yes, this is not how you use PHP! PHP isn't embedded in HTML, it's
actually the other way round.

You should make the main page a .php page and from there you can include
the necessary HTML parts like so:

?php
include includes/header.html;

// body code here

include includes/footer.html;
?

Thanks,
Ash
http://www.ashleysheridan.co.uk






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



Re: [PHP] Re: Directory Listing

2009-08-25 Thread Tom Chubb
I've been playing about more and now I have the following code:

?
error_reporting(E_ALL);
ini_set('display_errors', true);

function getDirectory($path = '.', $ignore = '') {
$dirTree = array ();
$dirTreeTemp = array ();
$fileDate = array ();
$ignore[] = '.';
$ignore[] = '..';
$dh = @opendir($path);
while (false !== ($file = readdir($dh))) {
if (!in_array($file, $ignore)) {
if (!is_dir($path/$file)) {
$dirTree[$path][] = $file;
$fileDate[$file][] = date (d/m/Y,
filemtime($path/$file));
} else {
$dirTreeTemp = getDirectory($path/$file, $ignore);
if (is_array($dirTreeTemp))$dirTree =
array_merge($dirTree, $dirTreeTemp, $fileDate);
}
}
}
closedir($dh);
return $dirTree;
}

$ignore = array('.htaccess', 'Thumbs.db', 'index.php');
$dirTree = getDirectory('.', $ignore);
getdirectory('.');

echo Gatwick Tender Documents\n;

foreach( $dirTree as $key = $folder ){
   echo \n; //Don't need folders as they're shown with the files
   foreach( $folder as $file){
   echo str_replace(./, , $key) . \t . $file . \t\n; //Pad
out with a tab for easy import into excel

   }
}
print_r($dirTree); //Just using this for debugging
?


The output is fine for the paths and filenames but I still can't get
the dates showing. It's getting the correct date for some but not all.
I did something else earlier and found that all the dates were
01/01/1970 but at least there was a date for every file but can't
remember how I go there!


Here is a sample output result:

Gatwick Tender Documents

.   9216_100_REV_V1.0_bound.dwg 

Tender Docs BAA Works Terms v1.1 (22.05.08).pdf 
Tender Docs Contents of Volumes 1 and 2.pdf 
Tender Docs Cover Letter and Instructions.doc   
Tender Docs Form of Tender.doc  

Tender Docs/Health and Safety Questionnaire NT Baggage Tender
Questionaire rev2.xls

BAA Works Terms v1.1 (22.05.08).pdf 29/07/2009  

Contents of Volumes 1 and 2.pdf 29/07/2009  

Cover Letter and Instructions.doc   29/07/2009  

Form of Tender.doc  29/07/2009  

Tender Docs/NTB BH Lighting 3J-B-1 PIR.xls  
Tender Docs/NTB BH Lighting 3J-B-2B PIR.xls 
Tender Docs/NTB BH Lighting 3J-B-2R PIR.xls 
Tender Docs/NTB BH Lighting 3J-B-3R PIR.xls 
Tender Docs/NTB BH Lighting 3J-D PIR.xls
Tender Docs/NTB BH Lighting 4G-G PIR.xls
Tender Docs/NTB BH Lighting 4J-B-1B PIR.xls 
Tender Docs/NTB BH Lighting 4J-B-1R PIR.xls 
Tender Docs/NTB BH Lighting 4J-B-2B PIR.xls 
Tender Docs/NTB BH Lighting 4J-B-2R PIR.xls 
Tender Docs/NTB BH Lighting 4J-B-4 PIR.xls  
Tender Docs/NTB BH Lighting 5G-G PIR.xls


Can anyone shed any light on it?
I'm about to admit defeat!

Thanks in advance and I'm not being lazy - I really am trying!!! :(

Tom

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



Re: [PHP] security question of ZCE exam

2009-08-25 Thread Daniel Brown
On Tue, Aug 25, 2009 at 00:07, Augusto Flavioafla...@gmail.com wrote:

 Answers: (choose 2)
    Error messages will contain sensitive session information
    Error messages can contain cross site scripting attacks
    Security risks involved in logging are handled by PHP
 X    Error messages give the perception of insecurity to the user
 X    Error messages can contain data useful to a potential attacker


 My answers is marked with a X.


 some clue about this?

Yes, and my answers are marked with an X.

XBuy a study guide.
XDo your own homework.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Check out our great hosting and dedicated server deals at
http://twitter.com/pilotpig

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



[PHP] Case Insensativity in String Comparisons

2009-08-25 Thread Ben Miller
Is there a simple to way to compare two strings with case insensitivity so
that the following will return true?

$foo = Arnold;
$bar = arnold;

If($foo == $bar) {

}

Thanks.


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



Re: [PHP] Case Insensativity in String Comparisons

2009-08-25 Thread Eddie Drapkin
On Tue, Aug 25, 2009 at 12:48 PM, Ben Millerbiprel...@gmail.com wrote:
 Is there a simple to way to compare two strings with case insensitivity so
 that the following will return true?

 $foo = Arnold;
 $bar = arnold;

 If($foo == $bar) {

 }

 Thanks.


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



http://www.php.net/manual/en/function.strcasecmp.php

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



[PHP] How to output a NULL field?

2009-08-25 Thread David Stoltz
$rs-Fields(22) equals a NULL in the database

My Code:

if(empty($rs-Fields(22))){
$q4 = ;
}else{
$q4 = $rs-Fields(22);
}

Produces this error:
Fatal error: Can't use method return value in write context in
D:\Inetpub\wwwroot\evaluations\lookup2.php on line 32

Line 32 is the if line...

If I switch the code to (using is_null):
if(is_null($rs-Fields(22))){
$q4 = ;
}else{
$q4 = $rs-Fields(22);
}

It produces this error:
Catchable fatal error: Object of class variant could not be converted to
string in D:\Inetpub\wwwroot\evaluations\lookup2.php on line 196

Line 196 is: ?php echo $q4;?

What am I doing wrong?

Thanks!

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



RE: [PHP] Beginner question

2009-08-25 Thread Arno Kuhl
-Original Message-
From: mike bode [mailto:mikebo...@hotmail.com]
Sent: 25 August 2009 07:16 AM
To: php-general@lists.php.net
Subject: [PHP] Beginner question

I am trying to use PHP on my web site I am developing now. I have installed
Apache 2.2 and PHP 5.2. My problem is that I can execute PHP code embedded
in my HTML code, but I can't execute the same cose when I put it into a
separate .php file that i then call from within the html code. for example:

I have a html file with

body
?php
echo Printing with php;
?
?body

and it works fine.

When I take out the php code and put it inot a file pp.php, and I call that
file with my browser (localhost/pp.php), it works, too.

But when I change the html code to:

body
script type=text/javascript src=pp.php/script /body

I get a blank page. this is probably something really stupid, but I have
been wrecking my head for days now, and I can't figure it out. anybody has
an idea?

--

I presume your html/php code is in a file with a .php extension? If not then
change the extension to php because most other webservers won't parse php
code in a html file. If you have a .php file you can mix html and php the
way you described, and you can put your php code between the ?php and ?
tags.

The php script you're trying to include in your html code with javascript
script type=text/javascript src=pp.php/script
would presumably echo out the javascript code that ends up in your html
page, but if you don't know php then you're trying to run before you can
walk.

If possible try to see what javascript code is being generated (echoed) by
the php script and put it in a normal .js file (e.g. pp.js) and then use it
like any other javascript file
script type=text/javascript src=pp.js/script
This isn't always possible because often php is used to decide what
javascript to output (otherwise why bother). If you have to use php to
generate your javascript code then start with small steps - try echoing some
simple js code in your pp.php (like an alert) just so you can see how it
works. Once you get that working you can move on to more useful things.


To illustrate, what's actually happening with the code you have at the
moment is this:

The browser parses the initial html code and finds
script type=text/javascript src=pp.php/script
And sends a request back to the server for pp.php

The server runs pp.php and send the output generated by the php script back
to the browser,
so effectively the browser ends up with
script type=text/javascriptPrinting with php/script

Obviously that isn't going to work. Hopefully you can now see what the
problem is and how to fix it.


Cheers
Arno





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



Re: [PHP] How to output a NULL field?

2009-08-25 Thread Bastien Koert
On Tue, Aug 25, 2009 at 2:00 PM, David Stoltzdsto...@shh.org wrote:
 $rs-Fields(22) equals a NULL in the database

 My Code:

 if(empty($rs-Fields(22))){
        $q4 = ;
 }else{
        $q4 = $rs-Fields(22);
 }

 Produces this error:
 Fatal error: Can't use method return value in write context in
 D:\Inetpub\wwwroot\evaluations\lookup2.php on line 32

 Line 32 is the if line...

 If I switch the code to (using is_null):
 if(is_null($rs-Fields(22))){
        $q4 = ;
 }else{
        $q4 = $rs-Fields(22);
 }

 It produces this error:
 Catchable fatal error: Object of class variant could not be converted to
 string in D:\Inetpub\wwwroot\evaluations\lookup2.php on line 196

 Line 196 is: ?php echo $q4;?

 What am I doing wrong?

 Thanks!

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




$q4 =  '' . $rs-Fields(22);

Note that it's two single quotes
-- 

Bastien

Cat, the other other white meat

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



RE: [PHP] How to output a NULL field?

2009-08-25 Thread David Stoltz
if(empty($rs-Fields(22))){
$q4 = '';
}else{
$q4 = ''.$rs-Fields(22);
}  

Still produces errors, whether using empty or is_nullwith single 
quotes

???

-Original Message-
From: Bastien Koert [mailto:phps...@gmail.com] 
Sent: Tuesday, August 25, 2009 2:17 PM
To: David Stoltz
Cc: php-general@lists.php.net
Subject: Re: [PHP] How to output a NULL field?

On Tue, Aug 25, 2009 at 2:00 PM, David Stoltzdsto...@shh.org wrote:
 $rs-Fields(22) equals a NULL in the database

 My Code:

 if(empty($rs-Fields(22))){
        $q4 = ;
 }else{
        $q4 = $rs-Fields(22);
 }

 Produces this error:
 Fatal error: Can't use method return value in write context in
 D:\Inetpub\wwwroot\evaluations\lookup2.php on line 32

 Line 32 is the if line...

 If I switch the code to (using is_null):
 if(is_null($rs-Fields(22))){
        $q4 = ;
 }else{
        $q4 = $rs-Fields(22);
 }

 It produces this error:
 Catchable fatal error: Object of class variant could not be converted to
 string in D:\Inetpub\wwwroot\evaluations\lookup2.php on line 196

 Line 196 is: ?php echo $q4;?

 What am I doing wrong?

 Thanks!

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




$q4 =  '' . $rs-Fields(22);

Note that it's two single quotes
-- 

Bastien

Cat, the other other white meat

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



Re: [PHP] Beginner question

2009-08-25 Thread tedd

At 11:16 PM -0600 8/24/09, mike bode wrote:
I get a blank page. this is probably something really stupid, but I 
have been wrecking my head for days now, and I can't figure it out. 
anybody has an idea?


Mike:

Here's an idea -- try this:

http://sperling.com/examples/include-demo/

If you complete that (a hour or so, not days), you'll have a much 
better idea of what this is all about.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Re: How to output a NULL field?

2009-08-25 Thread Shawn McKenzie
David Stoltz wrote:
 $rs-Fields(22) equals a NULL in the database
 
 My Code:
 
 if(empty($rs-Fields(22))){
   $q4 = ;
 }else{
   $q4 = $rs-Fields(22);
 }
 
 Produces this error:
 Fatal error: Can't use method return value in write context in
 D:\Inetpub\wwwroot\evaluations\lookup2.php on line 32
 
 Line 32 is the if line...
 
 If I switch the code to (using is_null):
 if(is_null($rs-Fields(22))){
   $q4 = ;
 }else{
   $q4 = $rs-Fields(22);
 }
 
 It produces this error:
 Catchable fatal error: Object of class variant could not be converted to
 string in D:\Inetpub\wwwroot\evaluations\lookup2.php on line 196
 
 Line 196 is: ?php echo $q4;?
 
 What am I doing wrong?
 
 Thanks!

First off, if the value is NULL in the database then in PHP it will be
the string NULL and not a null value as far as I remember.  Second,
you cant use a function/method in empty().  Thirdly, the string NULL
is not empty.  I'm not sure what DB class you're using here or what the
Fields() method actually returns.  You should do a
var_dump($rs-Fields(22)) to see. If it returns a string (especially
NULL), then this or some variation should work:

$q4 = $rs-Fields(22);

if($q4 == NULL){
$q4 = ;
}

If it returns an empty string or false then you may have nothing to do.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] How to output a NULL field?

2009-08-25 Thread Lars Torben Wilson
2009/8/25 David Stoltz dsto...@shh.org:
 if(empty($rs-Fields(22))){

Hi David,

You cannot call empty() on a function or class method like that. From
the manual:

   Note: empty() only checks variables as anything else will result in
a parse error. In other words, the following will not work:
   empty(trim($name)). - http://www.php.net/empty

You should assign the result of $rs-Fields(22) to a variable before
calling empty() on it, or use a class variable access to check it, or
check it first within the class and have Fields() return a suitable
value if needed.


Regards,

Torben

        $q4 = '';
 }else{
        $q4 = ''.$rs-Fields(22);
 }

 Still produces errors, whether using empty or is_nullwith single 
 quotes

 ???

 -Original Message-
 From: Bastien Koert [mailto:phps...@gmail.com]
 Sent: Tuesday, August 25, 2009 2:17 PM
 To: David Stoltz
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] How to output a NULL field?

 On Tue, Aug 25, 2009 at 2:00 PM, David Stoltzdsto...@shh.org wrote:
 $rs-Fields(22) equals a NULL in the database

 My Code:

 if(empty($rs-Fields(22))){
        $q4 = ;
 }else{
        $q4 = $rs-Fields(22);
 }

 Produces this error:
 Fatal error: Can't use method return value in write context in
 D:\Inetpub\wwwroot\evaluations\lookup2.php on line 32

 Line 32 is the if line...

 If I switch the code to (using is_null):
 if(is_null($rs-Fields(22))){
        $q4 = ;
 }else{
        $q4 = $rs-Fields(22);
 }

 It produces this error:
 Catchable fatal error: Object of class variant could not be converted to
 string in D:\Inetpub\wwwroot\evaluations\lookup2.php on line 196

 Line 196 is: ?php echo $q4;?

 What am I doing wrong?

 Thanks!

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




 $q4 =  '' . $rs-Fields(22);

 Note that it's two single quotes
 --

 Bastien

 Cat, the other other white meat

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



[PHP] php 5.2.x - Fatal error: Cannot re-assign $this in ...

2009-08-25 Thread John Stoffel

Hi,

I'm looking for some help with PHP5.2.x hacking on a web site to
cleanup how the user submitted search form is handled.  Basically I
want to make it simple for the end user to a) refine their query, b)
not have to answer popups if they hit the reload button, and c) so I
can learn more PHP.  I found this nice reference:

  http://us2.php.net/manual/en/language.variables.external.php

which has two sections by wayne and Jonas Lindel talking about how
you can take the results of a PHP POST request, stuff the vars into
your session, and redirect back to the same page without the POST vars
set, then complete the query.

The idea is so that when people hit the back or reload buttons,
they don't keep getting asked whether they want to resubmit their
data.

What I'm trying is not strictly needed, but it would be a nice cleanup
of the interface of the search forms for this site.  

I've been googling, reading php5.x docs and trying to understand what
needs to be done here.  I think I'm just missing how to re-assign
$this properly, so that when the redirect happens, the proper env is set.

Here's the snippet I'm trying to use, which bombs out with:

   Fatal error: Cannot re-assign $this in  on line 45

And the code I'm using is:

?

// We want to put the search query into a session so we can restore it
// easily when users goto look at full_holdings.php and then return to
// the overall display page.  We'll need to do a session_destroy in
// index.php I think.  See the tutorial(s) at
// http://www.phpf1.com/tutorial/php-sessions.html
// http://us3.php.net/manual/en/book.session.php

session_start();

// Now see Jonas Lindel's  Wayne's code at
// http://us2.php.net/manual/en/language.variables.external.php for
// this *nice* trick.

//is there POST or GET data we should look at
if($_POST or ($_GET and (!isset($_SESSION['skipnextget'] {

  //is there GET data?
  if($_GET) {
$newgetarr = array();
foreach($_GET as $key = $value) {
  if(is_array($value)) {
//if it's an array, convert it to comma separated
$newvalue = implode(',',$value);
  } else {
$newvalue = $value;
  }
  $newgetarr[] = $key.'='.$newvalue;
}
$newget = implode('',$newgetarr);
$_SESSION['skipnextget'] = 1;
  }
  foreach($_POST as $key = $value) {
$this[$key] = $value;
  }
  $_SESSION['postvars'] = serialize($this); //put POST in the session
  header(Location: http://; .$_SERVER['HTTP_HOST']
  . $_SERVER['PHP_SELF'] . '?\
' . $newget);
  //reload page without POST data and shorter GET data

  exit();
 } else { //after reloading we'll come right to this spot
  session_unregister('skipnextget');
  if(isset($_SESSION['postvars'])) {
//load the POST variables from the session

// Error on this line below!
$this = unserialize($_SESSION['postvars']);
session_unregister('postvars'); //delete the session stuff we
//don't need anymore.
return $this;
  }
 }

 // rest of my code goes here...
___

Thanks,
John
j...@stoffel.org

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



[PHP] Re: How to output a NULL field?

2009-08-25 Thread Shawn McKenzie
Shawn McKenzie wrote:
  First off, if the value is NULL in the database then in PHP it will be
 the string NULL and not a null value as far as I remember.  Second,
 you cant use a function/method in empty().  Thirdly, the string NULL
 is not empty.  I'm not sure what DB class you're using here or what the
 Fields() method actually returns.  You should do a
 var_dump($rs-Fields(22)) to see. If it returns a string (especially
 NULL), then this or some variation should work:
 
 $q4 = $rs-Fields(22);
 
 if($q4 == NULL){
   $q4 = ;
 }
 
 If it returns an empty string or false then you may have nothing to do.
 
DOH! My bad.  MySQL stores an empty value based upon the field type for
NULL.  So if the field type is int then it sets it to 0 and if its
varchar, etc, it sets it to an empty string .  The MySQL functions
seem to return everything as a string, so for an int field it returns
the string 0, so:

$q4 = $rs-Fields(22);

if(empty($q4)){
$q4 = ;
}

But I'm not sure what benefit you get from this except that 0 is
changed to .

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: php 5.2.x - Fatal error: Cannot re-assign $this in ...

2009-08-25 Thread Shawn McKenzie
John Stoffel wrote:
 Hi,
 
 I'm looking for some help with PHP5.2.x hacking on a web site to
 cleanup how the user submitted search form is handled.  Basically I
 want to make it simple for the end user to a) refine their query, b)
 not have to answer popups if they hit the reload button, and c) so I
 can learn more PHP.  I found this nice reference:
 
   http://us2.php.net/manual/en/language.variables.external.php
 
 which has two sections by wayne and Jonas Lindel talking about how
 you can take the results of a PHP POST request, stuff the vars into
 your session, and redirect back to the same page without the POST vars
 set, then complete the query.
 
 The idea is so that when people hit the back or reload buttons,
 they don't keep getting asked whether they want to resubmit their
 data.
 
 What I'm trying is not strictly needed, but it would be a nice cleanup
 of the interface of the search forms for this site.  
 
 I've been googling, reading php5.x docs and trying to understand what
 needs to be done here.  I think I'm just missing how to re-assign
 $this properly, so that when the redirect happens, the proper env is set.
 
 Here's the snippet I'm trying to use, which bombs out with:
 
Fatal error: Cannot re-assign $this in  on line 45
 
 And the code I'm using is:
 
 ?
 
 // We want to put the search query into a session so we can restore it
 // easily when users goto look at full_holdings.php and then return to
 // the overall display page.  We'll need to do a session_destroy in
 // index.php I think.  See the tutorial(s) at
 // http://www.phpf1.com/tutorial/php-sessions.html
 // http://us3.php.net/manual/en/book.session.php
 
 session_start();
 
 // Now see Jonas Lindel's  Wayne's code at
 // http://us2.php.net/manual/en/language.variables.external.php for
 // this *nice* trick.
 
 //is there POST or GET data we should look at
 if($_POST or ($_GET and (!isset($_SESSION['skipnextget'] {
 
   //is there GET data?
   if($_GET) {
 $newgetarr = array();
 foreach($_GET as $key = $value) {
   if(is_array($value)) {
 //if it's an array, convert it to comma separated
 $newvalue = implode(',',$value);
   } else {
 $newvalue = $value;
   }
   $newgetarr[] = $key.'='.$newvalue;
 }
 $newget = implode('',$newgetarr);
 $_SESSION['skipnextget'] = 1;
   }
   foreach($_POST as $key = $value) {
 $this[$key] = $value;
   }
   $_SESSION['postvars'] = serialize($this); //put POST in the session
   header(Location: http://; .$_SERVER['HTTP_HOST']
   . $_SERVER['PHP_SELF'] . '?\
 ' . $newget);
   //reload page without POST data and shorter GET data
 
   exit();
  } else { //after reloading we'll come right to this spot
   session_unregister('skipnextget');
   if(isset($_SESSION['postvars'])) {
 //load the POST variables from the session
 
 // Error on this line below!
 $this = unserialize($_SESSION['postvars']);
 session_unregister('postvars'); //delete the session stuff we
 //don't need anymore.
 return $this;
   }
  }
 
  // rest of my code goes here...
 ___
 
 Thanks,
 John
 j...@stoffel.org

I'm not sure if it is technically reserved, but $this is used in a class
in order for an object to refer to itself.  AFAIK you can't use it
anywhere other than that.  Just change all $this to $vars or something else.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: php 5.2.x - Fatal error: Cannot re-assign $this in ...

2009-08-25 Thread Shawn McKenzie
Shawn McKenzie wrote:
 John Stoffel wrote:
 Hi,

 I'm looking for some help with PHP5.2.x hacking on a web site to
 cleanup how the user submitted search form is handled.  Basically I
 want to make it simple for the end user to a) refine their query, b)
 not have to answer popups if they hit the reload button, and c) so I
 can learn more PHP.  I found this nice reference:

   http://us2.php.net/manual/en/language.variables.external.php

 which has two sections by wayne and Jonas Lindel talking about how
 you can take the results of a PHP POST request, stuff the vars into
 your session, and redirect back to the same page without the POST vars
 set, then complete the query.

 The idea is so that when people hit the back or reload buttons,
 they don't keep getting asked whether they want to resubmit their
 data.

 What I'm trying is not strictly needed, but it would be a nice cleanup
 of the interface of the search forms for this site.  

 I've been googling, reading php5.x docs and trying to understand what
 needs to be done here.  I think I'm just missing how to re-assign
 $this properly, so that when the redirect happens, the proper env is set.

 Here's the snippet I'm trying to use, which bombs out with:

Fatal error: Cannot re-assign $this in  on line 45

 And the code I'm using is:

 ?

 // We want to put the search query into a session so we can restore it
 // easily when users goto look at full_holdings.php and then return to
 // the overall display page.  We'll need to do a session_destroy in
 // index.php I think.  See the tutorial(s) at
 // http://www.phpf1.com/tutorial/php-sessions.html
 // http://us3.php.net/manual/en/book.session.php

 session_start();

 // Now see Jonas Lindel's  Wayne's code at
 // http://us2.php.net/manual/en/language.variables.external.php for
 // this *nice* trick.

 //is there POST or GET data we should look at
 if($_POST or ($_GET and (!isset($_SESSION['skipnextget'] {

   //is there GET data?
   if($_GET) {
 $newgetarr = array();
 foreach($_GET as $key = $value) {
   if(is_array($value)) {
 //if it's an array, convert it to comma separated
 $newvalue = implode(',',$value);
   } else {
 $newvalue = $value;
   }
   $newgetarr[] = $key.'='.$newvalue;
 }
 $newget = implode('',$newgetarr);
 $_SESSION['skipnextget'] = 1;
   }
   foreach($_POST as $key = $value) {
 $this[$key] = $value;
   }
   $_SESSION['postvars'] = serialize($this); //put POST in the session
   header(Location: http://; .$_SERVER['HTTP_HOST']
   . $_SERVER['PHP_SELF'] . '?\
 ' . $newget);
   //reload page without POST data and shorter GET data

   exit();
  } else { //after reloading we'll come right to this spot
   session_unregister('skipnextget');
   if(isset($_SESSION['postvars'])) {
 //load the POST variables from the session

 // Error on this line below!
 $this = unserialize($_SESSION['postvars']);
 session_unregister('postvars'); //delete the session stuff we
 //don't need anymore.
 return $this;
   }
  }

  // rest of my code goes here...
 ___

 Thanks,
 John
 j...@stoffel.org
 
 I'm not sure if it is technically reserved, but $this is used in a class
 in order for an object to refer to itself.  AFAIK you can't use it
 anywhere other than that.  Just change all $this to $vars or something else.
 

Also, as you can see by the use of $this, this is old code.  You need to
change all of the session_unregister('varname') stuff to
unset($_SESSION['varname']). session_unregister() is deprecated and will
be removed in PHP 6.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Beginner question

2009-08-25 Thread mike bode

Thanks.

I will surely do that.

In the meantime I have found out that it really is not a problem with the 
code. I uploaded the (non-functioning code) from my PC to a public web 
server, and lo and behold, the code works.

It thus appears that there is something wrong with my php-apache setup.

Now that's a whole other issue that I now need to try to solve. Any 
suggestions where to start?


Thanks.

tedd tedd.sperl...@gmail.com wrote in message 
news:p06240806c6b9e3571...@[192.168.1.102]...

At 11:16 PM -0600 8/24/09, mike bode wrote:
I get a blank page. this is probably something really stupid, but I have 
been wrecking my head for days now, and I can't figure it out. anybody has 
an idea?


Mike:

Here's an idea -- try this:

http://sperling.com/examples/include-demo/

If you complete that (a hour or so, not days), you'll have a much better 
idea of what this is all about.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com 



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



Re: [PHP] How to output a NULL field?

2009-08-25 Thread Paul M Foster
On Tue, Aug 25, 2009 at 02:00:04PM -0400, David Stoltz wrote:

 $rs-Fields(22) equals a NULL in the database
 
 My Code:
 
 if(empty($rs-Fields(22))){
   $q4 = ;
 }else{
   $q4 = $rs-Fields(22);
 }
 
 Produces this error:
 Fatal error: Can't use method return value in write context in
 D:\Inetpub\wwwroot\evaluations\lookup2.php on line 32
 
 Line 32 is the if line...
 
 If I switch the code to (using is_null):
 if(is_null($rs-Fields(22))){
   $q4 = ;
 }else{
   $q4 = $rs-Fields(22);
 }
 
 It produces this error:
 Catchable fatal error: Object of class variant could not be converted to
 string in D:\Inetpub\wwwroot\evaluations\lookup2.php on line 196
 
 Line 196 is: ?php echo $q4;?
 
 What am I doing wrong?
 
 Thanks!

Just a thought... do you really mean $rs-Fields(22) or do you mean
$rs-Fields[22]? The former is a function call and the latter is an
array variable.

Paul

-- 
Paul M. Foster

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



Re: [PHP] Beginner question

2009-08-25 Thread mike bode
I see. PHP runs on the server and cannot directly interact with my browser, 
only through Javascript. So I can use javascript to trigger a php script, 
which does something on the server, and returns something to javascript on 
my machine, which can then be used to do something on my browser.


However, as I just said in this thread, I found out that the code is 
actually working, just not on my machine. I uploaded the code to a public 
web server (www.bestrmvacation.com/album.htm, if you want to check it out), 
and it works there. But not on my computer. There must be something broken 
with my PHP or Apache Installation. However, when I run a PHP script that 
calls phpinfo(), it works fine. Any idea where this might go wrong?


BTW, I am using Expression Web to develop the web site. Could that have 
anything to do with it?


Thanks.

Arno Kuhl ak...@telkomsa.net wrote in message 
news:a6c65a0610f9485787e31f7161cb7...@point01...

-Original Message-
From: mike bode [mailto:mikebo...@hotmail.com]
Sent: 25 August 2009 07:16 AM
To: php-general@lists.php.net
Subject: [PHP] Beginner question

I am trying to use PHP on my web site I am developing now. I have 
installed

Apache 2.2 and PHP 5.2. My problem is that I can execute PHP code embedded
in my HTML code, but I can't execute the same cose when I put it into a
separate .php file that i then call from within the html code. for 
example:


I have a html file with

body
?php
echo Printing with php;
?
?body

and it works fine.

When I take out the php code and put it inot a file pp.php, and I call 
that

file with my browser (localhost/pp.php), it works, too.

But when I change the html code to:

body
script type=text/javascript src=pp.php/script /body

I get a blank page. this is probably something really stupid, but I have
been wrecking my head for days now, and I can't figure it out. anybody has
an idea?

--

I presume your html/php code is in a file with a .php extension? If not 
then
change the extension to php because most other webservers won't parse 
php

code in a html file. If you have a .php file you can mix html and php the
way you described, and you can put your php code between the ?php and ?
tags.

The php script you're trying to include in your html code with javascript
script type=text/javascript src=pp.php/script
would presumably echo out the javascript code that ends up in your html
page, but if you don't know php then you're trying to run before you can
walk.

If possible try to see what javascript code is being generated (echoed) by
the php script and put it in a normal .js file (e.g. pp.js) and then use 
it

like any other javascript file
script type=text/javascript src=pp.js/script
This isn't always possible because often php is used to decide what
javascript to output (otherwise why bother). If you have to use php to
generate your javascript code then start with small steps - try echoing 
some

simple js code in your pp.php (like an alert) just so you can see how it
works. Once you get that working you can move on to more useful things.


To illustrate, what's actually happening with the code you have at the
moment is this:

The browser parses the initial html code and finds
script type=text/javascript src=pp.php/script
And sends a request back to the server for pp.php

The server runs pp.php and send the output generated by the php script 
back

to the browser,
so effectively the browser ends up with
script type=text/javascriptPrinting with php/script

Obviously that isn't going to work. Hopefully you can now see what the
problem is and how to fix it.


Cheers
Arno







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



[PHP] Re: php 5.2.x - Fatal error: Cannot re-assign $this in ...

2009-08-25 Thread John Stoffel
 Shawn == Shawn McKenzie nos...@mckenzies.net writes:

Shawn Shawn McKenzie wrote:
 John Stoffel wrote:
 Hi,
 
 I'm looking for some help with PHP5.2.x hacking on a web site to
 cleanup how the user submitted search form is handled.  Basically I
 want to make it simple for the end user to a) refine their query, b)
 not have to answer popups if they hit the reload button, and c) so I
 can learn more PHP.  I found this nice reference:
 
 http://us2.php.net/manual/en/language.variables.external.php
 
 which has two sections by wayne and Jonas Lindel talking about how
 you can take the results of a PHP POST request, stuff the vars into
 your session, and redirect back to the same page without the POST vars
 set, then complete the query.
 
 The idea is so that when people hit the back or reload buttons,
 they don't keep getting asked whether they want to resubmit their
 data.
 
 What I'm trying is not strictly needed, but it would be a nice cleanup
 of the interface of the search forms for this site.  
 
 I've been googling, reading php5.x docs and trying to understand what
 needs to be done here.  I think I'm just missing how to re-assign
 $this properly, so that when the redirect happens, the proper env is set.
 
 Here's the snippet I'm trying to use, which bombs out with:
 
 Fatal error: Cannot re-assign $this in  on line 45
 
 And the code I'm using is:
 
 ?
 
 // We want to put the search query into a session so we can restore it
 // easily when users goto look at full_holdings.php and then return to
 // the overall display page.  We'll need to do a session_destroy in
 // index.php I think.  See the tutorial(s) at
 // http://www.phpf1.com/tutorial/php-sessions.html
 // http://us3.php.net/manual/en/book.session.php
 
 session_start();
 
 // Now see Jonas Lindel's  Wayne's code at
 // http://us2.php.net/manual/en/language.variables.external.php for
 // this *nice* trick.
 
 //is there POST or GET data we should look at
 if($_POST or ($_GET and (!isset($_SESSION['skipnextget'] {
 
 //is there GET data?
 if($_GET) {
 $newgetarr = array();
 foreach($_GET as $key = $value) {
 if(is_array($value)) {
 //if it's an array, convert it to comma separated
 $newvalue = implode(',',$value);
 } else {
 $newvalue = $value;
 }
 $newgetarr[] = $key.'='.$newvalue;
 }
 $newget = implode('',$newgetarr);
 $_SESSION['skipnextget'] = 1;
 }
 foreach($_POST as $key = $value) {
 $this[$key] = $value;
 }
 $_SESSION['postvars'] = serialize($this); //put POST in the session
 header(Location: http://; .$_SERVER['HTTP_HOST']
 . $_SERVER['PHP_SELF'] . '?\
 ' . $newget);
 //reload page without POST data and shorter GET data
 
 exit();
 } else { //after reloading we'll come right to this spot
 session_unregister('skipnextget');
 if(isset($_SESSION['postvars'])) {
 //load the POST variables from the session
 
 // Error on this line below!
 $this = unserialize($_SESSION['postvars']);
 session_unregister('postvars'); //delete the session stuff we
 //don't need anymore.
 return $this;
 }
 }
 
 // rest of my code goes here...
 ___
 
 Thanks,
 John
 j...@stoffel.org
 
 I'm not sure if it is technically reserved, but $this is used in a class
 in order for an object to refer to itself.  AFAIK you can't use it
 anywhere other than that.  Just change all $this to $vars or something else.
 

Shawn Also, as you can see by the use of $this, this is old code.
Shawn You need to change all of the session_unregister('varname')
Shawn stuff to unset($_SESSION['varname']). session_unregister() is
Shawn deprecated and will be removed in PHP 6.

Thanks for the feedback, someone should ask the admins to update some
of the comments on the php.net web pages then, esp since I think
they're trying to kill off 4.x support.

Anyway, I'm wondering if I'm doing this all wrong in some ways.  From
further googling and reading, I think I need to change from my current
setup:

index.php - form for user to fill in.  POSTS to
results.php  - checks input (barely :-) does query and shows
 results.  I'm trying to have results.php redirect
 to itself and clean out the POST vars.

 It works, esp since I've got pagination and such
 for my results pages, etc.  

 The user can either do a new search, or refine
 the existing results and goes back to the
 index.php search page in that case. 

But I think I need to re-work things so that instead I do all form
validation and checks on the index.php page, and once I get all the
$_POST stuff, I redirect to the results.php page, using *only* session
vars.

Though I'm not sure how my page navigation is going to work, since
it's all based on buttons with hidden values.  I guess I should just
change them to session vars in that case...

But back to the $this = unserialize(...) stuff.  I tried your initial
suggestion and renamed it to 

 

[PHP] php cms?

2009-08-25 Thread Lars Nielsen
Hey list,

I am going to use a cms for some sites and I have looked a little at
Typo3, Joomla and php-fusion.
Can anyone recommend a system where it is easy to customize the
templates?

regards
Lars Nielsen


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



Re: [PHP] php cms?

2009-08-25 Thread Bastien Koert
On Tue, Aug 25, 2009 at 4:35 PM, Lars Nielsenl...@mit-web.dk wrote:
 Hey list,

 I am going to use a cms for some sites and I have looked a little at
 Typo3, Joomla and php-fusion.
 Can anyone recommend a system where it is easy to customize the
 templates?

 regards
 Lars Nielsen


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



Joomla or Drupal are good

-- 

Bastien

Cat, the other other white meat

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



Re: [PHP] anchor inside form

2009-08-25 Thread Paul M Foster
On Tue, Aug 25, 2009 at 11:29:28AM +0100, Ashley Sheridan wrote:

 On Tue, 2009-08-25 at 12:28 +0200, Arno Kuhl wrote:
  -Original Message-
  From: leledumbo [mailto:leledumbo_c...@yahoo.co.id]
  Sent: 25 August 2009 09:55 AM
  To: php-general@lists.php.net
  Subject: [PHP] anchor inside form
 
  If I have an anchor inside form, how can I send form using the anchor
  without displaying target url? I've tried the code below but IE says that
  this.form is null or empty and Firefox does nothing.
 
  form action=somewhere.php method=get
  # Pick me
  /form
  --
 
  You can use javascript behind a button or image or link to submit the form
  from anywhere in your html page. You don't need the anchor but you do
 need a
  form name. Something like:
 
href=javascript:document.FormName.submit();
 
  Cheers
  Arno
 
 
 And all it takes for that to break is for someone to turn off
 Javascript...
 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk

Oh no, here we go again

Paul

-- 
Paul M. Foster

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



Re: [PHP] __destruct() not called ! we shot us in the foot try the script

2009-08-25 Thread Martin Scotta
__destruct is called only when the object is detroyed.
The object is destroyed only when there is no references to it.


?php

error_reporting( E_ALL | E_STRICT );
header( 'Content-Type: text/plain' );

class Foo
{
function __destruct()
{
echo __METHOD__, PHP_EOL;
}
}

$a = new Foo;
$b = $a; #  try the script without this line or commented
unset( $a ); # no destructor called
echo '--', PHP_EOL;
unset( $b ); # destructor called!


On Mon, Aug 24, 2009 at 8:40 PM, Ralph Deffke ralph_def...@yahoo.de wrote:


 well I would call this an error in the first view , and some of u where
 right! and the stuff with the refernce counter seems to be right as well.

 however I can't see a reason for it as 5.x works through refernces. so
 unsetting a REFERENCE to the object does not destroy it.

 How to destroy the object then?

 ?php


 abstract class a {
  public function __construct(){
echo constructingbr;
  }
  public function __destruct(){
echo destructingbr;
  }
 }

 class b extends a{

  public function doSomething(){
echo I'm doing ...but the reference c to the object is unset()br;
  }

 }

 $c = new b();

 $d = $c ;   // works
 $f[] = $c ; // works

 class e {
  public static $m;

  public static function setM( $m ){
self::$m = $m;
  }
 }

 $o = new e();
 e::setM( $c ); // works

 echo unsetting ...br;
 unset( $c );

 $d-doSomething();

 echo script ending now ...br;

 ?




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




-- 
Martin Scotta


Re: [PHP] Beginner question

2009-08-25 Thread tedd

At 2:45 PM -0600 8/25/09, mike bode wrote:
I see. PHP runs on the server and cannot directly interact with my 
browser, only through Javascript.


Kind of.

PHP runs on the server and can create html, css, javascript et al. 
However, PHP will complete it's task before the browser see's 
anything. Once the browser see's the code, it's up to the browser to 
interpret and run html, css, and javascript.


If your html is a form (i.e., submit), or you have javascript 
running, then either of those can trigger a php script on the server 
to run which can repeat the process in generating new html, css, and 
javascript (if needed). Normally, javascript is not generated by PHP, 
but it can be.


Using javascript to trigger an event certainly works IF javascript is 
turned on by the user's browser. However, this is something that you 
have absolutely no control over. A user can turn javascript ON/OFF at 
their discretion. You see, many people turn javascript off because of 
security concerns -- and those concerns are not without foundation.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] php cms?

2009-08-25 Thread Lars Nielsen
tir, 25 08 2009 kl. 17:05 -0400, skrev Bastien Koert:
 On Tue, Aug 25, 2009 at 4:35 PM, Lars Nielsenl...@mit-web.dk wrote:
  Hey list,
 
  I am going to use a cms for some sites and I have looked a little at
  Typo3, Joomla and php-fusion.
  Can anyone recommend a system where it is easy to customize the
  templates?
 
  regards
  Lars Nielsen
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 Joomla or Drupal are good
 
 -- 
 
 Bastien
 
 Cat, the other other white meat
 

ok, thanks

I'll give joomla! another shot.

/Lars


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



[PHP] DOMNode children iteration (was Re: array() returns something weird)

2009-08-25 Thread Martin Scotta
-- Forwarded message --
From: Martin Scotta martinsco...@gmail.com
Date: Tue, Aug 25, 2009 at 6:24 PM
Subject: Re: [PHP] DOMNode children iteration (was Re: array() returns
something weird)
To: webmas...@strefarytmu.pl


Fatal error: Call to a member function getAttribute() on a non-object in
testme.php on line *121*

I'm using a Apache/2.2.3 (Win32) PHP/5.2.6
Is the script correctly? I have removed the  in the loop and the script
returns the attached file.

It looks like a bogus bug?

2009/8/24 Szczepan Hołyszewski webmas...@strefarytmu.pl


 Hi Lars and list!

 New facts about the strange bug initially diagnosed as array() returning
 NULL:

 Firstly, the issue is not really about array() returning null, but about
 full
 blown UndefinedBehavior(TM) progressively trashing local variables. It just
 so
 happened that I noticed it first with a variable to which array() had been
 assigned just before things began breaking.

 Secondly, I proudly present the culprit: things break when I iterate over a
 DOMNode's children *by reference* using firstChild and nextSibling:

for($child=$node-firstChild; $child; $child=$child-nextSibling)
 {

//processing...
}

 No problems if iteration is done by value or by DOMNodeList (childNodes,
 DOMXPath...).

 HOWEVER,

 I still consider this a bug because it destablizes PHP. After the evil loop
 has finished, things happen that should never happen, like a variable being
 NULL immediately after being assigned array().

 I attach a demonstration. It is a self-contained commented script that you
 can
 execute from command line. Also attached is output on my machine.

 Best regards,
 Szczepan Hołyszewski

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




-- 
Martin Scotta



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

[PHP] Where to list PHP5.2.8 and PHP5.2.10 known vulnerabilities?

2009-08-25 Thread David Taveras
Hello,

Iam still a user of PHP5.2.8 - 5.2.10 under BSD.I wish to know what
vulnerabilites this version is exposed aside from CVE-2008-5498.

Is there any site, where I can get an accurate listing, the only page I saw
in php.net was for 5.2.9 listing that one vulnerability, iam thinking there
might be others?

CVE site seems confusing and I just wonder if there is something more
practical.

Thank you.

Daniel


Re: [PHP] Re: unset() something that doesn't exist

2009-08-25 Thread Stuart
2009/8/25 tedd tedd.sperl...@gmail.com:
 At 2:31 PM +0100 8/25/09, Stuart wrote:

 Please don't reply directly unless you intend to pay me for my time.

 2009/8/25 Ralph Deffke ralph_def...@yahoo.de:

  sorry but its about the top topic it say it never does an error if u
 dont
  give an argument

 I accept that your English is not great, but given that you should be
 a bit more careful.

 The OP said is it the case that unset() does not trigger an error or
 throw an exception if it's argument was never set?. That does not say
 if you don't give an argument. Not even close.

 -Stuart

 I can't believe that you are wasting time on this. This guy is beyond
 clueless.

To be fair tedd English is clearly not his main language and I can see
how you could misunderstand the original question as he did. What I
objected to was that he took what he interpreted as the question being
asked, saw that it did in fact behave that way and then proceeded to
completely fabricate an explanation as to why it does so when that
explanation does little more than demonstrate that he clearly has no
understanding of what's actually going on. I can't stand people who
claim to know what they're talking about when they're really making it
up as they go along.

Actually, an explanation like that does do a lot more than demonstrate
ignorance. It gives naive observers of this thread, now and in the
future, incorrect information that they may potentially rely upon if
nobody corrects it. That's why I'm wasting my time on this - I do it
for the greater good.

Hmm, maybe I just need a holiday...

-Stuart

-- 
http://stut.net/

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



Re: [PHP] Re: unset() something that doesn't exist

2009-08-25 Thread Ralph Deffke
sorry I mixed 'set' with 'given' and if my mistake did prevent all the
smarter guys to give u an answer I'm sorry too.

I hope not to be too limited to give u an answer

well, think about how PHP 5 works.
$a e.g. is a REFENCE to some memory where the variable resides.

so the interpreter running into this unset() statement searches the
reference table to find the pointer named $a to delete its name from the
reference table. it doesn't find it, but it's ment to unset it anyway, why
should be complained about it. in the next line the $a is not set, as u want
it.

mmmh nice as well that nobody told me direcly that I mixed set with given

ralph_def...@yahoo.de

ps.: great behavior, I think for less then 10% of the world population is
english the native language, such a behavior prevents very good and smart
programmers arround the world to share their knowledge.

Tom Worster f...@thefsb.org wrote in message
news:c6b93df9.114fa%...@thefsb.org...
 On 8/25/09 5:00 AM, Ralph Deffke ralph_def...@yahoo.de wrote:

  of course its a syntax error, because unset() IS NOT A FUNCTION its a
  language construct

 that's hard to believe. i can't imagine how the compiler could reliably
 predict if the argument will be set or not when the unset line is
executed.


  Stuart stut...@gmail.com wrote in message
  news:a5f019de0908250201g14e4b61cn73c6cd67da6f...@mail.gmail.com...
  2009/8/25 Ralph Deffke ralph_def...@yahoo.de:
  causes an error
  Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`'$''
  in
  C:\wamp\www\TinyCreator\testCrapp6.php on line 42
 
  This is a syntax error, not a runtime error. You've clearly done
  something wrong.
 
  Tom Worster f...@thefsb.org wrote in message
  news:c6b87877.11463%...@thefsb.org...
  is it the case that unset() does not trigger an error or throw an
  exception
  if it's argument was never set?
 
  Absolutely.
 
  -Stuart
 
  -- 
  http://stut.net/
 
 





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



[PHP] page works on public web site, but not on my computer

2009-08-25 Thread mike bode
I have posted the question in another thread a bit down, but only buried 
within the thread, so please excuse me when I ask again.


I want to use some PHP code from a web site 
(http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm), and I am 
following their instruction how to implement it. I was not able to get it to 
work. Then I uploaded the code to a server, and lo and behold, it does work 
on the server. On the public site you see thumbnails of images (never mind 
the junk above them), when I run the SAME html and php code on my omputer, I 
get a blank white page.


The error log has several entries, but they are all warnings:

[Tue Aug 25 18:12:00 2009] [error] [client 127.0.0.1] PHP Warning:  date(): 
It is not safe to rely on the system's timezone settings. You are *required* 
to use the date.timezone setting or the date_default_timezone_set() 
function. In case you used any of those methods and you are still getting 
this warning, you most likely misspelled the timezone identifier. We 
selected 'America/Denver' for '-6.0/DST' instead in 
C:\\webdev\\rmv3\\album\\getalbumpics.php on line 11, referer: 
http://localhost/album.htm


(this error is repeated for as many images I have in the directory that the 
php script is reading).


Between php.ini, httpd.conf, and Windows Vista, I can't figure out where to 
start to diagnose this, and how. Anybody out there who can give me a pointer 
on how to roubleshoot this issue? I am almost ready to throw in the towel 
and either start from scratch (although this is alrady the second time that 
I have uninstalled and re-installed everything), or simply forget about php 
altogether. that would be a shame, though... 



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



Re: [PHP] Where to list PHP5.2.8 and PHP5.2.10 known vulnerabilities?

2009-08-25 Thread David Taveras
I already did see that, but it only lists one single vulnerability
previously stated. Id just want to confirm that is the only one?



On Tue, Aug 25, 2009 at 7:09 PM, Vinicius Pinto vinicius...@gmail.comwrote:

 You can look at the changelog for 5.3.0 and see what was fixed:
 http://www.php.net/ChangeLog-5.php#5.3.0


 On Tue, Aug 25, 2009 at 6:44 PM, David Taveras d3taveras3...@gmail.comwrote:

 Hello,

 Iam still a user of PHP5.2.8 - 5.2.10 under BSD.I wish to know what
 vulnerabilites this version is exposed aside from CVE-2008-5498.

 Is there any site, where I can get an accurate listing, the only page I
 saw
 in php.net was for 5.2.9 listing that one vulnerability, iam thinking
 there
 might be others?

 CVE site seems confusing and I just wonder if there is something more
 practical.

 Thank you.

 Daniel





[PHP] Re: page works on public web site, but not on my computer

2009-08-25 Thread mike bode
I just de-installed, then re-installed MySQL, Apache and PHP 5.3. No 
changes. The script does not work on my computer.


Now I get in addition to the error message below this:

[Tue Aug 25 21:29:11 2009] [error] [client 127.0.0.1] PHP Deprecated: 
Function eregi() is deprecated in C:\\webdev\\rmv3\\album\\getalbumpics.php 
on line 11, referer: http://localhost/album.php


Don't know if those warnings would stop the execution of the php script.


mike bode mikebo...@hotmail.com wrote in message 
news:99.f2.08117.ccf74...@pb1.pair.com...
I have posted the question in another thread a bit down, but only buried 
within the thread, so please excuse me when I ask again.


I want to use some PHP code from a web site 
(http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm), and I am 
following their instruction how to implement it. I was not able to get it 
to work. Then I uploaded the code to a server, and lo and behold, it does 
work on the server. On the public site you see thumbnails of images (never 
mind the junk above them), when I run the SAME html and php code on my 
omputer, I get a blank white page.


The error log has several entries, but they are all warnings:

[Tue Aug 25 18:12:00 2009] [error] [client 127.0.0.1] PHP Warning: 
date(): It is not safe to rely on the system's timezone settings. You are 
*required* to use the date.timezone setting or the 
date_default_timezone_set() function. In case you used any of those 
methods and you are still getting this warning, you most likely misspelled 
the timezone identifier. We selected 'America/Denver' for '-6.0/DST' 
instead in C:\\webdev\\rmv3\\album\\getalbumpics.php on line 11, referer: 
http://localhost/album.htm


(this error is repeated for as many images I have in the directory that 
the php script is reading).


Between php.ini, httpd.conf, and Windows Vista, I can't figure out where 
to start to diagnose this, and how. Anybody out there who can give me a 
pointer on how to roubleshoot this issue? I am almost ready to throw in 
the towel and either start from scratch (although this is alrady the 
second time that I have uninstalled and re-installed everything), or 
simply forget about php altogether. that would be a shame, though... 



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



Re: [PHP] php cms?

2009-08-25 Thread hack988 hack988
i like durpal or e107

2009/8/26 Lars Nielsen l...@mit-web.dk:
 tir, 25 08 2009 kl. 17:05 -0400, skrev Bastien Koert:
 On Tue, Aug 25, 2009 at 4:35 PM, Lars Nielsenl...@mit-web.dk wrote:
  Hey list,
 
  I am going to use a cms for some sites and I have looked a little at
  Typo3, Joomla and php-fusion.
  Can anyone recommend a system where it is easy to customize the
  templates?
 
  regards
  Lars Nielsen
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

 Joomla or Drupal are good

 --

 Bastien

 Cat, the other other white meat


 ok, thanks

 I'll give joomla! another shot.

 /Lars


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



Re: [PHP] Re: page works on public web site, but not on my computer

2009-08-25 Thread hack988 hack988
It Just Deprecated Function used.It mean source code wouldn't work
wall based on newer php versions.
see this link http://cn.php.net/manual/en/function.eregi.php
If you want fix that warning ,replace eregi to preg_match_all and use
/s instead.

2009/8/26 mike bode mikebo...@hotmail.com:
 I just de-installed, then re-installed MySQL, Apache and PHP 5.3. No
 changes. The script does not work on my computer.

 Now I get in addition to the error message below this:

 [Tue Aug 25 21:29:11 2009] [error] [client 127.0.0.1] PHP Deprecated:
 Function eregi() is deprecated in C:\\webdev\\rmv3\\album\\getalbumpics.php
 on line 11, referer: http://localhost/album.php

 Don't know if those warnings would stop the execution of the php script.


 mike bode mikebo...@hotmail.com wrote in message
 news:99.f2.08117.ccf74...@pb1.pair.com...

 I have posted the question in another thread a bit down, but only buried
 within the thread, so please excuse me when I ask again.

 I want to use some PHP code from a web site
 (http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm), and I am
 following their instruction how to implement it. I was not able to get it to
 work. Then I uploaded the code to a server, and lo and behold, it does work
 on the server. On the public site you see thumbnails of images (never mind
 the junk above them), when I run the SAME html and php code on my omputer, I
 get a blank white page.

 The error log has several entries, but they are all warnings:

 [Tue Aug 25 18:12:00 2009] [error] [client 127.0.0.1] PHP Warning: date():
 It is not safe to rely on the system's timezone settings. You are *required*
 to use the date.timezone setting or the date_default_timezone_set()
 function. In case you used any of those methods and you are still getting
 this warning, you most likely misspelled the timezone identifier. We
 selected 'America/Denver' for '-6.0/DST' instead in
 C:\\webdev\\rmv3\\album\\getalbumpics.php on line 11, referer:
 http://localhost/album.htm

 (this error is repeated for as many images I have in the directory that
 the php script is reading).

 Between php.ini, httpd.conf, and Windows Vista, I can't figure out where
 to start to diagnose this, and how. Anybody out there who can give me a
 pointer on how to roubleshoot this issue? I am almost ready to throw in the
 towel and either start from scratch (although this is alrady the second time
 that I have uninstalled and re-installed everything), or simply forget about
 php altogether. that would be a shame, though...


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



Re: [PHP] Where to list PHP5.2.8 and PHP5.2.10 known vulnerabilities?

2009-08-25 Thread hack988 hack988
see this
https://bugzilla.redhat.com/show_bug.cgi?id=478425

2009/8/26 David Taveras d3taveras3...@gmail.com:
 I already did see that, but it only lists one single vulnerability
 previously stated. Id just want to confirm that is the only one?



 On Tue, Aug 25, 2009 at 7:09 PM, Vinicius Pinto vinicius...@gmail.comwrote:

 You can look at the changelog for 5.3.0 and see what was fixed:
 http://www.php.net/ChangeLog-5.php#5.3.0


 On Tue, Aug 25, 2009 at 6:44 PM, David Taveras 
 d3taveras3...@gmail.comwrote:

 Hello,

 Iam still a user of PHP5.2.8 - 5.2.10 under BSD.I wish to know what
 vulnerabilites this version is exposed aside from CVE-2008-5498.

 Is there any site, where I can get an accurate listing, the only page I
 saw
 in php.net was for 5.2.9 listing that one vulnerability, iam thinking
 there
 might be others?

 CVE site seems confusing and I just wonder if there is something more
 practical.

 Thank you.

 Daniel





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



Re: [PHP] Re: page works on public web site, but not on my computer

2009-08-25 Thread Lars Torben Wilson
2009/8/25 mike bode mikebo...@hotmail.com:
 I just de-installed, then re-installed MySQL, Apache and PHP 5.3. No
 changes. The script does not work on my computer.

 Now I get in addition to the error message below this:

 [Tue Aug 25 21:29:11 2009] [error] [client 127.0.0.1] PHP Deprecated:
 Function eregi() is deprecated in C:\\webdev\\rmv3\\album\\getalbumpics.php
 on line 11, referer: http://localhost/album.php

Hi Mike,

No, those messages don't indicate anything which would cause PHP to
fail or abort. Do you see anything different if you change
error_reporting to error_reporting = E_ALL, display_errors = On, and
display_startup_errors = On in php.ini? (Note: if you do turn on
display_errors and display_startup_errors, be sure to turn them off
again before making your page available to the public).

Are you using the PHP Apache module or fastcgi or some other method?


Torben

 Don't know if those warnings would stop the execution of the php script.


 mike bode mikebo...@hotmail.com wrote in message
 news:99.f2.08117.ccf74...@pb1.pair.com...

 I have posted the question in another thread a bit down, but only buried
 within the thread, so please excuse me when I ask again.

 I want to use some PHP code from a web site
 (http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm), and I am
 following their instruction how to implement it. I was not able to get it to
 work. Then I uploaded the code to a server, and lo and behold, it does work
 on the server. On the public site you see thumbnails of images (never mind
 the junk above them), when I run the SAME html and php code on my omputer, I
 get a blank white page.

 The error log has several entries, but they are all warnings:

 [Tue Aug 25 18:12:00 2009] [error] [client 127.0.0.1] PHP Warning: date():
 It is not safe to rely on the system's timezone settings. You are *required*
 to use the date.timezone setting or the date_default_timezone_set()
 function. In case you used any of those methods and you are still getting
 this warning, you most likely misspelled the timezone identifier. We
 selected 'America/Denver' for '-6.0/DST' instead in
 C:\\webdev\\rmv3\\album\\getalbumpics.php on line 11, referer:
 http://localhost/album.htm

 (this error is repeated for as many images I have in the directory that
 the php script is reading).

 Between php.ini, httpd.conf, and Windows Vista, I can't figure out where
 to start to diagnose this, and how. Anybody out there who can give me a
 pointer on how to roubleshoot this issue? I am almost ready to throw in the
 towel and either start from scratch (although this is alrady the second time
 that I have uninstalled and re-installed everything), or simply forget about
 php altogether. that would be a shame, though...


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