Re: [PHP] GET, POST, REQUEST
- Original Message - From: "Richard Lynch" <[EMAIL PROTECTED]> On Sun, June 18, 2006 2:19 am, Satyam wrote: - Original Message - From: "Rory Browne" <[EMAIL PROTECTED]> Good code won't be vulnerable to register_globals either, but having register_globals on is a security problem because there are security flaws that can only be exploited when register_globals is enabled. Actually, code quality cannot overcome the vulnerability of register_globals. Every program will have global variables. You clearly do not really understand the meaning behind "register_globals" and "global variables" in PHP... :-) Or perhaps you don't consider initializing variables as code quality issue. Because if you initialize EVERY variable, register_globals on/off has zero effect. The last paragraph you are replying to is actually mine and your first paragraph is right, I don't know what register_globals on implies because I never had it and, fortunately, my ISP doesn't have it that way either so, indeed, I lack experience with register_globals because I never had to deal with that and I should have remained quiet. I come from languages where you not only have to initialize a variable but have to declare it as well so initializing comes natural, I feel wrong if I don't do it, even if the interpreter does not care. Satyam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] pear xml_serializer
Hi all, I am using PEAR:XML_Serializer to unserializer our customer xml file. However in some customer xml file , there are some value in xml which are not unicode , for example as shown below: I need to amended the value above to be empty. Anyone have any suggestion how to do this ? Thanks - weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still trying to figure this out...
Rob W. wrote: > OMG Chris, Thankyou very much. That is exactally what I needed. If you > wish for me to pay you some amount, I will be very happy to. Please send > me a private email where I can paypal you. If not, Thank you again very > much for the help. just do us all a favor and only come back when you have grasped the concept of debugging/investigating a problem (any problem) and doing your *own* work. > > Sorry everyone for the hastle for those of you wernt able to help with ['wernt'? that is not a word.] what Chris wrote is a tiny variation of code examples that have been posted by at least 4 different people. the fact is that you didn't bother to study the code and just pasted into your script expecting it to work. > what I wanted. > > - Rob > > - Original Message - From: "Chris" <[EMAIL PROTECTED]> > To: "Rob W." <[EMAIL PROTECTED]> > Cc: > Sent: Tuesday, June 20, 2006 1:39 AM > Subject: Re: [PHP] Still trying to figure this out... > > >> Rob W. wrote: >>> I still have not yet found anybody to help me with this. All the code >>> that people have given me has not worked at all. I still get no >>> output. So to add a little more to this, I'm gonna define how the >>> database looks. >>> >>> -- >>> |switchid|switchport | >>> -- >>> |1 | 1 | >>> |1 | 2 | >>> |1 | 3 | >>> |1 | 4 | >>> |1 | 7 | >>> |1 | 10| >>> -- >> >> I'm sure the code that people have posted will work if you do more >> than just copy/paste it and try to understand it and match it to what >> you want. >> >> >> $switch_ports_taken = array(); >> >> $query = "select switchport from table where switchid=1"; >> $result = mysql_query($query); >> >> if (!$result) die("error: " . mysql_error()); >> >> while($row = mysql_fetch_assoc($result)) { >> array_push($switch_ports_taken, $row['switchport']); >> } >> >> echo "Got these ports: " . print_r($switch_ports_taken, true) . ""; >> >> $all_ports = range(1,24); >> >> $unused_ports = array_diff($all_ports, $switch_ports_taken); >> >> echo "Unused ports: " . print_r($unused_ports, true) . ""; >> >> >> If that doesn't work tell us what doesn't work and don't make us guess >> what's going on. >> >> -- >> Postgresql & php tutorials >> http://www.designmagick.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] Still trying to figure this out...
Ya know, after working on this for 2 days straight, I have tried my own work. I never said I was an expert at php, that's why this list is here, so the next time you critisize someone, keep it to your self cause no one cares to hear about it. If you dont wanna help, then stfu. - Original Message - From: "Jochem Maas" <[EMAIL PROTECTED]> To: "Rob W." <[EMAIL PROTECTED]> Cc: Sent: Tuesday, June 20, 2006 3:54 AM Subject: Re: [PHP] Still trying to figure this out... Rob W. wrote: OMG Chris, Thankyou very much. That is exactally what I needed. If you wish for me to pay you some amount, I will be very happy to. Please send me a private email where I can paypal you. If not, Thank you again very much for the help. just do us all a favor and only come back when you have grasped the concept of debugging/investigating a problem (any problem) and doing your *own* work. Sorry everyone for the hastle for those of you wernt able to help with ['wernt'? that is not a word.] what Chris wrote is a tiny variation of code examples that have been posted by at least 4 different people. the fact is that you didn't bother to study the code and just pasted into your script expecting it to work. what I wanted. - Rob - Original Message - From: "Chris" <[EMAIL PROTECTED]> To: "Rob W." <[EMAIL PROTECTED]> Cc: Sent: Tuesday, June 20, 2006 1:39 AM Subject: Re: [PHP] Still trying to figure this out... Rob W. wrote: I still have not yet found anybody to help me with this. All the code that people have given me has not worked at all. I still get no output. So to add a little more to this, I'm gonna define how the database looks. -- |switchid|switchport | -- |1 | 1 | |1 | 2 | |1 | 3 | |1 | 4 | |1 | 7 | |1 | 10| -- I'm sure the code that people have posted will work if you do more than just copy/paste it and try to understand it and match it to what you want. $switch_ports_taken = array(); $query = "select switchport from table where switchid=1"; $result = mysql_query($query); if (!$result) die("error: " . mysql_error()); while($row = mysql_fetch_assoc($result)) { array_push($switch_ports_taken, $row['switchport']); } echo "Got these ports: " . print_r($switch_ports_taken, true) . ""; $all_ports = range(1,24); $unused_ports = array_diff($all_ports, $switch_ports_taken); echo "Unused ports: " . print_r($unused_ports, true) . ""; If that doesn't work tell us what doesn't work and don't make us guess what's going on. -- Postgresql & php tutorials http://www.designmagick.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] Still trying to figure this out...
Rob W. wrote: Ya know, after working on this for 2 days straight, I have tried my own work. I never said I was an expert at php, that's why this list is here, so the next time you critisize someone, keep it to your self cause no one cares to hear about it. If you dont wanna help, then stfu. Just one more suggestion before we all STFU and leave you to work it out for yourself... you do have PHP set up to display errors right? You've said several times that you "get no output" which leads me to believe you're trying to code with one hand tied behind your back and a red-hot poker in each eye. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still trying to figure this out...
Yes, I do have it setup right to display my errors, the reason why I wasnt getting any input is because when the array was matched to range(1,24) and the other array had nothing in it, I was either getting a list of numbers 1 though 24 or nothing at all. - Rob - Original Message - From: "Stut" <[EMAIL PROTECTED]> To: "Rob W." <[EMAIL PROTECTED]> Cc: Sent: Tuesday, June 20, 2006 4:08 AM Subject: Re: [PHP] Still trying to figure this out... Rob W. wrote: Ya know, after working on this for 2 days straight, I have tried my own work. I never said I was an expert at php, that's why this list is here, so the next time you critisize someone, keep it to your self cause no one cares to hear about it. If you dont wanna help, then stfu. Just one more suggestion before we all STFU and leave you to work it out for yourself... you do have PHP set up to display errors right? You've said several times that you "get no output" which leads me to believe you're trying to code with one hand tied behind your back and a red-hot poker in each eye. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still trying to figure this out...
Rob W. wrote: > Ya know, after working on this for 2 days straight, I have tried my own so what. > work. I never said I was an expert at php, neither did I. > that's why this list is here, really, could you please quote your support contract number. > so the next time you critisize someone, keep it to your self cause no > one cares to hear about it. If you dont wanna help, then stfu. your right about not wanting to help you - you silly little toad. > > > - Original Message - From: "Jochem Maas" <[EMAIL PROTECTED]> > To: "Rob W." <[EMAIL PROTECTED]> > Cc: > Sent: Tuesday, June 20, 2006 3:54 AM > Subject: Re: [PHP] Still trying to figure this out... > > >> Rob W. wrote: >>> OMG Chris, Thankyou very much. That is exactally what I needed. If you >>> wish for me to pay you some amount, I will be very happy to. Please send >>> me a private email where I can paypal you. If not, Thank you again very >>> much for the help. >> >> just do us all a favor and only come back when you have grasped the >> concept >> of debugging/investigating a problem (any problem) and doing your >> *own* work. >> >>> >>> Sorry everyone for the hastle for those of you wernt able to help with >> >> ['wernt'? that is not a word.] >> >> what Chris wrote is a tiny variation of code examples that have been >> posted >> by at least 4 different people. the fact is that you didn't bother to >> study the code and just pasted into your script expecting it to work. >> >>> what I wanted. >>> >>> - Rob >>> >>> - Original Message - From: "Chris" <[EMAIL PROTECTED]> >>> To: "Rob W." <[EMAIL PROTECTED]> >>> Cc: >>> Sent: Tuesday, June 20, 2006 1:39 AM >>> Subject: Re: [PHP] Still trying to figure this out... >>> >>> Rob W. wrote: > I still have not yet found anybody to help me with this. All the code > that people have given me has not worked at all. I still get no > output. So to add a little more to this, I'm gonna define how the > database looks. > > -- > |switchid|switchport | > -- > |1 | 1 | > |1 | 2 | > |1 | 3 | > |1 | 4 | > |1 | 7 | > |1 | 10| > -- I'm sure the code that people have posted will work if you do more than just copy/paste it and try to understand it and match it to what you want. $switch_ports_taken = array(); $query = "select switchport from table where switchid=1"; $result = mysql_query($query); if (!$result) die("error: " . mysql_error()); while($row = mysql_fetch_assoc($result)) { array_push($switch_ports_taken, $row['switchport']); } echo "Got these ports: " . print_r($switch_ports_taken, true) . ""; $all_ports = range(1,24); $unused_ports = array_diff($all_ports, $switch_ports_taken); echo "Unused ports: " . print_r($unused_ports, true) . ""; If that doesn't work tell us what doesn't work and don't make us guess what's going on. -- Postgresql & php tutorials http://www.designmagick.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] Still trying to figure this out...
- Original Message - From: "Jochem Maas" <[EMAIL PROTECTED]> To: "Rob W." <[EMAIL PROTECTED]> Cc: Sent: Tuesday, June 20, 2006 4:13 AM Subject: Re: [PHP] Still trying to figure this out... Rob W. wrote: Ya know, after working on this for 2 days straight, I have tried my own so what. Why the heck you bitching then? work. I never said I was an expert at php, neither did I. Dont complain about people asking for help when that is what this list is for. that's why this list is here, really, could you please quote your support contract number. If it's not, dont reply then idiot. so the next time you critisize someone, keep it to your self cause no one cares to hear about it. If you dont wanna help, then stfu. your right about not wanting to help you - you silly little toad. Good, ignore my posts and shut the hell up about it, no one want's your opinion. - Original Message - From: "Jochem Maas" <[EMAIL PROTECTED]> To: "Rob W." <[EMAIL PROTECTED]> Cc: Sent: Tuesday, June 20, 2006 3:54 AM Subject: Re: [PHP] Still trying to figure this out... Rob W. wrote: OMG Chris, Thankyou very much. That is exactally what I needed. If you wish for me to pay you some amount, I will be very happy to. Please send me a private email where I can paypal you. If not, Thank you again very much for the help. just do us all a favor and only come back when you have grasped the concept of debugging/investigating a problem (any problem) and doing your *own* work. Sorry everyone for the hastle for those of you wernt able to help with ['wernt'? that is not a word.] what Chris wrote is a tiny variation of code examples that have been posted by at least 4 different people. the fact is that you didn't bother to study the code and just pasted into your script expecting it to work. what I wanted. - Rob - Original Message - From: "Chris" <[EMAIL PROTECTED]> To: "Rob W." <[EMAIL PROTECTED]> Cc: Sent: Tuesday, June 20, 2006 1:39 AM Subject: Re: [PHP] Still trying to figure this out... Rob W. wrote: I still have not yet found anybody to help me with this. All the code that people have given me has not worked at all. I still get no output. So to add a little more to this, I'm gonna define how the database looks. -- |switchid|switchport | -- |1 | 1 | |1 | 2 | |1 | 3 | |1 | 4 | |1 | 7 | |1 | 10| -- I'm sure the code that people have posted will work if you do more than just copy/paste it and try to understand it and match it to what you want. $switch_ports_taken = array(); $query = "select switchport from table where switchid=1"; $result = mysql_query($query); if (!$result) die("error: " . mysql_error()); while($row = mysql_fetch_assoc($result)) { array_push($switch_ports_taken, $row['switchport']); } echo "Got these ports: " . print_r($switch_ports_taken, true) . ""; $all_ports = range(1,24); $unused_ports = array_diff($all_ports, $switch_ports_taken); echo "Unused ports: " . print_r($unused_ports, true) . ""; If that doesn't work tell us what doesn't work and don't make us guess what's going on. -- Postgresql & php tutorials http://www.designmagick.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] Still trying to figure this out...
Rob W. wrote: > ... > > Dont complain about people asking for help when that is what this list > is for. I wasn't complaining Rob, merely trying to point out that 'help' != 'do my work for me' > >> >>> that's why this list is here, >> >> really, could you please quote your support contract number. >> > > If it's not, dont reply then idiot. > >> >>> so the next time you critisize someone, keep it to your self cause no >>> one cares to hear about it. If you dont wanna help, then stfu. >> >> your right about not wanting to help you - you silly little toad. >> > > Good, ignore my posts and shut the hell up about it, no one want's your > opinion. a, whether you or anyone else *wants* my opinion is irrelevant. b, I'm quite sure there are a couple of people here that appreciate at least *some* of my input on this list. that said: Rob meet /dev/null, /dev/null say hallo to Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] comparing a string
I have a quiz where the ansers are held in a array called $correct answers. When I compare the string if ($_REQUEST['x']= $correct_answers[$page-1]) { with a double == the answer is always correct with the single = it is always wrong. when I echo out the posted answer and the value from the answers arrray they are correct. echo "post equals".$_POST['x']." corect answer is".$correct_answers[$page-1]; Ross -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] User Login Problem
Hi, I am facing one problem in my project.i want to restrict more than one user login in the same account .Is there any functions available to check r we can implement using session. A.suresh - Yahoo! India Answers: Share what you know. Learn something new Click here Send free SMS to your Friends on Mobile from your Yahoo! Messenger Download now
Re: [PHP] User Login Problem
suresh kumar wrote: > Hi, > I am facing one problem in my project.i want to restrict more than one > user login in the same account .Is there any functions available to check r > we can implement using session. probably. > > A.suresh > > > - > Yahoo! India Answers: Share what you know. Learn something new Click here > Send free SMS to your Friends on Mobile from your Yahoo! Messenger Download > now -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: comparing a string
(inline) Ross wrote: I have a quiz where the ansers are held in a array called $correct answers. When I compare the string if ($_REQUEST['x']= $correct_answers[$page-1]) { with a double == the answer is always correct with the single = it is always wrong. A single "=" it's an assignment, not a comparison; and though it sometimes work, you shouldn't compare strings with "==", but using string functions, such as strcmp()... or similar_text(), etc. when I echo out the posted answer and the value from the answers arrray they are correct. echo "post equals".$_POST['x']." corect answer is".$correct_answers[$page-1]; -- Atentamente / Sincerely, J. Rafael Salazar Magaña -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] User Login Problem
Or make your own, might be easier to do. On 6/20/06, suresh kumar <[EMAIL PROTECTED]> wrote: Hi, I am facing one problem in my project.i want to restrict more than one user login in the same account .Is there any functions available to check r we can implement using session. A.suresh - Yahoo! India Answers: Share what you know. Learn something new Click here Send free SMS to your Friends on Mobile from your Yahoo! Messenger Download now -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: User Login Problem
suresh kumar schrieb: Hi, I am facing one problem in my project.i want to restrict more than one user login in the same account . Is there any functions available to check r we can implement using session. Nothing specialized than that. Barry -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] comparing a string
= is the assignment operator. It is not a comparison. == is the weak equality comparator. === is the strong equality comparator. On Tuesday 20 June 2006 06:43, Ross wrote: > I have a quiz where the ansers are held in a array called $correct answers. > When I compare the string > > if ($_REQUEST['x']= $correct_answers[$page-1]) { > > > > with a double == the answer is always correct with the single = it is > always wrong. > > when I echo out the posted answer and the value from the answers arrray > they are correct. > > > echo "post equals".$_POST['x']." corect answer > is".$correct_answers[$page-1]; > > Ross -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 "If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still trying to figure this out...
At 11:43 AM +0200 6/20/06, Jochem Maas wrote: > > >a, whether you or anyone else *wants* my opinion is irrelevant. >b, I'm quite sure there are a couple of people here that appreciate at least >*some* of my input on this list. You can count me into that "couple of people" group. I've always found your opinion very informative and professional. tedd PS: Rob W -- no matter how you cut it, yours was not the way to replay help. -- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still trying to figure this out...
At 4:19 AM -0500 6/20/06, Rob W. wrote: >- Original Message - From: "Jochem Maas" <[EMAIL PROTECTED]> >To: "Rob W." <[EMAIL PROTECTED]> >Cc: >Sent: Tuesday, June 20, 2006 4:13 AM >Subject: Re: [PHP] Still trying to figure this out... > > >snip > Ahhh crap -- does this mean none of us get paid? Ruined my day. tedd -- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] comparing strings - again!
if (isset($_POST['Submit'])) { //echo "post equals".$_POST['x']." corect is".$correct_answers[$page-1]; $compare1 = $_POST['x']; echo "page is".$page; $compare2 = $correct_answers[($page-1)]; echo "compare1 is ".$compare1; echo ""; echo "compare2 is ".$compare2; if (strcmp($compare1, $compare2) == 0) { $incrementedPage = $page + 1; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] comparing a string
At 12:43 PM +0100 6/20/06, Ross wrote: >I have a quiz where the ansers are held in a array called $correct answers. >When I compare the string > >if ($_REQUEST['x']= $correct_answers[$page-1]) { > > > >with a double == the answer is always correct with the single = it is always >wrong. > >when I echo out the posted answer and the value from the answers arrray they >are correct. When you say == the answer is always correct -- does that mean even when the answer is wrong? If so, then there's something else going on here. But, I believe the answer is: if ($_REQUEST['x'] == $correct_answers[$page-1]) { This will compare the two and if they are the same will report true. You should read the manual. hth's tedd -- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: comparing strings - again!
This does not work although when I echo out the strings they are exactly the same. Strange! "Ross" <[EMAIL PROTECTED]> wrote in message news:... > if (isset($_POST['Submit'])) { > //echo "post equals".$_POST['x']." corect > is".$correct_answers[$page-1]; > $compare1 = $_POST['x']; > echo "page is".$page; > $compare2 = $correct_answers[($page-1)]; > echo "compare1 is ".$compare1; > echo ""; > echo "compare2 is ".$compare2; > > if (strcmp($compare1, $compare2) == 0) { > $incrementedPage = $page + 1; > ?> > > > > //header("Location: evaluation.php?page=$incrementedPage"); > } > > else { > $chances++; > echo "you have had".$chances; > } > > } > > > ?> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_db_query & INSERT
At 8:47 AM +0600 6/20/06, Prathaban Mookiah wrote: >I have run into a tricky situation and need some help to work my way through >the problem. I use MySQL. > >I accept some data from the user and insert them into two tables. > >1. I insert part of the data into the first table. I do not specify the >primary key field. It is auto generated through auto_increment. All the >other fields can have duplicates. >2. Then I want to insert the other part of the data along with the primary >key that was automatically generated during the previous insert operation >into the second table. > >My problem is this: How do I retrieve the auto generated primary key field >in the first table during the first insert operation. I cannot go back to >the table and query using the data I inserted since as I mentioned earlier >there can be duplicates. I simply cannot retreive the maximum value since >some other user could have inserted something during that time. > >Any ideas? > >Thanks in advance. > >Cheers, > >Prathap Prathap: I had a similar problem -- I solved it my generating a unique_id field in the record. That way whenever I wanted to find a specific record, even among duplicates, I could do so. hth's tedd -- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: comparing strings - again!
var_dump gives Company Director string(17) Company Director string(16) Why would they be different? Seems like they have add some extra whitespace? R. - Original Message - From: "Jochem Maas" <[EMAIL PROTECTED]> To: "Ross" <[EMAIL PROTECTED]> Cc: Sent: Tuesday, June 20, 2006 3:57 PM Subject: Re: [PHP] Re: comparing strings - again! Ross wrote: This does not work although when I echo out the strings they are exactly the same. Strange! try using var_dump($compare1, $compare2); "Ross" <[EMAIL PROTECTED]> wrote in message news:... if (isset($_POST['Submit'])) { //echo "post equals".$_POST['x']." corect is".$correct_answers[$page-1]; $compare1 = $_POST['x']; echo "page is".$page; $compare2 = $correct_answers[($page-1)]; echo "compare1 is ".$compare1; echo ""; echo "compare2 is ".$compare2; if (strcmp($compare1, $compare2) == 0) { $incrementedPage = $page + 1; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: comparing strings - again!
Soted it was an extra whitespace character being added to the posted answer. The var_dump function highlighted it! nice Work Jochem. No idea where it campe from though! R. - Original Message - From: "Jochem Maas" <[EMAIL PROTECTED]> To: "Ross" <[EMAIL PROTECTED]> Cc: Sent: Tuesday, June 20, 2006 3:57 PM Subject: Re: [PHP] Re: comparing strings - again! Ross wrote: This does not work although when I echo out the strings they are exactly the same. Strange! try using var_dump($compare1, $compare2); "Ross" <[EMAIL PROTECTED]> wrote in message news:... if (isset($_POST['Submit'])) { //echo "post equals".$_POST['x']." corect is".$correct_answers[$page-1]; $compare1 = $_POST['x']; echo "page is".$page; $compare2 = $correct_answers[($page-1)]; echo "compare1 is ".$compare1; echo ""; echo "compare2 is ".$compare2; if (strcmp($compare1, $compare2) == 0) { $incrementedPage = $page + 1; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: comparing strings - again!
[EMAIL PROTECTED] wrote: > var_dump gives > > Company Director string(17) > > Company Director string(16) > > Why would they be different? probably because there is either: 1. white space in the value in your data source 2. white space being outputted along side the value when creating a form field weith that valu that and/or possible the fact that your doing a trim() in one place but not in another - personally I usually trim() incoming string data (regardless of any other validation/sanitation) to avoid stuff like this > Seems like they have add some extra > whitespace? exactly. btw: var_dump() should be showing exactly where the white space is e.g.: code: http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: comparing a string
Rafael wrote: A single "=" it's an assignment, not a comparison; and though it sometimes work, you shouldn't compare strings with "==", but using string functions, such as strcmp()... or similar_text(), etc. This is PHP, not C. Operators such as == support strings for a reason, people should use them as such. If you need to ensure type, (so that 0 == "foo" doesn't return true), then you can use ===. Using a function call that does more than you need when there is an operator to achieve the same goal is bad advice. Not to mention the fact that it leads to harder to read code. Which of these has a more readily apparent meaning? if ( strcmp($foo,$bar) == 0 ) if ( $foo === $bar ) Regards, Adam Zey. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: comparing strings - again!
Ross wrote: > This does not work although when I echo out the strings they are exactly the > same. Strange! try using var_dump($compare1, $compare2); > > > "Ross" <[EMAIL PROTECTED]> wrote in message news:... >> if (isset($_POST['Submit'])) { >> //echo "post equals".$_POST['x']." corect >> is".$correct_answers[$page-1]; >> $compare1 = $_POST['x']; >> echo "page is".$page; >> $compare2 = $correct_answers[($page-1)]; >> echo "compare1 is ".$compare1; >> echo ""; >> echo "compare2 is ".$compare2; >> >> if (strcmp($compare1, $compare2) == 0) { >> $incrementedPage = $page + 1; >> ?> >> >> >> >> > //header("Location: evaluation.php?page=$incrementedPage"); >> } >> >> else { >> $chances++; >> echo "you have had".$chances; >> } >> >> } >> >> >> ?> >> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_db_query & INSERT
After you do your first insert, do: $insertedid = mysql_insert_id(); That will give you the autoincrement ID from the last INSERT you did. Note, this doesn't retrieve the last autoincrement ID from any insert, just the last one for thta specific mysql connection. So you don't have to worry about about user's INSERT messing up your operations. Another note, as a bit of trivia, some database systems allow access to both the last ID inserted for your session or the last ID inserted by any sessions. Been a couple of years, but I believe in MS SQL Server, using SQL, it was "SELECT @IDENTITY" to get the last inserted ID from any session and "SELECT @@IDENTITY" (two @'s) to get the last one inserted by your session. Last note, if you do a mysql_close() or break the connection somehow, you've closed that particular session. Even if you re-open it, you can't do mysql_insert_id() to retrieve your last insert since it's tied to that particular connection. Once it's closed, you no longer have a handle that points to the previous operations (at least that's how I remember it working.. could always be some caveats I've forgotten). -TG = = = Original message = = = At 8:47 AM +0600 6/20/06, Prathaban Mookiah wrote: >I have run into a tricky situation and need some help to work my way through >the problem. I use MySQL. > >I accept some data from the user and insert them into two tables. > >1. I insert part of the data into the first table. I do not specify the >primary key field. It is auto generated through auto_increment. All the >other fields can have duplicates. >2. Then I want to insert the other part of the data along with the primary >key that was automatically generated during the previous insert operation >into the second table. > >My problem is this: How do I retrieve the auto generated primary key field >in the first table during the first insert operation. I cannot go back to >the table and query using the data I inserted since as I mentioned earlier >there can be duplicates. I simply cannot retreive the maximum value since >some other user could have inserted something during that time. > >Any ideas? > >Thanks in advance. > >Cheers, > >Prathap ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] complex control structure- please help
Hi all, This may not be complex at all- maybe my head is just screwed up this afternoon! I am looping through arrays all at one time for the following- $filter_subject $filter_body $filter_email $filter_subject_like $filter_body_like $filter_email_like Examples of the following could be- $filter_subject[0] = "This is the subject"; $filter_body[0] = "This is the body"; $filter_email[0] = "[EMAIL PROTECTED]"; $filter_subject_like[0] = ""; $filter_body_like[0] = ""; $filter_email_like[0] = ""; $filter_subject[1] = ""; $filter_body[1] = ""; $filter_email[1] = ""; $filter_subject_like[1] = "lots of nice things"; $filter_body_like[1] = "horrible body text"; $filter_email_like[1] = "[EMAIL PROTECTED]"; $filter_subject[2] = ""; $filter_body[2] = ""; $filter_email[2] = ""; $filter_subject_like[2] = "Lots of nice things"; $filter_body_like[2] = ""; $filter_email_like[2] = ""; $filter_subject[3] = ""; $filter_body[3] = "This is the complete body"; $filter_email[3] = ""; $filter_subject_like[3] = "Part of the subject"; $filter_body_like[3] = ""; $filter_email_like[3] = ""; I then run something like the following on the variables $subject, $body, $email, $subject_like, $body_like and $email_like for($e=0;$e if($subject == $filter_subject[$e]) {$found_subject = 1;}// Subject has been found if($body == $filter_body[$e]) {$found_body = 1;}// Body has been found if($email == $filter_email[$e]) {$found_email = 1;}// Email has been found if(strpos($subject_like, $filter_subject_like[$e])) {$found_subject_like = 1;}// Subject(like) has been found if(strpos($body_like, $filter_body_like[$e])) {$found_body_like = 1;}// Body(like) has been found if(strpos($email_like, $filter_email_like[$e])) {$found_email_like = 1;}// Email(like) has been found ... } What I want to do is work out if (from the above examples) the following (not written in php by the way, just in kind of english) example 0 - if - ($subject == "This is the subject" AND $body == "This is the body" AND $email == "[EMAIL PROTECTED]") THEN DO THE FOLLOWING example 1 - if - ($subject == "lots of nice things" AND $body_like contains "horrible body text" AND $email contains "[EMAIL PROTECTED]") THEN DO THE FOLLOWING example 2 if - ($subject contains "Lots of nice things") THEN DO THE FOLLOWING example 3 if - ($body == "This is the complete body" AND $subject contains "Part of the subject") THEN DO THE FOLLOWING How can I organise a control structure so that I can do the above? My brain is hurting and I could do with some thoughts from you guys! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: comparing strings - again!
Jochem Maas wrote: [EMAIL PROTECTED] wrote: var_dump gives Company Director string(17) Company Director string(16) Why would they be different? probably because there is either: 1. white space in the value in your data source 2. white space being outputted along side the value when creating a form field weith that valu that and/or possible the fact that your doing a trim() in one place but not in another - personally I usually trim() incoming string data (regardless of any other validation/sanitation) to avoid stuff like this Seems like they have add some extra whitespace? exactly. btw: var_dump() should be showing exactly where the white space is e.g.: code: Without the quotes he's not going to see the extra white space though, as the browser is going to render the first space it comes too, but it will piss on any white space after that (for display purpose). Main reason I wrap my debugging data in . -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Paging Help
I have the following problem, I need to make a paging system to show results from search on a Mysql database. I found a class that should do the job but couldn't figure it out how to use it. Does anybody has an Idea of hos to do this? I thank in advance for any help you guys can provide me. Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Paging Help
Links for the pages --- First page: this_page.php?pag=1 Previous page: this_page?pag= Next page: this_page?pag= Last page: this_page?pag= Rodrigo de Oliveira Costa escribió: I have the following problem, I need to make a paging system to show results from search on a Mysql database. I found a class that should do the job but couldn't figure it out how to use it. Does anybody has an Idea of hos to do this? I thank in advance for any help you guys can provide me. Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Paging Help
Juanjo Pascual wrote: > // Num of records each time > $NUM_RECORDS = 10; > > if ($_GET["pag"] == "") { >$ini = 0; >$pag = 1; > } > else { >$ini = ($pag - 1) * $NUM_RECORDS; > } > > // Query to show > $query_rsData = "SELECT * FROM table LIMIT " . $ini . ", " . $NUM_RECORDS; > $rsData = mysql_query($query_rsData, $DB_CONECTION); > > // Total records > $query_rsData2 = "SELECT * FROM table"; > $rsData2 = mysql_query($query_rsData2, $DB_CONECTION); > $num_total_records = mysql_num_rows($rsData2); > Since you query all enregs from table why not query all first and the do mysql_data_seek on result? // Query to show $query_rsData = "SELECT * FROM {table} ORDER BY {Whatever field}"; $rsData = mysql_query($query_rsData, $DB_CONECTION); $num_total_records = mysql_num_rows( $rsData ); $total_pag = ceil($num_total_records / $NUM_RECORDS); if( $pag < 1 ) $pag = 1; elseif( $pag > $total_pag ) $pag = $total_pag; $start_enreg = ($pag-1) * $NUM_RECORDS; @mysql_data_seek( $rsData, $start_enreg ); while( ($result = mysql_fetch_object( $rsData )) ) { // display data... } > // Total pages > $total_pag = ceil($num_total_records / $NUM_RECORDS); > > $previous_page = $pag - 1; > $next_page = $pag + 1; > ?> > > Links for the pages > --- > > First page: this_page.php?pag=1 > Previous page: this_page?pag= > Next page: this_page?pag= > Last page: this_page?pag= > > > Rodrigo de Oliveira Costa escribió: >> I have the following problem, I need to make a paging system to show >> results from search on a Mysql database. I found a class that >> should do the job but couldn't figure it out how to use it. Does >> anybody has an Idea of hos to do this? I thank in advance for any help >> you guys can provide me. >> Rodrigo >> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [?? Probable Spam] [PHP] MYSQL_CONNECT vs MYSQL_PCONNECT
As you didn't mentioned what you use your queries for, maybe read the manual? Andy Juanjo Pascual wrote: > How can i know which of both is better to use each time? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Paging Help
Andrei wrote: Since you query all enregs from table why not query all first and the do mysql_data_seek on result? // Query to show $query_rsData = "SELECT * FROM {table} ORDER BY {Whatever field}"; $rsData = mysql_query($query_rsData, $DB_CONECTION); $num_total_records = mysql_num_rows( $rsData ); $total_pag = ceil($num_total_records / $NUM_RECORDS); if( $pag < 1 ) $pag = 1; elseif( $pag > $total_pag ) $pag = $total_pag; $start_enreg = ($pag-1) * $NUM_RECORDS; @mysql_data_seek( $rsData, $start_enreg ); while( ($result = mysql_fetch_object( $rsData )) ) { // display data... } Querying all data in the first place is a waste, and the practice of seeking through a dataset seems silly when MySQL has the "LIMIT" feature to specify which data you want to return. I believe the proper way to do this would be something like this (Simplified example, of course): $query = "SELECT SQL_CALC_FOUND_FOWS * FROM foo LIMIT 30, 10"; $result = mysql_query($query); $query = "SELECT found_rows()"; $num_rows = mysql_result(mysql_query($query), 0); That should be much faster than the methods used by either of you guys. As a comment, it would have been better to do "SELECT COUNT(*) FROM foo" and reading the result rather than doing "SELECT * FROM foo" and then mysql_num_rows(). Don't ask MySQL to collect data if you're not going to use it! That actually applies to why you shouldn't use mysql_data_seek either. Regards, Adam. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] shutting down a web app for maintenance
Hello All, I'm not sure this is strictly a PHP related question or perhaps a server admin question as well. What do you do when you are trying to shutdown a web application for maintenance (like a membership or registration-required system)? I understand that you can temporarily upload or activate a holding page that prevents users from continuing to login/use the system, but how can you insure that there are no ongoing sessions or users still in the process of doing something? What's the best method for handling this, especially if you don't have full control of the server hosting the web app? Thanks for any advice, - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] shutting down a web app for maintenance
Assuming you're using a web server that supports htaccess files, you could easily just pop in a .htaccess file that denies access to everything. You could even add a PHP ini directive like: php_value auto_prepend_file "maintenance.php" where maintenance.php could contain something like: Down for MaintenanceSite down for maintenance! (Or, to be sure, you could do both.) jon Ben Liu wrote: Hello All, I'm not sure this is strictly a PHP related question or perhaps a server admin question as well. What do you do when you are trying to shutdown a web application for maintenance (like a membership or registration-required system)? I understand that you can temporarily upload or activate a holding page that prevents users from continuing to login/use the system, but how can you insure that there are no ongoing sessions or users still in the process of doing something? What's the best method for handling this, especially if you don't have full control of the server hosting the web app? Thanks for any advice, - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MYSQL_CONNECT vs MYSQL_PCONNECT
How can i know which of both is better to use each time? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MYSQL_CONNECT vs MYSQL_PCONNECT
On Tue, 2006-06-20 at 12:34, Juanjo Pascual wrote: > How can i know which of both is better to use each time? Use mysql_pconnect() if the connection overhead is large. This is usually the case if the database is off on a remote server somewhere in lala land. Remote servers within your LAN don't usually require mysql_pconnect(). Use mysql_connect() for pretty much all other connections. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MYSQL_CONNECT vs MYSQL_PCONNECT
If you're not sure you should probably stick with mysql_connect() - otherwise you could end up bogging down mysql with way more connections than you need if you're not careful. On Jun 20, 2006, at 12:34 PM, Juanjo Pascual wrote: How can i know which of both is better to use each time? -- 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] shutting down a web app for maintenance
Hi Jon, Thanks for the response. What would these solutions mean in regards to users who are active at the moment that the .htaccess file is added? Would it be wise to force some kind of logout, destruction of open sessions, etc. I guess there is no simple, graceful way to allow users to complete whatever they are doing and then kick them off while preventing new users from logging in. I was thinking for example, what if someone is in the process of uploading a file to the web app host or filling out step 2 of a 4 part membership form or something that requires multiple steps. - Ben On 6/20/06, Jon Anderson <[EMAIL PROTECTED]> wrote: Assuming you're using a web server that supports htaccess files, you could easily just pop in a .htaccess file that denies access to everything. You could even add a PHP ini directive like: php_value auto_prepend_file "maintenance.php" where maintenance.php could contain something like: Down for MaintenanceSite down for maintenance! (Or, to be sure, you could do both.) jon Ben Liu wrote: > Hello All, > > I'm not sure this is strictly a PHP related question or perhaps a > server admin question as well. What do you do when you are trying to > shutdown a web application for maintenance (like a membership or > registration-required system)? I understand that you can temporarily > upload or activate a holding page that prevents users from continuing > to login/use the system, but how can you insure that there are no > ongoing sessions or users still in the process of doing something? > What's the best method for handling this, especially if you don't have > full control of the server hosting the web app? > > Thanks for any advice, > > - Ben > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: shutting down a web app for maintenance
Ben Liu wrote: Hello All, I'm not sure this is strictly a PHP related question or perhaps a server admin question as well. What do you do when you are trying to shutdown a web application for maintenance (like a membership or registration-required system)? I understand that you can temporarily upload or activate a holding page that prevents users from continuing to login/use the system, but how can you insure that there are no ongoing sessions or users still in the process of doing something? What's the best method for handling this, especially if you don't have full control of the server hosting the web app? Thanks for any advice, - Ben I normally do what you say; activate a holding page. The question comes to mind, does it really matter if a user's session is interrupted? Is the web application dealing with data that is critical enough (or non-critical data in a possibly destructive manner) that you can't just cut them off for a while? You have to consider that users could just as easily be cut off by a server crash, packetloss/network issues (on your end OR theirs, or anywhere in between), or just might hit the stop button while a script is running (Which, IIRC, ordinarily terminates the script the next time you try to send something). If your web app works in a way such that you can't just pull the plug and everything is fine, you're running some pretty big risks that your app will get into unrecoverable states from everyday issues. If you wanted to get fancy, you could code your system to prevent new logins, expire normal logins much faster (Say, after 15 minutes instead of hours or days), and then wait for all users to be logged out before continuing. Regards, Adam Zey. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: shutting down a web app for maintenance
Thanks Adam, What you say makes good sense to me. Is there some method to run a script that kills all active sessions on a host? It could become part of the maintenance script I suppose: 1) Kill all active sessions 2) Put up generic maintenance screen 3) Deny further login attempts - Ben On 6/20/06, Adam Zey <[EMAIL PROTECTED]> wrote: Ben Liu wrote: > Hello All, > > I'm not sure this is strictly a PHP related question or perhaps a > server admin question as well. What do you do when you are trying to > shutdown a web application for maintenance (like a membership or > registration-required system)? I understand that you can temporarily > upload or activate a holding page that prevents users from continuing > to login/use the system, but how can you insure that there are no > ongoing sessions or users still in the process of doing something? > What's the best method for handling this, especially if you don't have > full control of the server hosting the web app? > > Thanks for any advice, > > - Ben I normally do what you say; activate a holding page. The question comes to mind, does it really matter if a user's session is interrupted? Is the web application dealing with data that is critical enough (or non-critical data in a possibly destructive manner) that you can't just cut them off for a while? You have to consider that users could just as easily be cut off by a server crash, packetloss/network issues (on your end OR theirs, or anywhere in between), or just might hit the stop button while a script is running (Which, IIRC, ordinarily terminates the script the next time you try to send something). If your web app works in a way such that you can't just pull the plug and everything is fine, you're running some pretty big risks that your app will get into unrecoverable states from everyday issues. If you wanted to get fancy, you could code your system to prevent new logins, expire normal logins much faster (Say, after 15 minutes instead of hours or days), and then wait for all users to be logged out before continuing. Regards, Adam Zey. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: shutting down a web app for maintenance
Shutting down Apache would do the trick ;) But if you're in a shared hosting environment that may not be possible. As for sessions, it depends how you track them. You can't kill all PHP sessions in one go, but you could have your web app nuke the sessions of users after they come back after maintenance. Something like first_login_after_maint in the database, that if set to true, mandates that any existing session data be destroyed before continuing. I assume that the reason you want to kill session data is because the data and how it is used would be different after the maintenance? Because otherwise, if you've denied all access to ANY of your webapp's php scripts, it shouldn't matter if the user has session data. If you physically move the web app's PHP scripts (Or set up a redirect, etc), they can't do anything with it. Regards, Adam Ben Liu wrote: Thanks Adam, What you say makes good sense to me. Is there some method to run a script that kills all active sessions on a host? It could become part of the maintenance script I suppose: 1) Kill all active sessions 2) Put up generic maintenance screen 3) Deny further login attempts - Ben On 6/20/06, Adam Zey <[EMAIL PROTECTED]> wrote: Ben Liu wrote: > Hello All, > > I'm not sure this is strictly a PHP related question or perhaps a > server admin question as well. What do you do when you are trying to > shutdown a web application for maintenance (like a membership or > registration-required system)? I understand that you can temporarily > upload or activate a holding page that prevents users from continuing > to login/use the system, but how can you insure that there are no > ongoing sessions or users still in the process of doing something? > What's the best method for handling this, especially if you don't have > full control of the server hosting the web app? > > Thanks for any advice, > > - Ben I normally do what you say; activate a holding page. The question comes to mind, does it really matter if a user's session is interrupted? Is the web application dealing with data that is critical enough (or non-critical data in a possibly destructive manner) that you can't just cut them off for a while? You have to consider that users could just as easily be cut off by a server crash, packetloss/network issues (on your end OR theirs, or anywhere in between), or just might hit the stop button while a script is running (Which, IIRC, ordinarily terminates the script the next time you try to send something). If your web app works in a way such that you can't just pull the plug and everything is fine, you're running some pretty big risks that your app will get into unrecoverable states from everyday issues. If you wanted to get fancy, you could code your system to prevent new logins, expire normal logins much faster (Say, after 15 minutes instead of hours or days), and then wait for all users to be logged out before continuing. Regards, Adam Zey. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: shutting down a web app for maintenance
On 6/20/06, Adam Zey <[EMAIL PROTECTED]> wrote: Shutting down Apache would do the trick ;) But if you're in a shared hosting environment that may not be possible. Yeah, don't have full control over the server in this case. As for sessions, it depends how you track them. You can't kill all PHP sessions in one go, but you could have your web app nuke the sessions of users after they come back after maintenance. Something like first_login_after_maint in the database, that if set to true, mandates that any existing session data be destroyed before continuing. How about iterating through the /tmp directory and deleting all the session cookies? On second thought, that would kill all the sessions for other apps as well. I assume that the reason you want to kill session data is because the data and how it is used would be different after the maintenance? Because otherwise, if you've denied all access to ANY of your webapp's php scripts, it shouldn't matter if the user has session data. If you physically move the web app's PHP scripts (Or set up a redirect, etc), they can't do anything with it. I didn't have a specific reason for doing it, just wasn't sure what the ramifications of having open sessions alive through the maintenance period and afterward might be so I thought it best to just kill them. It doesn't sound like anything horrible can happen except some inconvenience maybe. Regards, Adam Ben Liu wrote: > Thanks Adam, > > What you say makes good sense to me. Is there some method to run a > script that kills all active sessions on a host? It could become part > of the maintenance script I suppose: > > 1) Kill all active sessions > 2) Put up generic maintenance screen > 3) Deny further login attempts > > - Ben > > On 6/20/06, Adam Zey <[EMAIL PROTECTED]> wrote: >> Ben Liu wrote: >> > Hello All, >> > >> > I'm not sure this is strictly a PHP related question or perhaps a >> > server admin question as well. What do you do when you are trying to >> > shutdown a web application for maintenance (like a membership or >> > registration-required system)? I understand that you can temporarily >> > upload or activate a holding page that prevents users from continuing >> > to login/use the system, but how can you insure that there are no >> > ongoing sessions or users still in the process of doing something? >> > What's the best method for handling this, especially if you don't have >> > full control of the server hosting the web app? >> > >> > Thanks for any advice, >> > >> > - Ben >> >> I normally do what you say; activate a holding page. The question comes >> to mind, does it really matter if a user's session is interrupted? Is >> the web application dealing with data that is critical enough (or >> non-critical data in a possibly destructive manner) that you can't just >> cut them off for a while? >> >> You have to consider that users could just as easily be cut off by a >> server crash, packetloss/network issues (on your end OR theirs, or >> anywhere in between), or just might hit the stop button while a script >> is running (Which, IIRC, ordinarily terminates the script the next time >> you try to send something). If your web app works in a way such that you >> can't just pull the plug and everything is fine, you're running some >> pretty big risks that your app will get into unrecoverable states from >> everyday issues. >> >> If you wanted to get fancy, you could code your system to prevent new >> logins, expire normal logins much faster (Say, after 15 minutes instead >> of hours or days), and then wait for all users to be logged out before >> continuing. >> >> Regards, Adam Zey. >> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_db_query & INSERT
No. I was looking for a way to do it. mysql_insert_id did the job for me. I can't figure out how I missed out on this function. I browsed through the manual for 2 hours yesterday looking for such a function. Anway, thank you Jay and Chris. And you too John, for your attention. Cheers, Prathap -- Original Message --- From: John Nichel <[EMAIL PROTECTED]> To: Sent: Tue, 20 Jun 2006 00:19:20 -0400 Subject: Re: [PHP] mysql_db_query & INSERT > Jay Blanchard wrote: > > [snip] > > How do I retrieve the auto generated primary key field > > in the first table during the first insert operation. > > [/snip] > > > > http://www.php.net/mysql_insert_id > > > > You mean they have a manual for this stuff?? > > Holy Toledo! > > -- > By-Tor.com > ...it's all about the Rush > http://www.by-tor.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php --- End of Original Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: comparing strings - again!
John Nichel wrote: > Jochem Maas wrote: ... >> >> exactly. btw: var_dump() should be showing exactly where the white >> space is e.g.: >> >> >> code: >> > $s1 = "Company Director "; $s2 = "Company Director"; var_dump($s1, $s2); >> >> output: >> string(17) "Company Director " >> string(16) "Company Director" >> > > Without the quotes he's not going to see the extra white space though, > as the browser is going to render the first space it comes too, but it > will piss on any white space after that (for display purpose). Main > reason I wrap my debugging data in . I use too when debugging in the browser - but I was testing on the cmdline, that said var_dump() outputs the quotes when outputting to the browser too. I wasn't 100% sure but I just checked to be safe ;-) > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem displaying a mysql database field
Hi, I have a varchar field in a MySQL database that contains a line of text like so: "This is a line if text" The double quotes are included in the database field. I cannot seem to display it on my HTML page, it always shows as blank. I have tried using both the stripslashes() and the html_entity_decode() but it still shows as blank. How can I display this please??? Tks, Don
Re: [PHP] Problem displaying a mysql database field
Don wrote: I have a varchar field in a MySQL database that contains a line of text like so: "This is a line if text" The double quotes are included in the database field. I cannot seem to display it on my HTML page, it always shows as blank. I have tried using both the stripslashes() and the html_entity_decode() but it still shows as blank. How can I display this please??? Well, using my highly developed frontal lobe I can see from your code that... ahh, hang on a tick - you didn't include any code. Can't help, sorry. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Processing HTML in mail form
I've done the following code bellow for an e-mail form. But it handles the HTML tags as text. Is there anyway to get the HTML tags processed to form the mail? '. 'L-name: '.$lastname.''. 'Birth: '.$date_of_birth.''. 'Address: '.$post_address.''. 'Zip: '.$zip_code.''. 'City: '.$city.''. 'Phone: '.$phone.''. 'Mail: '.$mail.''. 'Desc: '.$description.''. 'Hair: '.$hairdresser.''. 'Make: '.$makeup; mail('[EMAIL PROTECTED]',$subject,$text,"From: $forname $lastname <$mail>"); ?> The mail looks like this when recived: F-namn: JL-namn: RBirth: 12Address: 34Zip: 56City: 78Phone: 90Mail: [EMAIL PROTECTED]Desc: NHair: hairMake: makeup Thanks in advance // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] For Loop
I have a regular for loop - for($i=1; $i<100; $i++) Within the loop I need to create variables named: $p1name; $p2name; $p3name; etc. The integer portion of each variable name needs to be the value of $i. I can't seem to get my syntax correct? Can someone point me in the right direction? Thanks. Albert Padley -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] For Loop
On Tuesday 20 June 2006 15:14, Albert Padley wrote: > I have a regular for loop - for($i=1; $i<100; $i++) > > Within the loop I need to create variables named: > > $p1name; > $p2name; > $p3name; > etc. > > The integer portion of each variable name needs to be the value of $i. > > I can't seem to get my syntax correct? > > Can someone point me in the right direction? > > Thanks. > > Albert Padley If you really want to keep the p?name syntax, I would suggest throwing them in an array with keys. $arr["p1name"] $arr["p2name"] Then that way you can create the key dynamically: $arr["p".$i."name"] Not pretty, but it works. Thanks, -- Ray Hauge Programmer/Systems Administrator American Student Loan Services www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] For Loop
for($i=1; $i<100; $i++) { ${'p'.$i.'name'} = 'whatever'; } - jeff On 20-Jun-06, at 6:14 PM, Albert Padley wrote: I have a regular for loop - for($i=1; $i<100; $i++) Within the loop I need to create variables named: $p1name; $p2name; $p3name; etc. The integer portion of each variable name needs to be the value of $i. I can't seem to get my syntax correct? Can someone point me in the right direction? Thanks. Albert Padley -- 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] For Loop
Ray Hauge wrote: On Tuesday 20 June 2006 15:14, Albert Padley wrote: I have a regular for loop - for($i=1; $i<100; $i++) Within the loop I need to create variables named: $p1name; $p2name; $p3name; etc. The integer portion of each variable name needs to be the value of $i. I can't seem to get my syntax correct? Can someone point me in the right direction? Thanks. Albert Padley If you really want to keep the p?name syntax, I would suggest throwing them in an array with keys. $arr["p1name"] $arr["p2name"] Then that way you can create the key dynamically: $arr["p".$i."name"] Not pretty, but it works. Thanks, I haven't checked this, but couldn't you reference it as $arr["p$iname"] ? Is there a reason why variable expansion wouldn't work in this circumstance? If it does, you could make it easier to read by doing $arr["p{$i}name"] even though the {} aren't required. It'd be a lot easier to read than concatenations :) Regards, Adam. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] For Loop
Are you sure that you don't want an array? Arrays are normally much better for this type of thing. That said, ${"p{$i}name"} = 'foo'; David Albert Padley wrote: > I have a regular for loop - for($i=1; $i<100; $i++) > > Within the loop I need to create variables named: > > $p1name; > $p2name; > $p3name; > etc. > > The integer portion of each variable name needs to be the value of $i. > > I can't seem to get my syntax correct? > > Can someone point me in the right direction? > > Thanks. > > Albert Padley > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] For Loop
On Tuesday 20 June 2006 15:28, Adam Zey wrote: > Ray Hauge wrote: > > On Tuesday 20 June 2006 15:14, Albert Padley wrote: > >> I have a regular for loop - for($i=1; $i<100; $i++) > >> > >> Within the loop I need to create variables named: > >> > >> $p1name; > >> $p2name; > >> $p3name; > >> etc. > >> > >> The integer portion of each variable name needs to be the value of $i. > >> > >> I can't seem to get my syntax correct? > >> > >> Can someone point me in the right direction? > >> > >> Thanks. > >> > >> Albert Padley > > > > If you really want to keep the p?name syntax, I would suggest throwing > > them in an array with keys. > > > > $arr["p1name"] > > $arr["p2name"] > > > > Then that way you can create the key dynamically: > > > > $arr["p".$i."name"] > > > > Not pretty, but it works. > > > > Thanks, > > I haven't checked this, but couldn't you reference it as $arr["p$iname"] > ? Is there a reason why variable expansion wouldn't work in this > circumstance? > > If it does, you could make it easier to read by doing $arr["p{$i}name"] > even though the {} aren't required. It'd be a lot easier to read than > concatenations :) > > Regards, Adam. Both of those ways work. I think there's a question on the PHP Certification Exam about the different ways to work with strings. -- Ray Hauge Programmer/Systems Administrator American Student Loan Services www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] For Loop
Thanks everyone. Always nice to know there is more than one direction to go in. Albert On Jun 20, 2006, at 4:52 PM, Ray Hauge wrote: On Tuesday 20 June 2006 15:28, Adam Zey wrote: Ray Hauge wrote: On Tuesday 20 June 2006 15:14, Albert Padley wrote: I have a regular for loop - for($i=1; $i<100; $i++) Within the loop I need to create variables named: $p1name; $p2name; $p3name; etc. The integer portion of each variable name needs to be the value of $i. I can't seem to get my syntax correct? Can someone point me in the right direction? Thanks. Albert Padley If you really want to keep the p?name syntax, I would suggest throwing them in an array with keys. $arr["p1name"] $arr["p2name"] Then that way you can create the key dynamically: $arr["p".$i."name"] Not pretty, but it works. Thanks, I haven't checked this, but couldn't you reference it as $arr["p $iname"] ? Is there a reason why variable expansion wouldn't work in this circumstance? If it does, you could make it easier to read by doing $arr["p{$i} name"] even though the {} aren't required. It'd be a lot easier to read than concatenations :) Regards, Adam. Both of those ways work. I think there's a question on the PHP Certification Exam about the different ways to work with strings. -- Ray Hauge Programmer/Systems Administrator American Student Loan Services www.americanstudentloan.com 1.800.575.1099 -- 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] For Loop
On Tue, 2006-06-20 at 19:19, Albert Padley wrote: > Thanks everyone. Always nice to know there is more than one direction > to go in. > > Albert > > > On Jun 20, 2006, at 4:52 PM, Ray Hauge wrote: > > > On Tuesday 20 June 2006 15:28, Adam Zey wrote: > >> Ray Hauge wrote: > >>> On Tuesday 20 June 2006 15:14, Albert Padley wrote: > I have a regular for loop - for($i=1; $i<100; $i++) > > Within the loop I need to create variables named: > > $p1name; > $p2name; > $p3name; > etc. > > The integer portion of each variable name needs to be the value > of $i. > > I can't seem to get my syntax correct? > > Can someone point me in the right direction? > > Thanks. > > Albert Padley > >>> > >>> If you really want to keep the p?name syntax, I would suggest > >>> throwing > >>> them in an array with keys. > >>> > >>> $arr["p1name"] > >>> $arr["p2name"] > >>> > >>> Then that way you can create the key dynamically: > >>> > >>> $arr["p".$i."name"] > >>> > >>> Not pretty, but it works. > >>> > >>> Thanks, > >> > >> I haven't checked this, but couldn't you reference it as $arr["p > >> $iname"] > >> ? Is there a reason why variable expansion wouldn't work in this > >> circumstance? > >> > >> If it does, you could make it easier to read by doing $arr["p{$i} > >> name"] > >> even though the {} aren't required. It'd be a lot easier to read than > >> concatenations :) > >> > >> Regards, Adam. > > > > Both of those ways work. I think there's a question on the PHP > > Certification > > Exam about the different ways to work with strings. Ahhh, got to love the fact that there's a question, yet no need for the taker to actually understand the implications. Does anyone know if you can get toilet paper with certs printed on it? Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] For Loop
Albert Padley wrote: Thanks everyone. Always nice to know there is more than one direction to go in. A alternative to variable variables might use these: http://us3.php.net/manual/en/function.compact.php http://us3.php.net/manual/en/function.extract.php 'extract' looks like it might be right up your alley: Dante On Tuesday 20 June 2006 15:14, Albert Padley wrote: I have a regular for loop - for($i=1; $i<100; $i++) Within the loop I need to create variables named: $p1name; $p2name; $p3name; etc. The integer portion of each variable name needs to be the value of $i. I can't seem to get my syntax correct? Can someone point me in the right direction? Thanks. Albert Padley -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: comparing a string
(inline) Adam Zey wrote: Rafael wrote: A single "=" it's an assignment, not a comparison; and though it sometimes work, you shouldn't compare strings with "==", but using string functions, such as strcmp()... or similar_text(), etc. This is PHP, not C. Operators such as == support strings for a reason, people should use them as such. You shouldn't rely on what other languages do, but the one you're working with; PHP has no explicit data-types and manages strings as PERL does. Just as you say there's a reason why "==" supports strings, there's also a reason (or more) for strcmp() to exists --it's just safer to use strcmp() instead of "==", e.g: 24 == "24/7" If you need to ensure type, (so that 0 == "foo" doesn't return true), then you can use ===. Using a function call that does more than you need when there is an operator to achieve the same goal is bad advice. I think you haven't encounter a "special case" to make you understand "==" does NOT have the same behaviour as strcmp() It's just like the (stranger) case of the loop for ( $c = 'a'; $c <= 'z'; $c ++ ) echo $c; Not to mention the fact that it leads to harder to read code. Which of these has a more readily apparent meaning? if ( strcmp($foo,$bar) == 0 ) if ( $foo === $bar ) That might be true, either way you need to know the language to understand what the first line does and that the second isn't a typo. -- Atentamente / Sincerely, J. Rafael Salazar Magaña -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Stream download problem
I have a site that generates a file to be streamed down. The relevant code is: -- header("Content-type: application/vnd.ms-excel"); header("Content-disposition: attachment; filename=$EXPORT_TIME.txt"); header("Content-disposition: attachment"); header("Pragma: no-cache"); header("Expires: 0"); echo $filestring; die(); --- $EXPORT_TIME has been set to a valid filename in earlier part of script. The script has been called by the user clicking on a line similar to ...and before you suggest it, *NO*, I cannot tell my client that they can't use Internet Explorer. Can anyone offer any help? ---Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GD problems
Beauford wrote: After my last email I searched around some more and found the following. /Q: gd keeps saying it can't find png or jpeg support. I did install libpng and libjpeg. What am I missing?/ /A: Be sure to do "make install-headers" for libpng and "make install-lib" for libjpeg, in addition to "make install."/ This is basically what you were saying, but as I said these header files do not exist on their own (for Slackware anyways) and just by chance I came across the above, but in any event it still doesn't work. It might be nice though if somewhere in the instructions it says, hey, you might need to do this. Then I found this when searching on the jpeg errors I keep getting. /This error occures becuase the linker (ld) cannot find the jpeg library./ /You can fix this problem by editing the config.nice file inside the php4/ /directory and adding / /LDFLAGS='-L/path/to/lib' \ / /above the ./configure \ / /For example is your libjpeg.so resides inside /usr/local/lib, you'd add/ /-L/usr/local./ /Once you've edited the file, remove config.cache and run ./config.nice,/ /after that make; make install; should work./ Since my/// libjpeg.so / is in /usr/lib I put/// LDFLAGS='-L/user' \/ - I still get the same error. If I compile without the jpeg it works like a charm - so I recompiled libjpeg thinking it may have gotten screwed up, but same errors. So the question is, why can't it find these files? Any ideas on what else I can do. I'm assuming that other people have this working on Slackware, if so, how did they do it? I posted to that forum as well and didn't get one answer. Please always CC the list - you'll get more (and faster) help. As David suggested, try adding this: --with-jpeg-dir=/usr --with-png-dir=/usr to the php configure command. If that doesn't work, where is the jpeglib.h file? Mine is in the /usr/include folder, so I use /usr for the --with-jpeg-dir parameter. If that file doesn't exist anywhere on your system, you haven't got the headers installed for libjpeg. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Processing HTML in mail form
Jonas: I am not sure if I understood your problem correct. But the way I understood it, you want the mail to be displayed as: F-namn: J L-namn: R Birth: 12 Address: 34 Zip: 56 City: 78 Phone: 90 Mail: [EMAIL PROTECTED] Desc: N Hair: hair Make: makeup Am I correct? If that is the case, I guess you should use '\n' instead of ''. Cheers, Prathap -- Original Message --- From: Jonas Rosling <[EMAIL PROTECTED]> To: PHP Lists Sent: Tue, 20 Jun 2006 23:56:47 +0200 Subject: [PHP] Processing HTML in mail form > I've done the following code bellow for an e-mail form. But it > handles the HTML tags as text. Is there anyway to get the HTML tags > processed to form the mail? > > > @extract($_POST); > > $subject = 'Intresseanmalan'; > > $forname = stripslashes($forname); > > $lastname = stripslashes($lastname); > > $date_of_birth = stripslashes($date_of_birth); > > $post_address = stripslashes($post_address); > > $zip_code = stripslashes($zip_code); > > $city = stripslashes($city); > > $phone = stripslashes($phone); > > $mail = stripslashes($mail); > > $description = stripslashes($description); > > $hairdresser = stripslashes($hairdresser); > > $makeup = stripslashes($makeup); > > $text = 'F-name: '.$forname.''. > 'L-name: '.$lastname.''. > 'Birth: '.$date_of_birth.''. > 'Address: '.$post_address.''. > 'Zip: '.$zip_code.''. > 'City: '.$city.''. > 'Phone: '.$phone.''. > 'Mail: '.$mail.''. > 'Desc: '.$description.''. > 'Hair: '.$hairdresser.''. > 'Make: '.$makeup; > > mail('[EMAIL PROTECTED]',$subject,$text,"From: $forname > $lastname <$mail>"); > > ?> > > The mail looks like this when recived: > > F-namn: JL-namn: RBirth: 12Address: 34Zip: > 56City: 78Phone: 90Mail: [EMAIL PROTECTED]Desc: NHair: > hairMake: makeup > > Thanks in advance // Jonas > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php --- End of Original Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Stream download problem
Micheal, I ran into this problem too. A easy workaround is to right click and choose 'save as' which worked for me. For complete information on this you want to have a look at http://support. microsoft.com/default.aspx/kb/279667 Cheers, Prathap -- Original Message --- From: Michael Satterwhite <[EMAIL PROTECTED]> To: PHP Users Sent: Tue, 20 Jun 2006 19:32:17 -0500 Subject: [PHP] Stream download problem > I have a site that generates a file to be streamed down. The > relevant code is: > -- > header("Content-type: application/vnd.ms-excel"); > header("Content-disposition: attachment; filename=$EXPORT_TIME.txt"); > header("Content-disposition: attachment"); > header("Pragma: no-cache"); > header("Expires: 0"); > echo $filestring; > die(); > --- > > $EXPORT_TIME has been set to a valid filename in earlier part of > script. The script has been called by the user clicking on a line > similar to http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php --- End of Original Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Stream download problem
Micheal, I ran into this problem too. A easy workaround is to right click and choose 'save as' which worked for me. For complete information on this you may want to have a look at http:// support. microsoft.com/default.aspx/kb/279667 Cheers, Prathap -- Original Message --- From: Michael Satterwhite <[EMAIL PROTECTED]> To: PHP Users Sent: Tue, 20 Jun 2006 19:32:17 -0500 Subject: [PHP] Stream download problem > I have a site that generates a file to be streamed down. The > relevant code is: > -- > header("Content-type: application/vnd.ms-excel"); > header("Content-disposition: attachment; filename=$EXPORT_TIME.txt"); > header("Content-disposition: attachment"); > header("Pragma: no-cache"); > header("Expires: 0"); > echo $filestring; > die(); > --- > > $EXPORT_TIME has been set to a valid filename in earlier part of > script. The script has been called by the user clicking on a line > similar to http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php --- End of Original Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] complex control structure- please help
IG wrote: Hi all, This may not be complex at all- maybe my head is just screwed up this afternoon! I am looping through arrays all at one time for the following- $filter_subject $filter_body $filter_email $filter_subject_like $filter_body_like $filter_email_like Examples of the following could be- $filter_subject[0] = "This is the subject"; $filter_body[0] = "This is the body"; $filter_email[0] = "[EMAIL PROTECTED]"; $filter_subject_like[0] = ""; $filter_body_like[0] = ""; $filter_email_like[0] = ""; $filter_subject[1] = ""; $filter_body[1] = ""; $filter_email[1] = ""; $filter_subject_like[1] = "lots of nice things"; $filter_body_like[1] = "horrible body text"; $filter_email_like[1] = "[EMAIL PROTECTED]"; $filter_subject[2] = ""; $filter_body[2] = ""; $filter_email[2] = ""; $filter_subject_like[2] = "Lots of nice things"; $filter_body_like[2] = ""; $filter_email_like[2] = ""; $filter_subject[3] = ""; $filter_body[3] = "This is the complete body"; $filter_email[3] = ""; $filter_subject_like[3] = "Part of the subject"; $filter_body_like[3] = ""; $filter_email_like[3] = ""; I then run something like the following on the variables $subject, $body, $email, $subject_like, $body_like and $email_like for($e=0;$e if($subject == $filter_subject[$e]) {$found_subject = 1;}// Subject has been found if($body == $filter_body[$e]) {$found_body = 1;}// Body has been found if($email == $filter_email[$e]) {$found_email = 1;}// Email has been found if(strpos($subject_like, $filter_subject_like[$e])) {$found_subject_like = 1;}// Subject(like) has been found if(strpos($body_like, $filter_body_like[$e])) {$found_body_like = 1;}// Body(like) has been found if(strpos($email_like, $filter_email_like[$e])) {$found_email_like = 1;}// Email(like) has been found ... } What I want to do is work out if (from the above examples) the following (not written in php by the way, just in kind of english) example 0 - if - ($subject == "This is the subject" AND $body == "This is the body" AND $email == "[EMAIL PROTECTED]") THEN DO THE FOLLOWING example 1 - if - ($subject == "lots of nice things" AND $body_like contains "horrible body text" AND $email contains "[EMAIL PROTECTED]") THEN DO THE FOLLOWING example 2 if - ($subject contains "Lots of nice things") THEN DO THE FOLLOWING example 3 if - ($body == "This is the complete body" AND $subject contains "Part of the subject") THEN DO THE FOLLOWING How can I organise a control structure so that I can do the above? My brain is hurting and I could do with some thoughts from you guys! You're most of the way there. convert it to php code and you're basically done: if ($body == '...') { echo "Body is $body\n"; } and so on. I don't see the problem here ? -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session problem
Hi all, I have 2 php page , whenever i click the submit in 1st page , the $_SESSION['LIST_OF_DATA'] display nothing in the 2nd page. If i do echo print_r($_SESSION['LIST_OF_DATA']) in first page , it displayed the data correctly. Anybody have any ideas why php session behaviour is like that ? Thanks - weetat below is the 1st page : 'Jumping', 'itemData' => $arrayoffiles, 'perPage' => 10, 'delta' => 8, 'append' => true, 'clearIfVoid' => true, 'useSessions' => true, 'closeSession' => true, ); $pager = & Pager::factory($params); $data = $pager->getPageData(); $links = $pager->getLinks(); $_SESSION['LIST_OF_DATA'] = $data; ?> below is second page : -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem displaying a mysql database field
Don wrote: Hi, I have a varchar field in a MySQL database that contains a line of text like so: "This is a line if text" The double quotes are included in the database field. I cannot seem to display it on my HTML page, it always shows as blank. I have tried using both the stripslashes() and the html_entity_decode() but it still shows as blank. How can I display this please??? If you're putting this into a type box you need to encode it not decode it. htmlspecialchars or htmlentities will do it for you. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Stream download problem
Prathaban Mookiah wrote: Micheal, I ran into this problem too. A easy workaround is to right click and choose 'save as' which worked for me. I wish that would work. The URL is along the lines of For complete information on this you want to have a look at http://support. microsoft.com/default.aspx/kb/279667 I find this interesting MSoft claims to have fixed the problem back at IE 5.1, but I'm still seeing it - and I'm up to date as is my client. Of course, I seldom believe anything MSoft says. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] comparing a string
When the $_REQUEST['x'] is not 0 or '', it will be always correct condition of your if. see the magic*. -Original Message- From: tedd [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 20, 2006 10:02 PM To: Ross; php-general@lists.php.net Subject: Re: [PHP] comparing a string At 12:43 PM +0100 6/20/06, Ross wrote: >I have a quiz where the ansers are held in a array called $correct answers. >When I compare the string > >if ($_REQUEST['x']= $correct_answers[$page-1]) { > > > >with a double == the answer is always correct with the single = it is always >wrong. > >when I echo out the posted answer and the value from the answers arrray they >are correct. When you say == the answer is always correct -- does that mean even when the answer is wrong? If so, then there's something else going on here. But, I believe the answer is: if ($_REQUEST['x'] == $correct_answers[$page-1]) { This will compare the two and if they are the same will report true. You should read the manual. hth's tedd -- http://sperling.com http://ancientstones.com http://earthstones.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