php-general Digest 15 Oct 2004 10:29:28 -0000 Issue 3054

Topics (messages 199541 through 199574):

Re: include()ing into a variable
        199541 by: Curt Zirzow

Re: Help with sessions problem please
        199542 by: John Holmes

For how long session exist
        199543 by: Jerry Swanson
        199545 by: John Holmes
        199547 by: Dan Joseph

Re: Form Validation
        199544 by: Jerry Swanson

Ask for help on a mysql problem
        199546 by: Teng Wang
        199554 by: John Nichel

problem with array
        199548 by: Dale Hersowitz
        199551 by: Jason Wong
        199552 by: Minuk Choi
        199564 by: Graham Cossey

replacing characters in a string
        199549 by: Mark Hubert
        199550 by: Dan Joseph
        199560 by: Robby Russell

throw me a bone for a regexp please.
        199553 by: Robet Carson
        199556 by: Jason Wong

PHP 5.0.2 & LDAP SASL Binds (GSSAPI specifically)
        199555 by: Quanah Gibson-Mount

Re: dbm choices - advice?
        199557 by: Justin French

How to optimize select of random record in DB ?
        199558 by: -{ Rene Brehmer }-
        199561 by: Matthew Weier O'Phinney
        199562 by: Gareth Williams

Problem with MSSQL
        199559 by: Yusuf Tikupadang

PHP-CGI: custom 404 error?
        199563 by: Jared
        199565 by: Christophe Chisogne

PHP App User Permissions Tecnique
        199566 by: Brendon
        199567 by: Yusuf Tikupadang
        199571 by: Ian Firla

PHP websites (www/uk/us2)
        199568 by: Graham Cossey
        199572 by: Yusuf Tikupadang
        199573 by: Lester Caine
        199574 by: Ford, Mike

Re: 答复: [PHP] Problem with MSSQL
        199569 by: Yusuf Tikupadang
        199570 by: Yusuf Tikupadang

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 ---
* Thus wrote Mag:
> Hi Curt,
> Thanks for replying.
> 
> > $obSaveFile = new SaveToFile();
> > $obSaveFile->open('/path/to/file.html');
> > ob_start(array(&$obSaveFile, 'save'), 1024);
> > 
> > /* do your stuff  here */
> > 
> > ob_end_flush();
> > $obSaveFile->close();
> 
> 
> Problem is, I have not really learnt classes as yet, I
> know how to use them but I really have no idea as to
> how to make them. Looking at your above code I see you
> are calling open() and close() of the class but not
> write() is that a mistake or just my lack of
> understanding of classes? (No idea what this:
> &$obSaveFile 
> means either)

Oops, yeah the ob_start should have been:
  ob_start(array(&$obSaveFile, 'write'), 1024);

The &$ in $&obSaveFile uses a reference instead of a copy of the
object (an old php4 trick, see more on references)

What will happen is anytime PHP's output buffer decides to write
the contents of the buffer, in this case I told it to do it when
ever 1024 bytes where collected, it will call:

  $obSaveFile->write($contents_of_buffer);

Then your write() class method will write the buffer contents to
the file handle you opened in open().

the ob_end_flush() forces the rest of the buffer (<1024) to get sent too to
your write() class method, ensuring everything is written.


> Also I have heard that outbuffering can be quite
> complicated, would you mind filling in your example a
> bit more and I can make add to it and work from there?

Here is the class in full (w/o error checking):

class SaveToFile {
  var $file_handle;

  function open($file)  {
    $this->file_handle = fopen($file, 'w');
  }
  function write($buf) {
    fwrite($this->file_handle, $buf);
  }
  function close() {
    fclose($this->file_handle);
  }
}

Curt
-- 
Quoth the Raven, "Nevermore."

--- End Message ---
--- Begin Message --- Chris Shiflett wrote:
--- John Holmes <[EMAIL PROTECTED]> wrote:

