php-general Digest 15 Apr 2007 17:07:25 -0000 Issue 4736

2007-04-15 Thread php-general-digest-help

php-general Digest 15 Apr 2007 17:07:25 - Issue 4736

Topics (messages 252959 through 252968):

Re: isset
252959 by: Jochem Maas
252968 by: afan.afan.net

secure login
252960 by: Ross
252961 by: Alain Roger
252962 by: Stut
252966 by: tedd

Re: WWE in Stamford, CT needs a kick ass PHP Developer!
252963 by: tedd
252964 by: Robert Cummings

Re: how to get var name and value from function?
252965 by: Zoltán Németh

Re: preg_replace and regular expressions.
252967 by: Buesching, Logan J

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---
Afan Pasalic wrote:
 
 Jochem Maas wrote:
 Richard Kurth wrote:
   
 What do you do when isset does not work? If I send data in a
 $_REQUEST['var'] like 
 if (isset($_REQUEST['var'])) {
 }
 Put var has no data it still says it is set. Because $_REQUEST['var'] = 
 and isset thinks  is set
 

 php -r ' $r = array(foo = ); 
 var_dump(isset($r[foo]),empty($r[foo]));'

 so empty() should give you the result your looking for  ...
 some tips:

 1. generally use $_GET or $_POST in preference to $_REQUEST
 2. be specific about your input validation, e.g.:

 if (isset($_GET['var'])  ($_GET['var'] == 'foo')) {
  echo got it!;
 }
   
 I always wondered about this. if $_GET['var'] == 'foo' is true, isn't
 automatically isset($_GET['var']) true too?
 I mean, isn't
 if ($_GET['var'] == 'foo')
 {
 echo got it!;
 }
 just enough?

it doesn't cover the situation where $_GET['var'] doesn't exist,
and using uninitialized var is not recommended.

of course it's your call whether you write/run code that spits out
E_NOTICEs all over the place due to usage of uninitialized vars.

 
 -afan
---End Message---
---BeginMessage---
 Afan Pasalic wrote:

 Jochem Maas wrote:
 Richard Kurth wrote:

 What do you do when isset does not work? If I send data in a
 $_REQUEST['var'] like
 if (isset($_REQUEST['var'])) {
 }
 Put var has no data it still says it is set. Because $_REQUEST['var']
 = 
 and isset thinks  is set


 php -r ' $r = array(foo = );
 var_dump(isset($r[foo]),empty($r[foo]));'

 so empty() should give you the result your looking for  ...
 some tips:

 1. generally use $_GET or $_POST in preference to $_REQUEST
 2. be specific about your input validation, e.g.:

 if (isset($_GET['var'])  ($_GET['var'] == 'foo')) {
 echo got it!;
 }

 I always wondered about this. if $_GET['var'] == 'foo' is true, isn't
 automatically isset($_GET['var']) true too?
 I mean, isn't
 if ($_GET['var'] == 'foo')
 {
 echo got it!;
 }
 just enough?

 it doesn't cover the situation where $_GET['var'] doesn't exist,
 and using uninitialized var is not recommended.

 of course it's your call whether you write/run code that spits out
 E_NOTICEs all over the place due to usage of uninitialized vars.


not quite sure. if $_GET['var'] doesn't exists it's DEFINITLY not equal to
'foo', right?

how I understand:
clause one: isset($_GET['var'])
clause two: ($_GET['var'] == 'foo')
if clause two is true, clause one MUST be true.
if clause one is true, clause two could be true or false.

means, if I look for solutions where ($_GET['var'] == 'foo') they wil
lautomaticaly cover isset($_GET['var']) part.
if ($_GET['var'] != 'foo') I erally do not care isset($_GET['var']) or
!isset($_GET['var']).

or I'm missing something here?

I have E_NOTICE turned off. :)

thanks.

-afan


 -afan


---End Message---
---BeginMessage---

I am creating a single user secure login based on this:

http://www.phpnoise.com/tutorials/26/1


Can anyone see any potential security issues with this method? Where should 
I store the password/username can I just have it located in the pagehead?


R. 
---End Message---
---BeginMessage---

Hi Ross,

