Re: [PHP] Help With Recursion Multi-Dimensional Arrays

2003-11-09 Thread Burhan Khalid
Navid Yar wrote:

Hello Guys,

I need a little bit of help with recursion. I've searched our PHP website
and Google, but none helped me understand my problem. There is a code below
this message in order to help you understand what I am trying to achieve.
Here is an explaination:
What I'm trying to do is list a typical category/subcategory system with
parents and children associated with those parents. My database table
(categories) lists all the parents and children together, each with a
parent_id field
(with root being a value of 0). What I want to do is, if a user clicked on
one of the parent categories, only one level of that category will show (or
only the direct children of that specific category will show). I want the
depth to be endless because I want to control the depth some other way. I
know that using a recursive theory would cost a lot as far as speed goes,
but I'm willing to risk it for now.
Here is the problem: The problem is that the recursive method yields several
arrays, instead of one long array. I tried to use an array_push() function,
but that doesn't seem to work well with multi-dimentional arrays. I tried
the straight way, i.e. $menu_array[$count]['name'] = $name_of_category or
$menu_array['name'][$count] = $name_of_category, but that yields several
arrays instead of one long array or category names. The depth of the
categories can be determined by the $_GET string passed, $_GET['some_path'],
which is in the format: parent1_child1_grandchild1_grandchild2,
etc.($some_path = 1_4_6_8), where all of these are related to each other.
These, of course, are split using the underscore delimeter: $path['0'] = 1,
$path['1'] = 4, and so on.
Can you give a sample of what the print_r() of the desired output would 
be like? That would help :)

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
---
Documentation is like sex: when it is good,
 it is very, very good; and when it is bad,
 it is better than nothing.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Beveled text

2003-11-09 Thread Javier Muniz
Interesting, is this for a website?  If so have you tried doing the same
thing with CSS?  Using CSS you could make the site load faster and be more
accessible (for instance, you can allow users to choose their own font size,
and make it easier for page readers to handle your page).

-Javier

-Original Message-
From: Ashley M. Kirchner [mailto:[EMAIL PROTECTED] 
Sent: Saturday, November 08, 2003 10:12 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Beveled text


Ashley M. Kirchner wrote:

This produces the attached result.  Not exactly beveled, but pretty
 close (and it's the effect I wanted.)

Hmm, yes.  Attached result gets stripped by the listserv.  So, it's 
also visible here:

http://37th.yeehaw.net/phpiscool.png

-- 
 H| I haven't lost my mind; it's backed up on tape somewhere.
  +
  Ashley M. Kirchner mailto:[EMAIL PROTECTED]   .   303.442.6410 x130
  IT Director / SysAdmin / WebSmith . 800.441.3873 x130
  Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6
  http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A. 

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

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



Re: [PHP] Beveled text

2003-11-09 Thread Ashley M. Kirchner
Javier Muniz wrote:

Interesting, is this for a website?  If so have you tried doing the same
thing with CSS?  Using CSS you could make the site load faster and be more
accessible (for instance, you can allow users to choose their own font size,
and make it easier for page readers to handle your page).
   When I originally created the script, it was simply an exercise, to 
see if I could do it.  However, I have since then incorporated it into a 
site design of mine, where I wanted the headers to be images, 
dynamically created.  So yes, for each page that loads, each header 
calls this script which then spits out the PNG data.  Large overhead, 
simply because I never bothered looking into doing it with CSS, and also 
because outputting a PNG image I'm guaranteed it will work, and it will 
look the way I want it to look (both font type, as well as with layout 
positioning,) as opposed to dealing with broken browsers and people not 
seeing the same thing.  And also because I can use my fonts, instead of 
relying on the user having a particular font installed on their system.

--
H| I haven't lost my mind; it's backed up on tape somewhere.
 +
 Ashley M. Kirchner mailto:[EMAIL PROTECTED]   .   303.442.6410 x130
 IT Director / SysAdmin / WebSmith . 800.441.3873 x130
 Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6
 http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A. 

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


[PHP] Dose this exist?

2003-11-09 Thread Dave Carrera
Hi List,

Is there such a tool that will generate a form and relevant code when given
the mysql db-table-fields to update, select, insert etc ?

I ask as hand coding forms and the relevant php code is becoming very time
consuming and I need to speed up this operation.

Any URL's would be useful.

Thank you in advance for any help

Yours
Dave C

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.535 / Virus Database: 330 - Release Date: 01/11/2003
 

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



[PHP] Executing shell commands

2003-11-09 Thread Teren
Hi, I'm trying to write a front end for something and I want to be able to execute 
shell commands. I tried all of the pre-written functions and non of them would work. I 
setup a user that can sudo and then i set apache to run as that user. So, what I tried 
to do is shell_exec(sudo -s; reboot;); but that didn't work, I also tried other 
numerous variations all of which didn't work (also using exec(), system(), passthru()  
). If any one has any ideas how i can do this, please let me know. Thanks

Teren

Re: [PHP] Executing shell commands

2003-11-09 Thread Robert Cummings
On Sun, 2003-11-09 at 03:41, Teren wrote:

 Hi, I'm trying to write a front end for something and I want to be able
 to execute shell commands. I tried all of the pre-written functions
 and non of them would work. I setup a user that can sudo and then i
 set apache to run as that user. So, what I tried to do is
 shell_exec(sudo -s; reboot;); but that didn't work, I also tried
 other numerous variations all of which didn't work (also using exec(),
 system(), passthru()  ). If any one has any ideas how i can do this,
 please let me know. Thanks

