RE: [PHP-WIN] Using the GET Method
IMO, writing programs that work without register_globals to be enabled, is a good thing. Throughout the book, the code examples will have been created with register_globals on. (The default setting for older PHP installations/versions) just keep in mind that variables are not auto created for you, so you must initialize them first. $author = $_GET['author']; if you change the form method to POST, then you will have to modify the code to reflect that too. Anyways, explicitly initialising your variables is a good habit to get into. Its more secure. -Original Message- From: Dash McElroy [mailto:[EMAIL PROTECTED]] Sent: Sunday, 12 January 2003 3:49 PM To: Wade Cc: [EMAIL PROTECTED] Subject: Re: [PHP-WIN] Using the GET Method Ah, You're the latest of the ones to get hit by the register_globals setting. There are two things to do: 1. Change your code to reference the METHOD referenced in the form page GET -> $_GET['varname'] POST -> $_POST['varname'] COOKIE -> $_COOKIE['varname'] SESSION -> $_SESSION['varname'] GPC (Get Post Cookie, in that order) -> $_REQUEST['varname'] See php.net/register_globals for this. 2. Change your php.ini settings from: register_globals = off to register_globals = on then restart your server. Now, I just have to ask myself why I don't have a canned message for this... -Dash Know thyself. If you need help, call the C.I.A. On Sat, 11 Jan 2003, Wade wrote: > 01112003 2132 CST > > Im working on learning PHP4 by reading Beginning PHP 4, Wrox Press. > Chapter 3, page 76. > Im working with a form field sending data via the GET method. > On the first page, you fill in a text field and hit send. > That data is sent via the URL. > I can see it in the URL, on the next page. > The page will not show the data in the variable spot. > > The Code: > > Page One > > > > > > > > > Page Two - text.php > > > Your favorite author is: > echo $author; > ?> > > > Now, I know PHP is case sensitive and I have been sure to check the > $variable in the code. I have worked through some other pages in this > book and I downloaded the documentation from the wrox website. Their > code is exactly as the book and my own. > > Im stumbed. Anybody read this book? Can anybody see something wrong? > > Wade > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-WIN] Using the GET Method
As PHP is normally installed, your pages should work, however, when I was getting started I had this same problem. I was working on the windows version, and while I had the windows browser plainly showing the two files, "double clicking" the first page produced the first page in a browser, just like I expected. Filling in the information and pressing submit produced the second page with the value in the URL, but no PHP substitution occurred. The problem was that I was invoking the files thru the browsers "file" method and not thru the apache server where PHP was implemented. Try using http://localhost/page1.php, and you will be using the browsers server links. See if that does it. Warren Vail [EMAIL PROTECTED] -Original Message- From: Wade [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 11, 2003 9:42 PM To: [EMAIL PROTECTED] Subject: [PHP-WIN] Using the GET Method 01112003 2132 CST Im working on learning PHP4 by reading Beginning PHP 4, Wrox Press. Chapter 3, page 76. Im working with a form field sending data via the GET method. On the first page, you fill in a text field and hit send. That data is sent via the URL. I can see it in the URL, on the next page. The page will not show the data in the variable spot. The Code: Page One Page Two - text.php Your favorite author is: Now, I know PHP is case sensitive and I have been sure to check the $variable in the code. I have worked through some other pages in this book and I downloaded the documentation from the wrox website. Their code is exactly as the book and my own. Im stumbed. Anybody read this book? Can anybody see something wrong? Wade -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-WIN] Using the GET Method
shouldn't it just be: echo($author); and not: echo $author; :: Bobo Wieland :: www.elstudion.com/bobo/ - Original Message - From: "Wade" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, January 12, 2003 6:42 AM Subject: [PHP-WIN] Using the GET Method > 01112003 2132 CST > > Im working on learning PHP4 by reading Beginning PHP 4, Wrox Press. > Chapter 3, page 76. > Im working with a form field sending data via the GET method. > On the first page, you fill in a text field and hit send. > That data is sent via the URL. > I can see it in the URL, on the next page. > The page will not show the data in the variable spot. > > The Code: > > Page One > > > > > > > > > Page Two - text.php > > > Your favorite author is: > echo $author; > ?> > > > Now, I know PHP is case sensitive and I have been sure to check the > $variable in the code. I have worked through some other pages in this > book and I downloaded the documentation from the wrox website. Their > code is exactly as the book and my own. > > Im stumbed. Anybody read this book? Can anybody see something wrong? > > Wade > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-WIN] initialize variables (was: Using the GET Method)
Please, explain this to me, because I couldn't figure it out by myself... If register_globals is set to 'off', and because it's good practice, you should allways initzialize your variables? So I should write: $test = $_POST['test']; and then I can use $test as usuall... But what about local variables then? Variables that shouldn't be past from one page to another? And is $_POST[] short for $HTTP_POST_VARS[] or is it something else? And should you use $_SESSION[] and not session_register()?!? Sorry for these simple questions, but I would like to do things right... My knowledge comes basicly just from 'Beginning PHP4 (WROX)' and it seems that the book doesn't dig so deep into this matter... Thanks! .bobo :: www.elstudion.com/bobo - Original Message - From: "Sean Malloy" <[EMAIL PROTECTED]> To: "Wade" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Sunday, January 12, 2003 9:59 AM Subject: RE: [PHP-WIN] Using the GET Method > IMO, writing programs that work without register_globals to be enabled, is a > good thing. > > Throughout the book, the code examples will have been created with > register_globals on. (The default setting for older PHP > installations/versions) > > just keep in mind that variables are not auto created for you, so you must > initialize them first. > > $author = $_GET['author']; > > if you change the form method to POST, then you will have to modify the code > to reflect that too. > > Anyways, explicitly initialising your variables is a good habit to get into. > Its more secure. > > -Original Message- > From: Dash McElroy [mailto:[EMAIL PROTECTED]] > Sent: Sunday, 12 January 2003 3:49 PM > To: Wade > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP-WIN] Using the GET Method > > > Ah, You're the latest of the ones to get hit by the register_globals > setting. There are two things to do: > > 1. Change your code to reference the METHOD referenced in the form page > GET -> $_GET['varname'] > POST -> $_POST['varname'] > COOKIE -> $_COOKIE['varname'] > SESSION -> $_SESSION['varname'] > GPC (Get Post Cookie, in that order) -> $_REQUEST['varname'] > > See php.net/register_globals for this. > > 2. Change your php.ini settings from: > register_globals = off > to > register_globals = on > > then restart your server. > > Now, I just have to ask myself why I don't have a canned message for > this... > > -Dash > > Know thyself. If you need help, call the C.I.A. > > On Sat, 11 Jan 2003, Wade wrote: > > > 01112003 2132 CST > > > > Im working on learning PHP4 by reading Beginning PHP 4, Wrox Press. > > Chapter 3, page 76. > > Im working with a form field sending data via the GET method. > > On the first page, you fill in a text field and hit send. > > That data is sent via the URL. > > I can see it in the URL, on the next page. > > The page will not show the data in the variable spot. > > > > The Code: > > > > Page One > > > > > > > > > > > > > > > > > > Page Two - text.php > > > > > > Your favorite author is: > > > echo $author; > > ?> > > > > > > Now, I know PHP is case sensitive and I have been sure to check the > > $variable in the code. I have worked through some other pages in this > > book and I downloaded the documentation from the wrox website. Their > > code is exactly as the book and my own. > > > > Im stumbed. Anybody read this book? Can anybody see something wrong? > > > > Wade > > > > > > -- > > PHP Windows Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-WIN] Which Web server to run under XP
At 23:03 10/01/2003 -0400, you wrote: I use Win XP with Service Pack 1 and I have not had problem with my PC, in fact it has better performance on my machine. But if you don't want to upgrade use Xitami I guess you were luck, it certainly screwed up my machine. -Original Message- From: Ben Edwards [mailto:[EMAIL PROTECTED]] Sent: Friday, January 10, 2003 10:11 PM To: [EMAIL PROTECTED] Subject: [PHP-WIN] Which Web server to run under XP I am using XP and have been trying to work out which web server to use with PHP & MySQL. First I tries IIS and it said I have an OCX missing. Then I looked at Apache and it said I need Service Pack 1, which if I install slows the whole machine down. This is a know issue, Microsoft excuse is that it is something to do with securety. Are there any other web servers I could use or are there work rounds for the above. Regards, Ben * Ben Edwards +44 (0)117 968 2602 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * * Ben Edwards +44 (0)117 968 2602 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-WIN] initialize variables (was: Using the GET Method)
- Original Message - From: "Bobo Wieland" <[EMAIL PROTECTED]> To: "Sean Malloy" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Sunday, January 12, 2003 2:59 PM Subject: [PHP-WIN] initialize variables (was: Using the GET Method) > Please, explain this to me, because I couldn't figure it out by myself... > > If register_globals is set to 'off', and because it's good practice, you It makes it harder for someone to 'hack' your webpage. > should allways initzialize your variables? > So I should write: > > $test = $_POST['test']; and then I can use $test as usuall... You don't have to. You can either do that and then use test, or you can just use $_POST['test'] instead. It does not matter which way. > But what about local variables then? Variables that shouldn't be past from one page to > another? They won't be parsed... If you don't send it via a session/cookie/form/etc, it won't be on the next page > And is $_POST[] short for $HTTP_POST_VARS[] or is it something else? $HTTP_POST_VARS[] is the older version of $_POST. It will most likely not be in any more versions of php, hence why you must use $_POST > And should you use $_SESSION[] and not session_register()?!? $_SESSION[] only holds the values of the session variables. If you register a value using session_register(), it will then be stored in $_SESSION[] . Complicated bit: Basically, $_POST/$_GET/etc are just 'arrays'. They are used to store all the values passed on in a page in a few big stores. It is also much harder to manually input values into those arrays. e.g. $_POST["test"] can ONLY have come from a post method, e.g. from a form submited to your page. $test however can come from the url ( http://host/page.php?test=thisvalue), or from a form, or any other input method. It all comes down to security in the end. If you have any further questions, do not hesitate to send it in. The only stupid question is one which you do not ask! Stephen > > Sorry for these simple questions, but I would like to do things right... My > knowledge comes basicly just from 'Beginning PHP4 (WROX)' and it seems that > the book doesn't dig so deep into this matter... > > Thanks! > > > .bobo :: www.elstudion.com/bobo > - Original Message - > From: "Sean Malloy" <[EMAIL PROTECTED]> > To: "Wade" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Sunday, January 12, 2003 9:59 AM > Subject: RE: [PHP-WIN] Using the GET Method > > > > IMO, writing programs that work without register_globals to be enabled, is > a > > good thing. > > > > Throughout the book, the code examples will have been created with > > register_globals on. (The default setting for older PHP > > installations/versions) > > > > just keep in mind that variables are not auto created for you, so you must > > initialize them first. > > > > $author = $_GET['author']; > > > > if you change the form method to POST, then you will have to modify the > code > > to reflect that too. > > > > Anyways, explicitly initialising your variables is a good habit to get > into. > > Its more secure. > > > > -Original Message- > > From: Dash McElroy [mailto:[EMAIL PROTECTED]] > > Sent: Sunday, 12 January 2003 3:49 PM > > To: Wade > > Cc: [EMAIL PROTECTED] > > Subject: Re: [PHP-WIN] Using the GET Method > > > > > > Ah, You're the latest of the ones to get hit by the register_globals > > setting. There are two things to do: > > > > 1. Change your code to reference the METHOD referenced in the form page > > GET -> $_GET['varname'] > > POST -> $_POST['varname'] > > COOKIE -> $_COOKIE['varname'] > > SESSION -> $_SESSION['varname'] > > GPC (Get Post Cookie, in that order) -> $_REQUEST['varname'] > > > > See php.net/register_globals for this. > > > > 2. Change your php.ini settings from: > > register_globals = off > > to > > register_globals = on > > > > then restart your server. > > > > Now, I just have to ask myself why I don't have a canned message for > > this... > > > > -Dash > > > > Know thyself. If you need help, call the C.I.A. > > > > On Sat, 11 Jan 2003, Wade wrote: > > > > > 01112003 2132 CST > > > > > > Im working on learning PHP4 by reading Beginning PHP 4, Wrox Press. > > > Chapter 3, page 76. > > > Im working with a form field sending data via the GET method. > > > On the first page, you fill in a text field and hit send. > > > That data is sent via the URL. > > > I can see it in the URL, on the next page. > > > The page will not show the data in the variable spot. > > > > > > The Code: > > > > > > Page One > > > > > > > > > > > > > > > > > > > > > > > > > > > Page Two - text.php > > > > > > > > > Your favorite author is: > > > > > echo $author; > > > ?> > > > > > > > > > Now, I know PHP is case sensitive and I have been sure to check the > > > $variable in the code. I have worked through some other pages in this > > > book and I downloaded the documentation from the wrox website. Their > > > code is exactly as the book and my own. > > > > > > Im stumbed. Anybody read this bo
php-windows Digest 12 Jan 2003 15:15:01 -0000 Issue 1531
php-windows Digest 12 Jan 2003 15:15:01 - Issue 1531 Topics (messages 17782 through 17789): Using the GET Method 17782 by: Wade 17783 by: Dash McElroy 17784 by: Sean Malloy 17785 by: Warren Vail 17786 by: Bobo Wieland initialize variables (was: Using the GET Method) 17787 by: Bobo Wieland 17789 by: Stephen Edmonds Re: Which Web server to run under XP 17788 by: Ben Edwards 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 --- 01112003 2132 CST Im working on learning PHP4 by reading Beginning PHP 4, Wrox Press. Chapter 3, page 76. Im working with a form field sending data via the GET method. On the first page, you fill in a text field and hit send. That data is sent via the URL. I can see it in the URL, on the next page. The page will not show the data in the variable spot. The Code: Page One Page Two - text.php Your favorite author is: echo $author; ?> Now, I know PHP is case sensitive and I have been sure to check the $variable in the code. I have worked through some other pages in this book and I downloaded the documentation from the wrox website. Their code is exactly as the book and my own. Im stumbed. Anybody read this book? Can anybody see something wrong? Wade --- End Message --- --- Begin Message --- Ah, You're the latest of the ones to get hit by the register_globals setting. There are two things to do: 1. Change your code to reference the METHOD referenced in the form page GET -> $_GET['varname'] POST -> $_POST['varname'] COOKIE -> $_COOKIE['varname'] SESSION -> $_SESSION['varname'] GPC (Get Post Cookie, in that order) -> $_REQUEST['varname'] See php.net/register_globals for this. 2. Change your php.ini settings from: register_globals = off to register_globals = on then restart your server. Now, I just have to ask myself why I don't have a canned message for this... -Dash Know thyself. If you need help, call the C.I.A. On Sat, 11 Jan 2003, Wade wrote: > 01112003 2132 CST > > Im working on learning PHP4 by reading Beginning PHP 4, Wrox Press. > Chapter 3, page 76. > Im working with a form field sending data via the GET method. > On the first page, you fill in a text field and hit send. > That data is sent via the URL. > I can see it in the URL, on the next page. > The page will not show the data in the variable spot. > > The Code: > > Page One > > > > > > > > > Page Two - text.php > > > Your favorite author is: > echo $author; > ?> > > > Now, I know PHP is case sensitive and I have been sure to check the > $variable in the code. I have worked through some other pages in this > book and I downloaded the documentation from the wrox website. Their > code is exactly as the book and my own. > > Im stumbed. Anybody read this book? Can anybody see something wrong? > > Wade > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > --- End Message --- --- Begin Message --- IMO, writing programs that work without register_globals to be enabled, is a good thing. Throughout the book, the code examples will have been created with register_globals on. (The default setting for older PHP installations/versions) just keep in mind that variables are not auto created for you, so you must initialize them first. $author = $_GET['author']; if you change the form method to POST, then you will have to modify the code to reflect that too. Anyways, explicitly initialising your variables is a good habit to get into. Its more secure. -Original Message- From: Dash McElroy [mailto:[EMAIL PROTECTED]] Sent: Sunday, 12 January 2003 3:49 PM To: Wade Cc: [EMAIL PROTECTED] Subject: Re: [PHP-WIN] Using the GET Method Ah, You're the latest of the ones to get hit by the register_globals setting. There are two things to do: 1. Change your code to reference the METHOD referenced in the form page GET -> $_GET['varname'] POST -> $_POST['varname'] COOKIE -> $_COOKIE['varname'] SESSION -> $_SESSION['varname'] GPC (Get Post Cookie, in that order) -> $_REQUEST['varname'] See php.net/register_globals for this. 2. Change your php.ini settings from: register_globals = off to register_globals = on then restart your server. Now, I just have to ask myself why I don't have a canned message for this... -Dash Know thyself. If you need help, call the C.I.A. On Sat, 11 Jan 2003, Wade wrote: > 01112003 2132 CST > > Im working on learning PHP4 by reading Beginning PHP 4, Wrox Press. > Chapter 3, page 76. > Im working with a form field sending data via the GET method. > On the first page, you fill in a text field and hit send. > That data is sent via the URL. > I can see it in the URL, on the next page. > The pag
Re: [PHP-WIN] Which Web server to run under XP
Xitami is not a good choice for XP. I don't know why, but it has problems handling sessions properly, not to mention a few other bugs I ran into. I strongly suggest you use something like Apache, IIS (if you have XP professional, although IIS does suck quite badly lol), or even Abyss (http://www.aprelium.com). Personally, I had problems with Abyss causing my server to restart during heavy loads (It did something wrong, and bloody XP decides its gonna restart to avoid a crash :-( ), but it is the best/easiest to use Windows server i know. I like it more than Apache, if only it was stable on my pc! Stephen - Original Message - From: "Ben Edwards" <[EMAIL PROTECTED]> To: "Rafael Fernandez" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Sunday, January 12, 2003 2:53 PM Subject: RE: [PHP-WIN] Which Web server to run under XP > At 23:03 10/01/2003 -0400, you wrote: > > >I use Win XP with Service Pack 1 and I have not had problem with my PC, > >in fact it has better performance on my machine. But if you don't want > >to upgrade use Xitami > > I guess you were luck, it certainly screwed up my machine. > > >-Original Message- > >From: Ben Edwards [mailto:[EMAIL PROTECTED]] > >Sent: Friday, January 10, 2003 10:11 PM > >To: [EMAIL PROTECTED] > >Subject: [PHP-WIN] Which Web server to run under XP > > > >I am using XP and have been trying to work out which web server to use > >with > >PHP & MySQL. > > > >First I tries IIS and it said I have an OCX missing. > > > >Then I looked at Apache and it said I need Service Pack 1, which if I > >install slows the whole machine down. This is a know issue, Microsoft > >excuse is that it is something to do with securety. > > > >Are there any other web servers I could use or are there work rounds for > > > >the above. > > > >Regards, > >Ben > > > > > >* Ben Edwards +44 (0)117 968 2602 * > >* Critical Site Builderhttp://www.criticaldistribution.com * > >* online collaborative web authoring content management system * > >* Get alt news/views films online http://www.cultureshop.org * > >* i-Contact Progressive Video http://www.videonetwork.org * > >* Smashing the Corporate image http://www.subvertise.org * > >* Bristol Indymedia http://bristol.indymedia.org * > >* Bristol's radical news http://www.bristle.org.uk * > >* PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * > > > > > * Ben Edwards +44 (0)117 968 2602 * > * Critical Site Builderhttp://www.criticaldistribution.com * > * online collaborative web authoring content management system * > * Get alt news/views films online http://www.cultureshop.org * > * i-Contact Progressive Video http://www.videonetwork.org * > * Smashing the Corporate image http://www.subvertise.org * > * Bristol Indymedia http://bristol.indymedia.org * > * Bristol's radical news http://www.bristle.org.uk * > * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-WIN] Getting IP Address and previous URL from user??
Hi. Is it possible to get the IP Address and the URL from which a request was made to a PHP script? I need this to implement a security barrier. I have an image that links to a PHP script. I need the IP of the client that clicked on the image and the URL of the page where the image is placed. Is this possible? Thanks in advance Ignacio Domínguez -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-WIN] Getting IP Address and previous URL from user??
Sure. If you ever want to see what variables you can access and how they are stored, simply write a script with phpinfo(32); in. It outputs ALL variables which you can access from your script. In this case: Remote IP (Person who accessed the script) $_SERVER["REMOTE_ADDR"] File that was accessed (and directory) $PHP_SELF Name of host (e.g. localhost from http://localhost/page.php $_SERVER["HTTP_HOST"] - Original Message - From: "Ignacio Domínguez" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, January 12, 2003 3:43 PM Subject: [PHP-WIN] Getting IP Address and previous URL from user?? > Hi. Is it possible to get the IP Address and the URL from which a request > was made to a PHP script? I need this to implement a security barrier. > > I have an image that links to a PHP script. I need the IP of the client that > clicked on the image and the URL of the page where the image is placed. > > Is this possible? > > Thanks in advance > > Ignacio Domínguez > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-WIN] Getting IP Address and previous URL from user??
Thanks! that was exactly what I needed. I used $_SERVER["HTTP_REFERER"] instead of $_SERVER["HTTP_HOST"], which returned the complete url, not only the host. "Stephen Edmonds" <[EMAIL PROTECTED]> wrote in message 006301c2ba54$76ee67b0$ae00a8c0@q">news:006301c2ba54$76ee67b0$ae00a8c0@q... > Sure. If you ever want to see what variables you can access and how they are > stored, simply write a script with > phpinfo(32); > in. It outputs ALL variables which you can access from your script. In this > case: > Remote IP (Person who accessed the script) > $_SERVER["REMOTE_ADDR"] > File that was accessed (and directory) > $PHP_SELF > Name of host (e.g. localhost from http://localhost/page.php > $_SERVER["HTTP_HOST"] > > - Original Message - > From: "Ignacio Domínguez" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Sunday, January 12, 2003 3:43 PM > Subject: [PHP-WIN] Getting IP Address and previous URL from user?? > > > > Hi. Is it possible to get the IP Address and the URL from which a request > > was made to a PHP script? I need this to implement a security barrier. > > > > I have an image that links to a PHP script. I need the IP of the client > that > > clicked on the image and the URL of the page where the image is placed. > > > > Is this possible? > > > > Thanks in advance > > > > Ignacio Domínguez > > > > > > > > -- > > PHP Windows Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-WIN] Re: sending mail trough PHP page??
I solved this using ini_set("sendmail_from", "[EMAIL PROTECTED]"); and ini_set("SMTP", "mail.server"); everytime i needed to use mail(). "Ignacio DomíNguez" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I get the following error every time I send mail. > > Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or > custom "From:" header missing > > using this code: > > mail("[EMAIL PROTECTED]", "Subject", "This is the text", "From: [EMAIL PROTECTED]"); > > > > i have configured my php.ini to read "sendmail_from = [EMAIL PROTECTED]" > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-WIN] Re: Which Web server to run under XP
Ben Edwards wrote: > I am using XP and have been trying to work out which web server to use with > PHP & MySQL. > First I tries IIS and it said I have an OCX missing. > Then I looked at Apache and it said I need Service Pack 1, which if I > install slows the whole machine down. This is a know issue, Microsoft > excuse is that it is something to do with securety. > Are there any other web servers I could use or are there work rounds for > the above. > Regards, > Ben I use XP Pro with Apache and have had very little problems once it is up. I used a intregrated FoxServ 2.1. It installs PHP, Apache and MySQL from a single program. The editions are not the latest of each, but is very easy to install and works flawlessly. -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-WIN] RE: initialize variables (was: Using the GET Method)
I've always had a problem with books on PHP, because the language changes and evolves more quickly than books can be written, printed, and distributed. If register_globals is set to off, cookie variables, query string variables, form (post) variables, and session variables are not automatically turned into PHP variables, IE; if register globals is on. http://www/index.php"; method="POST"> in index.php, you don't need to specify where $id is being created, because it gets created for you. Howver, other people can override your variables with values of their own http://www/index.php?id=453 its better to specifically write, where your variable is coming from: $id = $_POST['id']; then someone acessing the url with id=435 appended to it will have no affect. > And is $_POST[] short for $HTTP_POST_VARS[] or is it something else? $_POST was introduced in PHP 4.1, prior to that you used $HTTP_POST_VARS; Most people say "Just use $HTTP_POST_VARS, and your code will work anywhere", however, if you read the PHP manual, the developers say "$HTTP_POST_VARS is deprecated", which means "Its going to be removed in the future" Now you start to see why Books on PHP, that teach specific PHP syntax, get out-dated quite quickly. You still need to use session_register() (to register a session variable), but you should access (registered) session variables through $_SESSION[] -Original Message- From: Bobo Wieland [mailto:[EMAIL PROTECTED]] Sent: Monday, 13 January 2003 2:00 AM To: Sean Malloy; [EMAIL PROTECTED] Subject: initialize variables (was: Using the GET Method) Please, explain this to me, because I couldn't figure it out by myself... If register_globals is set to 'off', and because it's good practice, you should allways initzialize your variables? So I should write: $test = $_POST['test']; and then I can use $test as usuall... But what about local variables then? Variables that shouldn't be past from one page to another? And is $_POST[] short for $HTTP_POST_VARS[] or is it something else? And should you use $_SESSION[] and not session_register()?!? Sorry for these simple questions, but I would like to do things right... My knowledge comes basicly just from 'Beginning PHP4 (WROX)' and it seems that the book doesn't dig so deep into this matter... Thanks! .bobo :: www.elstudion.com/bobo - Original Message - From: "Sean Malloy" <[EMAIL PROTECTED]> To: "Wade" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Sunday, January 12, 2003 9:59 AM Subject: RE: [PHP-WIN] Using the GET Method > IMO, writing programs that work without register_globals to be enabled, is a > good thing. > > Throughout the book, the code examples will have been created with > register_globals on. (The default setting for older PHP > installations/versions) > > just keep in mind that variables are not auto created for you, so you must > initialize them first. > > $author = $_GET['author']; > > if you change the form method to POST, then you will have to modify the code > to reflect that too. > > Anyways, explicitly initialising your variables is a good habit to get into. > Its more secure. > > -Original Message- > From: Dash McElroy [mailto:[EMAIL PROTECTED]] > Sent: Sunday, 12 January 2003 3:49 PM > To: Wade > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP-WIN] Using the GET Method > > > Ah, You're the latest of the ones to get hit by the register_globals > setting. There are two things to do: > > 1. Change your code to reference the METHOD referenced in the form page > GET -> $_GET['varname'] > POST -> $_POST['varname'] > COOKIE -> $_COOKIE['varname'] > SESSION -> $_SESSION['varname'] > GPC (Get Post Cookie, in that order) -> $_REQUEST['varname'] > > See php.net/register_globals for this. > > 2. Change your php.ini settings from: > register_globals = off > to > register_globals = on > > then restart your server. > > Now, I just have to ask myself why I don't have a canned message for > this... > > -Dash > > Know thyself. If you need help, call the C.I.A. > > On Sat, 11 Jan 2003, Wade wrote: > > > 01112003 2132 CST > > > > Im working on learning PHP4 by reading Beginning PHP 4, Wrox Press. > > Chapter 3, page 76. > > Im working with a form field sending data via the GET method. > > On the first page, you fill in a text field and hit send. > > That data is sent via the URL. > > I can see it in the URL, on the next page. > > The page will not show the data in the variable spot. > > > > The Code: > > > > Page One > > > > > > > > > > > > > > > > > > Page Two - text.php > > > > > > Your favorite author is: > > > echo $author; > > ?> > > > > > > Now, I know PHP is case sensitive and I have been sure to check the > > $variable in the code. I have worked through some other pages in this > > book and I downloaded the documentation from the wrox website. Their > > code is exactly as the book and my own. > > > > Im stumbed. Anybody read this book? Can anybody see something wrong? > > > > Wade > > > > > > --
[PHP-WIN] Question about Mail()
I'm needing to debug a mailer script on my site as it has recently started to throw up several time out errors. When I put in some timing code and observed the results, I found that a call to the mail() function was taking 17 seconds to execute, which does not seem right under any definition of right, no matter how creative it may be. My specific question for the PHP-Windows list is: Is there any particular substantial overhead for mail? I did not expect 17 seconds of overhead, seems like a little bit much for an email that is less than 1 k in size, being sent through the localhost. My setup is as follows: Win 2k Prof Apache 1.3.23 PHP 4.2.2 Mail Server: Mail Enable 1.613 PHP INI Snipet: [mail function] ; For Win32 only. SMTP = localhost ; for Win32 only ; For Win32 only. sendmail_from = [EMAIL PROTECTED] ; for Win32 only thanks, Jeff -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-windows Digest 13 Jan 2003 07:04:57 -0000 Issue 1532
php-windows Digest 13 Jan 2003 07:04:57 - Issue 1532 Topics (messages 17790 through 17797): Re: Which Web server to run under XP 17790 by: Stephen Edmonds 17795 by: Michael Harding Getting IP Address and previous URL from user?? 17791 by: Ignacio Domínguez 17792 by: Stephen Edmonds 17793 by: Ignacio Domínguez Re: sending mail trough PHP page?? 17794 by: Ignacio Domínguez Re: initialize variables (was: Using the GET Method) 17796 by: Sean Malloy Question about Mail() 17797 by: Jeff Vandenberg 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 --- Xitami is not a good choice for XP. I don't know why, but it has problems handling sessions properly, not to mention a few other bugs I ran into. I strongly suggest you use something like Apache, IIS (if you have XP professional, although IIS does suck quite badly lol), or even Abyss (http://www.aprelium.com). Personally, I had problems with Abyss causing my server to restart during heavy loads (It did something wrong, and bloody XP decides its gonna restart to avoid a crash :-( ), but it is the best/easiest to use Windows server i know. I like it more than Apache, if only it was stable on my pc! Stephen - Original Message - From: "Ben Edwards" <[EMAIL PROTECTED]> To: "Rafael Fernandez" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Sunday, January 12, 2003 2:53 PM Subject: RE: [PHP-WIN] Which Web server to run under XP > At 23:03 10/01/2003 -0400, you wrote: > > >I use Win XP with Service Pack 1 and I have not had problem with my PC, > >in fact it has better performance on my machine. But if you don't want > >to upgrade use Xitami > > I guess you were luck, it certainly screwed up my machine. > > >-Original Message- > >From: Ben Edwards [mailto:[EMAIL PROTECTED]] > >Sent: Friday, January 10, 2003 10:11 PM > >To: [EMAIL PROTECTED] > >Subject: [PHP-WIN] Which Web server to run under XP > > > >I am using XP and have been trying to work out which web server to use > >with > >PHP & MySQL. > > > >First I tries IIS and it said I have an OCX missing. > > > >Then I looked at Apache and it said I need Service Pack 1, which if I > >install slows the whole machine down. This is a know issue, Microsoft > >excuse is that it is something to do with securety. > > > >Are there any other web servers I could use or are there work rounds for > > > >the above. > > > >Regards, > >Ben > > > > > >* Ben Edwards +44 (0)117 968 2602 * > >* Critical Site Builderhttp://www.criticaldistribution.com * > >* online collaborative web authoring content management system * > >* Get alt news/views films online http://www.cultureshop.org * > >* i-Contact Progressive Video http://www.videonetwork.org * > >* Smashing the Corporate image http://www.subvertise.org * > >* Bristol Indymedia http://bristol.indymedia.org * > >* Bristol's radical news http://www.bristle.org.uk * > >* PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * > > > > > * Ben Edwards +44 (0)117 968 2602 * > * Critical Site Builderhttp://www.criticaldistribution.com * > * online collaborative web authoring content management system * > * Get alt news/views films online http://www.cultureshop.org * > * i-Contact Progressive Video http://www.videonetwork.org * > * Smashing the Corporate image http://www.subvertise.org * > * Bristol Indymedia http://bristol.indymedia.org * > * Bristol's radical news http://www.bristle.org.uk * > * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php --- End Message --- --- Begin Message --- Ben Edwards wrote: > I am using XP and have been trying to work out which web server to use with > PHP & MySQL. > First I tries IIS and it said I have an OCX missing. > Then I looked at Apache and it said I need Service Pack 1, which if I > install slows the whole machine down. This is a know issue, Microsoft > excuse is that it is something to do with securety. > Are there any other web servers I could use or are there work rounds for > the above. > Regards, > Ben I use XP Pro with Apache and have had very little problems once it is up. I used a intregrated Fox
[PHP-WIN] PHP + Win98 Question
Can anyone please tell me why i can not use php fully under win98SE with apache 1.3.24 and PHP 4.3.0 I have most of the features of PHP but i can not seem to test scripts that i design that need forms or sessions. This gets rather anoying as with each new script i need to test it on a remote computer. Thanks. Dean Hayes Mystical Web Designs _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php