RE: [PHP] Pulling information out of a MySQL database

2001-11-25 Thread Tim Thorburn

Thanks to everyone for their help - especially Martin, that fixed my 
problem and now all the records (both basic and extended) display properly.

I did have one last aesthetic question ... I have one field set as TEXT 
which holds descriptions of the events.  When the information was entered 
into this field, in many cases, spaces between lines were entered ... 
however, when I pull the info from the database onto the webpage ... all my 
line formatting is erased and its just one continuous line of text.  Is 
there a way to maintain my line formatting with spaces?

Its not mission critical or anything ... just one of those things that 
would be nice.

Thanks again
-Tim



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Reading the value of a serialize object in session

2001-11-25 Thread py

Hello,

How do you read back the value of a serialize object that you put into a
session variable?

My exemple:

page1.php
---
session_start();

include( "myObject.php" );

$o = new myObject();
$o->load_variable( "100", www.domain.com);
$o = serialize( $o );

session_register( "o" );
Header("Location:page2.php");
exit;


page2.php
---
session_start();
include( "myObject.php" );

print $HTTP_SESSION_VARS['o'];// prints the line ok

print "". $o->var1;  // nothing...
print "". $o->var2;

It does not work event when I do $o = unserialize( $o ) before displaying..

py



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: failure notice

2001-11-25 Thread Joelmon2001

For those running php 4 on raq 3, how did you compile freetype?

./configure
make 
make install

or just 2 make's?

Just curious




Re: [PHP] Installing PHP 4 on a RAQ3

2001-11-25 Thread Steve Werby

"Miles Thompson" <[EMAIL PROTECTED]> wrote:
> You mentioned .pkg files, might Cobalt be using a Debian distribution? Log
> in and try executing dpkg or dselect -- it could be that Cobalt have the
> installation pointing only to their server. If so, go to the Debian web
> site and locate some additional servers.

Cobalt (which became a division of Sun earlier this year) runs a modified
Redhat distribution.  The RaQ4 runs 6.2, RaQ2 runs 5.2 and I'm not sure on
the RaQ3, but I believe it's 6.1 (again, a modified version, not the full
standard version).  The pkg file is not a Debian format.  Instead of
searching the PHP archives I'd recommend searching the cobalt-users archives
and joining the cobalt-users list.  The AIMS Group site has a searchable
archive of the list.  Instructions, hints and tips have been posted there
many times.  I've installed PHP countless times on dozens of Cobalt boxes so
it definitely can be done.

--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Pulling information out of a MySQL database

2001-11-25 Thread Martin Towell

If "id" is unique, you can change the first sql from:

$result = mysql_query("SELECT *, DATE_FORMAT(EventStartDate, '%W %M %D %Y') 
AS FormattedEventStartDate, DATE_FORMAT(EventEndDate, '%W %M %D %Y') AS 
FormattedEventEndDate, TIME_FORMAT(EventStartTime, '%r') AS 
FormattedEventStartTime, TIME_FORMAT(EventEndTime, '%r') AS 
FormattedEventEndTime FROM comcal WHERE id=$id and EventMonth='".$month."' 
and EventYear='".$year."'",$db);

to:

$result = mysql_query("SELECT *, DATE_FORMAT(EventStartDate, '%W %M %D %Y') 
AS FormattedEventStartDate, DATE_FORMAT(EventEndDate, '%W %M %D %Y') AS 
FormattedEventEndDate, TIME_FORMAT(EventStartTime, '%r') AS 
FormattedEventStartTime, TIME_FORMAT(EventEndTime, '%r') AS 
FormattedEventEndTime FROM comcal WHERE id=$id",$db);

in other words: remove the "month" and "year" from the where clause

Martin


-Original Message-
From: Tim Thorburn [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 26, 2001 3:58 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Pulling information out of a MySQL database


Hi again,

Ok, I've heard some suggestions to my problem ... but I'm not entirely 
certain how to incorporate them, perhaps taking a look at the code would be 
helpful.

Again, the problem I'm having is as follows.  I have a simple form in which 
the user selects a month and year from two drop down menu's - based on 
their choice, the following PHP script searches a MySQL database and 
displays a basic listing (event name and date) for the selected 
month.  Then the user has the option to click an event name and receive a 
more detailed listing of the event - this is the portion that isn't working.

It seems that the script is forgetting the values entered by the user - I 
have come to this conclusion as when I replaced ".$month." and ".$year." 
with an actual month and year ie. 'November' and '2001' respectively, the 
detailed display works perfectly.

How can I get both the basic and detailed event listings working at the 
same time?

Thanks
-Tim


";
   echo "";
 echo "Event: ";
 echo "";
echo ($myrow["EventName"]);
echo "";
   echo "";
   echo "";
 echo "Location: ";
echo "".($myrow["EventLocation"])."";
   echo "";
   echo "";
echo "City: ";
echo "".($myrow["EventCity"]).", 
".($myrow["EventState"])."";
   echo "";
   echo "";
 echo "Time: ";
echo "".($myrow["FormattedEventStartTime"])."";
   echo "";
   echo "";
 echo "Date: ";
echo "".($myrow["FormattedEventStartDate"])."";
   echo "";
   echo "";
echo "Contact Person(s):
";
 echo "".($myrow["EventC1FN"])." 
".($myrow["EventC1LN"])."".($myrow["EventC2FN"])." 
".($myrow["EventC2LN"])."";
   echo "";
   echo "";
 echo "Phone: ";
 echo "".($myrow["EventC1ACPhone"]).".".($myrow["EventC1ExcPhone"]).".
".($myrow["EventC1ExtPhone"])." 
";
echo 
"".($myrow["EventC2ACPhone"]).".".($myrow["EventC2ExcPhone"]).".".($myro
w["EventC2ExtPhone"])." 
";
echo "";
   echo "";
   echo "";
echo "Fax: ";
 echo "".($myrow["EventACFax"]).".".($myrow["EventExcFax"]).".".($myro
w["EventExtFax"])."";
   echo "";
   echo "";
echo "Cell: ";
 echo "".($myrow["EventACCell"]).".".($myrow["EventExcCell"]).".".($my
row["EventExtCell"])."";
   echo "";
   echo "";
echo "Email:
";
 echo "".($myrow["EventEmail"])."
";
   echo "";
   echo "";
echo "Web: ";
 echo "".($myrow["EventWeb"])."";
   echo "";
   echo "";
echo "Description:
";
 echo "".($myrow["EventDescription"])."";
   echo "";
   echo "";
echo "Cost: ";
 echo "".($myrow["EventCost"])."";
   echo "";
   echo "";
 echo "";
 echo " ";
   echo "";
   echo "";
 echo "";
 echo " ";
   echo "";
 echo "";


} else {

//display basic information from user input form

$result = mysql_query("SELECT *, DATE_FORMAT(EventStartDate, '%W %M %D 
%Y') AS FormattedEventStartDate, TIME_FORMAT(EventStartTime, '%r') AS 
FormattedEventStartTime FROM comcal WHERE EventMonth='".$month."' and 
EventYear='".$year."' ORDER BY EventStartDate",$db);

 if ($myrow = mysql_fetch_array($result)) {

  echo "";


   do {
echo "";
echo "";
echo "";
echo ($myrow["EventName"]);
echo "";
echo "";
   

Re: [PHP] Pulling information out of a MySQL database

2001-11-25 Thread Tim Thorburn

Hi again,

Ok, I've heard some suggestions to my problem ... but I'm not entirely 
certain how to incorporate them, perhaps taking a look at the code would be 
helpful.

Again, the problem I'm having is as follows.  I have a simple form in which 
the user selects a month and year from two drop down menu's - based on 
their choice, the following PHP script searches a MySQL database and 
displays a basic listing (event name and date) for the selected 
month.  Then the user has the option to click an event name and receive a 
more detailed listing of the event - this is the portion that isn't working.

It seems that the script is forgetting the values entered by the user - I 
have come to this conclusion as when I replaced ".$month." and ".$year." 
with an actual month and year ie. 'November' and '2001' respectively, the 
detailed display works perfectly.

How can I get both the basic and detailed event listings working at the 
same time?

Thanks
-Tim


";
   echo "";
 echo "Event: ";
 echo "";
echo ($myrow["EventName"]);
echo "";
   echo "";
   echo "";
 echo "Location: ";
echo "".($myrow["EventLocation"])."";
   echo "";
   echo "";
echo "City: ";
echo "".($myrow["EventCity"]).", 
".($myrow["EventState"])."";
   echo "";
   echo "";
 echo "Time: ";
echo "".($myrow["FormattedEventStartTime"])."";
   echo "";
   echo "";
 echo "Date: ";
echo "".($myrow["FormattedEventStartDate"])."";
   echo "";
   echo "";
echo "Contact Person(s): ";
 echo "".($myrow["EventC1FN"])." 
".($myrow["EventC1LN"])."".($myrow["EventC2FN"])." 
".($myrow["EventC2LN"])."";
   echo "";
   echo "";
 echo "Phone: ";
 echo "".($myrow["EventC1ACPhone"]).".".($myrow["EventC1ExcPhone"]).".".($myrow["EventC1ExtPhone"])."
 
";
echo 
"".($myrow["EventC2ACPhone"]).".".($myrow["EventC2ExcPhone"]).".".($myrow["EventC2ExtPhone"])."
 
";
echo "";
   echo "";
   echo "";
echo "Fax: ";
 echo "".($myrow["EventACFax"]).".".($myrow["EventExcFax"]).".".($myrow["EventExtFax"])."";
   echo "";
   echo "";
echo "Cell: ";
 echo "".($myrow["EventACCell"]).".".($myrow["EventExcCell"]).".".($myrow["EventExtCell"])."";
   echo "";
   echo "";
echo "Email: ";
 echo "".($myrow["EventEmail"])."";
   echo "";
   echo "";
echo "Web: ";
 echo "".($myrow["EventWeb"])."";
   echo "";
   echo "";
echo "Description: ";
 echo "".($myrow["EventDescription"])."";
   echo "";
   echo "";
echo "Cost: ";
 echo "".($myrow["EventCost"])."";
   echo "";
   echo "";
 echo "";
 echo " ";
   echo "";
   echo "";
 echo "";
 echo " ";
   echo "";
 echo "";


} else {

//display basic information from user input form

$result = mysql_query("SELECT *, DATE_FORMAT(EventStartDate, '%W %M %D 
%Y') AS FormattedEventStartDate, TIME_FORMAT(EventStartTime, '%r') AS 
FormattedEventStartTime FROM comcal WHERE EventMonth='".$month."' and 
EventYear='".$year."' ORDER BY EventStartDate",$db);

 if ($myrow = mysql_fetch_array($result)) {

  echo "";


   do {
echo "";
echo "";
echo "";
echo ($myrow["EventName"]);
echo "";
echo "";
echo "";
echo "";
echo ($myrow["FormattedEventStartDate"]);
echo "";
echo "";
echo "";

   } while ($myrow = mysql_fetch_array($result));
echo "";
 } else {

   // no records to display

   echo "Sorry, there are no events scheduled for this month";  

 }

}

?> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] >>>ADVERTISE TO 11,759,000 PEOPLE FREE!

2001-11-25 Thread FreeEmailSoftware1

Dear [EMAIL PROTECTED],

  
 ***
 Would you like to send an Email Advertisement to
   OVER 11 MILLION PEOPLE DAILY for FREE?
 ***
 
Do you have a product or service to sell?
Do you want an extra 100 orders per week?

NOTE: (If you do not already have a product or service to sell, we can 
supply you with one).

=
1) Let's say you... Sell a $24.95 PRODUCT or SERVICE.
2) Let's say you... Broadcast Email to only 500,000 PEOPLE.
3) Let's say you... Receive JUST 1 ORDER for EVERY 2,500 EMAILS.

CALCULATION OF YOUR EARNINGS BASED ON THE ABOVE STATISTICS:

[Day 1]: $4,990  [Week 1]: $34,930  [Month 1]: $139,720


To find out more information, Do not respond by email. Instead, Please 
visit our web site at: 

http://www.bigcashtoday.com/package1.htm



List Removal Instructions:
We hope you enjoyed receiving this message. However, if you'd rather 
not receive future e-mails of this sort from Internet Specialists, send an
email to [EMAIL PROTECTED] and type "remove" in the 
"subject" line and you will be removed from any future mailings.

We hope you have a great day!
Internet Specialists


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Pulling information out of a MySQL database

2001-11-25 Thread David Robley

On Mon, 26 Nov 2001 13:17, Tim Thorburn wrote:
> Hi,
> I'm having some new troubles pulling information out of a MySQL
> database. The page I'm currently working on has a simple form, that
> asks the user to select a month and year from two dropdown menu's then
> forwards their choices on to a new page which displays community events
> for the chosen month and year. This all works great.
>
> However, this new page that displays the community events along with
> their date allows the user to click on the name of the event for a more
> detailed list (location, time, description, etc) - this is the part
> that isn't working. The problem seems to be that the script forgets the
> previously chosen month and year when it goes to display the event in
> greater detail.
>
> How can I get the script to remember the month and year so it will
> display the proper information? My immediate thought is a cookie, but I
> have no idea how to do this ... can anyone offer any other suggestions,
> or if a cookie is the way to go - can someone point me in the right
> direction?
>
> The site is hosted on a Sun Solaris box with PHP 3.0.16 and MySQL
> 3.23.31
>
> Thanks


Presumably each event will have a unique ID? Then pass that ID as part of 
the URL on the link for the detailed information, and use the ID to 
select the detailed information.

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   A cat is the universe's way of showing us perfection.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] GD, PNG

2001-11-25 Thread Joseph Blythe

thats right just untar somewhere, when you do the make install it should
create the directory /usr/local/freetype2 for you, it is a bit of a strange
one they also made it to use jam which is another make file system, I don't
know whats wrong with the old ./configure, make, make install at least it is
a standard :)

Good luck with the install.

Regards,

Joseph

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, 26 November 2001 9:11 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] GD, PNG


