php-general Digest 12 Mar 2001 01:25:40 -0000 Issue 561

Topics (messages 43385 through 43422):

new line in forms?
        43385 by: Jens
        43386 by: Bård Farstad
        43416 by: Henrik Hansen

Re: DB Abstraction
        43387 by: Pierre-Yves Lemaire

Re: Retrieving data from multiple select list
        43388 by: Ben Cheng
        43394 by: Carsten Gehling

Re: PHP & Apache with SSL
        43389 by: Rouvas Stathis

Re: Sending "pretty" email
        43390 by: Todd Cary
        43399 by: Derek Sivers
        43403 by: Michael Geier
        43405 by: Chris Adams

Passing string variable gets cut off
        43391 by: Fates
        43393 by: Jens Nedal

Re: objects in functions?
        43392 by: Carsten Gehling

Best way to pass SQL TEXT field via a link
        43395 by: Fates
        43401 by: Pierre-Yves Lemaire

Problems with string replacement
        43396 by: James, Yz
        43413 by: Christian Reiniger
        43414 by: James, Yz

date
        43397 by: FredrikAT
        43402 by: Pierre-Yves Lemaire
        43404 by: Chris Adams

When a form var is empty, how do you tell?
        43398 by: Dennis Gearon
        43409 by: Lewis Bergman

spidering dynamic pages
        43400 by: Derek Sivers

fscanf
        43406 by: Kubol

date (urgent!)
        43407 by: FredrikAT
        43415 by: Henrik Hansen

Variable dynamique
        43408 by: Pierre-Yves Lemaire
        43412 by: Christian Reiniger

Re: problem with include/require
        43410 by: Yasuo Ohgaki

displaying pictures form db [problem]
        43411 by: Siim Einfeldt aka Itpunk

Flash call erase my session
        43417 by: Pierre-Yves Lemaire
        43418 by: Pierre-Yves Lemaire

Fetching mails from a mailbox in PHP
        43419 by: Filip Olsson
        43420 by: Jason Brooke

Mailing List
        43421 by: Thomas Anderson
        43422 by: David Robley

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]


----------------------------------------------------------------------


You have probably had this question a few times, but can anyone tell me how
to detect "new line's" or breaks in form fealds from both PC and Mac. And
then replacing the "new line" with a <br> so that I can use it for the web?

Thanks in advance

Jens






On Sunday 11 March 2001 14:37, Jens wrote:
> You have probably had this question a few times, but can anyone tell me how
> to detect "new line's" or breaks in form fealds from both PC and Mac. And
> then replacing the "new line" with a <br> so that I can use it for the web?

$string = nl2br( $string );

-- 
Bård Farstad
Systems developer
ez.no | developer.ez.no | zez.org




> On Sunday 11 March 2001 14:37, Jens wrote:
> > You have probably had this question a few times, but can anyone tell me
how
> > to detect "new line's" or breaks in form fealds from both PC and Mac.
And
> > then replacing the "new line" with a <br> so that I can use it for the
web?
>
> $string = nl2br( $string );


nl2br() don't replace the newlines with a <br> they insert a <br> before
the newline,
therefor you need something like:

$string = str_replace("\n", "<br>", $string);

--
Henrik Hansen





Hello,

For the most popular one, it is include in the phplib package:
http://phplib.netuse.de/download/index.php3

Or for just the mysql database class, I like this one:
MySQL_class at: http://phpclasses.upperdesign.com/ (login required)

py



----- Original Message -----
From: Jordan Elver <[EMAIL PROTECTED]>
To: PHP DB Mailing List <[EMAIL PROTECTED]>; PHP General Mailing List
<[EMAIL PROTECTED]>
Sent: Sunday, March 11, 2001 12:54 PM
Subject: [PHP] DB Abstraction


