php-general Digest 3 Dec 2002 13:41:08 -0000 Issue 1741

Topics (messages 126791 through 126846):

Re: dynamic arraynames
        126791 by: Floyd Baker

Re: printing array
        126792 by: . Edwin
        126793 by: Matt

Re: IIS 5
        126794 by: . Edwin

Validating get and post data
        126795 by: Beth Gore
        126802 by: Matt
        126803 by: . Edwin
        126804 by: John W. Holmes
        126806 by: . Edwin
        126822 by: Tom Rogers
        126825 by: Tom Rogers
        126833 by: Ford, Mike               [LSS]

Re: PHP --with-dbm enabled???
        126796 by: . Edwin

Need advice on downloading files and databases
        126797 by: Dara Dowd
        126819 by: Jason Wong

PHP and the PDFlib
        126798 by: Ryan Smaglik
        126799 by: Morgan Hughes
        126807 by: Marco Tabini

Re: Browser going to page twice?
        126800 by: Leif K-Brooks

Comment Threading
        126801 by: Beth Gore
        126818 by: Philip Hallstrom

How to handle "so called" expired sessions??
        126805 by: Gerard Samuel
        126820 by: Tom Rogers
        126823 by: Gerard Samuel

[JOB] Senior Developer (PHP/Perl/Java/SQL), Washington DC Area
        126808 by: Alok K. Dhir

Re: PDF Help Please
        126809 by: Larry Brown

Can't get this right
        126810 by: John Taylor-Johnston

hiding php
        126811 by: Larry Brown
        126812 by: Peter Houchin
        126813 by: Rasmus Lerdorf
        126816 by: Justin French
        126821 by: Larry Brown
        126824 by: Jason Wong
        126827 by: Serge A.
        126830 by: Dan Hardiker
        126834 by: Ford, Mike               [LSS]
        126840 by: Dan Hardiker

Re: Show Folder Contents in Form
        126814 by: . Nilaab

easiest way to get 1st and last dates of the month?
        126815 by: Justin French
        126817 by: Justin French
        126832 by: Ford, Mike               [LSS]

Does using msql_select_db excessively burn resources?
        126826 by: Rob Paxon

Re: Date problem
        126828 by: James Coates
        126835 by: Jason Wong

Pear vs Phplib vs adodb
        126829 by: David Eisenhart

object method overloading
        126831 by: Javier Montserat

writing to mysql using php
        126836 by: Shams

does anybody know PHPlib's source site?
        126837 by: Alexander A. Savenkov

Problem: Only 1 fsockopen() connection for apache at a time.
        126838 by: William Bailey

mail with CC and BCC
        126839 by: Alain ROMERO
        126843 by: Jason Wong

Re: php5 features?
        126841 by: Brad Young

[SEMI-OT] Making secure flash high scoring?
        126842 by: Leif K-Brooks

variable num of function args
        126844 by: christian haines
        126845 by: christian haines

need advice on template engine
        126846 by: Alexander A. Savenkov

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 want to thank everyone and tell how it finally came out...

I was making way to much of this and went into difficult concepts too
quickly.  That's where the problem came from.  Trying to build on
earlier mistakes.   

We already had an array for the column names so a suggestion that I
use one single array for all the data columns works out the best.
Now I'm unwinding that one long array according to how many name
fields there are in each row.  As each process is done, the fields are
there in the original column order, no matter how big the x-y grid is.

The data from the 'basic' column arrays is also going to be included
in the single array too.

I'm not a wiz by any means so creating the best application 'method'
can be rough no matter what I know about the individual functions.
The *single* array just never dawned on me.  Thanks for the help...
:-)  

Floyd 













On Fri, 29 Nov 2002 11:47:56 -0000, you wrote:

