php-general Digest 26 Nov 2001 16:59:18 -0000 Issue 1017

Topics (messages 75697 through 75726):

Re: Pulling information out of a MySQL database
        75697 by: Martin Towell
        75701 by: Tim Thorburn
        75709 by: Douglas McKenzie
        75710 by: Jon Haworth

Re: Installing PHP 4 on a RAQ3
        75698 by: Steve Werby

Re: failure notice
        75699 by: Joelmon2001.aol.com
        75719 by: Steve Werby

Reading the value of a serialize object in session
        75700 by: py

preventing multiple submissions
        75702 by: Derek Mailer

Creating a new file & saving it with date & time name
        75703 by: Kevin Garrett
        75704 by: Michael Hall

unsetting a session
        75705 by: Joffrey van Wageningen

Re: Classes
        75706 by: Rudi Ahlers

Infomation wanted
        75707 by: De Necker Henri
        75714 by: Michael Hall
        75715 by: B. van Ouwerkerk

changing  a variable according to the input in a checkbox
        75708 by: Rudi Ahlers
        75712 by: Miles Thompson

Re: xslt compile error?
        75711 by: Papp Gyozo

Re: [PHP-DB] postgres optimization
        75713 by: Miles Thompson

email info
        75716 by: Caspar Kennerdale
        75720 by: R'twick Niceorgaw
        75723 by: Caspar Kennerdale

PHP to ASP ?
        75717 by: Jean-Arthur Silve
        75718 by: Casey Allen Shobe
        75721 by: JSheble
        75726 by: Jean-Arthur Silve

Recursive directory scan
        75722 by: Christoph Starkmann
        75724 by: Hank Marquardt

Need a script that will read Apache Log files and generate reports
        75725 by: Dan McCullough

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


<?

$db = mysql_connect("localhost", "login", "password");
mysql_select_db("edoinfo",$db);

if ($id) {

// query for extented information

$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);

$myrow = mysql_fetch_array($result);
                
//display extended information

         echo "<table width='65%' border='0' cellspacing='2'
cellpadding='2'>";
           echo "<tr>";
             echo "<td valign='top' align='left'><b>Event: </b></td>";
             echo "<td valign='top' align='left'>";
                        echo ($myrow["EventName"]);
                        echo "</td>";
           echo "</tr>";
           echo "<tr>";
             echo "<td valign='top' align='left'><b>Location: </b></td>";
                        echo "<td valign='top'
align='left'>".($myrow["EventLocation"])."</td>";
           echo "</tr>";
           echo "<tr>";
                echo "<td valign='top' align='left'><b>City: </b></td>";
                echo "<td valign='top'
align='left'>".($myrow["EventCity"]).", 
".($myrow["EventState"])."</td>";
           echo "</tr>";
           echo "<tr>";
             echo "<td valign='top' align='left'><b>Time: </b></td>";
                        echo "<td valign='top' 
align='left'>".($myrow["FormattedEventStartTime"])."</td>";
           echo "</tr>";
           echo "<tr>";
             echo "<td valign='top' align='left'><b>Date: </b></td>";
                        echo "<td valign='top' 
align='left'>".($myrow["FormattedEventStartDate"])."</td>";
           echo "</tr>";
           echo "<tr>";
                echo "<td valign='top' align='left'><b>Contact Person(s):
</b></td>";
             echo "<td valign='top' align='left'>".($myrow["EventC1FN"])." 
".($myrow["EventC1LN"])."<br>".($myrow["EventC2FN"])." 
".($myrow["EventC2LN"])."</td>";
           echo "</tr>";
           echo "<tr>";
             echo "<td valign='top' align='left'><b>Phone: </b></td>";
             echo "<td valign='top' 
align='left'>".($myrow["EventC1ACPhone"]).".".($myrow["EventC1ExcPhone"]).".
".($myrow["EventC1ExtPhone"])." 
";
                        echo 
"<br>".($myrow["EventC2ACPhone"]).".".($myrow["EventC2ExcPhone"]).".".($myro
w["EventC2ExtPhone"])." 
";
                        echo "</td>";
           echo "</tr>";
           echo "<tr>";
                    echo "<td valign='top' align='left'><b>Fax: </b></td>";
             echo "<td valign='top' 
align='left'>".($myrow["EventACFax"]).".".($myrow["EventExcFax"]).".".($myro
w["EventExtFax"])."</td>";
           echo "</tr>";
           echo "<tr>";
                    echo "<td valign='top' align='left'><b>Cell: </b></td>";
             echo "<td valign='top' 
