Re: [PHP] good practice

2002-02-15 Thread Keith V. (Vance Consulting LLC)

On 15 Feb 2002 at 10:50, Michael Kimsal wrote:

 Erik Price wrote:
  
  On Thursday, February 14, 2002, at 04:40  PM, Michael Kimsal wrote:
  
  On that same topic, *why* do people name files with both .inc and 
  .php?  Your .inc file has PHP code in it, right?  Why not just call it 
  .php and
  spare the server reconfiguration.  If knowing which files are 
  include files (long time since I've made that distinction!) just 
  prepend
  them with inc_ or put them all in an includes/ directory.
  
  
  If you are including a file into another file with PHP's 'include()' 
  function, it doesn't matter what the extension is.  You don't even need 
  an extension.  Apache doesn't even see this as a separate file, it 
  thinks of it all as one big file with the name of whichever file is 
  doing the including.
  
  Giving the .inc suffix is a nice way to keep your code organized.  Also, 
  I keep my .incs in a separate directory.
  
  Not to mention I have a directive in my server's conf file that 
  specifically prevents it from serving any file with the extension '.inc'.
  
 
 
 That's great for you that you have that luxury, as do I, but not 
 everyone has access to their server's conf file.
 
Yeah, you may not be able to access the server's conf file but you can still put your 
include files outside the server's web space and name them whatever you want. 
Put something like this in your scripts if you can't modify the php.ini or access the 
server's conf directory.
ini_set(include_path, /path_to_your_include_directory);

Regardless of the extension you use, putting them outside the server's web 
accessible area is the best way to protect them. I just use .php and put them in 
subdirectories to differentiate what site they are for or what their specific purpose 
is.

 'Organizing' would be better served with the separate directory and/or
 a prepend, because most directory structures are sorted by name by default.
 
 I replied privately to someone on this already, but I'll post it here as 
 well.
 
 The majority of people learning PHP do so by examining other code, and a 
 great many do so in shared hosting environments where they can't control 
 the server config files.  Furthermore, because they are new they don't 
 understand the security implications of .inc or other extensions, and
 blindly copy code and run it without knowing they are exposed 
 security-wise.  That's my primary beef with .inc and other non- .php
 extensions.
 
 
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


K E I T H  V A N C E
Web Developer, IT Professional
http://www.vanceconsulting.net
[EMAIL PROTECTED]

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




RE: [PHP] Php is serversided????

2002-02-13 Thread Keith V. (Vance Consulting LLC)

Just remember that what the user sees is always just static html. If some decision 
needs to happen the user has to send some sort of request of the web server to do 
something, and that's where PHP does its thing. 

For client-side stuff, like Java Applets. There is actually code running on the user's 
machine that can do things on it's own. It can perform operations without having to 
send a request to the webserver, the web server does something, then sends a 
response back. 

The Internet is stateless and dumb. HTML isn't dynamic, but PHP can make 
decisions on what data (html) to send to the client based on certain variables. You 
can make dynamic web sites with PHP, but the user still gets plain old HTML in the 
end that doesn't know how to do anything (the browser reads it and displays the 
content). That's why HTML isn't a programming language.