>> -----Original Message-----
>> From: Floyd Baker [mailto:[EMAIL PROTECTED]]
>> Sent: 28 November 2002 17:09
> 
>OK, I think I'm finally beginning to understand what you're up to, and it seems to me 
>everyine's been making rather heavy weather of it so far!
>
>> The user's choice is made from a drop down list of available items,
>> prior to running the routine itself.  The choices are predetermined
>> and kept in a personal table to be called by the routine.  This part
>> is finished to the point of putting the needed column names at the top
>> of the input columns on the form.  The choices are fixed spellings to
>> match formula if-then's, etc.
>
>If this is the case, couldn't you use 2-dimensional arrays with the column names as 
>the first dimension, and the values relating to it in the second dimension?
>
>So you'd have something like 
>
>  $user['colour'][0]   $user['hobby'][0]   $user['etc'][0]
>  $user['colour'][1]   $user['hobby'][1]   $user['etc'][1]
>  $user['colour'][2]   $user['hobby'][2]   $user['etc'][2]
>  $user['colour'][3]   $user['hobby'][3]   $user['etc'][3]
>
>etc.
>
>Anyway, going back to your forms:
>
>> >if ($start_button=="1")
>> > {
>> > print "<form action=$PHP_SELF method=get>";
>> > print "Input the following information";
>> > // these are your fixed cells and they now contain user input
>> >   print "Name: <input type=text name=name value=\"$name\" 
>> size=20><br>";
>> >   print "Temp: <input type=text name=temp value=\"$temp\" 
>> size=20><br>";
>> >   print "Time: <input type=text name=time value=\"$time\" 
>> size=20><br>";
>> >   print "Offset: <input type=text name=offset value=\$offset\"
>> >size=20><br>";
>> > print "Input the names of the desired additional cells in the spaces
>> >provided.";
>> > // this is where your user will name the cells he asked to create
>> > for($i=1;$i<=$additional_cells;$i++)
>> >  {
>> >  print "$i <input type=text name=user_added[$i] size=20><br>";
>> >  }
>
>OK, this looks good -- it will give you your array of column names.   But you really 
>should quote all those attributes, so:
>
>  print "$i <input type=\"text\" name=\"user_added[$i]\" size=\"20\"><br>";
>
>The next bit is where I'd do the clever stuff to build the 2-dimensional array:
>
>> >> Name          Temp      Time      Offset    Etc.      As needed...
>> >> process 1    [input]   [input]   [input]   [input]   [inputs]
>> >> process 2    [input]   [input]   [input]   [input]   [inputs]
>> >> process 3    [input]   [input]   [input]   [input]   [inputs]
>> >> process 4    [input]   [input]   [input]   [input]   [inputs]
>> >>
>> >> Right now, for the three *basic* columns, I have the lines 
>> below in a
>> >> 'while' loop.
>> >>
>> >> <INPUT TYPE='text' NAME='temp[]' VALUE='$temp' SIZE='10'
>> >> MAXLENGTH='10'>
>> >> <INPUT TYPE='text' NAME='time[]' VALUE='$time' SIZE='10'
>> >> MAXLENGTH='10'>
>> >> <INPUT TYPE='text' NAME='offs[]' VALUE='$offs' SIZE='10'
>> >> MAXLENGTH='10'>
>
>So, you just need additional lines in your while loop to add the entries for the user 
>columns, named in such a way that you'll get back the 2-dimensional array I described 
>earlier.  As you already have those column namers in the $user_added[] array built 
>above, we can do it like this:
>
>      foreach ($user_added as $user_col):
>        echo "<input type='text' name=\"user['$user_col'][]\" size='10' 
>maxlength='10'>";
>      endforeach;
>
>and, bingo, you have your user's input being submitted into a 2-dimensional array 
>indexable by column name and row number.
>
>(Actually, to be absolutely sure all the row numbers match, I'd be outputting those 
>into the form field names as well.)
>
>Additionally, having gone this far I'd consider doing the same sort of thing with 
>your standard columns, something like this:
>
>   $std_cols = array('temp', 'time', 'offs');
>
>   // now fill the $user_added[] array from database or wherever
>
>   echo "<form ......>";
>
>   
>   for ($n=0; $n<ROWS_NEEDED; $n++):
>
>      foreach ($std_cols as $col_id):
>         echo "<input type='text' name=\"$col_id[$n]\" size='10' ....>";
>      endforeach;
>
>      foreach ($user_added as $col_id):
>         echo "<input type='text' name=\"user['$col_id'][$n]\" size='10' ....>";
>      endforeach;
>
>   endfor;
>
>You could even 2-dimensionalize your standard columns, so you get:
>
>   $std['temp'][0]   $std['time'][0]   $std['offs'][0]
>   $std['temp'][1]   $std['time'][1]   $std['offs'][1]
>
>etc., with the corresponding form fields being written using:
>
>      foreach ($std_cols as $col_id):
>         echo "<input type='text' name=\"std['$col_id'][$n]\" size='10' ....>";
>      endforeach;
>
>And, then, of course, you might well wonder why you should bother having two separate 
>sets of very similar arrays, when you could merge them and just keep track of how 
>many are standard ones (with the rest automatically treated as user added ones). So 
>you'd start off something like:
>
>   $cols = array('temp', 'time', 'offs');
>   define('N_STD_COLS', 3);
>
>and build from there -- but I leave that as an exercise for the reader!!!
>
>Cheers!
>
>Mike
>
>---------------------------------------------------------------------
>Mike Ford,  Electronic Information Services Adviser,
>Learning Support Services, Learning & Information Services,
>JG125, James Graham Building, Leeds Metropolitan University,
>Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
>Email: [EMAIL PROTECTED]
>Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 
>
>
>
>
>   

--

--- End Message ---
--- Begin Message ---
Hello,

"empty" <[EMAIL PROTECTED]> wrote:

> Hi
> <?php
> $stra=("aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll");
> $splited = array();
> $splited = split(",",$stra);
> $c=count($splited);
> for($i=0 ; $i<$c ; $i+=2){
>         echo "$splited[$i]";
>         echo "$splited[$i+1]";  // *****error is here******** >
> //Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
expecting ']' in D:\sites\c\htemp.php on line 12
>         echo "<br>"
> }
> ?>
>
> I want to see on the screen is that
> aabb
> ccdd
> eeff
> gghh
> iijj
> kkll
>
> but the code above says wrong :(

Try incrementing $i outside:

  for($i=0 ; $i<$c ; $i++){
    echo "$splited[$i]";
    $i++;
    echo "$splited[$i]";
    echo "<br>";
  }

HTH,

- E

PS
BTW, notice the $i++ on the top as well.

And also, the semi-colon after "<br>"--you'll get a "parse error" again :)

--- End Message ---
--- Begin Message ---
----- Original Message -----
From: "empty" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 02, 2002 8:08 PM
Subject: [PHP] printing array


> Hi
> <?php
> $stra=("aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll");
> $splited = array();
> $splited = split(",",$stra);
> $c=count($splited);
> for($i=0 ; $i<$c ; $i+=2){
>         echo "$splited[$i]";
>         echo "$splited[$i+1]";  // *****error is here******** >

You can do (at least) two things here to resolve that error:
1. If you really want the double quotes:
echo "{$splited[$i+1]}";  // curly braces help resolve the arrary reference
in double quoted strings.
2. Drop the double quotes:
echo $splited[$i+1];

> //Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
expecting ']' in D:\sites\c\htemp.php on line 12
>         echo "<br>"
> }
> ?>
>
> I want to see on the screen is that
> aabb
> ccdd
> eeff
> gghh
> iijj
> kkll
>
> but the code above says wrong :(
>
> Can you help me?
> Thanks everybody.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>


--- End Message ---
--- Begin Message ---
Hello,

"Chris Edwards" <[EMAIL PROTECTED]> wrote:

> I'm getting "You are not authorized to view this page" when trying to run
> .php files.

You mean plain html files work fine?

> How do I fix this?  I'm running php isapi on iis 5 on w2k
> server.

How did you configure it?

Anyway, it sounds like a permission problem so try checking whether your
server (or the user running as the server) is allowed to read files and
traverse directories that you're trying to access.

Just some ideas,

- E

--- End Message ---
--- Begin Message --- Okay, I've just solved my own problem by simply doing:

settype($input,"integer");

but.. I'm puzzled about why the following more complicated solution didn't work. The ASCII value for 0 is 48, and for 9 is 57.

The idea was to read a character at a time from the $rawinput string, check if it's within the correct range, and if so concantenate it to the end of the output string.

However bizarrely this seems to behave incorrectly, as it cuts out "0" as well. Can anyone explain why it does this?

function stripnum($rawinput)
{

for($x=0;$x < strlen($rawinput);$x++)
{
$c = substr($rawinput,$x,1);

switch($c){

case ($c > chr(47) and $c < chr(58)):
$output .=$c;
break;

default:
echo "escaped character at ".$x;
break;
}

}

return $output;
}


I just can't find the bug in my code at all, and even though I found a better way to do it, it's annoying me that this didn't work!!!

Beth Gore
--
http://bethanoia.dyndns.org/
rss feed: http://bethanoia.dyndns.org/bethanoia.rss

--- End Message ---
--- Begin Message ---
----- Original Message -----
From: "Beth Gore" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 02, 2002 9:12 PM
Subject: [PHP] Validating get and post data


> Okay, I've just solved my own problem by simply doing:
>
> settype($input,"integer");
>
> but.. I'm puzzled about why the following more complicated solution
> didn't work. The ASCII value for 0 is 48, and for 9 is 57.
>
> The idea was to read a character at a time from the $rawinput string,
> check if it's within the correct range, and if so concantenate it to the
> end of the output string.
>
> However bizarrely this seems to behave incorrectly, as it cuts out "0"
> as well. Can anyone explain why it does this?
>
> function stripnum($rawinput)
> {
>
> for($x=0;$x < strlen($rawinput);$x++)
> {
> $c = substr($rawinput,$x,1);
>
> switch($c){
>
> case ($c > chr(47) and $c < chr(58)):
> $output .=$c;
> break;

I think what's happening here is a type issue. The comparison is returning a
boolean, so when $c != '0', the switch is true and the case is resolving to
true, and executing.  But when $c == '0', with switch is (false), but the
case is true.  Change the case to
($c > chr(58) and $c < chr(58)):
pass in '09090' and see what you get.  Perhaps the case isn't the right
structure for this test.

>
> default:
> echo "escaped character at ".$x;
> break;
> }
>
> }
>
> return $output;
> }
>
>
> I just can't find the bug in my code at all, and even though I found a
> better way to do it, it's annoying me that this didn't work!!!
>
> Beth Gore
> --
> http://bethanoia.dyndns.org/
> rss feed: http://bethanoia.dyndns.org/bethanoia.rss
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>


--- End Message ---
--- Begin Message ---
Hello,

"Matt" <[EMAIL PROTECTED]> wrote:

> I think what's happening here is a type issue. The comparison is returning
a
> boolean, so when $c != '0', the switch is true and the case is resolving
to
> true, and executing.  But when $c == '0', with switch is (false), but the
> case is true.  Change the case to
> ($c > chr(58) and $c < chr(58)):
> pass in '09090' and see what you get.  Perhaps the case isn't the right
> structure for this test.

I think you're in the right track.

Running these would produce different results:

---------- script 1 ----------
$s = '0';
switch ($s){
  case ($s > chr(47) && $s < chr(58)):
    echo 'Yehey!';
    break;
  default:
    echo 'Boo!';
}

---------- script 2 ----------
$s = 0;
switch ($s){
  case ($s > chr(47) && $s < chr(58)):
    echo 'Yehey!';
    break;
  default:
    echo 'Boo!';
}

BTW, there's no problem if you use "if...else" clause...

- E

--- End Message ---
--- Begin Message ---
> > I think what's happening here is a type issue. The comparison is
> returning
> a
> > boolean, so when $c != '0', the switch is true and the case is
resolving
> to
> > true, and executing.  But when $c == '0', with switch is (false),
but
> the
> > case is true.  Change the case to
> > ($c > chr(58) and $c < chr(58)):
> > pass in '09090' and see what you get.  Perhaps the case isn't the
right
> > structure for this test.
> 
> I think you're in the right track.
> 
> Running these would produce different results:
> 
> ---------- script 1 ----------
> $s = '0';
> switch ($s){
>   case ($s > chr(47) && $s < chr(58)):
>     echo 'Yehey!';
>     break;
>   default:
>     echo 'Boo!';
> }
> 
> ---------- script 2 ----------
> $s = 0;
> switch ($s){
>   case ($s > chr(47) && $s < chr(58)):
>     echo 'Yehey!';
>     break;
>   default:
>     echo 'Boo!';
> }

I think the problem is just the incorrect use of a switch. If you change
your code to

switch(1)

then it works as it should. You should be using if..elseif for your
style of "cases".

---John Holmes...


--- End Message ---
--- Begin Message ---
"John W. Holmes" <[EMAIL PROTECTED]> wrote:
> I think the problem is just the incorrect use of a switch. If you change
> your code to
> 
> switch(1)

Or,

  switch(true)
 
for that matter...

- E

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

Tuesday, December 3, 2002, 12:12:09 PM, you wrote:
BG> Okay, I've just solved my own problem by simply doing:

BG> settype($input,"integer");

BG> but.. I'm puzzled about why the following more complicated solution 
BG> didn't work. The ASCII value for 0 is 48, and for 9 is 57.

BG> The idea was to read a character at a time from the $rawinput string, 
BG> check if it's within the correct range, and if so concantenate it to the 
BG> end of the output string.

BG> However bizarrely this seems to behave incorrectly, as it cuts out "0" 
BG> as well. Can anyone explain why it does this?

BG> function stripnum($rawinput)
BG>         {

BG>         for($x=0;$x < strlen($rawinput);$x++)
BG>         {
BG>                 $c = substr($rawinput,$x,1);

BG>                 switch($c){

BG>                         case ($c > chr(47) and $c < chr(58)):
BG>                                 $output .=$c;
BG>                                 break;

BG>                         default:
BG>                                 echo "escaped character at ".$x;
BG>                                 break;
BG>                 }

BG>         }

BG>         return $output;
BG> }


BG> I just can't find the bug in my code at all, and even though I found a 
BG> better way to do it, it's annoying me that this didn't work!!!

BG> Beth Gore
BG> --
BG> http://bethanoia.dyndns.org/
BG> rss feed: http://bethanoia.dyndns.org/bethanoia.rss

switch will treat 0 as false which ever way you try to dress it up :)
I solved a similar problem like this:

switch($c){

           case (ord($c) > 47 && ord($c) < 58)?True:False:
                $output .=$c;
           break;

           default:
                echo "escaped character at ".$x;
           break;
}

-- 
regards,
Tom

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

Tuesday, December 3, 2002, 5:17:48 PM, you wrote:
TR> Hi,

TR> Tuesday, December 3, 2002, 12:12:09 PM, you wrote:
BG>> Okay, I've just solved my own problem by simply doing:

BG>> settype($input,"integer");

BG>> but.. I'm puzzled about why the following more complicated solution 
BG>> didn't work. The ASCII value for 0 is 48, and for 9 is 57.

BG>> The idea was to read a character at a time from the $rawinput string, 
BG>> check if it's within the correct range, and if so concantenate it to the 
BG>> end of the output string.

BG>> However bizarrely this seems to behave incorrectly, as it cuts out "0" 
BG>> as well. Can anyone explain why it does this?

BG>> function stripnum($rawinput)
BG>>         {

BG>>         for($x=0;$x < strlen($rawinput);$x++)
BG>>         {
BG>>                 $c = substr($rawinput,$x,1);

BG>>                 switch($c){

BG>>                         case ($c > chr(47) and $c < chr(58)):
BG>>                                 $output .=$c;
BG>>                                 break;

BG>>                         default:
BG>>                                 echo "escaped character at ".$x;
BG>>                                 break;
BG>>                 }

BG>>         }

BG>>         return $output;
BG>> }


BG>> I just can't find the bug in my code at all, and even though I found a 
BG>> better way to do it, it's annoying me that this didn't work!!!

BG>> Beth Gore
BG>> --
BG>> http://bethanoia.dyndns.org/
BG>> rss feed: http://bethanoia.dyndns.org/bethanoia.rss

TR> switch will treat 0 as false which ever way you try to dress it up :)
TR> I solved a similar problem like this:

TR> switch($c){

TR>            case (ord($c) > 47 && ord($c) < 58)?True:False:
TR>                 $output .=$c;
TR>            break;

TR>            default:
TR>                 echo "escaped character at ".$x;
TR>            break;
TR> }

TR> -- 
TR> regards,
TR> Tom

BTW you may find this runs a bit quicker

function stripnum($rawinput)
        {
        $len =  strlen($rawinput);
        $output = '';
        for($x=0;$x < $len;$x++)
        {

                switch($rawinput[$x]){

                        case (ord($rawinput[$x]) > 47 && ord($rawinput[$x]) < 
58)?True:False:
                                $output .= $rawinput[$x];
                                break;

                        default:
                                echo "escaped character at ".$x;
                                break;
                }

        }

        return $output;
}

-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Beth Gore [mailto:[EMAIL PROTECTED]]
> Sent: 03 December 2002 02:12
> 
> However bizarrely this seems to behave incorrectly, as it 
> cuts out "0" 
> as well. Can anyone explain why it does this?
> 
> function stripnum($rawinput)
>       {
> 
>       for($x=0;$x < strlen($rawinput);$x++)
>       {
>               $c = substr($rawinput,$x,1);
> 
>               switch($c){
> 
>                       case ($c > chr(47) and $c < chr(58)):
>                               $output .=$c;
>                               break;
> 
>                       default:
>                               echo "escaped character at ".$x;
>                               break;
>               }
> 
>       }
> 
>       return $output;
> }
> 
> 
> I just can't find the bug in my code at all, 

Well, that's just not the way the switch statement works!  The value of the
expression after each case is compared for equality to the expression after
switch -- so, in this case, you have the equivalent of:

   if ($c == ($c > chr(47) and $c < chr(58)))

and I think you can figure out why that gives the wrong answer!

In fact, switch doesn't work well for this kind of test, as you'd have to
write it as:

   switch ($c):
      case '0':
      case '1':
      case '2':
      case '3':
      case '4':
      case '5':
      case '6':
      case '7':
      case '8':
      case '9':
         $output .= $c;
         break;

      default:
         echo "escaped character at ".$x;
         break;

   endswitch;

You're much better off here with a straight if/else.

Cheers!

Mike

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


--- End Message ---
--- Begin Message ---
Hello,

"Vernon" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm being told that I need to have php compiled --with-dbm and it is not,
> but it is complied --with-db3. Is that the same thing or do I need
> recopile --with-dbm to use the dbmopen() function?

I think you can find the answer here:

  http://www.php.net/manual/en/ref.dba.php

- E
--- End Message ---
--- Begin Message ---
Hello everybody,
        Newbie here...basically I need to develop a site that will allow users to 
download files, e.g
        Word docs, XL sheets, and I would like to know whether it is better to store 
the entire file in a database, 
        or just the filepath, or even whether I need a database at all. Is it possible 
to link to a file on a remote server if the file isn't in the root directory? Any 
advice gratefully received.
        Thanks,Dara
-- 
For the largest free email in Ireland (25MB) & 
File Storage space (20MB), visit http://www.campus.ie

Powered by Outblaze
--- End Message ---
--- Begin Message ---
On Tuesday 03 December 2002 10:33, Dara Dowd wrote:
> Hello everybody,
>       Newbie here...basically I need to develop a site that will allow users to
> download files, e.g Word docs, XL sheets, and I would like to know whether
> it is better to store the entire file in a database, or just the filepath,
> or even whether I need a database at all. 

In general just storing the filepath is best. For the pros and cons search the 
archives, this has been asked and answered many times before, keywords "store 
file in database" (or similar).

> Is it possible to link to a file
> on a remote server if the file isn't in the root directory? 

Yes.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
... My pants just went on a wild rampage through a Long Island Bowling Alley!!
*/

--- End Message ---
--- Begin Message ---
Has anyone found any other means of opening an existing pdf file and adding
text to it?  The only thing I could find is the  PDI + PDFlib commercial
combo which I do not have the $1000 to dish out right now...

Any Ideas? 
--- End Message ---
--- Begin Message ---
On Sun, 1 Dec 2002, Ryan Smaglik wrote:

> Has anyone found any other means of opening an existing pdf file and adding
> text to it?  The only thing I could find is the  PDI + PDFlib commercial
> combo which I do not have the $1000 to dish out right now...
> Any Ideas?

  While the PDFlib/PDI combo is the only way that's actually been stated
  to work...  It bears remembering that PDF files are modified Postscript,
  and tools to convert PDF to/from Postscript do exist.  Perhaps you can
  build something by converting the PDF to PS, which should be text you
  can read and manipulate, then convert back to PDF.  The utilities I'm
  thinking of are ps2pdf and pdf2ps, which seem to be part of the
  Ghostscript package and ship with most Linux distros...

  Hoep this helps!

-- 
   Morgan Hughes
   C programmer and highly caffeinated mammal.
   [EMAIL PROTECTED]
   ICQ: 79293356


--- End Message ---
--- Begin Message ---
Take a look at the iText library--it's a Java library, but you can build
your Java classes and then instantiate them through PHP by executing
them as external apps.

That's what we use to personalize copies of our magazine.


Marco

-- 
------------
php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!

On Sun, 2002-12-01 at 21:58, Ryan Smaglik wrote:
> Has anyone found any other means of opening an existing pdf file and adding
> text to it?  The only thing I could find is the  PDI + PDFlib commercial
> combo which I do not have the $1000 to dish out right now...
> 
> Any Ideas? 


--- End Message ---
--- Begin Message ---
Hmm, nope.  It's now off and it's still doing that.  (I did restart apache)

Morgan Hughes wrote:

On Mon, 2 Dec 2002, Leif K-Brooks wrote:


Yes, I'm using Apache 1.3.22. Mind giving specifics on what to set
those options to? I'm not very great with configuring apache...

Basically, you can have any number of names resolve to the server's IP
address, via DNS or hosts files (/etc/hosts, c:\windows\hosts, or
c:\windows\system32\drivers\etc\hosts). This is especially true if
you're doing virtual hosting on the server.

You use ServerName to tell the server what it's DNS name is, so it
doesn't have to look it up. This may be just one of the several names
you can give the server, but it's the one it will reply with, and the
one it will print out on directory indexes and error messages.

As long as you set UseCanonicalName, the server will use with the
ServerName, or whatever it looked up for its IP address. This may be
different to whatever you accessed it by, so it may redirect you to the
same page with the new name. If you turn off UseCanonicalName, the
server will reply with whatever name you used to contact it, which may
solve this problem.

I almost always run with UseCanonicalName off, on my development
servers... For production servers one doesn't usually have that level
of control... If you can turn it off, try that. I'm not sure it'll
help, but it's worth a try.

Good luck!


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.


--- End Message ---
--- Begin Message --- Hello,

I'm trying to work out how to do some simple comment threading using PHP. I've overridden the blockquote tag in CSS so that it only indents from the left.

At the moment comments are simply displayed in reverse chronological order as all the replies to a particular post.

I just can't get my head around how to do the threading.

I could add an extra column in the comments table, i.e, "repliedto" which would contain the comment ID of the comment the user replied to, but that would seem to require some sort of recursion to check whether or not a comment has a reply, which I'd rather avoid if I can (mainly because I don't think I'm good enough to pull it off)

The other idea would be to have a threadID.. hmm...

table thread: threadID, rootCommmentID, replyCommentID

Then perhaps every time a user replies to a comment, it adds a row to the database?

How can I somehow take the data in the comments and/or thread table and sort an array of comment data which I can then use to layout the page, i.e, adding a different level of indent for each "thread"?

ie:

originalpost
-comment1/thread1(reply to post)

--comment2/thread2(reply to comment1)

---comment3/thread3(reply to comment 2)

----comment3/thread4(reply to comment 3)

--comment5/thread1(reply to comment1)

---comment3/thread5(reply to comment 2)

--comment6/thread2(reply to comment1)

-coment7/thread1(reply to post)

Thanks for any help/examples. I really just can't get my head around it.

Beth Gore
--
http://bethanoia.dyndns.org

--- End Message ---
--- Begin Message ---
Your best bet would be to look at how some of the other apps do it :)
(taking licensing issues into account that is :)

