RE: [PHP] include files, ".php" or ".inc" ?

2004-11-22 Thread steve
Graham Cossey wrote:
> If you only have limited control/knowledge of Apache you could adopt
> names something like: script.inc.php
> 
> In such a way PHP will always process the script as it's extension
> is .php and you can easily identify that it is a script to be
> included/required.

FWIW, I use .php for main scripts/pages, and .phtml for includes, as the
latter get processed through PHP too.

-- 
@+
Steve

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



[PHP] IE title bug

2004-11-22 Thread Giles
Hello people

 

I am making a movie browsing site. On one page I have a list of movies as
links. When you click on the movie it goes to another page with the movie ID
as an anchor in the page so that the browser scrolls to that movie. 

 

The title of the page is made up of the movie category name and the movie
name. This all works fine in mozilla but in IE the title appears like this:

 

Site Name - Category Name#3037#3037#3037#3037#3037#3037#3037#3037

 

Where #3037 is the ID of the movie and obviously appears at the end of the
url. Looking at the source of the page the  tag is fine and does not
contain any id's (or it would appear in mozilla as well).

Also the title appears ok to begin with - the page has flash thumbnails of
the movies in and as each of these swf's load into the page another  #3037
appears in the title. We are using the satay method of flash embedding as
this is required by the client. Possibly it is something to do with that?

 

Anyone seen anything like this before or have any suggestions?

 

Thanks

 

 

Giles Roadnight

http://giles.roadnight.name

 



[PHP] Problems running PHP.

2004-11-22 Thread Jose Arguello
I just install in my computer PHP 5.0.2, I followed
the instruction on the book PHP and MySql Web
Development by Luke Welling and Laura Thomson.
But, it is not working. I have tried to use this
codes, one is just a html form and the other is a php
code. I tried to pass the values from the form to the
php code but it is not getting the values.

HTML Form:
 
 
 
 
  Item
  Quantity
 
 
  Tires
  
 
 
  Oil
  
   
 
 
 
  Spark Plugs
  
   
 
 
 
  
 
 
 
 
 Php Code:
 
 
 
 

   Bob's Auto Parts - Order Results


  Bob's Auto Parts
  Order Results
  Order pordessed at ';
echo date('H:i, jS F');
echo '';

echo 'Your order is as follows: ';
echo $tireqty.' tires';
echo $oilqty.' bottles of oil';
echo $sparkqty.' spark plugs';
  ?>

 
 
 
 I am sure that this code works because I tried it on
a server who is running php 4.0, I know that in php
 5.0.2, I can use $_POST and $_GET instead of
 $HTTP_GET_VARS or $HTTP_POST_VARS. But, I have tried
 them and they are not working.
 So, I hope you can help me to fix it, because I
really want to learn how to program with PHP.
 
 Best Regards,
  Jose



__ 
Do you Yahoo!? 
The all-new My Yahoo! - Get yours free! 
http://my.yahoo.com 
 

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



[PHP] Fwd: Re: Problems running PHP.

2004-11-22 Thread Jose Arguello

Note: forwarded message attached.




__ 
Do you Yahoo!? 
The all-new My Yahoo! - Get yours free! 
http://my.yahoo.com 
 
--- Begin Message ---
Hi Jose,
Since your report is not about the php.net website, this is not the 
right address to send it. Please consult [EMAIL PROTECTED] for 
support questions.

Regards,
Gabor Hojtsy
Jose Arguello írta:
I just install in my computer PHP 5.0.2, I followed
the instruction on the book PHP and MySql Web
Development by Luke Welling and Laura Thomson.
But, it is not working. I have tried to use this
codes, one is just a html form and the other is a php
code. I tried to pass the values from the form to the
php code but it is not getting the values.
HTML Form:



 Item
 Quantity


 Tires
 


 Oil
 
  



 Spark Plugs
 
  



 



Php Code:


   
  Bob's Auto Parts - Order Results
   
   
 Bob's Auto Parts
 Order Results
 Order pordessed at ';
echo date('H:i, jS F');
echo '';

echo 'Your order is as follows: ';
echo $tireqty.' tires';
echo $oilqty.' bottles of oil';
echo $sparkqty.' spark plugs';
 ?>
   

I am sure that this code works because I tried it on a
server who is running php 4.0, I know that in php
5.0.2, I can use $_POST and $_GET instead of
$HTTP_GET_VARS or $HTTP_POST_VARS. But, I have tried
them and they are not working.
So, I hope you can help me to fix it, because I really
want to learn how to program with PHP.
Best Regards,
 Jose
		
__ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 
 


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

Re: [PHP] Problems running PHP.

2004-11-22 Thread Eakin, W


 




I am sure that this code works because I tried it on
a server who is running php 4.0, I know that in php
5.0.2, I can use $_POST and $_GET instead of
$HTTP_GET_VARS or $HTTP_POST_VARS. But, I have tried
them and they are not working.
So, I hope you can help me to fix it, because I
really want to learn how to program with PHP.
Best Regards,
 Jose
 


Hello Jose,
   You may have already tried this, but have you checked your php.ini 
file to see if you have

register_globals = Off
If you don't, change it to 'Off', and try your code again.
William
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Timezones

2004-11-22 Thread Venelin Arnaudov
Hi Trevor,
I have list of Timezones (see the attachment) but I do not know the 
offset in respect of GMT.  Then I will be able to calculate my local 
time for every user local input.

I would like to know which PHP date/time functions operate with the 
system time alone and which one take the timezone into consideration. 
When in the function description is mentioned "local time" what does 
this mean? User local or system local?

Kindest regards,
Venelin
Gryffyn, Trevor wrote:
Don't know if this helps, but this was a message regarding Windows based
long timezone formats that was posted a little while ago by another
user:
---
Kim [EMAIL PROTECTED]
Managed to find it  It helps using just those right keywords after a
million goes
http://www.steltor.com/notes/corptime-server/5_4/refmanual/refappd.htm
this
is a list of all timezone notations. Thanks for your help. Thought about
the
long way but it was not a pleasant thought as you may imagine, was
hoping to
avoid at all costs. Hopefully this sorts it.
---
You might want to build a table or a list in some way that'll return the
GMT offset for you.
Let us know what you end up doing.
-TG
 

-Original Message-
From: Venelin Arnaudov [mailto:[EMAIL PROTECTED] 
Sent: Friday, November 19, 2004 6:57 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Timezones

Hi,
I have a legacy PHP3 system and a MySQL DB with two tables:
user {
 user_id int,
 timezone varchar (like "Europe/Brussels", "US/Eastern", 
"America/New_York", etc.)
}
and
messages {
 msg_id int,
 user_id int,
 date int
}

When a user submits a message, my PHP script (using time() function) 
stores the submission time in messages.date field. However 
this value is 
not the server's system time but shifted according the users timezone.

1. How can I convert it to reflect my timezone (ex. GMT)? Is 
there a way 
to find the offset between two timezones given in long format 
as in my 
table?
2. I would appreciate any information on how the PHP/Apache 
handles the 
timezone offset when calculating the time. Which of the PHP date/time 
functions take into consideration the environment variable TZ 
(upon user 
login there is putenv('TZ='.user_get_timezone()); command)?

Thank you in advance,
Venelin
--
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] include files, ".php" or ".inc" ?