align='left'>".($myrow["EventACCell"]).".".($myrow["EventExcCell"]).".".($my
row["EventExtCell"])."</td>";
           echo "</tr>";
           echo "<tr>";
                    echo "<td valign='top' align='left'><b>Email:
</b></td>";
             echo "<td valign='top' align='left'><a 
href='mailto:";.($myrow["EventEmail"])."'>".($myrow["EventEmail"])."</a></td>
";
           echo "</tr>";
           echo "<tr>";
                    echo "<td valign='top' align='left'><b>Web: </b></td>";
             echo "<td valign='top' align='left'><a 
href='".($myrow["EventWeb"])."'>".($myrow["EventWeb"])."</a></td>";
           echo "</tr>";
           echo "<tr>";
                    echo "<td valign='top' align='left'><b>Description:
</b></td>";
             echo "<td valign='top' 
align='left'>".($myrow["EventDescription"])."</td>";
           echo "</tr>";
           echo "<tr>";
                    echo "<td valign='top' align='left'><b>Cost: </b></td>";
             echo "<td valign='top' 
align='left'>".($myrow["EventCost"])."</td>";
           echo "</tr>";
           echo "<tr>";
             echo "<td valign='top' align='left'><b></b></td>";
             echo "<td valign='top' align='left'>&nbsp;</td>";
           echo "</tr>";
           echo "<tr>";
             echo "<td valign='top' align='left'><b></b></td>";
             echo "<td valign='top' align='left'>&nbsp;</td>";
           echo "</tr>";
         echo "</table>";
                
                
                } 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 "<table width=65% border=0 cellspacing=2 cellpadding=2>";


       do {
        echo "<tr>";
                echo "<td valign='top' align='left'>";
                echo "<a href=";
                echo "$PHP_SELF?id=";
                echo ($myrow["id"]);
                echo ">";
                echo ($myrow["EventName"]);
                echo "</a>";
                echo "</td>";
                echo "<td valign='top' align='left'>";
                echo "<font size='1'>";
                echo ($myrow["FormattedEventStartDate"]);
                echo "</font>";
                echo "</td>";
        echo "</tr>";

       } while ($myrow = mysql_fetch_array($result));
        echo "</table>";
     } 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]
--- End Message ---
--- Begin Message ---
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


--- End Message ---
--- Begin Message ---
Im new to php but I would suggest using a <pre></pre> tag to wrap round your
text output. This should keep any formatting. I think.........

Tim Thorburn wrote:

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

--- End Message ---
--- Begin Message ---
You could look into the nl2br() function, which converts \n -style newlines
(entered in  <TEXTAREA>s) into HTML <br>s.

http://www.php.net/nl2br

HTH
Jon


-----Original Message-----
From: Tim Thorburn [mailto:[EMAIL PROTECTED]]
Sent: 26 November 2001 07:32
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Pulling information out of a MySQL database


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?


**********************************************************************
'The information included in this Email is of a confidential nature and is 
intended only for the addressee. If you are not the intended addressee, 
any disclosure, copying or distribution by you is prohibited and may be 
unlawful. Disclosure to any party other than the addressee, whether 
inadvertent or otherwise is not intended to waive privilege or confidentiality'

**********************************************************************
--- End Message ---
--- Begin Message ---
"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/

--- End Message ---
--- Begin Message ---
For those running php 4 on raq 3, how did you compile freetype?

./configure
make 
make install

or just 2 make's?

Just curious

--- End Message ---
--- Begin Message ---
<[EMAIL PROTECTED]> wrote:
> For those running php 4 on raq 3, how did you compile freetype?
>
> ./configure
> make
> make install
>
> or just 2 make's?

Read the INSTALL file for freetype.  2.0.4 says:

make setup
make
make install

Then install PHP with the options you need in ./configure.  You'll get
better bang for your buck searching the archives for cobalt-users and
posting there.  After all, *everyone* on that list runs Cobalt servers
whereas probably only a small percentage do on the PHP list.  See archives
at marc.theaimsgroup.com and list subscription at www.cobalt.com.

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

--- End Message ---
--- Begin Message ---
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 "<br>". $o->var1;  // nothing...
print "<br>". $o->var2;

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

py


--- End Message ---
--- Begin Message ---
I have a problem with a form on my website.

