php-general Digest 21 Dec 2003 19:56:06 -0000 Issue 2486

Topics (messages 173096 through 173111):

Re: Includes inside includes
        173096 by: Website Managers.net

how to setup php on OS X.2
        173097 by: wayan mardika
        173102 by: friscu.supereva.it

List values
        173098 by: Chakravarthy Cuddapah
        173099 by: Chakravarthy Cuddapah
        173100 by: Chris

CRC values update by readfile function?
        173101 by: ermelir
        173104 by: ermelir

Extending String Length (255) limit for Levenshtein
        173103 by: Gohaku

[posibleOT] Forcing entering te site thru index.php
        173105 by: Fernando M. Maresca
        173106 by: Eugene Lee
        173107 by: Fernando M. Maresca
        173108 by: Website Managers.net
        173109 by: Fernando M. Maresca
        173110 by: Eugene Lee
        173111 by: Fernando M. Maresca

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 ---
To call the file from anywhere within the document space, try this:

include($_SERVER["DOCUMENT_ROOT"]."/common/setup.inc");

Jim

----- Original Message ----- 
From: "Robbert van Andel" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, December 21, 2003 1:41 AM
Subject: [PHP] Includes inside includes


| I've written a class that is calling an include
| function to include a setup file.  The problem is that
| the setup file is in another directory than the class.
|  I'm including the file using:
| 
| include ("../common/setup.inc");
| 
| Is there a way that i can make the relative path
| inside the class definition specific to the class
| definition, not the page that is including the class
| definition.  I have trouble when I include the class
| definition.  I get an error that it cannot include
| "../common/setup.ini" whenever the class is called
| from a directory above common.
| 
| I hope this makes sense. and thanks for your help.
| 
| Robbert van Andel
|   
| 
| __________________________________
| Do you Yahoo!?
| New Yahoo! Photos - easier uploading and sharing.
| http://photos.yahoo.com/
| 
| -- 
| PHP General Mailing List (http://www.php.net/)
| To unsubscribe, visit: http://www.php.net/unsub.php
| 
|

--- End Message ---
--- Begin Message --- hii there,

my name is wayan mardika, i would like to ask you how to install php on mac OS X.2.
iam new in this things. i tried to install the php on my computer.
and then what else do i need?
could you tell me the simple way to do it?


the point is, i want to run php on my own computer.
thank you for your attention.
i am looking forward to hear from you soon.



best regards,

wayan mardika
--- End Message ---
--- Begin Message ---
hii there,

my name is wayan mardika, i would like to ask you how to install php on mac OS X.2.
iam new in this things. i tried to install the php on my computer.
and then what else do i need?
could you tell me the simple way to do it?


the point is, i want to run php on my own computer.
thank you for your attention.
i am looking forward to hear from you soon.

Go in this site, http://www.entropy.ch/software/macosx/php/ is simple.. ;)

ciao
--- End Message ---
--- Begin Message ---
Can anyone pls tell me how to dynamically list values in a ListMenu. The values do not 
come from any database. They are stored in php variables. Sample code will be highly 
appreciated.

--- End Message ---
--- Begin Message ---
Array. I am interested to know for both the cases. 
 
Thanks !

________________________________

From: Nathan Taylor [mailto:[EMAIL PROTECTED]
Sent: Sun 12/21/2003 8:00 AM
To: Chakravarthy Cuddapah
Subject: Re: [PHP] List values


Are the values in an array or individually in variables?
 
Nathan

        ----- Original Message ----- 
        From: Chakravarthy Cuddapah <mailto:[EMAIL PROTECTED]>  
        To: [EMAIL PROTECTED] 
        Sent: Sunday, December 21, 2003 7:47 AM
        Subject: [PHP] List values

        Can anyone pls tell me how to dynamically list values in a ListMenu. The 
values do not come from any database. They are stored in php variables. Sample code 
will be highly appreciated.
        


--- End Message ---
--- Begin Message ---
<?
$items["One"]=1;
$items["Two"]=2;     
$items["Three"]=3;   
$items["Four"]=4;   
$items["Five"]=5;   

outPutFormDropDown($items,"my_list","4");               

function outPutFormDropDown($items,$field_name,$selected=""){
        if(!is_array($items)) 
                return;
?>
        <select size="1" name="<?=$field_name?>">
        <?
        foreach($items as $name=>$value){
        ?>
                <option value="<?=$value?>"<?if ($selected==$value) echo "
selected";?>><?=$name?></option>
                <?
        } 
        ?>
        </select>
<?
} 
?>
   

> -----Original Message-----
> From: Chakravarthy Cuddapah [mailto:[EMAIL PROTECTED] 
> Sent: 21 December 2003 12:47
> To: [EMAIL PROTECTED]
> Subject: [PHP] List values
> 
> Can anyone pls tell me how to dynamically list values in a 
> ListMenu. The values do not come from any database. They are 
> stored in php variables. Sample code will be highly appreciated.
> 

--- End Message ---
--- Begin Message --- hello list,

I have a problem with file integrity in my url.
I try to force download file with the following script:

------------------------------------------------------------
$sFile = $dSession['DOWNLOAD'][$id][$type];
if (is_file($sFile))
{
header("Content-disposition: attachment; filename=".basename($sFile));
header("Content-Type: force-download");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($sFile));
header("Pragma: no-cache");
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
header("Expires: 0");
readfile($sFile);
}
-------------------------------------------------------------
nothing very hard to understand, but
if I try to donwload the file with a ftp application, CRC checksum is different from file download with this script (there is only one file to download in the folder read, it's not a bad file read).
have you an idea to fix this?
thanks in advance for your help
best regards


Matthieu

_____________________________________________________________________
Envie de discuter en "live" avec vos amis ? Télécharger MSN Messenger
http://www.ifrance.com/_reloc/m la 1ère messagerie instantanée de France

--- End Message ---
--- Begin Message --- hello list,

I have a problem with file integrity in my url.
I try to force download file with the following script:

------------------------------------------------------------
$sFile = $dSession['DOWNLOAD'][$id][$type];
if (is_file($sFile))
{
header("Content-disposition: attachment; filename=".basename($sFile));
header("Content-Type: force-download");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($sFile));
header("Pragma: no-cache");
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
header("Expires: 0");
readfile($sFile);
}
-------------------------------------------------------------
nothing very hard to understand, but
if I try to donwload the file with a ftp application, CRC checksum is different from file download with this script (there is only one file to download in the folder read, it's not a bad file read).
have you an idea to fix this?
thanks in advance for your help
best regards


Matthieu

_____________________________________________________________________
Envie de discuter en "live" avec vos amis ? Télécharger MSN Messenger
http://www.ifrance.com/_reloc/m la 1ère messagerie instantanée de France

--- End Message ---
--- Begin Message --- Hi everyone,
I would like to know if there is a way to extend the limit of 255 characters when using the Levenshtein Function?
I have used user-defined functions such levdis and xlevdist but they often take too much time.
Thanks in advance.
-Gohaku

--- End Message ---
--- Begin Message ---
Hello everybody.
Well, i'm trying to avoid access to the site for the middle. Say there
is a initial page with a form and other pages that depends on this. Is
there a way to force users access the site thru the initial form page,
regardless of the url?
Something like this:
lynx http://mysite/forma2.php/
produce the browser to redirect to 
http://mysite/index.php/

Of course, the forma2.php must be served if its accesed after index.php.
Thanks

-- 

Fernando M. Maresca

Cel: (54) 221 15 502 3938
Cel: 0221-15-502-3938

--- End Message ---
--- Begin Message ---
On Sun, Dec 21, 2003 at 03:57:24PM -0300, Fernando M. Maresca wrote:
: 
: Well, i'm trying to avoid access to the site for the middle. Say there
: is a initial page with a form and other pages that depends on this. Is
: there a way to force users access the site thru the initial form page,
: regardless of the url?
: Something like this:
: lynx http://mysite/forma2.php/
: produce the browser to redirect to 
: http://mysite/index.php/
: 
: Of course, the forma2.php must be served if its accesed after index.php.

There are several ways to do this.  The most obvious is with cookies.
Set up your index.php to initially create a cookie that authorizes a
user to look in the site.  On the rest of your PHP pages, check that
this authorization cookie exists.  If not, redirect to index.php.

--- End Message ---
--- Begin Message ---
On Sun, Dec 21, 2003 at 01:03:43PM -0600, Eugene Lee wrote:
> On Sun, Dec 21, 2003 at 03:57:24PM -0300, Fernando M. Maresca wrote:
> : 
> : Well, i'm trying to avoid access to the site for the middle. Say there
> : is a initial page with a form and other pages that depends on this. Is
> : there a way to force users access the site thru the initial form page,
> : regardless of the url?
> : Something like this:
> : lynx http://mysite/forma2.php/
> : produce the browser to redirect to 
> : http://mysite/index.php/
> : 
> : Of course, the forma2.php must be served if its accesed after index.php.
> 
> There are several ways to do this.  The most obvious is with cookies.
> Set up your index.php to initially create a cookie that authorizes a
> user to look in the site.  On the rest of your PHP pages, check that
> this authorization cookie exists.  If not, redirect to index.php.
Thanks for the response.
No, this way don't do it: once the cookie is set up in the client's browser, there is 
no way for me to prevent the client to type the url pointing to another page, and the 
cookie will be valid on that page.
What i'm trying to do is to force the client to travel pages in the
order expected, forbidding him/her to access a page out of sequence,
wich take him to an error message (because, for example, for abscense of
POST data or something).
So i'm stuck.
Thenak you.
> 

-- 

Fernando M. Maresca

Cel: (54) 221 15 502 3938
Cel: 0221-15-502-3938

--- End Message ---
--- Begin Message ---
Cookies are a possibility but not always functional. Many people have them shut off, 
or services like WebTV do not support them. Two other possibilities are seccions and 
POST variables.

_SESSIONS_
forma2.php
if((!isset($_SESSION["username"]) || (!isset($_SESSION["password"])) {
 header("Location:index.php");
}

__ POST __   
// check to make sure username and password are entered and if so, they must match 
account
if ((!$_POST["username"]) || (!$_POST["password"]) || ($_POST["username" != "myuser") 
|| ($_POST["password"] != "mypassword"])) {
header("Location:index.php");
}

Jim
www.websitemanagers.net

----- Original Message ----- 
From: "Fernando M. Maresca" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, December 21, 2003 12:57 PM
Subject: [PHP] [posibleOT] Forcing entering te site thru index.php


| Hello everybody.
| Well, i'm trying to avoid access to the site for the middle. Say there
| is a initial page with a form and other pages that depends on this. Is
| there a way to force users access the site thru the initial form page,
| regardless of the url?
| Something like this:
| lynx http://mysite/forma2.php/
| produce the browser to redirect to 
| http://mysite/index.php/
| 
| Of course, the forma2.php must be served if its accesed after index.php.
| Thanks
| 
| -- 
| 
| Fernando M. Maresca
| 
| Cel: (54) 221 15 502 3938
| Cel: 0221-15-502-3938
| 
| -- 
| PHP General Mailing List (http://www.php.net/)
| To unsubscribe, visit: http://www.php.net/unsub.php
| 
|

--- End Message ---
--- Begin Message ---
On Sun, Dec 21, 2003 at 01:16:58PM -0600, Website Managers.net wrote:
> Cookies are a possibility but not always functional. Many people have them shut off, 
> or services like WebTV do not support them. Two other possibilities are seccions and 
> POST variables.
> 
> _SESSIONS_
> forma2.php
> if((!isset($_SESSION["username"]) || (!isset($_SESSION["password"])) {
>  header("Location:index.php");
> }
> 
> __ POST __   
> // check to make sure username and password are entered and if so, they must match 
> account
> if ((!$_POST["username"]) || (!$_POST["password"]) || ($_POST["username" != 
> "myuser") || ($_POST["password"] != "mypassword"])) {
> header("Location:index.php");
> }
Thanks, Jim.
Yes, i'm doing something like that: i'm propagating a string thru
$_SESSION that is set up in the first page and is valid until session
expires or init page is reloaded.
But i think that may be another (and better) way to do this, and can't
figure out how.

> 
> Jim
> www.websitemanagers.net

Fernando M. Maresca

Cel: (54) 221 15 502 3938
Cel: 0221-15-502-3938

--- End Message ---
--- Begin Message ---
On Sun, Dec 21, 2003 at 04:11:36PM -0300, Fernando M. Maresca wrote:
: On Sun, Dec 21, 2003 at 01:03:43PM -0600, Eugene Lee wrote:
: > On Sun, Dec 21, 2003 at 03:57:24PM -0300, Fernando M. Maresca wrote:
: > : 
: > : Well, i'm trying to avoid access to the site for the middle. Say
: > : there is a initial page with a form and other pages that depends
: > : on this. Is there a way to force users access the site thru the
: > : initial form page, regardless of the url?
: > : Something like this:
: > : lynx http://mysite/forma2.php/
: > : produce the browser to redirect to 
: > : http://mysite/index.php/
: > : 
: > : Of course, the forma2.php must be served if its accesed after
: > : index.php.
: > 
: > There are several ways to do this.  The most obvious is with cookies.
: > Set up your index.php to initially create a cookie that authorizes a
: > user to look in the site.  On the rest of your PHP pages, check that
: > this authorization cookie exists.  If not, redirect to index.php.
:
: Thanks for the response.
: No, this way don't do it: once the cookie is set up in the client's
: browser, there is no way for me to prevent the client to type the url
: pointing to another page, and the cookie will be valid on that page.
: What i'm trying to do is to force the client to travel pages in the
: order expected, forbidding him/her to access a page out of sequence,
: wich take him to an error message (because, for example, for abscense
: of POST data or something).
: So i'm stuck.

Not really.  It depends on how you use your cookie.  The cookie could be
some unique ID to some session-based system (whether you use PHP session
functions or not) that keeps a track of where the user is.  So let's say
the user did the right thing, went to index.php, got a cookie, and went
to the next page (let's say forma1.php).  Your session system notes that
the user is currently on forma1.php.  But the same user gets distracted,
does not go through the form normally, leaves for a few hours, and then
tries to return but jump directly to forma2.php.  Your session system
realizes that he's not supposed to be there, and kicks him out to
whereever you want him.

--- End Message ---
--- Begin Message ---
> Not really.  It depends on how you use your cookie.  The cookie could be
> some unique ID to some session-based system (whether you use PHP session
> functions or not) that keeps a track of where the user is.  So let's say
> the user did the right thing, went to index.php, got a cookie, and went
> to the next page (let's say forma1.php).  Your session system notes that
> the user is currently on forma1.php.  But the same user gets distracted,
> does not go through the form normally, leaves for a few hours, and then
> tries to return but jump directly to forma2.php.  Your session system
> realizes that he's not supposed to be there, and kicks him out to
> whereever you want him.
You are right. I'm using $_SESSION vars to do this, but i don't like it
because forces cookies enable in the client, and today many people
disable cookies.
In the other hand, $_POST vars are not very secure.
i'm looking for a clean solution, and can't figure out how.
So the question in first place would be: how you guys do it?.
Nevermind, this is not big deal. The aproach i've take works, but you
are experienced people and i'm not, and i'm very interested in the way
you're using to solve problems like this ones.
So thanks a lot.


-- 

Fernando M. Maresca

Cel: (54) 221 15 502 3938
Cel: 0221-15-502-3938

--- End Message ---

Reply via email to