This might help as well.. not sure how efficient it is on a really long
list, but it works for my little stuff...

http://stuff.adhesivemedia.com/php/heirarchial-sorting.php

On Tue, 3 Dec 2002, Beth Gore wrote:

> Hello,
>
> I'm trying to work out how to do some simple comment threading using
> PHP. I've overridden the blockquote tag in CSS so that it only indents
> from the left.
>
> At the moment comments are simply displayed in reverse chronological
> order as all the replies to a particular post.
>
> I just can't get my head around how to do the threading.
>
> I could add an extra column in the comments table, i.e, "repliedto"
> which would contain the comment ID of the comment the user replied to,
> but that would seem to require some sort of recursion to check whether
> or not a comment has a reply, which I'd rather avoid if I can (mainly
> because I don't think I'm good enough to pull it off)
>
> The other idea would be to have a threadID.. hmm...
>
> table thread: threadID, rootCommmentID, replyCommentID
>
> Then perhaps every time a user replies to a comment, it adds a row to
> the database?
>
> How can I somehow take the data in the comments and/or thread table and
> sort an array of comment data which I can then use to layout the page,
> i.e, adding a different level of indent for each "thread"?
>
> ie:
>
> originalpost
> -comment1/thread1(reply to post)
>
> --comment2/thread2(reply to comment1)
>
> ---comment3/thread3(reply to comment 2)
>
> ----comment3/thread4(reply to comment 3)
>
> --comment5/thread1(reply to comment1)
>
> ---comment3/thread5(reply to comment 2)
>
> --comment6/thread2(reply to comment1)
>
> -coment7/thread1(reply to post)
>
> Thanks for any help/examples. I really just can't get my head around it.
>
> Beth Gore
> --
> http://bethanoia.dyndns.org
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message --- Ive just been getting myself deep into using sessions.
Sessions are working as it should except for one condition.
Say I log into the site, and the session is started, and I don't do anything for the next 30 mins, then go back to the site.
Im temporarily logged out, but because the session cookie is still good, the next page load logs me back in.
How do the people who use sessions handle this type of scenario??