On 13 Feb 2002 at 12:13, Lars Torben Wilson wrote:

 On Wed, 2002-02-13 at 11:56, Rick Emery wrote:
  The if-statements are based upon values read from session variables,
  cookies, values from databases, and values for the form that was just
  submitted.
  
  So, no, there are no if-statements executed on data the user has not
  submitted.
 
 Say what? They can be executed on information read from the filesystem,
 the Internet, the date or other system functions, from a random number
 generator, pulled out of a database, or whatever.
 
 When used on a web page, PHP uses whatever information it needs to
 put together some text to send to the user. This may or may not be
 in reaction to a user action (other, of course, than opening the page).
 
 As to Morten's original question, the sequence would go like this:
 
  1. User requests a page.
  2. The page is presented. It may or may not have been generated
 by PHP, but let's say it contains a form.
  3. The user fills out the form and submits it.
  4. The PHP script parses the form contents and generates an
 appropriate response page, which is sent back to the user.
  5. Go to 1.
 
 So, the user makes a selection which is sent to the server side, where
 PHP executes, and sends the data back to the client.
 
 
 Hope this helps,
 
 Torben
 
  -Original Message-
  From: Morten Nielsen [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, February 13, 2002 1:56 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Php is serversided
  
  
  Hi,
  I don't understand...
  Everybody says PHP is server based, so everything is calculated before the
  user sees it in his browser. But if that is the case how is it then possible
  to use if-statements. Wouldn't that mean that the if-statement has been
  executed before the user makes a selection?
  
  Please explain it to me,
  Morten
 
 -- 
  Torben Wilson [EMAIL PROTECTED]
  http://www.thebuttlesschaps.com
  http://www.hybrid17.com
  http://www.inflatableeye.com
  +1.604.709.0506
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


K E I T H  V A N C E
Web Developer, IT Professional
http://www.vanceconsulting.net
[EMAIL PROTECTED]

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




Re: [PHP] Re: mail headers

2002-02-13 Thread Keith V. (Vance Consulting LLC)

On 13 Feb 2002 at 17:33, Renato Salvatore Moya L. wrote:

 Hi, i'm writte from Chile. If you writte to little php-script for send mail, what 
send you mail ?.
 
 I question you, because i'm writte a tipical php-script  tell a friend, but i have 
problems with getenv(HTPP_REFERER), because send only my https fixed.
 
 Renato.
 
 Stalmannen ha escrito:
 
  Hej!
 
  I have a question. I send mail from a php-script with the mail()-function. However 
the smtp server I use has a wrong time set. Can I set the sent-time through the 
headers so I take my web-servers time? and how then?

I would say no. I suggest setting the time on the mail server, or having the 
administrator do it. I am pretty sure the mail server is going to want to set that 
itself.

  Thankfull for help.
 
  /Kalle
 
 


K E I T H  V A N C E
Web Developer, IT Professional
http://www.vanceconsulting.net
[EMAIL PROTECTED]

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




RE: [PHP] Re: mail headers

2002-02-13 Thread Keith V. (Vance Consulting LLC)

On 13 Feb 2002 at 14:40, Rick Emery wrote:

 Renato,
 
 To send mail, use PHP's mail() function:
 mail($recipient,$subject,$message,$headers);
 
 You can reference $HTTP_REFERER directly without saying getenv(HTTP_REFERER)

Yeah, and if your mail function is being called within a function, just say:
global $HTTP_REFERER;

Hope that helps.
 
 -Original Message-
 From: Renato Salvatore Moya L. [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, February 13, 2002 2:34 PM
 To: [EMAIL PROTECTED]; Stalmannen
 Subject: [PHP] Re: mail headers
 Importance: High
 
 
 Hi, i'm writte from Chile. If you writte to little php-script for send mail,
 what send you mail ?.
 
 I question you, because i'm writte a tipical php-script  tell a friend,
 but i have problems with getenv(HTPP_REFERER), because send only my https
 fixed.
 
 Renato.
 
 Stalmannen ha escrito:
 
  Hej!
 
  I have a question. I send mail from a php-script with the mail()-function.
 However the smtp server I use has a wrong time set. Can I set the sent-time
 through the headers so I take my web-servers time? and how then?
  Thankfull for help.
 
  /Kalle
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


K E I T H  V A N C E
Web Developer, IT Professional
http://www.vanceconsulting.net
[EMAIL PROTECTED]

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




Re: [PHP] PHP Work in New York

2002-02-12 Thread Keith V. (Vance Consulting LLC)

On 12 Feb 2002 at 20:28, Michael Sims wrote:

 At 06:27 PM 2/12/2002 -0500, J Smith wrote:
 Last week I looked at some VBScript/ASP code that I kind of need to port to
 PHP. I was mortified.
 
 It is truly appalling, isn't it? ;)  I have actually converted a large 
 portion of my companies website from VBScript to PHPthankfully most of 
 the stuff was fairly basic.  For the few pages that were more complex I 
 just looked at the end result and reverse engineered it rather than 
 trying to figure out what the heck the programmers before me were doing.
 
 One good thing about .NET and C#...it may be M$ and I may not want to use 
 it, but at least the code syntax makes sense to me...curly braces to 
 delimit code blocks, semicolons as line terminators, etc. etc.  I figure if 
 I'm forced to go M$ I'd much rather use C# that VBScript...

Yeah, but no matter what language you use there is always someone out there they 
can write crap code with it.

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


K E I T H  V A N C E
Web Developer, IT Professional
http://www.vanceconsulting.net
[EMAIL PROTECTED]

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




RE: [PHP] PHP Work in New York

2002-02-12 Thread Keith V. (Vance Consulting LLC)

On 13 Feb 2002 at 13:33, Jason Murray wrote:

  I figure if I'm forced to go M$ I'd much rather use C# that 
  VBScript...
 
 C# actually seems to be getting quite a lot of positive mentions
 in the *nix world at the moment.
 
Interesting, where are you seeing them? I am not being a jerk, I am serious do you 
have links, I am very interested in C# as is the rest of the programming world - I am 
just too lazy to go google and search for it.

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


K E I T H  V A N C E
Web Developer, IT Professional
http://www.vanceconsulting.net
[EMAIL PROTECTED]

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




RE: [PHP] PHP Work in New York

2002-02-12 Thread Keith V. (Vance Consulting LLC)

Well, yes there are a number of people, including myself, Sun, Aol and loads of 
others that are very interested in what is going to emerge as the king of distributed 
authentication and who will, if anyone, will be the king of providing web services 
that 
work. It's a very exciting and new area for the programming world and open source 
needs to make it's response. But that doesn't really mean that *nix folks are 
cheering for C#.

Everyone knows that the desktop market will continue to shrink from here on out 
and software manufacturers need to be able to provide high-quality secure online 
applications that work. .Net is a platform doing so with Passport as the 
authentication mechanism.

I wonder how PHP will fit into this whole distributed application framework, if it 
will. I 
have written a PHP authentication module, that could possibly be distrubuted, 
hmmm.

We are off topic, sorry. If anyone wants to respond to this, just email directly.

On 12 Feb 2002 at 23:41, Michael Sims wrote:

 At 08:46 PM 2/12/2002 -0800, Keith V. (Vance Consulting LLC) wrote:
 On 13 Feb 2002 at 13:33, Jason Murray wrote:
 
I figure if I'm forced to go M$ I'd much rather use C# that
VBScript...
  
   C# actually seems to be getting quite a lot of positive mentions
   in the *nix world at the moment.
  
 Interesting, where are you seeing them? I am not being a jerk, I am 
 serious do you
 have links, I am very interested in C# as is the rest of the programming 
 world - I am
 just too lazy to go google and search for it.
 
 Well, the projects that are underway to create a open source implementation 
 of the .NET platform as evidence that at least some people in the *nix 
 world have been quite taken with it...perhaps not C# in particular, but the 
 entire framework:
 
 http://www.dotgnu.org/
 
 http://www.ximian.com/devzone/projects/mono.html
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


K E I T H  V A N C E
Web Developer, IT Professional
http://www.vanceconsulting.net
[EMAIL PROTECTED]

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




Re: [PHP] Re: function? variable?

2002-02-11 Thread Keith V. (Vance Consulting LLC)

Can you be more specific? I am just guessing here but is this what you want:

? $title = home; ?
html
head
title
? echo $title; ?
/title
/head
body
? echo $title; ?
/body
/html

Perhaps, I am not getting what you are asking for.


On 11 Feb 2002 at 23:34, Jason Whitaker wrote:

 I just saw something with my code there.. i have my link tag inside the
 title tag.. i will have to fix that :)
 
 --
 
 Jason Whitaker
 
 
 Jason Whitaker [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 : Is there a way to set a variable or is there a function that takes the
 : information between the title tags and prints to the screen where you
 : command?
 :
 : ei:
 :
 : //head
 : //title
 : // ?php
 : // echo ?witakr home?
 : // ?
 : //
 : //LINK REL=stylesheet HREF=css/sCSS.css TYPE=text/css
 : ///title
 : ///head
 :
 : where as i would want the word home from the echo ?witakr home? (or
 : what ever word that may be in place of the word home) to print to say.. a
 : certain place in the body of the page?
 :
 :
 : Jason Whitaker
 :
 :
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


K E I T H  V A N C E
Web Developer, IT Professional
http://www.vanceconsulting.net
[EMAIL PROTECTED]

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




Re: [PHP] preserving variable values across pages.

2002-02-11 Thread Keith V. (Vance Consulting LLC)

You could do it a number of ways.
1. Use a hidden input field in your form,. input type=hidden name=some_var 
value=? echo $some_var; ?
2. Put $some_var in a session variable.
3. Pass the value of some_var in the url.

Each has it's advantages/disadvantages. Just remember that just because you say 
something is global doesn't mean it's global to every page, it's global on that page. 
global can be used as follows:

?
$var = 1;

function dude() {
global $var
print Dude that's a $var;
}
?

If I didn't specify global $var inside the function the function wouldn't be able to 
see the $var variable I defined outside the function and would have just printed 
Dude that's a  instead of Dude that's a 1

Hope that helps.

On 12 Feb 2002 at 17:22, Tehn Yit Chin wrote:

 Hi all,
 
 If I have the following code,
 
 ?php
   global $some_var
 FORM action=next_page.php method=post
   type=submit name=submit value=foobar
 /FORM
 ?
 
 
 When the user hits the submit button, the value in some_var disappears? Is
 there a way of perserving the value in $some_var.
 
 thanks in advance.
 
 cheers,
 Tehn Yit
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


K E I T H  V A N C E
Web Developer, IT Professional
http://www.vanceconsulting.net
[EMAIL PROTECTED]

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