php-general Digest 28 Dec 2004 14:29:34 -0000 Issue 3195

Topics (messages 205225 through 205246):

How to process a query form with CHECKBOX Please help
        205225 by: S Kumar
        205231 by: Ospinto
        205235 by: Jonathan

authentication
        205226 by: Ali
        205227 by: John Holmes

How to limit the number of entries got from ldap?(ldap_search)
        205228 by: truename

Re: negative numbers
        205229 by: Curt Zirzow
        205243 by: Jason Wong

not gettingg desired results... is my programming logic run amuck...
        205230 by: GH
        205242 by: Jason Wong
        205246 by: GH

How to delete text with replies for archive pages
        205232 by: Will McCullough
        205236 by: Jason Wong
        205238 by: Will McCullough
        205239 by: Jason Wong

Re: Making includes and requires safe.
        205233 by: John Holmes

Re: [PHP-DB] How to process a query form with CHECKBOX Please help
        205234 by: John Holmes

CMS
        205237 by: Javier Leyba
        205240 by: kalinga

PHP variables on SSL and IE5.x
        205241 by: Merlin

Strange results from file_get_contents using an url as filename
        205244 by: Ewout de Boer

Re: PHP based Apache admin tool?
        205245 by: John Nichel

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 ---
Dear group, 
 I am a novice programmer started doing php to process
a query form of my patients.  

I have a database and one table in it deals with my
patient information.  Depending on their condition I
divided their age groups into 3 categories. In my
database a table patient_data has a column age_group
and a patient can be any one of young, middle or old
category.   
Now the possibility is that a user can selecct 1 or 2
or all three options.

In the query form, I gave the option for a user as a
check box. The piece of html code is as below:

<DIV>Age group</DIV>
<DIV>Young<input type="checkbox" name=""
value=""></DIV>
<DIV>Middle<input type="checkbox" name=""
value=""></DIV>
<DIV>Old<input type="checkbox" name="" value=""></DIV>

Problem:
I want to capture the user options and create an SQL
statement:

Select age_group from patient_data where age_group =
young and old ; 


I am truly stuck here. Can any one please help me out
to pass this situation. 

Thank you in advance.

Kumar. 


        
                
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail

--- End Message ---
--- Begin Message ---
<DIV>Young<input type="checkbox" name="agegroup[]" value="young"></DIV>
<DIV>Middle<input type="checkbox" name="agegroup[]" value="middle"></DIV>
<DIV>Old<input type="checkbox" name="agegroup[]" value="old">

note that the name of all three is "agegroup[]". this ensures that it stores
the values in an array "$agegroup".
now on the next page, you can simply say
$ageresult=implode(" and ",$agegroup);

now, your query is simply:
Select age_group from patient_data where age_group = $ageresult;

You might wanna change the "and" to "or". if it's one column in the db that
has one value of the age group (young, middle, or old), i think your best
bet would be "or".
cheers,
Ospinto.


"S Kumar" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Dear group,
>  I am a novice programmer started doing php to process
> a query form of my patients.
>
> I have a database and one table in it deals with my
> patient information.  Depending on their condition I
> divided their age groups into 3 categories. In my
> database a table patient_data has a column age_group
> and a patient can be any one of young, middle or old
> category.
> Now the possibility is that a user can selecct 1 or 2
> or all three options.
>
> In the query form, I gave the option for a user as a
> check box. The piece of html code is as below:
>
> <DIV>Age group</DIV>
> <DIV>Young<input type="checkbox" name=""
> value=""></DIV>
> <DIV>Middle<input type="checkbox" name=""
> value=""></DIV>
> <DIV>Old<input type="checkbox" name="" value=""></DIV>
>
> Problem:
> I want to capture the user options and create an SQL
> statement:
>
> Select age_group from patient_data where age_group =
> young and old ;
>
>
> I am truly stuck here. Can any one please help me out
> to pass this situation.
>
> Thank you in advance.
>
> Kumar.
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - You care about security. So do we.
> http://promotions.yahoo.com/new_mail


--- End Message ---
--- Begin Message ---
Shouldn't you use "radio" rather than checkbox for age group? the 2
responses is good if you want them to be able to select more than one.