I previously worked on this theme and the general feeling / feedback from
the mailing list was the following one :

- access to your login window, via HTTPS (SSL)
- hash you password (inspired by :
http://phpsec.org/articles/2005/password-hashing.html)
- when user is authenticated, you can authorize him to go further, therefore
use a session and store in session array ONLY his login. (as he is already
identified).
all the webpages should be accessible in HTTPS (with first check on
$_SERVER[HTTPS] != 'on')

HTH.

Alain

On 4/15/07, Ross [EMAIL PROTECTED] wrote:



I am creating a single user secure login based on this:

http://www.phpnoise.com/tutorials/26/1


Can anyone see any potential security issues with this method? Where
should
I store the password/username can I just have it located in the pagehead?


R.

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





--
Alain

Windows XP SP2
PostgreSQL 

Re: [PHP] isset

2007-04-15 Thread Jochem Maas
Afan Pasalic wrote:
 
 Jochem Maas wrote:
 Richard Kurth wrote:
   
 What do you do when isset does not work? If I send data in a
 $_REQUEST['var'] like 
 if (isset($_REQUEST['var'])) {
 }
 Put var has no data it still says it is set. Because $_REQUEST['var'] = 
 and isset thinks  is set
 

 php -r ' $r = array(foo = ); 
 var_dump(isset($r[foo]),empty($r[foo]));'

 so empty() should give you the result your looking for  ...
 some tips:

 1. generally use $_GET or $_POST in preference to $_REQUEST
 2. be specific about your input validation, e.g.:

 if (isset($_GET['var'])  ($_GET['var'] == 'foo')) {
  echo got it!;
 }
   
 I always wondered about this. if $_GET['var'] == 'foo' is true, isn't
 automatically isset($_GET['var']) true too?
 I mean, isn't
 if ($_GET['var'] == 'foo')
 {
 echo got it!;
 }
 just enough?

it doesn't cover the situation where $_GET['var'] doesn't exist,
and using uninitialized var is not recommended.

of course it's your call whether you write/run code that spits out
E_NOTICEs all over the place due to usage of uninitialized vars.

 
 -afan

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



[PHP] secure login

2007-04-15 Thread Ross

I am creating a single user secure login based on this:

http://www.phpnoise.com/tutorials/26/1


Can anyone see any potential security issues with this method? Where should 
I store the password/username can I just have it located in the pagehead?


R. 

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



Re: [PHP] secure login

2007-04-15 Thread Alain Roger

Hi Ross,

I previously worked on this theme and the general feeling / feedback from
the mailing list was the following one :

- access to your login window, via HTTPS (SSL)
- hash you password (inspired by :
http://phpsec.org/articles/2005/password-hashing.html)
- when user is authenticated, you can authorize him to go further, therefore
use a session and store in session array ONLY his login. (as he is already
identified).
all the webpages should be accessible in HTTPS (with first check on
$_SERVER[HTTPS] != 'on')

HTH.

Alain

On 4/15/07, Ross [EMAIL PROTECTED] wrote:



I am creating a single user secure login based on this:

http://www.phpnoise.com/tutorials/26/1


Can anyone see any potential security issues with this method? Where
should
I store the password/username can I just have it located in the pagehead?


R.

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





--
Alain

Windows XP SP2
PostgreSQL 8.1.4
Apache 2.0.58
PHP 5


Re: [PHP] secure login

2007-04-15 Thread Stut

Ross wrote:

I am creating a single user secure login based on this:

http://www.phpnoise.com/tutorials/26/1

Can anyone see any potential security issues with this method? Where should 
I store the password/username can I just have it located in the pagehead?


I would be careful about using any code from that site. The code 
presented in that tutorial does not escape variables before putting them 
into SQL queries.


In addition it appears to be storing the MD5 of the password in a 
cookie. This leaves it open to offline dictionary attacks. The author 
falsly represents MD5 hashes as encryption. MD5 is not encryption, it's 
a checksum.


By all means use it as an example, but please be aware that it is not 
particularly secure and could open your site to attacks.


-Stut

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



Re: [PHP] WWE in Stamford, CT needs a kick ass PHP Developer!

2007-04-15 Thread tedd

At 3:27 PM -0400 4/14/07, Robert Cummings wrote:


  Statistics are easy to find:
  
   http://www.frontpagewebmaster.com/m-281187/tm.htm#281187
 
  Okay, so read them.

I did just before I posted the link :)

  In the first post you'll find (from my old college CSUN) this:
 
  http://www.imtc.gatech.edu/csun/stats.html
 
  It states that 19.4 percent of the population is disabled -- that's
  about twenty times the number you cited.


I just want to clarify a point, you previously said that less than 1% 
of the population is disabled and then to support your claim you 
provide a link that says something different. Instead, the link 
quotes a figure twenty times your estimation, so what is your claim? 
Is the percent of disabled one or twenty?


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] WWE in Stamford, CT needs a kick ass PHP Developer!