Thanks for any insight you may provide...

--
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/


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

Tuesday, December 3, 2002, 1:57:21 PM, you wrote:
GS> Ive just been getting myself deep into using sessions.
GS> Sessions are working as it should except for one condition.
GS> Say I log into the site, and the session is started, and I don't do 
GS> anything for the next 30 mins, then go back to the site.
GS> Im temporarily logged out, but because the session cookie is still good, 
GS> the next page load logs me back in.
GS> How do the people who use sessions handle this type of scenario??

GS> Thanks for any insight you may provide...

GS> -- 
GS> Gerard Samuel
GS> http://www.trini0.org:81/
GS> http://dev.trini0.org:81/


Do your own session timing by storing a last access time in sessions and check
the duration yourself, if it is over the timeout you want delete the session
data and start again. That way the cookie is ok but won't point to any old data.

-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
I had something similar in mind.  Thanks for your input...

Tom Rogers wrote:

Hi,

Tuesday, December 3, 2002, 1:57:21 PM, you wrote:
GS> Ive just been getting myself deep into using sessions.
GS> Sessions are working as it should except for one condition.
GS> Say I log into the site, and the session is started, and I don't do GS> anything for the next 30 mins, then go back to the site.
GS> Im temporarily logged out, but because the session cookie is still good, GS> the next page load logs me back in.
GS> How do the people who use sessions handle this type of scenario??

