php-general Digest 2 Feb 2007 20:53:00 -0000 Issue 4604

2007-02-02 Thread php-general-digest-help

php-general Digest 2 Feb 2007 20:53:00 - Issue 4604

Topics (messages 248184 through 248209):

Graphs
248184 by: ffredrixson.comcast.net
248185 by: Thomas Pedoussaut
248192 by: LeaseWeb - Poelwijk

Login script login
248186 by: Dave Carrera
248187 by: Satyam
248188 by: Stut
248189 by: Dave Carrera
248190 by: Németh Zoltán
248191 by: Jürgen Wind

Reading from the htpasswd file
248193 by: Ryan A

Year
248194 by: Dan Shirah
248195 by: Robert Cummings
248196 by: Robert Cummings
248197 by: Németh Zoltán
248198 by: chetan rane
248199 by: Dan Shirah

Re: Can a class instance a property of another class
248200 by: Ken Kixmoeller -- reply to ken.kixmoeller.com

Executing scripts from a table
248201 by: Ken Kixmoeller -- reply to ken.kixmoeller.com
248202 by: Ken Kixmoeller -- reply to ken.kixmoeller.com

preg_replace();
248203 by: Sébastien WENSKE
248204 by: .freenet.am
248205 by: .freenet.am
248206 by: .freenet.am
248207 by: Steffen Ebermann

Re: preg_replace(); [solved]
248208 by: Sébastien WENSKE
248209 by: Steffen Ebermann

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:
php-general@lists.php.net


--
---BeginMessage---
I would like to add some graphing capability to an app of mine. What package is 
recommended? I don't need anything too fancy, just some bar graphs, pie charts, 
etc.

Thank you in advance.---End Message---
---BeginMessage---

[EMAIL PROTECTED] wrote:

I would like to add some graphing capability to an app of mine. What package is 
recommended? I don't need anything too fancy, just some bar graphs, pie charts, 
etc.

Thank you in advance.
  

I use the PEAR module Image_Graph
Officially it's still in alpha, but works like a charm.

--
Thomas
---End Message---
---BeginMessage---
Or you could try JPgraph, i used it for several projects:  
http://www.aditus.nu/jpgraph/


Regards,

Sander Poelwijk



[EMAIL PROTECTED] wrote:

I would like to add some graphing capability to an app of mine. What package is 
recommended? I don't need anything too fancy, just some bar graphs, pie charts, 
etc.

Thank you in advance.
  
---End Message---
---BeginMessage---

Hi All,

Having a grey brain moment here and need some advise on the logic of 
this, should be simple, login script.


I am checking validity of

customer number
customer email
customer password (md5 in mysql)

So i have my form with relevant fields

Now i am getting problems with either sql or how i am handling , and 
showing, and errors.


I think what i am asking is this

If someone just hits the login button show error All fields must be 
entered


If customer number dose not excist show relevant error

If customer number ok but email not show error

If customer number ok but email ok but password is not show error

If all is ok set sessions, got this ok, and proceed.

Any help with with this is very much appreciated.

Kind Regards

Dave C
---End Message---
---BeginMessage---
- Original Message - 
From: Dave Carrera [EMAIL PROTECTED]

Hi All,

Having a grey brain moment here and need some advise on the logic of this, 
should be simple, login script.


I am checking validity of

customer number
customer email
customer password (md5 in mysql)

So i have my form with relevant fields

Now i am getting problems with either sql or how i am handling , and 
showing, and errors.


I think what i am asking is this

If someone just hits the login button show error All fields must be 
entered


If customer number dose not excist show relevant error

If customer number ok but email not show error

If customer number ok but email ok but password is not show error



In login scripts you usually don't tell which part of the login is wrong, 
otherwise, you are hinting at what is right.  Once the customer is logged 
in, you are right to be as helpful as possible, but until the customer 
proves who he/she is, you don't give away anything.


Satyam



If all is ok set sessions, got this ok, and proceed.

Any help with with this is very much appreciated.

Kind Regards

Dave C

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


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

Dave Carrera wrote:

Hi All,

Having a grey brain moment here and need some advise on the logic of 
this, should be simple, login script.


I am checking validity of

customer number
customer email
customer password (md5 in mysql)

So i have my form with relevant fields

Now i am getting problems with either sql or how i am handling , and 
showing, and errors.


I think what i am asking is this

If someone just 

[PHP] accepting POST variables using CURL

2007-02-02 Thread chetan rane

HI al

i tried curl to access HTTPS pages but how do i get the POST variables been
passed to me .
here is teh exact thing which i want.
i have a HTML page when i submit  the form i want ot read all teh POST data
using HTTPS.
I know its possible using CURL but dont exactly know how to do it



--
Have A plesant Day
Chetan. D. Rane
Location: Pune , India
Contact: +91-9890792762
otherID: [EMAIL PROTECTED]
[EMAIL PROTECTED]


[PHP] Graphs

2007-02-02 Thread ffredrixson
I would like to add some graphing capability to an app of mine. What package is 
recommended? I don't need anything too fancy, just some bar graphs, pie charts, 
etc.

Thank you in advance.

Re: [PHP] Graphs

2007-02-02 Thread Thomas Pedoussaut

[EMAIL PROTECTED] wrote:

I would like to add some graphing capability to an app of mine. What package is 
recommended? I don't need anything too fancy, just some bar graphs, pie charts, 
etc.

Thank you in advance.
  

I use the PEAR module Image_Graph
Officially it's still in alpha, but works like a charm.

--
Thomas

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



[PHP] Login script login

2007-02-02 Thread Dave Carrera

Hi All,

Having a grey brain moment here and need some advise on the logic of 
this, should be simple, login script.


I am checking validity of

customer number
customer email
customer password (md5 in mysql)

So i have my form with relevant fields

Now i am getting problems with either sql or how i am handling , and 
showing, and errors.


I think what i am asking is this

If someone just hits the login button show error All fields must be 
entered


If customer number dose not excist show relevant error

If customer number ok but email not show error

If customer number ok but email ok but password is not show error

If all is ok set sessions, got this ok, and proceed.

Any help with with this is very much appreciated.

Kind Regards

Dave C

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



Re: [PHP] Login script login

2007-02-02 Thread Satyam
- Original Message - 
From: Dave Carrera [EMAIL PROTECTED]

Hi All,

Having a grey brain moment here and need some advise on the logic of this, 
should be simple, login script.


I am checking validity of

customer number
customer email
customer password (md5 in mysql)

So i have my form with relevant fields

Now i am getting problems with either sql or how i am handling , and 
showing, and errors.


I think what i am asking is this

If someone just hits the login button show error All fields must be 
entered


If customer number dose not excist show relevant error

If customer number ok but email not show error