2007-04-15 Thread Robert Cummings
On Sun, 2007-04-15 at 08:23 -0400, tedd wrote:
 At 3:27 PM -0400 4/14/07, Robert Cummings wrote:
 
Statistics are easy to find:

 http://www.frontpagewebmaster.com/m-281187/tm.htm#281187
   
Okay, so read them.
 
 I did just before I posted the link :)
 
In the first post you'll find (from my old college CSUN) this:
   
http://www.imtc.gatech.edu/csun/stats.html
   
It states that 19.4 percent of the population is disabled -- that's
about twenty times the number you cited.
 
 I just want to clarify a point, you previously said that less than 1% 
 of the population is disabled and then to support your claim you 
 provide a link that says something different. Instead, the link 
 quotes a figure twenty times your estimation, so what is your claim? 
 Is the percent of disabled one or twenty?

I didn't provide a link to support my claim, I provided a link to prove
how easy it was to find statistics. That my 1% asstistic was wrong was
not surprising; however, your claim is not quite right either since the
value of 19.4% is a value for all disabilities, not just ones that
benefit from visual issues. The actual number of visual disabilities I
believe was around a third of the given number, so closer to 6.5%-- I
would increase that a bit for mental disabilities that may make
processing of information more difficult. That said, I live in Canada,
our disability numbers are around 12% versus the US 19.4%. So, there is
marked difference between countries. So to set the record straight, I
wasn't claiming anything and neither of our asstistics were correct :)

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

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



Re: [PHP] how to get var name and value from function?

2007-04-15 Thread Zoltán Németh
2007. 04. 14, szombat keltezéssel 08.15-kor Afan Pasalic ezt írta:
 Tijnema ! wrote:
  On 4/14/07, Afan Pasalic [EMAIL PROTECTED] wrote:
  hi,
  this one I can't figure out:
 
  I have to assign value of an array to variable named after key of the
  array several times in my project to , e.g. after I submit a form with
  personal info I have
  $_POST['name'] = 'john doe';
  $_POST['address'] = '123 main st.';
  $_POST['city'] = 'urbandale';
  $_POST['zip'] = '12345';
  $_POST['phone'] = '123-456-7980';
  etc.
 
  Then I assign value to the var name:
  foreach ($_POST as $key = $value)
  {
 ${$key} = $value;
  }
  and then validate submitted.
 
  Are you sure you want to do this? You never know what a hacker inserts
  to your POST data, so he could easily define variables inside your
  script, especially when you're using more dangerous functions like
  system().
 I do validation after this step. :)

you should validate before this step, not after. let's say you have an
important variable called $system_setting
then someone sends you a POST with 'system_setting' in it. then you're
writing that POST value to your important variable with that foreach
stuff, and trying to validate after it - but your system_setting value
is corrupted still!