it's part of a shopping cart application, whereby the form consists of a list of 
products and the user enters the quantity they require of each product in the field 
provided.  Everything works okay except for the fact that if someone hits the submit 
button more than once the products will be added to the 'cart' more than once.

I've tried altering the script that handles the posted form info, but the problem 
persists.  I've also simplified the page that loads after adding products to the 
shopping cart so that it loads quicker (people are less likely to click the submit 
button more than once).

Can anyone suggest a solution?

Thanks in advance for any help.

Regards,

Derek


**********************************************************************************
This e-mail (and any attachment) is intended only for the attention
of the addressee(s). Its unauthorised use, disclosure, storage
or copying is not permitted. If you are not the intended recipient,
please destroy all copies and inform the sender by return e-mail. 
This e-mail (whether you are the sender or the recipient) may be 
monitored, recorded and retained by Business Information 
Publications Limited (BiP). E-mail monitoring/ blocking software 
may be used, and e-mail content may be read at any time.You 
have a responsibility to ensure laws are not broken when composing 
or forwarding e-mails and their contents.
**********************************************************************************

--- End Message ---
--- Begin Message ---
Hi all,

I'm looking to find out how to create a file using php & using the date & 
time as it's filename.

Can somebody please help me?
Kevin


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

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

Something like this ...?

$time = time();         // UNIX timestamp
$filename = $time . ".txt";
$string = "your content here";

$file = fopen("$filename","w");
fputs($file,$string);

fclose($file);

Michael




On Mon, 26 Nov 2001, Kevin Garrett wrote:

> Hi all,
> 
> I'm looking to find out how to create a file using php & using the date & 
> time as it's filename.
> 
> Can somebody please help me?
> Kevin
> 
> 
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
> 
> 
> 

-- 
################################
Michael Hall
[EMAIL PROTECTED]
[EMAIL PROTECTED]
http://openlearningcommuntiy.org


--- End Message ---
--- Begin Message ---
hi all,