2004-11-22 Thread Marek Kilimajer
Richard Davey wrote:
Hello Perry,
Sunday, November 21, 2004, 8:02:48 PM, you wrote:
PJ> What it the purpose of the ".inc" file then?
Security - on a properly configured web server a .inc file will never
actually try and compile/execute itself. Whereas a .php one always
will.
Yes, .inc files will show up as they are - php source, db 
username/password etc. So it's even less secure unless you forbid 
serving them:


Order Allow,Deny
Deny from all

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


[PHP] perl to php translation tool?

2004-11-22 Thread Markus Mayer
Hello everyone!

I've searched for a tool that would translate, or at least mostly translate, 
perl scripts into php, unfortunately with no success.  I didn't even find a 
reference in the archives of this list to this subject, which surprises me.  
Does anyone know of any tool that can handle this type of thing?

regards
Markus

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



Re: [PHP] Timezones

2004-11-22 Thread Robin Vickery
On Fri, 19 Nov 2004 12:56:55 +0100, Venelin Arnaudov <[EMAIL PROTECTED]> wrote:
> I have a legacy PHP3 system and a MySQL DB with two tables:
> [...]
> When a user submits a message, my PHP script (using time() function)
> stores the submission time in messages.date field. However this value is
> not the server's system time but shifted according the users timezone.
>
> 1. How can I convert it to reflect my timezone (ex. GMT)? Is there a way
> to find the offset between two timezones given in long format as in my
> table?

MySQL assumes that the dates you supply are in your servers local
timezone. You can convert dates from the users time to your local
timezone using the builtin MySQL function CONVERT_TZ(datetime,
from_tz, to_tz). See the MySQL manual for details:

http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html#IDX1410

If you want to use "long format" timezones rather than offsets, you
may have to do a little extra work with MySQL as the zoneinfo tables
are not automatically loaded - the manual explains...

   http://dev.mysql.com/doc/mysql/en/Time_zone_support.html

  -robin

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



[PHP] default extension for includes?

2004-11-22 Thread Justin French
I'd like to be able to call include("thing"); and have PHP 
automatically look for thing.html -- I know include_path can look in 
multiple places, but I have no idea if I can look for multiple file 
extensions, close matches, etc.

Doubt it, but I'm asking :)
Justin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re[2]: [PHP] include files, ".php" or ".inc" ?

2004-11-22 Thread Richard Davey
Hello Marek,

Monday, November 22, 2004, 12:18:22 PM, you wrote:

MK> Yes, .inc files will show up as they are - php source, db
MK> username/password etc. So it's even less secure unless you forbid
MK> serving them:

That would be the "properly configured web server" section of my post,
assuming this has been done they are definitely not less secure than
placing those details in a .php.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I am not young enough to know everything." - Oscar Wilde

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



Re: [PHP] IE title bug

2004-11-22 Thread Raditha Dissanayake
Giles wrote:

Anyone seen anything like this before or have any suggestions?
 

I thought it was mysql that had taken over this list and not microsoft.

Thanks


Giles Roadnight
http://giles.roadnight.name

 

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


Re: [PHP] perl to php translation tool?

2004-11-22 Thread Raditha Dissanayake
Markus Mayer wrote:
Hello everyone!
I've searched for a tool that would translate, or at least mostly translate, 
perl scripts into php, unfortunately with no success.  I didn't even find a 
reference in the archives of this list to this subject, which surprises me.  
Does anyone know of any tool that can handle this type of thing?
 

I am not suprised that you didn't find anything. This would be something 
exceedily complex to write such a convertor because you can solve the 
same problem in so many different ways using perl.

regards
Markus
 

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


[PHP] yet another autoresponder

2004-11-22 Thread Raditha Dissanayake
Can someone remove this idiot? (this idiot = idiot who uses an 
autoresponder , not the idiot who is complaining about it :-))
Autoresponder wrote:

Hi,
To protect us from spamming, please contact with us at 
http://www.dvdidle.com/contact.htm, thanks.
Sincerely,
DVDIdle Support Team
 

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


Re: [PHP] perl to php translation tool?

2004-11-22 Thread Christophe Chisogne
Markus Mayer wrote:
I've searched for a tool that would translate, or at least mostly translate, 
perl scripts into php, unfortunately with no success. 
It's simply impossible. By example, a Perl script handling file uploads
cant be translated automatically : php4 handles file uploads _before_
the php script gets executed (choosing tmp filename, filling $_FILES etc).
AFAIK PHP can't do everything Perl can (ex download progress),
so automatic translations are not possible unless very simple/specific cases.
Some translation problems are
- very different OO models
- different handling of references
- and, as suggested by Raditha, in Perl, TIMTOWTDI
  -- There Is More Than One Way To Do It
Does anyone know of any tool that can handle this type of thing?
/dev/brain  :-)
Christophe
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Is there a shorthand way to...?

2004-11-22 Thread Al
When handling $_POST[] values that may or may not be assigned, I am forever 
using:
if((isset($_POST['courses_list']) AND $_POST['courses_list']== 'Used'))
Is there a shorthand way of doing this without causing notice errors?
Thanks.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] redirecting to a success page

2004-11-22 Thread Judson Vaughn
Group,
I have a create_login.php page, which works (it inserts data into the 
database), but I need for the script once executed to redirect to a 
success.php page.

It doesn't do this and I can't figure out how to do it. I've included a 
portion of the script below. This was created by Dreamweaver MX and 
modified by me.

The original script, created by Dreamweaver, gives an error that says 
header has already been sent. I tried different options to no avail. I 
realize this script is now seriously hosed but thought I would include 
it anyway since others may be using Dreamweaver.

Anybody know a simple fix for this? I have a feeling that it's right in 
front of me but I'm just not getting it.

Jud.
Judson Vaughn
[EMAIL PROTECTED] | [EMAIL PROTECTED]
Seiter Vaughn  Communications
12455 Plowman Court
Herndon, VA 20170
703.450.9740
svc
===
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
  $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS["MM_insert"])) && 
($HTTP_POST_VARS["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO xcart_customers (login, usertype, 
membership, password, firstname, lastname, email, pending_membership) 
VALUES ( %s ,%s, %s, %s, %s, %s, %s, %s)",
   GetSQLValueString($HTTP_POST_VARS['login'], "text"),
   GetSQLValueString($HTTP_POST_VARS['usertype'], 
"text"),
   GetSQLValueString($HTTP_POST_VARS['membership'], 
"text"),
   GetSQLValueString($HTTP_POST_VARS['password'], 
"text"),
	   GetSQLValueString($HTTP_POST_VARS['firstname'], "text"),
	   GetSQLValueString($HTTP_POST_VARS['lastname'], "text"),
	   GetSQLValueString($HTTP_POST_VARS['email'], "text"),

GetSQLValueString($HTTP_POST_VARS['pending_membership'], "text"));
  mysql_select_db($database_courses1, $courses1);
  $Result1 = mysql_query($insertSQL, $courses1) or die(mysql_error());
  $insertGoTo = "success.php";