GS> Thanks for any insight you may provide...

GS> -- GS> Gerard Samuel
GS> http://www.trini0.org:81/
GS> http://dev.trini0.org:81/


Do your own session timing by storing a last access time in sessions and check
the duration yourself, if it is over the timeout you want delete the session
data and start again. That way the cookie is ok but won't point to any old data.


--
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/


--- End Message ---
--- Begin Message ---
We have openings for a couple of experienced web application developers
who meet or exceed the following criteria:

Required skills (You *must* have 2.5+ years of each):

        - Large scale applications development on Unix/Linux platform
        - PHP
        - Perl
        - SQL (Oracle, MySQL preferred)
        - D/HTML/CSS
        - Javascript
        - XML
        - OO programming
        - Source code control (CVS)

Desired skills:

        - SOAP
        - WSDL
        - UDDI
        - Java/JSP
        - Linux/Unix
        - Windows NT/2000/XP
        - Python
        - C/C++

Plusses:

        - UML
        - RUP
        - understanding of various software development methodologies
        - ability to work under pressure
        - leadership ability

If you meet the requirements above, and are interested in working on
exciting projects with a strong DC area company, please send a cover
letter and resume with salary requirements to [EMAIL PROTECTED] 


Thanks, 

Alok K. Dhir
[EMAIL PROTECTED]
Symplicity Corporation
http://solutions.symplicity.com/

--- End Message ---
--- Begin Message ---
I know this is probably a day late and a dollar short but I was curious
myself whether this would be a good outlet to use for reports for a client
and wondered if there was such a thing.  After seeing your post I went to
there site and it looks like you have to have the PDI side to be able to
modify existing ones.  The $1,000.  Was there a reason you thought there was
some other solution?

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388

