Article View: pl.comp.lang.php
Article #1231Re: bezpieczenstwo
From: Lukasz Klimek
Date: Mon, 27 Aug 2001 12:15
Date: Mon, 27 Aug 2001 12:15
48 lines
1923 bytes
1923 bytes
Gr0g zeznal(a): >Pisze pierwszy raz na ta grupe, wiec witam wszytkich. > >czy moze orientujecie sie czy bezpeczne jest doczepienie stron przez include >ktorych nazwy sa pobierane z parametru: Tak to nie... index.php?file=/etc/passwd :))) rozwiazanie (malo eleganckie, ale... ): index.php?file=a.php $tabl["a.php"] = "a.php"; $tabl["b.php"] = "b.php"; .... include ($tabl[$file]); Poza tym mozesz zrobic tak: index.php?file=a.php <? include($file); ?> >czy podawanie wartosci do zapytan SQL ktore nie sa brane w cudzyslow przez >parametr jest bezpieczne?: > >szukaj.php?orderby=kolumna&pageoffset=20 ><? dodaj tutaj sobie cos typu $pageoffset+=0; if ($orderby == "kolumna") $order="kolumna"; /* albo lepiej case... i sensowne else (else $order="domyslne_sortowanie")*/ $mysql_q="SELECT * FROM tabela ORDER BY $order LIMIT $pageoffset, 25"; mysql_query($mysql_q); [...] -- Lukasz "casa" Klimek :: casa(AT)YourCGI.Net Chcesz wiedziec ile osob jest na Twojej stronie? ------> http://www.YourCGI.Net/index.php <------
Technical Details
Message-ID:
<slrn9ok6df.1mj.casa@localhost.localdomain>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!news.icm.edu.pl!newsfeed.tpinternet.pl!news.vogel.pl!nnrpReferences:
<9md4n3$96f$1@news.tpi.pl>Show Full Headers
Complete Article Headers
From: casa@WYTNIJ.hoga.pl (Lukasz Klimek) Newsgroups: pl.comp.lang.php Subject: Re: bezpieczenstwo References: <9md4n3$96f$1@news.tpi.pl> Organization: The Unlimited Project Polska Reply-To: casa@BEZREKLAM.NOSPAM.hoga.pl Message-ID: <slrn9ok6df.1mj.casa@localhost.localdomain> User-Agent: slrn/0.9.6.3pl4 (Linux) NNTP-Posting-Host: as1-94.pila.dialup.inetia.pl X-Original-NNTP-Posting-Host: as1-94.pila.dialup.inetia.pl Date: 27 Aug 2001 14:15:04 +0200 X-Trace: news.vogel.pl 998914504 as1-94.pila.dialup.inetia.pl (27 Aug 2001 14:15:04 +0200) Lines: 48 X-Complaints-To: Usenet@news.vogel.pl Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!news.icm.edu.pl!newsfeed.tpinternet.pl!news.vogel.pl!nnrp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit