[PHP] Forms
Hi, I'm sending this to both lists as I'm not sure where the problem is, but I believe it is an issue with my HTML form. Here's the problem: I have a drop-down menu form on my webpage with employee names in it. When I choose a name and click submit it gets passed to a php page which accesses a mysql database and displays information about that employee. The problem is that the form is not sending the employee name to the php page. If I insert the name in the php page manually, it works fine, so the problem appears to be with the form. Can someone help me out here - a sample of my code is below. I'm not sure how to explain this, but whatever gets sent to the PHP page has to be one variable - i.e. if I choose John, then the variable that gets sent to the PHP should have the value John, if I choose Mary, the value of the variable should be Mary. Hope this makes sense. TIA PCENTERFORM NAME=Employees SELECT NAME=name OPTION SELECTED VALUE=/OPTION OPTION VALUE=John/OPTIONJohn OPTION VALUE=Mary/OPTIONMary /SELECT INPUT TYPE=submit VALUE=Submit -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Displaying output from MySQL
Hi, Not sure if this is a PHP of a MySQL question, so I am sending it to both groups. Basically I have a list of numbers with two decimal places in the MySQL database, but I only want to display some of them with the decimal points. i.e. 70 (not 70.00) 87 51.5 46.75 12 29 5.5 -1 45 I know it's probably a weird request, but any thoughts on how one would do this. TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying output from MySQL
Yep, pretty close to what I needed. Had to do a bit of tweaking, but basically was able to get the results I needed. Thanks - Original Message - From: Chris Hewitt [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, December 11, 2002 5:11 AM Subject: Re: [PHP] Displaying output from MySQL Beauford.2002 wrote: Hi, Not sure if this is a PHP of a MySQL question, so I am sending it to both groups. Basically I have a list of numbers with two decimal places in the MySQL database, but I only want to display some of them with the decimal points. Check out number_format() in the manual (under Mathematical Functions). HTH Chris -- 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
[PHP] Variables - Help
Hi, I have a webpage where users input information. This gets sent to a PHP page to use this input. The first time the user inputs information it works correctly, but the second, third, forth, etc. times does not. It appears the information from the first time is still stored in the variables I am using in PHP. I have tried setting them all back to zero, but this does not work. So how do I reset all the variables so that the new information is contained in them when the user adds more information. TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and MySQL queries
Hi, I am having a real problem with variables in PHP and trying to query my MySQL database. I have a form that a user inputs information and then that info is used to query my database, but it's not working. I don't get any errorrs and it appears every thing worked, but nothing gets displayed (see code below). I know the info is getting passed from the form as it appears correct in the address bar of my browser. The query below also works if I use the command line in MySQL and hard code the information. Any help is appreciated. http://etc/etc?FromTrade=TRUEname=1from=2 $query = select tmanager.idn, tmanager.total, troster.idp, user, position, points from troster join treference join tmanager where tmanager.idn=treference.idn and treference.idp=troster.idp and tmanager.name like '$name' and troster.player like '$from'; $results = mysql_query($query) or die(Query failed); while ($line = mysql_fetch_array($results, MYSQL_ASSOC)) { echo $line[idn]; echo $line[total]; echo $line[idp]; echo $line[position]; echo $line[points]; This just displays an empty page. So it appears the query found nothing, but like I said, it works from the command line and there should be one entry (see below). So I have to assume it is a problem with the variables. +-++-++--++ | idn | total | idp | user | position | points | +-++-++--++ | 1 | 746.75 | 2 | Trevor | F| 45.00 | +-++-++--++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question about the exit() command
Hi, Could someone clarify this for me. I want to be able to exit out of a PHP webpage and return to the calling page if certain conditions are not met. It appears using exit() will do this, but I am unclear exactly how to use it. any info is appreciated. TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about the exit() command
Just to make sure I have this right. I have a switch() statement like below. If the case statement is true it should include the page indicated and exit the PHP script without displaying the echo or executing any other code. If the case is false the script should continue as normal. TIA. switch (true) { case ($fname == Select): $errormessage = $error; include (other.html); exit; } echo Other Code; - Original Message - From: Philip Olson [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Thursday, December 19, 2002 4:55 PM Subject: Re: [PHP] Question about the exit() command How about: if (!$conn = mysql_connect($host, $user, $pass)) { include 'static_html.inc'; exit; } print Welcome, yes the database is connected; exit ends the script, nothing after its use is executed. Regards, Philip Olson On Thu, 19 Dec 2002, Beauford.2002 wrote: Hi, Could someone clarify this for me. I want to be able to exit out of a PHP webpage and return to the calling page if certain conditions are not met. It appears using exit() will do this, but I am unclear exactly how to use it. any info is appreciated. TIA -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Another problem with conditional statements
Hi, This should be as simple as breathing, but not today. I have two variables $a and $b which I need to compare in a switch statement in several different ways, but no matter what I do it's wrong. This is what I have tried, can someone tell me how it should be. TIA switch (true): case ($a == $b): This one seems simple enough. do sum stuff; break; case ($a $b == 124): This appears not to work. do sum stuff; break; case ($a == 124 $b == 755): If $a is equal to 124 and $b is equal to 755 then it should be true..doesn't work. do sum stuff; break; case ($a == 124 $b != 124): Nope, this doesn't appear to work either. do sum stuff; break; endswitch; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Another problem with conditional statements
I believe you are incorrect. Switch will look for the first case statement that is true and execute that statement. The following works - case one is incorrect so it doesn't get executed but the second case does. Paste this into a test.php file and you will see it works.. Read the manual. $a=2; $b=4; switch (true) { case ($a $b) and ($b 5): echo Incorrect; case ($a == 2): echo Correct; } So my original question is still stands. The switch statement is correct, but there is a problem with my conditional statements. - Original Message - From: Rick Emery [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED] Sent: Thursday, December 19, 2002 7:33 PM Subject: Re: [PHP] Another problem with conditional statements switch() does not work that way. Switch uses the value in the parentheses and selects a CASE based upon that value. Read the manual. You will have to use a series of if()-elseif()-else() - Original Message - From: Beauford.2002 [EMAIL PROTECTED] To: PHP General [EMAIL PROTECTED] Sent: Thursday, December 19, 2002 6:19 PM Subject: [PHP] Another problem with conditional statements Hi, This should be as simple as breathing, but not today. I have two variables $a and $b which I need to compare in a switch statement in several different ways, but no matter what I do it's wrong. This is what I have tried, can someone tell me how it should be. TIA switch (true): case ($a == $b): This one seems simple enough. do sum stuff; break; case ($a $b == 124): This appears not to work. do sum stuff; break; case ($a == 124 $b == 755): If $a is equal to 124 and $b is equal to 755 then it should be true..doesn't work. do sum stuff; break; case ($a == 124 $b != 124): Nope, this doesn't appear to work either. do sum stuff; break; endswitch; -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fw: Fatal error: Call to undefined function: allerrors() in............
At the beginning of my page I have some code which calls a function I have created, at the bottom of the page is the function, but I keep getting the error Fatal error: Call to undefined function: gotofunction() in .. no matter what I do. Any info on what's happening is appreciated. example: if ($a == $b) { gotofunction($a, $b); } function gotofunction($a, $b) { a bunch of code; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Another problem with conditional statements
From the manual at www.php.net. This is a lot more sophiticated than mine and apparantly works. So as a recent user of PHP, I'm at a loss as to what is and what isn't. Using switch would be more efficiant as it would stop once a match is made (if you use break), but with eleif statements each one is evaluated in order. $chr = substr($a,$i,1); switch (TRUE) { case $chr == á || $chr == à || $chr == ã || $chr == â: $a = str_replace(substr($a,$i,1),a,$a); break; case $chr == é || $chr == è || $chr == ê: $a = str_replace(substr($a,$i,1),e,$a); break; } - Original Message - From: Sean Malloy [EMAIL PROTECTED] To: PHP General [EMAIL PROTECTED] Sent: Thursday, December 19, 2002 9:36 PM Subject: RE: [PHP] Another problem with conditional statements Nowhere in the documentation does it specify switch should be used in the context you are attempting. The docs show a single variable and checking the case of that variable. I'm not going to berate you on syntax. If you can get it working like that then good for you. However, I would strongly advise you to use the if/elseif/else statements instead. an example of switch $action = $_POST['action'] switch ($action) { case 'help': showHelp(); break; default : showDefault(); } not $action = $_POST['action'] switch (true) { case ($action == 'help'): showHelp(); break; default : showDefault(); } -Original Message- From: Beauford.2002 [mailto:[EMAIL PROTECTED]] Sent: Friday, 20 December 2002 12:46 PM To: Rick Emery Cc: PHP General Subject: Re: [PHP] Another problem with conditional statements I believe you are incorrect. Switch will look for the first case statement that is true and execute that statement. The following works - case one is incorrect so it doesn't get executed but the second case does. Paste this into a test.php file and you will see it works.. Read the manual. $a=2; $b=4; switch (true) { case ($a $b) and ($b 5): echo Incorrect; case ($a == 2): echo Correct; } So my original question is still stands. The switch statement is correct, but there is a problem with my conditional statements. - Original Message - From: Rick Emery [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED] Sent: Thursday, December 19, 2002 7:33 PM Subject: Re: [PHP] Another problem with conditional statements switch() does not work that way. Switch uses the value in the parentheses and selects a CASE based upon that value. Read the manual. You will have to use a series of if()-elseif()-else() - Original Message - From: Beauford.2002 [EMAIL PROTECTED] To: PHP General [EMAIL PROTECTED] Sent: Thursday, December 19, 2002 6:19 PM Subject: [PHP] Another problem with conditional statements Hi, This should be as simple as breathing, but not today. I have two variables $a and $b which I need to compare in a switch statement in several different ways, but no matter what I do it's wrong. This is what I have tried, can someone tell me how it should be. TIA switch (true): case ($a == $b): This one seems simple enough. do sum stuff; break; case ($a $b == 124): This appears not to work. do sum stuff; break; case ($a == 124 $b == 755): If $a is equal to 124 and $b is equal to 755 then it should be true..doesn't work. do sum stuff; break; case ($a == 124 $b != 124): Nope, this doesn't appear to work either. do sum stuff; break; endswitch; -- 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 -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with functions
Hi, I keep getting errors in my script that says 'x' function is undefined or 'y' function is undefined. I defined it as 'function test ($a, $b)' and call it using 'test($a, $b)' From my knowledge this is correct, but it just simply doesn't work. Anyone have any ideas on this? TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with functions
Jon, You may have answered my question, but I'm still confused. I see from your example that the actual function comes before the function is called in the script, and when I changed mine to that format it worked. Now the confusion. I have another script which is the opposite of your example, and works fine. So why would one work one way but not the other. I have included the exact format I have for the one that doesn't work, and below that the actual code of the one that does work. In most languages I have used, this is the correct format - it makes for easier reading. ?PHP (this is the one that does not work) include (errormessages.php); $error = ; if (!$name) { errormessage(); } elseif ($anothercondition) { gotofunction(); } elseif ($anothercondition2) { gotofunction2(); } elseif ($anothercondition3) { gotofunction3(); } function errormessage() { code ... code ... } function gotofunction() { code ... code ... } function gotofunction2() { code ... code ... } function gotofunction3() { code ... code ... } ? ?PHP $ipexists = checkforduplicates(); switch (true) { case (!$name): showentries(); break; case (!$ipexists): writerecord($date, $name, $email, $comment); break; case ($ipexists): duplicatemessage(); break; } function checkforduplicates() { code ...; } showentries() { code ...; } writerecord($date, $name, $email, $comment) { code ...; } duplicatemessage() { code ...; } ? - Original Message - From: Jon Haworth [EMAIL PROTECTED] To: 'Beauford.2002' [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED] Sent: Friday, December 20, 2002 11:05 AM Subject: RE: [PHP] Problem with functions Hi, I keep getting errors in my script that says 'x' function is undefined or 'y' function is undefined. I defined it as 'function test ($a, $b)' and call it using 'test($a, $b)' You need to post code :-) Try this: ?php function test ($a, $b) { echo I am the test functionbr /; echo a is $abr /; echo b is $bbr /; } test(1, 2); ? Cheers Jon -- 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
[PHP] Forms and PHP variables
Hi, First off, thanks to all those that helped out with my other questions. Not all my problems were solved, but I'm certainly closer. Still working on the same project I need to do the following. I have a form where users input numbers only, is there a way I can have php check to make sure a letter or other character didn't get put in by accident. I was looking at ereg, but not to familiar with this or if it would work in this case. TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms and PHP variables
Thanks for the info, but . is_numeric does not appear to accept variables i.e. is_numeric($num) and ctype gives me the following. Fatal error: Call to undefined function: ctype_digit() in /usr/local/apache/htdocs/.. on line 6 - Original Message - From: Philip Olson [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Saturday, December 21, 2002 9:50 PM Subject: Re: [PHP] Forms and PHP variables Use is_numeric() http://www.php.net/is_numeric See also the ctype functions which can be read about here: http://www.php.net/ctype And yes, regular expressions are another option but aren't needed here. Regards, Philip Olson On Sat, 21 Dec 2002, Beauford.2002 wrote: Hi, First off, thanks to all those that helped out with my other questions. Not all my problems were solved, but I'm certainly closer. Still working on the same project I need to do the following. I have a form where users input numbers only, is there a way I can have php check to make sure a letter or other character didn't get put in by accident. I was looking at ereg, but not to familiar with this or if it would work in this case. TIA -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Undefined Functions
Hi, I previously asked a question about getting undefined function errors in my script and someone mentioned that it may be that I am calling it from within an if or else statement. This turned out to be the case. Now the question - is there a way around this? What I need to do resolves around many different conditions, and depending on the what's what I call the necessary function. I have looked my script over and over and can not see any other way of doing this. I am fairly new to PHP and maybe there is a better way, and I'm open to suggestions. TIA Example: if ($a == $b) call function one; elseif ($a $b) call function two; elseif ($a == $c) call function two; elseif ($a $b) call function two; elseif ($c $b) call function two; elseif ($d == $e) call function two; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Undefined Functions
I have a function at the bottom of my script which is called from withing an if/else statement. If I take it out of the if/else and just call the function it works fine (except I don't get the results I want). So it appears where you are calling it from does matter. See the examples below. This isn't the first time either, I have had to redo several scripts for this project because of it. If I'm doing this wrong based on the examples below, please let me know. Thanks. i.e. This doesn't work.This does. some code .. some code If ($bob) { gotofunction($bob); } gotofunction($bob); elseif ($sally) { gotonextfunction($sally); } gotonextfunction($sally) else { gotolastfunction(); } gotolastfunction() some other code . some other code function gotofunction($bob) function gotofunction($bob) function gotonextfunction() function gotonextfunction() function gotolastfunction() function gotolastfunction() - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Sunday, December 22, 2002 11:16 PM Subject: Re: [PHP] Undefined Functions An undefined function error has nothing to do with where you are calling the function from. It has to do with whether or not you have defined the function you are calling. -Rasmus On Sun, 22 Dec 2002, Beauford.2002 wrote: Hi, I previously asked a question about getting undefined function errors in my script and someone mentioned that it may be that I am calling it from within an if or else statement. This turned out to be the case. Now the question - is there a way around this? What I need to do resolves around many different conditions, and depending on the what's what I call the necessary function. I have looked my script over and over and can not see any other way of doing this. I am fairly new to PHP and maybe there is a better way, and I'm open to suggestions. TIA Example: if ($a == $b) call function one; elseif ($a $b) call function two; elseif ($a == $c) call function two; elseif ($a $b) call function two; elseif ($c $b) call function two; elseif ($d == $e) call function two; -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Undefined Functions
Then based on the one below that doesn't work, what is the problem with it? As I said, the functions are at the bottom of the script. The only thing after them is the closing ?. I also said that they work if I don't call them from within an if/else. This tells me it is not where it is defined but where it is being called from. Your saying this doesn't matter, but have not given any reasons for my problems. If you could elaborate on this it would be appreciated. Beauford - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Monday, December 23, 2002 11:14 AM Subject: Re: [PHP] Undefined Functions Like I said, where you define your function is important, not where you call it. If you are defining and calling it all in the same place, then yes, obviously it makes a difference. -Rasmus On Mon, 23 Dec 2002, Beauford.2002 wrote: I have a function at the bottom of my script which is called from withing an if/else statement. If I take it out of the if/else and just call the function it works fine (except I don't get the results I want). So it appears where you are calling it from does matter. See the examples below. This isn't the first time either, I have had to redo several scripts for this project because of it. If I'm doing this wrong based on the examples below, please let me know. Thanks. i.e. This doesn't work.This does. some code .. some code . If ($bob) { gotofunction($bob); } gotofunction($bob); elseif ($sally) { gotonextfunction($sally); } gotonextfunction($sally) else { gotolastfunction(); } gotolastfunction() some other code . some other code function gotofunction($bob) function gotofunction($bob) function gotonextfunction() function gotonextfunction() function gotolastfunction() function gotolastfunction() - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Sunday, December 22, 2002 11:16 PM Subject: Re: [PHP] Undefined Functions An undefined function error has nothing to do with where you are calling the function from. It has to do with whether or not you have defined the function you are calling. -Rasmus On Sun, 22 Dec 2002, Beauford.2002 wrote: Hi, I previously asked a question about getting undefined function errors in my script and someone mentioned that it may be that I am calling it from within an if or else statement. This turned out to be the case. Now the question - is there a way around this? What I need to do resolves around many different conditions, and depending on the what's what I call the necessary function. I have looked my script over and over and can not see any other way of doing this. I am fairly new to PHP and maybe there is a better way, and I'm open to suggestions. TIA Example: if ($a == $b) call function one; elseif ($a $b) call function two; elseif ($a == $c) call function two; elseif ($a $b) call function two; elseif ($c $b) call function two; elseif ($d == $e) call function two; -- 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 -- 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] Undefined Functions
Finally got it working, but I have no idea how. I rewrote the script changing a few if's and elseif's so there weren't as many, but still calling the functions from the if/else statements. The format of the new script is the same as the old one, and other than a few modifications, I still can't see where the old one failed. In any event, I appreciate the help from all who responded. Beauford - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Monday, December 23, 2002 2:40 PM Subject: Re: [PHP] Undefined Functions I have no idea what you have done wrong. I am simply telling you how it works. Create a small test script that reproduces the problem and we can help you. What you have provided so far does not give us anything to work with. Try this, for example: ? if(true) func1(); else func2(); function func1() { echo 1; } function func2() { echo 2; } ? When you run this you will see that it prints out 1 which should satisfy you that you can safely call functions inside conditionals and have them be defined at the bottom of your script. Your job now is to tell us how your script differs from the above test script, because as far as I have understood this is the exact situation you say isn't working. -Rasmus On Mon, 23 Dec 2002, Beauford.2002 wrote: Then based on the one below that doesn't work, what is the problem with it? As I said, the functions are at the bottom of the script. The only thing after them is the closing ?. I also said that they work if I don't call them from within an if/else. This tells me it is not where it is defined but where it is being called from. Your saying this doesn't matter, but have not given any reasons for my problems. If you could elaborate on this it would be appreciated. Beauford - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Monday, December 23, 2002 11:14 AM Subject: Re: [PHP] Undefined Functions Like I said, where you define your function is important, not where you call it. If you are defining and calling it all in the same place, then yes, obviously it makes a difference. -Rasmus On Mon, 23 Dec 2002, Beauford.2002 wrote: I have a function at the bottom of my script which is called from withing an if/else statement. If I take it out of the if/else and just call the function it works fine (except I don't get the results I want). So it appears where you are calling it from does matter. See the examples below. This isn't the first time either, I have had to redo several scripts for this project because of it. If I'm doing this wrong based on the examples below, please let me know. Thanks. i.e. This doesn't work.This does. some code .. some code . If ($bob) { gotofunction($bob); } gotofunction($bob); elseif ($sally) { gotonextfunction($sally); } gotonextfunction($sally) else { gotolastfunction(); } gotolastfunction() some other code . some other code function gotofunction($bob) function gotofunction($bob) function gotonextfunction() function gotonextfunction() function gotolastfunction() function gotolastfunction() - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Sunday, December 22, 2002 11:16 PM Subject: Re: [PHP] Undefined Functions An undefined function error has nothing to do with where you are calling the function from. It has to do with whether or not you have defined the function you are calling. -Rasmus On Sun, 22 Dec 2002, Beauford.2002 wrote: Hi, I previously asked a question about getting undefined function errors in my script and someone mentioned that it may be that I am calling it from within an if or else statement. This turned out to be the case. Now the question - is there a way around this? What I need to do resolves around many different conditions, and depending on the what's what I call the necessary function. I have looked my script over and over and can not see any other way of doing this. I am fairly new to PHP and maybe there is a better way, and I'm open to suggestions. TIA Example: if ($a == $b) call function one; elseif ($a $b) call function two; elseif ($a == $c) call function two; elseif ($a $b) call function two
[PHP] Nested Arrays
Hi, Is there anyway to do a nested array, I have looked at the various array functions and can't figure this out (if possible). I want to be able to put each field of a row into an array, and then put that entire row and into another array. so when I display it, I would have: row1 - col1 col2 col3 col4 col5 row2 - col1 col2 col3 col4 col5 row3 - col1 col2 col3 col4 col5 row4 - col1 col2 col3 col4 col5 row5 - col1 col2 col3 col4 col5 etc. (depending on how many rows there are). TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested Arrays
Thanks for the info, but maybe I didn't give enough info. I have a mysql database with up to 10 rows and 5 fields in each row.. I have been reading up on some of the array functions, but haven't been able to get anything to work. TIA - Original Message - From: Weston Houghton [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Thursday, December 26, 2002 6:19 PM Subject: Re: [PHP] Nested Arrays Sure... for the longwinded approach, just do this: $row1 = array(col1, col2, col3, ...); $row2 = array(col1, col2, col3, ...); $row3 = array(col1, col2, col3, ...); $row4 = array(col1, col2, col3, ...); $row5 = array(col1, col2, col3, ...); $main_array = array($row1, $row2, $row3, $row4, $row5); Obviously these could include key-value pairs in the arrays as well. Then to prove it to yourself: print_r($main_array); Cheers, Wes On Thursday, December 26, 2002, at 06:14 PM, Beauford.2002 wrote: Hi, Is there anyway to do a nested array, I have looked at the various array functions and can't figure this out (if possible). I want to be able to put each field of a row into an array, and then put that entire row and into another array. so when I display it, I would have: row1 - col1 col2 col3 col4 col5 row2 - col1 col2 col3 col4 col5 row3 - col1 col2 col3 col4 col5 row4 - col1 col2 col3 col4 col5 row5 - col1 col2 col3 col4 col5 etc. (depending on how many rows there are). TIA -- 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] Nested Arrays
Great. now can you explain why this works. I'm confused at how PHP knows this is a multidimensional array. I was trying something like $tmp[][]=???. TIA - Original Message - From: Marek Kilimajer [EMAIL PROTECTED] Cc: Beauford.2002 [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED] Sent: Friday, December 27, 2002 8:45 AM Subject: Re: [PHP] Nested Arrays Sorry, now I reminded myself this would cause a false element at the end of $rows, use this: while($tmp=mysql_fetch_array($res)) { $rows[]=$tmp; } Marek Kilimajer wrote: Simple: while($rows[]=mysql_fetch_array($res)) {} ($res is a mysql result resource) Beauford.2002 wrote: Thanks for the info, but maybe I didn't give enough info. I have a mysql database with up to 10 rows and 5 fields in each row.. I have been reading up on some of the array functions, but haven't been able to get anything to work. TIA - Original Message - From: Weston Houghton [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Thursday, December 26, 2002 6:19 PM Subject: Re: [PHP] Nested Arrays Sure... for the longwinded approach, just do this: $row1 = array(col1, col2, col3, ...); $row2 = array(col1, col2, col3, ...); $row3 = array(col1, col2, col3, ...); $row4 = array(col1, col2, col3, ...); $row5 = array(col1, col2, col3, ...); $main_array = array($row1, $row2, $row3, $row4, $row5); Obviously these could include key-value pairs in the arrays as well. Then to prove it to yourself: print_r($main_array); Cheers, Wes On Thursday, December 26, 2002, at 06:14 PM, Beauford.2002 wrote: Hi, Is there anyway to do a nested array, I have looked at the various array functions and can't figure this out (if possible). I want to be able to put each field of a row into an array, and then put that entire row and into another array. so when I display it, I would have: row1 - col1 col2 col3 col4 col5 row2 - col1 col2 col3 col4 col5 row3 - col1 col2 col3 col4 col5 row4 - col1 col2 col3 col4 col5 row5 - col1 col2 col3 col4 col5 etc. (depending on how many rows there are). TIA -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested Arrays
OK, little bit of a brain cramp here. I wasn't clueing in that $tmp=mysql_fetch_array($res) was an array and was trying to do something again that was already there. Thanks for the help. Beauford - Original Message - From: Marek Kilimajer [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Friday, December 27, 2002 11:41 AM Subject: Re: [PHP] Nested Arrays while($tmp=mysql_fetch_array($res)) { // now $tmp is now an array (as the function name suggests) $rows[]=$tmp; // by assigning to $rows[], we make $rows an array, adding array $tmp as the last element } and this makes it multidimensional Beauford.2002 wrote: Great. now can you explain why this works. I'm confused at how PHP knows this is a multidimensional array. I was trying something like $tmp[][]=???. TIA - Original Message - From: Marek Kilimajer [EMAIL PROTECTED] Cc: Beauford.2002 [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED] Sent: Friday, December 27, 2002 8:45 AM Subject: Re: [PHP] Nested Arrays Sorry, now I reminded myself this would cause a false element at the end of $rows, use this: while($tmp=mysql_fetch_array($res)) { $rows[]=$tmp; } Marek Kilimajer wrote: Simple: while($rows[]=mysql_fetch_array($res)) {} ($res is a mysql result resource) -- 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
[PHP] Windows vs Linux
Hi I just installed MySQL and PHP on Windows, and I have found that I am getting all sorts of errors (in both) when I try to use some of the same commands I use in the Linux versions. Are their a lot of differences in the two, and where can I find out what these are - I just got used to using them in Linux TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Windows vs Linux
The php.ini in both are whatever the default settings for these files are. If the defaults are different, then maybe - but I have no idea about these files, and really don't want to get into it. If the default doesn't work on Windows I will just scrap it. Not worth the head aches. Same with MySQL - getting errors as well where I get none in Linux. Thanks for the info - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 14, 2003 4:02 PM Subject: Re: [PHP] Windows vs Linux In a message dated 1/14/2003 12:45:03 PM Pacific Standard Time, [EMAIL PROTECTED] writes: I just installed MySQL and PHP on Windows, and I have found that I am getting all sorts of errors (in both) when I try to use some of the same commands I use in the Linux versions. Are their a lot of differences in the two, and where can I find out what these are - I just got used to using them in Linux There really aren't any differences. Scripts that run on one, run on the other. The differences you are experiencing probably have to do with different settings. For isntance, you might have the error reporting level settings different. Or you might have register_globals set on in one and set off in the other. You need to check your php.ini files and make sure the settings are the same. Janet
[PHP] Windows PHP vs Linux PHP
Hi, I asked previously about the differences between the two and the concensus was any differences are in the operating systems themselves and not with PHP. Knowing this, how do I get rid of these errors that keep coming up in Windows, that don't in Linux. One specific one is Notice: Undefined variable: add in E:\IIS Webs\address.php on line 3 Someone said to turn on register_globals which I have. Another suggestion was to put a @ sign in from of all variables. This is a real pain. Anyone have any other suggestions, or is this basically it? Also, is there anything else that anyone can think of that I may have to look forward to using PHP under Windows? TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Windows vs Linux
Notice: I have given up on PHP and MySQL on Windows in E:\IIS Webs\beauford as it is a total pain in the butt. The simplest of things I try and do are inundated with errors - I fix one and 5 more come up. I have changed settings in php.ini as suggested and put the @ in front of variables and whatever else has been suggested, but alas, nothing. Anyway, thanks for all the help to all those that replied to my questions, but I'll just use Linux as I know it works.
[PHP] Apache 2.0.43 and PHP 4.3.0 on Windows - Problems
Here we go again. I installed Apache and it works fine, I then installed PHP and all tests show it works fine - but when I try to get the PHP modules loaded for Apache in httpd.conf, the Apache server won't start again. The only error I get is a Windows error box that says The requested operation has failed. The event viewer shows: The Apache service named reported the following error: Cannot load E:/Apache2/bin/php4apache.dll into server. The specified module could not be found. Well, the file(s) are in the appropriate place(s) as outlined in the PHP install guide (below). So I'm at a loss as to where to go next. This is a perfect testement as to why not to use Windows.I guess I am just a sucker for punishment. Any help is appreciated. TIA Installing PHP for Apache as module ~~~ Now that version 4.1 introduces a safer sapi module, we recommend that you configure PHP as a module in Apache. To accomplish this, you have to load the php4apache.dll in your Apache httpd.conf. !! NOTE !! Whereever you load php4apache.dll from, php4apache.dll also needs the php4ts.dll also included in the PHP4 distribution. php4apache.dll depends on php4ts.dll which is loaded as soon as Apache loads php4apache.dll. If php4ts.dll can't be found, you usually get an error like (also see the Problems? section at the end of the file): Cannot load c:/php/sapi/php4apache.dll into server So where does php4ts.dll has to be to be properly loaded ? php4ts.dll is searched in the following order: 1) in the directory where apache.exe is start from 2) in the directory where php4apache.dll is loaded from 3) in your %SYSTEMROOT%\System32, %SYSTEMROOT%\system and %SYSTEMROOT% directory. Note: %SYSTEMROOT%\System32 only applies to Windows NT/2000/XP) 4) in your whole %PATH% Note: What is %SYSTEMROOT% ? Depending on your Windows installation this may be for example c:\winnt or C:\windows Usually you would just copy it over to %SYSTEMROOT%\System32. But if you want to have multiple PHP installations (for whatever reason) this is a bad idea. For this circumstance the safest thing is to let php4ts.dll reside in the same directory where php4apache.dll is loaded from (see point 2 above). After you've set up the file layout properly, you're ready to finally configure Apache to load the PHP4 module. Just add the following lines to your httpd.conf: LoadModule php4_module c:/php/sapi/php4apache.dll AddModule mod_php4.c AddType application/x-httpd-php .php Note: Especially newer versions of Apache do not need the AddModule directive anymore, your milage may vary. Where do I have to put the php.ini ? The php.ini files is only searched in two places: 1) in your Apache installation directory (e.g. c:\apache\apache) 2) in your %SYSTEMROOT% directory. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing Variables
Hi, Is there a way to pass a variable to a PHP script without using a form? I want to put several links on my main page that when clicked on goes to a PHP script - depending on what link was selected, will determine what part of the PHP script gets executed. TIA, Beauford -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing Variables
Perfect. Thanks. - Original Message - From: Philip Olson [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 2:22 PM Subject: Re: [PHP] Passing Variables On Sat, 1 Feb 2003, Beauford.2002 wrote: Hi, Is there a way to pass a variable to a PHP script without using a form? I want to put several links on my main page that when clicked on goes to a PHP script - depending on what link was selected, will determine what part of the PHP script gets executed. Yes, use GET: a href=foo.php?fruit=appleeat an apple/a See also if() and switch() http://www.php.net/else http://www.php.net/switch http://www.php.net/variables.external print $_GET['fruit']; Regards, Philip -- 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
[PHP] Forms Question
Hi, Im trying to figure out the best way to do the following. I need to have a series of forms that when the user finishes the first part of the form he is sent to another page where a second form is filled out, and then a third. Making the forms etc. is no problem, what I'm not sure of is how to keep the data from all forms so it can be displayed at the end. I don't want to have anything written to the users drive, or to the server - so this information would have to be kept in memory. Would an array work in this situation? Any ideas are appreciated. TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms Question
Yep, Definitely need help. I tried option 1, but for some reason the variables are not being passed - and this is messy and not really one I want to use. Option 3 sounds like the cleanest, but I am not 100% familiar with sessions - I have used this on another page with a counter so the counter doesn't get run up on every refresh, and I am sure this is similar, but I would need some further help on how to pass the information from one page to the next. Any help is appreciated.. - Original Message - From: Chris McCluskey [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED] Sent: Saturday, February 15, 2003 1:25 PM Subject: RE: [PHP] Forms Question Hey there, Maintaining state in a web application is always a difficult thing.. fortunatly, you use PHP, which makes it a bit easier. However, if you do not want anything written to the server or to the user's drive you are out of luck, simply because at very least you will need to have the user download your HTML which will be written to the hard drive for caching. There are a few ways of doing making this work: 1) Store the form values from the previous form stored in hidden form fields on each page of the form, such as the fields the user filled out on form1 will be stored as hidden form fields on form2, the fields from form1 and form2 will be stored in hidden fields on form3, etc.. This is not the cleanest way, but as far as crossplatforming goes, it's one of the best. 2) Use a cookie to store the form fields. YUCK! Cookies have many good applications, but they are usually disabled on the user's browser as they have been miss used in the past. of course, this goes against your rule of keeping things from being written on the user's harddrive. 3) Finally, you could use sessions. The cleanest way i would think to pass variables from one form to another is to create an object in PHP that contains the fields in the form as variables. Pass that object from form to form, adding the information the application recieves from the user into the object at each form submit. That way, all you have to do is to pass the sessionid from page to page. How do you do that you ask? 2 ways: 1) you could save it in a cookie (this is the default way of passing sessionids in PHP), 2) OR you can use a really cool thing PHP does and turn URL-rewriting on in the php.ini file. This will automatically rewrite all the urls you have on your page to append the ?SESSIONID=id at the end and include the sessionid as a hidden form field on all your pages. Cool, huh? yeah.. PHP kicks ass. =) If you need more help on how to do this, don't hesitate to ask. good luck! -Chris -Original Message- From: Beauford.2002 [mailto:[EMAIL PROTECTED]] Sent: Sat 2/15/2003 10:02 AM To: PHP General Cc: Subject: [PHP] Forms Question Hi, Im trying to figure out the best way to do the following. I need to have a series of forms that when the user finishes the first part of the form he is sent to another page where a second form is filled out, and then a third. Making the forms etc. is no problem, what I'm not sure of is how to keep the data from all forms so it can be displayed at the end. I don't want to have anything written to the users drive, or to the server - so this information would have to be kept in memory. Would an array work in this situation? Any ideas are appreciated. TIA -- 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
[PHP] Forms Help (continued)
Has anyone seen or used this script? It looks fairly straight forward, but I can't get it to work. It is however, exactly what I need. Any help is appreciated. http://codewalkers.com/tutorials.php?show=28page=1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms Help (continued)
I wish to get this script to work. If you can help it would be appreciated, whether you personally like them or not. If it works, I don't care if it was coded by Bugs Bunny. TIA - Original Message - From: Kevin Waterson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, February 15, 2003 11:34 PM Subject: Re: [PHP] Forms Help (continued) This one time, at band camp, Beauford.2002 [EMAIL PROTECTED] wrote: Has anyone seen or used this script? It looks fairly straight forward, but I can't get it to work. It is however, exactly what I need. Any help is appreciated. http://codewalkers.com/tutorials.php?show=28page=1 I never use anything from codewankers or sites like it. What is it you wish to do? Kevin -- __ (_ \ _) ) | / / _ ) / _ | / ___) / _ ) | | ( (/ / ( ( | |( (___ ( (/ / |_| \) \_||_| \) \) Kevin Waterson Port Macquarie, Australia -- 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] Forms Help (continued)
Globals are turned on - Original Message - From: Ray Hunter [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Sunday, February 16, 2003 12:15 AM Subject: Re: [PHP] Forms Help (continued) Do you have globals turned on or off? Ray On Sat, 2003-02-15 at 21:19, Beauford.2002 wrote: Has anyone seen or used this script? It looks fairly straight forward, but I can't get it to work. It is however, exactly what I need. Any help is appreciated. http://codewalkers.com/tutorials.php?show=28page=1 -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] List problem
Does anyone else get bounced messages saying they can't send email to [EMAIL PROTECTED] when sending email to the list? Every email I send to the list I get this. I don't get this when sending email to anyone else or any other list. TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Creating a file to write to?
Hi, I want to be able to check to see if a file exists and if so I want to be able to overwrite it. If it doesn't exist I want to be able to create it and then make sure it is writable. A lot of this I have found in the PHP manual, but I can't find anywhere on how to just create the file or overwrite it if it exists. Thanks for any help... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sorting a file
I have the file below which I need to sort by player and then rewrite it, this file will then be used as part of another part of my input process on my site. A couple of things. I am able to read the file into an array using 'file', I think, but I am not able to sort it. I have tried different variatons of 'sort' and it doesn't do it properly. One other question though, when I display the contents of the array in my browser, I only get the players name and not the Option VALUE=?, I am assuming this is because of the way IE has interpreted it and that the entire line did actually get read, but who knows. Any help is appreciated. Option VALUE=1Bonk Option VALUE=3Alfredsson Option VALUE=4Neil Option VALUE=5Chara Option VALUE=7Lalime Option VALUE=15Hossa Option VALUE=18Phillips Option VALUE=20Redden Option VALUE=21Havlat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sorting a file
Yep, that did it. Thanks. - Original Message - From: Ernest E Vogelsinger [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Friday, February 28, 2003 10:50 AM Subject: Re: [PHP] Sorting a file At 16:41 28.02.2003, Beauford.2002 spoke out and said: [snip] I have the file below which I need to sort by player and then rewrite it, this file will then be used as part of another part of my input process on my site. A couple of things. I am able to read the file into an array using 'file', I think, but I am not able to sort it. I have tried different variatons of 'sort' and it doesn't do it properly. One other question though, when I display the contents of the array in my browser, I only get the players name and not the Option VALUE=?, I am assuming this is because of the way IE has interpreted it and that the entire line did actually get read, but who knows. Option VALUE=1Bonk Option VALUE=3Alfredsson Option VALUE=4Neil Option VALUE=5Chara Option VALUE=7Lalime Option VALUE=15Hossa Option VALUE=18Phillips Option VALUE=20Redden Option VALUE=21Havlat [snip] Try something like this (untested): $array = file($infile); // exchange the option and name parts // option value=somethingName // will become // Nameoption value=something $array = preg_replace('/(.*?)(.*)/', '$2$1', $array); // now sort the array $array = sort($array); // exchange the parts back $array = preg_replace('/(.*?)(.*)/', '$2$1', $array); // and finally save it to a file though, when I display the contents of the array in my browser, I only get the players name and not the Option VALUE=?, I am assuming this is because of the way IE has interpreted it and that the entire line did actually get read, but who knows. Try echoing using htmlentities(), IE (and all other browsers) will need to eat the option parts - it's a valid html tag (even outside a form) -- O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/ -- 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
[PHP] Arrays and MySQL
Hi, I have an array which I am trying to total but having some problems. Any help is appreciated. Example: This is a hockey team and there are 20 players - I am selecting the goals, assists, and points from each player and then want to have a grand total of all goals, assists, and points. $query = select goals, assists, points from roster; while ($line = mysql_fetch_row($result)) { $totals[] = $line; } I want to total $totals[0][4] through $totals[19][4], $totals[0][5] through $totals[19][5], etc. for each stat. I thought of putting them in a for loop and just adding them, but this seemed kind of messy and the long way around Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Arrays and MySQL
It gets a little more complicated than this. There are several teams (each with 20 players) and then there is the team owner and then there is the player position, etc. So to do this I would have to do some kind of a join and so on - and to date haven't been able to figure this out with sums. I would also have to do a second query (I am already doing one to get the points for each player), so I might as well just use it and through the results in an array and then total it from there - and thus my question of how I total the array - Original Message - From: Marek Kilimajer [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Sunday, March 02, 2003 11:10 AM Subject: Re: [PHP] Arrays and MySQL Cannot you just make MaSQL count it? $query = select sum(goals), sum(assists), sum(points) from roster; Beauford.2002 wrote: Hi, I have an array which I am trying to total but having some problems. Any help is appreciated. Example: This is a hockey team and there are 20 players - I am selecting the goals, assists, and points from each player and then want to have a grand total of all goals, assists, and points. $query = select goals, assists, points from roster; while ($line = mysql_fetch_row($result)) { $totals[] = $line; } I want to total $totals[0][4] through $totals[19][4], $totals[0][5] through $totals[19][5], etc. for each stat. I thought of putting them in a for loop and just adding them, but this seemed kind of messy and the long way around Thanks -- 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] Arrays and MySQL
You can use array_sum(). I have used that in the past, but only on single arrays, I can't figure out how to do on multi-level arrays, and since I need to have different totals from different levels of the array, I don't think this will work. If you can shed some light on this it would be appreciated. From below - $totals[0][4] through $totals[19][4] , $totals[0][5] through $totals[19][5], etc. - Original Message - From: Jason Wong [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, March 02, 2003 4:53 PM Subject: Re: [PHP] Arrays and MySQL On Sunday 02 March 2003 23:34, Beauford.2002 wrote: Hi, I have an array which I am trying to total but having some problems. Any help is appreciated. Example: This is a hockey team and there are 20 players - I am selecting the goals, assists, and points from each player and then want to have a grand total of all goals, assists, and points. $query = select goals, assists, points from roster; while ($line = mysql_fetch_row($result)) { $totals[] = $line; } I want to total $totals[0][4] through $totals[19][4], $totals[0][5] through $totals[19][5], etc. for each stat. I thought of putting them in a for loop and just adding them, but this seemed kind of messy and the long way around You can use array_sum(). -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Man's unique agony as a species consists in his perpetual conflict between the desire to stand out and the need to blend in. -- Sydney J. Harris */ -- 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
[PHP] Code Validator
Hi, Is there a code validater for HTML/PHP. I have one for just HTML, but once you introduce PHP it doesn't work. TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A NAME= question
Not sure if this is a PHP or HTML problem, so I have posted it to both lists. I have a table with with 5 itmes in which I want to click on and go to a different part of the page. TDA HREF=#1Click 1/A/TD TDA HREF=#2Click 2/A/TD TDA HREF=#3Click 3/A/TD TDA HREF=#4Click 4/A/TD TDA HREF=#5Click 5/A/TD Now this is where it gets interesting. I have a PHP script which loops 5 times. for ($i = 1; $i 6; $i++) { A NAME = $i Destination/A A bunch of of other code. } When I look at the source from my browser everything looks the way it should be. I get A NAME=1, A NAME=2, etc. The problem is that when I click on the link it does nothing. I get the little click noise, but that's it. Any ideas on this would be appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A NAME= question
Thanks for the info, but the # is not used in this way from the information I have read. a name=anchor_name . . . /a Define a target location in a document a href=#anchor_name . . . /a Link to a location in the base document, which is the document containing the anchor tag itself, unless a base tag has been specified. - Original Message - From: Richard Baskett [EMAIL PROTECTED] To: PHP General [EMAIL PROTECTED] Sent: Tuesday, March 04, 2003 5:29 PM Subject: Re: [PHP] A NAME= question for ($i = 1; $i 6; $i++) { echo a name=\#{$I}\Destination/a\n; } You forgot the # sign. Cheers! Rick Happiness is not a destination. It is a method of life. - Burton Hills From: Beauford.2002 [EMAIL PROTECTED] Date: Tue, 4 Mar 2003 17:21:20 -0500 To: HWG Basics [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Subject: [PHP] A NAME= question Not sure if this is a PHP or HTML problem, so I have posted it to both lists. I have a table with with 5 itmes in which I want to click on and go to a different part of the page. TDA HREF=#1Click 1/A/TD TDA HREF=#2Click 2/A/TD TDA HREF=#3Click 3/A/TD TDA HREF=#4Click 4/A/TD TDA HREF=#5Click 5/A/TD Now this is where it gets interesting. I have a PHP script which loops 5 times. for ($i = 1; $i 6; $i++) { A NAME = $i Destination/A A bunch of of other code. } When I look at the source from my browser everything looks the way it should be. I get A NAME=1, A NAME=2, etc. The problem is that when I click on the link it does nothing. I get the little click noise, but that's it. Any ideas on this would be appreciated. -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Part PHP part MySQL question
Hi, I have a hockey database with players names in it and I want to be able to update their stats one after the other. To be more clear - when the page is first entered I want the first players name to automatically appear showing his current stats (this will be in a form). Then you can update the record and write it back to the database, then the next player will show up with his stats showing, and the process continues until all the players have been done. Setting up the database and forms is no problem, but I'm not sure how I would keep count of what player has been done so the next one automatically appears (and if there should be a power failure orWindows crashes, or whatever else - I want the process to start at the last player being updated - I don't want to have to start again from player one). I'm not sure if this is more a PHP or MySQL question - or both - so I have sent it to both lists. Thanks Beauford -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can someone explain this? include problem.....?
Hi, I have a php script which does some stuff and at the end of the file I have it include a file which has a form in it. The problem I am having is that it is missing code. If you go down to the second input - it has a value=0 field - this does not show up when I view the source from my browser. The first input value= works fine. Anyone have any ideas on this.TIA i.e. ? php stuff; include(theform.inc); ? This is theform.inc.. FORM ACTION=stats-write.php action=post name=update INPUT TYPE=hidden name=FromPosted value=TRUE TABLE ALIGN=center WIDTH=200 TRTD COLSPAN=2HR SIZE=3 COLOR=#63687B/TR/TD /TD/TR TRTD ID=WD CLASS=mainPlayer:/TD TD ALIGN=right ID=WD input type=text name=player SIZE=10 value=? echo $line['player']; ? /TD/TR TRTD COLSPAN=2HR SIZE=3 COLOR=#63687B/TR/TD TRTD ID=WD CLASS=mainGoals:/TD TD ALIGN=right ID=WD input type=text name=goals SIZE=5 value0 /TD/TR TR HEIGHT=5TD ID=WD/TD TRTD COLSPAN=2HR SIZE=3 COLOR=#63687B/TD/TR TD ALIGN=center colspan=2 input type=submit value=Update name=submit /TD/TR/TABLE /FORM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can someone explain this? include problem.....?
Sorry, the line I was actually referring to is the one below. I forgot the hidden one was even there and serves no purpose and does not resolve the problem by removing it. This works: input type=text name=player SIZE=10 value=? echo $line['player']; ? It also works if I just hardcode a value (value=Bob) This doesn't: input type=text name=goals SIZE=5 value0 They are both exactly the same other than the way they get their values, so I don't see a reason why I'm losing part of the second input line. Just to be clear, when I view the souce code I see this: input type=text name=goals SIZE=5 The value= has been stripped from the code Thanks - Original Message - From: Chris Hayes [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, March 09, 2003 4:32 PM Subject: Re: [PHP] Can someone explain this? include problem.? At 22:15 9-3-2003, you wrote: Hi, I have a php script which does some stuff and at the end of the file I have it include a file which has a form in it. The problem I am having is that it is missing code. If you go down to the second input - it has a value=0 field - this does not show up when I view the source from my browser. The first input value= works fine. have a closer look at it!! compare your first line: INPUT TYPE=hidden name=FromPosted value=TRUE to the failing line: input type=text name=goals SIZE=5 value0 I'm sure you can see it :) -- 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
[PHP] array_sum help
Hi, I have a mysql database in which some values are loaded into an array - the problem is that some fields may contain zeros. The problem is the following. If there happens to be zeros in certain column's (which there will be from time to time) then I get this error. How do I get around this? Funny thing about this is I have the exact same thing duplicated on my Windows PC and it doesn't cause this problem. (the problem one is on Linux which is the production one). All versions of mysql, PHP, apache are the same on both. Note that as soon as I put in a number it works fine. Warning: The argument to array_sum() should be an array in /usr/local/apache/htdocs/main/viewstats.php on line 154 TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Redirect to a new page?
Hi, I have searched around for hours on this and nothing seems to work. I want simply to do this if yes - goto thispage.php if no - goto thatpage.php Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect to a new page?
Figured it out echo Script Lang=javascript; echo window.location.href = 'viewpostats.php'; echo /script; - Original Message - From: Leif K-Brooks [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, March 13, 2003 2:20 PM Subject: Re: [PHP] Redirect to a new page? if(something){ header(Location: {$_SERVER['HTTP_HOST']}/thispage.php); }else{ header(Location: {$_SERVER['HTTP_HOST']}/thatpage.php); } Beauford.2002 wrote: Hi, I have searched around for hours on this and nothing seems to work. I want simply to do this if yes - goto thispage.php if no - goto thatpage.php Thanks -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- 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
[PHP] Authentication
Hi, I am looking for a simple authentication script that uses MySQL. I have downloaded about 10 of them (most with no instructions on it's use), but even at that they are not what I need. When you go to the main page of my site it will ask you to login or signup. So I want to be able to authenticate the user if he logs in (not to much of a problem here, but I want to protect all pages (I don't want to use cookies as not everyone has these enabled). What other options do I have? If anyone knows a small script that can be modified, or point me in the right direction of how to do this, it would be appreciated. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and IIS 5.0
Hi, I am putting together a website for a customer who insists on using IIS running on Windows XP and I'm running into some problems. It appears that no matter what PHP script I run, I'm getting tons of errors saying this variable or that variable is undefined. I have global variables turned on in the php.ini file - so I'm not sure what would be causing the problem (other than it is a Microsoft product). The same scripts work perfectly on my Linux box running Apache. Any help is appreciated. BTW - thanks to those that answered previous questions regarding authentication. B. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and IIS - More info
These are some of the errors I am getting Notice: Undefined index: login in C:\Inetpub\wwwroot\..\login\checklogin.php on line 74 and 75, and other similar errors. Line 74 is: $login = $HTTP_SESSION_VARS['login']; Line 75 is: $password = $HTTP_SESSION_VARS['password']; Another one is: echo $HTTP_ENV_VARS[QUERY_STRING]; Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and IIS 5.0
I have it running on Windows XP using Apache and Linux using Apache with perfect results - It does not work on IIS, which tells me this is a IIS problem, not a coding problem or an error reporting problem - register_globals are on on all three platforms. Thanks - Original Message - From: CPT John W. Holmes [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 11:21 AM Subject: Re: [PHP] PHP and IIS 5.0 I am putting together a website for a customer who insists on using IIS running on Windows XP and I'm running into some problems. It appears that no matter what PHP script I run, I'm getting tons of errors saying this variable or that variable is undefined. I have global variables turned on in the php.ini file - so I'm not sure what would be causing the problem (other than it is a Microsoft product). The same scripts work perfectly on my Linux box running Apache. Read all about it here... http://www.php.net/manual/en/ref.errorfunc.php Either fix your code or adjust the error_reporting level. Actually, it could be a register_globals problem also. They are off by default, so you may need to re-write your code or turn them on in php.ini. ---John Holmes... -- 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] PHP and IIS - More info
Further note that it is not just this script, but many PHP scripts that I run on IIS - they all work perfectly on Apache (on Windows and Linux).. - Original Message - From: John W. Holmes [EMAIL PROTECTED] To: 'Beauford.2002' [EMAIL PROTECTED]; 'PHP General' [EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 12:21 PM Subject: RE: [PHP] PHP and IIS - More info These are some of the errors I am getting Notice: Undefined index: login in C:\Inetpub\wwwroot\..\login\checklogin.php on line 74 and 75, and other similar errors. Line 74 is: $login = $HTTP_SESSION_VARS['login']; Line 75 is: $password = $HTTP_SESSION_VARS['password']; Another one is: echo $HTTP_ENV_VARS[QUERY_STRING]; There is no 'login' or 'password' index in the $HTTP_SESSION_VARS array. How are you registering these variables? Try using the new method with $_SERVER. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- 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] PHP and IIS - More info
PHP and MySQL, which I am using in this project are the same on all three platforms - the only difference is IIS - which is why I think it is a IIS problem. Problems, Problems... - Original Message - From: Chris Hewitt [EMAIL PROTECTED] To: 'PHP General' [EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 2:40 PM Subject: Re: [PHP] PHP and IIS - More info Beauford.2002 wrote: Further note that it is not just this script, but many PHP scripts that I run on IIS - they all work perfectly on Apache (on Windows and Linux).. As well as configuration differences it could be different versions of php. Modern ones expect $_SERVER for example. I might like to blame IIS for a lot of things, but I think you will probably find its not. HTH Chris -- 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] - IIS - More info
After many grueling hours of screwing around with this, it's working. Not sure of the exact problem - but for those that want to knowI uninstalled PHP and cleaned the registry of any remnents of PHP and then installed PHP manually (instead of using the PHP installer). Then I had to tweak the php.ini file to set the global variables and session data directory and add a few extensions etc. A few things also had to be changed in the IIS settings so it would recognize the php extension and a couple of other things. After that IIS was restarted and voila - these scripts now work. So it appears the problem was a combination of php and the way it was installed, and a few settings in IIS that weren't there. I guess the PHP installer doesn't do these things automatically. Thanks to all those that replied, as some of your answers eventually lead to me reinstalling PHP. If I was snarky to anyone, I also apologize as this was out of frustration. B. - Original Message - From: Diego Fulgueira [EMAIL PROTECTED] To: PHP Windows [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED]; Beauford.2002 [EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 2:22 PM Subject: [PHP] - IIS - More info Did you checked my last message? Was it helpful? PHP under Apache exposes diferent global variables than PHP under IIS. It will be impossible for you to correct your errors without changing your code. Run phpinfo() to see what variables are available under IIS. About session variables... I suggest you use the $_SESSION array instead of $HTTP_SESSION_VARS. Also, check your session_path (defined in php.ini, which should be under /WINNT). session_path should point to a directory where user IUSR_MYHOST has writing permissions. There, you should see a file created for each session. Open this file in notepad and you should find names of session variables and their values. If all this is correct, check what session cookies is sending your browser to the server (Netscape is very suitable for doing this). PHPSESSID should be one of them, if not, you are not registering your session correctly. Cheers. - Original Message - From: Beauford.2002 [EMAIL PROTECTED] To: [EMAIL PROTECTED]; 'PHP General' [EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 12:44 PM Subject: Re: [PHP] PHP and IIS - More info Further note that it is not just this script, but many PHP scripts that I run on IIS - they all work perfectly on Apache (on Windows and Linux).. - Original Message - From: John W. Holmes [EMAIL PROTECTED] To: 'Beauford.2002' [EMAIL PROTECTED]; 'PHP General' [EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 12:21 PM Subject: RE: [PHP] PHP and IIS - More info These are some of the errors I am getting Notice: Undefined index: login in C:\Inetpub\wwwroot\..\login\checklogin.php on line 74 and 75, and other similar errors. Line 74 is: $login = $HTTP_SESSION_VARS['login']; Line 75 is: $password = $HTTP_SESSION_VARS['password']; Another one is: echo $HTTP_ENV_VARS[QUERY_STRING]; There is no 'login' or 'password' index in the $HTTP_SESSION_VARS array. How are you registering these variables? Try using the new method with $_SERVER. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- 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 -- 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
[PHP] PHP and file extensions
Still working on this authentication script and have a small question. Each page on the site needs to have one line of code on it so it can't be accessed unless you log in - is there a way to have this line in an html file without changing the extension to .php? On the same note, there is a small script called Zoom Version 1.7.0 which is a search engine that search's for content on your site, but the way they are doing this alludes me. In the search.htm file there is a line - !--ZOOMSEARCH-- - which somehow inserts the results of your search. In the results.php file this is the relevant code, but I'm not quite sure what's going on here. Any comments are appreciated. //Open and print start of result page template $template = file ('search.htm'); $numtlines = count ($template); //Number of lines in the template $line = 0; while (! stristr ($template[$line], !--ZOOMSEARCH--) $line $numtlines) { echo $template[$line]; $line++; } $line++; //Replace the key text !--ZOOMSEARCH-- with the search result -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and file extensions
What about IIS. This is what the customer is usingand I know d*** about IIS. I would assume that there is a similar thing for IIS, but have no idea where to even look. - Original Message - From: Chris Hewitt [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Thursday, March 20, 2003 4:28 AM Subject: Re: [PHP] PHP and file extensions Beauford.2002 wrote: accessed unless you log in - is there a way to have this line in an html file without changing the extension to .php? Yes, but you need to tell Apache (in the AddType line in httpd.conf) to parse all .html files with php. This has a performance implication for ordinary .html files. HTH Chris -- 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
[PHP] Sessions question
I have read some posts to this list on sessions and have read as much as I can find on them, but one problem still exists which I can't figure out. How do I kill the session when the user leaves my site. So if a user is on www.mine.com and logs in successfully, then goes to www.hers.com - the user should have to log in again once coming back to www.mine.com, but at present the user is still logged in - and all variables are still set. Any help is appreciated. TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions question
What about HTTP_REFERER - is there someway I could incorporate it to so if the user didn't come from xxx (a page on my site) then kill the session and redirect him to the login page... - Original Message - From: Jason Wong [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, March 21, 2003 1:34 AM Subject: Re: [PHP] Sessions question On Friday 21 March 2003 13:57, Beauford.2002 wrote: I have read some posts to this list on sessions and have read as much as I can find on them, but one problem still exists which I can't figure out. How do I kill the session when the user leaves my site. There is simply no way to tell when a user 'leaves' your site. PHP automatically cleans up sessions that have been idle for some time (see php.ini). So if a user is on www.mine.com and logs in successfully, then goes to www.hers.com - the user should have to log in again once coming back to www.mine.com, but at present the user is still logged in - and all variables are still set. The only way to be sure someone has logged out is to present them with a logout link which when clicked will clear the session. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* I would much rather have men ask why I have no statue, than why I have one. -- Marcus Procius Cato */ -- 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] Sessions question
What about cookies - someone said if you put no time limit on a cookie it dies when you leave the site - I'm not sure about this, but any help is appreciated. - Original Message - From: Justin French [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED] Sent: Friday, March 21, 2003 2:46 AM Subject: Re: [PHP] Sessions question on 21/03/03 4:57 PM, Beauford.2002 ([EMAIL PROTECTED]) wrote: I have read some posts to this list on sessions and have read as much as I can find on them, but one problem still exists which I can't figure out. How do I kill the session when the user leaves my site. So if a user is on www.mine.com and logs in successfully, then goes to www.hers.com - the user should have to log in again once coming back to www.mine.com, but at present the user is still logged in - and all variables are still set. How can PHP possibly tell when the user closes a window, or manually enters a new URL into the browser? It can't because PHP is only server side. Set the appropriate session max lifetime and garbage clean out probability, and sessions should die within a reasonable time of not being used (see php.ini for more info). Or, present the user with a logout link, to be sure the session is killed instantly. You can also do some *extra* insurance by creating a javascript pop-up triggered on a window close event which forces a log out, but this will only help in some cases, and more to the point, client-side scripting cannot be relied upon. If you want to kill sessions as people click on external links within your site, you can do so by creating a middle-man script between your page and the external site: Instead of a href='http://newsite.com'click/a you would do this: a href='out.php?url=?=urlencode('http://newsite.com')?'click/a out.php would be responsible for killing the session before doing a header() redirect to the target url. But, end of the day, all these are work-arounds. Offer a logout link on every page of your site. If the user chooses not to logout, then they are consciously making this decision -- they may want to come back shortly, or they may not care about the security implications -- either way, it's their call. Justin -- 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] Sessions question
So is there anyway to do this - perl, javascript, voodo? - Original Message - From: Ford, Mike [LSS] [EMAIL PROTECTED] To: 'Justin French' [EMAIL PROTECTED]; Beauford.2002 [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED] Sent: Friday, March 21, 2003 11:04 AM Subject: RE: [PHP] Sessions question -Original Message- From: Justin French [mailto:[EMAIL PROTECTED] Sent: 21 March 2003 15:59 on 22/03/03 2:27 AM, Beauford.2002 ([EMAIL PROTECTED]) wrote: What about cookies - someone said if you put no time limit on a cookie it dies when you leave the site - I'm not sure about this, but any help is appreciated. I think it's defined as when the browser is closed, not when the browser is no longer in your domain That is correct. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions question
I don't quite understand this. If a user is on my site and then decides to go into his favourites and go to yahoo.com - this won't work. I think you are assuming the user is going to click on something I have set up - I want this to be invisible - however this user decides to leave my site. It appears though from the answers I have received - that this is not possible B. - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: PHP General [EMAIL PROTECTED] Sent: Friday, March 21, 2003 4:21 PM Subject: Re: [PHP] Sessions question This is one of those rare things in programming that can only be done one way. Absolutely the only way to kill the session when a user leaves your site is to go through a script and then redirect after the session has been destroyed. For this to work every outgoing link on your website will have to point to a script. Then you'll pass the redirect url or url id (that referse to a url in your database) through the link and redirect after session_destroy() has killed the session. The link can look like this: a href=exit.php?url=http://www.thiersite.com;www.theirsite.com/a The script will look something like this: ? // exit.php session_start(); session_destroy(); header(Location: .$_POST['url']); ? Keep in mind if you want to do this then the user will not be able to use his/her back button in order to return to your website unless you define an additional redirect in a conditional that states if the session is not active then go here. Voodoo. *LOL* - Kevin - Original Message - From: Beauford.2002 [EMAIL PROTECTED] To: Ford, Mike [LSS] [EMAIL PROTECTED]; 'Justin French' [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED] Sent: Friday, March 21, 2003 12:56 PM Subject: Re: [PHP] Sessions question So is there anyway to do this - perl, javascript, voodo? - Original Message - From: Ford, Mike [LSS] [EMAIL PROTECTED] To: 'Justin French' [EMAIL PROTECTED]; Beauford.2002 [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED] Sent: Friday, March 21, 2003 11:04 AM Subject: RE: [PHP] Sessions question -Original Message- From: Justin French [mailto:[EMAIL PROTECTED] Sent: 21 March 2003 15:59 on 22/03/03 2:27 AM, Beauford.2002 ([EMAIL PROTECTED]) wrote: What about cookies - someone said if you put no time limit on a cookie it dies when you leave the site - I'm not sure about this, but any help is appreciated. I think it's defined as when the browser is closed, not when the browser is no longer in your domain That is correct. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, 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 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions question
Why? You wouldn't even know it happened - nor would the site. This is just a security precaution. - Original Message - From: Jason Wong [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, March 22, 2003 2:25 AM Subject: Re: [PHP] Sessions question On Saturday 22 March 2003 08:09, Beauford.2002 wrote: I don't quite understand this. If a user is on my site and then decides to go into his favourites and go to yahoo.com - this won't work. I think you are assuming the user is going to click on something I have set up - I want this to be invisible - however this user decides to leave my site. It appears though from the answers I have received - that this is not possible You're right it is not possible and quite rightly so. I wouldn't want a site to know when I have 'left' their site. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Lee's Law: Mother said there would be days like this, but she never said that there'd be so many! */ -- 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
[PHP] PHP and IIS
I just installed Win2k server and IIS (need it for a project I am doing) and get the following error after installing PHP. All permissions are set correctly. This appears to be a common problem as a search comes up with hundreds of the same problem - funny though - no answers. Any help is appreciated. Technical Information (for support personnel) a.. Background: You have attempted to execute a CGI, ISAPI, or other executable program from a directory that does not allow programs to be executed. b.. More information: Microsoft Support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and IIS
I'm an Apache user - I had runscripts on for the main server, but I had a virtual host which did not - I assumed incorrectly that the virtual would inherit the other settings. I was wrong. B. - Original Message - From: Burhan Khalid [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Sent: Saturday, March 22, 2003 9:32 PM Subject: Re: [PHP] PHP and IIS Hello Beauford.2002, Saturday, March 22, 2003, 6:03:38 PM, you wrote: B2 I just installed Win2k server and IIS (need it for a project I am doing) and B2 get the following error after installing PHP. All permissions are set B2 correctly. This appears to be a common problem as a search comes up with B2 hundreds of the same problem - funny though - no answers. B2 Any help is appreciated. In the IIS properties -- make sure you have run scripts enabled for the folder in question. -- Best regards, Burhan mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] reloading a page..
Not sure why things like this are so difficult. I have an authentication script which allows users access to certain pages based on their user level. If they click on a link to go to a page their not allowed to, I want to be able to just reload the page their on and display a message saying they are not authorized to view that page - do you think I can get the page to reload.I've tried the header thing (but can't because headers are already sent), I've tried playing around with $PHP_SELF with no luck, I've looked for javascripts with no luck. Anyone have any ideas? TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reloading a page..
One other problem is that I need to know the page the came from in order to reload it. i.e. if they try to access a restricted page from six.html I want to reload six.html - if they try from eight.html then eight.html needs to be reloaded. - Original Message - From: David Otton [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Sunday, March 23, 2003 12:37 PM Subject: Re: [PHP] reloading a page.. On Sun, 23 Mar 2003 12:15:25 -0500, you wrote: Not sure why things like this are so difficult. I have an authentication script which allows users access to certain pages based on their user level. If they click on a link to go to a page their not allowed to, I want to be First, why are the pages they can't access displayed as active links? able to just reload the page their on and display a message saying they are not authorized to view that page - do you think I can get the page to You don't need to reload the page. At the top of each page, put your check routine. if (access_granted == FALSE) { show_access_denied_message; exit; } show_regular_page; reload.I've tried the header thing (but can't because headers are already sent), Either rewrite your page so the security check comes before any output is sent, or use the output buffering functions (ob_start(), etc) I've tried playing around with $PHP_SELF with no luck, I've That's passed to the script from its environment... changing it will have no effect on the script's environment. looked for javascripts with no luck. Anyone have any ideas? You can't rely on Javascript for security. -- 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] reloading a page..
The link in question is there by design and should be there, but below is what I am talking about. Even better, if a user cannot be validated then you can redirect them back to where they came from (referrer). That would effectively achive your goal by refreshing the original page no matter where they;re coming from. This is what I have, but no matter what I do I can not get a message to appear on the referring page saying you have no access to the other page, and I have also read that 'HTTP_REFERER' is not very reliable if($userlevel != $neededlevel) { include ($_SERVER['HTTP_REFERER']); $message = $no_permission; $exit; } ...on referring page ? if ($message) { echo $message; } ? - Original Message - From: Leo Spalteholz [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, March 23, 2003 2:06 PM Subject: Re: [PHP] reloading a page.. On March 23, 2003 10:22 am, Beauford.2002 wrote: One other problem is that I need to know the page the came from in order to reload it. i.e. if they try to access a restricted page from six.html I want to reload six.html - if they try from eight.html then eight.html needs to be reloaded. Firstly, as David mentioned, if the user is not allowed to access the page then the link shouldn't be there in the first place. If there is no link then there is no need to refresh the page or generate an error or anything. If you really want to you can have the link but instead of an href to the page you would replace it with a Javascript alert saying access denied. But thats beside the point because if they enter the restricted page into the address bar directly it also has to deny them access. You should write a script that checks the users credentials and then include it at the top of EVERY page. If the user can no be validated then an access denied message is displayed. Even better, if a user cannot be validated then you can redirect them back to where they came from (referrer). That would effectively achive your goal by refreshing the original page no matter where they;re coming from. Leo -- 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
[PHP] PHP has encountered a Stack overflow
Where can I find information on this (all my searches come up in non-English). This script was working fine until I changed the directory it was in - since I moved it I get this error. TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Include Question
Hi, First, I fixed my other problem of the stack overflow by moving the files back to the root directory (although I would rather have them in a login directory). Anyway, I have a question regarding the include function. I have a login script in a file called login.php - in this file it includes checklogin.php and loginerrors.php. If the user inputs an incorrect login I assign $messages the appropriate error from loginerrors, then I re-include login.php where I want to show the error message, but no matter what I do the error message will not show up. Example. Login.php Enter your Name: Enter Your Password: if ($message) { echo $message; } Checklogin.php if (!$name || !password) { $message = $enter_info; include (login.php); exit; } Any help is appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include Question
Just a typo, but now I have other problems as well which I think have to do with paths and includes. If I am in the root directory on page main.html and click on a link that is in /other - because this is a restricted page I include main.html with an error (which right now doesn't display) - but now the paths are all screwed up. If I click on the same link again I get file not found. Hope I am explaining this right as this is really getting on my nerves. TIA - Original Message - From: James E Hicks III [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Sent: Thursday, March 27, 2003 4:15 PM Subject: RE: [PHP] Include Question If checklogin.php is only below, you shouldnn't get those errors. Anyway, is password just a typo below or does your code omit the $ too? if (!$name || !password) { $message = $enter_info; include (login.php); exit; } -Original Message- From: Beauford.2002 [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 4:07 PM To: James E Hicks III Subject: Re: [PHP] Include Question Because I would get the error - headers already sent etc. - Original Message - From: James E Hicks III [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Sent: Thursday, March 27, 2003 3:53 PM Subject: RE: [PHP] Include Question Why not try header(login.php) instead of include? James Hicks -Original Message- From: Beauford.2002 [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 3:47 PM To: PHP General Subject: [PHP] Include Question Hi, First, I fixed my other problem of the stack overflow by moving the files back to the root directory (although I would rather have them in a login directory). Anyway, I have a question regarding the include function. I have a login script in a file called login.php - in this file it includes checklogin.php and loginerrors.php. If the user inputs an incorrect login I assign $messages the appropriate error from loginerrors, then I re-include login.php where I want to show the error message, but no matter what I do the error message will not show up. Example. Login.php Enter your Name: Enter Your Password: if ($message) { echo $message; } Checklogin.php if (!$name || !password) { $message = $enter_info; include (login.php); exit; } Any help is appreciated. -- 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] Session Theft
Can someone explain how this works as I am in the process of doing a login/authentication page and want to make it as secure as possible B. - Original Message - From: Haseeb Iqbal [EMAIL PROTECTED] To: PHP General list [EMAIL PROTECTED] Sent: Friday, March 28, 2003 11:48 PM Subject: [PHP] Session Theft i just want to figure out a way by which i can stop session theft.i thought if i can get something from user end that is unique for that user.for e.g. his/her IP .but it will not work when they are behind firewall.they will be assigned same IP.is there a way for me to get the IP (e.g.202.202.202.202 thats just an e.g. ) plus computer ip(192.168.0.1 e.g.) i saw once a java chat server do this.if we can do this then it will help us (SOMEWHAT). if anyone has better suggestion just let me know Haseeb -- 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
[PHP] Is there a PHP for Dummies?
I'm really tired of trying to figure out the PHP manual and need something that explains things in plain straight forward English. Like get_magic_quotes_gpc() for example - the manual says how to use it and what it returns - but nowhere can I find out what it's for. Does it count sheep, do a quote of the day, or what - maybe I'm just stupid - but in any event I have spent more time in the last two weeks searching for things and getting no answers - Any help in pointing me a good straight forward tutorial/manual would be appreciated. B. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there a PHP for Dummies?
No, the name explains absolutely squat. What is a magic quote? Sounds like something I smoked in the 60's. Maybe to you it makes sense as you know what it does. To me it means absolutely nothing - nor does the PHP manual explain it. B. - Original Message - From: Jennifer Goodie [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED] Sent: Friday, March 28, 2003 5:07 PM Subject: RE: [PHP] Is there a PHP for Dummies? That is a really, really, really poor example. Tha name says it all. It gets the magic quotes setting for gpc(get, post, cookie). You can figure out what most PHP functions do just by looking at their names, that's actually what I like about PHP. -Original Message- From: Beauford.2002 [mailto:[EMAIL PROTECTED] Sent: Friday, March 28, 2003 1:54 PM To: PHP General Subject: [PHP] Is there a PHP for Dummies? I'm really tired of trying to figure out the PHP manual and need something that explains things in plain straight forward English. Like get_magic_quotes_gpc() for example - the manual says how to use it and what it returns - but nowhere can I find out what it's for. Does it count sheep, do a quote of the day, or what - maybe I'm just stupid - but in any event I have spent more time in the last two weeks searching for things and getting no answers - Any help in pointing me a good straight forward tutorial/manual would be appreciated. B. -- 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] Is there a PHP for Dummies?
Thanks to all that responded on this. There are some great examples here that I will definitely look into. BE. - Original Message - From: Kenn Murrah [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED] Sent: Friday, March 28, 2003 5:03 PM Subject: Re: [PHP] Is there a PHP for Dummies? well, B., i've read a LOT of 'em .. it sort of depends on YOUR background as to which is best ... i like Professional PHP Programming from Wrox ... don't bother with Beginning PHP Programming from Wrox ... it'll probably insult your intelligence ... one of the first i ever read, when i was first getting started, was PHP Essentials by Meloni ... simple, but some GOOD examples to study, and when you finish, you'll have a decent foundation for more study .. my current personal favorite is Mastering PHP 4.1 from Sybex ... good writing style, and it covers (obviously) 4.1, which a LOT of books out don't do ... so it eliminates THAT frustration ... HTH kenM - Original Message - From: Beauford.2002 [EMAIL PROTECTED] To: PHP General [EMAIL PROTECTED] Sent: Friday, March 28, 2003 3:53 PM Subject: [PHP] Is there a PHP for Dummies? I'm really tired of trying to figure out the PHP manual and need something that explains things in plain straight forward English. Like get_magic_quotes_gpc() for example - the manual says how to use it and what it returns - but nowhere can I find out what it's for. Does it count sheep, do a quote of the day, or what - maybe I'm just stupid - but in any event I have spent more time in the last two weeks searching for things and getting no answers - Any help in pointing me a good straight forward tutorial/manual would be appreciated. B. -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there a PHP for Dummies?
I found that after the fact, but my question was regarding tutorials, books, or other docs. This was just an example I used. In general I don't find the PHP manual very helpful - I tend to get more out of the users comments than the actual manual.. - Original Message - From: Leif K-Brooks [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, March 28, 2003 9:49 PM Subject: Re: [PHP] Is there a PHP for Dummies? After a quick search of the php manual, I came upon http://www.php.net/manual/en/ref.info.php#ini.magic-quotes-gpc, which says: Sets the magic_quotes state for GPC (Get/Post/Cookie) operations. When magic_quotes are on, all ' (single-quote), (double quote), \ (backslash) and NUL's are escaped with a backslash automatically. Seems to explain it pretty nicely. Beauford.2002 wrote: No, the name explains absolutely squat. What is a magic quote? Sounds like something I smoked in the 60's. Maybe to you it makes sense as you know what it does. To me it means absolutely nothing - nor does the PHP manual explain it. B. - Original Message - From: Jennifer Goodie [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED] Sent: Friday, March 28, 2003 5:07 PM Subject: RE: [PHP] Is there a PHP for Dummies? That is a really, really, really poor example. Tha name says it all. It gets the magic quotes setting for gpc(get, post, cookie). You can figure out what most PHP functions do just by looking at their names, that's actually what I like about PHP. -Original Message- From: Beauford.2002 [mailto:[EMAIL PROTECTED] Sent: Friday, March 28, 2003 1:54 PM To: PHP General Subject: [PHP] Is there a PHP for Dummies? I'm really tired of trying to figure out the PHP manual and need something that explains things in plain straight forward English. Like get_magic_quotes_gpc() for example - the manual says how to use it and what it returns - but nowhere can I find out what it's for. Does it count sheep, do a quote of the day, or what - maybe I'm just stupid - but in any event I have spent more time in the last two weeks searching for things and getting no answers - Any help in pointing me a good straight forward tutorial/manual would be appreciated. B. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session Theft
Aside from SSL (which I wouldn't even know where to begin at this point). Is there not a way to determine what gets sent with the headers or to block the referring address from another site? B. - Original Message - From: Haseeb Iqbal [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 10:04 PM Subject: Re: [PHP] Session Theft the session is created such that a file is created that (the file contains all the variables for that perticular user) referenced by the session id. now consider a situation where the user open a link to external site and that external site is recording all the link where the user is comming from.that is done by $_SERVER['HTTP_REFERER'] (in php). now suppose the user did not closed the session and the external websites author (suppose is not a person with ethics) uses that rederer address.and then what heppens.HE IS IN another persons account.now he can do anything the REAL user can do. now you should have the idea how it can be stolen. now for the security. you can conduct everything over ssl. this is what i got when i posted my message on this list. what i am doing is i am gathering every bit of information from the user.and storing that information along with some extra things this will minimize the risk but it won't completly remove the risk. i am still learning how to master this field.if you get any idea lemme know. regards Haseeb -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with functions()
Hi, I have form that a user would input information and that info is sent to a function, but I need to be able to return a result of this function and is where I am having a problem. For example: testfunction($var1, $var2, $var3, $var4); //the form fills these values. echo $meat; function testfunction($a, $b, $c, $d) { The $meat of the function goes here; Now I need to return the result of $meat; return $meat; } This does not work. I'm new to funtions and obviously missing something, but I haven't been able to find a good tutorial on this. The PHP manual isn't much help. Any help is appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mail() question!
Hi, I have a form where a user enters an email address. The contents of the form are then sent to myself, which works fine. The problem is that the from field says it is from nobody - how can I get it to say it is from the email address the user inputted - or is this possible? TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] More mail() questions.
Hi, Thanks to all who replied to my previous email. One more small problem. I am trying to get the message portion of the email to have line breaks, but whatever I do it displays on one line. This is what I have. $message = First Line\n; $message = First Line\n; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] More mail() questions.
Hi, Sorry, my last email got sent by mistake. I am trying to get the message portion of the email to have line breaks, but whatever I do it displays on one line. This is what I have. $message = 1st Line\n; $message .= 2nd Line\n; $message .= \n; $message .= 3rd Line\n; $message .= \n; $message .= 4th Line\n; mail (, $subject, $message, $headers); TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: More mail() questions.
Thanks for the reply, however, that will not work. The only line breaks you may get with that are those layed out in a text box or from your mail client. What if I have other variables that need to be put in the body of the email. i.e. Age: 16 Height: 168 Weight: 120 etc etc etc. These are variables that the user inputs into a form and need to be on a seperate line, so if I did $message = $age, $weight, $height, etc. they would appear on the same line - I need to have them on separate lines. - Original Message - From: Kyle Gibson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, November 25, 2002 10:54 PM Subject: [PHP] Re: More mail() questions. I am trying to get the message portion of the email to have line breaks, but whatever I do it displays on one line. This is what I have. $message = 1st Line\n; $message .= 2nd Line\n; $message .= \n; $message .= 3rd Line\n; $message .= \n; $message .= 4th Line\n; mail (, $subject, $message, $headers); TIA As far as I've encountered, you can simply do the following: ? $message = This is the message I wish to send with linebreaks... all the way down here. ; mail (, $subject, $message, $headers); ? -- Kyle Gibson admin(at)frozenonline.com http://www.frozenonline.com/ -- 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] Re: More mail() questions.
Tried that, but no go. I did figure it out however. Putting the following at the bottom of the $header seemed to work. $headers .= --=MIME_BOUNDRY_message_parts\n; $headers .= Content-Type: text/plain; charset=\iso-8859-1\\n; $headers .= Content-Transfer-Encoding: quoted-printable\n; - Original Message - From: Ewout de Boer [EMAIL PROTECTED] To: PHP General [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 4:23 AM Subject: Re: [PHP] Re: More mail() questions. Try '\r\n' instead of '\n' regards, Ewout de Boer - Original Message - From: Beauford.2002 [EMAIL PROTECTED] To: [EMAIL PROTECTED]; Kyle Gibson [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 10:17 AM Subject: Re: [PHP] Re: More mail() questions. Thanks for the reply, however, that will not work. The only line breaks you may get with that are those layed out in a text box or from your mail client. What if I have other variables that need to be put in the body of the email. i.e. Age: 16 Height: 168 Weight: 120 etc etc etc. These are variables that the user inputs into a form and need to be on a seperate line, so if I did $message = $age, $weight, $height, etc. they would appear on the same line - I need to have them on separate lines. - Original Message - From: Kyle Gibson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, November 25, 2002 10:54 PM Subject: [PHP] Re: More mail() questions. I am trying to get the message portion of the email to have line breaks, but whatever I do it displays on one line. This is what I have. $message = 1st Line\n; $message .= 2nd Line\n; $message .= \n; $message .= 3rd Line\n; $message .= \n; $message .= 4th Line\n; mail (, $subject, $message, $headers); TIA As far as I've encountered, you can simply do the following: ? $message = This is the message I wish to send with linebreaks... all the way down here. ; mail (, $subject, $message, $headers); ? -- Kyle Gibson admin(at)frozenonline.com http://www.frozenonline.com/ -- 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 -- 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