> Hi,
> I thought it was about time I started using a db abstraction class.
Problem
> is, there are so many out there that I don't which one to start using?
>
> I've heard of ADODB (I think).
>
> Anyone have any suggestions?
>
> Cheers,
>
> Jord
>
>
> --
> 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]
>
>





Yeah I saw this in the online manual but is there any other way of 
doing this that doesn't require naming the select box in HTML with a 
[] at the end?  Cause I have another button that calls a JavaScript 
to select all the options within CategoryID[] and it doesn't seem to 
work cause it's looking for a CategoryID[] array instead of a select 
box named CategoryID[].

-Ben
P.S.  Please send responses directly to my email address as well 
since I'm in digest mode.  Thanks.

At 10:05 AM +0100 3/11/01, Edi Murfy wrote:
>try this:
>
>in the form:
><select name="CatecoryID[]" size="3" multiple>
>    <option value="1">Item 1</option>
>    <option value="2">Item 2</option>
>    <option value="3">Item 3</option>
></select>
>
>in the script:
>$num = sizeof($CategoryID); // Number of array items
>for($i=0;$i<$num;$i++)
>   {
>   // $CategoryID[$i] --> whatever you wanna do with it...
>   }
>
>
>
>"Ben Cheng" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
>news:p05010402b6d0b285663b@[10.10.0.169]...
>>  I have a select box that allows the user to select and submit more
>>  than one selection at a time.  How do I retrieve all the selections
>>  in PHP?  For example, the select list is named CategoryID.  But when
>>  I select more than one item and then hit submit, $CategoryID only
>>  shows me the last value of the selected items.  How do I see all the
>  > values that have been selected?




From: "Ben Cheng" <[EMAIL PROTECTED]>
Sent: Sunday, March 11, 2001 3:27 PM


> Yeah I saw this in the online manual but is there any other way of 
> doing this that doesn't require naming the select box in HTML with a 
> [] at the end?  Cause I have another button that calls a JavaScript 
> to select all the options within CategoryID[] and it doesn't seem to 
> work cause it's looking for a CategoryID[] array instead of a select 
> box named CategoryID[].

You solve that one by referencing your selectbox in JavaScript like this:

document.myForm["CategoryID[]"].selectedIndex

instead of

document.myForm.CategoryID.selectedIndex

- Carsten






In .htaccess use SSLRequireSSL for AuthType Config and redirect to https
using ErrorDocument.
Example for  www.foo.goo/sec
.htacess
--------
AuthType Config
SSLRequireSSL
ErrorDocument 403 https://www.foo.goo/sec
Options -Indexes
--------
Options directive is not neccessary but I assume that if you want a
secure conection then directory listing are not desirable.

-Stathis.

Daniel B I wrote:
> 
> Hello,
> any idea how to limit file access (php files) by
> protocol type call?
> I mean how could I serve a php file only if it is
> called with SSL (https://... not http://...)
> I saw this on a site when I was refused because
> I didn't use secure protocol, and I wonder, how could
> I do that?
> Is there a specific statement in apache config file?
> 
> Daniel BI
> PS. I know it 's a little bit far of PHP specific this
> question, excuse me for that.. maybe you knwow
> something about
> 
> --
> 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]




Richard -

For me you are pointing out one of the dilemmas I face on a daily basis
that I call the "fin dilemma".  I coined this expression from the era
when Detroit put fins on the cars.  These did not make the car perfrom
better; they only appealed to need to get a car with fins because the
neighbor had one.

Yet I earn my living by writing software for clients and when I suggest
that they use the KISS principle, they tell me that I am not up with the
times.  There is a very interesting book that I came across at a
friend's home addressing effective Web design.  Though I cannot remember
the authors name, he has done many of the "big name" magazine covers as
well as some big name Web sites and he believes in simplicity.  Quite a
deilemma!!!

Todd

--
Todd Cary
Ariste Software
[EMAIL PROTECTED]