-----Original Message-----
From: Ryan Smaglik [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 02, 2002 5:14 PM
To: [EMAIL PROTECTED]
Subject: [PHP] PDF Help Please

I need to figure out by tonight how to:
1. open a .pdf file using php.
2. add text to certain parts of it.
3. save it and output to browser.
4. Then delete the temp file so the process can be done over again.

I have PDFlib but not the $1000 PDI addition....

Please help,

Ryan


--- End Message ---
--- Begin Message ---
What am I supposed to be doing with my slashes, exactly? Here is my first post:

http://news.php.net/article.php?group=php.general&article=126754

I can't get this right. I know I have to esacpe my quotes for my SQL to work.

http://news.php.net/article.php?group=php.general&article=126755

PHP addes the slashes all by itself, right? So here is my code:

$sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH
(TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO)
AGAINST (\''.$search.'\' IN BOOLEAN MODE) ORDER BY id asc';

http://ccl.flsh.usherb.ca/print/index.html

echo $sql; gives me this. This is what I thought I needed, but it doesn't work either.

SELECT id,AU,ST,BT,AT FROM ccl_main WHERE MATCH
(TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('\"ready maria\"' 
IN BOOLEAN MODE)
ORDER BY id asc

If I copy & paste, it will work as a SQL in PHPMyAdmin. But it won't in PHP.

Can someone point at what I've done wrong? I've tried addslashes($search).

?? John
--- End Message ---
--- Begin Message ---
This should bump up my popularity here...can you run asp on apache?  The
reason I ask is that I understand you can use a php option to hide the fact
that you are running php.  This sounds like a good idea to keep people
guessing, but I also want to use .asp extensions and have them parsed for
the php tags.  I thought this would be nice if someone wanted to screw with
a site they wouldn't even be trying tools that would apply.  However, if you
can't run asp on apache nobody would be fooled.  Any thoughts?

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388



--- End Message ---
--- Begin Message ---
yes look around for sum thing like chilli soft from sun microsystems, but
it's not free.. i dunno if there is a free one..

> -----Original Message-----
> From: Larry Brown [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, 3 December 2002 4:13 PM
> To: PHP List
> Subject: [PHP] hiding php
>
>
> This should bump up my popularity here...can you run asp on apache?  The
> reason I ask is that I understand you can use a php option to
> hide the fact
> that you are running php.  This sounds like a good idea to keep people
> guessing, but I also want to use .asp extensions and have them parsed for
> the php tags.  I thought this would be nice if someone wanted to
> screw with
> a site they wouldn't even be trying tools that would apply.
> However, if you
> can't run asp on apache nobody would be fooled.  Any thoughts?
>
> Larry S. Brown
> Dimension Networks, Inc.
> (727) 723-8388
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

--- End Message ---
--- Begin Message ---
So change your Apache server string to say IIS instead.  Why tell them you
are using Apache?

On Tue, 3 Dec 2002, Larry Brown wrote:

> This should bump up my popularity here...can you run asp on apache?  The
> reason I ask is that I understand you can use a php option to hide the fact
> that you are running php.  This sounds like a good idea to keep people
> guessing, but I also want to use .asp extensions and have them parsed for
> the php tags.  I thought this would be nice if someone wanted to screw with
> a site they wouldn't even be trying tools that would apply.  However, if you
> can't run asp on apache nobody would be fooled.  Any thoughts?
>
> Larry S. Brown
> Dimension Networks, Inc.
> (727) 723-8388
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Why not just make up an extension, like your initials (.lsb) or your
business name (.dim or .dni), and set-up apache to pipe all those files
through PHP...??

That way they'll have no clue at all (if used in conjunction with the "hide
PHP" stuff, etc etc).


Justin

on 03/12/02 4:13 PM, Larry Brown ([EMAIL PROTECTED]) wrote:

> This should bump up my popularity here...can you run asp on apache?  The
> reason I ask is that I understand you can use a php option to hide the fact
> that you are running php.  This sounds like a good idea to keep people
> guessing, but I also want to use .asp extensions and have them parsed for
> the php tags.  I thought this would be nice if someone wanted to screw with
> a site they wouldn't even be trying tools that would apply.  However, if you
> can't run asp on apache nobody would be fooled.  Any thoughts?
> 
> Larry S. Brown
> Dimension Networks, Inc.
> (727) 723-8388
> 
> 
> 

Justin French
--------------------
http://Indent.com.au
Web Development & 
Graphic Design
--------------------

--- End Message ---
--- Begin Message ---
Because its better to have someone waste time trying known hacks for a
platform I don't have than to have the same person not know the platform and
start spending time figuring out what it is right off the bat.

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388

-----Original Message-----
From: Justin French [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 03, 2002 12:39 AM
To: Larry Brown; PHP List
Subject: Re: [PHP] hiding php

Why not just make up an extension, like your initials (.lsb) or your
business name (.dim or .dni), and set-up apache to pipe all those files
through PHP...??

That way they'll have no clue at all (if used in conjunction with the "hide
PHP" stuff, etc etc).


Justin

on 03/12/02 4:13 PM, Larry Brown ([EMAIL PROTECTED]) wrote:

> This should bump up my popularity here...can you run asp on apache?  The
> reason I ask is that I understand you can use a php option to hide the
fact
> that you are running php.  This sounds like a good idea to keep people
> guessing, but I also want to use .asp extensions and have them parsed for
> the php tags.  I thought this would be nice if someone wanted to screw
with
> a site they wouldn't even be trying tools that would apply.  However, if
you
> can't run asp on apache nobody would be fooled.  Any thoughts?
>
> Larry S. Brown
> Dimension Networks, Inc.
> (727) 723-8388
>
>
>

Justin French
--------------------
http://Indent.com.au
Web Development &
Graphic Design
--------------------


--- End Message ---
--- Begin Message ---
On Tuesday 03 December 2002 15:01, Larry Brown wrote:
> Because its better to have someone waste time trying known hacks for a
> platform I don't have than to have the same person not know the platform
> and start spending time figuring out what it is right off the bat.

In response to your original question, yes you can run asp on apache. 

google -> "asp apache" would have told you the answer is less than 1 second.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
No one can have a higher opinion of him than I have, and I think he's a
dirty little beast.
                -- W.S. Gilbert
*/

--- End Message ---
--- Begin Message ---
> Because its better to have someone waste time trying known hacks for a
> platform I don't have than to have the same person not know the platform
and
> start spending time figuring out what it is right off the bat.


That will not work.. try the following:

telnet yourserve 80

and than type GET / HTTP1.0 and press Enter twice

You'll see the server response which will tell anybody that the server is
Apache and even the operation system it runs at.

Regards,
    Serge


--- End Message ---
--- Begin Message ---
Actually..

You can turn off header responses in both apache and php. Inside the
php.ini you will find:

[ expose_php = Off ]

In the ini-dist its even switched off by default.
In the apache httpd.conf file you can set the following:

[ ServerSignature On ]

I believe you may also find some help in "mod_headers".

In short you can do alot with the configuration to mask what you are
running on what platform. If you are running FreeBSD you can even get it
to emulate the SYN packets (used for TCP operating system fingerprinting)
of alternative OS's (eg: Red Hat [why you would want people to think
you'd run RH, to I dont know] / Solaris).

Questions?

>> Because its better to have someone waste time trying known hacks for a
>> platform I don't have than to have the same person not know the
>> platform and
>> start spending time figuring out what it is right off the bat.
>
> That will not work.. try the following:
>
> telnet yourserve 80
>
> and than type GET / HTTP1.0 and press Enter twice
>
> You'll see the server response which will tell anybody that the server
> is Apache and even the operation system it runs at.


-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative


--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Larry Brown [mailto:[EMAIL PROTECTED]]
> Sent: 03 December 2002 07:02
> 
> Because its better to have someone waste time trying known hacks for a
> platform I don't have than to have the same person not know 
> the platform and
> start spending time figuring out what it is right off the bat.

Well, if you *really* wnat to get hem going, you could send .jsp and .cfm (and any 
others you can think of) through PHP as well!!

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 
--- End Message ---
--- Begin Message ---
>> [Larry Brown]
>> Because its better to have someone waste time trying known hacks for a
>> platform I don't have than to have the same person not know
>> the platform and
>> start spending time figuring out what it is right off the bat.

> [Mike Ford]
> Well, if you *really* wnat to get hem going, you could send .jsp and
> .cfm (and any others you can think of) through PHP as well!!

If your gong down that road, you could use an arbitrary extension to pipe
through php so that at the simplist level (the URL) the technology isnt
misinformed (eg: .cfm as cold fusion), but at a blank completely, eg:

http://your-server.com/some.script

With .script being parsed by php, but the outside world not knowing what
technology you are using behind the scenes. Very simple, yet very
effective way of blindfolding the end user.


-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative


--- End Message ---
--- Begin Message ---
Here is a basic format for the select statement. All you have to do is take
the names of all the files and put them into an array, such as $filename[].
Then you place the file name between the option element using a for loop or
something similar. You will have to place a unique value that identifies
which file has been selected by using the "value" attribute of the <option>
element (which can be the same value as the array values if you want it to
be). When you press the submit button, you will have a variable called
$file_name (which was created from the "name" attribute of the <select>
element) and it will have the value of whatever option was selected from the
form. Then you can do whatever you want with the value found in $file_name.
Sorry, I'm too lazy to write the code tonight, but you have a basic
framework for what you need. Remember, the below is just pseudo-code, so
make sure you see that it cooperates with PHP by printing it out correctly,
adding the correct sets of quotes, etc. Then use a loop of some kind to list
the option data as you see fit.

If you have an array which has this:

$filename[0] = "filename1.php";
$filename[1] = "filename2.php";
$filename[2] = "filename3.php";

<select name="file_name">
    <option value="$filename[0]">$filename[0]</option>
    <option value="$filename[1]">$filename[1]</option>
    <option value="$filename[2]">$filename[2]</option>
</select>

So if the user picks option #2, he chose $filename[1], whose value is
filename2.php. After the user hits the submit button then $file_name equals
"filename2.php" and you can use that information however you need it. Hope
that didn't confuse you. If you need further help, please let me know. Good
luck...

- Nilaab




> -----Original Message-----
> From: Stephen [mailto:[EMAIL PROTECTED]]
> Sent: Monday, December 02, 2002 3:04 PM
> To: PHP List
> Subject: [PHP] Show Folder Contents in Form
>
>
> Hello,
>
> Is it possible, and if so how, to get the filenames and last edited
> time/date, then display them in a select field in a form for a user to
> select? I'd need to show them in order of most recently edited to last
> edited. How can this be done if it can?
>
> Thanks,
> Stephen Craton
> http://www.melchior.us
>
> "Life is a gift from God. Wasting it is like destroying a gift
> you got from
> the person you love most." -- http://www.melchior.us
>
>

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

I'm looking to get a unix timestamp for the first and last day of a month,
given a timestamp. 

But so far everything i've come up with has been waaaay too many lines of
trickery -- especially for the last day of the month (which isn't always 31)

Any ideas or snippets of code floating around?


Justin French
--------------------
http://Indent.com.au
Web Development & 
Graphic Design
--------------------

--- End Message ---
--- Begin Message ---
Thanks for pointing out the obvious !!! -- it's been a long day!

Justin


on 03/12/02 4:52 PM, rija ([EMAIL PROTECTED]) wrote:

> How about date("t") ?
> It's supposed return the last day of a month (28 - 31).
> 
> ----- Original Message -----
> From: "Justin French" <[EMAIL PROTECTED]>
> To: "php" <[EMAIL PROTECTED]>
> Sent: Tuesday, December 03, 2002 4:31 PM
> Subject: [PHP] easiest way to get 1st and last dates of the month?
> 
> 
>> Hi,
>> 
>> I'm looking to get a unix timestamp for the first and last day of a month,
>> given a timestamp.
>> 
>> But so far everything i've come up with has been waaaay too many lines of
>> trickery -- especially for the last day of the month (which isn't always
> 31)
>> 
>> Any ideas or snippets of code floating around?
>> 
>> 
>> Justin French
>> --------------------
>> http://Indent.com.au
>> Web Development &
>> Graphic Design
>> --------------------
>> 
>> 
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
>> 
> 
> 
> 

Justin French
--------------------
http://Indent.com.au
Web Development & 
Graphic Design
--------------------

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Justin French [mailto:[EMAIL PROTECTED]]
> Sent: 03 December 2002 05:31
> 
> I'm looking to get a unix timestamp for the first and last 
> day of a month,
> given a timestamp. 
> 
> But so far everything i've come up with has been waaaay too 
> many lines of
> trickery -- especially for the last day of the month (which 
> isn't always 31)
> 
> Any ideas or snippets of code floating around?

In addition to other solutions, this may or may not be appropriate depending
on how you're handling your dates, but on the manual page for mktime is the
following:

> The last day of any given month can be expressed as the "0"
> day of the next month, not the -1 day. Both of the following
> examples will produce the string "The last day in Feb 2000
> is: 29".
>
>   $lastday = mktime (0,0,0,3,0,2000);
>   echo strftime ("Last day in Feb 2000 is: %d", $lastday);
>     
>   $lastday = mktime (0,0,0,4,-31,2000);
>   echo strftime ("Last day in Feb 2000 is: %d", $lastday);


Cheers!

Mike

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

 
 
--- End Message ---
--- Begin Message ---
I plan to have my sites using several databases, but there is a common database they 
must all use.  Obviously I'll have to use "mysql_select_db" each time I change the 
database I wish to use.  Does this simply select the database 
and hold it as a variable until a query is made, or does it load it in a way that 
would potentially slow things down?


--- End Message ---
--- Begin Message ---
At 18:44 02/12/2002 -0500, John W. Holmes wrote:

> Can you help me for this ?

Yeah, I already did:
Perhaps you could throw a clue my way, in that case.

I have an actor database (mySQL again) which has actor dates of birth in 'YYYY-MM-DD' format. I want to be able to query against that ignoring the year:

* give me actors who have birthdays in the next five days
* give me actors whose birthdays fall between two dates (ie: Aries)

I've got pretty much everything else working but this one's *really* playing with my head. :-( I know I should've employed a db engineer! :)

James.


--- End Message ---
--- Begin Message ---
On Tuesday 03 December 2002 18:29, James Coates wrote:

> Perhaps you could throw a clue my way, in that case.

> I have an actor database (mySQL again) which has actor dates of birth in
> 'YYYY-MM-DD' format. I want to be able to query against that ignoring the
> year:
>
> * give me actors who have birthdays in the next five days

Assuming the column holding the the birthday is called 'birthday':

a) you have to work out the date in 5 days time:

  DATE_ADD(CURRENT_DATE, INTERVAL 5 DAY)

b) You have to transform the birthdays so that they are for the current year 
(so instead of 1981-04-01 it becomes 2002-04-01)

    CONCAT(YEAR(CURRENT_DATE), '-', MONTH(birthday), '-', 
DAYOFMONTH(birthday))

c) Combine both into your query:

  SELECT *,
         CONCAT(YEAR(CURRENT_DATE), '-', MONTH(birthday), '-', 
DAYOFMONTH(birthday)) as current_birthday
   FROM table
   WHERE current_birthday >= CURRENT_DATE
     AND current_birthday <= DATE_ADD(CURRENT_DATE, INTERVAL 5 DAY)

** Untested ** use with extreme caution.

> * give me actors whose birthdays fall between two dates (ie: Aries)

This one is easy, use the BETWEEN clause in your SELECT statement. Consult 
manual for details.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Intuition, however illogical, is recognized as a command prerogative.
                -- Kirk, "Obsession", stardate 3620.7
*/

--- End Message ---
--- Begin Message ---
I'm looking to choose a set of library code principally for database
functions. So far checked out Pear, Phplib and adodb which all appear to be
well crafted and easy to use. Irrespective of differences in the actual
functions provided (which of course are well documented) can anyone briefly
compare and contrast them from experience working with 2 or more such
libraries in a production environment in terms of robustness and speed (I
appreciate that speed tests have put adodb top, then phplib and finally
Pear, but have people found such differences to be very noticeable and if so
under what specific circumstances?)

Cheers,
David Eisenhart



--- End Message ---
--- Begin Message --- can you do method overloading in php as you can in java?

Javier





_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

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

I'm relatively new to PHP and mySQL.

I currently have a simple table created within a MySQL database.  And I have
a php script that connects to the database, presents a form for the user to
fill in, and then writes that record to the table.

Instead... is it possible, to write to multiple records at once using a
tabular view rather than one record at a time with a columnar view ?

Many Thanks,

Shams


--- End Message ---
--- Begin Message ---
 Hi All.

   does anybody know PHPlib's source site?
   or may be you can tell me which template engine
   is more efficient or usefull or comfortable?


 Alexander A. Savenkov
 System Administrator
 mailto:[EMAIL PROTECTED]
 JSC "Terminal GMB"
 http://www.terminalgmb.ru

--- End Message ---
--- Begin Message ---
Hello all.

        I have a script that uses fsockopen() to connect to a remote server/port and 
from what i am seeing mod_php4 with apache only allows 1 fsockopen connection 
at a time and will que the other fsockopen calls and then process them when 
the one before it has closed. Is there a way round this?

        What i am after is for somebody to be able to goto the php page which will 
then connect via fsockopen to the other server do its send/read stuff and 
then produce the output. At the moment if one pages takes a bit of time to 
finish the remote connection then all the other apache processes just sit 
there and wait for it. The remote server only ever gets 1 connection at a 
time even though there are free connections available.

        Has anybody else seen this or know of a way around it.


-- 
Regards,
        William Bailey.
        Pro-Net Internet Services Ltd.
        http://www.pro-net.co.uk
        http://wb.pro-net.co.uk

--- End Message ---
--- Begin Message ---
PHP server = Win 2000 SP2/php 4.1.2
SMTP server = Netscape Messenger 4.15 (declare on php.ini)

Why CC and BCC never receive mail ?
The header 'TO' is correct : see CC and BCC !
The header : "From : ..... CC: [EMAIL PROTECTED] BCC: [EMAIL PROTECTED]"

I try  severals classes I have found (PHP Classes), no good result !

Help please

--- End Message ---
--- Begin Message ---
On Tuesday 03 December 2002 20:09, Alain ROMERO wrote:
> PHP server = Win 2000 SP2/php 4.1.2
> SMTP server = Netscape Messenger 4.15 (declare on php.ini)
>
> Why CC and BCC never receive mail ?
> The header 'TO' is correct : see CC and BCC !
> The header : "From : ..... CC: [EMAIL PROTECTED] BCC: [EMAIL PROTECTED]"

Headers need to be separated by "\r\n". But it is much more convenient to use 
a ready-made class instead ...

> I try  severals classes I have found (PHP Classes), no good result !

... try phpmailer (www.phpclasses.org).

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
If I am elected no one will ever have to do their laundry again!
*/

--- End Message ---
--- Begin Message ---
Zeev Suraski wrote an article on the subject. You can find it at 
http://www.devx.com/webdev/Article/10007

From: ed [mailto:[EMAIL PROTECTED]]
>
>Hi all.  I was wondering if there are resources on the
>web that will help me get an 
>idea of the changes and new features that will be in
>php5.
>I'm particularly interested in what's gonna be added
>or changed to php in regards to 
>its OOP capabilities.

______________________________
Brad Young
Director, Product Marketing
[EMAIL PROTECTED] 
www.zend.com 
Zend - The PHP Company
 

--- End Message ---
--- Begin Message --- Sorry for the semi-ot post, but this is both a flash and php question, and I'm not a member of any flash lists, so I decided to post it here. Anyway, I have a game site with virtual pets, virtual shops, user accounts, etc. One feature request I get alot is flash games. I could find someone to make them, but I'm not sure about ways of making the score submitting secure. Any thoughts?

--
The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.


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

is it possible to somehow have a function which takes a variable number of arguments (with some kind of key association) which can then be converted to variables?
i am sick of continually having to go back and add empty parameters to functions in use.

an example would be..

function test1()
{
extract(func_arg_keys());
print $this;
}
test1($test = 1, $this = 2);
// output
2

i know something similar can be done like this...

function test2()
{
extract($arr);
print $this;
}

test2($arr = array(
"test" => 1,
"this" => 2
));
// output
2

is there another ... better or cleaner way?

having something like this inbuilt into php would appear to be an excellent to allow functions to easily expand without having to go revisit already used instances of the function

many thanks
christian

ps sorry if this has been discussed before




--- End Message ---
--- Begin Message ---
ooops that should be...

function test2($arr)
{
  extract($arr);
  print $this;
}

test2($arr = array(
"test" => 1,
"this" => 2
));
// output
2

--- End Message ---
--- Begin Message ---
 Hi PHP.

  Suggest me which template engine is more popular?
  I try select engine for me but I alredy become involved in that
  number different version


 Alexander A. Savenkov
 System Administrator
 mailto:[EMAIL PROTECTED]
 JSC "Terminal GMB"
 http://www.terminalgmb.ru

--- End Message ---

Reply via email to