If customer number ok but email ok but password is not show error



In login scripts you usually don't tell which part of the login is wrong, 
otherwise, you are hinting at what is right.  Once the customer is logged 
in, you are right to be as helpful as possible, but until the customer 
proves who he/she is, you don't give away anything.


Satyam



If all is ok set sessions, got this ok, and proceed.

Any help with with this is very much appreciated.

Kind Regards

Dave C

--
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] Login script login

2007-02-02 Thread Stut

Dave Carrera wrote:

Hi All,

Having a grey brain moment here and need some advise on the logic of 
this, should be simple, login script.


I am checking validity of

customer number
customer email
customer password (md5 in mysql)

So i have my form with relevant fields

Now i am getting problems with either sql or how i am handling , and 
showing, and errors.


I think what i am asking is this

If someone just hits the login button show error All fields must be 
entered


If customer number dose not excist show relevant error

If customer number ok but email not show error

If customer number ok but email ok but password is not show error

If all is ok set sessions, got this ok, and proceed.

Any help with with this is very much appreciated.

Kind Regards

Dave C


I'm not totally clear what the question was in there. Personally I keep 
this simple...


?php
$_POST['number'] =
(isset($_POST['number']) ? trim($_POST['number']) : '');
$_POST['email'] =
(isset($_POST['email']) ? trim($_POST['email']) : '');

if (empty($_POST['number']) or
empty($_POST['email']) or
empty($_POST['password']))
{
die('All fields must be entered');
}

// Find the customer/user/whatever you need from the given details

if (not found)
{
die('Unable to locate customer/user/whatever');
}

// Set up the session here, or however you're tracking the
// current customer/user/whatever

header('Location: /somewhere_else');
?

Hope that helps.

-Stut

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



Re: [PHP] Login script login

2007-02-02 Thread Dave Carrera

Hi Stut,

I think i have found where i am going wrong.

Its in the comparison login for the db result.

So i select * from jfjfjfjf where custno=$_POST[number]

But now i am getting messed up with if cust no not found then all i get 
is a blank page but hoping for an error


And i dont think i am comparing the db result with the $_POST correctly