At 07:49 AM 3/11/01 , Richard Scott Crawford wrote:
>The first thing to do is to take two aspirin and lie down until the 
>temptation to do this passes.  It may be cool, but those of us who use 
>Eudora or Pine for our e-mail don't read HTML-encoded mail, don't *want* 
>to read HTML-encoded mail, and get really annoyed when it shows up in our 
>mailboxes.

I generally agree, but there is...
ONE GOOD USE FOR HTML EMAIL:   AOL DUMMIES.

REASON:
When I would send my email list a URL I needed them to go to, I would do it 
in plain-text.   ("Go to www.something.com and do something.")

And because 90% of the email programs out there automatically make it a 
hyperlinked URL, there was no problem - *EXCEPT* the AOL people who would 
email back stupid things like, "Sounds interesting!  What's the web address?"

SOLUTION:
When you're sending email using PHP, try this:

if (strtolower(strstr($email, '@'))=="aol.com")
   {
   $link1 = '<a href="http://www.something.com/">www.something.com</a>';
   $link2 = '<a href="http://www.otherthing.com/">www.otherthing.com</a>';
   }
else
   {
   $link1 = 'www.something.com';
   $link2 = 'www.otherthing.com';
   }

$message = "Hey $firstname -

Check out this link!
" . $link1 . "

and also this one...
" . $link2 . "

Enoy!";

mail ($email, $subject, $message, $headers);


That way the AOL dummies get their hyperlinked HTML links, and all the cool 
people of the world get the regular simple version.






Although I will probably getting tarred and feathered for this,

I send out at least a million (multiple emails for lists around the 200
thousand customer mark) emails a week, mostly html.
When I wrote the software interface (in PHP) to do so, I mentioned to my
bosses that many people would not be able to read these HTML emails (ie.
AOL, Eudora, Lotus 5.0, and my beloved pine).  This deterred them naught,
cuz they wanted to send banners in the email.  Since email with banners
generated more revenue than without (however little money that may be), I
was overruled.