"S Kumar" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Dear group,
>  I am a novice programmer started doing php to process
> a query form of my patients.
>
> I have a database and one table in it deals with my
> patient information.  Depending on their condition I
> divided their age groups into 3 categories. In my
> database a table patient_data has a column age_group
> and a patient can be any one of young, middle or old
> category.
> Now the possibility is that a user can selecct 1 or 2
> or all three options.
>
> In the query form, I gave the option for a user as a
> check box. The piece of html code is as below:
>
> <DIV>Age group</DIV>
> <DIV>Young<input type="checkbox" name=""
> value=""></DIV>
> <DIV>Middle<input type="checkbox" name=""
> value=""></DIV>
> <DIV>Old<input type="checkbox" name="" value=""></DIV>
>
> Problem:
> I want to capture the user options and create an SQL
> statement:
>
> Select age_group from patient_data where age_group =
> young and old ;
>
>
> I am truly stuck here. Can any one please help me out
> to pass this situation.
>
> Thank you in advance.
>
> Kumar.
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - You care about security. So do we.
> http://promotions.yahoo.com/new_mail

--- End Message ---
--- Begin Message ---
Hi everyone...
can anyone lead me to a good tutorial on authentication...it wud be good if
i can get a one in connection with a database..
thnks

--- End Message ---
--- Begin Message --- Ali wrote:
can anyone lead me to a good tutorial on authentication...it wud be good if
i can get a one in connection with a database..

$all_good = query("SELECT valid_user FROM table");

or use Google.

--

---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
source code:
<?php
//$ds is a valid link identifier for a directory server

$dn = "o=My Company, c=US";
$filter="person=*";
$justthese = array("ou", "sn", "givenname", "mail");

$sr=ldap_search($ds, $dn, $filter, $justthese);
?>


It takes about 100 secs while the entries amount to more than 10,000.
Is there any solution to make it do fast?
Or is there any method to fetch 100 entries every time?

--- End Message ---
--- Begin Message ---
* Thus wrote Ford, Mike:
> To view the terms under which this email is distributed, please go to 
> http://disclaimer.leedsmet.ac.uk/email.htm
> 
> 
> 
> > -----Original Message-----
> > From: Jason Wong
> > Sent: 27/12/04 10:16
> > 
> > On Monday 27 December 2004 12:40, Richard Lynch wrote:
> > 
> > > If you want to mimic the behaviour of abs (allowing for positive
> > numbers)
> > > and performance was an issue, that:
> > > $x = ($x < 0) ? - $x : $x;
> > >
> > > is most likely faster than abs()
> > 
> > Having nothing better to do I decided to benchmark this:
> > 
> > ternary:
> > 
> >     $doo = -20;
> >     for ($i = 1; $i < 10000000; $i++) {
> >         $dah = ($doo < 0) ? - $doo : $doo;
> >     }
> > 
> > abs():
> > 
> >     $doo = -20;
> >     for ($i = 1; $i < 10000000; $i++) {
> >         $dah = abs($doo);
> >     }
> 
> That's not a valid benchmark, since only on the first pass through the loop
> is $doo negative.  Personally, I'd want to test it with equal numbers of
> positive and negative values, and I'd want to know the contribution of the
> loop and value-setup overhead, so I'd write it like this:

This really was my first concern about the benchmark (unfair
negative usage). In what ever case one uses to get the absolute
value from a value be sure to document things like:


         /* Get the absolute value */
         $dah = ($doo < 0) ? - $doo : $doo;

where:
         $dah = abs($doo);

is self relevant.


Curt
-- 
Quoth the Raven, "Nevermore."

--- End Message ---
--- Begin Message ---
On Tuesday 28 December 2004 01:13, Ford, Mike wrote:

> > abs():
> >
> >     $doo = -20;
> >     for ($i = 1; $i < 10000000; $i++) {
> >         $dah = abs($doo);
> >     }
>
> That's not a valid benchmark, since only on the first pass through the loop
> is $doo negative.  

I'm not sure what you mean by that, could you please elaborate. $doo is not 
reassigned inside the loop, so AFAICS it will be negative for all passes of 
the loop.

> Personally, I'd want to test it with equal numbers of 
> positive and negative values, 

Yes, that might affect the results ...

> and I'd want to know the contribution of the 
> loop and value-setup overhead, so I'd write it like this:

... but this ought to be irrelevant because for practical purposes if you need 
a loop you use a loop along with whatever overhead it brings, it's not as if 
there are alternatives to the loop. As we're only interested in the relative 
speeds of the 2 methods, and as the loop structure is the same for both then 
effectively the loop overhead is inconsequential.


[original code snipped]