Struggling here a bit :-(

Dave C

Stut wrote:

Dave Carrera wrote:

Hi All,

Having a grey brain moment here and need some advise on the logic of 
this, should be simple, login script.


I am checking validity of

customer number
customer email
customer password (md5 in mysql)

So i have my form with relevant fields

Now i am getting problems with either sql or how i am handling , and 
showing, and errors.


I think what i am asking is this

If someone just hits the login button show error All fields must be 
entered


If customer number dose not excist show relevant error

If customer number ok but email not show error

If customer number ok but email ok but password is not show error

If all is ok set sessions, got this ok, and proceed.

Any help with with this is very much appreciated.

Kind Regards

Dave C


I'm not totally clear what the question was in there. Personally I 
keep this simple...


?php
$_POST['number'] =
(isset($_POST['number']) ? trim($_POST['number']) : '');
$_POST['email'] =
(isset($_POST['email']) ? trim($_POST['email']) : '');

if (empty($_POST['number']) or
empty($_POST['email']) or
empty($_POST['password']))
{
die('All fields must be entered');
}

// Find the customer/user/whatever you need from the given details

if (not found)
{
die('Unable to locate customer/user/whatever');
}

// Set up the session here, or however you're tracking the
// current customer/user/whatever

header('Location: /somewhere_else');
?

Hope that helps.

-Stut



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



Re: [PHP] Login script login

2007-02-02 Thread Németh Zoltán
On p, 2007-02-02 at 12:10 +, Dave Carrera wrote:
 Hi Stut,
 
 I think i have found where i am going wrong.
 
 Its in the comparison login for the db result.
 
 So i select * from jfjfjfjf where custno=$_POST[number]
 
 But now i am getting messed up with if cust no not found then all i get 
 is a blank page but hoping for an error

because you get an empty result set if no match is found
so check it like

if ($row = mysql_fetch_array($result)) {
 // ok, found
} else {
 // not found, error
}

or whatever sql you use

hope that helps
Zoltán Németh

 
 And i dont think i am comparing the db result with the $_POST correctly
 
 Struggling here a bit :-(
 
 Dave C
 
 Stut wrote:
  Dave Carrera wrote:
  Hi All,
 
  Having a grey brain moment here and need some advise on the logic of 
  this, should be simple, login script.
 
  I am checking validity of
 
  customer number
  customer email
  customer password (md5 in mysql)
 
  So i have my form with relevant fields
 
  Now i am getting problems with either sql or how i am handling , and 
  showing, and errors.
 
  I think what i am asking is this
 
  If someone just hits the login button show error All fields must be 
  entered
 
  If customer number dose not excist show relevant error
 
  If customer number ok but email not show error
 
  If customer number ok but email ok but password is not show error
 
  If all is ok set sessions, got this ok, and proceed.
 
  Any help with with this is very much appreciated.
 
  Kind Regards
 
  Dave C
 
  I'm not totally clear what the question was in there. Personally I 
  keep this simple...
 
  ?php
  $_POST['number'] =
  (isset($_POST['number']) ? trim($_POST['number']) : '');
  $_POST['email'] =
  (isset($_POST['email']) ? trim($_POST['email']) : '');
 
  if (empty($_POST['number']) or
  empty($_POST['email']) or
  empty($_POST['password']))
  {
  die('All fields must be entered');
  }
 
  // Find the customer/user/whatever you need from the given details
 
  if (not found)
  {
  die('Unable to locate customer/user/whatever');
  }
 
  // Set up the session here, or however you're tracking the
  // current customer/user/whatever
 
  header('Location: /somewhere_else');
  ?
 
  Hope that helps.
 
  -Stut
 
 

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



Re: [PHP] Login script login

2007-02-02 Thread Jürgen Wind



Stut wrote:
 
 
 
 I'm not totally clear what the question was in there. Personally I keep 
 this simple...
 
 ?php
 $_POST['number'] =
  (isset($_POST['number']) ? trim($_POST['number']) : '');
 $_POST['email'] =
  (isset($_POST['email']) ? trim($_POST['email']) : '');
 
 if (empty($_POST['number']) or
  empty($_POST['email']) or
  empty($_POST['password']))
 {
  die('All fields must be entered');
 }
 
 // Find the customer/user/whatever you need from the given details
 
 if (not found)
 {
  die('Unable to locate customer/user/whatever');
 }
 
 // Set up the session here, or however you're tracking the
 // current customer/user/whatever
 
 header('Location: /somewhere_else');
 ?
 
 Hope that helps.
 
 -Stut
 
 
be aware that you need a session_write_close(); before header('Location...
or the session data might not be written to disk!

just my 2 cent
-- 
View this message in context: 
http://www.nabble.com/Login-script-login-tf3160341.html#a8766588
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] Graphs

2007-02-02 Thread LeaseWeb - Poelwijk
Or you could try JPgraph, i used it for several projects:  
http://www.aditus.nu/jpgraph/


Regards,

Sander Poelwijk



[EMAIL PROTECTED] wrote:

I would like to add some graphing capability to an app of mine. What package is 
recommended? I don't need anything too fancy, just some bar graphs, pie charts, 
etc.

Thank you in advance.
  


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



[PHP] Reading from the htpasswd file

2007-02-02 Thread Ryan A
Hey,

*** Warning: feeling a bit braindead today after working long hours yesterday 
so please excuse if some parts are crappy***

I have a pal who uses a htpasswd file for access to his site..

rather than using basic_auth he wants to change it to form based _without_ a DB 
(ie user comes to his site and enters the username and password into a form, 
then submits it to the php script, the php script reads the htpasswd file and 
accordingly grants access or denies access if the login does not match)

Am not so sure about this but before i can make an arguement against this, I 
should know something myself so my questions to you more knowledgeable guys are:
1. Is it such a good idea switching?
2.Wont the basic_auth pop up anyway even after entering these values into the 
form?
3. If having a hundreds (or even thousands) of user:pass combinations in the 
htpasswd file wont it make logging in longer and more processor intensive 
to search all of the combinations till you find (or not find) the login?


Did some small code experiments before coming here asking for advise...
can send you the code I have written if need be...but what i have found out is 
with small amounts of data i see no difference in speed of loggin in using the 
htpasswd file as the login database..

Thanks for any input on the above.

Cheers!
R


--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
 
-
Sucker-punch spam with award-winning protection.
 Try the free Yahoo! Mail Beta.

[PHP] Year

2007-02-02 Thread Dan Shirah

Hello all,

I am trying to populate a dropdown list to contain the current year to 10
years in the future.  Below is the code I'm using:

?PHP
 for ($y=0;$y=10;$y++) {
 $years=date http://php.net/date('Y')+$y;
 $short_years=date http://php.net/date('y')+$y;
 echo $short_years;
 echo option value=\$short_years\$years/option;
 }
?
I want the selection value to be 2007, 2008, 2009, 2010  and the $years
accomplishes this.  Howeverm I want the option value to be the two digit
year ex. 07, 08, 09, 10...the $short_years semi accomplishes thisinstead
of getting 07, 08, 08, 10 I get 7, 8, 9, 10...how can I get it to output the
two year for 07, 08, 09 without it cutting off the zero?

Reagrds,

Dan


Re: [PHP] Year

2007-02-02 Thread Robert Cummings
On Fri, 2007-02-02 at 10:11 -0500, Dan Shirah wrote:
 Hello all,
 
 I am trying to populate a dropdown list to contain the current year to 10
 years in the future.  Below is the code I'm using:
 
 ?PHP
   for ($y=0;$y=10;$y++) {
   $years=date http://php.net/date('Y')+$y;
   $short_years=date http://php.net/date('y')+$y;
   echo $short_years;
   echo option value=\$short_years\$years/option;
   }
 ?
 I want the selection value to be 2007, 2008, 2009, 2010  and the $years
 accomplishes this.  Howeverm I want the option value to be the two digit
 year ex. 07, 08, 09, 10...the $short_years semi accomplishes thisinstead
 of getting 07, 08, 08, 10 I get 7, 8, 9, 10...how can I get it to output the
 two year for 07, 08, 09 without it cutting off the zero?

?php

$year = date( 'Y' );
for( $i = 0; $i  10; $i++ )
{
$iYear = substr( (string)($year + 1), 2 );
echo 'option value='.$iYear.''.$iYear.'/option';
}

?

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

2007-02-02 Thread Robert Cummings
On Fri, 2007-02-02 at 10:21 -0500, Robert Cummings wrote:
 On Fri, 2007-02-02 at 10:11 -0500, Dan Shirah wrote:
  Hello all,
  
  I am trying to populate a dropdown list to contain the current year to 10
  years in the future.  Below is the code I'm using:
  
  ?PHP
for ($y=0;$y=10;$y++) {
$years=date http://php.net/date('Y')+$y;
$short_years=date http://php.net/date('y')+$y;
echo $short_years;
echo option value=\$short_years\$years/option;
}
  ?
  I want the selection value to be 2007, 2008, 2009, 2010  and the $years
  accomplishes this.  Howeverm I want the option value to be the two digit
  year ex. 07, 08, 09, 10...the $short_years semi accomplishes thisinstead
  of getting 07, 08, 08, 10 I get 7, 8, 9, 10...how can I get it to output the
  two year for 07, 08, 09 without it cutting off the zero?
 
 ?php
 
 $year = date( 'Y' );
 for( $i = 0; $i  10; $i++ )
 {
 $iYear = substr( (string)($year + 1), 2 );
 echo 'option value='.$iYear.''.$iYear.'/option';
 }
 
 ?

Bleh... Typo in the above... so here's a better one :)

?php

$currYear = date( 'Y' );
for( $i = 0; $i  10; $i++ )
{
$longYear  = $currYear + $i;
$shortYear = substr( (string)$longYear, 2 );
echo 'option value='.$shortYear.''.$longYear.'/option';
}

?

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

2007-02-02 Thread Németh Zoltán
On p, 2007-02-02 at 10:11 -0500, Dan Shirah wrote:
 Hello all,
 
 I am trying to populate a dropdown list to contain the current year to 10
 years in the future.  Below is the code I'm using:
 
 ?PHP
   for ($y=0;$y=10;$y++) {
   $years=date http://php.net/date('Y')+$y;
   $short_years=date http://php.net/date('y')+$y;
   echo $short_years;
   echo option value=\$short_years\$years/option;
   }
 ?
 I want the selection value to be 2007, 2008, 2009, 2010  and the $years
 accomplishes this.  Howeverm I want the option value to be the two digit
 year ex. 07, 08, 09, 10...the $short_years semi accomplishes thisinstead
 of getting 07, 08, 08, 10 I get 7, 8, 9, 10...how can I get it to output the
 two year for 07, 08, 09 without it cutting off the zero?

I think it is because when you calculate $short_years it is an integer.
So insert the following before echoing it out:

if ($short_years  10) {$short_years = 0 . $short_years;}

hope that helps
Zoltán Németh

 
 Reagrds,
 
 Dan

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



Re: [PHP] Year

2007-02-02 Thread chetan rane

HI Dan

try this this should work 100%;

echo select;
for ($y=0;$y=10;$y++) {
$years=date('Y')+$y;
$short_years=date('y')+$y;
printf(option value=\%02d\%d/option,$short_years,$years);

}
echo /select;

On 2/2/07, Dan Shirah [EMAIL PROTECTED] wrote:


Hello all,

I am trying to populate a dropdown list to contain the current year to 10
years in the future.  Below is the code I'm using:

?PHP
  for ($y=0;$y=10;$y++) {
  $years=date http://php.net/date('Y')+$y;
  $short_years=date http://php.net/date('y')+$y;
  echo $short_years;
  echo option value=\$short_years\$years/option;
  }
?
I want the selection value to be 2007, 2008, 2009, 2010  and the
$years
accomplishes this.  Howeverm I want the option value to be the two digit
year ex. 07, 08, 09, 10...the $short_years semi accomplishes
thisinstead
of getting 07, 08, 08, 10 I get 7, 8, 9, 10...how can I get it to output
the
two year for 07, 08, 09 without it cutting off the zero?

Reagrds,

Dan





--
Have A plesant Day
Chetan. D. Rane
Location: Pune , India
Contact: +91-9890792762
otherID: [EMAIL PROTECTED]
[EMAIL PROTECTED]


Re: [PHP] Year

2007-02-02 Thread Dan Shirah

Thanks everyone!  A lot of great solutions!

On 2/2/07, chetan rane [EMAIL PROTECTED] wrote:


HI Dan

try this this should work 100%;

echo select;
for ($y=0;$y=10;$y++) {
$years=date('Y')+$y;
$short_years=date('y')+$y;
printf(option value=\%02d\%d/option,$short_years,$years);

}
echo /select;

On 2/2/07, Dan Shirah [EMAIL PROTECTED] wrote:

 Hello all,

 I am trying to populate a dropdown list to contain the current year to
10
 years in the future.  Below is the code I'm using:

 ?PHP
   for ($y=0;$y=10;$y++) {
   $years=date http://php.net/date('Y')+$y;
   $short_years=date http://php.net/date('y')+$y;
   echo $short_years;
   echo option value=\$short_years\$years/option;
   }
 ?
 I want the selection value to be 2007, 2008, 2009, 2010  and the
 $years
 accomplishes this.  Howeverm I want the option value to be the two digit
 year ex. 07, 08, 09, 10...the $short_years semi accomplishes
 thisinstead
 of getting 07, 08, 08, 10 I get 7, 8, 9, 10...how can I get it to output
 the
 two year for 07, 08, 09 without it cutting off the zero?

 Reagrds,

 Dan




--
Have A plesant Day
Chetan. D. Rane
Location: Pune , India
Contact: +91-9890792762
otherID: [EMAIL PROTECTED]
[EMAIL PROTECTED]




Re: [PHP] Can a class instance a property of another class

2007-02-02 Thread Ken Kixmoeller -- reply to [EMAIL PROTECTED]
Thanks to all -- got all of this working fine. Mostly my syntax was a  
bit off. Your examples helped me mend my ways.


Ken

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



[PHP] Executing scripts from a table

2007-02-02 Thread Ken Kixmoeller -- reply to [EMAIL PROTECTED]

Hi, folks -- - -

For security and efficiency, I am trying to store PHP scripts in  
MySQL tables. Only problem: I can't get them to execute.


In a template:

$php_code = $this-ApplicationObject-GetStoredCode($whichpage);

echo $php_code;  // doesn't execute

print_r($php_code); // doesn't execute, either


I've looked for some kind of exec_script() function without luck.

I can't be the first one to have done this. Any ideas or resources  
you can point me to?


Thank you -- - -

Ken

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



Re: [PHP] Executing scripts from a table

2007-02-02 Thread Ken Kixmoeller -- reply to [EMAIL PROTECTED]

Yeah, that was it. Thanks, Thomas.

(dang it, I should have been able to figure out that myself!)

Ken


On Feb 2, 2007, at 11:32 AM, Thomas Pedoussaut wrote:


Ken Kixmoeller -- reply to [EMAIL PROTECTED] wrote:

Hi, folks -- - -

For security and efficiency, I am trying to store PHP scripts in  
MySQL tables. Only problem: I can't get them to execute.


In a template:

$php_code = $this-ApplicationObject-GetStoredCode($whichpage);

echo $php_code;  // doesn't execute

print_r($php_code); // doesn't execute, either



I think you're thinking of eval()
http://ie2.php.net/manual/en/function.eval.php

It should do what you want.

--
Thomas




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



[PHP] preg_replace();

2007-02-02 Thread Sébastien WENSKE
Hi all,

I want replace the | (pipe) and the   (space) chars where are between  
(double-quotes)  by an underscore _ with the preg_replace(); funtction.

Can someone help me to find the correct regex.

Thanks in advance

Seb

Re: [PHP] preg_replace();

2007-02-02 Thread wwww
I am not a very experienced programmer, but I think that str_replace
can be used in this case:
$new_string=str_replace('|', '_', $old_string)

then use the same function to replace spaces.

Ed

Friday, February 2, 2007, 9:30:37 PM, you wrote:

 Hi all,

 I want replace the | (pipe) and the   (space) chars where are
 between  (double-quotes)  by an underscore _ with the
 preg_replace(); funtction.

 Can someone help me to find the correct regex.

 Thanks in advance

 Seb



-- 
Best regards,
 mailto:[EMAIL PROTECTED]

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



Re[2]: [PHP] preg_replace();

2007-02-02 Thread wwww
I have tasted the code and it worked fine (if I got you right):

$old_string=lazy \|\ dog;
$new_string=str_replace('|', '_', $old_string);
print $new_string;

I got lazy_dog

Ed

Friday, February 2, 2007, 10:01:14 PM, you wrote:

 Thanks,

 but I think that I must use preg_replace because the condition is: replace
 the chars (pipe or space) when they are between 

 ie :  src=file:///h|/hjcjdgh dlkgj/dgjk.jpg  to 
 src=file:///h_/hjcjdgh_dlkgj/dgjk.jpg

 Seb





 - Original Message - 
 From: [EMAIL PROTECTED]
 To: Sébastien WENSKE [EMAIL PROTECTED]
 Cc: php-general@lists.php.net
 Sent: Friday, February 02, 2007 8:38 PM
 Subject: Re: [PHP] preg_replace();


 I am not a very experienced programmer, but I think that str_replace
 can be used in this case:
 $new_string=str_replace('|', '_', $old_string)

 then use the same function to replace spaces.

 Ed

 Friday, February 2, 2007, 9:30:37 PM, you wrote:

 Hi all,

 I want replace the | (pipe) and the   (space) chars where are
 between  (double-quotes)  by an underscore _ with the
 preg_replace(); funtction.

 Can someone help me to find the correct regex.

 Thanks in advance

 Seb

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



Re[4]: [PHP] preg_replace();

2007-02-02 Thread wwww
Try this one:

$old_string=lazy \some chars|some chars\ dog;
$new_string=str_replace('|', '_', $old_string);
print $new_string;

Ed

Friday, February 2, 2007, 10:39:59 PM, you wrote:

 ok, but :

 $old_string=lazy \some chars|some chars\ dog;
 $new_string=str_replace('|', '_', $old_string);

 don't work

 sorry for my bad english, i'm french.

 - Original Message - 
 From: [EMAIL PROTECTED]
 To: Sébastien WENSKE [EMAIL PROTECTED]
 Sent: Friday, February 02, 2007 9:22 PM
 Subject: Re[2]: [PHP] preg_replace();


 I have tasted the code and it worked fine (if I got you right):

 $old_string=lazy \|\ dog;
 $new_string=str_replace('|', '_', $old_string);
 print $new_string;

 I got lazy_dog

 Ed

 Friday, February 2, 2007, 10:01:14 PM, you wrote:

 Thanks,

 but I think that I must use preg_replace because the condition is: replace
 the chars (pipe or space) when they are between 

 ie :  src=file:///h|/hjcjdgh dlkgj/dgjk.jpg  to
 src=file:///h_/hjcjdgh_dlkgj/dgjk.jpg

 Seb





 - Original Message - 
 From: [EMAIL PROTECTED]
 To: Sébastien WENSKE [EMAIL PROTECTED]
 Cc: php-general@lists.php.net
 Sent: Friday, February 02, 2007 8:38 PM
 Subject: Re: [PHP] preg_replace();


 I am not a very experienced programmer, but I think that str_replace
 can be used in this case:
 $new_string=str_replace('|', '_', $old_string)

 then use the same function to replace spaces.

 Ed

 Friday, February 2, 2007, 9:30:37 PM, you wrote:

 Hi all,

 I want replace the | (pipe) and the   (space) chars where are
 between  (double-quotes)  by an underscore _ with the
 preg_replace(); funtction.

 Can someone help me to find the correct regex.

 Thanks in advance

 Seb

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



Re: [PHP] preg_replace();

2007-02-02 Thread Steffen Ebermann
This always works for me:

if (preg_match_all(!\(.+)\!sU, $var, $match))
{
  for ($i=0; $icount($match[0]); $i++)
  {
$old = $match[1][$i];
$new = preg_replace(!\|| !, _, $old);
$var = str_replace(\$old\, \$new\, $var);
  }
}


On Fri, Feb 02, 2007 at 07:30:37PM +0100, Sébastien WENSKE wrote:
 Hi all,
 
 I want replace the | (pipe) and the   (space) chars where are between  
 (double-quotes)  by an underscore _ with the preg_replace(); funtction.
 
 Can someone help me to find the correct regex.
 
 Thanks in advance
 
 Seb

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



Re: [PHP] preg_replace(); [solved]

2007-02-02 Thread Sébastien WENSKE

nice !

thanks Steffen  Ed !

i've just add  '[src|background] *= *' to make sure that the replacement 
takes effect only in THML tag's attributes


if (preg_match_all(![src|background] *= *\(.+)\!sU, $htmlContent, 
$match))

{
 for ($i=0; $icount($match[0]); $i++)
 {
   $old = $match[1][$i];
   $new = preg_replace(!\|| !, _, $old);
   $htmlContent = str_replace(\$old\, \$new\, $htmlContent);
 }
}

- Original Message - 
From: Steffen Ebermann [EMAIL PROTECTED]

To: php-general@lists.php.net
Cc: Sébastien WENSKE [EMAIL PROTECTED]
Sent: Friday, February 02, 2007 9:01 PM
Subject: Re: [PHP] preg_replace();



This always works for me:

if (preg_match_all(!\(.+)\!sU, $var, $match))
{
 for ($i=0; $icount($match[0]); $i++)
 {
   $old = $match[1][$i];
   $new = preg_replace(!\|| !, _, $old);
   $var = str_replace(\$old\, \$new\, $var);
 }
}


On Fri, Feb 02, 2007 at 07:30:37PM +0100, Sébastien WENSKE wrote:

Hi all,

I want replace the | (pipe) and the   (space) chars where are between 
 (double-quotes)  by an underscore _ with the preg_replace(); 
funtction.


Can someone help me to find the correct regex.

Thanks in advance

Seb




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



Re: [PHP] preg_replace(); [solved]

2007-02-02 Thread Steffen Ebermann
Maybe you just mistyped that, but this would *probably* also match on s=
or bar=, cause [ and ] are metacharacters.

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



Re: [PHP] preg_replace();

2007-02-02 Thread Steffen Ebermann
On Fri, Feb 02, 2007 at 09:01:38PM +0100, Steffen Ebermann wrote:

 $new = preg_replace(!\|| !, _, $old);

Heyha, the mail's subject gone obsolete. preg_replace isn't
necessary at all.

Better use: $new = str_replace(array (|, ), _, $old);

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



Re: [PHP] Graphs

2007-02-02 Thread Lists

[EMAIL PROTECTED] skrev:

I would like to add some graphing capability to an app of mine. What package is 
recommended? I don't need anything too fancy, just some bar graphs, pie charts, 
etc.

Thank you in advance.
  
Take a look a at: http://www.java2s.com then click on PHP in the menu 
and then sculll down to the image making.


:)

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



[PHP] scheduler algorithm

2007-02-02 Thread bruce
hi...

i'm creating a quick/dirty app for scheduling a function, based on the user
entering a start time/date, as well as a potential periodic timeframe.

ie:
 the user enters-
start time/date:10:00am 01/10/07
periodicmonthly

the idea is to be able to have a process start running on the start
time/date, and then to repeat on a monthly basis on the same time/date. i
can easily accomplish this for dates that are '1-28', but i'm looking for
suggestions as to how to handle situations where the number of the start
date, might be greater than the end date of the 'current month.

in searching google, i haven't come up with many apps that handle this...

thoughts/comments/etc...

thanks.

-bruce

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



[PHP] Re: scheduler algorithm

2007-02-02 Thread frank
hmmm, a month period has 4*7 days e.g. then i can schedule on 31.3.07 a
month  period which will repeat itself on 30.4.07 and again on 30.5.07 even
though may has 31 days. i dont see no other logic if you take a week period
it same a week has always 7 days. how else would it make sense. the start
date += the period

fra*



bruce [EMAIL PROTECTED] schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
 hi...

 i'm creating a quick/dirty app for scheduling a function, based on the
user
 entering a start time/date, as well as a potential periodic timeframe.

 ie:
  the user enters-
   start time/date: 10:00am 01/10/07
 periodic monthly

 the idea is to be able to have a process start running on the start
 time/date, and then to repeat on a monthly basis on the same time/date. i
 can easily accomplish this for dates that are '1-28', but i'm looking for
 suggestions as to how to handle situations where the number of the start
 date, might be greater than the end date of the 'current month.

 in searching google, i haven't come up with many apps that handle this...

 thoughts/comments/etc...

 thanks.

 -bruce

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



Re: [PHP] Re: scheduler algorithm

2007-02-02 Thread Richard Lynch

You may want to look at what various databases will do for you with
date arithmetic.

E.g., You can type this in MySQL:

select date_add('2007-01-31', interval 1 month);

I'm not sure what it will answer, but you can type that. :-)

In Postgresql, it's more like:
select '1/31/2007'::date + '1 month'::interval;

but the point is that somebody else has already solved this most
likely, and you should definitely not try to re-invent the wheel on
this one.


On Fri, February 2, 2007 4:24 pm, frank wrote:
 hmmm, a month period has 4*7 days e.g. then i can schedule on 31.3.07
 a
 month  period which will repeat itself on 30.4.07 and again on 30.5.07
 even
 though may has 31 days. i dont see no other logic if you take a week
 period
 it same a week has always 7 days. how else would it make sense. the
 start
 date += the period

 fra*



 bruce [EMAIL PROTECTED] schrieb im Newsbeitrag
 news:[EMAIL PROTECTED]
 hi...

 i'm creating a quick/dirty app for scheduling a function, based on
 the
 user
 entering a start time/date, as well as a potential periodic
 timeframe.

 ie:
  the user enters-
   start time/date: 10:00am 01/10/07
 periodic monthly

 the idea is to be able to have a process start running on the start
 time/date, and then to repeat on a monthly basis on the same
 time/date. i
 can easily accomplish this for dates that are '1-28', but i'm
 looking for
 suggestions as to how to handle situations where the number of the
 start
 date, might be greater than the end date of the 'current month.

 in searching google, i haven't come up with many apps that handle
 this...

 thoughts/comments/etc...

 thanks.

 -bruce

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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] preg_replace();