i need to unset a session cookie, i foud out header("Set-Cookie:"); does not
work for a php session (http://bugs.php.net/bug.php?id=14227)

request for clue...

with kind regards,
Joffrey van Wageningen

--- End Message ---
--- Begin Message ---
Thanx for all the explanations, it did help quite a bit, although I don't
have a use for a class yet, I might just use one to see how it works, and
when to use it, and when not to use it.
Regards

Rudi Ahlers

----- Original Message -----
From: "Christopher William Wesley" <[EMAIL PROTECTED]>
To: "Rudi Ahlers" <[EMAIL PROTECTED]>
Cc: "PHP General" <[EMAIL PROTECTED]>
Sent: Sunday, November 25, 2001 1:28 PM
Subject: Re: [PHP] Classes


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.  <Insert a couple semesters of theory
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.
</ramble>

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



--- End Message ---
--- Begin Message ---
I want to know where can i find a script that will allow a user to login
every certain time period! 
I just cant get it right!
--- End Message ---
--- Begin Message ---

If you want to stop people logging on more than every, say, 24 hours, you
could record the most recent log-on time in a database and then check that
24hrs has passed before another log-on is allowed.

I don't know where you can find a script that does this exactly, but it
wouldn't be hard to hack one up.

Michael

On Mon, 26 Nov 2001, De Necker Henri wrote:

> I want to know where can i find a script that will allow a user to login
> every certain time period! 
> I just cant get it right!
> 
> 

-- 
################################
Michael Hall
[EMAIL PROTECTED]
[EMAIL PROTECTED]
http://openlearningcommuntiy.org


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

>I want to know where can i find a script that will allow a user to login
>every certain time period!
>I just cant get it right!

Check www.hotscripts.com
Dunno if something exists but you could build one yourself or modify an 
existing script..

Bye,



B.

--- End Message ---
--- Begin Message ---
How would I be able to change a variable from the input in a checkbox? I
need to write an sms script, that would be able to sms to three different
providers, and I only want the use to type in the phone number. Thus, if he
types in 083xxxxxxxxxx, it should goto provider 1, if he types in
082xxxxxxxxxx, it should goto provider 2, and if he types in 084xxxxxxxxxx,
it should goto provider 3. I have a simple mail script, with $phone for the
phone number variable, and this is the one that needs to change.

Rudi Ahlers
UNIX Specialist and Web Developer
Bonzai Web Design - http://www.bonzai.org.za
Cell: 082 926 1689


--- End Message ---
--- Begin Message ---
At 02:04 PM 11/26/2001 +0200, Rudi Ahlers wrote:
>How would I be able to change a variable from the input in a checkbox? I
>need to write an sms script, that would be able to sms to three different
>providers, and I only want the use to type in the phone number. Thus, if he
>types in 083xxxxxxxxxx, it should goto provider 1, if he types in
>082xxxxxxxxxx, it should goto provider 2, and if he types in 084xxxxxxxxxx,
>it should goto provider 3. I have a simple mail script, with $phone for the
>phone number variable, and this is the one that needs to change.
>
>Rudi Ahlers
>UNIX Specialist and Web Developer
>Bonzai Web Design - http://www.bonzai.org.za
>Cell: 082 926 1689

Rudi,

Try this -  a function definition, followed by where I use it further down the
page.

Miles

// is_checked
// preserves status of previous selection of radio buttons or checkboxes
// when page redisplays by inserting "checked" into appropriate line of 
option group
// used in a group of radio buttons or checkboxes.
// usage: is_checked( $radio_val == 'open')
// CQA Consulting 2000
//
function is_checked( $opt_expression )
{
         if( $opt_expression )
         {
                 $retval = "checked";
         }
         else
         {
                 $retval = "";
         }
         echo $retval;
}
//end of function is_checked

And then further down the page, in a form, these radio buttons:

<td >Display:</td>
<td ><input type="radio" name="AuctionChoice" value = "open" <? is_checked( 
$AuctionChoice=='open') ?> > Open </td>
<td ><input type="radio" name="AuctionChoice" value = "closed" <? 
is_checked( $AuctionChoice=='closed') ?> > Closed  </td>
<td ><input type="radio" name="AuctionChoice" value = "both" <? is_checked( 
$AuctionChoice=='both') ?>  > Both </td>

The use of "checked" is not good terminology, because it implies a 
checkbox. You can replace AuctionChoice with PhoneChoice, and "open ... 
both" with your phone numbers or ISP id's and you're off to the races.

Now these next bits are out of sequence. They properly belong between the 
function definition and the display fragment, but are inserted here so you 
can see how I use the $AuctionChoice when it is read when the page is 
reloaded. It's used to build up a WHERE clause for a SELECT.

         switch( $AuctionChoice )
    {
         case "open":
                 $auction_where = " lOnAuction = 1" ;
                 break;
         case "closed":
                 $auction_where = " lOnAuction = 0 ";
                 break;
         default:
                 unset( $auction_where);
    }

and there is also a choice coming from a combo box, which returns a string 
representing a class, hence $class_where,  used like so:

    // where clause fragment for the chosen class
    if( $ClassChoice )
    {
         $class_where = " nClass = $ClassChoice ";
    }

The WHERE condition for the select is put together like this:

    // assemble the _where clause fragments into a
    // coherent WHERE condition
    if( $auction_where && $class_where )
    {
         $sql_where = " WHERE $auction_where AND $class_where ";
    }
    elseif( $auction_where)
    {
         $sql_where = " WHERE $auction_where ";
    }
    elseif( $class_where )
    {
         $sql_where = " WHERE $class_where ";
    }
         // now put the select statement together, test for results and 
display accordingly
         $sql = "SELECT * FROM item $sql_where order by cItemId";

There's probably someone on the list who can do it with fewer lines, but I 
find this clear, and it accommodates all my conditions, and if no choices 
are made $sql_where does not exist and the SELECT is still valid. I still 
find the statelessness of web pages strange, how variables just cease to 
exist next time around if you don't explicitly pass them.

If this is overkill, or I missed the mark completely, apologies. Otherwise, 
I hope you find it useful.

Miles Thompson

http://www.cqagroup.ca

--- End Message ---
--- Begin Message ---
Yes, indeed.

BTW, when I compiled PHP with xslt sablot as backend, 
xslt_proceess() was always complaining and failed to make any 
transformation. ("no valid resource" or somthing similar.)
Thus, I removed the other two lines (--with-xslt-sablot --enable-xslt)
and left --with-sablot and now it works.


| On Sat, 2001-11-24 at 20:11, James Green wrote:
| 
| > --with-sablot=shared,/usr \
| 
| Remove that line and it works. Damn. Someone should really document
| these options, --help doesn't help all that much...
| 
| On to my xslt fun...
| 
| jg
| 
| 
| 
| -- 
| 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 ---
Browse the Linux Journal archives. Sometime this year there was an article 
on tunig PGSQL for performance.
Miles Thompson

At 02:45 PM 11/26/2001 +0800, you wrote:
>hi,
>
>for php-db list users, i'm not sure if this is off-topic. please
>inform me if it is.
>
>i'd like to ask anyone who have worked with PostgreSQL
>for any advise on how to optimize its performance.
>i have a database that has a few tables. one of which
>may contain more than 50,000 records in the future.
>
>thanks!
>
>ric
>
>--
>
>==================================================================
>Note: The information contained in this message may be privileged
>and confidential and protected from disclosure. If the reader of
>this message is not the intended recipient, or an employee or agent
>responsible for delivering this to the intended recipient, you are
>hereby notified that any dissemination, distribution or copying of
>this communication is strictly prohibited. If you have received
>this communication in error, please notify us immediately by
>replying to the message and deleting it from your computer.
>Thank you.
>==================================================================
>
>
>--
>PHP Database 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 ---
can anyone recommend a site or discussion list relating to email

I have a form to mail script which sends attachments - it all works if I
have my private email address as the recipient,

however if I use my work email address the mail comes out with no attachment
but displays gobbledigook like-

"Content-type: multipart/mixed;boundary= "cd3b0ec60c75e8454ec2d36d9db1b16e"
Message-Id: <[EMAIL PROTECTED]>Date: Mon, 26 Nov 2001
12:25:31 +0000 (GMT)--cd3b0ec60c75e8454ec2d36d9db1b16eContent-type:
text/plain; charset=us-ascii Content-transfer-encoding: 7bit  Name caspar
[EMAIL PROTECTED] Title text submit Description test
submit --cd3b0ec60c75e8454ec2d36d9db1b16eContent-type:image/gif; name="text
submit"
Content-transfer-encod

If i forward my work email to my private email then the emaiul is fine-

is this a script error, a mail server/ isp error, local mail server error

any ideas thanks in advance



--- End Message ---
--- Begin Message ---
looks like your email client at work is not capable of handling the image
(.gif) attachments. check in the help secion of your email client.
HTH
----- Original Message -----
From: "Caspar Kennerdale" <[EMAIL PROTECTED]>
To: "Php-General" <[EMAIL PROTECTED]>
Sent: Monday, November 26, 2001 8:16 AM
Subject: [PHP] email info


> can anyone recommend a site or discussion list relating to email
>
> I have a form to mail script which sends attachments - it all works if I
> have my private email address as the recipient,
>
> however if I use my work email address the mail comes out with no
attachment
> but displays gobbledigook like-
>
> "Content-type: multipart/mixed;boundary=
"cd3b0ec60c75e8454ec2d36d9db1b16e"
> Message-Id: <[EMAIL PROTECTED]>Date: Mon, 26 Nov
2001
> 12:25:31 +0000 (GMT)--cd3b0ec60c75e8454ec2d36d9db1b16eContent-type:
> text/plain; charset=us-ascii Content-transfer-encoding: 7bit  Name caspar
> [EMAIL PROTECTED] Title text submit Description test
> submit --cd3b0ec60c75e8454ec2d36d9db1b16eContent-type:image/gif;
name="text
> submit"
> Content-transfer-encod
>
> If i forward my work email to my private email then the emaiul is fine-
>
> is this a script error, a mail server/ isp error, local mail server error
>
> any ideas thanks in advance
>
>
>
>
> --
> 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 ---
The thing is that you can send and receive attachments perfectly if you send
directly from an email client such as outlook or webbased mail such as
hotmail.

I have attached my script below

<?php

//function send_mail(){

        global $mail_to, $mail_name, $mail_email, $mail_title, $mail_description,
$attachment;

        //$mail_to = "[EMAIL PROTECTED]";
        $mail_to = "[EMAIL PROTECTED]";
        $mail_subject = "Photo Sent To Tourist";
        $attachment_size = filesize($attachment);


        // Response seen by User

        echo    "<img src=\"../tourist/thankyou.gif\">";

        $mail_boundary =  md5(uniqid(time()));

        $mail_headers .= "From: [EMAIL PROTECTED] \n";
        $mail_headers .= "MIME-Version: 1.0\r\n";
        $mail_headers .= "Content-type: multipart/mixed;";
        $mail_headers .= "boundary= \"$mail_boundary\"";
        $mail_headers .= "\r\n\r\n";

        $new_mail_body .= "--$mail_boundary\n";
        $new_mail_body .= "Content-type: text/plain; charset=us-ascii\r\n";
        $new_mail_body .= "Content-transfer-encoding: 7bit\r\n\r\n";
        $new_mail_body .= "Name ".$mail_name;
        $new_mail_body .= "\r\n";
        $new_mail_body .= "Email ".$mail_email;
        $new_mail_body .= "\r\n";
        $new_mail_body .= "Title ".$mail_title;
        $new_mail_body .= "\r\n";
        $new_mail_body .= "Description ".$mail_description;
        $new_mail_body .= "\r\n";

        if (!$attachment_size){
        NULL;
        }else{

        $new_mail_body .= "--$mail_boundary\n";
        $fp = fopen($attachment, "r");
        $file = fread ($fp, filesize ($attachment));
        $file = chunk_split(base64_encode($file));

        $mime_type ="image/gif";

        $new_mail_body .= "Content-type:$mime_type; name=\"$mail_title\"\r\n";
        $new_mail_body .= "Content-transfer-encoding:base64\r\n\r\n";
        $new_mail_body .= $file;
        $new_mail_body .= "\r\n\r\n";

}

        $new_mail_body .= "--$mail_boundary--";
        return mail($mail_to , $mail_subject, $new_mail_body, $mail_headers);

?>


-----Original Message-----
From: R'twick Niceorgaw [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 26, 2001 14:42
To: Caspar Kennerdale; Php-General
Subject: Re: [PHP] email info


looks like your email client at work is not capable of handling the image
(.gif) attachments. check in the help secion of your email client.
HTH
----- Original Message -----
From: "Caspar Kennerdale" <[EMAIL PROTECTED]>
To: "Php-General" <[EMAIL PROTECTED]>
Sent: Monday, November 26, 2001 8:16 AM
Subject: [PHP] email info


> can anyone recommend a site or discussion list relating to email
>
> I have a form to mail script which sends attachments - it all works if I
> have my private email address as the recipient,
>
> however if I use my work email address the mail comes out with no
attachment
> but displays gobbledigook like-
>
> "Content-type: multipart/mixed;boundary=
"cd3b0ec60c75e8454ec2d36d9db1b16e"
> Message-Id: <[EMAIL PROTECTED]>Date: Mon, 26 Nov
2001
> 12:25:31 +0000 (GMT)--cd3b0ec60c75e8454ec2d36d9db1b16eContent-type:
> text/plain; charset=us-ascii Content-transfer-encoding: 7bit  Name caspar
> [EMAIL PROTECTED] Title text submit Description test
> submit --cd3b0ec60c75e8454ec2d36d9db1b16eContent-type:image/gif;
name="text
> submit"
> Content-transfer-encod
>
> If i forward my work email to my private email then the emaiul is fine-
>
> is this a script error, a mail server/ isp error, local mail server error
>
> any ideas thanks in advance
>
>
>
>
> --
> 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 ---
Hi !

I work with someone who use ASP :-(( ...
Is someone could translate this function to ASP ??
I don't think it's hard, but when you don't know ASP...

function encrypt($str)
{
global $STRCRYPT;

$i = strlen($str);
$newstr="";
for ($j=0;$j<$i;$j++)
{
$car = substr($str,$j,1);
$car = ord($car);
$car = $car + ord(substr($STRCRYPT,$j,1));
$car = sprintf("%03d",$car);
$newstr.=$car;
}
return $newstr;
}



----------------------------------------------------------------
EuroVox
4, place Félix Eboue
75583 Paris Cedex 12
Tel : 01 44 67 05 05
Fax : 01 44 67 05 19
Web : http://www.eurovox.fr
----------------------------------------------------------------

--- End Message ---
--- Begin Message ---
This is a PHP mailing list, I doubt you'll find anyone who knows, or wants to 
know ASP.  Why not use PHP for this, and dump ASP (along with the slow, 
bug-ridden webserver it runs on [unless you're using Apache::ASP])?  

On 26 November 2001 9:00, Jean-Arthur Silve wrote:
> Hi !
>
> I work with someone who use ASP :-(( ...
> Is someone could translate this function to ASP ??
> I don't think it's hard, but when you don't know ASP...
>
> function encrypt($str)
> {
> global $STRCRYPT;
>
> $i = strlen($str);
> $newstr="";
> for ($j=0;$j<$i;$j++)
> {
> $car = substr($str,$j,1);
> $car = ord($car);
> $car = $car + ord(substr($STRCRYPT,$j,1));
> $car = sprintf("%03d",$car);
> $newstr.=$car;
> }
> return $newstr;
> }
>
>
>
> ----------------------------------------------------------------
> EuroVox
> 4, place Félix Eboue
> 75583 Paris Cedex 12
> Tel : 01 44 67 05 05
> Fax : 01 44 67 05 19
> Web : http://www.eurovox.fr
> ----------------------------------------------------------------

-- 
Casey Allen Shobe
[EMAIL PROTECTED]
GCS/CM d+ s+:->+: a-- C++(++++) ULU++++$ P- L+++>++++ E- W++ N++ !o K- w-- !O
M V- PS++ PE Y+ PGP>++ t+ 5+ X R>+ tv-- b++ DI+ D---- G++ e h-(*) r--- z--
--- End Message ---
--- Begin Message ---
Oh really?  I know ASP, PHP, ColdFusion and a few others.  You really 
shouldn't make such global statements... just because you don't know ASP 
doesn't mean it's not a viable tool, nor is it a good idea as a web 
developer to lock yourself into one singular technology.  Knowing more than 
one makes you a bit more marketable.

Here's your Encrypt function in ASP, the only difference being I passed the 
encryption key in while in the PHP counterpart it was a GLOBAL.  You can 
make it a global type of variable in your ASP too.

function Encrypt( strEncryptThis, strEncryptionKey)
         dim i
         dim strNewString
         dim strCurChar

         for i = 1 to Len( strEncryptThis )
                 strCurChar = Asc( Mid( strEncryptThis, i, 1 ))
                 strCurChar = strCurChar + Asc( Mid( strEncryptionKey, i, 1))
                 strNewString = strNewString & strCurChar
         next

         Encrypt = strNewString
end function

At 09:24 AM 11/26/2001 -0500, Casey Allen Shobe wrote:
>This is a PHP mailing list, I doubt you'll find anyone who knows, or wants to
>know ASP.  Why not use PHP for this, and dump ASP (along with the slow,
>bug-ridden webserver it runs on [unless you're using Apache::ASP])?
>
>On 26 November 2001 9:00, Jean-Arthur Silve wrote:
> > Hi !
> >
> > I work with someone who use ASP :-(( ...
> > Is someone could translate this function to ASP ??
> > I don't think it's hard, but when you don't know ASP...
> >
> > function encrypt($str)
> > {
> > global $STRCRYPT;
> >
> > $i = strlen($str);
> > $newstr="";
> > for ($j=0;$j<$i;$j++)
> > {
> > $car = substr($str,$j,1);
> > $car = ord($car);
> > $car = $car + ord(substr($STRCRYPT,$j,1));
> > $car = sprintf("%03d",$car);
> > $newstr.=$car;
> > }
> > return $newstr;
> > }
> >
> >
> >
> > ----------------------------------------------------------------
> > EuroVox
> > 4, place Félix Eboue
> > 75583 Paris Cedex 12
> > Tel : 01 44 67 05 05
> > Fax : 01 44 67 05 19
> > Web : http://www.eurovox.fr
> > ----------------------------------------------------------------
>
>--
>Casey Allen Shobe
>[EMAIL PROTECTED]
>GCS/CM d+ s+:->+: a-- C++(++++) ULU++++$ P- L+++>++++ E- W++ N++ !o K- w-- !O
>M V- PS++ PE Y+ PGP>++ t+ 5+ X R>+ tv-- b++ DI+ D---- G++ e h-(*) r--- z--
>
>--
>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 ---
Thank for your help !

At 08:08 26/11/01 -0700, JSheble wrote:
>Oh really?  I know ASP, PHP, ColdFusion and a few others.  You really 
>shouldn't make such global statements... just because you don't know ASP 
>doesn't mean it's not a viable tool, nor is it a good idea as a web 
>developer to lock yourself into one singular technology.  Knowing more 
>than one makes you a bit more marketable.
>
>Here's your Encrypt function in ASP, the only difference being I passed 
>the encryption key in while in the PHP counterpart it was a GLOBAL.  You 
>can make it a global type of variable in your ASP too.
>
>function Encrypt( strEncryptThis, strEncryptionKey)
>         dim i
>         dim strNewString
>         dim strCurChar
>
>         for i = 1 to Len( strEncryptThis )
>                 strCurChar = Asc( Mid( strEncryptThis, i, 1 ))
>                 strCurChar = strCurChar + Asc( Mid( strEncryptionKey, i, 1))
>                 strNewString = strNewString & strCurChar
>         next
>
>         Encrypt = strNewString
>end function
>
>At 09:24 AM 11/26/2001 -0500, Casey Allen Shobe wrote:
>>This is a PHP mailing list, I doubt you'll find anyone who knows, or wants to
>>know ASP.  Why not use PHP for this, and dump ASP (along with the slow,
>>bug-ridden webserver it runs on [unless you're using Apache::ASP])?
>>
>>On 26 November 2001 9:00, Jean-Arthur Silve wrote:
>> > Hi !
>> >
>> > I work with someone who use ASP :-(( ...
>> > Is someone could translate this function to ASP ??
>> > I don't think it's hard, but when you don't know ASP...
>> >
>> > function encrypt($str)
>> > {
>> > global $STRCRYPT;
>> >
>> > $i = strlen($str);
>> > $newstr="";
>> > for ($j=0;$j<$i;$j++)
>> > {
>> > $car = substr($str,$j,1);
>> > $car = ord($car);
>> > $car = $car + ord(substr($STRCRYPT,$j,1));
>> > $car = sprintf("%03d",$car);
>> > $newstr.=$car;
>> > }
>> > return $newstr;
>> > }
>> >
>> >
>> >
>> > ----------------------------------------------------------------
>> > EuroVox
>> > 4, place Félix Eboue
>> > 75583 Paris Cedex 12
>> > Tel : 01 44 67 05 05
>> > Fax : 01 44 67 05 19
>> > Web : http://www.eurovox.fr
>> > ----------------------------------------------------------------
>>
>>--
>>Casey Allen Shobe
>>[EMAIL PROTECTED]
>>GCS/CM d+ s+:->+: a-- C++(++++) ULU++++$ P- L+++>++++ E- W++ N++ !o K- w-- !O
>>M V- PS++ PE Y+ PGP>++ t+ 5+ X R>+ tv-- b++ DI+ D---- G++ e h-(*) r--- z--
>>
>>--
>>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]

----------------------------------------------------------------
EuroVox
4, place Félix Eboue
75583 Paris Cedex 12
Tel : 01 44 67 05 05
Fax : 01 44 67 05 19
Web : http://www.eurovox.fr
----------------------------------------------------------------

--- End Message ---
--- Begin Message ---
Ooops...

I'm just ging mad about a function to recursively scan a directory tree.
Maybe I'm just too stupid, maybe it's just because today is monday, but I
don't get this ******** managed.

Has anybody got a code sniplet the runs from $currentDir recursively through
all directories, does something with all files found there and stops after
returning to the starting directory?

Phew... Would be great, I'm kind of in a hurry...

Cheers,

Kiko

-----
It's not a bug, it's a feature.
christoph starkmann
mailto:[EMAIL PROTECTED]
http://www.fh-augsburg.de/~kiko
ICQ: 100601600
-----
--- End Message ---
--- Begin Message ---
This ought to do what you want:


<?php
function dir_print($dir) {
        chdir($dir);
        $dh = opendir($dir);
        while($fname = readdir($dh)) {
                if($fname!='.' && $fname!='..') {
                        if(is_dir($fname)) {
                                dir_print($dir.'/'.$fname);
                                } else {
                                echo "$dir/$fname<br>";
                                }
                        }
                }
        closedir($dh);
        }

dir_print("/home/hmarq");
?>
                        
Caveats:

It's unix style slashes --
Does no error checking -- perms in particular

Hank
On Mon, Nov 26, 2001 at 04:15:45PM +0100, Christoph Starkmann wrote:
> Ooops...
> 
> I'm just ging mad about a function to recursively scan a directory tree.
> Maybe I'm just too stupid, maybe it's just because today is monday, but I
> don't get this ******** managed.
> 
> Has anybody got a code sniplet the runs from $currentDir recursively through
> all directories, does something with all files found there and stops after
> returning to the starting directory?
> 
> Phew... Would be great, I'm kind of in a hurry...
> 
> Cheers,
> 
> Kiko
> 
> -----
> It's not a bug, it's a feature.
> christoph starkmann
> mailto:[EMAIL PROTECTED]
> http://www.fh-augsburg.de/~kiko
> ICQ: 100601600
> -----
> 
> -- 
> 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
--- End Message ---
--- Begin Message ---
Anyone have an idea, I know there are perl scripts, but I would have to set up Perl 
and other
stuff on my server to do this ... I dont want to.  Does anyone know where the access 
log
reader/displayer can be found.

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

Reply via email to