Hence, I read up on multi-part email.  This can be done, and I used Richard
Heyes' html-mime email class to do it.  The class was based on the SMTP
class that can be found on Manuel Lemos' PHPClasses site
(http://phpclasses.upperdesign.com), along with the SMTP class.

I now have the ability to send straight HTML, straight TEXT, or combo emails
that are interpreted correctly by all email clients (including AOL clients).
And, since I don't use the mail() function, it typically runs about 150%
faster (mail() puts the messages in the mail queue, but the SMTP class
writes directly to port 25 of the mail server).  All this and it runs on a
linux system that grabs the email addresses out of a M$ SQL 7 database.  The
database allows the customers the ability to opt-out of certain emails.

So don't refrain from doing it because some people say it shouldn't be done
for one reason or another.  Simply fix those reasons so they don't know any
different.

-----Original Message-----
From: Todd Cary [mailto:[EMAIL PROTECTED]]
Sent: Sunday, March 11, 2001 8:46 AM
To: Richard Scott Crawford
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Sending "pretty" email


Richard -

For me you are pointing out one of the dilemmas I face on a daily basis
that I call the "fin dilemma".  I coined this expression from the era
when Detroit put fins on the cars.  These did not make the car perfrom
better; they only appealed to need to get a car with fins because the
neighbor had one.

Yet I earn my living by writing software for clients and when I suggest
that they use the KISS principle, they tell me that I am not up with the
times.  There is a very interesting book that I came across at a
friend's home addressing effective Web design.  Though I cannot remember
the authors name, he has done many of the "big name" magazine covers as
well as some big name Web sites and he believes in simplicity.  Quite a
deilemma!!!

Todd

--
Todd Cary
Ariste Software
[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]





On 11 Mar 2001 10:57:32 -0800, Michael Geier <[EMAIL PROTECTED]> wrote:
>So don't refrain from doing it because some people say it shouldn't be done
>for one reason or another.  Simply fix those reasons so they don't know any
>different.

I'll second this - while I personally consider HTML email a waste of time[1], a
lot of people like it and it does open up some nice possibilities. The key is
remembering that if you're going to do it, you need to do it right - sending
the proper multi-part mime headers, providing alternatives for people who can't
use HTML[2] and generally just being polite. When presenting this to managers
and/or clients, point out that this maximizes the number of people who can read
their messages - they should grasp the whole "block potential customers = fewer
sales" concept quickly.

[1] For reasons having more to do with security and the crimes against good
design committed by a few; an email client which gave the user the kind of
control a browser like Opera does would be a lot more tolerable.
[2] It's not those of us using text-based email clients, either. Think of
wireless device users or people working at large corps which installed software
to disable anything remotely dynamic in incoming emails.




My strings are getting cut off when I pass to destination web page

Example:

Assign variable from database
$subcategory = mysql_result($result,$i,"subcategory");

Variable $subcategory  is assigned "Graphic Editors" from database
(notice two words)

Next I make a link and pass the variables to new page when person clicks
link
<? echo "<a
href='addupdate.php?category=$category&subcategory=$subcategory

New page appears
The value of $subcategory is:  Graphic     It cut off everything after
Graphic, How do I fix that?







on 11.03.2001 16:16 Uhr, Fates at [EMAIL PROTECTED] wrote:

> My strings are getting cut off when I pass to destination web page
> 
> Example:
> 
> Assign variable from database
> $subcategory = mysql_result($result,$i,"subcategory");
> 
> Variable $subcategory  is assigned "Graphic Editors" from database
> (notice two words)
> 
> Next I make a link and pass the variables to new page when person clicks
> link
> <? echo "<a
> href='addupdate.php?category=$category&subcategory=$subcategory
> 
> New page appears
> The value of $subcategory is:  Graphic     It cut off everything after
> Graphic, How do I fix that?
> 
> 
> 

Yes, because there is a space in the word you want to submit over the URL.
What you would need to do is:

$subcategory = urlencode($subcategory);
<a href='addupdate.php?category=$category&subcategory=$subcategory

By this way the space is converted to the equivalent ascii-char -> %20 and
then it should not get cut of anymore.

regards, Jens Nedal






From: "Jørg Vidar Bryne" <[EMAIL PROTECTED]>
Sent: Saturday, March 10, 2001 11:52 PM


> What do you mean by it fails? Any particular error, or does it just time
> out?
>
> I've made a different recursive function to print a tree-menu, you can
have
> a look at it if you want but it might not be what you're after. It prints
a
> tree-menu, and reqires the table to have at least a field named id and
> parent. parent telling which node an object is connected to.
> But I guess you know that already, I just got carried away! Maybe someone
> could use this.

<snip>

One of the rules I live by is never to assume you know all there is to know
about a subject.

You've just opened my eyes a little more with this script. All these years
I've been making recursive db-queries and it can all be done in just one...

Your script _must_ be faster, quite simply due to the fact that you only
make one query.

Thank you thank you thank you!

- Carsten






I'm trying to update an existing record based on a link that represents
the record to update.

I have a link and I am passing variables that were assigned from a SQL
database to another php form page which will be used to update the
record. I'm passing variable like so:<a
href='addupdate.php?name=$name&category=$category&description=$etc.....

This works fine for variables that contain values of only a few lines
but what about passing a couple paragraphs stored in variable
$description assigned via database value as TEXT.

Would it be better just to pass the database record ID to the
destination page and then query the record in the destination form page
and populate the form with the current values and update the record or
is there another way I don't know about?





Yes it would be a lot better to just passed the id in the url.

py

----- Original Message ----- 
From: Fates <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, March 11, 2001 5:12 PM
Subject: [PHP] Best way to pass SQL TEXT field via a link


> I'm trying to update an existing record based on a link that represents
> the record to update.
> 
> I have a link and I am passing variables that were assigned from a SQL
> database to another php form page which will be used to update the
> record. I'm passing variable like so:<a
> href='addupdate.php?name=$name&category=$category&description=$etc.....
> 
> This works fine for variables that contain values of only a few lines
> but what about passing a couple paragraphs stored in variable
> $description assigned via database value as TEXT.
> 
> Would it be better just to pass the database record ID to the
> destination page and then query the record in the destination form page
> and populate the form with the current values and update the record or
> is there another way I don't know about?
> 
> 
> -- 
> 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]
> 