2007-02-02 Thread Richard Lynch
On Fri, February 2, 2007 12:30 pm, Sébastien WENSKE wrote:
 I want replace the | (pipe) and the   (space) chars where are
 between  (double-quotes)  by an underscore _ with the
 preg_replace(); funtction.

 Can someone help me to find the correct regex.

You can even go so far so to do both at once:
$text = str_replace(array('|', ' '), array('_', '_'), $text);

This does ignore the initial requirement of only replacing the ones
between quotes, however...

Something like this will honor the quotes restriction:
$text = preg_replace_all('/(.*)[| ](.*)/, '\\1_\\2', $text);

I probably got the PCRE wrong, but it's close.

Download The Regex Coach and play with it. :-)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Executing scripts from a table

2007-02-02 Thread Richard Lynch
On Fri, February 2, 2007 11:32 am, Ken Kixmoeller -- reply to
[EMAIL PROTECTED] wrote:
 For security and efficiency, I am trying to store PHP scripts in
 MySQL tables. Only problem: I can't get them to execute.

E.

Putting PHP source into MySQL is the WRONG way to go for security and
efficiency...

So, right there, you're in the wrong tree.

But the function you THINK you want is 'eval'
http://php.net/eval

Rule Of Thumb:
If 'eval' is the answer, you are almost certainly asking the wrong
question.
:-)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Year