Interesting. Thanks

So after untar, I will use that sequence you typed

I presume I can untar and do that
or need to rename folder to freetype 2
go in, and then the process you stated?

It's funny how freetype throws me off but I am confident
in installing gd and everything else. It's like the sun
, without it, everything else falls apart

Thanks
Joel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Pulling information out of a MySQL database

2001-11-25 Thread Duncan Hill

On Sun, 25 Nov 2001, Tim Thorburn wrote:

> the proper information? My immediate thought is a cookie, but I have no 
> idea how to do this ... can anyone offer any other suggestions, or if a 
> cookie is the way to go - can someone point me in the right direction?

Hidden form variable, assign the previous values.

-- 

Sapere aude
My mind not only wanders, it sometimes leaves completely.
Never attribute to malice that which can be adequately explained by stupidity.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Pulling information out of a MySQL database

2001-11-25 Thread Tim Thorburn

Hi,
I'm having some new troubles pulling information out of a MySQL database. 
The page I'm currently working on has a simple form, that asks the user to 
select a month and year from two dropdown menu's then forwards their 
choices on to a new page which displays community events for the chosen 
month and year. This all works great.

However, this new page that displays the community events along with their 
date allows the user to click on the name of the event for a more detailed 
list (location, time, description, etc) - this is the part that isn't working.
The problem seems to be that the script forgets the previously chosen month 
and year when it goes to display the event in greater detail.

How can I get the script to remember the month and year so it will display 
the proper information? My immediate thought is a cookie, but I have no 
idea how to do this ... can anyone offer any other suggestions, or if a 
cookie is the way to go - can someone point me in the right direction?

The site is hosted on a Sun Solaris box with PHP 3.0.16 and MySQL 3.23.31

Thanks



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] ZIP Files?

2001-11-25 Thread Emiliano Marmonti




Hi people,
 
    I´m looking for alternatives in 
using zip files. Our users should upload into our server zipped files and we 
need to unzip this files and process it. I have read there is a library that 
could be used like an extension, but I´ve tried to use it from NT and don´t 
seems like the extension was added and when I try to use the commands PHP says 
that don´t recognoice the commands. In the other hand somebody has told me that 
PHP must be recompiled for using this library. Our platform is Windows NT but in 
the future could be Solaris.
 
    Anybody could send me your 
experience?
 
    Thanks in advance.
    
Emiliano

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


RE: [PHP] EXAMPLE: Redirect upon execution of script...

2001-11-25 Thread Jason G.

Doing this is very simple, although a pain in the rear...

For those of you that have any confusion on this issue, pay very close 
attention to this script.  It effectivly demonstrates how to deal with a 
form, and display intellegent errors WITHOUT any of that "...Please click 
your browsers back button..." crap.

Have a hidden field in your form - ACTION=SAVE
This will tell your script when to look for input.

Write your script like this

 0 then you are in UPDATE mode.  if ID == 0 then you are in INSERT 
MODE
$ID = intval($ID);

//The main reason that I use a switch instead of an IF is that you can 
break out at any time.
switch($ACTION) case 'SAVE':
{
 //Validate all fields here
 if(empty($field1)) $oErr->field1 = 'Required';
 if(empty($field2)) $oErr->field2 = 'Required';

 //If the variable $oErr is set, then break
 if(isset($oErr)) break;

 //We are okay, add slashes to all fields...
 $field1 = addslashes($field1);
 $field2 = addslashes($field2);

 if($ID)
 {   //UPDATE MODE
 $sQuery = "UPDATE table SET field1='field1', 
field2='field2 WHERE id=$ID";

 //Do the UPDATE query here (however you do that)
 }
 else
 {   //INSERT MODE
 $sQuery = "INSERT INTO table VALUES ('field1', 'field2');

 //Do the INSERT query here (however you do that)

 //Grab the newly inserted ID
 $ID = mysql_insery_id();
 }

 //We have success, Do the redirect here
 header("Location: http://www.yourdomain.com/nextscript.php?ID=$ID";);
 exit;
}

?>



   
  
  

  Field 1: field1)) echo($oErr->field1); ?>
  
  Field 2: field2)) echo($oErr->field2); ?>
  

   



**

At 06:24 PM 11/25/2001 +0100, Daniel Alsén wrote:
> > 2. User fills in a form, clicks "submit" which calls the same script,
> > passing itself the values. Depending on the value passed by the submit
> > button, the script processes the information (INSERT or UPDATE) and sets
> > $done = 1 if successful.
> >
> > The second scenario is easier to handle.
> > Call the same script, passing it $done, and depending on whether or not
> > $done is set you redirect.
> >
> > Juli Meloni has done an excellent tutorial on just this at
> > http://www.thickbook.com. look in the tutorials for something like "Form
> > With Error Message". You just have to adapt the logic to suit your needs.
>
>The second scenario is correct. I am actually already using the method in
>Melonis tutorial for error messages. But i can´t do a redirection that way
>since $done isn´t set until after the db INSERT. My if-statement for the
>header is at the top of the page (wich is the only place i can put it) and
>will never know if $done is set or not below.
>
>- Daniel
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Ojects and sessions

2001-11-25 Thread Greg Sidelinger

I'm trying to store some classes that I created in session variables.  I
want to test for the object at the beginning of each page and if it does
not exist I want to create it.
 
I have the class definitions in a separate file that is included before
session_start()
But when I try to access the object I get an error.
Here is what I am trying right now.  This is from an example in the
Docs.
 

 
Can some one please point me in the right direction on how to get
objects stored in my session vars.
 
Greg Sidelinger



[PHP] error on update

2001-11-25 Thread Peter Lavender

Hi everyone,

I'm connecting to a SQL SVR 2000 database and get an error that I haven't
been able to resolve.

The following code generates an error Incorrect syntax near 'longer'; SQL
state 3700 in SQLExecDirect

I read some where that it might be due to a reserved word in column names,
but this isn't the case.

Here is the code:

  print("QID: $qIDQuestion to be updated to: $updateQuest");
$updateQuest = cleanUpText($updateQuest);

$query = "update tbl_question ";
$query .= "set question = '$updateQuest' ";
$query .= "where questID = '$qID';";

print("Query= $query");

print("Cleaned up: $updateQuest");
$result = odbc_exec($conn, $updateQuest);
unset($updateQuest);

I can copy and paste the resultant SQL and execute it fine in the query
analyser.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] User access rights..

2001-11-25 Thread Kurt Lieber

On Sunday 25 November 2001 04:08 pm, Ali Pakkan wrote:

> And consider they are real users, then how will i tell Apache server to
> run as the user owning the file?

Using the PHP module, you can't.  Using PHP as a CGI, you can use something 
like cgiwrap to execute under the user's account

> Is it impossible for a real solution?

Again, search the archives.  This has all been discussed before.  Repeatedly.

--kurt

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] User access rights..

2001-11-25 Thread Ali Pakkan



I should explain a bit more in detail.. Actually, the users can have php
files. And these php files can access other users' stuff. 

And consider they are real users, then how will i tell Apache server to
run as the user owning the file?

Is it impossible for a real solution?


On Sun, 25 Nov 2001, Hank Marquardt wrote:

> > I want to keep their information on Mysql. That is,
> > if possible I don't want to create real system accounts.
> > 
> > The problem is... using PHP, they can open any file 
> > that is readable to nobody account (Apache user).. 
> > So it can read and even edit other users' files..
> > 
> These two statements seem at odds with each other (to me anyway) .. if
> you're completely managing the user 'virtually' within mysql you could
> manage all your permissions and access within the database with sessions
> and a user id ... if on the other hand you are creating accounts on the
> system just with a nologin shell, then you're in a pickle with no real
> solution ... if the 'nobody' group needs read permission then you're
> correct that most anyone can read anyone else's work ... you're only
> real option is to create some kind of wrapper script for accessing the
> files that checks the db perms first.
> 
> BTW, there are *lots* of ISPs offering shell access (and web accounts)
> out there where this is an issue ... the entire /home tree is 0755
> permed and user a can read/execute user b's stuff.   even a 0750
> doesn't fix it most of the time as the users share a common group ... I
> guess you could go with 0750, set uid=gid and then add 'nobody' to
> everyone's groups though ...
> 
> ... enough, I'm just thinking out loud now.
> 
> Hank
> 
> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] mailing list script?

2001-11-25 Thread David Robley

On Sat, 24 Nov 2001 03:33, Yura wrote:
> Hi,
>
> Thank you all for help, I figured out that fsockopen() is the same as
> telnet so I found command for telnet and now successfully apply them
> through fputs() Now all I have to do is to come back to beginnings and
> figure out how to separate message header and text and then temporary
> store it and then put it into database for future use.
>
> Thank you,
>
> Youri

http://www.w3.org/Protocols/rfc822/rfc822.txt
STANDARD FOR THE FORMAT OF ARPA INTERNET TEXT MESSAGES
-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   With friends like these, who needs to hallucinate?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] User access rights..

2001-11-25 Thread Hank Marquardt

> I want to keep their information on Mysql. That is,
> if possible I don't want to create real system accounts.
> 
> The problem is... using PHP, they can open any file 
> that is readable to nobody account (Apache user).. 
> So it can read and even edit other users' files..
> 
These two statements seem at odds with each other (to me anyway) .. if
you're completely managing the user 'virtually' within mysql you could
manage all your permissions and access within the database with sessions
and a user id ... if on the other hand you are creating accounts on the
system just with a nologin shell, then you're in a pickle with no real
solution ... if the 'nobody' group needs read permission then you're
correct that most anyone can read anyone else's work ... you're only
real option is to create some kind of wrapper script for accessing the
files that checks the db perms first.

BTW, there are *lots* of ISPs offering shell access (and web accounts)
out there where this is an issue ... the entire /home tree is 0755
permed and user a can read/execute user b's stuff.   even a 0750
doesn't fix it most of the time as the users share a common group ... I
guess you could go with 0750, set uid=gid and then add 'nobody' to
everyone's groups though ...

... enough, I'm just thinking out loud now.

Hank

-- 
Hank Marquardt <[EMAIL PROTECTED]>
http://web.yerpso.net
GPG Id: 2BB5E60C
Fingerprint: D807 61BC FD18 370A AC1D  3EDF 2BF9 8A2D 2BB5 E60C
*** Web Development: PHP, MySQL/PgSQL - Network Admin: Debian/FreeBSD
*** PHP Instructor - Intnl. Webmasters Assn./HTML Writers Guild 
*** Beginning PHP -- Starts January 7, 2002 
*** See http://www.hwg.org/services/classes

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Redirect upon execution of script...

2001-11-25 Thread Daniel Alsén

Thanks for all the help guys! I am sure i will solve this when i have a go
at it again :)

- Daniel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] User access rights..

2001-11-25 Thread Kurt Lieber

On Sunday 25 November 2001 03:30 pm, you wrote:
> The problem is... using PHP, they can open any file
> that is readable to nobody account (Apache user)..
> So it can read and even edit other users' files..
>
> Consquently, the users should be able to access only and only their home
> directories.

Short answer; you can't.

Long answer; if users have shell accounts, there is no way you can do what 
you're trying to do.  If you limit users to FTP access and PHP *only* (i.e. 
no telnet, ssh, custom CGI, Perl or other languages that can access the file 
system) then you can use PHP safe mode to at least protect PHP.

Read the Security chapter in the PHP manual.  (chapter 4, I believe)

This topic has been discussed extensively before on the list, so you may also 
want to search the list archives for more details.

--kurt

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] User access rights..

2001-11-25 Thread Ali Pakkan


Hello,

I have a machine which is running Php4 on Apache 1.3
And I want to make a hosting site that the users
can register themselves online. They will have a home
directory and so they will be able to put their web files
(html, php, images etc.) under there. 

I want to keep their information on Mysql. That is,
if possible I don't want to create real system accounts.
I'll do all this work (create user, its home etc) with PHP.
There is no problem at this point.

The problem is... using PHP, they can open any file 
that is readable to nobody account (Apache user).. 
So it can read and even edit other users' files..

Consquently, the users should be able to access only and only their home
directories. 

How can I do this?

Thanks in advance..

Ali Pakkan
E-mail: [EMAIL PROTECTED]
Gsm: +90542 3268742



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Creating $key, $value pairs

2001-11-25 Thread Hank Marquardt