header('Location: http://www.example.org/script2.php?".SID);

He is human after all. :-)

That's just a "rumour' I started...

--

---John Holmes...

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

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
For what period of time a session can exist? Or session exist as soon
as browser is open?
TH

--- End Message ---
--- Begin Message ---
Jerry Swanson wrote:

For what period of time a session can exist? Or session exist as soon
as browser is open?

1. For as long as the user is active 2. Depends on what page the browser opens

--

---John Holmes...

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

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
> > For what period of time a session can exist? Or session exist as soon
> > as browser is open?
> 
> 1. For as long as the user is active
> 2. Depends on what page the browser opens

I'm gonna elaborate a bit...

In your php.ini there is a session idle timeout setting.  The
inactivity John mentioned is set there.  Otherwise, yes, as soon as
the browser is closed.

-Dan Joseph

--- End Message ---
--- Begin Message ---
On what percent browsers Javascript is enabled?



On Wed, 13 Oct 2004 15:48:51 -0700, Mattias Thorslund
<[EMAIL PROTECTED]> wrote:
> There are several JavaScript solutions for validating forms on the
> client side. Search on hotscripts.com and google.com.
> 
> Client-side validation (in the browser) is useful, but you shouldn't
> depend on it to guarantee that the data that your users submit is
> valid.  You should also validate the data in your PHP script as you
> process the form.
> 
> Oh, and there are several PHP-based list managers available, for
> instance phplist, so you may not need to program it yourself.
> 
> /Mattias
> 
> Huang, Ou wrote:
> 
> >I am currently working on a newsletter mailing list project and
> >developed a form in php. I would like to validate before it is
> >submitted. What would be the best way to validate a form? Write your own
> >routines or using a form validator. I just started learning PHP, so
> >don't have much experience on this. I am thinking using a form validator
> >but not sure where I can get it.
> >
> >Any suggestions would be appreciated!
> >
> >Thanks.
> >
> >
> >
> 
> -- 
> More views at http://www.thorslund.us
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--- End Message ---
--- Begin Message ---
I wanna setup a tree structure. Each node in this tree is a
table. Each table has a "link" field. For each record, the
data in this field is a pointer to another table or null.

I read mysql manual but don't find any clues that SQL
supports such a "link" field. Does anyone has an idea about
that?

Thanks a lot!



                            eruisi
                            10/14/2004
                            21:01:16

--- End Message ---
--- Begin Message ---
Teng Wang wrote:

I wanna setup a tree structure. Each node in this tree is a
table. Each table has a "link" field. For each record, the
data in this field is a pointer to another table or null.

I read mysql manual but don't find any clues that SQL
supports such a "link" field. Does anyone has an idea about
that?

Did you happen to read about the MySQL mailing lists when you were reading the manual?

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

--- End Message ---
--- Begin Message ---
Hi guys,
Recently, I had to reformat one of the web servers and now I have
encountered an unusual problem. I am not sure whether this is an issue which
can be fixed in the .ini file or whether its specific to the version of php
I am using.

Here is the problem:
   $query="SELECT * FROM customizeViewClients WHERE employeeNum =