2007-02-02 Thread Richard Lynch
On Fri, February 2, 2007 9:11 am, Dan Shirah wrote:
 I am trying to populate a dropdown list to contain the current year to
 10
 years in the future.  Below is the code I'm using:

 ?PHP
   for ($y=0;$y=10;$y++) {
   $years=date http://php.net/date('Y')+$y;
   $short_years=date http://php.net/date('y')+$y;
   echo $short_years;
   echo option value=\$short_years\$years/option;
   }
 ?
 I want the selection value to be 2007, 2008, 2009, 2010  and the
 $years
 accomplishes this.  Howeverm I want the option value to be the two
 digit
 year ex. 07, 08, 09, 10...the $short_years semi accomplishes
 thisinstead
 of getting 07, 08, 08, 10 I get 7, 8, 9, 10...how can I get it to
 output the
 two year for 07, 08, 09 without it cutting off the zero?

for ($year = date('Y'); $year = date('Y') + 10; $year++){
  $short_year = $year - 2000;
  echo option value=\$short_year\$year/option\n;
}

Using the 2-digit year as your value is almost for sure a really Bad
Idea, unless you are dealing with legacy software that absolutely
needs it...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Reading from the htpasswd file

2007-02-02 Thread Richard Lynch
On Fri, February 2, 2007 8:17 am, Ryan A wrote:
 I have a pal who uses a htpasswd file for access to his site..

 rather than using basic_auth he wants to change it to form based
 _without_ a DB (ie user comes to his site and enters the username and
 password into a form, then submits it to the php script, the php
 script reads the htpasswd file and accordingly grants access or denies
 access if the login does not match)

 Am not so sure about this but before i can make an arguement against
 this, I should know something myself so my questions to you more
 knowledgeable guys are:
 1. Is it such a good idea switching?