Having fixed the subtle bugs(!) running this:

<?php
    list($t0, $t1) = explode(' ', microtime());
    $oh = $t1 + $t0;
    for ($i=1; $i<10000000; $i++) {
        $doo = 20 * ($i%2?-1:1);
    }
    list($t0, $t1) = explode(' ', microtime());
    $oh = $t1 + $t0 - $oh;

    list($t0, $t1) = explode(' ', microtime());
    $tern = $t1 + $t0;
    for ($i=1; $i<10000000; $i++) {
        $doo = 20 * ($i%2?-1:1);
        $dah = ($doo<0) ? -$doo : $doo;
    }
    list($t0, $t1) = explode(' ', microtime());
    $tern = $t1 + $t0 - $tern;

    list($t0, $t1) = explode(' ', microtime());
    $abs = $t1 + $t0;
    for ($i=1; $i<10000000; $i++) {
        $doo = 20 * ($i%2?-1:1);
        $dah = abs($doo);
    }
    list($t0, $t1) = explode(' ', microtime());
    $abs = $t1 + $t0 - $abs;

    echo "<p>Overhead = ", $oh, "sec<br />\n";
    echo "Ternary = ", $tern,
         " sec; less overhead = ", $tern-$oh,
         " sec<br />\n";
    echo "Abs() = ", $abs,
         " sec; less overhead = ", $abs-$oh,
         " sec\n</p>";
?>


Results in:

Overhead = 12.942795991898sec
Ternary = 22.343024015427 sec; less overhead = 9.4002280235291 sec
Abs() = 21.590991973877 sec; less overhead = 8.6481959819794 sec

> I don't have access to a php system right now, or I'd run it (just out of
> curiosity!).  Anyone who wants to grab the above and test it is welcome...

And for the even more curious amongst you, using a straight "$doo = -20" and 
"$doo = 20" results in:

$doo = -20
Overhead = 9.3479979038239sec
Ternary = 19.242904186249 sec; less overhead = 9.8949062824249 sec
Abs() = 18.279228925705 sec; less overhead = 8.9312310218811 sec

$doo = 20
Overhead = 7.9141719341278sec
Ternary = 16.776551008224 sec; less overhead = 8.8623790740967 sec
Abs() = 17.280977964401 sec; less overhead = 9.3668060302734 sec


Conclusion if you know that all your values will be positive then using the 
ternary method will be faster (but then why the heck would you need to use 
any method at all if you already knew your values were positive!), otherwise 
abs() is faster and clearer.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
QOTD:
 "She's about as smart as bait."
*/

--- End Message ---
--- Begin Message ---
Greetings:

I am having a problem with some php that I have written...  In an
attempt to clearly state the problem and how it is supposed to work
the following may be lengthy, to which I appologize for.

I am not getting the results that I am expecting.  I am using the
following url  to access my page.

http://localhost/AHRC_PL/ahrc_programleader/ahrc_programleader.php?SID=1&get_switch=0


the ahrc_programleader.php file is supposed to use  switch/case
statement to determine what action to take:

switch ($_GET['get_switch']){
        case "0":
                displayMenu($_GET['SID']);
                break;
        case "1":
                attendanceReport($_GET['SID']);
                break;
        case "2":
                attendanceSheet($_GET['SID']);
                break;
        default:
                // Return Error Message ## TO BE CODED LATER
                // Reprint Menu 
}

