php-general Digest 3 Feb 2007 13:16:40 -0000 Issue 4605

Topics (messages 248210 through 248234):

Re: preg_replace();
        248210 by: Steffen Ebermann
        248215 by: Richard Lynch

Re: Graphs
        248211 by: Lists
        248223 by: Richard Lynch
        248233 by: frank

scheduler algorithm
        248212 by: bruce
        248213 by: frank
        248214 by: Richard Lynch

Re: Executing scripts from a table
        248216 by: Richard Lynch

Re: Year
        248217 by: Richard Lynch
        248227 by: Robert Cummings
        248230 by: Richard Lynch
        248231 by: Robert Cummings

Re: Reading from the htpasswd file
        248218 by: Richard Lynch
        248234 by: Ryan A

Re: Login script login
        248219 by: Richard Lynch
        248220 by: Richard Lynch
        248221 by: Richard Lynch
        248222 by: Richard Lynch
        248229 by: Stut

Re: accepting POST variables using CURL
        248224 by: Richard Lynch

Re: date to string
        248225 by: Richard Lynch

Re: PHP5 & Commercial Development
        248226 by: Richard Lynch

Re: Who uses PHP
        248228 by: Richard Lynch

Recommend PHP & Flash 8 book?
        248232 by: Skip Evans

Administrivia:

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

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

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
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);

--- End Message ---
--- Begin Message ---
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?

--- End Message ---
--- Begin Message ---
[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.

:)

--- End Message ---
--- Begin Message ---
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?

--- End Message ---
--- Begin Message ---
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?

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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?

--- End Message ---
--- Begin Message ---
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.

Errrr.

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?

--- End Message ---
--- Begin Message ---
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
> this....instead
> 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?

--- End Message ---
--- Begin Message ---
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
> > this....instead
> > 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.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
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?

--- End Message ---
--- Begin Message ---
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.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
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?

--- End Message ---
--- Begin Message ---
Hey!

(Forgive me for top posting but in this case I think it makes more sense)

Thanks for the tips, you've given me some excellent starting points so will 
start experimenting from there and come back when I start running into problems 
(which I am sure I will as I still dont know RegEx so preg_* statements leave 
me pretty much clueless... I know, I should learn)

If you (or anybody) wants to chip in any additional advise snippets, please go 
ahead.

Cheers!
R

Richard Lynch <[EMAIL PROTECTED]> wrote: 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




------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
 
---------------------------------
Any questions?  Get answers on any topic at Yahoo! Answers. Try it now.

--- End Message ---
--- Begin Message ---
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=\"error"><p>",
implode("</p>\n<p>", $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?

--- End Message ---
--- Begin Message ---
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?

--- End Message ---
--- Begin Message ---
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?

--- End Message ---
--- Begin Message ---
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?

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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?

--- End Message ---
--- Begin Message ---
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?

--- End Message ---
--- Begin Message ---
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 Google&Yahoo, 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?

--- End Message ---
--- Begin Message ---
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?

--- End Message ---
--- Begin Message ---
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

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

--- End Message ---

Reply via email to