If he thinks the Basic Auth popup is icky then go ahead and get rid
of it.  No biggie.

There's no great advantage to Basic Auth, and, actually, having the
authentication done in PHP can be beneficial if you want to start
doing some custom logging and user profile modeling of logins.

It's certainly possible to get access to that, or to integrate that
after the HTTP Basic Auth has been done, but it can be cleaner code
to have it all as one conceptual mess in PHP, instead of a mess in
HTTP Auth Apache and another in PHP.

 2.Wont the basic_auth pop up anyway even after entering these values
 into the form?

Not unless you send the headers out, either with PHP, or with
.htaccess (or httpd.conf) settings to do HTTP Basic Authentication

 3. If having a hundreds (or even thousands) of user:pass combinations
 in the htpasswd file wont it make logging in longer and more
 processor intensive to search all of the combinations till you find
 (or not find) the login?

Not really.
$file = file_get_contents('/full/path/to/htpasswd');
preg_match_all('/(.*):(.*)$/msU', $file, $htpassd);
//play games with array_flip or array_slice here to get
//an associative array of $users['username'] = 'password';
//Your login check is then a simple array reference

 Did some small code experiments before coming here asking for
 advise...
 can send you the code I have written if need be...but what i have
 found out is with small amounts of data i see no difference in speed
 of loggin in using the htpasswd file as the login database..

Whether reading the file or the DB is faster depends totally and your
hardware and network topology between web server and db server, or
lack thereof.