In the displayMenu() function it is  (1) supposed to print out a link
to get an Attendance Sheet for the SID and  (2) check if an attendance
report exists using the isAttendance Report() function... if there is
it prints out a link to it (ahrc_programleader.php with SID=$SID and
get_switch = 1. Otherwise it prints out "No Attendance Report
Available".  the function isAttendanceReport() is supposed to return
either a 0 if no report or invalid session id or 1 for is a report.

function displayMenu($SID){
echo "<a href=\"ahrc_programleader.php?SID=".$SID."&get_switch=2\">Print
Attendance Sheet </a><br />\n";
if(isAttendanceReport($SID)) 
        echo "<a href=\"ahrc_programleader.php?SID=". $SID .
"&get_switch=1\"> Print Attendance Report </a> <br>\n";
else
{
        echo "No Attendance Report Available"; 
        echo $SID; // DEBUG CODE 
}

#echo "Enter Attendance <br> \n";    ## TO BE CODED LATER
#echo "Print Progress Notes <br>\n"; ## TO BE CODED LATER
#echo "Print Progress Notes with Attendance <br>\n";  ## TO BE CODED LATER
#echo "View Participants<br>\n";  
}

I know for a fact that an attendance report exists for the given SID.
Because when I manually put in the URL with the get_switch value = 1
(http://localhost/AHRC_PL/ahrc_programleader/ahrc_programleader.php?SID=1&get_switch=1)
it displays the report.

When I was testing the code after it not returning results, I had
attempted to make sure that it was going through the logic and was
reaching the return 1; statement and it was... so I am perplexed...

Below I have placed links to the full code for both pages.



Additional code file: isAttendanceReport.php code is available at
http://pastebin.com/133993

Additional code file: ahrc_programleader.php code is available at
http://pastebin.com/134014


Thank You in advance
Gary

--- End Message ---
--- Begin Message ---
On Tuesday 28 December 2004 13:00, GH wrote:

> I am having a problem with some php that I have written...  In an
> attempt to clearly state the problem and how it is supposed to work
> the following may be lengthy, to which I appologize for.

It's better to have a lengthy explanation of what your problem is rather than 
havong to trade posts back and forth trying to determine what your problem 
is, so no need to apologize. NB it is good to have a lengthy explanation but 
not good to post lengthy code.

> I am not getting the results that I am expecting.  I am using the
> following url  to access my page.
>
> http://localhost/AHRC_PL/ahrc_programleader/ahrc_programleader.php?SID=1&ge
>t_switch=0

So what *do* you get?

> In the displayMenu() function it is  (1) supposed to print out a link
> to get an Attendance Sheet for the SID and  (2) check if an attendance
> report exists using the isAttendance Report() function... if there is
> it prints out a link to it (ahrc_programleader.php with SID=$SID and
> get_switch = 1. Otherwise it prints out "No Attendance Report
> Available".  the function isAttendanceReport() is supposed to return
> either a 0 if no report or invalid session id or 1 for is a report.
>
> function displayMenu($SID){
> echo "<a href=\"ahrc_programleader.php?SID=".$SID."&get_switch=2\">Print
> Attendance Sheet </a><br />\n";
> if(isAttendanceReport($SID))
>  echo "<a href=\"ahrc_programleader.php?SID=". $SID .
> "&get_switch=1\"> Print Attendance Report </a> <br>\n";
> else

Note that it is good practice to use { } around your statement(s).

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Make me look like LINDA RONSTADT again!!
*/

--- End Message ---
--- Begin Message ---
The isAttendanceReport() fails... so in the displayMenu() function I get

Print Attendance Sheet
No Attendance Report Available1

> Note that it is good practice to use { } around your statement(s).

I am under the opression that it is only for when you have
multistatement groups and not just a one statement after a condition?
Please correct me if I am wrong.

Thanks

Gary

On Tue, 28 Dec 2004 19:24:28 +0800, Jason Wong <[EMAIL PROTECTED]> wrote:
> On Tuesday 28 December 2004 13:00, GH wrote:
> 
> > I am having a problem with some php that I have written...  In an
> > attempt to clearly state the problem and how it is supposed to work
> > the following may be lengthy, to which I appologize for.
> 
> It's better to have a lengthy explanation of what your problem is rather than
> havong to trade posts back and forth trying to determine what your problem
> is, so no need to apologize. NB it is good to have a lengthy explanation but
> not good to post lengthy code.
> 
> > I am not getting the results that I am expecting.  I am using the
> > following url  to access my page.
> >
> > http://localhost/AHRC_PL/ahrc_programleader/ahrc_programleader.php?SID=1&ge
> >t_switch=0
> 
> So what *do* you get?
> 
> > In the displayMenu() function it is  (1) supposed to print out a link
> > to get an Attendance Sheet for the SID and  (2) check if an attendance
> > report exists using the isAttendance Report() function... if there is
> > it prints out a link to it (ahrc_programleader.php with SID=$SID and
> > get_switch = 1. Otherwise it prints out "No Attendance Report
> > Available".  the function isAttendanceReport() is supposed to return
> > either a 0 if no report or invalid session id or 1 for is a report.
> >
> > function displayMenu($SID){
> > echo "<a href=\"ahrc_programleader.php?SID=".$SID."&get_switch=2\">Print
> > Attendance Sheet </a><br />\n";
> > if(isAttendanceReport($SID))
> >  echo "<a href=\"ahrc_programleader.php?SID=". $SID .
> > "&get_switch=1\"> Print Attendance Report </a> <br>\n";
> > else
> 
> Note that it is good practice to use { } around your statement(s).
> 
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> Make me look like LINDA RONSTADT again!!
> */
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--- End Message ---
--- Begin Message ---
Hey Everyone,

We are writing a web archive to a mail list server. 
We want to be able to delete the footer that comes
through on every email so that we don't end up with
those long footers that are 4x repeated sometimes like
in the example here:
-----------------
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, e-mail: php-general-unsubscribe
<email protected>
>>For additional commands, e-mail: php-general-help
>><email protected>
>>To contact the list administrators, e-mail:
php-list-admin <email protected>
>>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe
<email >protected>
>For additional commands, e-mail: php-general-help
><email protected>
>To contact the list administrators, e-mail:
>php-list-admin <email protected>
>
--------------------

So in this case we want to delete each one of those
lines and the > in front of them.  What would be the
best way to do this?

Thanks!
Will


        
                
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail

--- End Message ---
--- Begin Message ---
On Tuesday 28 December 2004 13:26, Will McCullough wrote:

> We are writing a web archive to a mail list server.
> We want to be able to delete the footer that comes
> through on every email so that we don't end up with
> those long footers that are 4x repeated sometimes like
> in the example here:

If everyone followed standards and long established conventions then life 
would be a breeze. If the signature (ie your footer) is separated from the 
body by '-- ' (note the space) then standards/conventions compliant clients 
will automatically strip the signature when needed.

The PHP list does correctly use '-- ' when it appends its signature. 
Unfortunately Yahoo doesn't (probably because it doesn't *want* its 
signatures stripped so that it becomes advertising for them).

> So in this case we want to delete each one of those
> lines and the > in front of them.  What would be the
> best way to do this?

Look for the '-- ', otherwise good luck :)

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Chicken Little was right.
*/

--- End Message ---
--- Begin Message ---
 
 


                
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
http://info.mail.yahoo.com/mail_250
--- Begin Message ---
That will result in the same problem, some lines after
replies, then would be:

<<----------------------------

And finding out how to delete that with the < in front
is my problem....

--- Jason Wong <[EMAIL PROTECTED]> wrote:

> On Tuesday 28 December 2004 13:26, Will McCullough
> wrote:
> 
> > We are writing a web archive to a mail list
> server.
> > We want to be able to delete the footer that comes
> > through on every email so that we don't end up
> with
> > those long footers that are 4x repeated sometimes
> like
> > in the example here:
> 
> If everyone followed standards and long established
> conventions then life 
> would be a breeze. If the signature (ie your footer)
> is separated from the 
> body by '-- ' (note the space) then
> standards/conventions compliant clients 
> will automatically strip the signature when needed.
> 
> The PHP list does correctly use '-- ' when it
> appends its signature. 
> Unfortunately Yahoo doesn't (probably because it
> doesn't *want* its 
> signatures stripped so that it becomes advertising
> for them).
> 
> > So in this case we want to delete each one of
> those
> > lines and the > in front of them.  What would be
> the
> > best way to do this?
> 
> Look for the '-- ', otherwise good luck :)
> 
> -- 
> Jason Wong -> Gremlins Associates ->
> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet
> Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> Chicken Little was right.
> */
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 



                
__________________________________ 
Do you Yahoo!? 
All your favorites on one personal page � Try My Yahoo!
http://my.yahoo.com 

--- End Message ---

--- End Message ---
--- Begin Message ---
On Tuesday 28 December 2004 18:09, Will McCullough wrote:
> That will result in the same problem, some lines after
> replies, then would be:
>
> <<----------------------------
>
> And finding out how to delete that with the < in front
> is my problem....

That's where the good luck comes in. Sorry if you misunderstood, I wasn't 
offering a solution (other than pointing out that you should make use of the 
standard signature separator), I was just pointing out how it is bad not to 
follow standards :)

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
BOFH Excuse #193:

Did you pay the new Support Fee?
*/

--- End Message ---
--- Begin Message --- > It uses search engines including
Google, Yahoo and AOL to identify exploitable Web pages written in PHP that use the functions "include()" and "require()" in an insecure manner, K-OTik said.

Exactly how is a worm going to know if I have include($crap) in my code by searching google? Is it searching source code on sourceforge or something? Is it targetting certain applications again? If so, why not tell us which ones so we can remove them until a fix is in place. Does anyone have any more details on this "new" worm?


Eliminating the security flaws exploited by the newer versions of Santy involves no new tricks, and is simply a matter of applying long-known sound programming principles.

That sums it up exactly. Poor programmers incorrectly using include() and require() will probably never go away. I could write the exact same article for any other web scripting language. So what's the point here? Nothing I've seen details how this worm is targetting my web server...


Is this just more FUD against PHP? How many bosses are now going demand PHP be disabled or not installed on company machines because of all these "vulnerabilities" when it's really just poor programming like it's always been?

--

---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message --- S Kumar wrote:
I have a database and one table in it deals with my
patient information. Depending on their condition I
divided their age groups into 3 categories. In my
database a table patient_data has a column age_group
and a patient can be any one of young, middle or old
category. Now the possibility is that a user can selecct 1 or 2
or all three options.


In the query form, I gave the option for a user as a
check box. The piece of html code is as below:

<DIV>Age group</DIV>
<DIV>Young<input type="checkbox" name=""
value=""></DIV>
<DIV>Middle<input type="checkbox" name=""
value=""></DIV>
<DIV>Old<input type="checkbox" name="" value=""></DIV>

Problem:
I want to capture the user options and create an SQL
statement:

> Select age_group from patient_data where age_group = > young and old ;

Young<input type="checkbox" name="agegroup[]" value="young" />
Middle<input type="checkbox" name="agegroup[]" value="middle" />
Old<input type="checkbox" name="agegroup[]" value="old" />

Then in your code:

if(!empty($_GET['agegroup']) && is_array($_GET['agegroup']))
{
  $in = "'" . implode("','",$_GET['agegroup']) . "'";
  $query = "SELECT * FROM table WHERE age_group IN ($in)";
}

Next time just post this to php-general or php-db... no need to include both of them.

--

---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
Hi

I'm looking for a good CMS recommendation.

I've seen comments in opencms and tested a few (Xaraya was good when I read
features but so slow at testing time) but I can't test all and may be other
user experience could reduce my test universe.