Hello all,

Well, I'm having problems again.  This time with string replacement.  I'd
like people to be able to write notes on one of the site's I'm helping with,
and would like them to be able to use Bold, Italic, Underline and <a href>
tags.  I tried using striptags(); but that would strip anything within
double quotes too.  So I've gotten around it by converting the message
string to htmlspecialchars and then using ereg_replace around the tags I'd
like to allow, ie:

$message = ereg_replace("&lt;u&gt;","<u>", $message);

Where I'm struggling is with the a href tags, though.  I've been using this:

$message = eregi_replace("(&lt;a
href=&quot;)(http://[^[:space:]]{1,})(&quot;&gt;)(.*)(&lt;\/a&gt;)", "<a
href=\"\\2\" target=\"_blank\">\\4</a>", $message);

which would change a string containing:
<a href="http://www.php.net">PHP!</a>
to:
<a href="http://www.php.net" target="_blank">PHP!</a>

Great.  But, there's a problem.  If someone uses:
<a href="http://www.php.net" target="_blank">PHP!</a><a
href="http://www.php.net" target="_blank">PHP Again!</a>
it returns:
<a href="http://www.php.net" target="_blank">PHP!/a&gt;&lt;a
href=&quot;http://www.php.net&quot;PHP AGAIN!</a>

Ouch!

Anyone got any ideas where it's going wrong?

Also, for the html that isn't allowed, it'd be nice to have some sort of
cleanup, so that something like this:

<blah>BLAH</blah>

Would be returned as BLAH.  But not essential :)

Thanks in advance,

James.






On Sunday 11 March 2001 18:45, you wrote:

> Well, I'm having problems again.  This time with string replacement. 
> I'd like people to be able to write notes on one of the site's I'm
> helping with, and would like them to be able to use Bold, Italic,
> Underline and <a href> tags.  I tried using striptags(); but that would
> strip anything within double quotes too.  So I've gotten around it by

huh? strip_tags works fine for me.