OK, probably the easiest thing to do would be to add some kind of state
functionality to the loop and use different logic/regex stuff based on
where in the process you are ... first test each line for '/^SHIP TO/',
'/^BILL TO/' or /^ORDER NO./ ... that could set your 'state' for the
script, then you can process each line properly (and it would get around
the ':' in an order line problem as you wouldn't execute on that basis
... in my head anyway that would make the main loop into a case
construct:

switch($stateofscript) {
case SHIP:
$shippinginfo[$matches[1]] = $matches[2];
break;
case BILL:
$billinginfo[$matches[1]] = $matches[2];
break;
case ORDER:
// split your order lines
break;
default;
// must not have hit the SHIPPING INFO yet so do nothing
}

The other thing you'll need to fix is that you have the generic
'address' tag for 3 different lines in both shipping and billing ... so
the logic will need to include a if(isset($shippinginfo[$matches[1]]))
thing to prepend or postfix an integer or something onto the index to
keep the lines straight.

I'd say you're getting there though.

Hank


On Sun, Nov 25, 2001 at 02:06:52PM -0700, Ashley M. Kirchner wrote:
> Hank Marquardt wrote:
> 
> > Actually you're OK here (I think ...) if a few of them end up blank,
> > that's OK, just ignore them, you'll know the ones you want based on the
> > real email you receive ... as for the folks putting To: someone, From:
> > someone ... I wrote the regex to accomodate that ... it takes anything
> > up to the first ':' and claims that as the variable name, then discards
> > the ':' after and finally grabs the rest of the line (.*) as the
> > remainder ... that can include ':' without problem ... in fact if you
> > look at your example, it handles the first 'timestamp' field just fine:)
> 
> Yeap, I noticed that as soon as I ran the first (full) email through it.  And of 
>course, there're some problems.  The incoming email has two "sections" in it which 
>will contain the same variables.  What I posted only contained a 'BILL TO:' section.  
>The full email also contains a 'SHIP TO:' section.  But because the script creates 
>variables based on the fields in the email, it overwrites the first section:
> 
>   SHIP TO:
>   Business Name:
>   Contact Name: PhotoCraft
>   Day Number:   303.442.6410
>   Evening Number:
>   Fax Number:
>   Address:  3550 Arapahoe Ave
>   Address:  Suite 6
>   Address:
>   City: Boulder
>   State/Province:   CO
>   Zip/Postal Code:  80303
>   Country:  USA
> 
>   BILL TO:
>   Business Name:
>   Contact Name: Ashley M. Kirchner
>   Day Number:   800 555-1212
>   Evening Number:   303 555-1212
>   Fax Number:
>   Address:  3550 Arapahoe Ave #6
>   Address:
>   Address:
>   City: Boulder
>   State/Province:   CO
>   Zip/Postal Code:  80303
>   Country:  USA
> 
> This is part of why I asked whether it was possible to use my own variable 
>naming, so I could end up with one of:
> 
> $ShipToContact$BillToContact
> $ShipToDayPhone   $BillToDayPhone
> $ShipToEvePhone   $BillToEvePhone
> 
> or:
> 
> $ShipTo['contact']$BillTo['contact']
> $ShipTo['DayPhone']   $BillTo['dayphone']
> $ShipTo['EvePhone']   $BillTo['evephone']
> 
> 
> And then there's still the order items themselves.  Right now, the script is 
>cutting the lines because of the : matching.  So, a line like this (wrapping alert):
> 
> ORDER NO.  QTY  UNIT   DESCRIPTION   
>  PRICE  TOTAL
>  4x6 1  4"x6"  Standard Print (full-frame from 35mm) Image:Uploaded Image 1  
>  .75$0.75
> 
> ...will end up:
> 
> $key: 4x614x6StandardPrint(full-framefrom35mm)Image
> $val: 'Uploaded Image 1 .75 $0.75'
> 
> ORDER HERE:
> Item: 0
> Itemnum -> 4x6
> Quantity -> 1
> 
> 
> Not quite what it should be.  I think I'm going to limit where it should do the 
>$key -> $value matching, and figure something else out for the rest of the message.
> 
> 
> > the
> > whole thing would be a lot easier in the last one if they actually tab
> > delimit the fields, then a simple split() call would handle it nicely
> > but what you posted was spaces.
> 
> Yeah, the original incoming email is a mess really.  No tab delimited anything, 
>and some of the fields have extraneous spaces after each value, some just have a row 
>of spaces (if the value's blank), some 80 characters long.
> 
> --
> H | "Life is the art of drawing without an eraser." - John Gardner
>   +
>   Ashley M. Kirchner    .   303.442.6410 x130
>   Director of Internet Operations / SysAdmin. 800.441.3873 x130
>   Photo Craft Lab

[PHP] automatic serial/unserializing with sessions

2001-11-25 Thread Christian Dechery

Sessions do automatically serialize and unserialize it's variables?

How is it done??... is it via session_register() that calls serialize() ??
and then session_start() unserializes it all?

/* I'm just guessing here */

can someone explain me how does this work?

_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] GD, PNG

2001-11-25 Thread Joseph Blythe

Hmm, don't know much about raq3 but if it has GNU Make (ver 3.78.1 or newer)
it should compile with any Unix C compiler.

make setup CFG="--prefix=/usr/local/freetype2"
make
make install

Hope this helps, from memory it is a little fiddly sometimes hard to get GD
to see the freetype2 libs/includes, but if you get it compiled you should
have no problems.

Regards,

Joseph



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, 23 November 2001 5:04 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] GD, PNG


Hello, and thanks for your time, which I respect. I was reading your reply
on php list and I have one question if I may

*how* did you get freetype on your linux? I am on raq 3
nobody can confirm if a
untar
./configure
make
make install
will do it

just wondering if a linux guy can confirm this works
without freetype, I can't run php/gd library as I intend to and their list
support is pathetic

Thanks


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] HTTP_POST_VARS, forms, and not allowing modifications.

2001-11-25 Thread C. Bensend


On Mon, 26 Nov 2001, Martin Towell wrote:

> you said you tried a text field, have you tried a hidden field?

Alrighty then, my greenness shows.  :)

The hidden field idea was perfect (never used one before).
Thank god I'm just playing around with my _own_ site.  ;)

Thanks Martin!

Benny


~~
"The onions are irritating my buttocks."   - Sluggy Freelance
 10-12-1998



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] HTTP_POST_VARS, forms, and not allowing modifications.

2001-11-25 Thread Martin Towell

you said you tried a text field, have you tried a hidden field?

does it HAVE to be in $HTTP_POST_VARS ??  can you append it to whatever link
you have using "?unique_id=$id" or something similar?

Martin T

-Original Message-
From: C. Bensend [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 26, 2001 8:18 AM
To: [EMAIL PROTECTED]
Subject: [PHP] HTTP_POST_VARS, forms, and not allowing modifications.



Hey folks,

I am working on a database-driven site, and
have run into a problem.  It's not a problem with any
existing code, more of a "how the heck do I do this"
sort of thing.

I have a table, that is generated from a database
query:

+---+---++-+
| unique_id | some_text | some_more_text | edit button |
+---+---++-+

The unique_id is an integer, and the user can
NOT be allowed to modify it.  However, I need to pass
that value to the php script that's the ACTION for
the "edit button".

register_globals is not allowed, so somehow I
need to get the value of unique_id into the HTTP_POST_VARS
array.  I tried:

$HTTP_POST_VARS['unique_id'] = id;

but it was ignored.  I know I can make the unique_id
a TEXT input area, but then it can be modified.  I did some
searching around for more information about what can and can
not be done with HTTP_POST_VARS, but I didn't find anything
helpful (I could have been looking in the wrong place, too).

Anyone have some Wise Tips(tm) for me?  Any help
would be greatly appreciated.  :)

Benny


~~
"The onions are irritating my buttocks."   - Sluggy Freelance
 10-12-1998



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



[PHP] detecting objects

2001-11-25 Thread Christian Dechery

I'm trying to build serializeAll() and unserializeAll() type functions...

but how can I tell from $HTTP_SESSION_VARS which of those vars are 
serialized objects so I can unserialize them?

_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] HTTP_POST_VARS, forms, and not allowing modifications.

2001-11-25 Thread C. Bensend


Hey folks,

I am working on a database-driven site, and
have run into a problem.  It's not a problem with any
existing code, more of a "how the heck do I do this"
sort of thing.

I have a table, that is generated from a database
query:

+---+---++-+
| unique_id | some_text | some_more_text | edit button |
+---+---++-+

The unique_id is an integer, and the user can
NOT be allowed to modify it.  However, I need to pass
that value to the php script that's the ACTION for
the "edit button".

register_globals is not allowed, so somehow I
need to get the value of unique_id into the HTTP_POST_VARS
array.  I tried:

$HTTP_POST_VARS['unique_id'] = id;

but it was ignored.  I know I can make the unique_id
a TEXT input area, but then it can be modified.  I did some
searching around for more information about what can and can
not be done with HTTP_POST_VARS, but I didn't find anything
helpful (I could have been looking in the wrong place, too).

Anyone have some Wise Tips(tm) for me?  Any help
would be greatly appreciated.  :)

Benny


~~
"The onions are irritating my buttocks."   - Sluggy Freelance
 10-12-1998



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Creating $key, $value pairs

2001-11-25 Thread Ashley M. Kirchner

Hank Marquardt wrote:

> Actually you're OK here (I think ...) if a few of them end up blank,
> that's OK, just ignore them, you'll know the ones you want based on the
> real email you receive ... as for the folks putting To: someone, From:
> someone ... I wrote the regex to accomodate that ... it takes anything
> up to the first ':' and claims that as the variable name, then discards
> the ':' after and finally grabs the rest of the line (.*) as the
> remainder ... that can include ':' without problem ... in fact if you
> look at your example, it handles the first 'timestamp' field just fine:)

Yeap, I noticed that as soon as I ran the first (full) email through it.  And of 
course, there're some problems.  The incoming email has two "sections" in it which 
will contain the same variables.  What I posted only contained a 'BILL TO:' section.  
The full email also contains a 'SHIP TO:' section.  But because the script creates 
variables based on the fields in the email, it overwrites the first section:

  SHIP TO:
  Business Name:
  Contact Name: PhotoCraft
  Day Number:   303.442.6410
  Evening Number:
  Fax Number:
  Address:  3550 Arapahoe Ave
  Address:  Suite 6
  Address:
  City: Boulder
  State/Province:   CO
  Zip/Postal Code:  80303
  Country:  USA

  BILL TO:
  Business Name:
  Contact Name: Ashley M. Kirchner
  Day Number:   800 555-1212
  Evening Number:   303 555-1212
  Fax Number:
  Address:  3550 Arapahoe Ave #6
  Address:
  Address:
  City: Boulder
  State/Province:   CO
  Zip/Postal Code:  80303
  Country:  USA

This is part of why I asked whether it was possible to use my own variable naming, 
so I could end up with one of:

$ShipToContact$BillToContact
$ShipToDayPhone   $BillToDayPhone
$ShipToEvePhone   $BillToEvePhone

or:

$ShipTo['contact']$BillTo['contact']
$ShipTo['DayPhone']   $BillTo['dayphone']
$ShipTo['EvePhone']   $BillTo['evephone']


And then there's still the order items themselves.  Right now, the script is 
cutting the lines because of the : matching.  So, a line like this (wrapping alert):

ORDER NO.  QTY  UNIT   DESCRIPTION 
PRICE  TOTAL
 4x6 1  4"x6"  Standard Print (full-frame from 35mm) Image:Uploaded Image 1
.75$0.75

...will end up:

$key: 4x614x6StandardPrint(full-framefrom35mm)Image
$val: 'Uploaded Image 1 .75 $0.75'

ORDER HERE:
Item: 0
Itemnum -> 4x6
Quantity -> 1


Not quite what it should be.  I think I'm going to limit where it should do the 
$key -> $value matching, and figure something else out for the rest of the message.


> the
> whole thing would be a lot easier in the last one if they actually tab
> delimit the fields, then a simple split() call would handle it nicely
> but what you posted was spaces.