Nothing anybody else can say on this matter has any real meaning.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Login script login

2007-02-02 Thread Richard Lynch
On Fri, February 2, 2007 5:19 am, Dave Carrera wrote:
 Having a grey brain moment here and need some advise on the logic of
 this, should be simple, login script.

 I am checking validity of

 customer number
 customer email
 customer password (md5 in mysql)

 So i have my form with relevant fields

 Now i am getting problems with either sql or how i am handling , and
 showing, and errors.

 I think what i am asking is this

 If someone just hits the login button show error All fields must be
 entered

$customer_number = (int) (isset($_POST['customer_number']) ?
$_POST['customer_number'] : 0);
$customer_email = isset($_POST['customer_email']) ?
$_POST['customer_email'] : '';
$customer_password = isset($_POST['customer_password']) ?
$_POST['customer_password'] : '';

if (!$customer_number || !strlen($customer_email) ||
!strlen($customer_password)){
  $messages[] = All fields are required;
}
else{
  $customer_number_sql = mysql_real_escape_string($customer_number);
  $customer_email_sql = mysql_real_escape_string($customer_email);
  $customer_password_sql = mysql_real_escape_string($customer_password);
  $query = select ;
  $query .=email = '$customer_email_sql' as email_ok
  $query .= , password = md5('$customer_password_sql') as password_ok
  $query .=  FROM customer ;
  $query .=  WHERE customer_number = $customer_number_sql ;
  $customer_info = mysql_query($query) or die(mysql_error());
  if (!mysql_num_rows($customer_info)){
$messages[] = Invalid Customer Number;
  }
  else{
list($email_ok, $password_ok) = mysql_fetch_row($customer_info);
if (!$email_ok) $messages[] = Invalid Email;
elseif (!$password_ok) $messages[] = Invalid Password;
  }
}
if count($messages)) echo div class=\errorp,
implode(/p\np, $messages), /p/div\n;
else require 'proceed.inc';

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Login script login

2007-02-02 Thread Richard Lynch
On Fri, February 2, 2007 5:33 am, Satyam wrote:
 In login scripts you usually don't tell which part of the login is
 wrong,
 otherwise, you are hinting at what is right.  Once the customer is
 logged
 in, you are right to be as helpful as possible, but until the customer
 proves who he/she is, you don't give away anything.

Satyam is correct:  It's more secure to not indicate when the username
was incorrect differently from an incorrect password.

But it's definitely also (very much) less user-friendly.

For example, in seldom-used applications where the user is very likely
to forget their username, such as 99% of the stupid websites that
require me to register for something that needs no security in the
first place, it's a royal pain in the ass.  :-)

You have to balance Security against Usability and make an informed
intelligent decision.



I also wondered why you have an ID number that somebody is supposed to
remember, and an email, when either one should be sufficient for most
applications, but it was easier to type out an answer than to get you
to re-think your design decisions. :-)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Login script login

2007-02-02 Thread Richard Lynch

If you are splicing $_POST directly into your SQL, you are DEFINITELY
doing it wrong, but not in the way that you think.

Start reading here:
http://phpsec.org


On Fri, February 2, 2007 6:10 am, Dave Carrera wrote:
 Hi Stut,

 I think i have found where i am going wrong.

 Its in the comparison login for the db result.

 So i select * from jfjfjfjf where custno=$_POST[number]

 But now i am getting messed up with if cust no not found then all i
 get
 is a blank page but hoping for an error

 And i dont think i am comparing the db result with the $_POST
 correctly

 Struggling here a bit :-(

 Dave C

 Stut wrote:
 Dave Carrera wrote:
 Hi All,

 Having a grey brain moment here and need some advise on the logic
 of
 this, should be simple, login script.

 I am checking validity of

 customer number
 customer email
 customer password (md5 in mysql)

 So i have my form with relevant fields

 Now i am getting problems with either sql or how i am handling ,
 and
 showing, and errors.

 I think what i am asking is this

 If someone just hits the login button show error All fields must
 be
 entered

 If customer number dose not excist show relevant error

 If customer number ok but email not show error

 If customer number ok but email ok but password is not show error

 If all is ok set sessions, got this ok, and proceed.

 Any help with with this is very much appreciated.

 Kind Regards

 Dave C

 I'm not totally clear what the question was in there. Personally I
 keep this simple...

 ?php
 $_POST['number'] =
 (isset($_POST['number']) ? trim($_POST['number']) : '');
 $_POST['email'] =
 (isset($_POST['email']) ? trim($_POST['email']) : '');

 if (empty($_POST['number']) or
 empty($_POST['email']) or
 empty($_POST['password']))
 {
 die('All fields must be entered');
 }

 // Find the customer/user/whatever you need from the given details

 if (not found)
 {
 die('Unable to locate customer/user/whatever');
 }

 // Set up the session here, or however you're tracking the
 // current customer/user/whatever

 header('Location: /somewhere_else');
 ?

 Hope that helps.

 -Stut


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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Login script login

2007-02-02 Thread Richard Lynch
On Fri, February 2, 2007 7:05 am, Jürgen Wind wrote:
 // Set up the session here, or however you're tracking the
 // current customer/user/whatever

 header('Location: /somewhere_else');
 ?

 Hope that helps.

 -Stut


 be aware that you need a session_write_close(); before
 header('Location...
 or the session data might not be written to disk!

If we're gonna get picuyane...

The Location header technically requires a full URL.

And using a re-direct instead of an include is a shocking waste of
HTTP resources imho, but that may not matter if traffic is low.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Graphs

2007-02-02 Thread Richard Lynch
On Fri, February 2, 2007 4:55 am, [EMAIL PROTECTED] wrote:
 I would like to add some graphing capability to an app of mine. What
 package is recommended? I don't need anything too fancy, just some bar
 graphs, pie charts, etc.

JP Graph is always mentioned in this list.

I generally just do GD directly, to get things laid out the way I
want, instead of sort of kind of not really the way I want.

YMMV

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] accepting POST variables using CURL

2007-02-02 Thread Richard Lynch
On Fri, February 2, 2007 2:45 am, chetan rane wrote:
 i tried curl to access HTTPS pages but how do i get the POST variables
 been
 passed to me .
 here is teh exact thing which i want.
 i have a HTML page when i submit  the form i want ot read all teh POST
 data
 using HTTPS.
 I know its possible using CURL but dont exactly know how to do it

You've got things a bit backwards...

There's the CLIENT which curl represents.

There's the SERVER using HTTPS.

You use curl (CLIENT) to *send* POST data to the SERVER.

The SERVER responds with HTML output [*]

So you just send the POST data to the SERVER with curl, and read the
HTML response.

If you are also programming the SERVER side, the POST data in PHP is
just in $_POST array.  (Unless you've configured things oddly.)

[*] Okay, the request could be for a JPEG or PDF or something, and the
Content-type and all that could be sending out something whack...


-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] date to string

2007-02-02 Thread Richard Lynch
On Thu, February 1, 2007 6:30 pm, John Taylor-Johnston wrote:
 How do I take 2007-02-01 and turn it into Thursday, February 1,
 2006?
 Simple question, except I don't know the answer :)
 This is all I see for now:
 http://ca.php.net/manual/en/function.px-date2string.php

list($year, $month, $day) = explode('-', '2007-02-01');
//the - 1 is because you SAID you wanted 2006..
//If that's a typo, lose the - 1 part.
$time = mktime(1, 0, 0, $month, $day, $year - 1);
echo date('l, F d', $time);

http://php.net/mktime
http://php.net/date

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] PHP5 Commercial Development