$employeeNum";
   $results=mssql_query($query, $connection) or die("Couldn't execute
query");
   $numRows=mssql_num_rows($results);

    if($numRows>0)
   {
         $row=mssql_fetch_array($results);
    }

     $selectedCol=$row["selectedCol"];
      echo $selectedCol;
     $selectedColName=$row[$selectCol];   //<--- PLEASE NOTE THIS SPECIFIC
ROW


For some reason, on the last row, I am not unable to reference a particular
index in the array using a php variable. This has been working for almost 12
months and now the coding is breaking all over the place. I don't have an
answer. Any feedback would be greatly appreciated.

Thx.
Dale

--- End Message ---
--- Begin Message ---
On Friday 15 October 2004 09:58, Dale Hersowitz wrote:

> For some reason, on the last row, I am not unable to reference a particular
> index in the array using a php variable. This has been working for almost
> 12 months and now the coding is breaking all over the place. I don't have
> an answer. Any feedback would be greatly appreciated.

echo()/print_r()/var_dump() every $variable that you use.

-- 
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
------------------------------------------
/*
I love being married.  It's so great to find that one special person
you want to annoy for the rest of your life.
                -- Rita Rudner
*/

--- End Message ---
--- Begin Message ---
    $selectedCol=$row["selectedCol"];
     echo $selectedCol;
    $selectedColName=$row[$selectCol];   //<--- PLEASE NOTE THIS SPECIFIC
ROW

Please give me the output, what do you get from "echo $selectedCol;"? If I had to guess, it looks like you're confusing key and value of an associatative array.

if

$row["selectedCol"] = 12;

$row["12"] does NOT equal "SelectedCol".


In fact, even if you used mysql_fetch_array, you will not be able to do a reverse lookup like that.

Suppose you have the following :

$row['a'] = 1;
$row['b'] = 2;
$row['c'] = 1;

You can see that your approach is incorrect because what would $row[1] return?

If this is NOT your question, please post your output(errors and all).

----- Original Message ----- From: "Dale Hersowitz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 14, 2004 9:58 PM
Subject: [PHP] problem with array


Hi guys,
Recently, I had to reformat one of the web servers and now I have
encountered an unusual problem. I am not sure whether this is an issue which
can be fixed in the .ini file or whether its specific to the version of php
I am using.

Here is the problem:
  $query="SELECT * FROM customizeViewClients WHERE employeeNum =
$employeeNum";
  $results=mssql_query($query, $connection) or die("Couldn't execute
query");
  $numRows=mssql_num_rows($results);

   if($numRows>0)
  {
        $row=mssql_fetch_array($results);
   }

    $selectedCol=$row["selectedCol"];
     echo $selectedCol;
    $selectedColName=$row[$selectCol];   //<--- PLEASE NOTE THIS SPECIFIC
ROW


For some reason, on the last row, I am not unable to reference a particular
index in the array using a php variable. This has been working for almost 12
months and now the coding is breaking all over the place. I don't have an
answer. Any feedback would be greatly appreciated.

Thx.
Dale

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


--- End Message ---
--- Begin Message ---
> Hi guys,
> Recently, I had to reformat one of the web servers and now I have
> encountered an unusual problem. I am not sure whether this is an
> issue which
> can be fixed in the .ini file or whether its specific to the
> version of php
> I am using.
>
> Here is the problem:
>    $query="SELECT * FROM customizeViewClients WHERE employeeNum =
> $employeeNum";
>    $results=mssql_query($query, $connection) or die("Couldn't execute
> query");
>    $numRows=mssql_num_rows($results);
>
>     if($numRows>0)
>    {
>          $row=mssql_fetch_array($results);
>     }
>
>      $selectedCol=$row["selectedCol"];
>       echo $selectedCol;
>      $selectedColName=$row[$selectCol];   //<--- PLEASE NOTE THIS SPECIFIC
ROW
[snip]

Note because you used $selectCol instead of $selectedCol?

I would also move the } to after this line so that you do not attempt to
access non-existent array elements when no rows are returned.

HTH

Graham

--- End Message ---
--- Begin Message --- This should be simple but having never have done it before and at deadline...help please.

Need to change:

 [EMAIL PROTECTED]

to;

user=domain


Thank you!

Mark
--- End Message ---
--- Begin Message ---
> This should be simple but having never have done it before and at
> deadline...help please.
> 
> Need to change:
> 
>  [EMAIL PROTECTED]
> 
> to;
> 
> user=domain

str_replace() is what you want...

$var = str_replace( "@", "=", $oldvar );

-Dan Joseph

--- End Message ---
--- Begin Message ---
On Thu, 2004-10-14 at 21:04 -0500, Mark Hubert wrote:
> This should be simple but having never have done it before and at 
> deadline...help please.
> 
> Need to change:
> 
>   [EMAIL PROTECTED]
> 
> to;
> 
> user=domain

Did you try searching on the php site or google first?

http://www.google.com/search?q=php+replace+character+in+string

first result should find you your answer...and would take less time than
sending the email. ;-)

-Robby

-- 
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
****************************************/

Attachment: signature.asc
Description: This is a digitally signed message part


--- End Message ---
--- Begin Message ---
need a regexp to get the contents of this marker or one very simular:

{!STATISTICS:starbucks!}

what I am looking for is to get the "STATISTICS" and "starbucks" into
an array() if possible.  I believe with the correct regexp this can be
accomplished using preg_split() or by getting the contents of the
marker and explode()'ing them.  also i am looking to grab several
strings for a marker like this, for instance.

{!STASTISTICS:starbucks:blended:chocolate!}

Also if someone could direct me to a site that explains how to use and
create regexp in a small minded manor since I have been unable to
grasp the concepts.

Thanks in advanced,
Robert

--- End Message ---
--- Begin Message ---
On Friday 15 October 2004 10:35, Robet Carson wrote:
> need a regexp to get the contents of this marker or one very simular:
>
> {!STATISTICS:starbucks!}
>
> what I am looking for is to get the "STATISTICS" and "starbucks" into
> an array() if possible.  I believe with the correct regexp this can be
> accomplished using preg_split() or by getting the contents of the
> marker and explode()'ing them.  also i am looking to grab several
> strings for a marker like this, for instance.
>
> {!STASTISTICS:starbucks:blended:chocolate!}
>
> Also if someone could direct me to a site that explains how to use and
> create regexp in a small minded manor since I have been unable to
> grasp the concepts.

A few tips for starting out with regex:

1) use PCRE, they are faster and ultimately more useful than the POSIX variety
2) Build up your regex step-by-step and test it at each step to see what is 
being matched and what isn't (and why it isn't)
3) Use parentheses () to enclose the bits you want to 'capture' (extract).
4) Practice
5) More practice