Yeah, the original incoming email is a mess really.  No tab delimited anything, 
and some of the fields have extraneous spaces after each value, some just have a row 
of spaces (if the value's blank), some 80 characters long.

--
H | "Life is the art of drawing without an eraser." - John Gardner
  +
  Ashley M. Kirchner    .   303.442.6410 x130
  Director of Internet Operations / SysAdmin. 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, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Classes

2001-11-25 Thread Christopher William Wesley

On Sun, 25 Nov 2001, Miles Thompson wrote:

> Not such a useless explanation at all, in fact a damned good one. Tight &
> concise, and you immediately related the functions to code examples, along
> with an easy-to-visualize object, the chair.

Sweet ... I'm glad you found it useful!  TY

> 1. Why is a constructor class needed? My OO background is Visual FoxPro,
> and all it requires is a declaration of  the class, it' methods and properties.

It's not actually required.  It's good practice, however.  With the
constructor, a chair effectively defaults to a stool (minimal chair, 3
legs, no arms)  when a chair is created w/o any arguments ($myChair = new
chair;).  It'd be silly to make a chair with no legs[1] or 1 or 2 legs.
In many cases, it'd be silly to create an object without some default
attributes set, or giving the programmer the ability to set attributes at
creation time ($myChair = new chair( 4, 2 ); // a nice chair).  If you
have an object that won't need any initial attention when it's created,
feel free to drop the constructor.  (I don't recommend that ... I just
create an empty one ... out of habbit/practice.)

> 2. Are the chairs properties exposed, or are they private? You use
> functions to both set and retrieve them, which implies that they are
> private.  Even so, PHP's syntax is much cleaner than the tortured syntax
> used in VB.

In PHP the chair's properties are exposed.  There's no sense of public vs.
private data members or methods w/ PHP.  Everything is public[2].  I could
effectively get the chair's number of legs by referencing
$myChair->num_legs.  Using object methods to get and set object data
members is just a matter of good practice too.  I come from a C++
background and developed rigid practices of protecting as much as possible
about objects, and not allowing the programmer (usually myself) muck with
objects' data members, or call its internal methods.  It forces me to
tightly define classes, and make them as useful as possible.  

[1] Maybe a chair is inherited from a seat, like a mat or a swing, which
can have no legs :)

[2] This is why I recommended [to the original poster] learning a real OO
language.  There are large differences between classes in PHP and classes
in C++ or Java.  Learning those first would enable a person to understand
PHP classes easily.  Learning PHP classes wouldn't help much in
understanding classes in C++ or Java.  If classes in PHP were to one day
become like C++ classes, everyone who only knew PHP classes would have to
re-learn what a PHP class is.  That's not bad, per se, but is something to
consider.

~Chris   /"\
 \ / September 11, 2001
  X  We Are All New Yorkers
 / \ rm -rf /bin/laden

> At 03:28 AM 11/25/2001 -0800, you wrote:
> >On Sun, 25 Nov 2001, Rudi Ahlers wrote:
> > > Can anyone explain classes to me please? On many sites have I seen classes,
> >
> >There are people earning PHD's while explaining classes.  I know your
> >question originates from using PHP, and this is a PHP general mailing list
> >... but your question is just a tad too general for this list.
> >
> > > I'm not sure how these work, or how to use them. I'm still learning about
> >
> >Classes aren't unique to PHP.  You need to learn a true object-oriented
> >programming language (C++, Java, ... etc.) to really learn classes.
> >Truly gifted individuals can learn object-oriented programming w/o too
> >much help, but they'd first have a firm grip on programming.  I'd expect
> >the average, novice programmer to need a good amount of help learning &
> >understanding objecte-oriented programming ...  like that attained from a
> >University, a good High School, or a lot of independent study and time
> >experimenting with code.
> >
> >That said ...
> >
> >You weren't completely missing the boat with your analogy of a class to a
> >variable, but in the same breath, that idea is totally missing the boat (I
> >can see from where you're coming, and to where you're headed).  Classes
> >are an IDEA.  They're not actually anything.  They're the definition of
> >private and public data members and methods that should make up an object.
> >When a class is instantiated, an object is created with the defined data
> >members and methods available.  You can then use the objects' methods to
> >set, get, alter, or otherwise interact with its data members, or to simply
> >perform a set of related operations.   >here.> That's my feeble attempt to explain classes.  It's abstract, I
> >know, and possibly not a help at all.  But it's because of the paragraph
> >above this one.
> >
> >Let's look at some petty code:
> >
> >class chair{
> > // DATA
> > var num_legs;
> > var color;
> > var num_arms;
> >
> > // METHODS
> > function chair( $legs = 3, $arms = 0 ){ //CONSTRUCTOR
> > 

Re: [PHP] Creating $key, $value pairs

2001-11-25 Thread Hank Marquardt

> Actually, some of those will end up being "blank", for example the 'BILL TO:' 
>line is always blank, I may not have all 3 lines of 'Address:' filled, etc., etc.  
>And there may be more lines that might end up blank when someone places an order.  
>And as you pointed out, some lines might have :'s elsewhere in it.  The 'Today's 
>Date:' line is one of those.  And nothing is going to stop anyone from doing 
>something like 'From: Santa, To: Rudolph' in the 'Gift Message:' field.  So I suppose 
>I need to look out for those, I just don't know who just yet.  (and considering how 
>much I *suck* at regexp matching, that's going to be rather tricky for me)
> 
Actually you're OK here (I think ...) if a few of them end up blank,
that's OK, just ignore them, you'll know the ones you want based on the
real email you receive ... as for the folks putting To: someone, From:
someone ... I wrote the regex to accomodate that ... it takes anything
up to the first ':' and claims that as the variable name, then discards
the ':' after and finally grabs the rest of the line (.*) as the
remainder ... that can include ':' without problem ... in fact if you
look at your example, it handles the first 'timestamp' field just fine:)

> Either way, thank you very much for your code.  It is a great start for what I 
>need done.  Thanks!
> 
You're welcome:) ... the regexs aren't that bad here, just picky; the
whole thing would be a lot easier in the last one if they actually tab
delimit the fields, then a simple split() call would handle it nicely
but what you posted was spaces.

Good luck

Hank

-- 
Hank Marquardt <[EMAIL PROTECTED]>
http://web.yerpso.net
GPG Id: 2BB5E60C
Fingerprint: D807 61BC FD18 370A AC1D  3EDF 2BF9 8A2D 2BB5 E60C
*** Web Development: PHP, MySQL/PgSQL - Network Admin: Debian/FreeBSD
*** PHP Instructor - Intnl. Webmasters Assn./HTML Writers Guild 
*** Beginning PHP -- Starts January 7, 2002 
*** See http://www.hwg.org/services/classes

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Installing PHP 4 on a RAQ3

2001-11-25 Thread Miles Thompson

Phil,

Can you telnet or SSH (using putty or Terr Term SSH) to the RAQ? If so, do 
it by hand, and the best set of instructions is the "Soothingly Seamless 
setup of Linux Apache MySQL and PHP." I'd give you the URL, but the 
Internet is so slow here right now that I can't find anything, so search 
for it on Google. I think it's located at DevShed or Web Monkey.

Doing it that way you can compile everything from source, and the 
instructions are very good. You can also get the compile and install 
instructions, along with the source for each, from Apache, MySQL and PHP. 
Cross check those with "Soothingly Seamless" to get what you specifically 
want and run your ./conf for each accordingly. If it takes a couple of 
kicks, no sweat.

You don't have to use the --with-mysql option, but I believe it assume 
/usr/local/mysql. I always install MySQL in a different spot than the 
standard, so I always use that parameter.

One quirk to watch out for is that I've had MySQL install to 
/usr/local/bin/mysql, and  then the installation script added another 
"/bin/mysql". I think that was a Red Hat box. All I'm say is to not make 
any assumptions.

Oh, best version? Current one, 4.0.6.

You mentioned .pkg files, might Cobalt be using a Debian distribution? Log 
in and try executing dpkg or dselect -- it could be that Cobalt have the 
installation pointing only to their server. If so, go to the Debian web 
site and locate some additional servers.

Have fun - Miles Thompson

At 04:56 PM 11/25/2001 +, Phil Ewington wrote:
>Hi,
>
>As I have only ever worked on a Windows platform, installing PHP & MySQL on
>a RAQ3 is completely alien to me. I attempted to install the binaries by
>following instructions I dug up somewhere, and it all went badly wrong :o(
>
>I have since had the RAQ reset so I could start again. This time round I
>installed the RaQ3-RaQ4-MySQL-3.23.37-1.pkg from cobalt, this went on OK,
>but now I need to install PHP. As there is no .pkg for the RAQ3, I have been
>advised that I do need to install the binaries for PHP 4. Do I need to give
>a path for the --with mysql option, and if so where does the .pkg install
>MySQL? Any idiot proof step by step instructions will be greatly
>appreciated, along with which is the best/most stable version of PHP 4?, and
>where is best to install it?
>
>Thanks in advance,
>
>Phil.
>
>-
>Phil Ewington
>Cold Fusion Developer
>-
>T: 01344 643138
>E: mailto:[EMAIL PROTECTED]
>-
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Creating $key, $value pairs

2001-11-25 Thread Ashley M. Kirchner

Hank Marquardt wrote:

> if you do have extraneous ':'s
> elsewhere in the message then you'll need to be a little more picky with
> your regex stuff to only pick out what you want -- for example, your
> post has a couple of sentences that end with ':' before an example ...
> the script as written picks those up as key value pairs, but since
> you'll unlikely have those in your order messages I figure you're on
> safe ground for now --

Actually, some of those will end up being "blank", for example the 'BILL TO:' line 
is always blank, I may not have all 3 lines of 'Address:' filled, etc., etc.  And 
there may be more lines that might end up blank when someone places an order.  And as 
you pointed out, some lines might have :'s elsewhere in it.  The 'Today's Date:' line 
is one of those.  And nothing is going to stop anyone from doing something like 'From: 
Santa, To: Rudolph' in the 'Gift Message:' field.  So I suppose I need to look out for 
those, I just don't know who just yet.  (and considering how much I *suck* at regexp 
matching, that's going to be rather tricky for me)


> Of course the really easy way to do this is just to process the form
> output directly then you have your key/values nice and neat in
> $HTTP_POST_VARS already:) ... but I'm assuming this is on and processed
> by a separate server, or with a canned script that only gens emails, so
> this is what you need to do.

I don't have control over that process.  I only receive the email once an order is 
placed.  The company that does the ordering and all of that good stuff has their own 
internal DB that they maintain.  A DB I don't have access to, so I'm stuck with having 
to re-invent the wheel.

Either way, thank you very much for your code.  It is a great start for what I 
need done.  Thanks!

AMK4

--
H | "Life is the art of drawing without an eraser." - John Gardner
  +
  Ashley M. Kirchner    .   303.442.6410 x130
  Director of Internet Operations / SysAdmin. 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, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Safely Storing & Delivering PDFs

2001-11-25 Thread Hank Marquardt

You need to store your PDFs outside the web tree and then access and
distribute them through a script that does the user authentication ...
in pseudo-code that would look like this:

Check Authentication
If !Auth ... send to login
Check for proper file request (name/id/whatever)
If !Proper ... send error
If AllOK
Open file requested
Send appropriate headers for filetype
Send appropriate headers for filename/inline/attachment
Send Data
Close file
Script End

Hank

On Sun, Nov 25, 2001 at 03:54:59PM -0400, Miles Thompson wrote:
> Sebastian,
> 
> I believe I have to do what you do, but from your cryptic msg I've not been 
> able to figure it out.
> 
> We have a subscription site, and if a subscriber wants a PDF, the link 
> which requests it checks for a session cookie. If it's not set the user is 
> directed to a logon script which checks username/password against a 
> database and sets the session cookie if everything is OK. It automatically 
> redirects to the calling script, and because the session id is now present 
> the PDF can be accessed.
> 
> To my horror, I discovered on Friday that if I just type in the URL with 
> the name of the PDF it's delivered with no checking at all. I have to move 
> them to a safe place, either outside the web tree or to a directory 
> protected by htaccess. This is where I'm stuck.
> 
> If I use .htaccess, I don't want to maintain a separate .htaccess file in 
> addition to the subscriber table in the database. Can I set have my logon 
> script set an Apache variable that will give access to the protected 
> directory which store the PDf's?
> 
> Or do they have to be passed? If so how?
> 
> Would that mean that I'd need only one or a few username/password pairs in 
> htaccess?
> or
> Is htaccess (or Apache's security) somehow satisfied by setting the 
> variables?
> 
> Regards - Miles Thompson
> 
> At 01:19 PM 10/19/2001 +0200, you wrote:
> >Hi George
> >
> >I had the same problem a while ago.
> >The only solution i found was to change the link to :
> >www.blabla.com/pdffile/test.pdf
> >test.pdf does not exist, but
> >in /pdffile/ there is a .htaccess which redirects the 404 to the php
> >script that reads/generates the pdfs. And for my purpose checks if user
> >is
> >authorized to get these files.
> >
> >sebastian
>  preserved.>
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- 
Hank Marquardt <[EMAIL PROTECTED]>
http://web.yerpso.net
GPG Id: 2BB5E60C
Fingerprint: D807 61BC FD18 370A AC1D  3EDF 2BF9 8A2D 2BB5 E60C
*** Web Development: PHP, MySQL/PgSQL - Network Admin: Debian/FreeBSD
*** PHP Instructor - Intnl. Webmasters Assn./HTML Writers Guild 
*** Beginning PHP -- Starts January 7, 2002 
*** See http://www.hwg.org/services/classes

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Safely Storing & Delivering PDFs

2001-11-25 Thread Mark Charette

If you have access to the Apache server why not set up auth-mysql as the
authentication method? It checks for authentication login/password pairs out
of MySQL.

mark C.

> -Original Message-
> From: Miles Thompson [mailto:[EMAIL PROTECTED]]
> Sebastian,
>
> I believe I have to do what you do, but from your cryptic msg
> I've not been
> able to figure it out.
>
> We have a subscription site, and if a subscriber wants a PDF, the link
> which requests it checks for a session cookie. If it's not set
> the user is
> directed to a logon script which checks username/password against a
> database and sets the session cookie if everything is OK. It
> automatically
> redirects to the calling script, and because the session id is
> now present
> the PDF can be accessed.
>
> To my horror, I discovered on Friday that if I just type in the URL with
> the name of the PDF it's delivered with no checking at all. I
> have to move
> them to a safe place, either outside the web tree or to a directory
> protected by htaccess. This is where I'm stuck.
>
> If I use .htaccess, I don't want to maintain a separate .htaccess file in
> addition to the subscriber table in the database. Can I set have my logon
> script set an Apache variable that will give access to the protected
> directory which store the PDf's?
>
> Or do they have to be passed? If so how?
>
> Would that mean that I'd need only one or a few username/password
> pairs in
> htaccess?
> or
> Is htaccess (or Apache's security) somehow satisfied by setting
> the variables?
>
> Regards - Miles Thompson
>
> At 01:19 PM 10/19/2001 +0200, you wrote:
> >Hi George
> >
> >I had the same problem a while ago.
> >The only solution i found was to change the link to :
> >www.blabla.com/pdffile/test.pdf
> >test.pdf does not exist, but
> >in /pdffile/ there is a .htaccess which redirects the 404 to the php
> >script that reads/generates the pdfs. And for my purpose checks if user
> >is
> >authorized to get these files.
> >
> >sebastian
>  preserved.>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] I thought it wise to offer to my relatives and friends first the items I have on auction at ebay.

2001-11-25 Thread Jess Ragaza


1. Elegant, collector's 8" stainless steel knife. Never been used although I had it 
for over ten (10) years. click:

 http://cgi.ebay.com/aw-cgi/eBayISAPI.dll?ViewItem&item=1038281683

2. NEC MULTISYNC XV17+ SVGA 17" MONITOR. EXCELLENT (LIKE NEW). . click: 

http://cgi.ebay.com/aw-cgi/eBayISAPI.dll?ViewItem&item=1301841765

I hope you are enjoying your long Thanksgiving holiday weekend.

Jess


Jess Ragaza, President, Internet Architecture Inc.; Principal, JR Associates; P.O. Box 
2766, Washington, D.C. 20013;[EMAIL PROTECTED] 
http://www.internetarchitecture.com/ With shopping and entertainment an experience in 
great deals, ease and comfort: Disney, amazon.com, eBay, AOL, CarsDirect, Sony, 
Franklin Mint, Playboy and others; Where everybody is given a chance to work 
profitably at home with Multilevel Marketing and Residual Income Galore; Watch for the 
next IPO that will reap rewards beyond your imagination!


-
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.


[PHP] Safely Storing & Delivering PDFs

2001-11-25 Thread Miles Thompson

Sebastian,

I believe I have to do what you do, but from your cryptic msg I've not been 
able to figure it out.

We have a subscription site, and if a subscriber wants a PDF, the link 
which requests it checks for a session cookie. If it's not set the user is 
directed to a logon script which checks username/password against a 
database and sets the session cookie if everything is OK. It automatically 
redirects to the calling script, and because the session id is now present 
the PDF can be accessed.

To my horror, I discovered on Friday that if I just type in the URL with 
the name of the PDF it's delivered with no checking at all. I have to move 
them to a safe place, either outside the web tree or to a directory 
protected by htaccess. This is where I'm stuck.

If I use .htaccess, I don't want to maintain a separate .htaccess file in 
addition to the subscriber table in the database. Can I set have my logon 
script set an Apache variable that will give access to the protected 
directory which store the PDf's?

Or do they have to be passed? If so how?

Would that mean that I'd need only one or a few username/password pairs in 
htaccess?
or
Is htaccess (or Apache's security) somehow satisfied by setting the variables?

Regards - Miles Thompson

At 01:19 PM 10/19/2001 +0200, you wrote:
>Hi George
>
>I had the same problem a while ago.
>The only solution i found was to change the link to :
>www.blabla.com/pdffile/test.pdf
>test.pdf does not exist, but
>in /pdffile/ there is a .htaccess which redirects the 404 to the php
>script that reads/generates the pdfs. And for my purpose checks if user
>is
>authorized to get these files.
>
>sebastian



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] MySQL function in a Table's Column

2001-11-25 Thread Hank Marquardt

Well, you can certainly do this in a query ... if you have unitcost and
quantity  in your table you could do this:

select unitcost, quantity, (unitcost*quantity) as totalsale from orders 

Hank

On Sat, Nov 24, 2001 at 04:06:31PM -0700, Jared Howard wrote:
> I'm not really sure what I should be looking for in the MySQL manual.  I
> basically want to make a column that will do math to other columns, like in
> a spreadsheet program.  Is it possible?  And if so, what do I look for?
> And if you can give me an example that would be great.
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- 
Hank Marquardt <[EMAIL PROTECTED]>
http://web.yerpso.net
GPG Id: 2BB5E60C
Fingerprint: D807 61BC FD18 370A AC1D  3EDF 2BF9 8A2D 2BB5 E60C
*** Web Development: PHP, MySQL/PgSQL - Network Admin: Debian/FreeBSD
*** PHP Instructor - Intnl. Webmasters Assn./HTML Writers Guild 
*** Beginning PHP -- Starts January 7, 2002 
*** See http://www.hwg.org/services/classes

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Redirect upon execution of script...

2001-11-25 Thread Miles Thompson

Daniel,
See below
Miles
At 06:24 PM 11/25/2001 +0100, Daniel Alsén wrote:
> > 2. User fills in a form, clicks "submit" which calls the same script,
> > passing itself the values. Depending on the value passed by the submit
> > button, the script processes the information (INSERT or UPDATE) and sets
> > $done = 1 if successful.
> >
> > The second scenario is easier to handle.
> > Call the same script, passing it $done, and depending on whether or not
> > $done is set you redirect.
> >
> > Juli Meloni has done an excellent tutorial on just this at
> > http://www.thickbook.com. look in the tutorials for something like "Form
> > With Error Message". You just have to adapt the logic to suit your needs.
>
>The second scenario is correct. I am actually already using the method in
>Melonis tutorial for error messages. But i can´t do a redirection that way
>since $done isn´t set until after the db INSERT. My if-statement for the
>header is at the top of the page (wich is the only place i can put it) and
>will never know if $done is set or not below.
>
>- Daniel

Before this a whole bunch of processing has been done, either:

A username/login has been entered and checked and a checkval generated and 
stored
or
A cookie has been read and its value checked in the database
If everything is OK, then $REaderOK is set true (1). No output has been 
sent to the browser

Now this is encountered ...
if( $ReaderOK == 1 )
{
   //header("Location: 
$PHP_SELF?&member_id=$member_id&cLangCode=$cLangCode&ReaderOK=$ReaderOK\n");
  header("Location: 
$origin?&member_id=$member_id&cLangCode=$cLangCode&ReaderOK=$ReaderOK\n");
}
else
   {
   include("user_logon_title.inc");
   echo "" . 
$ErrorAndReturnMsg ." ";
   }

This is just about the end of all the logic stuff, and now the display 
portion of the page runs.
Note that in the else part of the code fragment, that the normal part of 
the display code is never reached because the page
is calling itself with with an error message to the user. If everything is 
ok, the user is sent back to the page ($origin) which called the logon 
script. That value was set thusly:



Miles  Thompson


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Need Remote Freelancers?

2001-11-25 Thread Heidi Belal

Check out
www.code-corner.com

=
Heidi Belal
www.code-corner.com
ICQ# 32127109

A bus stops at a bus station.
A train stops at a train station.  On my desk
I have a work station...

__
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Installing PHP 4 on a RAQ3

2001-11-25 Thread Philip Olson

Hello Phil,

I've seen this come up a few times, search the archives for a bit:

  http://marc.theaimsgroup.com/?l=php-general&s=raq

The following comes up and may be useful.  Don't hesitate to reply back on
how helpful it is, perhaps eventually some raq instructions can make their 
way into installation section of manual.  Try:

  HOWTO: Installation on Cobalt RaQ  (RaQ3 or RaQ4)  :
  
  http://marc.theaimsgroup.com/?l=php-general&m=98039640119670

Also, the manual's install instructions should be of some use:

  http://www.php.net/manual/en/install.unix.php

regards,
Philip Olson

On Sun, 25 Nov 2001, Phil Ewington wrote:

> Hi,
> 
> As I have only ever worked on a Windows platform, installing PHP & MySQL on
> a RAQ3 is completely alien to me. I attempted to install the binaries by
> following instructions I dug up somewhere, and it all went badly wrong :o(
> 
> I have since had the RAQ reset so I could start again. This time round I
> installed the RaQ3-RaQ4-MySQL-3.23.37-1.pkg from cobalt, this went on OK,
> but now I need to install PHP. As there is no .pkg for the RAQ3, I have been
> advised that I do need to install the binaries for PHP 4. Do I need to give
> a path for the --with mysql option, and if so where does the .pkg install
> MySQL? Any idiot proof step by step instructions will be greatly
> appreciated, along with which is the best/most stable version of PHP 4?, and
> where is best to install it?
> 
> Thanks in advance,
> 
> Phil.
> 
> -
> Phil Ewington
> Cold Fusion Developer
> -
> T: 01344 643138
> E: mailto:[EMAIL PROTECTED]
> -
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Redirect upon execution of script...

2001-11-25 Thread Christian Dechery

I think I really don't understand what do you want... hehehe :)
which is fine!

but take that code I sent ya... now I'll explain the functions... then tell 
me if I'm right:

function ShowHeader
{
 ?>
 
 Something
 
 
 
 
 
 
 
 Hmm...either i don´t really get what you mean, or you missed the problem.
>
>This is the situation:
>
>I have a form which results is to be inserted in a db. When the form is
>submitted the page calls itself and does a db INSERT based on if a couple of
>statements is true - otherwise it displays a proper error message.
>
>So far everything is fine and is working like a charm.
>But:
>
>I want a redirection after a successfull db INSERT. After the INSERT is made
>(which is what the page is for) i set a variable, $done, to 1.
>Right now i only use $done to display a message at the bottom of the screen
>saying that the INSERT worked. But i want the page to redirect itself as
>soon as $done is set to 1.
>
>The problem i have is: I can only send headers (wich i use for redirection -
>right??) at the top of the page - before all the other code. But since $done
>is set far down in the code, after my form and db-statements, the header
>will never know when to be sent.
>
>Is there a way of calling a headerfunction in the top of the page?
>
>- Daniel
>
> > -Original Message-
> > From: Christian Dechery [mailto:[EMAIL PROTECTED]]
> > Sent: den 25 november 2001 18:41
> > To: Daniel Alsén; PHP; Miles Thompson
> > Subject: RE: [PHP] Redirect upon execution of script...
> >
> >
> > sorry if I'm not understanding correctly your problem... but it
> > seems quite
> > simple to me...
> > I've created like 10.000 php forms that does that... I don't see a prob...
> >
> > what do you want to do?
> >
> > process a form:
> > if something's wrong, print error message and go back
> > if everything is fine go to another page... that's it?
> >
> > well... database inserts has nothing to do with headers...
> >
> > you can easily do something like
> >
> >  > switch ($action)
> > {
> >  case "process-form":if( ProcessForm() )
> >  header("Location:
> > next-page.php");
> >  else
> >  {
> >  ShowHeader(); // function to
> > display all the HTML you want
> >  printErrMessage();
> >  ShowFooter();
> >  }
> >  break;
> >  default:ShowForm();
> >  break;
> > }
> > ?>
> >
> > where ProcessForm returns true or false depending on the DB operation...
> >
> > of course there cannot be any output before the switch?
> >
> > did it help?
> >
> > At 18:24 25/11/01 +0100, Daniel Alsén wrote:
> > > > 2. User fills in a form, clicks "submit" which calls the same script,
> > > > passing itself the values. Depending on the value passed by the submit
> > > > button, the script processes the information (INSERT or
> > UPDATE) and sets
> > > > $done = 1 if successful.
> > > >
> > > > The second scenario is easier to handle.
> > > > Call the same script, passing it $done, and depending on
> > whether or not
> > > > $done is set you redirect.
> > > >
> > > > Juli Meloni has done an excellent tutorial on just this at
> > > > http://www.thickbook.com. look in the tutorials for something
> > like "Form
> > > > With Error Message". You just have to adapt the logic to suit
> > your needs.
> > >
> > >The second scenario is correct. I am actually already using the method in
> > >Melonis tutorial for error messages. But i can´t do a
> > redirection that way
> > >since $done isn´t set until after the db INSERT. My if-statement for the
> > >header is at the top of the page (wich is the only place i can
> > put it) and
> > >will never know if $done is set or not below.
> > >
> > >- Daniel
> > >
> > >
> > >--
> > >PHP General Mailing List (http://www.php.net/)
> > >To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >For additional commands, e-mail: [EMAIL PROTECTED]
> > >To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
> > _
> > . Christian Dechery
> > . . Gaita-L Owner / Web Developer
> > . . http://www.webstyle.com.br
> > . . http://www.tanamesa.com.br
> >


_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Redirect upon execution of script...

2001-11-25 Thread Hank Marquardt

An example being a thousand words ...






Enter name:


Enter email:






Now I haven't actually tested it I just typed it, but directionally it's
pretty similar to lot's of pages I've written if not a little simplistic
... it also assumes that register_globals is on and does no sanity
checking on GET overrides or anything else nasty the user might try to
do:)

HTH

Hank
On Sun, Nov 25, 2001 at 07:03:08PM +0100, Daniel Als?n wrote:
> Hmm...either i don?t really get what you mean, or you missed the problem.
> 
> This is the situation:
> 
> I have a form which results is to be inserted in a db. When the form is
> submitted the page calls itself and does a db INSERT based on if a couple of
> statements is true - otherwise it displays a proper error message.
> 
> So far everything is fine and is working like a charm.
> But:
> 
> I want a redirection after a successfull db INSERT. After the INSERT is made
> (which is what the page is for) i set a variable, $done, to 1.
> Right now i only use $done to display a message at the bottom of the screen
> saying that the INSERT worked. But i want the page to redirect itself as
> soon as $done is set to 1.
> 
> The problem i have is: I can only send headers (wich i use for redirection -
> right??) at the top of the page - before all the other code. But since $done
> is set far down in the code, after my form and db-statements, the header
> will never know when to be sent.
> 
> Is there a way of calling a headerfunction in the top of the page?
> 
> - Daniel
> 
> > -Original Message-
> > From: Christian Dechery [mailto:[EMAIL PROTECTED]]
> > Sent: den 25 november 2001 18:41
> > To: Daniel Als?n; PHP; Miles Thompson
> > Subject: RE: [PHP] Redirect upon execution of script...
> >
> >
> > sorry if I'm not understanding correctly your problem... but it
> > seems quite
> > simple to me...
> > I've created like 10.000 php forms that does that... I don't see a prob...
> >
> > what do you want to do?
> >
> > process a form:
> > if something's wrong, print error message and go back
> > if everything is fine go to another page... that's it?
> >
> > well... database inserts has nothing to do with headers...
> >
> > you can easily do something like
> >
> >  > switch ($action)
> > {
> >  case "process-form":if( ProcessForm() )
> >  header("Location:
> > next-page.php");
> >  else
> >  {
> >  ShowHeader(); // function to
> > display all the HTML you want
> >  printErrMessage();
> >  ShowFooter();
> >  }
> >  break;
> >  default:ShowForm();
> >  break;
> > }
> > ?>
> >
> > where ProcessForm returns true or false depending on the DB operation...
> >
> > of course there cannot be any output before the switch?
> >
> > did it help?
> >
> > At 18:24 25/11/01 +0100, Daniel Als?n wrote:
> > > > 2. User fills in a form, clicks "submit" which calls the same script,
> > > > passing itself the values. Depending on the value passed by the submit
> > > > button, the script processes the information (INSERT or
> > UPDATE) and sets
> > > > $done = 1 if successful.
> > > >
> > > > The second scenario is easier to handle.
> > > > Call the same script, passing it $done, and depending on
> > whether or not
> > > > $done is set you redirect.
> > > >
> > > > Juli Meloni has done an excellent tutorial on just this at
> > > > http://www.thickbook.com. look in the tutorials for something
> > like "Form
> > > > With Error Message". You just have to adapt the logic to suit
> > your needs.
> > >
> > >The second scenario is correct. I am actually already using the method in
> > >Melonis tutorial for error messages. But i can?t do a
> > redirection that way
> > >since $done isn?t set until after the db INSERT. My if-statement for the
> > >header is at the top of the page (wich is the only place i can
> > put it) and
> > >will never know if $done is set or not below.
> > >
> > >- Daniel
> > >
> > >
> > >--
> > >PHP General Mailing List (http://www.php.net/)
> > >To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >For additional commands, e-mail: [EMAIL PROTECTED]
> > >To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
> > _
> > . Christian Dechery
> > . . Gaita-L Owner / Web Developer
> > . . http://www.webstyle.com.br
> > . . http://www.tanamesa.com.br
> >
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- 
Hank Marquardt <[EMAIL PROTECTED]>
http://web.yerpso.net
GPG Id: 2BB5E60C
Fingerprint: D807 61BC FD18 370A AC1D  3EDF 2BF9 8A

RE: [PHP] Redirect upon execution of script...

2001-11-25 Thread Daniel Alsén

Hmm...either i don´t really get what you mean, or you missed the problem.

This is the situation:

I have a form which results is to be inserted in a db. When the form is
submitted the page calls itself and does a db INSERT based on if a couple of
statements is true - otherwise it displays a proper error message.

So far everything is fine and is working like a charm.
But:

I want a redirection after a successfull db INSERT. After the INSERT is made
(which is what the page is for) i set a variable, $done, to 1.
Right now i only use $done to display a message at the bottom of the screen
saying that the INSERT worked. But i want the page to redirect itself as
soon as $done is set to 1.

The problem i have is: I can only send headers (wich i use for redirection -
right??) at the top of the page - before all the other code. But since $done
is set far down in the code, after my form and db-statements, the header
will never know when to be sent.

Is there a way of calling a headerfunction in the top of the page?

- Daniel

> -Original Message-
> From: Christian Dechery [mailto:[EMAIL PROTECTED]]
> Sent: den 25 november 2001 18:41
> To: Daniel Alsén; PHP; Miles Thompson
> Subject: RE: [PHP] Redirect upon execution of script...
>
>
> sorry if I'm not understanding correctly your problem... but it
> seems quite
> simple to me...
> I've created like 10.000 php forms that does that... I don't see a prob...
>
> what do you want to do?
>
> process a form:
> if something's wrong, print error message and go back
> if everything is fine go to another page... that's it?
>
> well... database inserts has nothing to do with headers...
>
> you can easily do something like
>
>  switch ($action)
> {
>  case "process-form":if( ProcessForm() )
>  header("Location:
> next-page.php");
>  else
>  {
>  ShowHeader(); // function to
> display all the HTML you want
>  printErrMessage();
>  ShowFooter();
>  }
>  break;
>  default:ShowForm();
>  break;
> }
> ?>
>
> where ProcessForm returns true or false depending on the DB operation...
>
> of course there cannot be any output before the switch?
>
> did it help?
>
> At 18:24 25/11/01 +0100, Daniel Alsén wrote:
> > > 2. User fills in a form, clicks "submit" which calls the same script,
> > > passing itself the values. Depending on the value passed by the submit
> > > button, the script processes the information (INSERT or
> UPDATE) and sets
> > > $done = 1 if successful.
> > >
> > > The second scenario is easier to handle.
> > > Call the same script, passing it $done, and depending on
> whether or not
> > > $done is set you redirect.
> > >
> > > Juli Meloni has done an excellent tutorial on just this at
> > > http://www.thickbook.com. look in the tutorials for something
> like "Form
> > > With Error Message". You just have to adapt the logic to suit
> your needs.
> >
> >The second scenario is correct. I am actually already using the method in
> >Melonis tutorial for error messages. But i can´t do a
> redirection that way
> >since $done isn´t set until after the db INSERT. My if-statement for the
> >header is at the top of the page (wich is the only place i can
> put it) and
> >will never know if $done is set or not below.
> >
> >- Daniel
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
> _
> . Christian Dechery
> . . Gaita-L Owner / Web Developer
> . . http://www.webstyle.com.br
> . . http://www.tanamesa.com.br
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Redirect upon execution of script...

2001-11-25 Thread Christian Dechery

sorry if I'm not understanding correctly your problem... but it seems quite 
simple to me...
I've created like 10.000 php forms that does that... I don't see a prob...

what do you want to do?

process a form:
if something's wrong, print error message and go back
if everything is fine go to another page... that's it?

well... database inserts has nothing to do with headers...

you can easily do something like



where ProcessForm returns true or false depending on the DB operation...

of course there cannot be any output before the switch?

did it help?

At 18:24 25/11/01 +0100, Daniel Alsén wrote:
> > 2. User fills in a form, clicks "submit" which calls the same script,
> > passing itself the values. Depending on the value passed by the submit
> > button, the script processes the information (INSERT or UPDATE) and sets
> > $done = 1 if successful.
> >
> > The second scenario is easier to handle.
> > Call the same script, passing it $done, and depending on whether or not
> > $done is set you redirect.
> >
> > Juli Meloni has done an excellent tutorial on just this at
> > http://www.thickbook.com. look in the tutorials for something like "Form
> > With Error Message". You just have to adapt the logic to suit your needs.
>
>The second scenario is correct. I am actually already using the method in
>Melonis tutorial for error messages. But i can´t do a redirection that way
>since $done isn´t set until after the db INSERT. My if-statement for the
>header is at the top of the page (wich is the only place i can put it) and
>will never know if $done is set or not below.
>
>- Daniel
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Redirect upon execution of script...

2001-11-25 Thread Daniel Alsén

> 2. User fills in a form, clicks "submit" which calls the same script,
> passing itself the values. Depending on the value passed by the submit
> button, the script processes the information (INSERT or UPDATE) and sets
> $done = 1 if successful.
>
> The second scenario is easier to handle.
> Call the same script, passing it $done, and depending on whether or not
> $done is set you redirect.
>
> Juli Meloni has done an excellent tutorial on just this at
> http://www.thickbook.com. look in the tutorials for something like "Form
> With Error Message". You just have to adapt the logic to suit your needs.

The second scenario is correct. I am actually already using the method in
Melonis tutorial for error messages. But i can´t do a redirection that way
since $done isn´t set until after the db INSERT. My if-statement for the
header is at the top of the page (wich is the only place i can put it) and
will never know if $done is set or not below.

- Daniel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Installing PHP 4 on a RAQ3

2001-11-25 Thread Phil Ewington

Hi,

As I have only ever worked on a Windows platform, installing PHP & MySQL on
a RAQ3 is completely alien to me. I attempted to install the binaries by
following instructions I dug up somewhere, and it all went badly wrong :o(

I have since had the RAQ reset so I could start again. This time round I
installed the RaQ3-RaQ4-MySQL-3.23.37-1.pkg from cobalt, this went on OK,
but now I need to install PHP. As there is no .pkg for the RAQ3, I have been
advised that I do need to install the binaries for PHP 4. Do I need to give
a path for the --with mysql option, and if so where does the .pkg install
MySQL? Any idiot proof step by step instructions will be greatly
appreciated, along with which is the best/most stable version of PHP 4?, and
where is best to install it?

Thanks in advance,

Phil.

-
Phil Ewington
Cold Fusion Developer
-
T: 01344 643138
E: mailto:[EMAIL PROTECTED]
-


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Can PHP take input from the command prompt interactively?

2001-11-25 Thread Dan McCullough

An example for ya

#!/usr/local/bin/php -q


--- David Yee <[EMAIL PROTECTED]> wrote:
> Can I write a command line PHP script like the following:
> 
> php -q test.php
> 
> Output: 
> 
> ==
> 1)choice A
> 2)choice B
> 3)choice C
> 
> Please enter an option: 1
> ==
> 
> Thanks.
> 
> David
> 
> 
> 


=
Dan McCullough
---
"Theres no such thing as a problem unless the servers are on fire!"
h: 603.444.9808
w: McCullough Family
w: At Work

__
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




php-general Digest 25 Nov 2001 15:56:18 -0000 Issue 1015

2001-11-25 Thread php-general-digest-help


php-general Digest 25 Nov 2001 15:56:18 - Issue 1015

Topics (messages 75632 through 75652):

Re: what the best version PHP + APACHE on Solaris8
75632 by: Justin England

Re: Can php do this?
75633 by: Michael Sims
75634 by: Michael A. Peters
75636 by: Casey Allen Shobe
75637 by: Joelmon2001.aol.com
75643 by: Miles Thompson
75651 by: Michael Sims

Creating $key, $value pairs
75635 by: Ashley M. Kirchner
75650 by: Hank Marquardt

Help needed: Failed opening '' for inclusion
75638 by: David De Graff
75640 by: B. van Ouwerkerk

Classes
75639 by: Rudi Ahlers
75641 by: Christopher William Wesley
75642 by: Miles Thompson
75645 by: Jason G.
75646 by: Jason G.
75647 by: Jason G.

Re: [php] telnet describe command for mysql
75644 by: Jason G.

gnupg, running php as a cgi script
75648 by: Scott

Redirect upon execution of script...
75649 by: Daniel Alsén
75652 by: Miles Thompson

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 ---

Just grap the lastest stable version.  As of now:

Apache ver 1.3.22
PHPver 4.0.6

Most all of my Sparc Solaris8 machines are running Apache 1.3.19/PHP 4.0.6

Hope this helps.

Justin England  [EMAIL PROTECTED]
Network Administrator   
E-Net Information Services  http://www.enetis.net
Tel: 605-341-3638   Fax: 605-341-8880

On Thu, 22 Nov 2001, Evgeny Rachlenko wrote:

> Dir Justin England,
> Could you tell me what the version of apache and php do you prefer  for
> Solaris 8 .
> 
> thanks
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


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

At 10:04 PM 11/24/2001 -0500, [EMAIL PROTECTED] wrote:
[snip]
>Sort of like cron doing what you would do if you visited
>page.php and once it's hit, it emails specified users in a database
>Would I need path to php in the cron script to do this?
>Or am I just living a dream?

It sure can.  There's a couple of ways to accomplish this.  I personally 
think the easiest way is to code your page like normal, then call it in a 
cron job via lynx.  Let's say you have a page called "page.php" that 
connects to your database, retrieves the email addresses, and sends the 
emails.  To call it from a cron job add the following to your crontab:

0 8 * * * /usr/bin/lynx -dump http://localhost/page.php > 
/path/to/logfile/or/dev/null

Of course this means your script is in your public web space, so 
theoretically could be called by anyone who knew the name of the page.  You 
could put the page in a subdirectory and add an .htaccess file that 
restricts access to only 127.0.0.1 to take care of that if it concerns you.

If you have PHP installed as a CGI then you could also write your page as a 
shell script.  As the first line of your script put the line:

#! -q

I haven't personally used this method because I have PHP installed as an 
apache module and I was too lazy to compile the CGI version.  Using lynx in 
the above configuration works fine for me...


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

If you have built the php standalone binary then its easy-

#!/usr/local/bin/php


What I do when I build php is build it twice. First I build it with all my
options EXCEPT for with-apxs=/blah
That builds the standalone binary, and I install that in /usr/local/bin

Then, I build the apache module and install that where my apache modules
go.
This allows me to use php as a regular unix scripting language, so I can
do stuff from the crontab.

btw- I'm actually doing a very similar thing-
I have some customer support software that pops my support e-mail address
and puts the message in a MySQL database.

I have a cron job that calls a php shell script that pops the e-mail for
me every 15 minutes.
That way I don't have to log on to the support application as often, and
the customers get an automated response fairly quickly, giving them a
unique case ID etc.

On Sat, 24 Nov 2001 22:04:21 EST
[EMAIL PROTECTED] mentioned:

> Thanks for your time . *This* = create follow up autoresponders
> Or at least have php run with cron, so I can daily hit a mysql
> db and use php to email those people at a specified time, like
> every 3 days. Just so when I have users to the site who register
> and their name/email is in a table "users" in db "data", 
> php/cron can be used to pull the name/email from mysql
> and (with unsubscribe message at bottom) email them when I 
> say to do so in cron. G

Re: [PHP] Redirect upon execution of script...

2001-11-25 Thread Miles Thompson


What scenario do you have?

1. User fills in a form somewhere & those values get transmitted to another 
script which processes them
or
2. User fills in a form, clicks "submit" which calls the same script, 
passing itself the values. Depending on the value passed by the submit 
button, the script processes the information (INSERT or UPDATE) and sets 
$done = 1 if successful.

The second scenario is easier to handle.
Call the same script, passing it $done, and depending on whether or not 
$done is set you redirect.

Juli Meloni has done an excellent tutorial on just this at 
http://www.thickbook.com. look in the tutorials for something like "Form 
With Error Message". You just have to adapt the logic to suit your needs.

Miles Thompson

At 03:56 PM 11/25/2001 +0100, Daniel Alsén wrote:
>Hi,
>
>is there a way to redirect after a script has run?
>
>I have a form whos result is being put into a database. When, or if, the
>operation is sucessful i set a variable $done to 1.
>
>Now, i need a redirection from here (if $done is 1). But since i cant send
>out headers that far down on the page - what do i do?
>
>Regards
># Daniel Alsén| www.mindbash.com #
># [EMAIL PROTECTED]  | +46 704 86 14 92 #
># ICQ: 63006462   |  #
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Can php do this?

2001-11-25 Thread Michael Sims

At 09:22 AM 11/25/2001 -0400, Miles Thompson wrote:
>I've followed this with interest, but unless you specifically need some 
>properties of PHP to do this, use an easier tool.
>
>Python has modules for both MySQL and PHP. They are easily invoked and 
>don't involve calling Lynx & feeding it the script.
>Here's some code, you might want to think about it as an alternative. I 
>hope the indents preserve, as Python reliese on indentation and a  
>ends it's line.

Thanks for the code!  The easiest way for me personally to learn a new 
language is to think of a task that needs to be done then look at some 
sample code.  I'm not quite ready to learn Python (yet) but I'm saving this 
into the archive for when I'm ready. :)


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Creating $key, $value pairs

2001-11-25 Thread Hank Marquardt

OK, I took a stab at this using your post for input and it should be a
good enough starting point for you ... if you do have extraneous ':'s
elsewhere in the message then you'll need to be a little more picky with
your regex stuff to only pick out what you want -- for example, your
post has a couple of sentences that end with ':' before an example ...
the script as written picks those up as key value pairs, but since
you'll unlikely have those in your order messages I figure you're on
safe ground for now --

Of course the really easy way to do this is just to process the form
output directly then you have your key/values nice and neat in
$HTTP_POST_VARS already:) ... but I'm assuming this is on and processed
by a separate server, or with a canned script that only gens emails, so
this is what you need to do.

Here's the code:


#!/usr/bin/php4 -q
 $val \n";
}
echo "ORDER HERE!!!\n";
for($x=0; $x<$itemcnt; $x++) {
echo "Item: $x \n";
while(list($k,$v) = each($order[$x])) {
echo "$k -> $v \n";
}
echo "\n";
}
?>

On Sat, Nov 24, 2001 at 10:20:45PM -0700, Ashley M. Kirchner wrote:
> 
> I need to "convert" the following:
> 
> ---
>   Todays Date:  20-Nov-2001 10:58:24AM
>   Order ID: W25
>   Customer Email:   [EMAIL PROTECTED]
>   Email Promotions: Ok
> 
>   BILL TO:
>   Business Name:
>   Contact Name: Ashley M. Kirchner
>   Day Number:   800 555-1212
>   Evening Number:   303 555-1212
>   Fax Number:
>   Address:  3550 Arapahoe Ave #6
>   Address:
>   Address:
>   City: Boulder
>   State/Province:   CO
>   Zip/Postal Code:  80303
>   Country:  USA
> 
>   Payment Method:   CC
> 
>   Card Number:  991234
>   Expiration Date:  01/71
> 
>   Shipping Method:  PICKUP
>   Order Comment:
>   Gift Message:
>   Shipping
>   Instruction:
> ---
> 
> ...into $key, $value pairs.  Ideally, I'd like to be able to name/use my own 
>names for $key so I can end up with something like:
> 
> $BillToContact  => 'Ashley M. Kirchner'
> $BillToDayPhone => '800 555-1212'
> $BillToEvePhone => '303 555-1212'
> etc.
> (or maybe with something like:
>   $bill['contact']  => 'Ashley M. Kirchner'
>   $bill['dayphone'] => '800 555-1212'
>   $bill['evephone'] => '303 555-1212'
>   etc.)
> 
> All of these variables will eventually be shoved into a DB once the entire form 
>has been parsed.
> 
> And then, at the bottom of that same (submitted) form, there's the actual 
>information on the order, which looks something like this (the spacing is slightly 
>different):
> 
> (unfortunately, this will wrap rather ugly)
> ---
>   ORDER NO.  QTY  UNIT   DESCRIPTIONPRICE   TOTAL
>   4x614"x6"  Standard Print (full-frame from 35mm).75   $0.75
>   4x614"x6"  Standard Print (full-frame from 35mm).75   $0.75
>   5x7.5  15x7.5  Image:Uploaded Image 3  4.25   $4.25
>   8x12   18x12   Classic Full Frame Image:Uploaded Image 4  10.25  $10.25
> 
>  SUBTOTAL: $16.00
>   TAX:  $1.18
>  SHIPPING:  $0.00
> TOTAL: $17.18
> ---
> 
> 
> This part again I'd like to break up into separate lines, and separate variables 
>for the product no., the quantity, unit, decription, price, total (per line), then 
>the subtotal, tax, shipping cost and final (grant) total.
> 
> Again, if I can somehow use my own variable names, that'd be great.
> 
> ($product['no']
>  $product['quantity']
>  $product['unit']
>  etc.
>  $order['subtotal']
>  $order['tax']
>  $order['shipping']
>  $order['total']
>  etc.)
> 
> I don't know yet how to create different entries for each line in that order - 
>kinda stupid to create $product_1['no'], $product_2['no'], $product_3['no'], 
>$product_4['no'], but then again, I don't know.
> 
> --
> H | "Life is the art of drawing without an eraser." - John Gardner
>   +
>   Ashley M. Kirchner    .   303.442.6410 x130
>   Director of Internet Operations / SysAdmin. 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, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED

[PHP] Redirect upon execution of script...

2001-11-25 Thread Daniel Alsén

Hi,

is there a way to redirect after a script has run?

I have a form whos result is being put into a database. When, or if, the
operation is sucessful i set a variable $done to 1.

Now, i need a redirection from here (if $done is 1). But since i cant send
out headers that far down on the page - what do i do?

Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   |  #


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] gnupg, running php as a cgi script

2001-11-25 Thread Scott

I am trying to use php and gnupg on my virtual host to send user input to  
myself in encryptd form.  The problem I am having is that  I have installed 
gnupg in my user account and it is functional, but the keyring and keys that 
I have generated are under my user name for the account.  Php runs under the 
user name "nobody" and does not have access to the keys for encryption.  I 
have spoken to a tech at the company who said that I would not be allowed to 
install keys under "nobody".  I'm not quite sure I believe this.

Anyway, as a way to get around this, I have tried to run the php script as 
cgi, by putting the script into the cgi-bin in my user directory.   This way 
the scripts should run as my username.  Here is the script:

#!/usr/local/bin/php
$filename = "/home/gildedpg/public_html/mydata.txt";
$newfile = fopen($filename, "w+") or die("Couldn't create file.");

fclose($newfile);

$msg = "File created!";




  






This is the error I get:

CGIwrap Error: System Error: execv() failed

Error: No such file or directory (2)

If anyone could tell me why this script will not run, or better yet, make any 
suggestions to make this process workwithout using cgi, I would appreciate it.

Thanks,
SW

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Classes

2001-11-25 Thread Jason G.

Miles,

I have come from a QBASIC to VFP to VC++ to PHP (VFP and PHP are my primary 
languages), so I'll try to clear it up a bit.

In VFP, there is no constructor.  I believe that the equivalent is the 
init() method.  The init() method, or the constructor (in PHP, C++, etc) 
are useful for doing stuff that needs to be done when an object is 
created.  Likewise in true object oriented languages (PHP is not one of 
them yet), there is a Destructor that is called when an object goes out of 
scope or is deleted.  In VFP, there is a Destroy() method to simulate this 
behavior.

In VFP, there is the notion of Public, Private, and Hidden properties.  PHP 
does not yet support this behavior.  In PHP, especially since it is such a 
loosely typed language, you can add and remove properties on the 
fly.  Generally when programming in PHP, I like to identify private 
properties and methods by placing a single underscore before their 
name.  This makes it clear for someone using the class not to ever 
reference these entities.

If you want to see a neat example of object oriented programming in action 
(not that I like M$ or anything), check out how the Microsoft Foundation 
Classes (MFC) work.  They effectively demonstrate public and private class 
members, inheritance, constructors, destructors, parent objects, etc...

Hope it Helped...

-Jason Garber
IonZoft.com






At 09:10 AM 11/25/2001 -0400, Miles Thompson wrote:
>Chris,
>
>Not such a useless explanation at all, in fact a damned good one. Tight & 
>concise, and you immediately related the functions to code examples, along 
>with an easy-to-visualize object, the chair.
>
>But I have two questions:
>
>1. Why is a constructor class needed? My OO background is Visual FoxPro, 
>and all it requires is a declaration of  the class, it' methods and properties.
>
>2. Are the chairs properties exposed, or are they private? You use 
>functions to both set and retrieve them, which implies that they are 
>private.  Even so, PHP's syntax is much cleaner than the tortured syntax 
>used in VB.
>
>Miles Thompson
>
>At 03:28 AM 11/25/2001 -0800, you wrote:
>>On Sun, 25 Nov 2001, Rudi Ahlers wrote:
>> > Can anyone explain classes to me please? On many sites have I seen 
>> classes,
>>
>>There are people earning PHD's while explaining classes.  I know your
>>question originates from using PHP, and this is a PHP general mailing list
>>... but your question is just a tad too general for this list.
>>
>> > I'm not sure how these work, or how to use them. I'm still learning about
>>
>>Classes aren't unique to PHP.  You need to learn a true object-oriented
>>programming language (C++, Java, ... etc.) to really learn classes.
>>Truly gifted individuals can learn object-oriented programming w/o too
>>much help, but they'd first have a firm grip on programming.  I'd expect
>>the average, novice programmer to need a good amount of help learning &
>>understanding objecte-oriented programming ...  like that attained from a
>>University, a good High School, or a lot of independent study and time
>>experimenting with code.
>>
>>That said ...
>>
>>You weren't completely missing the boat with your analogy of a class to a
>>variable, but in the same breath, that idea is totally missing the boat (I
>>can see from where you're coming, and to where you're headed).  Classes
>>are an IDEA.  They're not actually anything.  They're the definition of
>>private and public data members and methods that should make up an object.
>>When a class is instantiated, an object is created with the defined data
>>members and methods available.  You can then use the objects' methods to
>>set, get, alter, or otherwise interact with its data members, or to simply
>>perform a set of related operations.  >here.> That's my feeble attempt to explain classes.  It's abstract, I
>>know, and possibly not a help at all.  But it's because of the paragraph
>>above this one.
>>
>>Let's look at some petty code:
>>
>>class chair{
>> // DATA
>> var num_legs;
>> var color;
>> var num_arms;
>>
>> // METHODS
>> function chair( $legs = 3, $arms = 0 ){ //CONSTRUCTOR
>> $this->num_legs = $legs;
>> $this->num_arms = $arms;
>> }
>>
>> function setLegs( $legs ){
>> $this->num_legs = $legs;
>> return;
>> }
>> function getLegs( ){
>> return $this->num_legs;
>> }
>>
>> // ... *clip* ...
>>}
>>
>>
>>Above is the [incomplete] definition of a chair class.  As you can see,
>>the class is useless.  But you can instantiate the class, and create a
>>useable object ... you can now create a chair.
>>
>>$myChair = new chair( 4, 2 );
>>
>>Now I have a chair [object] with 4 legs and 2 arms, called $myChair.
>>Let's have the chair tell us how many legs it has ...
>>
>>$numLegsOnMyChair = $myChair->getLegs();
>>print( "My Chair has $numLegsOnMyChair legs." );
>>
>>Lets change how man

Re: [PHP] Classes

2001-11-25 Thread Jason G.

Miles,

I have come from a QBASIC to VFP to VC++ to PHP (VFP and PHP are my primary 
languages), so I'll try to clear it up a bit.

In VFP, there is no constructor.  I believe that the equivalent is the 
init() method.  The init() method, or the constructor (in PHP, C++, etc) 
are useful for doing stuff that needs to be done when an object is 
created.  Likewise in true object oriented languages (PHP is not one of 
them yet), there is a Destructor that is called when an object goes out of 
scope or is deleted.  In VFP, there is a Destroy() method to simulate this 
behavior.

In VFP, there is the notion of Public, Private, and Hidden properties.  PHP 
does not yet support this behavior.  In PHP, especially since it is such a 
loosely typed language, you can add and remove properties on the 
fly.  Generally when programming in PHP, I like to identify private 
properties and methods by placing a single underscore before their 
name.  This makes it clear for someone using the class not to ever 
reference these entities.

If you want to see a neat example of object oriented programming in action 
(not that I like M$ or anything), check out how the Microsoft Foundation 
Classes (MFC) work.  They effectively demonstrate public and private class 
members, inheritance, constructors, destructors, parent objects, etc...

Hope it Helped...

-Jason Garber
IonZoft.com






At 09:10 AM 11/25/2001 -0400, Miles Thompson wrote:
>Chris,
>
>Not such a useless explanation at all, in fact a damned good one. Tight & 
>concise, and you immediately related the functions to code examples, along 
>with an easy-to-visualize object, the chair.
>
>But I have two questions:
>
>1. Why is a constructor class needed? My OO background is Visual FoxPro, 
>and all it requires is a declaration of  the class, it' methods and properties.
>
>2. Are the chairs properties exposed, or are they private? You use 
>functions to both set and retrieve them, which implies that they are 
>private.  Even so, PHP's syntax is much cleaner than the tortured syntax 
>used in VB.
>
>Miles Thompson
>
>At 03:28 AM 11/25/2001 -0800, you wrote:
>>On Sun, 25 Nov 2001, Rudi Ahlers wrote:
>> > Can anyone explain classes to me please? On many sites have I seen 
>> classes,
>>
>>There are people earning PHD's while explaining classes.  I know your
>>question originates from using PHP, and this is a PHP general mailing list
>>... but your question is just a tad too general for this list.
>>
>> > I'm not sure how these work, or how to use them. I'm still learning about
>>
>>Classes aren't unique to PHP.  You need to learn a true object-oriented
>>programming language (C++, Java, ... etc.) to really learn classes.
>>Truly gifted individuals can learn object-oriented programming w/o too
>>much help, but they'd first have a firm grip on programming.  I'd expect
>>the average, novice programmer to need a good amount of help learning &
>>understanding objecte-oriented programming ...  like that attained from a
>>University, a good High School, or a lot of independent study and time
>>experimenting with code.
>>
>>That said ...
>>
>>You weren't completely missing the boat with your analogy of a class to a
>>variable, but in the same breath, that idea is totally missing the boat (I
>>can see from where you're coming, and to where you're headed).  Classes
>>are an IDEA.  They're not actually anything.  They're the definition of
>>private and public data members and methods that should make up an object.
>>When a class is instantiated, an object is created with the defined data
>>members and methods available.  You can then use the objects' methods to
>>set, get, alter, or otherwise interact with its data members, or to simply
>>perform a set of related operations.  >here.> That's my feeble attempt to explain classes.  It's abstract, I
>>know, and possibly not a help at all.  But it's because of the paragraph
>>above this one.
>>
>>Let's look at some petty code:
>>
>>class chair{
>> // DATA
>> var num_legs;
>> var color;
>> var num_arms;
>>
>> // METHODS
>> function chair( $legs = 3, $arms = 0 ){ //CONSTRUCTOR
>> $this->num_legs = $legs;
>> $this->num_arms = $arms;
>> }
>>
>> function setLegs( $legs ){
>> $this->num_legs = $legs;
>> return;
>> }
>> function getLegs( ){
>> return $this->num_legs;
>> }
>>
>> // ... *clip* ...
>>}
>>
>>
>>Above is the [incomplete] definition of a chair class.  As you can see,
>>the class is useless.  But you can instantiate the class, and create a
>>useable object ... you can now create a chair.
>>
>>$myChair = new chair( 4, 2 );
>>
>>Now I have a chair [object] with 4 legs and 2 arms, called $myChair.
>>Let's have the chair tell us how many legs it has ...
>>
>>$numLegsOnMyChair = $myChair->getLegs();
>>print( "My Chair has $numLegsOnMyChair legs." );
>>
>>Lets change how man

Re: [PHP] [php] telnet describe command for mysql

2001-11-25 Thread Jason G.

Yeah, use a real client program like Terra Term.

-Jason Garber


At 05:07 PM 11/24/2001 +, cosmin laslau wrote:
>I've got a huge table that I'm trying to get information about. I use a 
>MySQL database, and the windows telnet utility to access it. To see info 
>about the table, the DESCRIBE command is used. However, since it's about 
>40 fields, it doesn't fit on the screen, so the top half just zips by in a 
>millisecond.
>
>Is there any break command, something to show one screen of info, read 
>key, and then show another screen, for the DESCRIBE command?
>
>Or just any other way to see the information...
>
>Thanks.
>
>_
>Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Can php do this?

2001-11-25 Thread Miles Thompson

I've followed this with interest, but unless you specifically need some 
properties of PHP to do this, use an easier tool.

Python has modules for both MySQL and PHP. They are easily invoked and 
don't involve calling Lynx & feeding it the script.
Here's some code, you might want to think about it as an alternative. I 
hope the indents preserve, as Python reliese on indentation and a  ends 
it's line.

Miles Thompson


#! /usr/bin/python
"Mails Passwords from sub_list, a MySQL database "
import sys, MySQLdb, traceback
import rfc822, string, sys
import smtplib

# MySQLdb allows connection to the MySQL database
# This connects to the database, all parameters must be explicitly named
try:
db = MySQLdb.connect( db='sub_list' )
except:
traceback.print_exc()
sys.exit()
# create connection to the database object
try:
pcursor = db.cursor()
except:
traceback.print_exc()
sys.exit()
#let's display some information
print db.get_host_info()
print db.stat()

#let's fetch our data, mailing to everyone who has not been emailed a password
try:
 pcursor.execute("select * from subscriber where lpasswd_mailed = 0 
and email !='';")
 resultset = pcursor.fetchall()
except:
 traceback.print_exc()
 sys.exit()

#let's build the message
fromaddr = '[EMAIL PROTECTED]'
toaddr = '[EMAIL PROTECTED]'
username = ""
password = ""

msgFirstPart = "Thanks for subscribing. Passwords have been\n\
updated as part of our security schedule to protect your subscription. \n\
Your name and new password are: \n\n"

msgEndPart = "Please contact us at (555) 555- or 555-5556 for help with 
your subscription, \n\
or email us at [EMAIL PROTECTED]\n\
\n\
Best regards, \n\
John Doe"

# we've gotten this far, so let's open the SMTP connection
server = smtplib.SMTP('smtp.domain.com',25)
server.set_debuglevel(2)

# for each record in the cursor
# set toaddr, username and password
# then send the message

# here in the for loop we send the mail message 
#server.sendmail( fromaddr, toaddr, msg, "Subject: Your new password" )[D

for cursorRecord in resultset:
 toaddr = cursorRecord[ 3 ]
 first_name = "   First name: " + cursorRecord[ 2 ] + "\n"
 last_name = "   Last name: " + cursorRecord[ 1 ] + "\n"
 password = "   Password : " + cursorRecord[ 4 ] + "\n\n"
 msgMail = msgFirstPart + first_name + last_name + password + 
msgEndPart
 print msgMail
 server.sendmail( fromaddr, toaddr, msgMail, "Subject: Password for 
ALLnovascotia.com" )

 # build the update query
 upd_query = "update subscriber set lpasswd_mailed = 1 where email 
='" + cursorRecord[ 3 ] + "';"
 try:
 #pcursor.execute( "update subscriber set lpasswd_mailed = 
1 where email = c_email;")
 pcursor.execute( upd_query )
 except:
 traceback.print_exc()
 sys.exit()
print "\n\n"
print "All records printed"

#close the smpt connection
#server.quit()

# close the database
try:
db.close()
except:
traceback.print_exc()
sys.exit()

# All done
print "*"*30
print ""
print "mailpass.py completed"
print ""
print "*"*30


At 02:58 AM 11/25/2001 -0500, you wrote:
>Thanks guys
>
>I just want to confirm one last thing, as it's been a while since I needed
>cron
>
>After I create this file (cron.file) for ex
>and use
>crontab cronfile (I do this as root, if it matters)
>do permissions need to be set? I really can't recall
>I would think that would do it as I am not uploading it
>and do it as root
>
>Thanks for the help, GREAT help and it's appreciated
>
>Now I just need to get freetype 2 installed right on my raq 3
>and I can live like a king
>
>Joel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Classes

2001-11-25 Thread Miles Thompson

Chris,

Not such a useless explanation at all, in fact a damned good one. Tight & 
concise, and you immediately related the functions to code examples, along 
with an easy-to-visualize object, the chair.

But I have two questions:

1. Why is a constructor class needed? My OO background is Visual FoxPro, 
and all it requires is a declaration of  the class, it' methods and properties.

2. Are the chairs properties exposed, or are they private? You use 
functions to both set and retrieve them, which implies that they are 
private.  Even so, PHP's syntax is much cleaner than the tortured syntax 
used in VB.

Miles Thompson

At 03:28 AM 11/25/2001 -0800, you wrote:
>On Sun, 25 Nov 2001, Rudi Ahlers wrote:
> > Can anyone explain classes to me please? On many sites have I seen classes,
>
>There are people earning PHD's while explaining classes.  I know your
>question originates from using PHP, and this is a PHP general mailing list
>... but your question is just a tad too general for this list.
>
> > I'm not sure how these work, or how to use them. I'm still learning about
>
>Classes aren't unique to PHP.  You need to learn a true object-oriented
>programming language (C++, Java, ... etc.) to really learn classes.
>Truly gifted individuals can learn object-oriented programming w/o too
>much help, but they'd first have a firm grip on programming.  I'd expect
>the average, novice programmer to need a good amount of help learning &
>understanding objecte-oriented programming ...  like that attained from a
>University, a good High School, or a lot of independent study and time
>experimenting with code.
>
>That said ...
>
>You weren't completely missing the boat with your analogy of a class to a
>variable, but in the same breath, that idea is totally missing the boat (I
>can see from where you're coming, and to where you're headed).  Classes
>are an IDEA.  They're not actually anything.  They're the definition of
>private and public data members and methods that should make up an object.
>When a class is instantiated, an object is created with the defined data
>members and methods available.  You can then use the objects' methods to
>set, get, alter, or otherwise interact with its data members, or to simply
>perform a set of related operations.  here.> That's my feeble attempt to explain classes.  It's abstract, I
>know, and possibly not a help at all.  But it's because of the paragraph
>above this one.
>
>Let's look at some petty code:
>
>class chair{
> // DATA
> var num_legs;
> var color;
> var num_arms;
>
> // METHODS
> function chair( $legs = 3, $arms = 0 ){ //CONSTRUCTOR
> $this->num_legs = $legs;
> $this->num_arms = $arms;
> }
>
> function setLegs( $legs ){
> $this->num_legs = $legs;
> return;
> }
> function getLegs( ){
> return $this->num_legs;
> }
>
> // ... *clip* ...
>}
>
>
>Above is the [incomplete] definition of a chair class.  As you can see,
>the class is useless.  But you can instantiate the class, and create a
>useable object ... you can now create a chair.
>
>$myChair = new chair( 4, 2 );
>
>Now I have a chair [object] with 4 legs and 2 arms, called $myChair.
>Let's have the chair tell us how many legs it has ...
>
>$numLegsOnMyChair = $myChair->getLegs();
>print( "My Chair has $numLegsOnMyChair legs." );
>
>Lets change how many legs the chair has ...
>
>$myChair->setLegs( 7 ); // very odd, seven-legged chair
>
>We should have a chair with 7 legs now, instead of 4.  Prove it ...
>
>$numLegsOnMyChair = $myChair->getLegs();
>print( "My Chair has $numLegsOnMyChair legs." );
>
>(As you alluded to previously, the object $myChair is seemingly a variable
>that has access to scripts ... but I hope you see now that $myChair is an
>object with methods and data members, not a variable.)
>
>That's very simple, and not too useful.  Which brings me to the next
>point.  Knowing object-oriented programming is to know when and when not
>to use it (especially with PHP).  I don't need a class definition and an
>object for a one-time use 7-legged chair.  But I may need a class
>definition if I were making many complete graph data structures, each with
>a number of nodes equal to a unique number in the Fibonacci sequence.  I
>wouldn't want to re-code the basic logic of a complete graph over and over
>for each graph.  I could just instantiate graph objects, each with
>different numbers of nodes, much like I did with the chair, above.
>
>
> g.luck,
> ~Chris   /"\
>  \ / September 11, 2001
>   X  We Are All New Yorkers
>  / \ rm -rf /bin/laden
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL P

Re: [PHP] Classes

2001-11-25 Thread Christopher William Wesley

On Sun, 25 Nov 2001, Rudi Ahlers wrote:
> Can anyone explain classes to me please? On many sites have I seen classes,

There are people earning PHD's while explaining classes.  I know your
question originates from using PHP, and this is a PHP general mailing list
... but your question is just a tad too general for this list.

> I'm not sure how these work, or how to use them. I'm still learning about

Classes aren't unique to PHP.  You need to learn a true object-oriented
programming language (C++, Java, ... etc.) to really learn classes.
Truly gifted individuals can learn object-oriented programming w/o too
much help, but they'd first have a firm grip on programming.  I'd expect
the average, novice programmer to need a good amount of help learning &
understanding objecte-oriented programming ...  like that attained from a
University, a good High School, or a lot of independent study and time
experimenting with code.

That said ...

You weren't completely missing the boat with your analogy of a class to a
variable, but in the same breath, that idea is totally missing the boat (I
can see from where you're coming, and to where you're headed).  Classes
are an IDEA.  They're not actually anything.  They're the definition of
private and public data members and methods that should make up an object.
When a class is instantiated, an object is created with the defined data
members and methods available.  You can then use the objects' methods to
set, get, alter, or otherwise interact with its data members, or to simply
perform a set of related operations.   That's my feeble attempt to explain classes.  It's abstract, I
know, and possibly not a help at all.  But it's because of the paragraph
above this one.

Let's look at some petty code:

class chair{
// DATA
var num_legs;
var color;
var num_arms;

// METHODS
function chair( $legs = 3, $arms = 0 ){ //CONSTRUCTOR
$this->num_legs = $legs;
$this->num_arms = $arms;
}

function setLegs( $legs ){
$this->num_legs = $legs;
return;
}
function getLegs( ){
return $this->num_legs;
}

// ... *clip* ...
}


Above is the [incomplete] definition of a chair class.  As you can see,
the class is useless.  But you can instantiate the class, and create a
useable object ... you can now create a chair.

$myChair = new chair( 4, 2 );

Now I have a chair [object] with 4 legs and 2 arms, called $myChair.
Let's have the chair tell us how many legs it has ...

$numLegsOnMyChair = $myChair->getLegs();
print( "My Chair has $numLegsOnMyChair legs." );

Lets change how many legs the chair has ...

$myChair->setLegs( 7 ); // very odd, seven-legged chair

We should have a chair with 7 legs now, instead of 4.  Prove it ...

$numLegsOnMyChair = $myChair->getLegs();
print( "My Chair has $numLegsOnMyChair legs." );

(As you alluded to previously, the object $myChair is seemingly a variable
that has access to scripts ... but I hope you see now that $myChair is an
object with methods and data members, not a variable.)

That's very simple, and not too useful.  Which brings me to the next
point.  Knowing object-oriented programming is to know when and when not
to use it (especially with PHP).  I don't need a class definition and an
object for a one-time use 7-legged chair.  But I may need a class
definition if I were making many complete graph data structures, each with
a number of nodes equal to a unique number in the Fibonacci sequence.  I
wouldn't want to re-code the basic logic of a complete graph over and over
for each graph.  I could just instantiate graph objects, each with
different numbers of nodes, much like I did with the chair, above.


g.luck,
~Chris   /"\
 \ / September 11, 2001
  X  We Are All New Yorkers
 / \ rm -rf /bin/laden


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Help needed: Failed opening '' for inclusion

2001-11-25 Thread B. van Ouwerkerk


>
>To test a new php installation I accessed a page called index.php that
>contains only 

Perhaps you want to:


Not sure if anything else should produce errors..

Bye,




B.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Classes

2001-11-25 Thread Rudi Ahlers

Hi

Can anyone explain classes to me please? On many sites have I seen classes,
I'm not sure how these work, or how to use them. I'm still learning about
php, and I get it going nicely. Is a class something like a variable (but as
a whole script) that I simply include into my other scripts?
Your help would be grateful as I'm still learning, and all info or knowledge
helps

Regards

Rudi Ahlers



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Help needed: Failed opening '' for inclusion

2001-11-25 Thread David De Graff

Hi,

To test a new php installation I accessed a page called index.php that
contains only  but that produces this error:

Warning: Failed opening '' for inclusion
(include_path='.:/usr/local/lib/php:/usr/local/include/php:/usr/local/bin/ph
p') in Unknown on line 0

This seems very odd given that:

a) the error does not specify any filename that failed opening, only '', and

b) permissions of the index.php file and the include path directories are
readable by all users.

I have even started the php fastcgi runner as root to double-check the
permissions aspect of this. The setup is php 4.0.6 with Zeus webserver
version 4 using FastCGI on Solaris 2.6.

Any ideas? Help of any sort would be greatly appreciated.

Thanks,

Dave De Graff


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]