greets
Zoltán Németh

 
 
  Though, to avoid writing all over again the same lines (even it's only 3
  lines) I was thinking to create a function something like:
 
  function value2var($array, $print=0)
  {
 foreach ($_POST as $key = $value)
 
  I think you should change above line to :
 
 foreach ($array as $key = $value)
 yup! it's print error. I meant $array.
 {
 ${$key} = $value;
 echo ($print ==1) ? $key.': '.$value.'br'; // to test
  results and seeing array variables and values
 }
  }
 
  value2var($_POST, 1);
 
  but, I don't know how to get info from function back to script?!?!?
  :-(
 
  Uhm, it's not even possible when you don't know the keys i believe.
 after 2 hours of testing and research I realized this too, but want to
 be sure.
 :-(
 
 thanks.
 
 -afan
 
 
 
  Tijnema
 
  any help appreciated.
 
  -afan
 
 

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



Re: [PHP] secure login

2007-04-15 Thread tedd

I am creating a single user secure login based on this:

http://www.phpnoise.com/tutorials/26/1


Can anyone see any potential security issues with this method? Where should
I store the password/username can I just have it located in the pagehead?

R.


Ross:

Yes, as Stut pointed out, the example above is problematic.

What kind of secure log-in are you wanting?

[1] http://sperling.com/a/pw/index.php

[2] http://sperling.com/a/users/index.php

In [1] the password and user id are test. The user id and password 
are stored in the header of the script, but they could be included in 
an php configuration script. I think that method is secure.


In [2] the password is emailed to you AND your user id and password 
are stored in a MySQL.


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] preg_replace and regular expressions.

2007-04-15 Thread Buesching, Logan J
In your regex, you have a greedy matcher, i.e. .* will match as much
as it can to satisfy its condition.  I believe you can do .*? and it
will work, as .*? will match as little as it can to be satisfied.

-Logan

-Original Message-
From: Travis Moore [mailto:[EMAIL PROTECTED] 
Sent: Sunday, April 15, 2007 12:22 AM
To: [EMAIL PROTECTED]
Subject: [PHP] preg_replace and regular expressions.

Okay, so what I have is a BB code type of thing for a CMS, which I for 
obvious reasons can't allow HTML.

Here's the snippet of my function:


function bbCode($str)
  {
   $db = new _Mysql;
   $strOld = $str;
   $strNew = $str;
   $getRegexs = $db-query(SELECT `regex`,`replace`,`search` FROM 
`_bb_codes`);
   while ($getRegex = mysql_fetch_assoc($getRegexs))
{
 $search = base64_decode($getRegex['search']);
 $regex = base64_decode($getRegex['regex']);
 $replace = base64_decode($getRegex['replace']);
 if (preg_match($search,$strNew) == 1)
  {
   for ($i = 1; $i  20; $i++)
{
 $strNew = $strOld;
$strNew = preg_replace($regex,$replace,$strNew);
 if ($strNew == $strOld)
  {
   break;
  }
 else
  {
   $strOld = $strNew;
  }
}
  }
}
   $return = $strNew;
   return $return;
  }
**

But, for something like this:

[quote][quote]Quote #2[/quote]Quote #1[/quote]No quote.

I'll get:

div class=quoteContainer
[quote]Quote #2[/quote]Quote #1/div
No quote.

Despite being in the loop.

Regex is: /\[quote\]((.*|\n)*)\[\/quote\]/
Replace is: div class=messageQuote$1/div

Both are stored base64 encoded in a database.

Any help / suggestions much appreciated.

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

2007-04-15 Thread afan
 Afan Pasalic wrote:

 Jochem Maas wrote:
 Richard Kurth wrote:

 What do you do when isset does not work? If I send data in a
 $_REQUEST['var'] like
 if (isset($_REQUEST['var'])) {
 }
 Put var has no data it still says it is set. Because $_REQUEST['var']
 = 
 and isset thinks  is set


 php -r ' $r = array(foo = );
 var_dump(isset($r[foo]),empty($r[foo]));'

 so empty() should give you the result your looking for  ...
 some tips:

 1. generally use $_GET or $_POST in preference to $_REQUEST
 2. be specific about your input validation, e.g.:

 if (isset($_GET['var'])  ($_GET['var'] == 'foo')) {
 echo got it!;
 }

 I always wondered about this. if $_GET['var'] == 'foo' is true, isn't
 automatically isset($_GET['var']) true too?
 I mean, isn't
 if ($_GET['var'] == 'foo')
 {
 echo got it!;
 }
 just enough?

 it doesn't cover the situation where $_GET['var'] doesn't exist,
 and using uninitialized var is not recommended.

 of course it's your call whether you write/run code that spits out
 E_NOTICEs all over the place due to usage of uninitialized vars.


not quite sure. if $_GET['var'] doesn't exists it's DEFINITLY not equal to
'foo', right?

how I understand:
clause one: isset($_GET['var'])
clause two: ($_GET['var'] == 'foo')
if clause two is true, clause one MUST be true.
if clause one is true, clause two could be true or false.

means, if I look for solutions where ($_GET['var'] == 'foo') they wil
lautomaticaly cover isset($_GET['var']) part.
if ($_GET['var'] != 'foo') I erally do not care isset($_GET['var']) or
!isset($_GET['var']).

or I'm missing something here?

I have E_NOTICE turned off. :)

thanks.

-afan


 -afan



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



Re: [PHP] isset

2007-04-15 Thread Larry Garfield
On Sunday 15 April 2007 12:07 pm, [EMAIL PROTECTED] wrote:

  of course it's your call whether you write/run code that spits out
  E_NOTICEs all over the place due to usage of uninitialized vars.

 not quite sure. if $_GET['var'] doesn't exists it's DEFINITLY not equal to
 'foo', right?

 how I understand:
 clause one: isset($_GET['var'])
 clause two: ($_GET['var'] == 'foo')
 if clause two is true, clause one MUST be true.
 if clause one is true, clause two could be true or false.

 means, if I look for solutions where ($_GET['var'] == 'foo') they wil
 lautomaticaly cover isset($_GET['var']) part.
 if ($_GET['var'] != 'foo') I erally do not care isset($_GET['var']) or
 !isset($_GET['var']).

 or I'm missing something here?

 I have E_NOTICE turned off. :)