So for your first example, as a first draft you can just capture everything 
between the begin marker and the end marker:

  $doo = '{!STATISTICS:starbucks!}';
  preg_match('/\{!(.*)!\}/', $doo, $match)

$match[1] now contains: STATISTICS:starbucks

You can explode() it to get the constituent parts.

Or you can refine your regex:

  preg_match('/\{!(.*):(.*)!\}/', $doo, $match)

So basically your first draft would match a large chunk of stuff, your 
successive drafts would fine-tune it until eventually you're matching exactly 
what you need.

-- 
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
------------------------------------------
/*
Today you'll start getting heavy metal radio on your dentures.
*/

--- End Message ---
--- Begin Message --- I see that php 5.0.2 has added the "ldap_sasl_bind" function. I compiled php-5.0.2 against our OpenLDAP w/ SASL support libraries, and went ahead to give it a whirl:

#!/usr/local/bin/php
<?php
$ds = ldap_connect("ldap-test3.stanford.edu");
if($ds) {
  $r = ldap_sasl_bind($ds);
} else {
 echo "Unable to connect!";
}
?>


However, what I get back is:

<b>Warning</b>: ldap_sasl_bind() [<a href='function.ldap-sasl-bind'>function.ldap-sasl-bind</a>]: Unable to bind to server: Not Supported in <b>/afs/ir.stanford.edu/users/q/u/quanah/cgi-bin/test.cgi</b> on line <b>5</b><br />


In looking at the php 5.0.2 code I see:

if ((rc = ldap_sasl_interactive_bind_s(ld->link, NULL, NULL, NULL, NULL, LDAP_SASL_QUIET, _php_sasl_interact, NULL)) != LDAP_SUCCESS) {


This line seems a bit bogus to me -- All those nulls mean that a valid SASL Mechanism is never specified to bind as.

For example, in perl, I've used:

ldap_sasl_interactive_bind_s($self->{"ld"}, $dn, $pass,
       $self->{"saslmech"}, $self->{"saslrealm"},
       $self->{"saslauthzid"}, $self->{"saslsecprops"},
       $self->{"saslflags"});

(Note that for SASL/GSSAPI, the $dn & $pass can safely be ignored, as it is my K5 credentials that determine my DN anyhow).

Is this feature expected to work yet?

--Quanah

--
Quanah Gibson-Mount
Principal Software Developer
ITSS/Shared Services
Stanford University
GnuPG Public Key: http://www.stanford.edu/~quanah/pgp.html

--- End Message ---
--- Begin Message ---
On 15/10/2004, at 2:46 AM, Jed R. Brubaker wrote:

Hi all - I am looking at using a dbm-style cache system and was wondering if
anyone has any recommendations from the plethora of systems listed here:
http://us2.php.net/manual/en/ref.dba.php
Is there a favorite?

I know if probably depends on what I want to do, so in short, I am looking
to create a temporary table that will be a composite of a ton of MySQL
queries (hence the reason I am not just querying). I have thought about just
creating a new database table to push my query results into, but I would
love to make it faster if possible. Am I hopelessly misguided?

I would love any feedback!

I've never done it, but I think serializing the result and inserting into a three column table with the query and a expiry date is pretty common. If you were to write your own DB adapters and wrappers (rather than using mysql_* directly), you probably wouldn't even notice the extra code or whatever needed.

I don't think MySQL has anything built in.

Justin French
--- End Message ---
--- Begin Message --- I made this code to pick a random record from a changeable number of records in a given table.
I'm just curious if any of the more awake coders out there can see a way to optimize this for better performance, since there's several other DB queries on the same page.

$records = mysql_query("SELECT COUNT(*) AS count FROM persons") or die('Unable to get record count<br>'.mysql_error());
$totalcount = mysql_result($records,0) - 1;
$rndrecord = rand(0,$totalcount);
$personquery = mysql_query("SELECT personID FROM persons LIMIT $rndrecord,1") or die('Unable to get random record<br>'.mysql_error());
$personID = mysql_result($personquery,0);
--
Rene Brehmer
aka Metalbunny

If your life was a dream, would you wake up from a nightmare, dripping of sweat, hoping it was over? Or would you wake up happy and pleased, ready to take on the day with a smile?

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums at http://forums.metalbunny.net/

--- End Message ---
--- Begin Message ---
* -{ Rene Brehmer }- <[EMAIL PROTECTED]>:
> I made this code to pick a random record from a changeable number of 
> records in a given table.
> I'm just curious if any of the more awake coders out there can see a way to 
> optimize this for better performance, since there's several other DB 
> queries on the same page.
>
>    $records = mysql_query("SELECT COUNT(*) AS count FROM persons") or 
> die('Unable to get record count<br>'.mysql_error());
>    $totalcount = mysql_result($records,0) - 1;
>    $rndrecord = rand(0,$totalcount);
>    $personquery = mysql_query("SELECT personID FROM persons LIMIT 
> $rndrecord,1") or die('Unable to get random record<br>'.mysql_error());
>    $personID = mysql_result($personquery,0);

Since you're using mysql, why not use the RAND() function?

$sql = "SELECT personID FROM persons ORDER BY RAND() LIMIT 1";
$query = mysql_query($sql) or die("Unable to get random record");
$personID = mysql_result($query, 0);

I've used this quite a bit -- much easier than using PHP to do it.

-- 
Matthew Weier O'Phinney           | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist       | http://www.garden.org
National Gardening Association    | http://www.kidsgardening.com
802-863-5251 x156                 | http://nationalgardenmonth.org

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

What about in MySQL:

SELECT personID from persons ORDER BY RAND(NOW()) LIMIT 1

If the table is large, then the following might be better:

LOCK TABLES foo READ;
SELECT FLOOR(RAND() * COUNT(*)) AS rand_row FROM foo;
SELECT * FROM foo LIMIT $rand_row, 1;
UNLOCK TABLES;

There's a whole discussion on it in the MySQL documentation web site:

http://dev.mysql.com/doc/mysql/en/SELECT.html


On 15 Oct 2004, at 07:41, -{ Rene Brehmer }- wrote:

I made this code to pick a random record from a changeable number of records in a given table.
I'm just curious if any of the more awake coders out there can see a way to optimize this for better performance, since there's several other DB queries on the same page.

$records = mysql_query("SELECT COUNT(*) AS count FROM persons") or die('Unable to get record count<br>'.mysql_error());
$totalcount = mysql_result($records,0) - 1;
$rndrecord = rand(0,$totalcount);
$personquery = mysql_query("SELECT personID FROM persons LIMIT $rndrecord,1") or die('Unable to get random record<br>'.mysql_error());
$personID = mysql_result($personquery,0);
--
Rene Brehmer
aka Metalbunny

If your life was a dream, would you wake up from a nightmare, dripping of sweat, hoping it was over? Or would you wake up happy and pleased, ready to take on the day with a smile?

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums at http://forums.metalbunny.net/

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


--- End Message ---
--- Begin Message ---
Hi, 
I'm a new member in this mailing list.
I have a problem with large data in mssql (more than 100.000 record in
one table). If I want to browse it from record 10 until 19 (like when
I press next button), php have to read all data (select * from table).
Is it posible to read only the record that I need (from record x1
untuk x2), without stored procedure?
Thanks before.

Best Regards,
Yusuf Tikupadang

--- End Message ---
--- Begin Message ---
I'm running PHP as CGI instead of as an apache module because my hosting 
1) suggests it and 2) this way I can compile my own PHP with whatever 
options I want, including a custom php.ini.