2007-02-02 Thread Richard Lynch
On Thu, February 1, 2007 5:13 pm, Eric Gorr wrote:
 I haven't tracked this particular issue, but I know when PHP5 was
 first released is wasn't recommended in a commercial/production
 environment. However, a lot of time has passed and we're at v5.2
 now...have things changed? Have GoogleYahoo, for example, moved to
 PHP5? Or is PHP4 still the recommendation for such environments?

Do you need XML processing or SOAP?

What are your performance requirements?

Are there features in Apache 2 that you need?

Are you using only PHP extensions that are known to be [probably]
thread safe?

You've grossly under-documented your needs, to the point that nobody
can answer your question very well.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Year

2007-02-02 Thread Robert Cummings
On Fri, 2007-02-02 at 19:02 -0600, Richard Lynch wrote:
 On Fri, February 2, 2007 9:11 am, Dan Shirah wrote:
  I am trying to populate a dropdown list to contain the current year to
  10
  years in the future.  Below is the code I'm using:
 
  ?PHP
for ($y=0;$y=10;$y++) {
$years=date http://php.net/date('Y')+$y;
$short_years=date http://php.net/date('y')+$y;
echo $short_years;
echo option value=\$short_years\$years/option;
}
  ?
  I want the selection value to be 2007, 2008, 2009, 2010  and the
  $years
  accomplishes this.  Howeverm I want the option value to be the two
  digit
  year ex. 07, 08, 09, 10...the $short_years semi accomplishes
  thisinstead
  of getting 07, 08, 08, 10 I get 7, 8, 9, 10...how can I get it to
  output the
  two year for 07, 08, 09 without it cutting off the zero?
 
 for ($year = date('Y'); $year = date('Y') + 10; $year++){
   $short_year = $year - 2000;
   echo option value=\$short_year\$year/option\n;
 }
 
 Using the 2-digit year as your value is almost for sure a really Bad
 Idea, unless you are dealing with legacy software that absolutely
 needs it...

Sorry Richard, you solution fails since he wants to retain the leading
zeros on the 2 digit years. Using subtraction and not formatting the
result will result in the loss of the 0 in 07. Also, why call the date()
function 10 times by embedding it in the loop's terminate condition?

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] Who uses PHP

2007-02-02 Thread Richard Lynch
On Thu, February 1, 2007 9:19 am, Eric Gorr wrote:
 Well, if you do not know the answer to my particular question, I'm
 curious how might you respond to someone who says:

   PHP has to many security issues and should not be used with a
 user authentication system.
   We should use XXX.

You go ahead and use XXX, because obviously the person making the
statement is so clueless that any rational discussion is moot.

Or, you quit that job and find a smarter boss.

:-)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Login script login

2007-02-02 Thread Stut

Richard Lynch wrote:

And using a re-direct instead of an include is a shocking waste of
HTTP resources imho, but that may not matter if traffic is low.


I generally redirect there because on occasion the login process does 
stuff like clear out potentially pre-existing session data from another 
part of the site. Having it happen again because of the user refreshing 
the page needs to be avoided. The redirect accomplishes this.


-Stut

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



Re: [PHP] Year

2007-02-02 Thread Richard Lynch
On Fri, February 2, 2007 7:41 pm, Robert Cummings wrote:
 for ($year = date('Y'); $year = date('Y') + 10; $year++){
   $short_year = $year - 2000;

$short_year = sprintf('%02d', $short_year);

   echo option value=\$short_year\$year/option\n;
 }

 Using the 2-digit year as your value is almost for sure a really Bad
 Idea, unless you are dealing with legacy software that absolutely
 needs it...

 Sorry Richard, you solution fails since he wants to retain the leading
 zeros on the 2 digit years. Using subtraction and not formatting the
 result will result in the loss of the 0 in 07. Also, why call the
 date()
 function 10 times by embedding it in the loop's terminate condition?

Because 10 calls to date() is chump-change.

If you need to optimize away 10 calls to date() then something is
horribly wrong...

That said, it's pretty trivial to optimize it:
for ($year = date('Y'), $end = date('Y) + 10; $year = $end; $year++){

If PHP guarantees the order of operations in for(, ; ; ) you could
even use $year instead of date('Y) on the $end assignment.  That's
really getting silly about optimization, however.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Year

2007-02-02 Thread Robert Cummings
On Fri, 2007-02-02 at 20:08 -0600, Richard Lynch wrote:
 On Fri, February 2, 2007 7:41 pm, Robert Cummings wrote:
  function 10 times by embedding it in the loop's terminate condition?
 
 Because 10 calls to date() is chump-change.

10 chumps here, 10 there, 100 there, sloppy here, sloppy there, didn't
realize this call isn't chump change, a million there. It adds up.

 If you need to optimize away 10 calls to date() then something is
 horribly wrong...

No, but implicitly understanding wasted cycles will make it a habit you
don't need to think about.

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



[PHP] Recommend PHP Flash 8 book?

2007-02-02 Thread Skip Evans

Hey all,

We're going to be developing some PHP and Flash 8 
applications and was wondering what books or online 
tutorials people might recommend.


I've Googled a few online resources but nothing 
terribly complete yet.


Any resources that have become favorites would be 
greatly appreciated.

--
Skip Evans
Big Sky Penguin, LLC
61 W Broadway
Butte, Montana 59701
406-782-2240

=-=-=-=-=-=-=-=-=-=-=

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



Re: [PHP] Graphs

2007-02-02 Thread frank
yes it does a great job, almost every parameter even for the legend can be
influenced by its methods and properties. i say jp graph is the best

fra*


 JP Graph is always mentioned in this list.

 I generally just do GD directly, to get things laid out the way I
 want, instead of sort of kind of not really the way I want.

 YMMV

 -- 
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some starving artist.
 http://cdbaby.com/browse/from/lynch
 Yeah, I get a buck. So?

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