===
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] include files, ".php" or ".inc" ?

2004-11-22 Thread Justin French
On 22/11/2004, at 7:02 AM, Perry Jönsson wrote:
What it the purpose of the ".inc" file then?
It gives you a way of knowing what's a directly executable file (like 
index.php) and what's an included file.  Further, I disallow the direct 
serving of all .inc files in my htaccess, so that people can't directly 
browse an include file which should not be executed on their own, and 
should not be served to a browser direct as text (like passwords).

Better still, store all your includes outside the document root, but 
that's another story.

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


Re: [PHP] redirecting to a success page

2004-11-22 Thread Randy Rinehart
You can send a header to redirect like below.


Or you can print out some javascript
location.href='successpage.php';



-randy rinehart


- Original Message - 
From: "Judson Vaughn" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, November 22, 2004 8:13 AM
Subject: [PHP] redirecting to a success page


> Group,
>
> I have a create_login.php page, which works (it inserts data into the
> database), but I need for the script once executed to redirect to a
> success.php page.
>
> It doesn't do this and I can't figure out how to do it. I've included a
> portion of the script below. This was created by Dreamweaver MX and
> modified by me.
>
> The original script, created by Dreamweaver, gives an error that says
> header has already been sent. I tried different options to no avail. I
> realize this script is now seriously hosed but thought I would include
> it anyway since others may be using Dreamweaver.
>
> Anybody know a simple fix for this? I have a feeling that it's right in
> front of me but I'm just not getting it.
>
> Jud.
>
> Judson Vaughn
> [EMAIL PROTECTED] | [EMAIL PROTECTED]
> Seiter Vaughn  Communications
> 12455 Plowman Court
> Herndon, VA 20170
> 703.450.9740
> svc
>
> ===
>
> $editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
> if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
>$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
> }
>
> if ((isset($HTTP_POST_VARS["MM_insert"])) &&
> ($HTTP_POST_VARS["MM_insert"] == "form1")) {
>$insertSQL = sprintf("INSERT INTO xcart_customers (login, usertype,
> membership, password, firstname, lastname, email, pending_membership)
> VALUES ( %s ,%s, %s, %s, %s, %s, %s, %s)",
> GetSQLValueString($HTTP_POST_VARS['login'],
"text"),
> GetSQLValueString($HTTP_POST_VARS['usertype'],
> "text"),
> GetSQLValueString($HTTP_POST_VARS['membership'],
> "text"),
> GetSQLValueString($HTTP_POST_VARS['password'],
> "text"),
>GetSQLValueString($HTTP_POST_VARS['firstname'], "text"),
>GetSQLValueString($HTTP_POST_VARS['lastname'], "text"),
>GetSQLValueString($HTTP_POST_VARS['email'], "text"),
>
> GetSQLValueString($HTTP_POST_VARS['pending_membership'], "text"));
>
>mysql_select_db($database_courses1, $courses1);
>$Result1 = mysql_query($insertSQL, $courses1) or die(mysql_error());
>
>
>$insertGoTo = "success.php";
>
> ===
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

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



RE: [PHP] redirecting to a success page

2004-11-22 Thread Jay Blanchard
[snip]
I have a create_login.php page, which works (it inserts data into the 
database), but I need for the script once executed to redirect to a 
success.php page.
[/snip]

http://www.php.net/header

header("Location: success.php"); exit();

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



Re: [PHP] perl to php translation tool?

2004-11-22 Thread John Nichel
Christophe Chisogne wrote:
/dev/brain  :-)
Are we sure that is included with all new OS's? ;)
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Is there a shorthand way to...?

2004-11-22 Thread Marek Kilimajer
Al wrote:
When handling $_POST[] values that may or may not be assigned, I am 
forever using:

if((isset($_POST['courses_list']) AND $_POST['courses_list']== 'Used'))
Is there a shorthand way of doing this without causing notice errors?
Thanks.
Before your condition:
$courses_list = isset($_POST['courses_list']) ? $_POST['courses_list'] : '';
then:
if($courses_list == 'Used'))
Sure, does not help any for a single condition.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Is there a shorthand way to...?

2004-11-22 Thread Robby Russell
On Mon, 2004-11-22 at 09:01 -0500, Al wrote:
> When handling $_POST[] values that may or may not be assigned, I am forever 
> using:
> 
> if((isset($_POST['courses_list']) AND $_POST['courses_list']== 'Used'))
> 
> Is there a shorthand way of doing this without causing notice errors?
> 
> Thanks.
> 

You could write a function that would perform this for you.

function getPostVar($var)
{
if (array_key_exists($var, $_POST) && isset($_POST[$var])) {
   return $_POST[$var];
} else {
   return False;
}

}

if (getPostVar('contact_list') == "Used")...

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
*--- Now supporting PHP5 ---
/


signature.asc
Description: This is a digitally signed message part


Re: [PHP] redirecting to a success page

2004-11-22 Thread Robby Russell
On Mon, 2004-11-22 at 09:13 -0500, Judson Vaughn wrote:
> Group,
> 
> I have a create_login.php page, which works (it inserts data into the 
> database), but I need for the script once executed to redirect to a 
> success.php page.
> 
> It doesn't do this and I can't figure out how to do it. I've included a 
> portion of the script below. This was created by Dreamweaver MX and 
> modified by me.
> 
> The original script, created by Dreamweaver, gives an error that says 
> header has already been sent. I tried different options to no avail. I 
> realize this script is now seriously hosed but thought I would include 
> it anyway since others may be using Dreamweaver.
> 
Sounds like you are displaying information then trying to redirect a
user? The way the internet works is that you load a page...and the
browser shouldn't be sent more headers until the next browser action.
Javascript can do this with a meta refresh, or you can use ob_start() at
the start of your php code, which will allow you to send headers at any
point during your php code, as it waits until it goes through all your
php code before sending any headers.

-Robby

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
*--- Now supporting PHP5 ---
/


signature.asc
Description: This is a digitally signed message part


Re: [PHP] Re: Tabs or Spaces?

2004-11-22 Thread Philip Thompson
On Nov 21, 2004, at 4:53 PM, Ryan King wrote:
On Nov 21, 2004, at 3:09 PM, Matthew Weier O'Phinney wrote:
* Daniel Schierbeck <[EMAIL PROTECTED]>:
There seems to be some tendency towards using spaces instead of tabs
when indenting PHP code - personally i can't come up with any reason 
not
to use tabs. I was just wondering if any of you freakees had some 
sort
of explanation...
Most likely due to PEAR standards:
http://pear.sourceforge.net/en/standards.php
I'm not sure what the rationale was behind using spaces instead of 
tabs,
but it's a standard I've seen in perl as well; it's not entirely 
unheard
I believe the rationale is that, since different environments define 
tabs as different sizes. So, the only way to be consistent across 
different environments is to use spaces. FWIW, many text editors can 
emulate tabs.  That is, when typin, you can hit tab, but the text 
editor inserts spaces instead. I find this very useful.