Works great except when I load a page that doesn't exist, such as 
foo.php, I get "No input file specified." Instead of the standard 404 
error. Is there a way to customize this?

I've read about it and the consensus is that you can't. I don't 
understand why not, though. Wouldn't it be easy to add a custom 404 
error page via php.ini or something?

--- End Message ---
--- Begin Message --- Jared wrote:
foo.php, I get "No input file specified." Instead of the standard 404 error. Is there a way to customize this?

Easy with Apache [1,2], with en ErrorDocument [1] directive. Ex with this in a .htaccess (the FileInfo Override [3] is required) containing this line:

ErrorDocument 404 /Lame_excuses/not_found.html

I've read about it and the consensus is that you can't.

Upgrade consensus :)

Wouldn't it be easy to add a custom 404 error page via php.ini or something?

Easy with Apache (.htaccess or httpd.conf). Ok, not via php.ini.

Christophe

[1] ErrorDocument directive
http://httpd.apache.org/docs/mod/core.html#errordocument

[2] Using XSSI and ErrorDocument to configure customized international server error 
responses
http://httpd.apache.org/docs/misc/custom_errordocs.html

[3] AllowOverride directive
http://httpd.apache.org/docs/mod/core.html#allowoverride

--- End Message ---
--- Begin Message --- I am building a web based community forum type software using PHP. I am currently working on how different user privelages are handled. Each user is part of a group and each group has varying degrees of privelages.

I need to add in functionality which at the begginning of every script check the permission level of the user accessing the page. There are about 15 different permissions.

I am debating whether i should store all the permission abilities into session variables and they can quickly be checked throughout the script, or whether i should query the database to check to see if the user has adequate group permissions to perform a certain function.

Could someone give me some advice as to which would be more advisable?
--- End Message ---
--- Begin Message ---
I think read from database better than from session, because it's more
easy than usnig session.

