[PHP] domain.org/?page=pageName method

2004-03-06 Thread Barýþ
A general thing to do while coding a site is to
include header.php at the top of the file (and
footer.php at the end of file). Another method is to
put these header and footer files together in
index.php and including the desired page between them.
We get the desired page from the query string:
domain.org/?page=pageName
$page = $_GET['pagename'];
include $page.'.php';
Is there any important difference between these two
methods? What can you say about the advanteges or
disadvanteges of one to the other?
Assume that including undesired pages is prohibited. I
mean don't write about page=../../secretpage

Thanks...

__
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] algorythm question

2002-09-23 Thread Barýþ


ok, now it's clear why i must use '|' instead of '+'. 
i still couldn't get what happens with bits but you
don't have to explain more. i know that it's about
bitwise operators, and how they handle numbers. no!
ok! i just got it! 
thank you again.

--- bob parker <[EMAIL PROTECTED]> wrote:
> Couple of points:
> You really do need to use the '!' operator to
> combine the categories not '+'
> eg if your user entered 2 twice you would get 
> $userLevels = 2 + 2;  // wrong we just made our admin
> a writer
> but
> $userLevels = 2 | 2;  // ok is still admin because
> $userLevels is still 2
> 
> These operators, | and & are called bit wise
> operators to see how they
> work look at the binary representations of the
> numbers
> say $userlevel = 15 then in binary
> $userlevel is 
> $result =  & 0001;// $result is 0001 binary or
> decimal 1
> $result =  & 0010;// $result is 0010 binary or
> decimal 2
> $result =  & 0100;// $result is 0101 binary or
> decimal 4
> $result =  & 1000;// $result is 1000 binary or
> decimal 8
> the '&' operator only returns the bit or bits which
> are both 1 in the
> same column.
> 
> The or operator returns the bits which are 1 in
> ether column so
> 2 | 2 which is 0010 | 0010 still returns 0010 which
> is 2
> Hope this helps
> bob

__
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] algorythm question

2002-09-22 Thread Barýþ

oh my god. here is an example.

$userLevels = array(
1 => 'Member', 
2 => 'Admin', 
4 => 'Writer', 
8 => 'Expert');

$cat = 15;
for ($mask=1; $mask <= 64; $mask *= 2) {
if ( $mask & $cat ) {
print "Yes $mask is in $cat\n";
}
} 

here i didn't have to 'or' the IDs but it works fine
and i didn't really understand how it works?
what does it mean "if 2 & 15, 2 can be found in
15"???!!! is that a miracle;)
thank you bob...


--- bob parker <[EMAIL PROTECTED]> wrote:
> On Sun, 22 Sep 2002 01:10, you wrote:
> 
> 1. To do that you should 'or' the categories when
> the ID's are
> to be in more than one category, not add them
> eg $category = $cat1 | $cat2;
> 
> 2. To extract the categories within a compounded
> category
> use the 'and' operator '&'
> 
> eg
> 
> for ($mask=1; $mask <= 64; /*or whatever*/ $mask *=
> 2; ) {
>   if ( $mask & $category ) {
>   print "Yes $mask is in $category\n";
>   }
> } 




original---
> > consider there are categories and these have IDs
> like
> > below:
> > 1, 2, 4, 8, 16, 32, 64...
> >
> > if some data belongs to more than 1 category for
> > exemple 4 and 32, its category ID will be 36, the
> sum
> > of cat. IDs.
> > i guess this is used widely in programming. so,
> how
> > can i resolve the original IDs. i mean what kind
> of
> > script can tell me what+what1+what2...whatN = 79?


__
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] algorythm question

2002-09-21 Thread Barýþ

consider there are categories and these have IDs like
below:
1, 2, 4, 8, 16, 32, 64...

if some data belongs to more than 1 category for
exemple 4 and 32, its category ID will be 36, the sum
of cat. IDs. 
i guess this is used widely in programming. so, how
can i resolve the original IDs. i mean what kind of
script can tell me what+what1+what2...whatN = 79?

__
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP and OOP

2002-06-28 Thread Barýþ

"Jesper Brunholm" <[EMAIL PROTECTED]> wrote:
"Do you have any documentation on this? - I'm
getting quite used to read and hear the very
opposite."

i downloaded several docs on the net about slow
execution when classes are used,  but sorry, i'm on a
public-shared computer now and can't reach these
downloaded docs. i found them making a search for
php+oop on google. 

and the other friend who asked "why use oop?": you can
find very nice explanations by making the search
above... 