And right there is your first mistake.  The only time to not have E_NOTICE on 
is when you're using legacy code that isn't E_NOTICE compliant and you don't 
have the time to upgrade it to be compliant.  Developing without E_NOTICE 
means you're telling the computer it's OK, let me just randomly guess where 
this bug or security hole or random typo is.  *Bad* idea.  

*Always* develop in the tightest, most restricted, most nit-picky setting you 
can get, regardless of the language.  

If you want your syntax to be a bit simpler, I frequently use helper functions 
along these lines:

function http_get_int($var, $default=0) {
  return isset($_GET[$var]) ? (int) $_GET[$var] : $default;
}

if (http_get_int('var') ==5) {
  // Do stuff
}

Clean to read, easy defaults, (reasonably) type-safe, and E_NOTICE friendly.

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

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



RE: [PHP] isset

2007-04-15 Thread Buesching, Logan J
 how I understand:
 clause one: isset($_GET['var'])
 clause two: ($_GET['var'] == 'foo')
 if clause two is true, clause one MUST be true.
 if clause one is true, clause two could be true or false.

 means, if I look for solutions where ($_GET['var'] == 'foo') they wil
 lautomaticaly cover isset($_GET['var']) part.
 if ($_GET['var'] != 'foo') I erally do not care isset($_GET['var']) or
 !isset($_GET['var']).

If you are looking for 

isset($_GET['var'])

to return true if the value exists, but may be null, you can always use 

