RE: [PHP] Confused a little with = to and grater than ...
I think this is what you mean -Original Message- From: Philip J. Newman [mailto:[EMAIL PROTECTED] Sent: Saturday, March 15, 2003 8:29 PM To: [EMAIL PROTECTED] Subject: [PHP] Confused a little with = to and grater than ... Importance: Low Well i thought about changeing access levels into numbers so that only LARGER numbers can access lower numbers and Lower numbers can't access anything higher ... if that makes sence ... So 3 can access 2 and 1, 2 can't access 3, but can access 2 and 1 and one can't access 2 or 3, but can 1 ... assuming that $siteAccessLevel is = to eather level-1, level-2 or level-3 ... if ($slevel >= $glevel) { is the line i can't seem to get right. *GRIN* any help? code below. if ($siteAccessLevel == "level-1") { $slevel = "1"; } else if ($siteAccessLevel == "level-2") { $slevel = "2"; } else if ($siteAccessLevel == "level-3") { $slevel = "3"; } if ($gAccessLevel == "level-1") { $glevel = "1"; } else if ($gAccessLevel == "level-2") { $glevel = "2"; } else if ($gAccessLevel == "level-3") { $glevel = "3"; } if ($slevel >= $glevel) { //LOAD PAGE }else { // ERROR MESSAGE HERE. { -- Philip J. Newman. Head Developer [EMAIL PROTECTED] +64 (9) 576 9491 +64 021-048-3999 -- Friends are like stars You can't allways see them, but they are always there. -- Websites: PhilipNZ.com - Design. http://www.philipnz.com/ [EMAIL PROTECTED] Philip's Domain // Internet Project. http://www.philipsdomain.com/ [EMAIL PROTECTED] Vital Kiwi / NEWMAN.NET.NZ. http://www.newman.net.nz/ [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] group by get last record
Hello, Guys i try to join to tables slides: id userid file moment users id username As there few slids per user and i want to get only last one, i use following sql query, but it fetches me first slide. How can i make it fetch last one please? SELECT slides.file, slides.moment, users.id, users.username FROM slides, users where users.id=slides.userid GROUP BY users.id desc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File upload Stuff ... well kinda.
Check the permissions on the directory you are trying to upload your files. The host I am using required me to either chmod the upload directory to 777 (not what I wanted to do) or run PHP with cgi-wrap enabled - this allowed my PHP application to run as the user and therefore had permission to write to a directory. Check with the host on this. - Charles On Saturday, March 15, 2003, at 09:53 PM, Philip J. Newman wrote: RIghto then. Just make a nice website, on my windows box and everything and when i moved it to the live server, the things that didn't work where file uploads. What (if any) settings do i have to use for a Linux dir .. to allow access for the file to be uploaded? -- Philip J. Newman. Head Developer [EMAIL PROTECTED] +64 (9) 576 9491 +64 021-048-3999 -- Friends are like stars You can't allways see them, but they are always there. -- Websites: PhilipNZ.com - Design. http://www.philipnz.com/ [EMAIL PROTECTED] Philip's Domain // Internet Project. http://www.philipsdomain.com/ [EMAIL PROTECTED] Vital Kiwi / NEWMAN.NET.NZ. http://www.newman.net.nz/ [EMAIL PROTECTED] -- 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] Performance and Function Calls
Storing the results of a function in a variable and referencing the variable will almost always be faster, this should be no surprise because instead of executing the function PHP just has to return the variable's value. In #1 since you only call the function once the function is only executed once, in a loop it is executed once for each loop iteration. Jason On Sat, 2003-03-15 at 21:25, Don Read wrote: > On 15-Mar-2003 CF High wrote: > > Hey all. > > > > Quick question: > > > > If I have a function that, say, prints out the months in a year, and I > > call > > that function within a 10 cycle loop, which of the following is faster: > > > > 1) Have function months() return months as a string; set var > > string_months = months() outside of the loop; then echo string_months > > within > > the loop > > > > -- OR > > > > 2) Just call months() for each iteration through the loop > > > > I'm not sure how PHP interprets option number 1. > > > > Guidance for the clueless much appreciated... > > > > Easy enuff to test: > > > function getmicrotime(){ > list($usec, $sec) = explode(" ",microtime()); > return ((float)$usec + (float)$sec); > } > > $time_start = getmicrotime(); > for ($m=1; $m <11; $m++) { > echo date('F', strtotime("2003-$m-1")), ''; > } > echo 'A: ', getmicrotime() - $time_start , ''; > > $time_start = getmicrotime(); > for ($m=1; $m <11; $m++) { > $str[]=date('F', strtotime("2003-$m-1")); > } > echo implode('',$str); > echo 'B: ', getmicrotime() - $time_start , ''; > > unset($str); > $time_start = getmicrotime(); > for ($m=1; $m <11; $m++) { > $str[]=date('F', strtotime("2003-$m-1")); > } > > while (list(,$v)= each($str)) { > echo $v, ''; > } > echo 'C: ', getmicrotime() - $time_start , ''; > > ?> > > On my machine I get numbers like: > A: 0.000907063484192 > B: 0.000651001930237 > C: 0.000686049461365 > > The function call within the loop is slower (contrary to what I > expected), the real question is how much effort do you want to expend to > save 2-3 micro-seconds? > > Regards, > -- > Don Read [EMAIL PROTECTED] > -- It's always darkest before the dawn. So if you are going to >steal the neighbor's newspaper, that's the time to do it. -- Jason Sheets <[EMAIL PROTECTED]> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Performance and Function Calls
On 15-Mar-2003 CF High wrote: > Hey all. > > Quick question: > > If I have a function that, say, prints out the months in a year, and I > call > that function within a 10 cycle loop, which of the following is faster: > > 1) Have function months() return months as a string; set var > string_months = months() outside of the loop; then echo string_months > within > the loop > > -- OR > > 2) Just call months() for each iteration through the loop > > I'm not sure how PHP interprets option number 1. > > Guidance for the clueless much appreciated... > Easy enuff to test: '; } echo 'A: ', getmicrotime() - $time_start , ''; $time_start = getmicrotime(); for ($m=1; $m <11; $m++) { $str[]=date('F', strtotime("2003-$m-1")); } echo implode('',$str); echo 'B: ', getmicrotime() - $time_start , ''; unset($str); $time_start = getmicrotime(); for ($m=1; $m <11; $m++) { $str[]=date('F', strtotime("2003-$m-1")); } while (list(,$v)= each($str)) { echo $v, ''; } echo 'C: ', getmicrotime() - $time_start , ''; ?> On my machine I get numbers like: A: 0.000907063484192 B: 0.000651001930237 C: 0.000686049461365 The function call within the loop is slower (contrary to what I expected), the real question is how much effort do you want to expend to save 2-3 micro-seconds? Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File upload Stuff ... well kinda.
RIghto then. Just make a nice website, on my windows box and everything and when i moved it to the live server, the things that didn't work where file uploads. What (if any) settings do i have to use for a Linux dir .. to allow access for the file to be uploaded? -- Philip J. Newman. Head Developer [EMAIL PROTECTED] +64 (9) 576 9491 +64 021-048-3999 -- Friends are like stars You can't allways see them, but they are always there. -- Websites: PhilipNZ.com - Design. http://www.philipnz.com/ [EMAIL PROTECTED] Philip's Domain // Internet Project. http://www.philipsdomain.com/ [EMAIL PROTECTED] Vital Kiwi / NEWMAN.NET.NZ. http://www.newman.net.nz/ [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Confused a little with = to and grater than ...
Well i thought about changeing access levels into numbers so that only LARGER numbers can access lower numbers and Lower numbers can't access anything higher ... if that makes sence ... So 3 can access 2 and 1, 2 can't access 3, but can access 2 and 1 and one can't access 2 or 3, but can 1 ... assuming that $siteAccessLevel is = to eather level-1, level-2 or level-3 ... if ($slevel >= $glevel) { is the line i can't seem to get right. *GRIN* any help? code below. if ($siteAccessLevel == "level-1") { $slevel = "1"; } else if ($siteAccessLevel == "level-2") { $slevel = "2"; } else if ($siteAccessLevel == "level-3") { $slevel = "3"; } if ($gAccessLevel == "level-1") { $glevel = "1"; } else if ($gAccessLevel == "level-2") { $glevel = "2"; } else if ($gAccessLevel == "level-3") { $glevel = "3"; } if ($slevel >= $glevel) { //LOAD PAGE }else { // ERROR MESSAGE HERE. { -- Philip J. Newman. Head Developer [EMAIL PROTECTED] +64 (9) 576 9491 +64 021-048-3999 -- Friends are like stars You can't allways see them, but they are always there. -- Websites: PhilipNZ.com - Design. http://www.philipnz.com/ [EMAIL PROTECTED] Philip's Domain // Internet Project. http://www.philipsdomain.com/ [EMAIL PROTECTED] Vital Kiwi / NEWMAN.NET.NZ. http://www.newman.net.nz/ [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP newbie ... function with several returns ?
Hi, Sunday, March 16, 2003, 10:52:49 AM, you wrote: RD> Hi ... PHP newbie here. RD> I'm migrating from ASP/vbScript. RD> I'd like to set up a subroutine that will change several variables at once. RD> In VB, I can say: RD> Private Sub Change_Variables ($variable1, $variable2) RD> $variable1 = "Something different from it's original value" RD> $variable2 = "I'm changed also!!" RD> End Sub RD> // in my code I can call it like this: RD> $My_variable1 = "This is the original value of variable1" RD> $My_variable2 = "This is the original value of variable2" RD> Call Change_Variables ($My_variable1, $My_variable2) RD> // after calling this subroutine the variables are changed: RD> print $My_variable1 // yeilds: "Something different from it's original RD> value" RD> print $My_variable2 // yields: "I'm changed also!!" RD> I try to convert this to PHP, and I'm getting stuck. I'm sure there's a RD> kind of function that can do this. RD> Any ideas? RD> TIA You need this: function Change_Variables (&$variable1, &$variable2){ $variable1 = "Something different from it's original value" $variable2 = "I'm changed also!!" } (notice the '&' symbols) -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP newbie ... function with several returns ?
"Jome" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Robert Dyke wrote: > > Hi ... PHP newbie here. > > > > I'm migrating from ASP/vbScript. > > > > I'd like to set up a subroutine that will change several variables at > > once. > > > > In VB, I can say: > > > > Private Sub Change_Variables ($variable1, $variable2) > > $variable1 = "Something different from it's original value" > > $variable2 = "I'm changed also!!" > > End Sub > > > > // in my code I can call it like this: > > $My_variable1 = "This is the original value of variable1" > > $My_variable2 = "This is the original value of variable2" > > > > Call Change_Variables ($My_variable1, $My_variable2) > > > > // after calling this subroutine the variables are changed: > > > > print $My_variable1 // yeilds: "Something different from it's > > original value" > > print $My_variable2 // yields: "I'm changed also!!" > > > > I try to convert this to PHP, and I'm getting stuck. I'm sure > > there's a kind of function that can do this. > > > > Any ideas? > > VB defaults to pass by reference while PHP defaults to pass by > value. > > Read more at: http://www.php.net/manual/en/language.references.pass.php > > Jome THANKS!! I inserted the ampersands and it works beautifully ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] How to convert an array to variables?
Hi, Sunday, March 16, 2003, 8:20:49 AM, you wrote: CK> Tom, CK> This seems like what I need exactly, but I am having a bit of trouble CK> getting it to work. CK> Here is how I have worked around this, but I know there is a 'real' way CK> to do this. Any thoughts? I had to set the variables, or should I just CK> use the variables as ${dra_0} etc.? CK> // get the values for the default dra from array CK> while(list($key,$val) = each($r_p_dras)){ CK> $n = "dra_$key"; CK> echo $n; CK> $$n = $val['dra_id']; CK> } CK> $dra_a = "${dra_0}"; CK> $dra_b = "${dra_1}"; CK> $dra_c = "${dra_2}"; CK> $dra_d = "${dra_3}"; CK> $dra_e = "${dra_4}"; You could use a seperate counter like this: $x = 1; while(list($key,$val) = each($r_p_dras)){ $n = "dra_$x"; echo $n; $$n = $val['dra_id']; $x ++; } -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP newbie ... function with several returns ?
Robert Dyke wrote: > Hi ... PHP newbie here. > > I'm migrating from ASP/vbScript. > > I'd like to set up a subroutine that will change several variables at > once. > > In VB, I can say: > > Private Sub Change_Variables ($variable1, $variable2) > $variable1 = "Something different from it's original value" > $variable2 = "I'm changed also!!" > End Sub > > // in my code I can call it like this: > $My_variable1 = "This is the original value of variable1" > $My_variable2 = "This is the original value of variable2" > > Call Change_Variables ($My_variable1, $My_variable2) > > // after calling this subroutine the variables are changed: > > print $My_variable1 // yeilds: "Something different from it's > original value" > print $My_variable2 // yields: "I'm changed also!!" > > I try to convert this to PHP, and I'm getting stuck. I'm sure > there's a kind of function that can do this. > > Any ideas? VB defaults to pass by reference while PHP defaults to pass by value. Read more at: http://www.php.net/manual/en/language.references.pass.php Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP newbie ... function with several returns ?
Hi ... PHP newbie here. I'm migrating from ASP/vbScript. I'd like to set up a subroutine that will change several variables at once. In VB, I can say: Private Sub Change_Variables ($variable1, $variable2) $variable1 = "Something different from it's original value" $variable2 = "I'm changed also!!" End Sub // in my code I can call it like this: $My_variable1 = "This is the original value of variable1" $My_variable2 = "This is the original value of variable2" Call Change_Variables ($My_variable1, $My_variable2) // after calling this subroutine the variables are changed: print $My_variable1 // yeilds: "Something different from it's original value" print $My_variable2 // yields: "I'm changed also!!" I try to convert this to PHP, and I'm getting stuck. I'm sure there's a kind of function that can do this. Any ideas? TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] checking array
what is the best way to check, if a value is NOT in an array? the purpose is to take results from a webpage and check one-by-one if they are in the txt file already. if they are not, i have to write them there.. If they are in there then i just want to leave them alone. this is what i came up with so far: http://site.com', 'r'); for ($src = ''; !feof ($fp); $src .= fgets ($fp, 1024)); fclose ($fp); preg_match_all ('/\(.*)\<\/td\>/isU', $src, $sum, PREG_SET_ORDER); $i=0; $result=file('boot.txt'); while($sum[$i][1] && $i<50){ $word=$sum[$i][1]; if(in_array($word, $result)){} else{ $word = "\n".$word; $addtxt = fopen('boot.txt', 'a'); fputs($addtxt,$word); fclose($addtxt); } $i++; } ?> but somehow it still writes into the txtfile if if an identical line is already there. could somebody please correct the code or suggest a better option for checking? thank you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Encoding /'s
> When my PHP page sends text that is being passed in, it places an "/" in > front of the apostrophe. How do I encode or decode this when I am > outputing > the variable? www.php.net/stripslashes They are added to GET, POST, COOKIE data according to the magic_quotes_gpc setting in php.ini. ---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
Re: [PHP] List tables
As noted earlier, in the manual and please don't cross post. Miles At 05:37 PM 3/26/2003 +, shaun wrote: Hi, i would like to list all of the tables and field names in my database e.g. table 1 field 1 field 2 field 3 table 2 field 1 field 2 field 3 table 3 field 1 field 2 field 3 etc is there a simple way to do this? thanks for your help -- 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] Encoding /'s
Hi All, When my PHP page sends text that is being passed in, it places an "/" in front of the apostrophe. How do I encode or decode this when I am outputing the variable? Thanks, Doug Coning -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Do query strings get spidered by Google?
Last time i checked, Google does infact query strings. As some of my searches have lead to forums where the url is www.someurl.com/viewtopic.php?f=3&t=345 ect. I also belive there is a tutorial somewhere on the internet which converts the variables into folders, so it looks like the article is in some sort of directory structure. - Original Message - From: "Mike Hillyer" <[EMAIL PROTECTED]> To: "PHP GENERAL LIST" <[EMAIL PROTECTED]> Sent: Sunday, March 16, 2003 4:26 AM Subject: [PHP] Do query strings get spidered by Google? > Hi All; > > I am trying to decide how to lay out a site with a lot of articles, and I am > wondering if query strings get spidered by Google. I was thinking it would > make for an easy search engine if I could put the articles in fulltext > searchable MySQL columns, but I do not want to lose the ability of search > engines to spider them. Otherwise, I believe there is a way to convert the > quert string to a trailing / so it looks like directory structure, does > anyone have info on that? > > Thanks, > Mike Hillyer > > > -- > 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] SMTP Authenticate
If the SMTP server is running on your machine, or you have access to it's configuration. Create an e-mail address specificaly for PHP to mail from, as i had trouble authenticating. But if i created the mailer address as a local user on my SMTP server, it'd be allowed through. I believe it's a method to reduce relayed SPAM... - Original Message - From: "Aitor Cabrera" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, March 16, 2003 3:43 AM Subject: [PHP] SMTP Authenticate Hi, I'm trying to use the mail() funtion but I can only use this funtion the email myself (the same email that I put in the php.ini file). I f I try to email someone else I get an error 530 delivery not allowed to non-local recipient, try authenticating -7 How can I authenticate myselft? Which is the SMTP comand to do it and how do I use it? Thanks!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to convert an array to variables?
Tom, This seems like what I need exactly, but I am having a bit of trouble getting it to work. Here is how I have worked around this, but I know there is a 'real' way to do this. Any thoughts? I had to set the variables, or should I just use the variables as ${dra_0} etc.? // get the values for the default dra from array while(list($key,$val) = each($r_p_dras)){ $n = "dra_$key"; echo $n; $$n = $val['dra_id']; } $dra_a = "${dra_0}"; $dra_b = "${dra_1}"; $dra_c = "${dra_2}"; $dra_d = "${dra_3}"; $dra_e = "${dra_4}"; On Saturday, March 15, 2003, at 02:08 PM, Tom Rogers wrote: Hi, Sunday, March 16, 2003, 4:52:10 AM, you wrote: CK> Hi all, CK> I have an array that gives me this when I do: CK> print_r($my_array); CK> Array CK> ( CK> [0] => Array CK> ( CK> [dra_id] => 5 CK> ) CK> [1] => Array CK> ( CK> [dra_id] => 8 CK> ) CK> [2] => Array CK> ( CK> [dra_id] => 9 CK> ) CK> ) CK> using a foreach() I want to create a variable with a unique incremental CK> name for each of the values. CK> for example: CK> $dra_1 = 5; CK> $dra_2 = 8; CK> $dra_3 = 9; CK> How would I do this? A variable that has a variable name based on a CK> counter in the loop? Not sure the syntax for that. CK> Thanks CK> Charles something like this... while(list($key,$val) = each($my_array)){ $n = 'dra_'.$key+1; $$n = $val['dra_id']; } -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 15 Mar 2003 21:51:12 -0000 Issue 1940
php-general Digest 15 Mar 2003 21:51:12 - Issue 1940 Topics (messages 139791 through 139810): Re: need a new challenge 139791 by: Dominik Werder How to write a module for php? 139792 by: hzqbbc Re: str_replace 139793 by: Jason Sheets 139805 by: Sebastian SMTP Authenticate 139794 by: Aitor Cabrera 139795 by: Manuel Lemos 139798 by: Bobby Patel Do query strings get spidered by Google? 139796 by: Mike Hillyer 139799 by: Alexandru COSTIN 139800 by: olinux List tables 139797 by: shaun 139809 by: Joel Colombo How to convert an array to variables? 139801 by: Charles Kline 139803 by: Tom Rogers Wrox no more? 139802 by: kaemaril.btinternet.com 139810 by: Alexandru COSTIN Re: Persistent values between executions 139804 by: Lance Lovette Performance and Function Calls 139806 by: CF High PHP User Groups 139807 by: Charles Kline 139808 by: John W. Holmes Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- --- Begin Message --- Hi Chris (and all others), This seems to me a very common "problem". I managed it too with different approaches including complete on the fly code generation, but I don't think that I have already the perfect solution. Does anyone have more information on this topic? bye! Dominik Metatable Suppose you've got one db table (meta-table) desribing the content of various other tables, for instance ID tablename fieldname fieldtype [integer|textarea|choicelist|link_to_other_table|] default_value permissions The easy part: make an interface so people can design their own db table, the description of every field goes into the metatable and the field is added to the datatable it refers to. With templates one can now quickly make show/edit/add/overview pages. I managed that. Now I want to have choice lists that come from new tables. For instance: with this system they made a table person (gender, name, etc), now i want to add a choice list of institutions, where the institutions are in another table (institute name, address, etc). Doing this directly is easier than doing it via this extra table. Let them use a class? --- End Message --- --- Begin Message --- Hi all: I want to write a small module for php and reduce some overhead while doingthe same job with PHP scripts. But i'm new to php dev, and even don't konw about the archtecture of phpmodule.. So could anybody tell me where and how to get help to write a smallmodule? Is there any sample of module exist the list or php.net? Thanks a lot ~ :-) --- End Message --- --- Begin Message --- You could put logic in your header and footer file not to display output if $_GET['action'] == 'print'. Jason On Fri, 2003-03-14 at 23:23, Sebastian wrote: > doesn't work but also doesn't give any errors, I will try to explain what I > am trying to do: > > I am trying to remove the header and footer to create a "printer friendly > page" with just the content, here's what my pages look like, I need to > remove header and footer when they visit: file.php?action=print > > include("../config.php"); > > if($_GET[action] == "print") > { >$header = str_replace('include("$header");', '', $header); >$footer = str_replace('include("$footer");', '', $footer); > } > > include("$header"); > ?> > > // html > > > > cheers, > - Sebastian > > - Original Message - > From: "John Gray" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Saturday, March 15, 2003 12:31 AM > Subject: [PHP] Re: str_replace > > > | $footer = str_replace('include("$header");', '', $footer); > | > | The way you have it now, you're telling PHP to first include the file > | named by the variable $header, then do an str_replace on the result; but > | the parser is going to fail on that first semi-colon, and that's not > | what you want to do anyway (as I understand it). Put the line you want > | to replace inside single quotes (as above) and PHP won't attempt to > | parse it, it'll just treat it as a string literal. Hope this helps, hope > | it makes sense. > | > | - john > | > | Sebastian wrote: > | > This may seem weird: > | > > | > How do I str_replace an include function? > | > > | > I want to replace this line: include("$header"); > | > > | > with nothing .. > | > > | > something like this: > | > > | > $footer = str_replace(" '. include("$header"); .' ", "", $footer); > | > > | > I get errors, any ideas? > | > > | > cheers, > | > - Sebastian -- Jason Sheets <[EMAIL PROTECTED]> --- End Message --- --- Begin Message --- Thank you, that seems to work fairly well :) cheers, - Sebastian - Original Message - From: "Ernest E Vogelsinger" | At 07:23 15.
[PHP] Re: Wrox no more?
This is a sad day, indeed. It seems that web developers tend to skip reading books to improve knowledge, and rely on web/google/this newsgroup, etc Alexandru -- Alexandru COSTIN Chief Operating Officer http://www.interakt.ro/ +4021 411 2610 <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] With the apparent very sad demise of Wrox (http://www.webstandards.org/ for details. This has also been reported on the webdesign list, although the Wrox website itself doesn't seem to have anything) does anyone know if "PHP MySQL Website Programming Problem-Design-Solution" will be published? According to their site it was due in "March", Amazon.com reports March 21, and Amazon.co.uk reports March 11th. Did it "get out of the door" in time? It would seem that Glasshaus are also gone (http://www.glasshaus.com/ for details) :( Glasshaus & Wrox did good books, I thought. I'm sure they'll be greatly missed, assuming they're not bought by anyone, or some other sort of miracle can be arranged... - Kaemaril. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: List tables
duplicate POST from php.db "Shaun" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > i would like to list all of the tables and field names in my database > > e.g. > > table 1 > field 1 > field 2 > field 3 > table 2 > field 1 > field 2 > field 3 > table 3 > field 1 > field 2 > field 3 > etc > > is there a simple way to do this? > > thanks for your help > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP User Groups
> Is or has anyone here been part of or started a PHP user group? I am > thinking it would be a great thing to get started in my area (maybe one > already exists?) and I was looking for suggestions on how to go about > it and things to know before getting started, etc. > BTW. I live in Southern New Jersey (USA) Check http://php.meetup.com/ for your area. ---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] PHP User Groups
Hi all, Is or has anyone here been part of or started a PHP user group? I am thinking it would be a great thing to get started in my area (maybe one already exists?) and I was looking for suggestions on how to go about it and things to know before getting started, etc. BTW. I live in Southern New Jersey (USA) Please feel free to contact me off list. Thanks, Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Performance and Function Calls
Hey all. Quick question: If I have a function that, say, prints out the months in a year, and I call that function within a 10 cycle loop, which of the following is faster: 1) Have function months() return months as a string; set var string_months = months() outside of the loop; then echo string_months within the loop -- OR 2) Just call months() for each iteration through the loop I'm not sure how PHP interprets option number 1. Guidance for the clueless much appreciated... --Noah -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: str_replace
Thank you, that seems to work fairly well :) cheers, - Sebastian - Original Message - From: "Ernest E Vogelsinger" | At 07:23 15.03.2003, Sebastian said: | [snip] | >doesn't work but also doesn't give any errors, I will try to explain what I | >am trying to do: | > | >I am trying to remove the header and footer to create a "printer friendly | >page" with just the content, here's what my pages look like, I need to | >remove header and footer when they visit: file.php?action=print | > | >include("../config.php"); | > | >if($_GET[action] == "print") | >{ | > $header = str_replace('include("$header");', '', $header); | > $footer = str_replace('include("$footer");', '', $footer); | >} | > | >include("$header"); | >?> | > | >// html | > | > | [snip] | | Hmm - can't work because the variable "$header" doesn't include the string | "include("$header");". | | Try it this way: | | | | // html | | | | | -- |>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
RE: [PHP] Persistent values between executions
The most efficient way to solve your problem is with a PHP extension I developed. It handles constants and provides a type of persistent variable too. It has been immensely useful for my projects. http://pwee.sourceforge.net/ Lance > -Original Message- > From: Mike Mannakee [mailto:[EMAIL PROTECTED] > Sent: Monday, March 10, 2003 11:30 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Persistent values between executions > > > I have some sets of values that I have stored in several tables in a mySQL > database. These don't often change, but are referenced on every > single page > view. While each call is quick, as a gross the load on the server is too > high. I would like to know if there is a way to have these sets of values > remain persistent in the server's memory between calls from browsers, like > environment variables, to reduce the back and forth calls to > mySQL. As the > data from the calls are almost always the same, it would seem easier this > way. > > Any thoughts? Comments? RTFM suggestions? > > Mike > > > > -- > 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] How to convert an array to variables?
Hi, Sunday, March 16, 2003, 4:52:10 AM, you wrote: CK> Hi all, CK> I have an array that gives me this when I do: CK> print_r($my_array); CK> Array CK> ( CK> [0] => Array CK> ( CK> [dra_id] => 5 CK> ) CK> [1] => Array CK> ( CK> [dra_id] => 8 CK> ) CK> [2] => Array CK> ( CK> [dra_id] => 9 CK> ) CK> ) CK> using a foreach() I want to create a variable with a unique incremental CK> name for each of the values. CK> for example: CK> $dra_1 = 5; CK> $dra_2 = 8; CK> $dra_3 = 9; CK> How would I do this? A variable that has a variable name based on a CK> counter in the loop? Not sure the syntax for that. CK> Thanks CK> Charles something like this... while(list($key,$val) = each($my_array)){ $n = 'dra_'.$key+1; $$n = $val['dra_id']; } -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Wrox no more?
With the apparent very sad demise of Wrox (http://www.webstandards.org/ for details. This has also been reported on the webdesign list, although the Wrox website itself doesn't seem to have anything) does anyone know if "PHP MySQL Website Programming Problem-Design-Solution" will be published? According to their site it was due in "March", Amazon.com reports March 21, and Amazon.co.uk reports March 11th. Did it "get out of the door" in time? It would seem that Glasshaus are also gone (http://www.glasshaus.com/ for details) :( Glasshaus & Wrox did good books, I thought. I'm sure they'll be greatly missed, assuming they're not bought by anyone, or some other sort of miracle can be arranged... - Kaemaril. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to convert an array to variables?
Hi all, I have an array that gives me this when I do: print_r($my_array); Array ( [0] => Array ( [dra_id] => 5 ) [1] => Array ( [dra_id] => 8 ) [2] => Array ( [dra_id] => 9 ) ) using a foreach() I want to create a variable with a unique incremental name for each of the values. for example: $dra_1 = 5; $dra_2 = 8; $dra_3 = 9; How would I do this? A variable that has a variable name based on a counter in the loop? Not sure the syntax for that. Thanks Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Do query strings get spidered by Google?
A better solution - make your pages look like static html pages: Search Engine Friendly PHP Pages http://zend.com/zend/spotlight/searchengine.php Search Engine-Friendly URLs http://www.sitepoint.com/article/485 How can I pass variables to a script in the url like /script/var1/var2? How can I pass variables in a form that won't scare off search engines? http://www.faqts.com/knowledge_base/view.phtml/aid/124 Apache ForceType Docs http://www.apache.org/docs/mod/mod_mime.html#forcetype I even add a ".htm" to the article id and then do a str_replace(). Remember to make sure that you are doing some type of validation of the data that is being passed via the URL. olinux --- Mike Hillyer <[EMAIL PROTECTED]> wrote: > Hi All; > > I am trying to decide how to lay out a site with a > lot of articles, and I am > wondering if query strings get spidered by Google. I > was thinking it would > make for an easy search engine if I could put the > articles in fulltext > searchable MySQL columns, but I do not want to lose > the ability of search > engines to spider them. Otherwise, I believe there > is a way to convert the > quert string to a trailing / so it looks like > directory structure, does > anyone have info on that? > > Thanks, > Mike Hillyer > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > __ Do you Yahoo!? Yahoo! Web Hosting - establish your business online http://webhosting.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Do query strings get spidered by Google?
Hi, Dynamic queries are googled as far as I know (*old* search engines probably didn't do this). Search InterAKT and you'll see that we have all the pages indexed - and our site is completely dynamic. (index.php?page=4_5, etc) Alexandru -- Alexandru COSTIN Chief Operating Officer http://www.interakt.ro/ +4021 411 2610 "Mike Hillyer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi All; > > I am trying to decide how to lay out a site with a lot of articles, and I am > wondering if query strings get spidered by Google. I was thinking it would > make for an easy search engine if I could put the articles in fulltext > searchable MySQL columns, but I do not want to lose the ability of search > engines to spider them. Otherwise, I believe there is a way to convert the > quert string to a trailing / so it looks like directory structure, does > anyone have info on that? > > Thanks, > Mike Hillyer > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SMTP Authenticate
There is another php mailer class which is really good (and includes authentication among alot of other things). http://phpmailer.sourceforge.net "Aitor Cabrera" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi, I'm trying to use the mail() funtion but I can only use this funtion the email myself (the same email that I put in the php.ini file). I f I try to email someone else I get an error 530 delivery not allowed to non-local recipient, try authenticating -7 How can I authenticate myselft? Which is the SMTP comand to do it and how do I use it? Thanks!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] List tables
Hi, i would like to list all of the tables and field names in my database e.g. table 1 field 1 field 2 field 3 table 2 field 1 field 2 field 3 table 3 field 1 field 2 field 3 etc is there a simple way to do this? thanks for your help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Do query strings get spidered by Google?
Hi All; I am trying to decide how to lay out a site with a lot of articles, and I am wondering if query strings get spidered by Google. I was thinking it would make for an easy search engine if I could put the articles in fulltext searchable MySQL columns, but I do not want to lose the ability of search engines to spider them. Otherwise, I believe there is a way to convert the quert string to a trailing / so it looks like directory structure, does anyone have info on that? Thanks, Mike Hillyer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SMTP Authenticate
Hello, On 03/15/2003 01:43 PM, Aitor Cabrera wrote: Hi, I'm trying to use the mail() funtion but I can only use this funtion the email myself (the same email that I put in the php.ini file). I f I try to email someone else I get an error 530 delivery not allowed to non-local recipient, try authenticating -7 How can I authenticate myselft? Which is the SMTP comand to do it and how do I use it? Thanks!! mail() does not support authentication. You may want to try this class that lets you specify the authentication credentials and comes with a wrapper function named smtp_mail() that sends the message to a SMTP server that you specify: http://www.phpclasses.org/mimemessage You also need this class to do the actual SMTP delivery: http://www.phpclasses.org/smtpclass -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SMTP Authenticate
Hi, I'm trying to use the mail() funtion but I can only use this funtion the email myself (the same email that I put in the php.ini file). I f I try to email someone else I get an error 530 delivery not allowed to non-local recipient, try authenticating -7 How can I authenticate myselft? Which is the SMTP comand to do it and how do I use it? Thanks!!
Re: [PHP] Re: str_replace
You could put logic in your header and footer file not to display output if $_GET['action'] == 'print'. Jason On Fri, 2003-03-14 at 23:23, Sebastian wrote: > doesn't work but also doesn't give any errors, I will try to explain what I > am trying to do: > > I am trying to remove the header and footer to create a "printer friendly > page" with just the content, here's what my pages look like, I need to > remove header and footer when they visit: file.php?action=print > > include("../config.php"); > > if($_GET[action] == "print") > { >$header = str_replace('include("$header");', '', $header); >$footer = str_replace('include("$footer");', '', $footer); > } > > include("$header"); > ?> > > // html > > > > cheers, > - Sebastian > > - Original Message - > From: "John Gray" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Saturday, March 15, 2003 12:31 AM > Subject: [PHP] Re: str_replace > > > | $footer = str_replace('include("$header");', '', $footer); > | > | The way you have it now, you're telling PHP to first include the file > | named by the variable $header, then do an str_replace on the result; but > | the parser is going to fail on that first semi-colon, and that's not > | what you want to do anyway (as I understand it). Put the line you want > | to replace inside single quotes (as above) and PHP won't attempt to > | parse it, it'll just treat it as a string literal. Hope this helps, hope > | it makes sense. > | > | - john > | > | Sebastian wrote: > | > This may seem weird: > | > > | > How do I str_replace an include function? > | > > | > I want to replace this line: include("$header"); > | > > | > with nothing .. > | > > | > something like this: > | > > | > $footer = str_replace(" '. include("$header"); .' ", "", $footer); > | > > | > I get errors, any ideas? > | > > | > cheers, > | > - Sebastian -- Jason Sheets <[EMAIL PROTECTED]> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to write a module for php?
Hi all: I want to write a small module for php and reduce some overhead while doingthe same job with PHP scripts. But i'm new to php dev, and even don't konw about the archtecture of phpmodule.. So could anybody tell me where and how to get help to write a smallmodule? Is there any sample of module exist the list or php.net? Thanks a lot ~ :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need a new challenge
Hi Chris (and all others), This seems to me a very common "problem". I managed it too with different approaches including complete on the fly code generation, but I don't think that I have already the perfect solution. Does anyone have more information on this topic? bye! Dominik Metatable Suppose you've got one db table (meta-table) desribing the content of various other tables, for instance ID tablename fieldname fieldtype [integer|textarea|choicelist|link_to_other_table|] default_value permissions The easy part: make an interface so people can design their own db table, the description of every field goes into the metatable and the field is added to the datatable it refers to. With templates one can now quickly make show/edit/add/overview pages. I managed that. Now I want to have choice lists that come from new tables. For instance: with this system they made a table person (gender, name, etc), now i want to add a choice list of institutions, where the institutions are in another table (institute name, address, etc). Doing this directly is easier than doing it via this extra table. Let them use a class? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 15 Mar 2003 09:30:16 -0000 Issue 1939
php-general Digest 15 Mar 2003 09:30:16 - Issue 1939 Topics (messages 139763 through 139790): Re: OT? Dynamic Page Setup in IE please help 139763 by: David T-G inserting parameters into URLs dynamically 139764 by: Maureen Roihl 139766 by: Ernest E Vogelsinger 139777 by: Tom Rogers 139784 by: Hugh Danaher General Information About Porting a Monolithic Perl CGI Script to PHP 139765 by: Richard Ward 139768 by: Ernest E Vogelsinger Re: inserting parameters into URLs dynamically] 139767 by: Pete James Re: Apache 2.0 and PHP 139769 by: Ernest E Vogelsinger Re: form/text area input problem 139770 by: Boaz Yahav Convert Date to MySQL format 139771 by: Vernon My PHP mysql Command 139772 by: Philip J. Newman mysql_connect issue 139773 by: Steve Shead 139774 by: Philip J. Newman Header order 139775 by: John Taylor-Johnston Re: php file writting ? 139776 by: Tom Rogers str_replace 139778 by: Sebastian 139779 by: John Gray 139781 by: Sebastian 139782 by: Hugh Danaher 139785 by: Hugh Danaher 139790 by: Ernest E Vogelsinger Feasability of Serial functions and constantly running progrms 139780 by: Jason Young Re: Newbie MySQL INSERT Q 139783 by: Uttam Re: checking $_POST variables 139786 by: Justin French Re: Checking for a Valid Email String. 139787 by: Justin French Re: Crypting Passwords for storage. 139788 by: Justin French Re: Dynamic titles. 139789 by: Justin French Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- --- Begin Message --- Anthony -- Your question is pure browser. Good luck, especially considering the browser you have to target :-) You might be able to change the setting with some javascript. You might also be able to define the print format with a style sheet (doubtful). In either case, you need to get into IE internals to see what it is that you want to set. I don't think you'll be able to do this for "only this page", though you could perhaps put the settings back (hey, store 'em in a cookie; it can't get much worse!) after the job has printed. HTH & Good luck & HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature --- End Message --- --- Begin Message --- We are looking for a way to set several key/value pairs (which will differ across users) such that they will persist during the user's session and be logged in the weblogs for every request that user makes. Some potential ways of doing this that occurred to us: - implement functionality to programmatically append these parameters to the querystring of all urls displayed across our site (far too cumbersome, we don't consider this a viable option) - find a way for PHP to automatically tack the parameters onto the ends of url querystrings, the same way it can do with PHPSESSIONID (we haven't found, in our initial research, a way to do this) Our primary goal is to get these parameters logged in the weblogs, without having to programmatically/physically modify every link on our site. For example, if we wanted to track parameters called x and y, the link on the page would just point to: /index.php but the weblog would show something like the following hit: /index.php?x=foo&y=bar The parameter values would need to get set once at the beginning of a user's session, and then would not change over the course of that session (but they'd need to get tracked with every request they made). We're planning to implement persistent sessions across our servers as well. Maureen Roihl Senior Web Developer Smarter Living [EMAIL PROTECTED] --- End Message --- --- Begin Message --- At 22:31 14.03.2003, Maureen Roihl said: [snip] >- find a way for PHP to automatically tack the parameters onto the ends >of url querystrings, the same way it can do with PHPSESSIONID (we haven't >found, in our initial research, a way to do this) > >Our primary goal is to get these parameters logged in the weblogs, without >having to programmatically/physically modify every link on our site. For >example, if we wanted to track parameters called x and y, the link on the >page would just point to: > >/index.php > >but the weblog would show something like the following hit: > >/index.php?x=foo&y=bar > >The parameter values would need to get set
Re: [PHP] Re: str_replace
At 07:23 15.03.2003, Sebastian said: [snip] >doesn't work but also doesn't give any errors, I will try to explain what I >am trying to do: > >I am trying to remove the header and footer to create a "printer friendly >page" with just the content, here's what my pages look like, I need to >remove header and footer when they visit: file.php?action=print > >include("../config.php"); > >if($_GET[action] == "print") >{ > $header = str_replace('include("$header");', '', $header); > $footer = str_replace('include("$footer");', '', $footer); >} > >include("$header"); >?> > >// html > > [snip] Hmm - can't work because the variable "$header" doesn't include the string "include("$header");". Try it this way: // html -- >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
Re: [PHP] Dynamic titles.
You can split $_SERVER['REQUEST_URI'] on the /'s to get the directories, eg: http://site.com/info/your_pet/dogs/page.html would result in /dir/anotherdir/page.php So, (untested code): Should echo something like: 'Name of My Site / Info / Your Pets / Dogs' All you need to to do is echo $title in the title tag, and season to taste :) Justin on 14/03/03 4:44 AM, Sebastian ([EMAIL PROTECTED]) wrote: > Hello. > > I have many pages, and was thinking of a way to generate dynamic page > titles, very similar to a breadcrumb where it uses the directory structure > to make the page title. > > Anyone have something like this, and is willing to give a hand? > > warm regards, > Sebastian - [BBR] Gaming Clan > http://www.broadbandreports.com > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Crypting Passwords for storage.
Commonly, you don't need to encrypt it. just md5() the password before inserting it, so you only store the md5'd password. then, to check on login, md5() the password they enter into a form... if they match, then they are the same. heaps less code, no need to mycrypt libraries to be installed, etc etc. the only catch is that if the user forgets the password, you need to reset it, because md5 is one-way, and isn't technically encryption :) justin on 14/03/03 1:31 PM, Philip J. Newman ([EMAIL PROTECTED]) wrote: > I have a user admin for a site, how ever passwords are stored in plane text. > Is there away to crypt and then read the crypt when verifying that string vs > the plane text in the password box? > > -- > Philip J. Newman. > Head Developer > [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for a Valid Email String.
on 14/03/03 2:09 AM, -{ Rene Brehmer }- ([EMAIL PROTECTED]) wrote: > Jumping in... Jumping in also: http://www.killersoft.com/downloads/pafiledb.php?action=file&id=4 This is a PHP port of a well respected Perl script which CHECKS THE FORMAT OF THE EMAIL ADDRESS AGAINST THE RCF SPEC. I use it EVERYWHERE :) Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] checking $_POST variables
As explained already, not a good idea :) Also, if someone makes a copy of your form and excludes one of the fields, then it won't be set in POST at all. Keep an array of the fields you have in the form. I choose to set the field as the key, and then for the value either 1 (required) or 0 (not required): 1, 'last' => 0, 'email' => 1', 'age' => 0, 'sex' => 0 ); ?> Then include it where needed: Then use the array to check POST values are set, or better still, not empty: $val) { if($val) { if(empty($_POST[$key]) // could also be if(!isset($_POST[$key])) { $error = 3; } } } if($error) { header("Location: signup.php?error={$error}"); exit(); } ?> In your case, street2 could be set to 0, and the rest set to 1. You may also find that you can use the same array to write all your form code as well, with a little work!! Justin on 15/03/03 6:26 AM, drparker ([EMAIL PROTECTED]) wrote: > I'm running this script to make sure all fields are filled in on a form: > > foreach($_POST as $p) > { > if(!$p) > { > header("Location: signup.php?error=3"); > exit(); > } > } > > But I need to exclude one field on the form from being checked - > Street2. How could I do this? > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php