echo strip_tags ('Hello <a href="http://foo/">bar</a> 
"world"<br><em>there</em>', '<a> <br>');

creates

'Hello <a href="http://foo/">bar</a> "world"<br>there'

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The use of COBOL cripples the mind; its teaching should, therefore,
be regarded as a criminal offence.

- Edsger W. Dijkstra




>> Well, I'm having problems again.  This time with string replacement.
>> I'd like people to be able to write notes on one of the site's I'm
>> helping with, and would like them to be able to use Bold, Italic,
>> Underline and <a href> tags.  I tried using striptags(); but that would
>> strip anything within double quotes too.  So I've gotten around it by

> huh? strip_tags works fine for me.

> echo strip_tags ('Hello <a href="http://foo/">bar</a>
> "world"<br><em>there</em>', '<a> <br>');

> creates

> 'Hello <a href="http://foo/">bar</a> "world"<br>there'

True, but then it doesn't:
-Open the link in a new window
it does:
-remove all content between "and".

Of course, I could replace quote marks with htmlspecialchars/entities or
using manual string replacement, but then it'd render all tags using quote
marks invalid.

See the problem? ;)

James.






Hi!

I have 2 dates...
$start = "20010101";
$end = "20010312";

What is the easiest way of finding out how many days are between?

Thanx!


---------------------------------
Fredrik A. Takle
[EMAIL PROTECTED]







Hello,

This works when you have a separator of some sort, a space would work too.
The tricky part is that mktime works with mm dd yy format.

$start = "2001-01-01";
$end = "2001-03-12";

$start = explode( "-", $start );
$start = mktime( 0, 0, 0, $start[1], $start[2], $start[0] );

$end = explode( "-", $end );
$end = mktime( 0, 0, 0, $end[1], $end[2], $end[0] );
$diff =  ( $end - $start ) / ( 86400 );

echo $diff;

py

----- Original Message ----- 
From: FredrikAT <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, March 11, 2001 6:31 PM
Subject: [PHP] date


> Hi!
> 
> I have 2 dates...
> $start = "20010101";
> $end = "20010312";
> 
> What is the easiest way of finding out how many days are between?
> 
> Thanx!
> 
> 
> ---------------------------------
> Fredrik A. Takle
> [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]
> 
> 





On 11 Mar 2001 10:25:25 -0800, FredrikAT <[EMAIL PROTECTED]> wrote:
>I have 2 dates...
>$start = "20010101";
>$end = "20010312";

Use mktime() (http://www.php.net/manual/en/function.mktime.php) on those
strings to convert them into Unix timestamps:

$start_time = mktime(0,0,0, 
        substr($start, 6, 2), 
        substr($start, 4, 2),
        substr($start, 0, 4)
); // mktime( hour, minute, second, day, month, year)

Since a Unix timestamp is just the number of seconds since a starting point,
you can get the elapsed number of seconds by substraing $start_time from
$stop_time; divide that by 86400 and you'll have the number of days.

You could also use the Calendar extension if you have that installed, since it
allows you to covert from several calendar systems into Julian Day counts,
which could be subtracted similarly. (See
http://www.php.net/manual/en/ref.calendar.php)





-- 
________________________________________________________________
Sites by friends of mine: http://www.myhiddentreasures.com/
________________________________________________________________
WARNING personal propaganda signature
TAKE WHAT YOU LIKE AND LEAVE THE REST

SINCE OUR GOVERNMENT WON'T PRESERVE OUR CLIMATE, IT'S UP TO US!
Imagine ** yourself ** and your kids now an endangered species
<1>Inflate automobile tires to near maximum in summer, -2psi in winter
<2>add insulation to house and hot water heater, and refrigerator,
<3>combine trips in cars, make less of them <4>buy cars, sports
vehicles and recreational vehicles with good if not best mileage
<4>put awnings over windows is summer, remove in winter. <5> add
solar hot water heating. <6>Push for energy recycling clothes
dryers <7> walk more, play outside with your kids! <8> let your
grass grow to 3-4 inches, chokes weeds, saves water and energy,
keeps house cooler <9> Put WHITE or REFLECTIVE materials on
roofs to send energy back into space. <10> Vote for burial of
logging slash onsite in logging areas for better watersheds
and less burned vegetation. <11> compost your leaves and grass,
bury in flower beds, lawns, gardens, or give away. <12> VOTE
for energy and CO2 ratings on ALL products and foods. KNOW how
much damage your purchases do to the climate. <13> Give your kids 
less stuff and more of you. <14> recycle everything you can <15>
limit your children to an average 1 per adult between all your 
marriages. (Only REPLACE yourself, not expand the population)





isset($somevar)

if($somevar == '') {
  <code>
}

foreach ($HTTP_POST_VARS as $k => $v){
   if(!isset($v)){
      <code>
   }
}

Take your pick. There are probably about two dozen other better ways.






>if I move everything to php and just use a different text file for each
>page for the main body of text and load each text file depending on what
>page the user wants, would the search engine search though those text
>files and just link to those and not to the php file?  Would it even be
>spidered by the search enging properly?


Many search engines will NOT spider pages that have "?" or "&" in the URL.

But they WILL spider PHP pages as if they were static content IF you hack 
Apache or PHP to let "/" be the variable separator instead of "?"

There are different ways of doing this.  Search the PHP list archives or 
check out some recent PHP books.

But here's the effect you're shooting for:

INSTEAD OF:
http://www.yoursite.com/showarticle.php?id=3&article=8&language=en

YOU CAN MAKE IT:
http://www.yoursite.com/showarticle/id/3/article/8/language/en

OR EVEN:
http://www.yoursite.com/showarticle/3/8/en

OR:
http://www.yoursite.com/somepage/en/3/8.html
... and just have PHP ignore any ".*" URL extensions before deciding what 
to take as the variables in the URL.

I do the last example at this site:
http://www.cdbaby.org/
It's a totally dynamic site that has gotten very well-spidered using these 
methods.


THE APACHE HACK:
You can either use "mod_rewrite" or in your Apache "/conf/httpd.conf" file, 
set:

DefaultType application/x-httpd-php  <--- not sure of exact spelling

So that ALL files with no extension are parsed as PHP files.
Which lets you rename "showarticle.php" to just "showarticle" in the 
examples above.


Hope this made sense.
I'd give concrete code examples but I'm offline right now.





hello

if this is really a silly problem dont blame me, i'm a newbie in php (but i'm 
experienced in c++ a bit :-)
well, imagine i want to write a content of some text file word by word. example will 
be more understandable 
than my english:
let file.txt consists:
lenin lives
forever
i want my php script to write to the screen:
lenin
lives
forever
I tried to manage this using fscanf function. i expected it works same as in c, but it 
looks it doesnt. consider 
the code:
while (fscanf($file,"%s",$buffer)==1)
{
        echo $buffer,"<br>";
}
the result:
lenin
forever
just like fscanf moved the file pointer to the next line after reading "lenin". i dont 
know whats up... why "lives" 
disappeared??? i know i can try using fgets and then split the string, but i want to 
know why fscanf doesnt 
work... :-)
could anyone explain me this phenomena?

best regards,
jakub zytka







Hi!

I have 2 dates...
$start = "20010101";
$end = "20010312";

What is the easiest way of finding out how many days are between?

Thanx!

---------------------------------
Fredrik A. Takle
[EMAIL PROTECTED]







> Hi!
> 
> I have 2 dates...
> $start = "20010101";
> $end = "20010312";
> 
> What is the easiest way of finding out how many days are between?


I Would suggest you check put the followinf article from phpbuilder:

http://www.phpbuilder.com/columns/akent20000610.php3

--
Henrik Hansen





I receive 2 variables, $var and $num
I need to make a variable out of these two like this

$var2 where $num = 2 or
$var3 where $num = 3

How can I do that ?

__________________
Pierre-Yves Lemaire
514.729.8100




On Sunday 11 March 2001 16:58, you wrote:
> I receive 2 variables, $var and $num
> I need to make a variable out of these two like this
>
> $var2 where $num = 2 or
> $var3 where $num = 3
>
> How can I do that ?

http://php.net/manual/en/language.variables.variable.php

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The use of COBOL cripples the mind; its teaching should, therefore,
be regarded as a criminal offence.

- Edsger W. Dijkstra




----- Original Message ----- From: "Erick Papadakis" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, March 11, 2001 9:05 PM Subject: Re: [PHP] problem with include/require > Hi Yasuo, > > Thanks for the reply, but yes I do know that the include_path in php.ini > should have the entries. But is this something new? I want to know how to > allow including and requiring files just like we used to do in PHP3! > > For instance, let us say that we have two software programs on the server > which are completely unrelated (I use Windows platform, so here it is): > > c:\apache\htdocs\software1\includes > c:\apache\htdocs\software2\includes > > Now with the latest PHP I have to include both these above paths in my > PHP.INI's "include_path" directive. is there a way to avoid this, and only > include the "c:\apache\htdocs"? Hmm. I can put multiple includes directory on my system (PHP4.0.4pl1/Linux/Apache) include_path = /home/httpd/include1:/home/httpd/include2 Getting rid of spaces around "=" might help. (It should work with spaces/tab, though) > Yes, I know that I can make a common INCLUDES folder, but come on lets be > practical. It is a lot cleaner if we can have an include folder INSIDE the > software-specific folder. I have different approch for 2 reasons 1) Multiple include path may result in unintetional includes of files. For example, include_for_aap1.inc and include_for_app2.inc may mixed up easily. 2) Multiple include path sacrifices performance. System need to search all include path for files to be included. Therefore, I specify only 1 directory for include_path. I have global.app_name.inc for each apps and defines constant, like define('INCLUDE_PATH','/home/httpd/include_path_for_app1'); and I write include_once(INCLUDE_PATH.'file_to_include.inc'); for all other files to be included. This this method, you still can esiliy change include_path esily and you can have different include directory for each application AND save COU time to find files to include. This is my approch for inlucding files. > Any ideas would be greatly appreciated! > > Thanks/Erick > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.237 / Virus Database: 115 - Release Date: 07-Mar-01 > Yasuo Ohgaki == PHP and Related Resources == [PHP FAQ] http://www.php.net/FAQ.php [PHP Manual] http://www.php.net/manual/en/ [W3C] http://www.w3.org/ [RFCs] http://www.faqs.org/rfcs/ If you don't read standard definitions, I recommend to read them.





I`m trying to display the picture from the database, but I can`t get it to
work. That`s just a short version of your script.

I try to display the picture like that:

<img src='showpic.php' width='150' height='80'>

and showpic looks like this:

<?php
$query = "select file_data,file_type, from pildid where id=1";
$result = @MYSQL_QUERY($query);
$data = @MYSQL_RESULT($result,0, "file_data");
$type = @MYSQL_RESULT($result,0, "file_type");
Header( "Content-type: $type");
$picture = $data;
print $picture;
?>


Any ideas why it might not work as expected? I have written picture to the
db, but ...? I write them like:
        $main           = addslashes(fread(fopen($main_pic, "r"),
filesize($main_pic)));
        $sql ->
insert("pildid","section,productid,picnr,file_name,file_type,file_data","'$section','$productid',0,'$main_pic_name','$main_pic_type','$main'");


Thanks in advance;
Siim EInfeldt





Hello php people,

I have a page with 3 frames, each one start the php4 session handler.
When all page are loaded, all session variables are valid.
After I receive request from a flash movie that will update one of the frame, my 
session does not exist anymore, all variables are empty.

Any idea ?
__________________
Pierre-Yves Lemaire
514.729.8100




Hello php people,

I have a page with 3 frames, each one start the php4 session handler.
When all page are loaded, all session variables are valid.
After I receive request from a flash movie that will update one of the frame, my 
session does not exist anymore, all variables are empty.

Any idea ?
__________________
Pierre-Yves Lemaire
514.729.8100




Question:

Can you by any other means except the IMAP functions get the mails from an mailbox?
Appreciate an answer.





Yes - see the network functions in the Php manual.
If you don't already know the protocol commands for the mail retrieval
protocol you want to use, see the relevant rfc.

jason

----- Original Message -----
From: "Filip Olsson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 12, 2001 10:12 AM
Subject: [PHP] Fetching mails from a mailbox in PHP


Question:

Can you by any other means except the IMAP functions get the mails from an
mailbox?
Appreciate an answer.


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







Ok, I've tried time and time again to unsubscribe from php.net's mailing
list unisubscribe instructions but it doesn't work. So how do I get off the
list?


______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup




On Mon, 12 Mar 2001 11:54, Thomas Anderson wrote:
> Ok, I've tried time and time again to unsubscribe from php.net's
> mailing list unisubscribe instructions but it doesn't work. So how do I
> get off the list?
>
>
The following is at the bottom of each message from the list:

To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA


Reply via email to