I believe this has been answered quite recently and the large consensus
was to have a daemon (cron or otherwise) check for some status file or
database entry, which when set it would perform the required function.
So for instance to reboot the machine, perhaps a cron job would check
for the existence of /tmp/myFrontEnd/reboot and if found reboot the
machine. Thus the front end would only need to create the file.

HTH,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Dose this exist?

2003-11-09 Thread Burhan Khalid
Dave Carrera wrote:

Hi List,

Is there such a tool that will generate a form and relevant code when given
the mysql db-table-fields to update, select, insert etc ?
I ask as hand coding forms and the relevant php code is becoming very time
consuming and I need to speed up this operation.
Any URL's would be useful.
http://pear.php.net/HTML_Quickform
http://smarty.php.net
--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
---
Documentation is like sex: when it is good,
 it is very, very good; and when it is bad,
 it is better than nothing.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Help With Recursion Multi-Dimensional Arrays

2003-11-09 Thread Lowell Allen
[snip]

 What I'm trying to do is list a typical category/subcategory system with
 parents and children associated with those parents. My database table
 (categories) lists all the parents and children together, each with a
 parent_id field
 (with root being a value of 0). What I want to do is, if a user clicked on
 one of the parent categories, only one level of that category will show (or
 only the direct children of that specific category will show). I want the
 depth to be endless because I want to control the depth some other way. I
 know that using a recursive theory would cost a lot as far as speed goes,
 but I'm willing to risk it for now.
 
 Here is the problem: The problem is that the recursive method yields several
 arrays, instead of one long array. I tried to use an array_push() function,
 but that doesn't seem to work well with multi-dimentional arrays. I tried
 the straight way, i.e. $menu_array[$count]['name'] = $name_of_category or
 $menu_array['name'][$count] = $name_of_category, but that yields several
 arrays instead of one long array or category names. The depth of the
 categories can be determined by the $_GET string passed, $_GET['some_path'],
 which is in the format: parent1_child1_grandchild1_grandchild2,
 etc.($some_path = 1_4_6_8), where all of these are related to each other.
 These, of course, are split using the underscore delimeter: $path['0'] = 1,
 $path['1'] = 4, and so on.
 
 And finally, here is my question: How do I get all these categories, parents
 and children, listed into one array and then returned. I want to be able to
 list them on the web page using one array. I will also include id,
 parent_id, and other info with each array, but first I want to get the name
 listings of the categories to work. Also, if anyone has any suggestions
 about a more speedier way to do this, please let me know.

I'm currently experimenting with something very similar to what you
describe, and having success by creating one array from a database query,
then using foreach loops to go through that array to display the main menu,
find submenu items or create submenu arrays as needed. However, I'm limiting
menus to three levels deep, so I can get away with conditional checks that
only need to consider id, parent id, and grandparent id.

Here's how I create the main array:

$menu_sql = SELECT id, parentid, menuname FROM pages WHERE
displaystatus='Y' ORDER BY parentid, displayorder;
$menu_result = mysql_query($menu_sql);
if (mysql_num_rows($menu_result)  0) {
while ($menu_row = mysql_fetch_array($menu_result)) {
$menu_array[] = array($menu_row[id], $menu_row[parentid],
$menu_row[menuname]);
}
}

Here's the code that creates the main menu:

// home id is 10
$id = isset($_GET[id]) ? $_GET[id] : 10;
$pid = isset($_GET[pid]) ? $_GET[pid] : 0;
$gpid = isset($_GET[gpid]) ? $_GET[gpid] : ;

// create tab menu
echo(div id=\tabs\\nul\n);
foreach ($menu_array as $menu) {
if ($menu[1] == 0) {
if ($menu[0] == $id || $menu[0] == $pid || $menu[0] == $gpid) {
echo(li id=\selected\a href=\ . $PHP_SELF . ?id= .
$menu[0] . pid=0\ . $menu[2] . /a/li\n);
} else {
echo(lia href=\ . $PHP_SELF . ?id= . $menu[0] .
pid=0\ . $menu[2] . /a/li\n);
}
}
}
echo(/ul\n/div\n);

Second-level and third-level menus are created in a similar manner:

if ($gpid == 0) {
// display children of parent page, then children of current page
// build submenu of child pages of parent page
foreach ($menu_array as $subcheck) {
if ($subcheck[1] == $pid) {
$sublevel[] = array($subcheck[0], $subcheck[1], $subcheck[2]);
}
}
if (count($sublevel)  0) {
$menu_count = 0;
echo(div id=\submenu\\n);
foreach ($sublevel as $sublink) {
$menu_count++;
if ($menu_count  count($sublevel)) {
if ($sublink[0] == $id) {
echo(a href=\ . $PHP_SELF . ?id= . $sublink[0] .
pid= . $sublink[1] . gpid=0\ style=\font-weight: bold; color:
#900;\ . $sublink[2] . /a | \n);
} else {
echo(a href=\ . $PHP_SELF . ?id= . $sublink[0] .
pid= . $sublink[1] . gpid=0\ . $sublink[2] . /a | \n);
}
} else {
if ($sublink[0] == $id) {
echo(a href=\ . $PHP_SELF . ?id= . $sublink[0] .
pid= . $sublink[1] . gpid=0\ style=\font-weight: bold; color:
#900;\ . $sublink[2] . /a\n/div\n);
} else {
echo(a href=\ . $PHP_SELF . ?id= . $sublink[0] .
pid= . $sublink[1] . gpid=0\ . $sublink[2] . /a\n/div\n);
}
}
}
}
// build submenu of child pages of current page
foreach ($menu_array as $subcheck2) {
if ($subcheck2[1] == $id) {
$sublevel2[] = array($subcheck2[0], $subcheck2[1],
$subcheck2[2]);
}
}
if (count($sublevel2)  0) {
$menu_count = 0;
echo(div id=\submenu2\\n);
 

Re: [PHP] Problems with session_id() in Windows?

2003-11-09 Thread Steve Buehler
Check your php.ini file and see where it is trying to save your sessions 
at.  I think it is trying to save them to /tmp.  You might have to make 
sure that directory exists.  You might also have to put it in as the full 
path.  ex.C:\tmp.  Make sure to restart your apache, or whatever Web 
Server you are running after making this change.

Steve

At 12:10 AM 11/9/2003, you wrote:
Hello all:

We recently ported an application from Linux to Windows and had a few
sessions-handling issues (we were going from PHP 4.1.2 Linxu to PHP 4.3.3
Windows).
We traced this to PHP's session_id() function. It worked fine in Linux, but
apparently not at all in windows, or not as expected.
Has anyone seen or heard of this? The notes in the docs didn't tell me
anything special about this.
-- steve lane

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


[PHP] Re: Dose this exist?

2003-11-09 Thread Greg Beaver
Hello Dave,

Although HTML_QuickForm is useful, you will find DB_DataObject is closer 
to what you need http://pear.php.net/db_dataobject

Greg
--
phpDocumentor
http://www.phpdoc.org
Dave Carrera wrote:
Hi List,

Is there such a tool that will generate a form and relevant code when given
the mysql db-table-fields to update, select, insert etc ?
I ask as hand coding forms and the relevant php code is becoming very time
consuming and I need to speed up this operation.
Any URL's would be useful.

Thank you in advance for any help

Yours
Dave C
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.535 / Virus Database: 330 - Release Date: 01/11/2003
 
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP session won't die!

2003-11-09 Thread Marek Kilimajer
[EMAIL PROTECTED] wrote:
I have tried about 15 combinations of unset(), session_unregister(), session_destroy(), session_unset(), $_SESSION = array(), 
I miss session_start in the list. You have to start the session prior to 
destroying it.

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


php-general Digest 9 Nov 2003 16:33:59 -0000 Issue 2405

2003-11-09 Thread php-general-digest-help

php-general Digest 9 Nov 2003 16:33:59 - Issue 2405

Topics (messages 168974 through 168991):

Re: Help With Recursion  Multi-Dimensional Arrays
168974 by: Jordan S. Jones
168981 by: Burhan Khalid
168988 by: Lowell Allen

Re: BTML 2.0 released!!!
168975 by: John Nichel
168976 by: Robert Cummings

Re: Beveled text
168977 by: Javier Muniz
168978 by: Ashley M. Kirchner
168980 by: Ashley M. Kirchner
168982 by: Javier Muniz
168983 by: Ashley M. Kirchner

Problems with session_id() in Windows?
168979 by: Steve Lane
168989 by: Steve Buehler

Dose this exist?
168984 by: Dave Carrera
168987 by: Burhan Khalid
168990 by: Greg Beaver

Executing shell commands
168985 by: Teren
168986 by: Robert Cummings

Re: PHP session won't die!
168991 by: Marek Kilimajer

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]


--
---BeginMessage---
Navid,

So you want something like this:

Category 1
Category 2
|
 --- Category a
|
 Category b
 |
   Category X
 |
   Category Y
   |
 Category AC
   |
 Category BC
  |
    Category Z
|
  Category c
Category 3
in a multi-dimentional array

Jordan S. Jones



Navid Yar wrote:

Hello Guys,

I need a little bit of help with recursion. I've searched our PHP website
and Google, but none helped me understand my problem. There is a code below
this message in order to help you understand what I am trying to achieve.
Here is an explaination:
What I'm trying to do is list a typical category/subcategory system with
parents and children associated with those parents. My database table
(categories) lists all the parents and children together, each with a
parent_id field
(with root being a value of 0). What I want to do is, if a user clicked on
one of the parent categories, only one level of that category will show (or
only the direct children of that specific category will show). I want the
depth to be endless because I want to control the depth some other way. I
know that using a recursive theory would cost a lot as far as speed goes,
but I'm willing to risk it for now.
Here is the problem: The problem is that the recursive method yields several
arrays, instead of one long array. I tried to use an array_push() function,
but that doesn't seem to work well with multi-dimentional arrays. I tried
the straight way, i.e. $menu_array[$count]['name'] = $name_of_category or
$menu_array['name'][$count] = $name_of_category, but that yields several
arrays instead of one long array or category names. The depth of the
categories can be determined by the $_GET string passed, $_GET['some_path'],
which is in the format: parent1_child1_grandchild1_grandchild2,
etc.($some_path = 1_4_6_8), where all of these are related to each other.
These, of course, are split using the underscore delimeter: $path['0'] = 1,
$path['1'] = 4, and so on.
And finally, here is my question: How do I get all these categories, parents
and children, listed into one array and then returned. I want to be able to
list them on the web page using one array. I will also include id,
parent_id, and other info with each array, but first I want to get the name
listings of the categories to work. Also, if anyone has any suggestions
about a more speedier way to do this, please let me know.
Sorry for the long explaination, I just wanted to make sure you guys
understood my goals. Thanks in advance to anyone that responds, I appreciate
it very much. Here is the code I promised:
-

function menu_tree($parent_id = '0', $cPath = '', $menu_array = '') {
   if (!is_array($menu_array)) {
   $menu_array = array();
   $cPath = $this-separatePath($_GET['cPath']); // separates $_GET
string into array of category ids
   } else {
   reset($cPath);
   array_shift($cPath);
   }
   if (sizeof($cPath) = 0) {
   $db = new base_db();
   $query = select cid, name, parent_id from categories where
parent_id = ' . $parent_id . ' order by sort_order, name;;
   $categories = $db-fetch_results($query);
   //echo sizeof($cPath).br /;
   //echo $query.br /;
   for ($i = 0, $count = 0; $i  count($categories); $i++, $count++) {
  // The following are the methods I tied, but failed to work
   //$menu_array['name'][$count] = $categories[$i]['name'];
   //$menu_array[]['name'] = $categories[$i]['name'];
   //$menu_array['name'][] = 

[PHP] Solutions for 1970 epoch date restriction

2003-11-09 Thread YC Nyon
Hi,

I have a table that includes 3 columns for day, month and year. Example:
Day, Month, Year
11,Jan, 1974
4,Sep, 1921
...
...

I need to construct a query where users can specify a starting date.
Currently, I stuck in mktime function became of the 1970 epoch problem. It
gives an error for dates before 1970.
Anyone has  a solution?


Regards
Nyon

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



[PHP] First test release of BTportal made!!!!

2003-11-09 Thread Bas
It's avaiable on:

http://members.home.nl/famde.jong/portalBT-0.0.1.zip

If you have any comments, post a reply.

If you find it is very easy, it is. That is why it is version 0.0.1

Okay, it is not that good, but please try it... There is even an install
script in it!!

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



Re: [PHP] Solutions for 1970 epoch date restriction

2003-11-09 Thread John W. Holmes
YC Nyon wrote:
I have a table that includes 3 columns for day, month and year. Example:
Day, Month, Year
11,Jan, 1974
4,Sep, 1921
...
...
I need to construct a query where users can specify a starting date.
Currently, I stuck in mktime function became of the 1970 epoch problem. It
gives an error for dates before 1970.
Anyone has  a solution?
Why are you using three separate columns? What database are you using?

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

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


RE: [PHP] Beveled text

2003-11-09 Thread Javier Muniz
Ok, that's reasonable.  My only suggestion would be to cache the images that
your script generates.  A good way to do this is to md5 or otherwise hash
the arguments to the PNG generation code and then have the code search for a
file in a specified directory (/tmp/generated_pngs for instance) with that
name before calling gd, if it exists just read out that file, otherwise
generate a new one and place it in the directory.  This will lower your
overhead without adding too much complexity.  To spray out the cached
version of your PNG use readfile() or something similar.

-Javier

-Original Message-
From: Ashley M. Kirchner [mailto:[EMAIL PROTECTED] 
Sent: Saturday, November 08, 2003 11:57 PM
To: Javier Muniz
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Beveled text


Javier Muniz wrote:

Interesting, is this for a website?  If so have you tried doing the 
same thing with CSS?  Using CSS you could make the site load faster and 
be more accessible (for instance, you can allow users to choose their 
own font size, and make it easier for page readers to handle your 
page).

When I originally created the script, it was simply an exercise, to 
see if I could do it.  However, I have since then incorporated it into a 
site design of mine, where I wanted the headers to be images, 
dynamically created.  So yes, for each page that loads, each header 
calls this script which then spits out the PNG data.  Large overhead, 
simply because I never bothered looking into doing it with CSS, and also 
because outputting a PNG image I'm guaranteed it will work, and it will 
look the way I want it to look (both font type, as well as with layout 
positioning,) as opposed to dealing with broken browsers and people not 
seeing the same thing.  And also because I can use my fonts, instead of 
relying on the user having a particular font installed on their system.

-- 
 H| I haven't lost my mind; it's backed up on tape somewhere.
  +
  Ashley M. Kirchner mailto:[EMAIL PROTECTED]   .   303.442.6410 x130
  IT Director / SysAdmin / WebSmith . 800.441.3873 x130
  Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6
  http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A. 

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



RE: [PHP] Executing shell commands

2003-11-09 Thread Javier Muniz
Ack! No no no no no! At least put something this critical in a password
protected database, not a place that could possibly be written to by a
malicious user that gains access to an easily-writable directory like /tmp,
the DoS and security ramifications of having a system like this are huge.
Be exceptionally careful, and never pretend that /tmp is a safe place for
data.  If something is being read from /tmp then it should be treated the
same way user-inputted data is, and never trusted.

-Javier

-Original Message-
From: Robert Cummings [mailto:[EMAIL PROTECTED] 
Sent: Sunday, November 09, 2003 12:47 AM
To: Teren
Cc: PHP-General
Subject: Re: [PHP] Executing shell commands


On Sun, 2003-11-09 at 03:41, Teren wrote:

 Hi, I'm trying to write a front end for something and I want to be 
 able to execute shell commands. I tried all of the pre-written 
 functions and non of them would work. I setup a user that can sudo and 
 then i set apache to run as that user. So, what I tried to do is 
 shell_exec(sudo -s; reboot;); but that didn't work, I also tried 
 other numerous variations all of which didn't work (also using exec(), 
 system(), passthru()  ). If any one has any ideas how i can do this, 
 please let me know. Thanks

I believe this has been answered quite recently and the large consensus was
to have a daemon (cron or otherwise) check for some status file or database
entry, which when set it would perform the required function. So for
instance to reboot the machine, perhaps a cron job would check for the
existence of /tmp/myFrontEnd/reboot and if found reboot the machine. Thus
the front end would only need to create the file.

HTH,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  | a 
| powerful, scalable system for accessing system services  | such as 
| forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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

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



Re: [PHP] High bandwidth application tips

2003-11-09 Thread dr. zoidberg
Radu Manole wrote:

Hi all,

I do have a question about optimizing the php for large applications.
Many applications group the functions in files (eg. functions.inc.php) or
build classes, and these files/classes are called with 'require' or
'include' on the top of each main file.
What would be the speed penalty if we have to include many files or if these
functions containter files are over 100k in size. I know the php engine will
parse them too. Are any tips to follow when using many functions?
It is much better to include only one big file, but only if you need all 
of that functions. You should try to separate your functions into 3 or + 
files: LoginFunctions.php, OtherFunctions.php, PictureFunctions.php and 
include only the ONE you need. If you need all of them, make only one 
file, and include only one file.

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


[PHP] Re: DW Php update form where one field is menu from another table

2003-11-09 Thread Robb Kerr
Thanx. I placed there as well, but wasn't getting any responses so thought
I'd try this group as it has been invaluable in the past.

Finally got a response on the Macromedia group so I'll try that suggestion.

-- 
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams
http://www.digitaliguana.com
http://www.cancerreallysucks.org

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



Re: [PHP] Solutions for 1970 epoch date restriction

2003-11-09 Thread David Otton
On Mon, 10 Nov 2003 01:41:15 +0800, you wrote:

I have a table that includes 3 columns for day, month and year. Example:
Day, Month, Year
11,Jan, 1974
4,Sep, 1921

That would be your problem - you should be using your database's native date
type.

I need to construct a query where users can specify a starting date.
Currently, I stuck in mktime function became of the 1970 epoch problem. It
gives an error for dates before 1970.
Anyone has  a solution?

[assumes mysql]

http://www.mysql.com/doc/en/Date_and_time_types.html

SELECT * FROM table WHERE start_date  '1969-08-25';

[for anyone who's interested, Raymond Chen's excellent journal had a short
article on various Windows timestamps:
http://blogs.gotdotnet.com/raymondc/permalink.aspx/99c54993-5c5e-45b9-95c1-c20a0526ce0b]

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



RE: [PHP] First test release of BTportal made!!!!

2003-11-09 Thread Paul
You might consider creating your own lists to make releases and leave
php-list alone.
Imagine what it will happen if everybody will post their releases on the
list.
Cheers!
Paul


-Original Message-
From: Bas [mailto:[EMAIL PROTECTED]
Sent: Sunday, November 09, 2003 6:18 PM
To: [EMAIL PROTECTED]
Subject: [PHP] First test release of BTportal made


It's avaiable on:

http://members.home.nl/famde.jong/portalBT-0.0.1.zip

If you have any comments, post a reply.

If you find it is very easy, it is. That is why it is version 0.0.1

Okay, it is not that good, but please try it... There is even an install
script in it!!

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

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



RE: [PHP] First test release of BTportal made!!!!

2003-11-09 Thread Ryan A
Whats it about?
Can you give me a list of features?

Cheers,
-Ryan

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



RE: [PHP] Executing shell commands

2003-11-09 Thread Robert Cummings
I did mention database as one of the solutions. The question wasn't
about security so I didn't elaborate.

Cheers,
Rob.

On Sun, 2003-11-09 at 16:45, Javier Muniz wrote:
 Ack! No no no no no! At least put something this critical in a password
 protected database, not a place that could possibly be written to by a
 malicious user that gains access to an easily-writable directory like /tmp,
 the DoS and security ramifications of having a system like this are huge.
 Be exceptionally careful, and never pretend that /tmp is a safe place for
 data.  If something is being read from /tmp then it should be treated the
 same way user-inputted data is, and never trusted.
 
 -Javier
 
 -Original Message-
 From: Robert Cummings [mailto:[EMAIL PROTECTED] 
 Sent: Sunday, November 09, 2003 12:47 AM
 To: Teren
 Cc: PHP-General
 Subject: Re: [PHP] Executing shell commands
 
 
 On Sun, 2003-11-09 at 03:41, Teren wrote:
 
  Hi, I'm trying to write a front end for something and I want to be 
  able to execute shell commands. I tried all of the pre-written 
  functions and non of them would work. I setup a user that can sudo and 
  then i set apache to run as that user. So, what I tried to do is 
  shell_exec(sudo -s; reboot;); but that didn't work, I also tried 
  other numerous variations all of which didn't work (also using exec(), 
  system(), passthru()  ). If any one has any ideas how i can do this, 
  please let me know. Thanks
 
 I believe this has been answered quite recently and the large consensus was
 to have a daemon (cron or otherwise) check for some status file or database
 entry, which when set it would perform the required function. So for
 instance to reboot the machine, perhaps a cron job would check for the
 existence of /tmp/myFrontEnd/reboot and if found reboot the machine. Thus
 the front end would only need to create the file.
 
 HTH,
 Rob.
 -- 
 ..
 | InterJinn Application Framework - http://www.interjinn.com |
 ::
 | An application and templating framework for PHP. Boasting  | a 
 | powerful, scalable system for accessing system services  | such as 
 | forms, properties, sessions, and caches. InterJinn |
 | also provides an extremely flexible architecture for   |
 | creating re-usable components quickly and easily.  |
 `'
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] Trouble sending an image's contents as output using header Content-Type...

2003-11-09 Thread Manuel Vázquez Acosta
Hi all:

I have a page with a img tag:
img src=/getthumbnail.php?fileid=12230983

The script getthumbnail.php searchs for a thumbnail of the specified image
id; if not thumbnail exists, the script creates one; and then using
readfile() and header() functions flushes it contents to the browser. But it
fails.

The code is very simple:

header('Content-Type: image/jpeg');// I'm testing with JPEGs

// If the thumbnails exists (or it gets generated this time)
if ($path = _generateThumbnail($_GET['fileid']))
@readfile($path);
else
@readfile(GENERIC_THUMBNAIL);// A constant to a generic icon



Any tips?
Manu.

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



RE: [PHP] Trouble sending an image's contents as output using hea der Content-Type...

2003-11-09 Thread Martin Towell
Maybe there's an error with _generateThumbnail() ?
Do you know for certain that _generateThumbnail() works okay ?

Martin

-Original Message-

Hi all:

I have a page with a img tag:
img src=/getthumbnail.php?fileid=12230983

The script getthumbnail.php searchs for a thumbnail of the specified image
id; if not thumbnail exists, the script creates one; and then using
readfile() and header() functions flushes it contents to the browser. But it
fails.

The code is very simple:

header('Content-Type: image/jpeg');// I'm testing with JPEGs

// If the thumbnails exists (or it gets generated this time)
if ($path = _generateThumbnail($_GET['fileid']))
@readfile($path);
else
@readfile(GENERIC_THUMBNAIL);// A constant to a generic icon

Any tips?
Manu.

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



Re: [PHP] Trouble sending an image's contents as output using header Content-Type...

2003-11-09 Thread Manuel Vázquez Acosta
 Maybe there's an error with _generateThumbnail() ?
 Do you know for certain that _generateThumbnail() works okay ?

 Martin


I do; it works correctly, the returned path exists. I also tested sending
the Content-Length header and it didn't work either.

Manu.

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



RE: [PHP] Solutions for 1970 epoch date restriction

2003-11-09 Thread Javier Muniz
If you can't change your database for some reason, for instance if it's a
legacy system or other large systems rely on that table format, look into
PEAR's Date class, it can probably help you out.

-Javier

-Original Message-
From: David Otton [mailto:[EMAIL PROTECTED] 
Sent: Sunday, November 09, 2003 4:00 PM
To: YC Nyon
Cc: php
Subject: Re: [PHP] Solutions for 1970 epoch date restriction


On Mon, 10 Nov 2003 01:41:15 +0800, you wrote:

I have a table that includes 3 columns for day, month and year. 
Example: Day, Month, Year 11,Jan, 1974
4,Sep, 1921

That would be your problem - you should be using your database's native date
type.

I need to construct a query where users can specify a starting date. 
Currently, I stuck in mktime function became of the 1970 epoch problem. 
It gives an error for dates before 1970. Anyone has  a solution?

[assumes mysql]

http://www.mysql.com/doc/en/Date_and_time_types.html

SELECT * FROM table WHERE start_date  '1969-08-25';

[for anyone who's interested, Raymond Chen's excellent journal had a short
article on various Windows timestamps:
http://blogs.gotdotnet.com/raymondc/permalink.aspx/99c54993-5c5e-45b9-95c1-c
20a0526ce0b]

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

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



RE: [PHP] Executing shell commands

2003-11-09 Thread Javier Muniz
I realize that, just didn't want to suggest that /tmp was a good solution
instead of a database.  The question is always about security, btw ;)

-Javier

-Original Message-
From: Robert Cummings [mailto:[EMAIL PROTECTED] 
Sent: Sunday, November 09, 2003 5:54 PM
To: Javier Muniz
Cc: Teren; PHP-General
Subject: RE: [PHP] Executing shell commands


I did mention database as one of the solutions. The question wasn't about
security so I didn't elaborate.

Cheers,
Rob.

On Sun, 2003-11-09 at 16:45, Javier Muniz wrote:
 Ack! No no no no no! At least put something this critical in a 
 password protected database, not a place that could possibly be 
 written to by a malicious user that gains access to an easily-writable 
 directory like /tmp, the DoS and security ramifications of having a 
 system like this are huge. Be exceptionally careful, and never pretend 
 that /tmp is a safe place for data.  If something is being read from 
 /tmp then it should be treated the same way user-inputted data is, and 
 never trusted.
 
 -Javier
 
 -Original Message-
 From: Robert Cummings [mailto:[EMAIL PROTECTED]
 Sent: Sunday, November 09, 2003 12:47 AM
 To: Teren
 Cc: PHP-General
 Subject: Re: [PHP] Executing shell commands
 
 
 On Sun, 2003-11-09 at 03:41, Teren wrote:
 
  Hi, I'm trying to write a front end for something and I want to be
  able to execute shell commands. I tried all of the pre-written 
  functions and non of them would work. I setup a user that can sudo and 
  then i set apache to run as that user. So, what I tried to do is 
  shell_exec(sudo -s; reboot;); but that didn't work, I also tried 
  other numerous variations all of which didn't work (also using exec(), 
  system(), passthru()  ). If any one has any ideas how i can do this, 
  please let me know. Thanks
 
 I believe this has been answered quite recently and the large 
 consensus was to have a daemon (cron or otherwise) check for some 
 status file or database entry, which when set it would perform the 
 required function. So for instance to reboot the machine, perhaps a 
 cron job would check for the existence of /tmp/myFrontEnd/reboot and 
 if found reboot the machine. Thus the front end would only need to 
 create the file.
 
 HTH,
 Rob.
 --
 ..
 | InterJinn Application Framework - http://www.interjinn.com |
 ::
 | An application and templating framework for PHP. Boasting  | a
 | powerful, scalable system for accessing system services  | such as 
 | forms, properties, sessions, and caches. InterJinn |
 | also provides an extremely flexible architecture for   |
 | creating re-usable components quickly and easily.  |
 `'
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  | a 
| powerful, scalable system for accessing system services  | such as 
| forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



RE: [PHP] Executing shell commands

2003-11-09 Thread Chris Shiflett
--- Robert Cummings [EMAIL PROTECTED] wrote:
 I did mention database as one of the solutions. The question wasn't
 about security so I didn't elaborate.

I have done this same thing in the past, because I tend to answer the
question asked and nothing more.

However, recently I have begun trying to not give suggestions or examples
that will create a security vulnerability, as well as warning about them
in the examples provided.

This is based on my belief that people don't always know what questions
they should be asking, combined with my belief that they likely use the
examples or suggestions we provide exactly as stated. As such, I think it
is our responsibility to educate.

I'm not sure if anyone agrees with me, but this is my philosophy.

Chris

=
My Blog
 http://shiflett.org/
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



php-general Digest 10 Nov 2003 05:34:23 -0000 Issue 2406

2003-11-09 Thread php-general-digest-help

php-general Digest 10 Nov 2003 05:34:23 - Issue 2406

Topics (messages 168992 through 169008):

Solutions for 1970 epoch date restriction
168992 by: YC Nyon
168994 by: John W. Holmes
168999 by: David Otton
169006 by: Javier Muniz

First test release of BTportal made
168993 by: Bas
169000 by: Paul
169001 by: Ryan A

Re: Beveled text
168995 by: Javier Muniz

Re: Executing shell commands
168996 by: Javier Muniz
169002 by: Robert Cummings
169007 by: Javier Muniz
169008 by: Chris Shiflett

Re: High bandwidth application tips
168997 by: dr. zoidberg

Re: DW Php update form where one field is menu from another table
168998 by: Robb Kerr

Trouble sending an image's contents as output using header Content-Type...
169003 by: Manuel Vázquez Acosta
169004 by: Martin Towell
169005 by: Manuel Vázquez Acosta

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]


--
---BeginMessage---
Hi,

I have a table that includes 3 columns for day, month and year. Example:
Day, Month, Year
11,Jan, 1974
4,Sep, 1921
...
...

I need to construct a query where users can specify a starting date.
Currently, I stuck in mktime function became of the 1970 epoch problem. It
gives an error for dates before 1970.
Anyone has  a solution?


Regards
Nyon
---End Message---
---BeginMessage---
YC Nyon wrote:
I have a table that includes 3 columns for day, month and year. Example:
Day, Month, Year
11,Jan, 1974
4,Sep, 1921
...
...
I need to construct a query where users can specify a starting date.
Currently, I stuck in mktime function became of the 1970 epoch problem. It
gives an error for dates before 1970.
Anyone has  a solution?
Why are you using three separate columns? What database are you using?

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

php|architect: The Magazine for PHP Professionals  www.phparch.com
---End Message---
---BeginMessage---
On Mon, 10 Nov 2003 01:41:15 +0800, you wrote:

I have a table that includes 3 columns for day, month and year. Example:
Day, Month, Year
11,Jan, 1974
4,Sep, 1921

That would be your problem - you should be using your database's native date
type.

I need to construct a query where users can specify a starting date.
Currently, I stuck in mktime function became of the 1970 epoch problem. It
gives an error for dates before 1970.
Anyone has  a solution?

[assumes mysql]

http://www.mysql.com/doc/en/Date_and_time_types.html

SELECT * FROM table WHERE start_date  '1969-08-25';

[for anyone who's interested, Raymond Chen's excellent journal had a short
article on various Windows timestamps:
http://blogs.gotdotnet.com/raymondc/permalink.aspx/99c54993-5c5e-45b9-95c1-c20a0526ce0b]
---End Message---
---BeginMessage---
If you can't change your database for some reason, for instance if it's a
legacy system or other large systems rely on that table format, look into
PEAR's Date class, it can probably help you out.

-Javier

-Original Message-
From: David Otton [mailto:[EMAIL PROTECTED] 
Sent: Sunday, November 09, 2003 4:00 PM
To: YC Nyon
Cc: php
Subject: Re: [PHP] Solutions for 1970 epoch date restriction


On Mon, 10 Nov 2003 01:41:15 +0800, you wrote:

I have a table that includes 3 columns for day, month and year. 
Example: Day, Month, Year 11,Jan, 1974
4,Sep, 1921

That would be your problem - you should be using your database's native date
type.

I need to construct a query where users can specify a starting date. 
Currently, I stuck in mktime function became of the 1970 epoch problem. 
It gives an error for dates before 1970. Anyone has  a solution?

[assumes mysql]

http://www.mysql.com/doc/en/Date_and_time_types.html

SELECT * FROM table WHERE start_date  '1969-08-25';

[for anyone who's interested, Raymond Chen's excellent journal had a short
article on various Windows timestamps:
http://blogs.gotdotnet.com/raymondc/permalink.aspx/99c54993-5c5e-45b9-95c1-c
20a0526ce0b]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
---End Message---
---BeginMessage---
It's avaiable on:

http://members.home.nl/famde.jong/portalBT-0.0.1.zip

If you have any comments, post a reply.

If you find it is very easy, it is. That is why it is version 0.0.1

Okay, it is not that good, but please try it... There is even an install
script in it!!
---End Message---
---BeginMessage---
You might consider creating your own lists to make releases and leave
php-list alone.
Imagine what it will happen if everybody will post their releases on the
list.
Cheers!
Paul


-Original Message-
From: Bas [mailto:[EMAIL PROTECTED]
Sent: Sunday, November 09, 2003 6:18 PM
To: [EMAIL PROTECTED]

RE: [PHP] Executing shell commands

2003-11-09 Thread Robert Cummings
On Mon, 2003-11-10 at 00:34, Chris Shiflett wrote:
 --- Robert Cummings [EMAIL PROTECTED] wrote:
  I did mention database as one of the solutions. The question wasn't
  about security so I didn't elaborate.
 
 I have done this same thing in the past, because I tend to answer the
 question asked and nothing more.
 
 However, recently I have begun trying to not give suggestions or examples
 that will create a security vulnerability, as well as warning about them
 in the examples provided.
 
 This is based on my belief that people don't always know what questions
 they should be asking, combined with my belief that they likely use the
 examples or suggestions we provide exactly as stated. As such, I think it
 is our responsibility to educate.
 
 I'm not sure if anyone agrees with me, but this is my philosophy.

All good points; I'd just like to point out though that the file system
is a viable method, though it does require the directories be set up
with proper ownerships and permissions. That said, yeah the /tmp
directory probably wasn't the best choice for the example :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] First test release of BTportal made!!!!

2003-11-09 Thread Bas
Possibillity to create articles(with using a password)
Ability for every user to reply to articles
Module based(PHP File Links included)
And a install script.

Ryan A [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Whats it about?
 Can you give me a list of features?

 Cheers,
 -Ryan

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