-ryan
Word for word ditto.
~Philip
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Is there a shorthand way to...?

2004-11-22 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 22 November 2004 14:01, Al wrote:

> When handling $_POST[] values that may or may not be
> assigned, I am forever using:
> 
> if((isset($_POST['courses_list']) AND
> $_POST['courses_list']== 'Used'))
> 
> Is there a shorthand way of doing this without causing notice errors?

For genuine one-offs, I tend to use:

if (@$_POST['courses_list']=='Used')

Otherwise, if I'm making multiple accesses to the $_POST[] element, I use
one of the other techniques already posted.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



[PHP] 'Unable to load' extension dll if VS.net 2003 not installed

2004-11-22 Thread Tang, Ming-Chung
Hi all,
 
I followed the great intro '
 Developing Custom PHP Extensions: Part 1' and successfully
built a php_devarticlesmod.dll on my winXP using VS.net 2003, and
everything works fine.
But when I try to use the built dll on another winXP computer (VS.net
2003 is not installed) by directly copying the whole, same directories
from my winXP (including apache1331 and php436 & php436src, and
php.ini), I got the error message: 'Unable to load dynamic library
.php_devarticlesmod.dll'. Then I uncommented 'php_gd.dll and
php_ming.dll' in PHP.ini; the system can find them and both can be shown
in the page by using 'phpinfo();'. So it's not a problem of PATH since
they are all located in the same extension dir.
I also tried to copy all dll's in PHP related DIRs to c:\windows or
system, or system32 and tried to add PHP related DIRs to system PATH,
but still got the same error message.
Finally, I get another winXP computer with VS.net 2003 installed and try
again (without building the dll again), and it works this time. So I
think the extension module I built is somehow dependant on something of
VS.net 2003, but I don't know why. Could someone please give me a hint
to resolve this?
 
Regards,
Paulkk,


Re: [PHP] perl to php translation tool?

2004-11-22 Thread Markus Mayer
I was afraid of such answers.  My intention was to get rid of a fewperl 
scripts on our server that were written by external companies, and those 
companies are pressing to continue to use perl for their cgi's.  /dev/brain 
would be nice, if I could get that node made at those companies  but it 
seems like I'm dealing with more like /dev/braindead  Such is life...

Thanks for the info though!

regards
Markus

On Monday 22 November 2004 14:48, Christophe Chisogne wrote:
> Markus Mayer wrote:
> > I've searched for a tool that would translate, or at least mostly
> > translate, perl scripts into php, unfortunately with no success.
>
> It's simply impossible. By example, a Perl script handling file uploads
> cant be translated automatically : php4 handles file uploads _before_
> the php script gets executed (choosing tmp filename, filling $_FILES etc).
> AFAIK PHP can't do everything Perl can (ex download progress),
> so automatic translations are not possible unless very simple/specific
> cases.
>
> Some translation problems are
>
> - very different OO models
> - different handling of references
> - and, as suggested by Raditha, in Perl, TIMTOWTDI
>-- There Is More Than One Way To Do It
>
> > Does anyone know of any tool that can handle this type of thing?
>
> /dev/brain  :-)
>
> Christophe

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



Re: [PHP] perl to php translation tool?

2004-11-22 Thread Greg Donald
On Mon, 22 Nov 2004 13:37:42 +0100, Markus Mayer <[EMAIL PROTECTED]> wrote:
> I've searched for a tool that would translate, or at least mostly translate,
> perl scripts into php, unfortunately with no success.  I didn't even find a
> reference in the archives of this list to this subject, which surprises me.
> Does anyone know of any tool that can handle this type of thing?

You may find this reference page useful:

http://www.cs.wcupa.edu/~rkline/perl2php/


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



[PHP] Re: Tabs or Spaces?

2004-11-22 Thread Daniel Schierbeck
Daniel Schierbeck wrote:
Hello there!
There seems to be some tendency towards using spaces instead of tabs 
when indenting PHP code - personally i can't come up with any reason not 
to use tabs. I was just wondering if any of you freakees had some sort 
of explanation...

Wow, didn't mean to start a major debate :x
Thanks, now i know (switching to spaces).
--
Daniel Schierbeck
Help spread Firefox (www.getfirefox.com): 
http://www.spreadfirefox.com/?q=user/register&r=6584

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


Re: [PHP] redirecting to a success page

2004-11-22 Thread Richard Davey
Hello Judson,

Monday, November 22, 2004, 2:13:13 PM, you wrote:

JV> The original script, created by Dreamweaver, gives an error that says
JV> header has already been sent. I tried different options to no avail. I
JV> realize this script is now seriously hosed but thought I would include
JV> it anyway since others may be using Dreamweaver.

Two options: Either use output buffering, or search for the extra
whitespace in the file - it could be before (or after) closing PHP
tags, or if you have any kind of HTML in the same script that would
cause it - basically anywhere you break out of PHP and into HTML
again.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I am not young enough to know everything." - Oscar Wilde

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



RE: [PHP] Timezones

2004-11-22 Thread Gryffyn, Trevor
Then somewhere there has to be a cross reference between name and
timezone info.  I'm sorry I'm not running Apache here and don't have
access to the same info that you're using, but I'd try digging into
those config files and any database tables you can find that seem to
relate to it.  I'm sorry I can't be more help, but it's gotta be in
there somewhere.

Maybe someone else can give you a better idea.

I'm re-posting this to PHP General in case someone has any addition
info.  Sorry for the long-winded response that didn't really help. Hah.
I didn't even consider the whole alphabetical thing, I should have
noticed.

Good luck!

-TG