if (isset($_GET['var']) || is_null($_GET['var]))

Albeit, I'm unsure if this will generate a warning if $_GET['var']
doesn't exist for the is_null() call.  And in this case, I believe it
would be appropriate to ignore that one warning.

-Logan

-Original Message-
From: Larry Garfield [mailto:[EMAIL PROTECTED] 
Sent: Sunday, April 15, 2007 1:17 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] isset

On Sunday 15 April 2007 12:07 pm, [EMAIL PROTECTED] wrote:

  of course it's your call whether you write/run code that spits out
  E_NOTICEs all over the place due to usage of uninitialized vars.

 not quite sure. if $_GET['var'] doesn't exists it's DEFINITLY not
equal to
 'foo', right?


 or I'm missing something here?

 I have E_NOTICE turned off. :)

And right there is your first mistake.  The only time to not have
E_NOTICE on 
is when you're using legacy code that isn't E_NOTICE compliant and you
don't 
have the time to upgrade it to be compliant.  Developing without
E_NOTICE 
means you're telling the computer it's OK, let me just randomly guess
where 
this bug or security hole or random typo is.  *Bad* idea.  

*Always* develop in the tightest, most restricted, most nit-picky
setting you 
can get, regardless of the language.  

If you want your syntax to be a bit simpler, I frequently use helper
functions 
along these lines:

function http_get_int($var, $default=0) {
  return isset($_GET[$var]) ? (int) $_GET[$var] : $default;
}

if (http_get_int('var') ==5) {
  // Do stuff
}

Clean to read, easy defaults, (reasonably) type-safe, and E_NOTICE
friendly.

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an
idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the
possession 
of every one, and the receiver cannot dispossess himself of it.  --
Thomas 
Jefferson

-- 
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] simple form web site up date

2007-04-15 Thread Joker7
I have said I would host a couple of friends CV's as a web page,here's the 
situation I'd like to set it up so that it can updated it via a simple 
form.I've googled the subject a fair bit and all I can come up with is big 
full solutions when I only need a simple form and say a flat file system.Any 
one have an idea or better still know of a pre-made form ect.

Cheers
Chris

-- 
Cheap As Chips Broadband http://yeah.kick-butt.co.uk
Superb hosting  domain name deals http://host.kick-butt.co.uk 

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



[PHP] Appending into associative arrays

2007-04-15 Thread Otto Wyss
I want to sort directories according there modification time and thought 
accociative arrays would be perfect. But when I add an element like


$dirs = array (filemtime($d) = $d)

the previous ones are lost. I tried array_push but that doesn't seems to 
work, at least I always get syntax errors. Next try was 
array_merge(array (...)). So what next?


O. Wyss

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



Re: [PHP] Json.php

2007-04-15 Thread Otto Wyss

Tijnema ! wrote:


*ROFLMFAO*...Did you actually try google for json.php?
Second result:
http://mike.teczno.com/JSON/JSON.phps

This doesn't have a json_encode but needs a $json object which then 
could be used as $json-encode(...). Thanks anyway.


O. Wyss

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



Re: [PHP] Appending into associative arrays

2007-04-15 Thread Zoltán Németh
2007. 04. 15, vasárnap keltezéssel 21.20-kor Otto Wyss ezt írta:
 I want to sort directories according there modification time and thought 
 accociative arrays would be perfect. But when I add an element like
 
 $dirs = array (filemtime($d) = $d)

why not simply

$dirs[] = array (filemtime($d) = $d);

greets
Zoltán Németh

 
 the previous ones are lost. I tried array_push but that doesn't seems to 
 work, at least I always get syntax errors. Next try was 
 array_merge(array (...)). So what next?
 
 O. Wyss
 

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



Re: [PHP] Json.php

2007-04-15 Thread Otto Wyss

Satyam wrote:

www.json.org lists all json resources in any language you care to think of.

I must admit I haven't checked each reference but the ones I have have 
only packages to install and not a PHP source. Maybe I wasn't clear when 
asking.


O. Wyss

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



Re: [PHP] Appending into associative arrays

2007-04-15 Thread Zoltán Németh
2007. 04. 15, vasárnap keltezéssel 21.20-kor Otto Wyss ezt írta:
 I want to sort directories according there modification time and thought 
 accociative arrays would be perfect. But when I add an element like
 
 $dirs = array (filemtime($d) = $d)

(sorry the previous one is incorrect, I misunderstood what you
wanted...)
so:

$dirs[filemtime($d)] = $d;

greets
Zoltán Németh

 
 the previous ones are lost. I tried array_push but that doesn't seems to 
 work, at least I always get syntax errors. Next try was 
 array_merge(array (...)). So what next?
 
 O. Wyss
 

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



Re: [PHP] Appending into associative arrays

2007-04-15 Thread Robert Cummings
On Sun, 2007-04-15 at 20:36 +0100, Alister Bulman wrote:
 On 15/04/07, Zoltán Németh [EMAIL PROTECTED] wrote:
  2007. 04. 15, vasárnap keltezéssel 21.20-kor Otto Wyss ezt írta:
   I want to sort directories according there modification time and thought
   accociative arrays would be perfect. But when I add an element like
  
   $dirs = array (filemtime($d) = $d)
  (sorry the previous one is incorrect, I misunderstood what you
  wanted...)
  so:
  $dirs[filemtime($d)] = $d;
 
 Better, I think, to put the unique thing - the name, as the index.
 Two directories may have the same modification time.
 
 $dirs[$d] = filemtime($d);

Has he even retrieved the directories in sorted order by modification
time? If not he still needs to sort.

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

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



Re: [PHP] Appending into associative arrays

2007-04-15 Thread Alister Bulman

On 15/04/07, Robert Cummings [EMAIL PROTECTED] wrote:

On Sun, 2007-04-15 at 20:36 +0100, Alister Bulman wrote:
 On 15/04/07, Zoltán Németh [EMAIL PROTECTED] wrote:
  2007. 04. 15, vasárnap keltezéssel 21.20-kor Otto Wyss ezt írta:
   I want to sort directories according there modification time and thought
   accociative arrays would be perfect. But when I add an element like



 Better, I think, to put the unique thing - the name, as the index.
 Two directories may have the same modification time.
 $dirs[$d] = filemtime($d);

Has he even retrieved the directories in sorted order by modification
time? If not he still needs to sort.


Then he'll need an asort($dirs);  They would not have come in any
particular order, so you have to sort them for whatever you need
anyway.

Alister

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



Re: [PHP] simple form web site up date

2007-04-15 Thread Børge Holen
On Sunday 15 April 2007 20:56, Joker7 wrote:
 I have said I would host a couple of friends CV's as a web page,here's the
 situation I'd like to set it up so that it can updated it via a simple
 form.I've googled the subject a fair bit and all I can come up with is big
 full solutions when I only need a simple form and say a flat file
 system.Any one have an idea or better still know of a pre-made form ect.

form
textarea/textarea
input type=submit
/form

and choose whatever you have access and feel comfortable to, to use as 
storage. This allows you to use html code to style, and the result is shown 
on the frontend.


 Cheers
 Chris

 --
 Cheap As Chips Broadband http://yeah.kick-butt.co.uk
 Superb hosting  domain name deals http://host.kick-butt.co.uk

-- 
---
Børge
http://www.arivene.net
---

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



Re: [PHP] free allocated memory: HOW ?

2007-04-15 Thread Chris

Richard Lynch wrote:

On Fri, April 13, 2007 12:54 am, Arthur Erdös wrote:

It can if you're trying to process a borked image...

I've had imagecreatefromjpeg() eat memory up to almost 50x the size
of
the image before finally deciding it can't handle it and crapping
out.
That was *after* running it through getimagesize() with no problem
at all.

okay - good point - but in this case the OP is reading in an html
template file,
just a string of 20.7Kb, what could go wrong there?


this is probably one issue... the template is an HTML template
containing images like img src=http://www.brainguide.com/xxx/. How
does PHP handle this stuff? I suppose that it is just a string and the
image at the URL is not really read, or am I wrong?

The newsletter does not have any attachements.


Now you're not making any sense at all...

Either your newsletter has the images in it, or it doesn't.


Embedded images are different to images with a href. To embed images, 
you need to read them in to memory and attach them (much the same as a 
regular attachment). Referencing a href like that doesn't do anything, 
it's just part of the string.


--
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP] auto page generation

2007-04-15 Thread Jeremy Adams

I'm building a website right now that will be a database of attractions in
the Carolina and Virginia area.
The idea is that attraction owners can submit data to the database and the
database will automatically generate a page containing that information.
What I'm trying to figure out is how to generate the pages automatically and
have links to them added to the site.  If someone could help me or point me
in the direction of a book or web page that covers this I would really
appreciate it.


Re: [PHP] auto page generation

2007-04-15 Thread heavyccasey

What you're looking for is basically what PHP is all about. Just read
any PHP  MySQL book and you'll find whatever you need.

On 4/15/07, Jeremy Adams [EMAIL PROTECTED] wrote:

I'm building a website right now that will be a database of attractions in
the Carolina and Virginia area.
The idea is that attraction owners can submit data to the database and the
database will automatically generate a page containing that information.
What I'm trying to figure out is how to generate the pages automatically and
have links to them added to the site.  If someone could help me or point me
in the direction of a book or web page that covers this I would really
appreciate it.



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