I want a CMS with html code separated from PHP code, fully customizable,
easy to implement and fast...

Any clue ?

Thanks in advance

Javier

--- End Message ---
--- Begin Message ---
typo3, it's a good one..

try it ;-)

vk.


On Tue, 28 Dec 2004 11:00:32 +0100, Javier Leyba
<[EMAIL PROTECTED]> wrote:
> 
> Hi
> 
> I'm looking for a good CMS recommendation.
> 
> I've seen comments in opencms and tested a few (Xaraya was good when I read
> features but so slow at testing time) but I can't test all and may be other
> user experience could reduce my test universe.
> 
> I want a CMS with html code separated from PHP code, fully customizable,
> easy to implement and fast...
> 
> Any clue ?
> 
> Thanks in advance
> 
> Javier
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
vk.

--- End Message ---
--- Begin Message ---
Hi there,

I am having trouble with posting a form to a php script through SSL on IE prior 5.5 sp1. It works like a charm on all other browsers. In IE it works without SSL, but when SSL is enabled, the browser pops up with a message that he is switching to an unsecure site and then all then displays a 404 error with the correct php file url inside the Adressbar. I guess the browser is somehow loosing all variables submited via post.

Has anybody an idea how to solve that? I cant unfortunatelly provide a link, since I had to disable SSL on the productio server due to that error.

Thank you for any help on that,

Merlin
--- End Message ---
--- Begin Message ---
I'm getting unexpected data from my file_get_contents function using an url
as filename.

The function does not return false, i do get data from it. Problem is that
is is not the data is requested.


  $data =
file_get_contents("http://somehost.com/xmlonl.asp?custid=000000&prodid=00000
");

  if ($data)
  {
    ...


the string this function returns is the webpage from the default website of
the server where this php code is running at and not the data from the
remote site (which is not on the same server).

i tried the url from my shell on the server using telnet and it gets the
data i expected.

I can't figure out why php is getting the wrong results while telnet on the
same host gets the correct data. Is this a (known) error with php or is it a
apache/php/server configuration problem ?


regards,
Ewout

--- End Message ---
--- Begin Message --- Brian Dunning wrote:
Is there any such thing as a PHP based GUI tool for administering Apache? I've searched high & low and found nothing.

- Brian


I don't know of any php based ones, but there's webmin; Perl based.

--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com

--- End Message ---

Reply via email to