> -Original Message-
> From: Venelin Arnaudov [mailto:[EMAIL PROTECTED] 
> Sent: Monday, November 22, 2004 11:24 AM
> To: Gryffyn, Trevor
> Subject: Re: [PHP] Timezones
> 
> 
> Hi Trevor,
> 
> I am using Eclipse with a PHP plugin to modify my PHP system. 
> Actually 
> this system is based on the Source Forge but the guy that 
> made all the 
> modifications is not available any more and I am trying to 
> understand it 
> and perform some changes.
> 
> The user.timezones field is modified by the user himself by selecting 
> the appropriate TZ from the list attached in my previous mail. I am 
> looking for a PHP function or script that would give me the offset of 
> each TZ in respect of GMT. As input parameter it should have 
> the string 
> TZ_name and as result the time (in hours, minutes or seconds).
> 
> Using Excel does not help because in the list I have 466 
> entries for 24 
> whole hours and some half hours. I cannot apply any logic to 
> this list 
> because it is sorted alphabetically. But my Apache/PHP knows 
> perfectly 
> what is the time offset between the server and the user. And this is 
> based only on the TZ info stored in my apache config file and 
> the user 
> table.
> 
> Kindest regards,
> Venelin
> 
> Gryffyn, Trevor wrote:
> 
> >I did a quick search for some of the timezone names and 
> didn't quickly
> >find a list that included the GMT offset (also called the UTC offset
> >sometimes.. I think GMT and UTC are the same).
> >
> >BUT..  In general the timezones go hour by hour so if you 
> used something
> >Excel (or some spreadsheet), created a list of your 
> timezones, found the
> >offset of the first one, then did a +1 on the next one...  
> On down the
> >list.  That'd get you close to what you wanted.  Then find a 
> decent list
> >of offsets and insert rows where you have stuff like Indiana 
> or places
> >that have a 1/2 hour offset.
> >
> >
> >After that, I'd copy/paste the list into a good PHP editor that has
> >macro functions (I use Crimson Editor  
> http://www.crimsoneditor.com) and
> >record a macro to format the lines in such a way that ends 
> up building a
> >new array in PHP.
> >
> >If you've never done this, it's easy.
> >
> >Say you start with some lines like this:
> >
> >$TZs[]='US/Alaska';
> >$TZs[]='US/Aleutian';
> >$TZs[]='US/Arizona';
> >
> >
> >You'd record a macro in Crimson Editor that does this:
> >
> >(1)
> >$TZs[]='US/Alaska';
> >
> >(2)
> > before the US
> >and hit DELETE>
> >US/Alaska';
> >
> >(3)
> >
> >US/Alaska
> >
> >
> >You now have just your timezone...   You may have a list like this
> >already though.
> >
> >(4)
> > >line>$TZs[]='US/Aleutian';
> >
> >End macro recording.  Now all you have to do is hold down (in Crimson
> >Editor) the ALT-Macro# key (I reuse ALT-1 constantly) until 
> it finishes
> >doing these actions to all lines.
> >
> >
> >(5) Copy and paste this list into Excel or something
> >
> >
> >Now after you get your numbers in Excel and you've adjusted 
> for the odd
> >timezones.  You'd do another macro like this:
> >
> >US/Alaska+1
> >US/Aleutian  +2
> >US/Arizona   +3
> >
> >(when you paste from Excel into Crimson Editor, you should have TABs
> >between the names and TZ #'s... Note, the TZ offsets listed 
> above aren't
> >accurate, just using numbers as examples.  There's no way Alaska is 1
> >hour ahead of GMT)
> >
> >(1)
> >US/Alaska+1
> >
> >(2)
> >Enter something like:
> >$tz["
> >
> >So you end up with:
> >
> >$tz["US/Alaska   +1
> >
> >(2)
> > cursor back
> >X # of characters or even tab back.  +1 and +3.5 are too different
> >tab-wise.. So maybe we'd do a FIND for "+" and hit DELETE to 
> remove the
> >+.
> >
> >(3)
> >After you do the FIND and DELETE, your cursor should be just 
> to the left
> >of the number.  Hit BACKSPACE to remove the tab, now you're in a good
> >position to continue your array building:
> >
> >$tz["US/Alaska1
> >
> >(4) Enter some middle line stuff:
> >
> >$tz["US/Alaska"] = 1
> >
> >(5)
> >Now finish the line.  Hit END to take you to the end of the 
> line, enter
> >a semicolon, then cursor down and HOME to take you to the 
> beginning of
> >the next line so you can do it all over again.
> >
> >$tz["US/Alaska"] = 1;
> >US/Aleutian  +2
> >US/Arizona   +3
> >
> >
> >Again, hold down ALT-Macro# to repeat this for all lines.
> >
> >I know that's

Re[2]: [PHP] redirecting to a success page

2004-11-22 Thread Richard Davey
Hello Randy,

Monday, November 22, 2004, 2:22:31 PM, you wrote:

RR> You can send a header to redirect like below.

I think he already had that (although it wasn't in the source code
posted) because he said the error was the "headers already sent" one.

Dreamweaver has a lot to answer for :)

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I am not young enough to know everything." - Oscar Wilde

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



Re: [PHP] perl to php translation tool?

2004-11-22 Thread Raditha Dissanayake
Greg Donald wrote:
On Mon, 22 Nov 2004 13:37:42 +0100, Markus Mayer <[EMAIL PROTECTED]> wrote:
 

I've searched for a tool that would translate, or at least mostly translate,
perl scripts into php, unfortunately with no success.  I didn't even find a
reference in the archives of this list to this subject, which surprises me.
Does anyone know of any tool that can handle this type of thing?
   

You may find this reference page useful:
http://www.cs.wcupa.edu/~rkline/perl2php/
 

you almost made a fool out of quite a few of us. thank god it's only a 
tutorial and not an automated tool :-)


--
Raditha Dissanayake.
--
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/  | Drag and Drop Upload 

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


Re: [PHP] Where to learn about these topics

2004-11-22 Thread Chris Lott
> In MySQL I would say... If you have data which has to be inserted in
> serveral tables, you must first check if all conditions are ok. So, do some
> selects to check if everythin in your database is ok, and after that,
> execute the query. But, when you really want to make complex database driven
> applications, choose PostgreSQL! This database is better build for
> complexity (and not only that ;) ), and supports transactions and
> references, and more stuff like that which can be really helpful to you...
> And when you compare MySQL against PostgreSQL... PostgreSQL is a heavy
> system compared with MySQL, also free, but when you look at the
> functionality: SUPERIOR 

But even with Postgresql I have the same situation. Let's say a user
wants to enter a new contact into the database. This contact lives in
a new city and has a new kind of relationship. To make that city and
relationship available, I need them in the related tables. Or I need
my form action to check for each one, insert if they are not there,
and then finally insert the new record. This last seems preferable
(one form), but no books seem to deal with the real world, only the
simplest, single-table cases...


>  $query = " SELECT * FROM table1, table2 WHERE table1.id = table2.id AND
> table1.value = 'value' OR table2.value = '' ORDER BY table1.name ";
>  
>  is less readable than:
>  
>  $query = " SELECT * FROM table1, table2
>   WHERE table1.id = table2.id
>  AND table1.value = 'value'
>  OR table.value = ''
>   ORDER BY table1.name   ";

Right-- but my question isn't about the query, but about the results.
Again, look at my result set:

+-+--+--+---+---+
| first   | last | relation | city  | state |
+-+--+--+---+---+
| Chris   | Beks | business | Fairbanks | AK|
| Robert  | Hannon   | friend   | Fairbanks | AK|
| Cindy   | Lott | family   | Fresno| CA|
| Derryl  | Hartz| business | Seattle   | WA|
| Kirsten | O'Malley | friend   | Seattle   | WA|
+-+--+--+---+---+

I want an output routine that does this:

CITY
  person
  person

CITY
  person

CITY 
  person

There has to be a more elegant way than making a new query for each
city-- which is what the query I mentioned above fixes... but is the
kind of code I have put, with its ugly indexes and counters really the
best way? This is another area where books always stop at the simplest
cases...

$currentcity = '';
$counter = 1;

while ($thisrow = mysql_fetch_array($result))
   {
   if ($currentcity <> $thisrow['city'])
   {
   if ($counter > 1)
   {
   echo '';
   }
   echo '' . $thisrow['city'] . '';
   echo '';
   $currentcity = $thisrow['city'];
   }
   echo $thisrow['first'] . ' ' . $thisrow['last'] . '';
   $counter++;
   }

c

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



Re: [PHP] Where to learn about these topics

2004-11-22 Thread John Nichel
Chris Lott wrote:
Right-- but my question isn't about the query, but about the results.
Again, look at my result set:
+-+--+--+---+---+
| first   | last | relation | city  | state |
+-+--+--+---+---+
| Chris   | Beks | business | Fairbanks | AK|
| Robert  | Hannon   | friend   | Fairbanks | AK|
| Cindy   | Lott | family   | Fresno| CA|
| Derryl  | Hartz| business | Seattle   | WA|
| Kirsten | O'Malley | friend   | Seattle   | WA|
+-+--+--+---+---+
I want an output routine that does this:
CITY
  person
  person
CITY
  person
CITY 
  person

There has to be a more elegant way than making a new query for each
city-- which is what the query I mentioned above fixes... but is the
kind of code I have put, with its ugly indexes and counters really the
best way? This is another area where books always stop at the simplest
cases...
Look at the MySQL documentation for 'DISTINCT' and 'GROUP BY'
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Where to learn about these topics

2004-11-22 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 22 November 2004 17:33, Chris Lott wrote:

> 
> +-+--+--+---+---+
> > first   | last | relation | city  | state |
> +-+--+--+---+---+
> > Chris   | Beks | business | Fairbanks | AK|
> > Robert  | Hannon   | friend   | Fairbanks | AK|
> > Cindy   | Lott | family   | Fresno| CA|
> > Derryl  | Hartz| business | Seattle   | WA|
> > Kirsten | O'Malley | friend   | Seattle   | WA|
> +-+--+--+---+---+
> 
> I want an output routine that does this:
> 
> CITY
>   person
>   person
> 
> CITY
>   person
> 
> CITY
>   person
> 
> There has to be a more elegant way than making a new query for each
> city-- which is what the query I mentioned above fixes... but is the
> kind of code I have put, with its ugly indexes and counters really the
> best way? This is another area where books always stop at the
> simplest cases... 
> 
> $currentcity = '';
> $counter = 1;
> 
> while ($thisrow = mysql_fetch_array($result))
>{
>if ($currentcity <> $thisrow['city'])
>{
>if ($counter > 1)
>{
>echo '';
>}
>echo '' . $thisrow['city'] . '';
>echo '';
>$currentcity = $thisrow['city'];
>}
>echo $thisrow['first'] . ' ' . $thisrow['last'] . '';   
>$counter++; }

Yep, that's about the size of it.  Looks a lot like many of my output
routines.  I'd start $counter at 0, though, so you can use just if($counter)
as your test; and I'll often tend to use a for loop rather than a while just
to group everything related to loop control in one place:

for ($currentcity='', $counter=0; $thisrow = mysql_fetch_array($result);
 $counter++)

Or you can do the increment as part of the test:

if ($counter++) echo '';

It's pretty much down to personal taste whether you use any of these
refinements, but your basic logic is spot on.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



Re: [PHP] Timezones

2004-11-22 Thread Robin Vickery
On Mon, 22 Nov 2004 11:52:03 -0500, Gryffyn, Trevor
<[EMAIL PROTECTED]> wrote:
> Then somewhere there has to be a cross reference between name and
> timezone info.  I'm sorry I'm not running Apache here and don't have
> access to the same info that you're using, but I'd try digging into
> those config files and any database tables you can find that seem to
> relate to it.  I'm sorry I can't be more help, but it's gotta be in
> there somewhere.

Apache and PHP should be able to use your zoneinfo file, which
contains the mappings for all these timezones.

You can obtain the offset of the current timezone, using
strftime('%z'). You'll get a return value like '+' (for GMT) or
'+0200' (for EET) and '-0200' (for EST) etc.

   http://www.php.net/strftime

You can change the current timezone by setting the 'TZ' environment
variable with something like putenv("TZ=EST").

   http://www.php.net/putenv

You can find out the current setting of the 'TZ' environment variable
with getenv('TZ').

   http://www.php.net/getenv

Putting that lot together, it's not hard to write a small function
that given a timezone will return an offset from UTC (aka GMT).



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



[PHP] $_POST['xxx'] = "blabla" ?

2004-11-22 Thread Perry Jönsson
Hello,
What is the difference between these two examples?
Both works fine for me.

1. if ($_POST['submit'] == 'Login') {
...
...
}
2. if (isset($_POST['submit']) {
...
...
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] $_POST['xxx'] = "blabla" ?

2004-11-22 Thread Afan Pasalic
in case $_POST['submit'] == 'Yes' only 2nd example works. Right?
-a|fan
Perry Jönsson wrote:
Hello,
What is the difference between these two examples?
Both works fine for me.

1. if ($_POST['submit'] == 'Login') {
...
...
}
2. if (isset($_POST['submit']) {
...
...
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] $_POST['xxx'] = "blabla" ?

2004-11-22 Thread Jay Blanchard
[snip]
What is the difference between these two examples?
Both works fine for me.



1. if ($_POST['submit'] == 'Login') {
...
...
}

2. if (isset($_POST['submit']) {
...
...
}
[/snip]

One is checking if $_POST contains a specific value, the other just checks to 
see if it contains a value. If $_POST['submit'] contains 'foo' is ISSET. Make 
sense?

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



Re: [PHP] $_POST['xxx'] = "blabla" ?

2004-11-22 Thread ankur_os
Dear u r correct,

Both r same...

but in first case ur variable with a constant string value

And in second case u r checking that your variable is set or not
but one limitation with the function is that..
"isset() only works with variables as passing anything else will result in a
parse error."

But second cace is more effective and it takes less time when u go 4 large
comparisions

Thnx...

Ankur
PHP Developer
INDIA



Quoting Perry Jönsson <[EMAIL PROTECTED]>:

> Hello,
> 
> What is the difference between these two examples?
> Both works fine for me.
> 
> 
> 
> 1. if ($_POST['submit'] == 'Login') {
>   ...
>   ...
> }
> 
> 2. if (isset($_POST['submit']) {
>   ...
>   ...
> }
> 
> -- 
> 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] $_POST['xxx'] = "blabla" ?

2004-11-22 Thread Greg Donald
On Mon, 22 Nov 2004 21:38:00 +0100, Perry Jönsson <[EMAIL PROTECTED]> wrote:
> What is the difference between these two examples?

> diff 1.txt 2.txt
1c1
< 1. if ($_POST['submit'] == 'Login') {
---
> 2. if (isset($_POST['submit']) {


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] $_POST['xxx'] = "blabla" ?

2004-11-22 Thread Gerhard Meier
On Mon, Nov 22, 2004 at 09:38:00PM +0100, Perry Jönsson wrote:
> 1. if ($_POST['submit'] == 'Login') { ... }

This one is true if $_POST['submit'] is equal to 'Login'.

> 2. if (isset($_POST['submit']) { ... }

This one is true if $_POST['submit'] is set, it doesn't matter
which value it has.

/GM

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



Re: [PHP] $_POST['xxx'] = "blabla" ?

2004-11-22 Thread Perry Jönsson
Gerhard Meier wrote:
On Mon, Nov 22, 2004 at 09:38:00PM +0100, Perry Jönsson wrote:
1. if ($_POST['submit'] == 'Login') { ... }

This one is true if $_POST['submit'] is equal to 'Login'.

2. if (isset($_POST['submit']) { ... }

This one is true if $_POST['submit'] is set, it doesn't matter
which value it has.
/GM

If you only have one form on a page, why would you like to check the 
value/name of the submit button?

Is there a security aspect to this?
/PJ
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] $_POST['xxx'] = "blabla" ?

2004-11-22 Thread Perry Jönsson
Jay Blanchard wrote:
[snip]
What is the difference between these two examples?
Both works fine for me.

1. if ($_POST['submit'] == 'Login') {
...
...
}
2. if (isset($_POST['submit']) {
...
...
}
[/snip]
One is checking if $_POST contains a specific value, the other just checks to see if it contains a value. If $_POST['submit'] contains 'foo' is ISSET. Make sense?

Maybe a daft question but why would you like to check for a specific value?
Can you give an example when this is a good thing to do?
/PJ
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] $_POST['xxx'] = "blabla" ?

2004-11-22 Thread Vail, Warren
Because you can have more than one submit button per form?

Warren Vail

> -Original Message-
> From: Perry Jönsson [mailto:[EMAIL PROTECTED] 
> Sent: Monday, November 22, 2004 12:56 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] $_POST['xxx'] = "blabla" ?
> 
> 
> Gerhard Meier wrote:
> > On Mon, Nov 22, 2004 at 09:38:00PM +0100, Perry Jönsson wrote:
> > 
> >>1. if ($_POST['submit'] == 'Login') { ... }
> > 
> > 
> > This one is true if $_POST['submit'] is equal to 'Login'.
> > 
> > 
> >>2. if (isset($_POST['submit']) { ... }
> > 
> > 
> > This one is true if $_POST['submit'] is set, it doesn't 
> matter which 
> > value it has.
> > 
> > /GM
> 
> 
> If you only have one form on a page, why would you like to check the 
> value/name of the submit button?
> 
> Is there a security aspect to this?
> 
> /PJ
> 
> -- 
> 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] $_POST['xxx'] = "blabla" ?

2004-11-22 Thread Jay Blanchard
[snip]
> One is checking if $_POST contains a specific value, the other just checks to 
> see if it contains a value. If $_POST['submit'] contains 'foo' is ISSET. Make 
> sense?

Maybe a daft question but why would you like to check for a specific value?

Can you give an example when this is a good thing to do?
[/snip]

Let's say that I have several buttons on a page...I can check the value of the 
one that was clicked (provided they all have a different name or value) and 
process a case statement based on that value. Or, if I need a field to be a 
specific value I can check it.

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



Re: [PHP] $_POST['xxx'] = "blabla" ?

2004-11-22 Thread Robin Vickery
On Mon, 22 Nov 2004 21:57:23 +0100, Perry Jönsson <[EMAIL PROTECTED]> wrote:
>
> Maybe a daft question but why would you like to check for a specific value?
>
> Can you give an example when this is a good thing to do?

A forum. You have two submit buttons, one labeled 'draft' and one
labeled 'final'.

If the user uses the draft button, the forum displays a preview of the
user's post for them to edit. If they use the 'final' button, then
their post gets put straight into the forum, typos and all.


 
 
 




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



Re: [PHP] $_POST['xxx'] = "blabla" ?

2004-11-22 Thread Gerhard Meier
On Mon, Nov 22, 2004 at 09:55:35PM +0100, Perry Jönsson wrote:
> Gerhard Meier wrote:
> If you only have one form on a page, why would you like to check the 
> value/name of the submit button?
> 
> Is there a security aspect to this?

That was not your question. You asked what the difference is.
And no, I see no security issue there, but that means nothing ;)

/GM

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



[PHP] Quick Question re: Input

2004-11-22 Thread Monique Verrier
Hi!

This is what I want to do:

When the user presses the submit button, run a function along the lines of:



The addrecord function basically runs an SQL insert.  This seems as though
it should be uncomplicated.   All the code that I look at has the page
calling itself again and running code that wasn't used the first time based
on some switch.  Does anyone know if there is some other kind of solution?
This seems so messy to me.  I would prefer to keep the function in the page.

I am learning php, so please be kind!

Thanks for any and all advice!

Monique.

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



RE: [PHP] Quick Question re: Input

2004-11-22 Thread Jay Blanchard
[snip]

[/snip]

Unfortunately you cannot do it like this, you either have to reload the
page or send the processing to another namespace. But you can do
different buttons...





In processStuff.php



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



Re: Re[2]: [PHP] include files, ".php" or ".inc" ?

2004-11-22 Thread Chris Shiflett
--- Richard Davey <[EMAIL PROTECTED]> wrote:
> MK> Yes, .inc files will show up as they are - php source, db
> MK> username/password etc. So it's even less secure unless you
> forbid serving them:
> 
> That would be the "properly configured web server" section of
> my post, assuming this has been done they are definitely not
> less secure than placing those details in a .php.

Let's not muddy the waters, though. :-)

I have no opinion about whether .inc or .inc.php is a better convention
for modules stored within document root, because storing modules in
document root is a terrible idea. If you do this, whether by choice or due
to some factor you cannot control, you're going to have to accept that it
is a security risk, regardless of the name.

I know you both agree, but I want to make sure this point isn't lost. :-)

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming February 2005http://httphandbook.org/

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



[PHP] [php] What does PHP mean?

2004-11-22 Thread John Taylor-Johnston
I'm writing an article where I'm going to explain what PHP is in a short 
sentence.
PHP once meant Personal Home Page, right?

PHP, originally an anacronym for "Personal Home Page", is a textual, 
"general-purpose scripting language" (www.PHP.net) designed to collect and 
process data between HTML pages and the Internet.

Any objections? There was an article someplace about Rasmus Lerdorf calling it 
such, in the beginning. (http://www.php.net/manual/en/history.php)

(recursive acronym for "PHP: Hypertext Preprocessor")

»» This is the general group. It is a general question? :)

--
John Taylor-Johnston
-
"If it's not Open Source, it's Murphy's Law."

  °v°   Bibliography of Comparative Studies in Canadian, Québec and Foreign 
Literatures
 /(_)\  Université de Sherbrooke
  ^ ^   http://compcanlit.ca/ T: 819.569.2064

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



Re: [PHP] [php] What does PHP mean?

2004-11-22 Thread John Holmes
John Taylor-Johnston wrote:
I'm writing an article where I'm going to explain what PHP is in a short 
sentence.
PHP once meant Personal Home Page, right?
PHP, originally an anacronym for "Personal Home Page", is a textual, 
"general-purpose scripting language" (www.PHP.net) designed to collect and process data 
between HTML pages and the Internet.
Any objections? There was an article someplace about Rasmus Lerdorf calling it 
such, in the beginning. (http://www.php.net/manual/en/history.php)
(recursive acronym for "PHP: Hypertext Preprocessor")
PHP/FI stands for "Personal Home Page / Forms Interpreter" and PHP 
stands for "PHP: Hypertext Preprocessor"... all of which is explained on 
the page you linked to... :/

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Where to learn about these topics

2004-11-22 Thread Ryan King
On Nov 22, 2004, at 11:33 AM, Chris Lott wrote:
In MySQL I would say... If you have data which has to be inserted in
serveral tables, you must first check if all conditions are ok. So, 
do some
selects to check if everythin in your database is ok, and after that,
execute the query. But, when you really want to make complex database 
driven
applications, choose PostgreSQL! This database is better build for
complexity (and not only that ;) ), and supports transactions and
references, and more stuff like that which can be really helpful to 
you...
And when you compare MySQL against PostgreSQL... PostgreSQL is a heavy
system compared with MySQL, also free, but when you look at the
functionality: SUPERIOR
But even with Postgresql I have the same situation.
No, you don't.
Let's say a user
wants to enter a new contact into the database. This contact lives in
a new city and has a new kind of relationship. To make that city and
relationship available, I need them in the related tables. Or I need
my form action to check for each one, insert if they are not there,
and then finally insert the new record. This last seems preferable
(one form), but no books seem to deal with the real world, only the
simplest, single-table cases...

This is where stored procedures, triggers and update-able views become 
very handy.

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


[PHP] Re: default extension for includes?

2004-11-22 Thread Jed Smith
Justin French wrote:
I'd like to be able to call include("thing"); and have PHP automatically 
look for thing.html -- I know include_path can look in multiple places, 
but I have no idea if I can look for multiple file extensions, close 
matches, etc.

Doubt it, but I'm asking :)
Justin
No.
--
 _
(_)___Jed Smith, Code Ninja
| / __|   RFBs: [email for info]
| \__ \   +1 (541) 606-4145
   _/ |___/   [EMAIL PROTECTED] (Signed mail preferred: PGP 0x703F9124)
  |__/http://personal.jed.bz/keys/jedsmith.asc
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] default extension for includes?

2004-11-22 Thread Jake Press
Justin,
'Use the force luke'  -  or perhaps just write yourself a function to do 
this :)

Regards
Jake Press

Justin French wrote:
I'd like to be able to call include("thing"); and have PHP 
automatically look for thing.html -- I know include_path can look in 
multiple places, but I have no idea if I can look for multiple file 
extensions, close matches, etc.

Doubt it, but I'm asking :)
Justin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] default extension for includes?

2004-11-22 Thread Justin French
On 23/11/2004, at 12:44 PM, Jake Press wrote:
Justin,
'Use the force luke'  -  or perhaps just write yourself a function to 
do this :)
Sadly, included files inside functions don't inherit the global 
namespace, so you have to do something ridiculous like 
extract($GLOBALS) inside the function:

function includer($thing)
{
extract($GLOBALS);
include($thing.".inc");
}
The extract isn't too expensive, but it's definitely something I'd like 
to avoid if possible.

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


Re: [PHP] Upload is still not working ( More tesitngs)

2004-11-22 Thread Michael Leung
Hi Everyone,
  I found some people stated this kind of error , because phpSUExec
max allows 755.  But  I have changed my upload_files  directory into
owned by apache. it should solved the problem based on this logic. but
it won't work at all.

Does Any one have an idea on this

yours,
Michael Leung



> Michael Leung wrote:
> 
> >My Error Msg:
> >  I can read /tmp/phphRiKeP
> >Warning: fopen(upload_files/doodah) [function.fopen]: failed to open
> >stream: Permission denied in /var/www/html/simple_upload.php on line
> >18
> >
> >Warning: fopen(upload_files/Water lilies.jpg) [function.fopen]: failed
> >to open stream: Permission denied in /var/www/html/simple_upload.php
> >on line 22
> >upload_files is valid a directoryI am able to write to upload_files
> >
> >
> >This is very strange. upload_files is writeable, but can't write by
> >fopen('upload_files/doodah', 'w')
> >
> >

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



Re: [PHP] $_POST['xxx'] = "blabla" ?

2004-11-22 Thread Angelo Zanetti
I speak under correction but the reason could be that if someone tries to hack 
your site, for example I post to your HTML page, you want to check it your 
$_POST contains a certain variable (which may be hidden)

Not really sure besides that



>>> Perry Jönsson <[EMAIL PROTECTED]> 11/22/2004 10:57:23 PM >>>
Jay Blanchard wrote:
> [snip]
> What is the difference between these two examples?
> Both works fine for me.
> 
> 
> 
> 1. if ($_POST['submit'] == 'Login') {
>   ...
>   ...
> }
> 
> 2. if (isset($_POST['submit']) {
>   ...
>   ...
> }
> [/snip]
> 
> One is checking if $_POST contains a specific value, the other just checks to 
> see if it contains a value. If $_POST['submit'] contains 'foo' is ISSET. Make 
> sense?


Maybe a daft question but why would you like to check for a specific value?

Can you give an example when this is a good thing to do?

/PJ

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



Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Technikon or the sender
of this e-mail be liable to any party for any direct, indirect,
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



Re: [PHP] $_POST['xxx'] = "blabla" ?

2004-11-22 Thread Dennis Seavers
Use unset () to reset the variable values and $_POST to set the values.  As
long as there's no other, unacceptable access to your server, you'll be in
a good position, other security considerations aside.  If any other latent
$_POST values exist, what could they do?  And if they were to do anything,
could they not be reset easily?


> [Original Message]
> From: Angelo Zanetti <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Date: 11/23/2004 12:17:37 AM
> Subject: Re: [PHP] $_POST['xxx'] = "blabla" ?
>
> I speak under correction but the reason could be that if someone tries to
hack your site, for example I post to your HTML page, you want to check it
your $_POST contains a certain variable (which may be hidden)
>
> Not really sure besides that
>
>
>
> >>> Perry Jönsson <[EMAIL PROTECTED]> 11/22/2004 10:57:23 PM >>>
> Jay Blanchard wrote:
> > [snip]
> > What is the difference between these two examples?
> > Both works fine for me.
> > 
> > 
> > 
> > 1. if ($_POST['submit'] == 'Login') {
> > ...
> > ...
> > }
> > 
> > 2. if (isset($_POST['submit']) {
> > ...
> > ...
> > }
> > [/snip]
> > 
> > One is checking if $_POST contains a specific value, the other just
checks to see if it contains a value. If $_POST['submit'] contains 'foo' is
ISSET. Make sense?
>
>
> Maybe a daft question but why would you like to check for a specific
value?
>
> Can you give an example when this is a good thing to do?
>
> /PJ
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php 
>
>
> 
> Disclaimer 
> This e-mail transmission contains confidential information,
> which is the property of the sender.
> The information in this e-mail or attachments thereto is 
> intended for the attention and use only of the addressee. 
> Should you have received this e-mail in error, please delete 
> and destroy it and any attachments thereto immediately. 
> Under no circumstances will the Cape Technikon or the sender 
> of this e-mail be liable to any party for any direct, indirect, 
> special or other consequential damages for any use of this e-mail.
> For the detailed e-mail disclaimer please refer to 
> http://www.ctech.ac.za/polic or call +27 (0)21 460 3911
>
> -- 
> 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