also i decided to use oop, any way, and also a
template system which will really slow down execution.
but it will be really professional, won't it? ;) 
thanks..

__
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] PHP and OOP

2002-06-27 Thread Barýþ

i want to build a site in fully OO style but that will
significantly slow down execution time and i'm about
to make a u turn to procedural PHP programming on my
project. 
that article is responsible of changing my decision: 

http://zend.com/zend/art/mistake1.php#Heading13 

besides it will be more modular, reusable, e.t.c... 

PHP is not a OO language but supports them so should
classes bu used ONLY where needed, NOT where
procedural programming can do fine?

a forum topic for this subject is also at:
http://www.zend.com/phorum/read.php?num=3&id=18612&loc=0&thread=18612


__
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] include through HTTP

2002-04-13 Thread Barýþ


file.php does more than one jobs depending on
HTTP_GET_VARS. for example if "..?mod=show" or it is
empty it shows things, elseif "..?mod=update" it
updates... so i must send a variable to the included
file but i can't do it in the file that includes it.
The file that includes file.php is a template file
which holds the design of the site and each page is
included in to that template. 
My English is not very good so if you can't see a
reason not to do it your way i will try to write a
more clear explanation.
Thank you!
Oh! that's an important point:
on index.php(the template file) it decides which file
to include with a switch.
//querystring: /index.php?page=a_page
switch $page
case "a_page":
  $inc = "http://$myhost/a_page.php";;
case "another_page":
  $inc =
"http://$myhost/a_page.php?mod=something";;

include($inc);





--- Rasmus Lerdorf <[EMAIL PROTECTED]> wrote:
> Why do you want to include from localhost over HTTP?
>  Sounds to me like
> you want to do:
> 
> $foo='bar';
> include "$DOCUMENT_ROOT/folder/file.php";
> 
> -Rasmus
> 
> On Fri, 12 Apr 2002, Barí¥²t wrote:
> 
> > What i want to do is :
> >
> include("http://localhost/folder/file.php?foo=bar";);
> > but it doesn't work. As you may guess it looks for
> a
> > file called "file.php?foo=bar". "url_fopen" is set
> to
> > "on" in my php.ini file as told in the PHP manual.
> > I work on win98+apache+php4.1.1(or something like
> that
> > but at least 4.1...)
> > Do you know what's the problem?
> > Info about this subject is on
> > http://www.php.net/manual/en/function.include.php
> > ...
> >
> > __
> > Do You Yahoo!?
> > Yahoo! Tax Center - online filing with TurboTax
> > http://taxes.yahoo.com/
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit:
> http://www.php.net/unsub.php
> >
> 


__
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] include through HTTP

2002-04-12 Thread Barýþ

Oh what a shame on me! Sorry and thank you...

--- "Collins, Robert" <[EMAIL PROTECTED]> wrote:
> Check the Note about 5 lines down on this page.
>
http://www.php.net/manual/en/features.remote-files.php
> 
> "Note: You can't use remote files in include() and
> require() statements on
> Windows."
> 
> Robert W. Collins II 
> Webmaster 
> New Orleans Regional Transit Authority 
> Phone : (504) 248-3826 
> Email : [EMAIL PROTECTED] 
> 
> 
> 
> -Original Message-
> From: Barýþ" Mert [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 12, 2002 8:13 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] include through HTTP
> 
> 
> What i want to do is :
> include("http://localhost/folder/file.php?foo=bar";);
> but it doesn't work. As you may guess it looks for a
> file called "file.php?foo=bar". "url_fopen" is set
> to
> "on" in my php.ini file as told in the PHP manual.
> I work on win98+apache+php4.1.1(or something like
> that
> but at least 4.1...)
> Do you know what's the problem?
> Info about this subject is on 
> http://www.php.net/manual/en/function.include.php
> ...
> 
> __
> Do You Yahoo!?
> Yahoo! Tax Center - online filing with TurboTax
> http://taxes.yahoo.com/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


__
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] include through HTTP

2002-04-12 Thread Barýþ

What i want to do is :
include("http://localhost/folder/file.php?foo=bar";);
but it doesn't work. As you may guess it looks for a
file called "file.php?foo=bar". "url_fopen" is set to
"on" in my php.ini file as told in the PHP manual.
I work on win98+apache+php4.1.1(or something like that
but at least 4.1...)
Do you know what's the problem?
Info about this subject is on 
http://www.php.net/manual/en/function.include.php
...

__
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php