On Fri, 15 Oct 2004 00:41:31 -0700, Brendon <[EMAIL PROTECTED]> wrote:
> I am building a web based community forum type software using PHP. I am
> currently working on how different user privelages are handled. Each
> user is part of a group and each group has varying degrees of privelages.
> 
> I need to add in functionality which at the begginning of every script
> check the permission level of the user accessing the page. There are
> about 15 different permissions.
> 
> I am debating whether i should store all the permission abilities into
> session variables and they can quickly be checked throughout the script,
> or whether i should query the database to check to see if the user has
> adequate group permissions to perform a certain function.
> 
> Could someone give me some advice as to which would be more advisable?
>

--- End Message ---
--- Begin Message ---
Definitely store them in a session. A db lookup will mean a much heavier
and process intensive procedure.

Ian

On Fri, 2004-10-15 at 09:41, Brendon wrote:
> I am building a web based community forum type software using PHP. I am 
> currently working on how different user privelages are handled. Each 
> user is part of a group and each group has varying degrees of privelages.
> 
> I need to add in functionality which at the begginning of every script 
> check the permission level of the user accessing the page. There are 
> about 15 different permissions.
> 
> I am debating whether i should store all the permission abilities into 
> session variables and they can quickly be checked throughout the script, 
> or whether i should query the database to check to see if the user has 
> adequate group permissions to perform a certain function.
> 
> Could someone give me some advice as to which would be more advisable?

--- End Message ---
--- Begin Message ---
I was wondering what the difference is between the various PHP sites linked
to in this list, are they mirrors and what determines which site you get
directed to when doing a search from www.php.net?

http://www.php.net
http://uk.php.net
http://us2.php.net

and presumably others...


Thanks

Graham

--- End Message ---
--- Begin Message ---
They're mirrors.


On Fri, 15 Oct 2004 09:20:10 +0100, Graham Cossey
<[EMAIL PROTECTED]> wrote:
> 
> I was wondering what the difference is between the various PHP sites linked
> to in this list, are they mirrors and what determines which site you get
> directed to when doing a search from www.php.net?
> 
> http://www.php.net
> http://uk.php.net
> http://us2.php.net
> 
> and presumably others...
> 
> Thanks
> 
> Graham
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--- End Message ---
--- Begin Message ---
Graham Cossey wrote:

I was wondering what the difference is between the various PHP sites linked
to in this list, are they mirrors and what determines which site you get
directed to when doing a search from www.php.net?

If you download you will be directed to a mirror, and that will then be used as your default location. I tend to use the uk one myself.

The problem comes when you quote links and include your mirror in that - just a problem that the Internet has yet to overcome. Perhaps local ip addresses could be picked up by an ISP for things like google or php - that would help reduce long distance traffic ;)

--
Lester Caine
-----------------------------
L.S.Caine Electronic Services

--- End Message ---
--- Begin Message ---
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 15 October 2004 10:00, Yusuf Tikupadang wrote:

> They're mirrors.
> 
> 
> On Fri, 15 Oct 2004 09:20:10 +0100, Graham Cossey
> <[EMAIL PROTECTED]> wrote:
> > 
> > I was wondering what the difference is between the various PHP
> > sites linked to in this list, are they mirrors and what determines
> > which site you get directed to when doing a search from www.php.net?
> > 
> > http://www.php.net
> > http://uk.php.net
> > http://us2.php.net
> > 
> > and presumably others...

Yes -- http://www.php.net/mirrors.php for a full list.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

--- End Message ---
--- Begin Message ---
> I don't know if this can running on mssql.
> select .... limit m,n
No, mssql can't do that. the only solution that i have is using
cursor, but I can't use codecharge to do that (and need much more time
to develop).
Thanks for your idea.

Best Regards,
Yusuf Tikupadang

--- End Message ---
--- Begin Message ---
> I don't know if this can running on mssql.
> select .... limit m,n
No, mssql can't do that. the only solution that i have is using
cursor, but I can't use codecharge to do that (and need much more time
to develop).
Thanks for your idea.

Best Regards,
Yusuf Tikupadang

--- End Message ---

Reply via email to