OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
php-general Digest 27 Jul 2007 01:16:25 -0000 Issue 4926

php-general-digest-helplists.php.net
Date: Thu Jul 26 2007 - 20:16:25 CDT


php-general Digest 27 Jul 2007 01:16:25 -0000 Issue 4926

Topics (messages 259558 through 259617):

query not working properly
        259558 by: Joey B
        259560 by: Richard Davey

DOM
        259559 by: Man-wai Chang
        259564 by: Man-wai Chang
        259566 by: M. Sokolewicz
        259617 by: Larry Garfield

How to get stored procedure return values via PDO?
        259561 by: Richard Davey
        259562 by: M. Sokolewicz
        259563 by: M. Sokolewicz
        259569 by: Richard Davey
        259609 by: Bruce Cowin

Hide the real URL
        259565 by: elk dolk
        259567 by: Richard Heyes
        259568 by: Eric Butera
        259572 by: Paul Novitski
        259574 by: Nathan Nobbe
        259575 by: Paul Novitski
        259576 by: M. Sokolewicz
        259579 by: elk dolk
        259582 by: Paul Novitski
        259593 by: Eric Butera
        259594 by: Nathan Nobbe

Re: The Official OT "Name Tedd's Grandson" Thread
        259570 by: Daniel Brown
        259571 by: Daniel Brown
        259577 by: M. Sokolewicz
        259578 by: Colin Guthrie
        259580 by: Robert Cummings
        259581 by: Daniel Brown
        259583 by: Colin Guthrie
        259584 by: Ford, Mike
        259585 by: Tijnema
        259586 by: Daniel Brown

Re: Pirate PHP books online?
        259573 by: Michelle Konzack
        259587 by: Stut
        259588 by: Tijnema
        259589 by: Daniel Brown
        259590 by: Tijnema

Re: Sessions?
        259591 by: brian
        259592 by: Luc

HTML Email Composing Problem.
        259595 by: Tom Ray [Lists]
        259599 by: Dan

Createing a Test DB Object.
        259596 by: Rob Adams

Found the problem...
        259597 by: Rob Adams

Re: Malformed Email Date Header
        259598 by: Dan
        259605 by: Chris Aitken

need help,pls
        259600 by: esimaje juan toritseju
        259603 by: Alan Milnes
        259616 by: Dan

Is it possible to stop an image from being cached?
        259601 by: Dan
        259602 by: Tijnema
        259604 by: Chris Aitken
        259606 by: brian
        259607 by: Tijnema
        259608 by: Chris Aitken
        259610 by: Tijnema
        259611 by: Dan
        259612 by: Tijnema
        259614 by: Dan
        259615 by: Dan

Re: No is_date() function?
        259613 by: Jim Lucas

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

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

attached mail follows:


Hi everyone,
I'mt trying to do the below query which itself works correctly, but when I
add a order by statement just bombs.

        $query = "select * from articles where ( {$now} BETWEEN startdate
AND enddate) and categoryid = 1 limit 0,3";

         $query = "select * from articles order by startdate asc where (
{$now} BETWEEN startdate AND enddate) and categoryid = 1 limit 0,3";

This one just doesn't work, can you tell me what I have done wrong??

Thanks

attached mail follows:


Hi Joey,

Thursday, July 26, 2007, 1:36:37 PM, you wrote:

> Hi everyone,
> I'mt trying to do the below query which itself works correctly, but when I
> add a order by statement just bombs.

> $query = "select * from articles where ( {$now} BETWEEN startdate
> AND enddate) and categoryid = 1 limit 0,3";

> $query = "select * from articles order by startdate asc where (
> {$now} BETWEEN startdate AND enddate) and categoryid = 1 limit 0,3";

> This one just doesn't work, can you tell me what I have done wrong??

Err.. ORDER BY comes at the END of your query, not the start.

SELECT * FROM blah WHERE blahblah ORDER BY y ASC LIMIT x,y

Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

attached mail follows:


Out of curiosity, is there any effort in creating a new DOM that's
easier for application builders (something like Visual Foxpro)?

Does Web 2.0 or maybe 3.0 offer some new <input> types, say something
like a real grid, or maybe a modal child popup?

--
  ~ Might, Courage, Vision, SINCERITY.
 / v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Xubuntu 7.04) Linux 2.6.22.1
  ^ ^ 20:36:01 up 14 days 22:40 1 user load average: 0.00 0.00 0.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

attached mail follows:


> Does Web 2.0 or maybe 3.0 offer some new <input> types, say something
> like a real grid, or maybe a modal child popup?

Java is just a specialized DOM... in my opinion.

--
   ~ Might, Courage, Vision, SINCERITY.
  / v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Xubuntu 7.04) Linux 2.6.22.1
   ^ ^ 21:13:01 up 14 days 23:17 1 user load average: 0.02 0.03 0.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

attached mail follows:


Man-wai Chang wrote:
>> Does Web 2.0 or maybe 3.0 offer some new <input> types, say something
>> like a real grid, or maybe a modal child popup?
>
> Java is just a specialized DOM... in my opinion.
>
Where did you get this weird idea... JAVA by itself has nothing to do
with the web or documents... It's commonly used to perform such tasks,
but it's not the "purpose" of the language. You could as well say that
PHP is just a specialized email-form language, which would also be not
quite right.

attached mail follows:


On Thursday 26 July 2007, Man-wai Chang wrote:
> Out of curiosity, is there any effort in creating a new DOM that's
> easier for application builders (something like Visual Foxpro)?
>
> Does Web 2.0 or maybe 3.0 offer some new <input> types, say something
> like a real grid, or maybe a modal child popup?

You're confusing two different things.

The DOM is a standard API developed by the W3C for addressing tree data
structures, generally XML or a data structure that maps to XML. It is
language-independent, which is why the Javascript DOM functions look and act
really really closely to the PHP DOM functions. Do not expect the DOM API to
change any time soon.

XHTML is a particular XML DocType. One can manipulate it using the DOM API.
That is very frequently done using Javascript, but in PHP 5 can be done in
PHP as well with essentially the same API. The DOM functions can be a bit
clunky, though, so various Javascript libraries exist that wrap them up into
some easier syntax. My preference is for jQuery, but there are many others.

Web 2.0 is a marketing term for a technical style and visual design movement.
It was invented by Tim O'Reilly as a somewhat joke, and picked up by people
with too much time and not enough brains to mean "Dot Boom 2.0".

Web 3.0 is a fictional term that is used only to make fun of people who use
the term Web 2.0 with a straight face.

What you're actually asking for is new elements in the DocType that offer
richer form elements. Do not expect that any time soon on a massive scale.
HTML/XHTML is unlikely to get such a thing any time soon. There is the
XForms standard from W3C, but I don't know of anything that actually uses it.
Microsoft would say "just use .NET", but that just gets boiled down to some
variant of Javascript that runs only in every bug-fix release of IE.

Probably the only useful "richer forms" system right now with any mass-market
adoption is XUL, which is the XML-based interface language used by Gecko, the
Firefox engine. It runs in pretty much any version of Firefox, but is a very
different animal from HTML.

http://www.xulplanet.com/

--
Larry Garfield AIM: LOLG42
larrygarfieldtech.com ICQ: 6817012

"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson

attached mail follows:


Hi,

I'm calling a MySQL Stored Procedure via PDO (PHP 5.2.3)

$stmt = $dbh->prepare('CALL forum_post(?, ?, ?, ?, ?, status, thread_id, message_id)');

At the moment in order to get the values of status, thread_id and
message_id I need to issue a second query:

$sql = "SELECT status AS status, thread_id AS thread_id, message_id AS message_id";

and then foreach my way through it:

foreach ($dbh->query($sql) as $row)
{
        $status = $row['status'];
        $thread_id = $row['thread_id'];
        $message_id = $row['message_id'];
}

Which seems a bit insane.. is there no way to do a bindValue at the
same time as I do my bindParams?

Now I write this I really can't remember why I am even putting that
second query into a foreach loop, even so it's still a step I'd like
to remove entirely if possible?

Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

attached mail follows:


Richard Davey wrote:
> Hi,
>
> I'm calling a MySQL Stored Procedure via PDO (PHP 5.2.3)
>
> $stmt = $dbh->prepare('CALL forum_post(?, ?, ?, ?, ?, status, thread_id, message_id)');
>
> At the moment in order to get the values of status, thread_id and
> message_id I need to issue a second query:
>
> $sql = "SELECT status AS status, thread_id AS thread_id, message_id AS message_id";
>
> and then foreach my way through it:
>
> foreach ($dbh->query($sql) as $row)
> {
> $status = $row['status'];
> $thread_id = $row['thread_id'];
> $message_id = $row['message_id'];
> }
>
> Which seems a bit insane.. is there no way to do a bindValue at the
> same time as I do my bindParams?
>
> Now I write this I really can't remember why I am even putting that
> second query into a foreach loop, even so it's still a step I'd like
> to remove entirely if possible?
>
> Cheers,
>
> Rich

From: http://www.php.net/manual/en/ref.pdo.php

Example 1716. Calling a stored procedure with an input/output parameter
<?php
$stmt = $dbh->prepare("CALL sp_takes_string_returns_string(?)");
$value = 'hello';
$stmt->bindParam(1, $value, PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT, 4000);

// call the stored procedure
$stmt->execute();

print "procedure returned $value\n";
?>

attached mail follows:


Richard Davey wrote:
> Hi,
>
> I'm calling a MySQL Stored Procedure via PDO (PHP 5.2.3)
>
> $stmt = $dbh->prepare('CALL forum_post(?, ?, ?, ?, ?, status, thread_id, message_id)');
>
> At the moment in order to get the values of status, thread_id and
> message_id I need to issue a second query:
>
> $sql = "SELECT status AS status, thread_id AS thread_id, message_id AS message_id";
>
> and then foreach my way through it:
>
> foreach ($dbh->query($sql) as $row)
> {
> $status = $row['status'];
> $thread_id = $row['thread_id'];
> $message_id = $row['message_id'];
> }
>
> Which seems a bit insane.. is there no way to do a bindValue at the
> same time as I do my bindParams?
>
> Now I write this I really can't remember why I am even putting that
> second query into a foreach loop, even so it's still a step I'd like
> to remove entirely if possible?
>
> Cheers,
>
> Rich

From: http://www.php.net/manual/en/ref.pdo.php

Example 1716. Calling a stored procedure with an input/output parameter
<?php
$stmt = $dbh->prepare("CALL sp_takes_string_returns_string(?)");
$value = 'hello';
$stmt->bindParam(1, $value, PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT, 4000);

// call the stored procedure
$stmt->execute();

print "procedure returned $value\n";
?>

attached mail follows:


Hi M.,

Thursday, July 26, 2007, 2:09:47 PM, you wrote:

> Richard Davey wrote:
>> Hi,
>>
>> I'm calling a MySQL Stored Procedure via PDO (PHP 5.2.3)
>>
>> $stmt = $dbh->prepare('CALL forum_post(?, ?, ?, ?, ?, status, thread_id, message_id)');
>>
>> At the moment in order to get the values of status, thread_id and
>> message_id I need to issue a second query:
>>
>> $sql = "SELECT status AS status, thread_id AS thread_id, message_id AS message_id";
>>
>> and then foreach my way through it:
>>
>> foreach ($dbh->query($sql) as $row)
>> {
>> $status = $row['status'];
>> $thread_id = $row['thread_id'];
>> $message_id = $row['message_id'];
>> }
>>
>> Which seems a bit insane.. is there no way to do a bindValue at the
>> same time as I do my bindParams?
>>
>> Now I write this I really can't remember why I am even putting that
>> second query into a foreach loop, even so it's still a step I'd like
>> to remove entirely if possible?
>>
>> Cheers,
>>
>> Rich

> From: http://www.php.net/manual/en/ref.pdo.php

> Example 1716. Calling a stored procedure with an input/output parameter

It's not an INOUT parameter though.

Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

attached mail follows:


I had a similar problem using PDO on MS Sql Server where I was trying to
return the id of an inserted row. I ended up giving up and doing a
second query to get IDENTITY.

Regards,

Bruce

>>> Richard Davey <richcorephp.co.uk> 27/07/2007 12:51 a.m. >>>
Hi,

I'm calling a MySQL Stored Procedure via PDO (PHP 5.2.3)

$stmt = $dbh->prepare('CALL forum_post(?, ?, ?, ?, ?, status,
thread_id, message_id)');

At the moment in order to get the values of status, thread_id and
message_id I need to issue a second query:

$sql = "SELECT status AS status, thread_id AS thread_id, message_id
AS message_id";

and then foreach my way through it:

foreach ($dbh->query($sql) as $row)
{
        $status = $row['status'];
        $thread_id = $row['thread_id'];
        $message_id = $row['message_id'];
}

Which seems a bit insane.. is there no way to do a bindValue at the
same time as I do my bindParams?

Now I write this I really can't remember why I am even putting that
second query into a foreach loop, even so it's still a step I'd like
to remove entirely if possible?

Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

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

attached mail follows:


Hi all,

I want to hide the real URL to my images by masking it with PHP
the code looks like this:

$query = "SELECT * FROM table";
$result=mysql_query($query);

while ($row = mysql_fetch_array($result))
{
echo "<img src='http://www.mysite.com/img/{$FileName}'/>";
}

if you look at the source in browser you will see:

<img src='http://www.mysite.com/img/111.jpg' />

how can I show it like this:

<img src='show.php?FileName=111.jpg' />

       
---------------------------------
Luggage? GPS? Comic books?
Check out fitting gifts for grads at Yahoo! Search.

attached mail follows:


> <img src='http://www.mysite.com/img/111.jpg' />
>
> how can I show it like this:
>
> <img src='show.php?FileName=111.jpg' />

1. Make your links point to <img src='show.php?FileName=111.jpg' />
2. In show.php, try the following:

<?php
        // This assumes all your images will be in "images/"
        // It also prevents using ../ for security
        $file = basename('images/' . $_GET['FileName']);

        if (file_exists($file)) {
                // You may need to use header() to send more headers,
                // eg. Caching headers (A very good idea) find out more
                // at http://www.mnot.net/cache_docs/ or use Fiddler to
                // find out what headers are being sent to your browser:
                // http://www.fiddlertool.com

                header('Content-Type: image/jpeg');
                passthru($file);
        }

?>

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

attached mail follows:


On 7/26/07, elk dolk <elkdolkyahoo.com> wrote:
> Hi all,
>
> I want to hide the real URL to my images by masking it with PHP
> the code looks like this:
>
> $query = "SELECT * FROM table";
> $result=mysql_query($query);
>
> while ($row = mysql_fetch_array($result))
> {
> echo "<img src='http://www.mysite.com/img/{$FileName}'/>";
> }
>
> if you look at the source in browser you will see:
>
> <img src='http://www.mysite.com/img/111.jpg' />
>
> how can I show it like this:
>
> <img src='show.php?FileName=111.jpg' />
>
>
>
> ---------------------------------
> Luggage? GPS? Comic books?
> Check out fitting gifts for grads at Yahoo! Search.

If you use $_SERVER['REQUEST_URI'] you can do all sorts of interesting things.

Say for instance you create a directory at the root of your site
called /images and put an index.php in there. Then inside of that
index.php you can parse the REQUEST_URI against some settings you'd
like and create your own sort of mod_rewrite rules out of it.

Here is an example:
<?php
var_dump($_SERVER['REQUEST_URI']);

$matches = array();
$result = preg_match('/([0-9]+).jpg$/D', $_SERVER['REQUEST_URI'], $matches);
if ($result == true) {
        echo 'Requested image: '. $matches[1];
}
?>

You can translate that 1111 to your image via a database call such as
SELECT imagename FROM hiddenimages WHERE id = 1111 or whatever you
want. People can still directly link to your images using this
technique.

Given that, you might also reconsider why you are hiding your image
filenames. Are you trying to protect them from unauthorized viewing?
If that is the case you can use the real filenames, but pass them
through a script that checks for a session set to you know that only
authenticated users can see them.

attached mail follows:


At 7/26/2007 06:18 AM, elk dolk wrote:
>I want to hide the real URL to my images by masking it with PHP
>the code looks like this:
>
>$query = "SELECT * FROM table";
>$result=mysql_query($query);
>
>while ($row = mysql_fetch_array($result))
>{
>echo "<img src='http://www.mysite.com/img/{$FileName}'/>";
>}
>
>if you look at the source in browser you will see:
>
><img src='http://www.mysite.com/img/111.jpg' />
>
>how can I show it like this:
>
><img src='show.php?FileName=111.jpg' />

Your primary script would echo:

         while ($row = mysql_fetch_array($result))
         {
                 // get the file name from the data table
                 $FileName = $row['filename'];

                 // encode the filename to be legal in an URL
                 $FileName = urlencode($FileName);

                 // download to browser
                 echo <<<_
<img src="show.php?FileName=$FileName" />
_;
         }

and the secondary script show.php could use logic such as this:

         // if the querystring contains the expected parameter
         if (isset($_GET['Filename']))
         {
                 // get requested filename
                 $Filename = 'img/' . $_GET['Filename'];

                         // if that file exists
                         if (file_exists($Filename))
                         {
                                 // output to browser, suppressing
error message
                                 readfile($Filename);
                         }
         }

Notes:

Your sample script included:
         echo "<img src='http://www.mysite.com/img/{$FileName}'/>";

Marking up your images as <img ... /> indicates that you want to use
XHTML. XHTML requires that attributes be quoted with double quotes,
not single quotes (apostrophes). Use <http://validator.w3.org/> to
validate your markup.

However, simply reversing the quotes in your statement would result in:
         echo '<img src="http://www.mysite.com/img/{$FileName}"/>';
This would not work because PHP would fail to expand the variable
name inside single quotes. Therefore you'd need to escape the inner
quotes like so:
         echo "<img src=\"http://www.mysite.com/img/{$FileName}\"/>";
or use heredoc (<<<...) which I prefer to use because it means not
having to escape the quotes. In a case like this it also means not
having to enclose the variable in curly braces:

         echo <<<_
<img src="show.php?FileName=$FileName" />
_;

urlencode: http://php.net/urlencode

heredoc syntax: http://php.net/heredoc#language.types.string.syntax.heredoc

isset: http://php.net/isset

file_exists: http://php.net/file_exists

readfile: http://php.net/readfile

Error Control Operator: http://php.net/

Regards,

Paul
__________________________

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com

attached mail follows:


eric,

ive seen this technique mentioned once or twice on the list now; do you know
of an article online
you could share that explains it?

-nathan

On 7/26/07, Eric Butera <eric.buteragmail.com> wrote:
>
> On 7/26/07, elk dolk <elkdolkyahoo.com> wrote:
> > Hi all,
> >
> > I want to hide the real URL to my images by masking it with PHP
> > the code looks like this:
> >
> > $query = "SELECT * FROM table";
> > $result=mysql_query($query);
> >
> > while ($row = mysql_fetch_array($result))
> > {
> > echo "<img src='http://www.mysite.com/img/{$FileName}'/>";
> > }
> >
> > if you look at the source in browser you will see:
> >
> > <img src='http://www.mysite.com/img/111.jpg' />
> >
> > how can I show it like this:
> >
> > <img src='show.php?FileName=111.jpg' />
> >
> >
> >
> > ---------------------------------
> > Luggage? GPS? Comic books?
> > Check out fitting gifts for grads at Yahoo! Search.
>
> If you use $_SERVER['REQUEST_URI'] you can do all sorts of interesting
> things.
>
> Say for instance you create a directory at the root of your site
> called /images and put an index.php in there. Then inside of that
> index.php you can parse the REQUEST_URI against some settings you'd
> like and create your own sort of mod_rewrite rules out of it.
>
> Here is an example:
> <?php
> var_dump($_SERVER['REQUEST_URI']);
>
> $matches = array();
> $result = preg_match('/([0-9]+).jpg$/D', $_SERVER['REQUEST_URI'],
> $matches);
> if ($result == true) {
> echo 'Requested image: '. $matches[1];
> }
> ?>
>
> You can translate that 1111 to your image via a database call such as
> SELECT imagename FROM hiddenimages WHERE id = 1111 or whatever you
> want. People can still directly link to your images using this
> technique.
>
> Given that, you might also reconsider why you are hiding your image
> filenames. Are you trying to protect them from unauthorized viewing?
> If that is the case you can use the real filenames, but pass them
> through a script that checks for a session set to you know that only
> authenticated users can see them.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


At 7/26/2007 06:18 AM, elk dolk wrote:
>I want to hide the real URL to my images

It should be pointed out that you can't really hide the real URL of
your images. If an image appears in a browser, the browser will
accurately report its location to the user, and the user can save it
to their hard drive.

If you're in a situation in which you're trying to avoid people
downloading images without permission, your best bets might be to
watermark, crop, low-res-ify, or otherwise disfigure the displayed
images to make them less attractive than the originals.

Regards,

Paul
__________________________

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com

attached mail follows:


Paul Novitski wrote:
> At 7/26/2007 06:18 AM, elk dolk wrote:
>> I want to hide the real URL to my images by masking it with PHP
>> the code looks like this:
>>
>> $query = "SELECT * FROM table";
>> $result=mysql_query($query);
>>
>> while ($row = mysql_fetch_array($result))
>> {
>> echo "<img src='http://www.mysite.com/img/{$FileName}'/>";
>> }
>>
>> if you look at the source in browser you will see:
>>
>> <img src='http://www.mysite.com/img/111.jpg' />
>>
>> how can I show it like this:
>>
>> <img src='show.php?FileName=111.jpg' />
>
>
> Your primary script would echo:
>
> while ($row = mysql_fetch_array($result))
> {
> // get the file name from the data table
> $FileName = $row['filename'];
>
> // encode the filename to be legal in an URL
> $FileName = urlencode($FileName);
>
> // download to browser
> echo <<<_
> <img src="show.php?FileName=$FileName" />
> _;
a heredoc for a single short line? why? isn't echo '<img
src="show.php?FileName='.$FileName.'" />'; just as easy? Or is it
because you didn't feel like escaping the double quotes and/or
concatenating strings? (yes, I really dislike heredoc, I know)
> }
>
> and the secondary script show.php could use logic such as this:
show.php?FileName=\0/etc/passwd
hint: use basename() on it.
>
> // if the querystring contains the expected parameter
> if (isset($_GET['Filename']))
> {
> // get requested filename
> $Filename = 'img/' . $_GET['Filename'];
>
> // if that file exists
> if (file_exists($Filename))
> {
> // output to browser, suppressing error
> message
why are you suppressing error messages??
> readfile($Filename);
> }
> }
>
> Notes:
>
> Your sample script included:
> echo "<img src='http://www.mysite.com/img/{$FileName}'/>";
>
> Marking up your images as <img ... /> indicates that you want to use
> XHTML. XHTML requires that attributes be quoted with double quotes, not
> single quotes (apostrophes). Use <http://validator.w3.org/> to validate
> your markup.
>
> However, simply reversing the quotes in your statement would result in:
> echo '<img src="http://www.mysite.com/img/{$FileName}"/>';
> This would not work because PHP would fail to expand the variable name
> inside single quotes. Therefore you'd need to escape the inner quotes
> like so:
> echo "<img src=\"http://www.mysite.com/img/{$FileName}\"/>";
> or use heredoc (<<<...) which I prefer to use because it means not
> having to escape the quotes. In a case like this it also means not
> having to enclose the variable in curly braces:
ok, nevermind, that answered my question :) Still a matter of taste
though, I'd prefer the concatenated version above any heredoc.
>
> echo <<<_
> <img src="show.php?FileName=$FileName" />
> _;
>
>
> urlencode: http://php.net/urlencode
>
> heredoc syntax: http://php.net/heredoc#language.types.string.syntax.heredoc
>
> isset: http://php.net/isset
>
> file_exists: http://php.net/file_exists
>
> readfile: http://php.net/readfile
>
> Error Control Operator: http://php.net/
>
>
> Regards,
>
> Paul
> __________________________
>
> Paul Novitski
> Juniper Webcraft Ltd.
> http://juniperwebcraft.com

attached mail follows:


Paul Novitski <pauljuniperwebcraft.com> wrote: Date: Thu, 26 Jul 2007 06:50:47 -0700
To: php-generallists.php.net
From: Paul Novitski <pauljuniperwebcraft.com>
Subject: Re: [PHP] Hide the real URL

Thank you Paul and everybody for the useful suggestions I need some time to test all of them.

elk

       
---------------------------------
Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool.

attached mail follows:


At 7/26/2007 08:08 AM, M. Sokolewicz wrote:
>> // output to browser, suppressing
>> error message
>why are you suppressing error messages??
>> readfile($Filename);

http://php.net/readfile

"Reads a file and writes it to the output buffer.

"Returns the number of bytes read from the file. If an error occurs,
FALSE is returned and unless the function was called as readfile(),
an error message is printed."

I figured that in the case of an image it would make more sense to
download a FALSE value to the browser than a text error
message. During development & debugging phases error messages are
invaluable, but after publication some circumstances dictate no
display rather than display of a message. Since the OP was looking
for a solution that obfuscated the image URL, I thought the less
techy information communicated to the user the better.

Richard Heyes' suggestion of using passthru() might work better if it
can be used with a mixture of content types on the same page.

And, yes, heredoc is definitely a matter of taste. In my own work,
its disadvantage (hugging left margin) is outweighed by its
advantages (separation of logic from data/template/output, omission
of escape codes except the occasional {}, fewer typographical errors,
faster proofreading, etc.). I don't feel the need to convince anyone
else to use heredoc, but I'm totally sold on it myself.

Regards,

Paul
__________________________

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com

attached mail follows:


On 7/26/07, Nathan Nobbe <quickshiftingmail.com> wrote:
> eric,
>
> ive seen this technique mentioned once or twice on the list now; do you know
> of an article online
> you could share that explains it?
>
> -nathan
>
>
> On 7/26/07, Eric Butera <eric.buteragmail.com> wrote:
> >
> > On 7/26/07, elk dolk <elkdolkyahoo.com> wrote:
> > > Hi all,
> > >
> > > I want to hide the real URL to my images by masking it with PHP
> > > the code looks like this:
> > >
> > > $query = "SELECT * FROM table";
> > > $result=mysql_query($query);
> > >
> > > while ($row = mysql_fetch_array($result))
> > > {
> > > echo "<img src='
> http://www.mysite.com/img/{$FileName}'/>";
> > > }
> > >
> > > if you look at the source in browser you will see:
> > >
> > > <img src='http://www.mysite.com/img/111.jpg ' />
> > >
> > > how can I show it like this:
> > >
> > > <img src='show.php?FileName=111.jpg' />
> > >
> > >
> > >
> > > ---------------------------------
> > > Luggage? GPS? Comic books?
> > > Check out fitting gifts for grads at Yahoo! Search.
> >
> > If you use $_SERVER['REQUEST_URI'] you can do all sorts of interesting
> things.
> >
> > Say for instance you create a directory at the root of your site
> > called /images and put an index.php in there. Then inside of that
> > index.php you can parse the REQUEST_URI against some settings you'd
> > like and create your own sort of mod_rewrite rules out of it.
> >
> > Here is an example:
> > <?php
> > var_dump($_SERVER['REQUEST_URI']);
> >
> > $matches = array();
> > $result = preg_match('/([0-9]+).jpg$/D', $_SERVER['REQUEST_URI'],
> $matches);
> > if ($result == true) {
> > echo 'Requested image: '. $matches[1];
> > }
> > ?>
> >
> > You can translate that 1111 to your image via a database call such as
> > SELECT imagename FROM hiddenimages WHERE id = 1111 or whatever you
> > want. People can still directly link to your images using this
> > technique.
> >
> > Given that, you might also reconsider why you are hiding your image
> > filenames. Are you trying to protect them from unauthorized viewing?
> > If that is the case you can use the real filenames, but pass them
> > through a script that checks for a session set to you know that only
> > authenticated users can see them.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
Hi Nathan,

There really isn't much to explain about it other than the fact that
Apache will give you the raw user input that is sent to it in
REQUEST_URI. Usually if a user is just clicking around it will be the
current page you are on.

Since we know that it will give us any user supplied value to it, we
can play around with those values by generating any sort of URL we
want.

If you create a file called blah.php and stick it in a web directory
somewhere then you might access it like this:

http://localhost/blah.php/?/hello

Here is the contents of blah.php:
<?php
var_dump($_SERVER['REQUEST_URI']);
?>

Here is the output:
string '/blah.php/?/hello' (length=17)

A few other urls:
http://localhost/blah.php/sometext
http://localhost/blah.php/?/category-23/item-164

Results:
string '/blah.php/sometext' (length=18)
string '/blah.php/?/category-23/item-164' (length=32)

If you replace blah.php with an index.php then you can have a cleaner
URL at the cost of not being able to use the $_GET superglobal. If we
were to try http://localhost/blah/somefile/111.jpg we would get a 404
error. To get around this you can add a query string in the url and
it works again. That is why you cannot use $_GET variables. If you
create a /blah directory and place an index.php in there you can do
this:

http://localhost/blah/?/somefile/111.jpg

Output:
$_SERVER['REQUEST_URI']: string '/blah/?/somefile/111.jpg' (length=24)
$_GET: array '/somefile/111_jpg' => string '' (length=0)

So there are some tradeoffs with something like this. It leads to a
cleaner url that you can easily parse with any preg_match. I only use
it in specific instances where I know that I'm only going to need
something like the 12 and 2 from /gallery/category-12/item-2.

attached mail follows:


eric,

thanks for taking time to explain this.

-nathan

On 7/26/07, Eric Butera <eric.buteragmail.com> wrote:
>
> On 7/26/07, Nathan Nobbe <quickshiftingmail.com> wrote:
> > eric,
> >
> > ive seen this technique mentioned once or twice on the list now; do you
> know
> > of an article online
> > you could share that explains it?
> >
> > -nathan
> >
> >
> > On 7/26/07, Eric Butera <eric.buteragmail.com> wrote:
> > >
> > > On 7/26/07, elk dolk <elkdolkyahoo.com> wrote:
> > > > Hi all,
> > > >
> > > > I want to hide the real URL to my images by masking it with PHP
> > > > the code looks like this:
> > > >
> > > > $query = "SELECT * FROM table";
> > > > $result=mysql_query($query);
> > > >
> > > > while ($row = mysql_fetch_array($result))
> > > > {
> > > > echo "<img src='
> > http://www.mysite.com/img/{$FileName}'/>";
> > > > }
> > > >
> > > > if you look at the source in browser you will see:
> > > >
> > > > <img src='http://www.mysite.com/img/111.jpg ' />
> > > >
> > > > how can I show it like this:
> > > >
> > > > <img src='show.php?FileName=111.jpg' />
> > > >
> > > >
> > > >
> > > > ---------------------------------
> > > > Luggage? GPS? Comic books?
> > > > Check out fitting gifts for grads at Yahoo! Search.
> > >
> > > If you use $_SERVER['REQUEST_URI'] you can do all sorts of interesting
> > things.
> > >
> > > Say for instance you create a directory at the root of your site
> > > called /images and put an index.php in there. Then inside of that
> > > index.php you can parse the REQUEST_URI against some settings you'd
> > > like and create your own sort of mod_rewrite rules out of it.
> > >
> > > Here is an example:
> > > <?php
> > > var_dump($_SERVER['REQUEST_URI']);
> > >
> > > $matches = array();
> > > $result = preg_match('/([0-9]+).jpg$/D', $_SERVER['REQUEST_URI'],
> > $matches);
> > > if ($result == true) {
> > > echo 'Requested image: '. $matches[1];
> > > }
> > > ?>
> > >
> > > You can translate that 1111 to your image via a database call such as
> > > SELECT imagename FROM hiddenimages WHERE id = 1111 or whatever you
> > > want. People can still directly link to your images using this
> > > technique.
> > >
> > > Given that, you might also reconsider why you are hiding your image
> > > filenames. Are you trying to protect them from unauthorized viewing?
> > > If that is the case you can use the real filenames, but pass them
> > > through a script that checks for a session set to you know that only
> > > authenticated users can see them.
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> >
> Hi Nathan,
>
> There really isn't much to explain about it other than the fact that
> Apache will give you the raw user input that is sent to it in
> REQUEST_URI. Usually if a user is just clicking around it will be the
> current page you are on.
>
> Since we know that it will give us any user supplied value to it, we
> can play around with those values by generating any sort of URL we
> want.
>
> If you create a file called blah.php and stick it in a web directory
> somewhere then you might access it like this:
>
> http://localhost/blah.php/?/hello
>
> Here is the contents of blah.php:
> <?php
> var_dump($_SERVER['REQUEST_URI']);
> ?>
>
> Here is the output:
> string '/blah.php/?/hello' (length=17)
>
> A few other urls:
> http://localhost/blah.php/sometext
> http://localhost/blah.php/?/category-23/item-164
>
> Results:
> string '/blah.php/sometext' (length=18)
> string '/blah.php/?/category-23/item-164' (length=32)
>
> If you replace blah.php with an index.php then you can have a cleaner
> URL at the cost of not being able to use the $_GET superglobal. If we
> were to try http://localhost/blah/somefile/111.jpg we would get a 404
> error. To get around this you can add a query string in the url and
> it works again. That is why you cannot use $_GET variables. If you
> create a /blah directory and place an index.php in there you can do
> this:
>
> http://localhost/blah/?/somefile/111.jpg
>
> Output:
> $_SERVER['REQUEST_URI']: string '/blah/?/somefile/111.jpg' (length=24)
> $_GET: array '/somefile/111_jpg' => string '' (length=0)
>
> So there are some tradeoffs with something like this. It leads to a
> cleaner url that you can easily parse with any preg_match. I only use
> it in specific instances where I know that I'm only going to need
> something like the 12 and 2 from /gallery/category-12/item-2.
>

attached mail follows:


On 7/26/07, Colin Guthrie <gmanecolin.guthr.ie> wrote:
> Well I managed to convince the Irish domain people to let me register
> guthr.ie which I think is pretty cool.
[snip]
> On the downside, as I use the domain quite a lot for numerous things, I
> now find it quite hard to write (type) my lastname /without/ the dot in
> it!! So my legacy will be to name any offspring with the dot in place on
> their birth certificate to avoid any hassle :p

    HA!

    Hey, on a side-note, has anyone else realized that this is
apparently the only PHP thread in the history of the list to not have
the prepended [PHP] in the subject line?

    .... or am I going retarded again?

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

attached mail follows:


On 7/26/07, Daniel Brown <parasanegmail.com> wrote:
> .... or am I going retarded again?

    This has been confirmed. For whatever reason, Gmail isn't showing
me the [PHP] mark in the subject for this thread. Perhaps because I'm
the OP.

    /me shrugs.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

attached mail follows:


Daniel Brown wrote:
> On 7/26/07, Daniel Brown <parasanegmail.com> wrote:
>> .... or am I going retarded again?
>
>
> This has been confirmed. For whatever reason, Gmail isn't showing
> me the [PHP] mark in the subject for this thread. Perhaps because I'm
> the OP.
>
> /me shrugs.
>

It's not the only, about 50% of threads have it, and another 50% don't.
For instance, the DOM thread does not have it, this thread has it in
between Re:'s, Hide the real URL has it, Pirate PHP books doesn't, etc.

attached mail follows:


M. Sokolewicz wrote:
> It's not the only, about 50% of threads have it, and another 50% don't.
> For instance, the DOM thread does not have it, this thread has it in
> between Re:'s, Hide the real URL has it, Pirate PHP books doesn't, etc.

I don't get them on any of my messages but then I read them all via nntp
and Gmane.org....

Col

attached mail follows:


On Thu, 2007-07-26 at 16:24 +0100, Colin Guthrie wrote:
> M. Sokolewicz wrote:
> > It's not the only, about 50% of threads have it, and another 50% don't.
> > For instance, the DOM thread does not have it, this thread has it in
> > between Re:'s, Hide the real URL has it, Pirate PHP books doesn't, etc.
>
> I don't get them on any of my messages but then I read them all via nntp
> and Gmane.org....

I get it in every message... must be a mail client thingy.

Cheers,
Rob.
--
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

attached mail follows:


On 7/26/07, Robert Cummings <robertinterjinn.com> wrote:
> On Thu, 2007-07-26 at 16:24 +0100, Colin Guthrie wrote:
> > M. Sokolewicz wrote:
> > > It's not the only, about 50% of threads have it, and another 50% don't.
> > > For instance, the DOM thread does not have it, this thread has it in
> > > between Re:'s, Hide the real URL has it, Pirate PHP books doesn't, etc.
> >
> > I don't get them on any of my messages but then I read them all via nntp
> > and Gmane.org....
>
> I get it in every message... must be a mail client thingy.
>
> Cheers,
> Rob.
> --
> ...........................................................
> SwarmBuy.com - http://www.swarmbuy.com
>
> Leveraging the buying power of the masses!
> ...........................................................
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

    That's what I'm guessing.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

attached mail follows:


Daniel Brown wrote:
> On 7/26/07, Robert Cummings <robertinterjinn.com> wrote:
>> On Thu, 2007-07-26 at 16:24 +0100, Colin Guthrie wrote:
>> > I don't get them on any of my messages but then I read them all via
>> nntp
>> > and Gmane.org....
>>
>> I get it in every message... must be a mail client thingy.
>
> That's what I'm guessing.
>

See, marking a thread as OT is no barrier to taking it OT from the OT!!

I love this list :p

Col

attached mail follows:


On 26 July 2007 16:10, M. Sokolewicz wrote:

> Daniel Brown wrote:
> > On 7/26/07, Daniel Brown <parasanegmail.com> wrote:
> > > .... or am I going retarded again?
> >
> >
> > This has been confirmed. For whatever reason, Gmail isn't
> > showing me the [PHP] mark in the subject for this thread. Perhaps
> > because I'm the OP.
> >
> > /me shrugs.
> >
>
> It's not the only, about 50% of threads have it, and another 50%
> don't. For instance, the DOM thread does not have it, this thread has
> it in between Re:'s, Hide the real URL has it, Pirate PHP books
> doesn't, etc.

What are you talking about??? That has to be an artifice of Gmail (and other clients?) -- every single message I've seen in every one of those topics has the [PHP] marker, just not always in exactly the same place:

   [PHP] About DOM function in PHP
   Re: [PHP] About DOM function in PHP
   [PHP] Re: About DOM function in PHP
   Re: [PHP] Re: About DOM function in PHP

   [PHP] Pirate PHP books online?
   Re: [PHP] Pirate PHP books online?
   [PHP] Re: Pirate PHP books online?
   Re: [PHP] Re: Pirate PHP books online?
   [PHP] Re: Re: Pirate PHP books online?
   Re: [PHP] Re: Re: Pirate PHP books online?
   Re[2]: [PHP] Re: Pirate PHP books online?
   Re: Re[2]: [PHP] Re: Pirate PHP books online?

I think I can kinda see a logic in there to do with a combination of smart and dumb email clients, and when the PHP list server adds a [PHP] marker, but I leave it as an exercise for the reader to figure out what it is... ;)

Bottom line, the [PHP] marker *is* there on every message, and if you're not seeing it it's 'cos your client is (for whatever reason) stripping it.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
JG125, The Headingley Library,
James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: m.fordleedsmet.ac.uk
Tel: +44 113 812 4730 Fax: +44 113 812 3211

To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm

attached mail follows:


On 7/26/07, Ford, Mike <M.Fordleedsmet.ac.uk> wrote:
> On 26 July 2007 16:10, M. Sokolewicz wrote:
>
> > Daniel Brown wrote:
> > > On 7/26/07, Daniel Brown <parasanegmail.com> wrote:
> > > > .... or am I going retarded again?
> > >
> > >
> > > This has been confirmed. For whatever reason, Gmail isn't
> > > showing me the [PHP] mark in the subject for this thread. Perhaps
> > > because I'm the OP.
> > >
> > > /me shrugs.
> > >
> >
> > It's not the only, about 50% of threads have it, and another 50%
> > don't. For instance, the DOM thread does not have it, this thread has
> > it in between Re:'s, Hide the real URL has it, Pirate PHP books
> > doesn't, etc.
>
> What are you talking about??? That has to be an artifice of Gmail (and other clients?) -- every single message I've seen in every one of those topics has the [PHP] marker, just not always in exactly the same place:
>
> [PHP] About DOM function in PHP
> Re: [PHP] About DOM function in PHP
> [PHP] Re: About DOM function in PHP
> Re: [PHP] Re: About DOM function in PHP
>
> [PHP] Pirate PHP books online?
> Re: [PHP] Pirate PHP books online?
> [PHP] Re: Pirate PHP books online?
> Re: [PHP] Re: Pirate PHP books online?
> [PHP] Re: Re: Pirate PHP books online?
> Re: [PHP] Re: Re: Pirate PHP books online?
> Re[2]: [PHP] Re: Pirate PHP books online?
> Re: Re[2]: [PHP] Re: Pirate PHP books online?
>
> I think I can kinda see a logic in there to do with a combination of smart and dumb email clients, and when the PHP list server adds a [PHP] marker, but I leave it as an exercise for the reader to figure out what it is... ;)
>
> Bottom line, the [PHP] marker *is* there on every message, and if you're not seeing it it's 'cos your client is (for whatever reason) stripping it.
>
> Cheers!
>
> Mike
>

The only threads were [PHP] is missing for me are the threads that I started.
All others start with [PHP] or Re: [PHP]

Tijnema

--
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

attached mail follows:


    Yeah, that's what I narrowed it down to as well. Must be a Gmail thing.

On 7/26/07, Tijnema <tijnemagmail.com> wrote:
> On 7/26/07, Ford, Mike <M.Fordleedsmet.ac.uk> wrote:
> > On 26 July 2007 16:10, M. Sokolewicz wrote:
> >
> > > Daniel Brown wrote:
> > > > On 7/26/07, Daniel Brown <parasanegmail.com> wrote:
> > > > > .... or am I going retarded again?
> > > >
> > > >
> > > > This has been confirmed. For whatever reason, Gmail isn't
> > > > showing me the [PHP] mark in the subject for this thread. Perhaps
> > > > because I'm the OP.
> > > >
> > > > /me shrugs.
> > > >
> > >
> > > It's not the only, about 50% of threads have it, and another 50%
> > > don't. For instance, the DOM thread does not have it, this thread has
> > > it in between Re:'s, Hide the real URL has it, Pirate PHP books
> > > doesn't, etc.
> >
> > What are you talking about??? That has to be an artifice of Gmail (and other clients?) -- every single message I've seen in every one of those topics has the [PHP] marker, just not always in exactly the same place:
> >
> > [PHP] About DOM function in PHP
> > Re: [PHP] About DOM function in PHP
> > [PHP] Re: About DOM function in PHP
> > Re: [PHP] Re: About DOM function in PHP
> >
> > [PHP] Pirate PHP books online?
> > Re: [PHP] Pirate PHP books online?
> > [PHP] Re: Pirate PHP books online?
> > Re: [PHP] Re: Pirate PHP books online?
> > [PHP] Re: Re: Pirate PHP books online?
> > Re: [PHP] Re: Re: Pirate PHP books online?
> > Re[2]: [PHP] Re: Pirate PHP books online?
> > Re: Re[2]: [PHP] Re: Pirate PHP books online?
> >
> > I think I can kinda see a logic in there to do with a combination of smart and dumb email clients, and when the PHP list server adds a [PHP] marker, but I leave it as an exercise for the reader to figure out what it is... ;)
> >
> > Bottom line, the [PHP] marker *is* there on every message, and if you're not seeing it it's 'cos your client is (for whatever reason) stripping it.
> >
> > Cheers!
> >
> > Mike
> >
>
> The only threads were [PHP] is missing for me are the threads that I started.
> All others start with [PHP] or Re: [PHP]
>
> Tijnema
>
> --
> Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

attached mail follows:


Am 2007-07-23 15:56:12, schrieb Sancar Saran:
> It was still ripping, They got 18 USD you got 2 USD. This is sucks. I'm not
> sure author of Harry Potter acceps same condition.
>
> You made everyone rich except yourself...

From the 18 USD, they payed me the proofreader and helped me to get
better layout.

And yes, if the book is sold over the normal bookstores I will earn
around 2 USD, but, - since I am using BOD, - I can sell the book my
own which mean, if I sell it for the same price, I earn 5-6 USD.

BUT, I have to pay the distribution and administration for it.

Greetings
    Michelle Konzack
    Systemadministrator
    Tamay Dogan Network
    Debian GNU/Linux Consultant

--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack Apt. 917 ICQ #328449886
                   50, rue de Soultz MSN LinuxMichi
0033/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFGqKhTC0FPBMSS+BIRArqIAKCFEDpxGjfkNKLZ806oZarR/cZzKQCgySUd
N1hFFOPk9YUhGq/oyNz4OrE=
=MBzu
-----END PGP SIGNATURE-----

attached mail follows:


Man-wai Chang wrote:
> You could open a sample book in bookstores, scan the chapters to
> decide whether you are gonna buy it.

Not even slightly relevant, but it made me think of this (seemingly
neverending) thread.

http://xkcd.com/294/

-Stut

--
http://stut.net/

attached mail follows:


On 7/26/07, Stut <stuttlegmail.com> wrote:
> Man-wai Chang wrote:
> > You could open a sample book in bookstores, scan the chapters to
> > decide whether you are gonna buy it.
>
> Not even slightly relevant, but it made me think of this (seemingly
> neverending) thread.
>
> http://xkcd.com/294/
>
> -Stut
>

Haha, good one stut!

Tijnema

--
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

attached mail follows:


On 7/26/07, Tijnema <tijnemagmail.com> wrote:
> On 7/26/07, Stut <stuttlegmail.com> wrote:
> > Man-wai Chang wrote:
> > > You could open a sample book in bookstores, scan the chapters to
> > > decide whether you are gonna buy it.
> >
> > Not even slightly relevant, but it made me think of this (seemingly
> > neverending) thread.
> >
> > http://xkcd.com/294/
> >
> > -Stut
> >
>
> Haha, good one stut!
>
> Tijnema
>
> --
> Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

    Christ, I'm the 100th post in this thread.... and this is even
after it forked a couple of times.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

attached mail follows:


On 7/26/07, Daniel Brown <parasanegmail.com> wrote:
> On 7/26/07, Tijnema <tijnemagmail.com> wrote:
> > On 7/26/07, Stut <stuttlegmail.com> wrote:
> > > Man-wai Chang wrote:
> > > > You could open a sample book in bookstores, scan the chapters to
> > > > decide whether you are gonna buy it.
> > >
> > > Not even slightly relevant, but it made me think of this (seemingly
> > > neverending) thread.
> > >
> > > http://xkcd.com/294/
> > >
> > > -Stut
> > >
> >
> > Haha, good one stut!
> >
> > Tijnema
> >
> > --
> > Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> Christ, I'm the 100th post in this thread.... and this is even
> after it forked a couple of times.

Hmm, I think you've missed some, mine was #201 according to Gmail :P
This one is #202..

Tijnema

--
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

attached mail follows:


Luc wrote:
> Good morning list,
>
> I have my form up and running but something is missing: if you omit
> required fields, the form returns an error like:
> please fill in ...
> please fill in...
>
> the error message is displayed above the form on the same page. The
> problem is that upon showing the error message, the fields already
> filled out, return blank so that the user has to fill everything in
> again.
>
> What i would like to have is that the data already filled out, is
> being saved when the error message kicks in so that the user doesn't
> have to start al over again.
>

The way that i generally handle this is to use a class. I instantiate an
object when the page loads, whether the form has been submitted or not.
Then, if it has been, i populate the object's values with the data
that's been posted, doing whatever validating that is required. Once
that has all been taken care of, the script checks to see if the object
has any errors set. If not, it then persists the data to the database
(or whatever is required).

If there are errors, i display the form again. However, this time the
object has values filled in. Thus, i can use form elements like so:

<input id="foo" name="foo" type="text"
   value="<?= $my_object->getFoo() ?>" />

Because i've instantiated the class even on the initial page load, the
getFoo() method simply returns NULL the first time. Another benefit is
that you can have default values for the class that the object will
populate the form with.

Also, you can set the error messages in the class, so the object can
display them at the proper place:

-- snip --
<?php
if ($my_object->hasError())
{
?>
   <p class="Error">There was an error with the submission. See below.</p>
<?php
}
?>

...

<fieldset>
   <legend>name</legend>

   <label for="first_name">first name</label>
   <input type="text" id="first_name" name="first_name"
     value="<?= $my_object->getFirstName() ?>" />

   <div class="Error"><?= $my_object->getError('first_name') ?></div>
</fieldset>

-- snip --

So, if the object's error array has something for the key 'first_name',
an error is returned. If not, NULL is returned.

In any case, no session is required.

attached mail follows:


Hello brian,

Thursday, July 26, 2007, 2:47:55 PM, you wrote:

> The way that i generally handle this is to use a class. I instantiate an
> object when the page loads, whether the form has been submitted or not.

Tnx for the response Brian.

Being a newbie i'll read your post carefully, trying to understand it
all and plunge into it :-)

--
Best regards,
 Luc

attached mail follows:


I'm trying to use PHP to compose an HTML formatted email and I'm running
into some small problems.

1) When using "Content-Type: multipart/mixed" during my testing both
Thunderbird and Gmail display the plain text and html version of the
email and Firefox attaches the html portion as an attachement.

2) When using "Content-Type: multipart/alternative" during my testing
Thunderbird only showed the HTML portion of the email but Gmail
displayed only a blank email.

3) Spam Assassin doesn't like it either way and tags the email as SPAM
for the following reasons:

 0.6 HTML_SHORT_LENGTH BODY: HTML is extremely short
 0.0 HTML_MESSAGE BODY: HTML included in message
 1.5 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding

Here is the script, which I mostly borrowed from tutorials/how to examples on the web.

$to="Tom Ray <listsblazestudios.com>";
$from="Support <testingblazestudios.com>";
$subject="Test HTML Email";

// --> plain text part of the email
$msgtext="This is HTML Testing";

//--> html part of the email
$htmlmsg=chunk_split(base64_encode("This is <b>HTML</b> testing."));

//--> create boundary
$sep = strtoupper(md5(uniqid(time())));

//--> create email
$header = "From: $from\n";
$header .= "MIME-Version: 1.0\n";
$header .= "Content-Type: multipart/mixed; boundary=$sep\n\n";

$header .= "--$sep\n";
$header .= "Content-Type: text/plain; charset=ISO-8859-1\n";
$header .= "Content-Transfer-Encoding: 8bit\n\n";
$header .= "$msgtext\n\n";

$header .= "--$sep\n";
$header .= "Content-Type: text/html; charset=ISO-8859-1\n";
$header .= "Content-Transfer-Encoding: base64\n\n";
$header.= "$htmlmsg\n\n";
$header .= "--$sep--";

//--> mail it
mail($to, $subject, "", $header);

Any help/suggestions would be appreciated.

attached mail follows:


I know it's not specificly a fix to your problem but it might be the easiest
solution. Check out http://phpmailer.sourceforge.net/ it lets you specify
an html and text body meaning it handles all the content-type stuff for you.
It's really a nice solution.

""Tom Ray [Lists]"" <listsblazestudios.com> wrote in message
news:46A8FA02.7000801blazestudios.com...
> I'm trying to use PHP to compose an HTML formatted email and I'm running
> into some small problems.
>
> 1) When using "Content-Type: multipart/mixed" during my testing both
> Thunderbird and Gmail display the plain text and html version of the email
> and Firefox attaches the html portion as an attachement.
>
> 2) When using "Content-Type: multipart/alternative" during my testing
> Thunderbird only showed the HTML portion of the email but Gmail displayed
> only a blank email.
>
>
> 3) Spam Assassin doesn't like it either way and tags the email as SPAM for
> the following reasons:
>
> 0.6 HTML_SHORT_LENGTH BODY: HTML is extremely short
> 0.0 HTML_MESSAGE BODY: HTML included in message
> 1.5 MIME_BASE64_TEXT RAW: Message text disguised using base64
> encoding
>
> Here is the script, which I mostly borrowed from tutorials/how to examples
> on the web.
>
> $to="Tom Ray <listsblazestudios.com>"; $from="Support
> <testingblazestudios.com>";
> $subject="Test HTML Email";
>
> // --> plain text part of the email $msgtext="This is
> HTML Testing";
> //--> html part of the email
> $htmlmsg=chunk_split(base64_encode("This is <b>HTML</b> testing."));
> //--> create boundary
> $sep = strtoupper(md5(uniqid(time())));
>
> //--> create email
> $header = "From: $from\n";
> $header .= "MIME-Version: 1.0\n";
> $header .= "Content-Type: multipart/mixed; boundary=$sep\n\n";
> $header .= "--$sep\n";
> $header .= "Content-Type: text/plain; charset=ISO-8859-1\n";
> $header .= "Content-Transfer-Encoding: 8bit\n\n";
> $header .= "$msgtext\n\n";
>
> $header .= "--$sep\n";
> $header .= "Content-Type: text/html; charset=ISO-8859-1\n";
> $header .= "Content-Transfer-Encoding: base64\n\n";
> $header.= "$htmlmsg\n\n";
> $header .= "--$sep--";
>
> //--> mail it
> mail($to, $subject, "", $header);
>
>
> Any help/suggestions would be appreciated.

attached mail follows:


I need to test a bunch of code that extensively uses a mysql database (both
selects and inserts), and I want to do it without actually writing to the
database.. Instead of commenting out all of the $db->query($insert_query)
statements and echoing $insert_query, I thought I'd make the following
object:

class TestDB {
    var $realDB;
    function TestDB(&$o)
    {
        echo $o;
        $this->realDB = &$o;
        echo $this->realDB;
    }
    function query($q)
    {
        echo $q;
    }
    function getOne($q)
    {
        return $this->realDB->getOne($q);
    }
    function getRow($q)
    {
        return $this->realDB->getRow($q);
    }
    function &resetDB()
    {
        return $this->realDB;
    }
}

Then, in my code, I instantiate it like so:

            $tmp = new TestDB($db);
            $db = &$tmp;

But this doesn't work, and I can't figure out why. When I try to call
$db->getRow($q) I was getting an error that said that I couldn't call a
member function of a non-object. I've changed things around now, and I'm
just not getting anything. Any idea why I would get the non-object error?
Thanks.

attached mail follows:


Found the problem. The piece of code was outside of a block where $db had
been created, so it was a non-object the whole time... Easily fixed, but a
hard error to find when I'm assuming it's my brand new class that's the
problem.

  -- Rob

""Rob Adams"" <rob_adamshotmail.com> wrote in message
news:91.27.10081.BDB09A64pb1.pair.com...
>I need to test a bunch of code that extensively uses a mysql database (both
>selects and inserts), and I want to do it without actually writing to the
>database.. Instead of commenting out all of the $db->query($insert_query)
>statements and echoing $insert_query, I thought I'd make the following
>object:
>
> class TestDB {
> var $realDB;
> function TestDB(&$o)
> {
> echo $o;
> $this->realDB = &$o;
> echo $this->realDB;
> }
> function query($q)
> {
> echo $q;
> }
> function getOne($q)
> {
> return $this->realDB->getOne($q);
> }
> function getRow($q)
> {
> return $this->realDB->getRow($q);
> }
> function &resetDB()
> {
> return $this->realDB;
> }
> }
>
> Then, in my code, I instantiate it like so:
>
> $tmp = new TestDB($db);
> $db = &$tmp;
>
> But this doesn't work, and I can't figure out why. When I try to call
> $db->getRow($q) I was getting an error that said that I couldn't call a
> member function of a non-object. I've changed things around now, and I'm
> just not getting anything. Any idea why I would get the non-object error?
> Thanks.

attached mail follows:


Most likely it's the server's time/date problem. Did you check to make sure
that the time/date is in the correct timezone, etc? I know this isn't
really the right way to do it, but you could always just move the server's
clock back 10 hours if it's really always 10 hours ahead of time. You
alternatively could also always use a different way of sending your mail for
that server. If you used PHPMailer http://phpmailer.sourceforge.net/ this
allows you to connect to SMTP on a different machine to send email from an
account. This one is really tougher than I origionally thought.

- Dan

""Chris Aitken"" <christhewebhub.com.au> wrote in message
news:200707260422.l6Q4McIr003499mail10.tpgi.com.au...
> Hi All,
>
>
>
> Just a query I have which by the looks of my research into it online,
> still
> exists on various installations around the world.
>
>
>
> The websites I build for my clients are scattered over several hosting
> servers, and I've noticed that one of them has an issue with the usage of
> the mail() function.
>
>
>
> The sever is running PHP Version 4.4.2 under Windows NT Server 5.2 build
> 3790.
>
>
>
> Whenever I use mail() to send an email out via a website, it goes out not
> a
> problem, but in the email program, the date received is around 10 hours
> ahead. This causes my clients much grief, especially those who have
> shopping
> carts and large numbers of emails and have the incoming emails listed all
> out of order because of the future date stamp.
>
>
>
> After digging into this somewhat, I had a friend of mine on a freebsd box
> got me to email him from one of the scripts, and his *nix mail filtering
> software hiccuped on the incoming message complaining that....
>
>
>
> X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char B8 hex): Date:
> Wed,
> 04
>
> Jul 2007 10:11:39 \2701000\n
>
>
>
> Now, he sent me the headers of the email that he received, and the "Date:
> "
> line in the headers was showing up as the following
>
>
>
> Date: Wed, 04 Jul 2007 10:11:39 ?1000
>
>
>
> With a ? before the 1000, which, but looking at all the other entries for
> the date in the headers, they all appear with the correct +1000 in place.
>
>
>
> Has anyone come across this or know of a reason why this is happening on
> this particular server. I have other hosting accounts on other windows and
> linux PHP boxes which do not have this issue. Just one this one server.
>
>
>
>
>
>
>
> Regards
>
>
>
>
> Chris Aitken
> The Web Hub Designer and Programmer
> Phone : 02 4648 0808
> Mobile : 0411 132 075
>
>
>
> -------------------------------------------------
>
>
>
> Making The Web Work........ The Web Hub
> <http://www.thewebhub.com.au/> http://www.thewebhub.com.au/
> <mailto:christhewebhub.com.au> christhewebhub.com.au
>
>
>
> -------------------------------------------------
>
>
>
> Confidentiality Statement:
> This message is intended only for the use of the Addressee and may contain
> information that is PRIVILEDGED and CONFIDENTIAL. If you are not the
> intended recipient, dissemination of this communication is prohibited.
> If you have received this communication in error, please erase all
> copies of the message and its attachments and notify us immediately.
>
>
>
>

attached mail follows:


> Most likely it's the server's time/date problem. Did you check to make
> sure that the time/date is in the correct timezone, etc? I know this
> isn't really the right way to do it, but you could always just move the
> server's clock back 10 hours if it's really always 10 hours ahead of time.

> You alternatively could also always use a different way of sending your
> mail for that server. If you used PHPMailer
> http://phpmailer.sourceforge.net/ this allows you to connect to SMTP on a
> different machine to send email from an account. This one is really
> tougher than I origionally thought.

The time on the machine is correct, and out of all of the date stamps in the
headers of the email are formed correctly based on the machines time/date,
(ie, everywhere else in the headers it adds the +1000 correctly) except in
the 1 main line

> Date: Day 00th Jan 2999 01:02:03 ?1000

Email programs (Wintendo based, and *nix based alike) generally have a hard
time with this Date header. Outlook and Outlook express just try and
interpret and guess what its supposed to mean (seemingly adding an extra 10
hours to the correct timestamp) and the *nix mail filter I came across
reported it as being a bad header.

Regards
 

Chris Aitken
The Web Hub Designer and Programmer
Phone : 02 4648 0808
Mobile : 0411 132 075
 
-------------------------------------------------
 
Making The Web Work........ The Web Hub
http://www.thewebhub.com.au/
christhewebhub.com.au
 
-------------------------------------------------
 
Confidentiality Statement:
This message is intended only for the use of the Addressee and may contain
information that is PRIVILEDGED and CONFIDENTIAL. If you are not the
intended recipient, dissemination of this communication is prohibited.
If you have received this communication in error, please erase all
copies of the message and its attachments and notify us immediately.

attached mail follows:


hi,
  My name is Juan, i need help from you and i will be greatful if you could assist me,i have got an academic project to create a website .Within the page i should create a login session for users ,i will have a database to save designs, i do know how to create the database but, do not know how to create the loggin sessions for users and also use flash in Php to enable a user to select one or more designs to appear on the other also to make a background color for the designs to be placed on,i ought to make it possible for the user to be able to change the background color to see which color suits the design,also make it possible for a user to be able to upload their own designs and make it sharable to other users.I will really appreciate if you will be able to direct me on how to go about this work.Looking forward to hearing from you soon.Thanks

       
---------------------------------
 Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for your freeaccount today.

attached mail follows:


On 26/07/07, esimaje juan toritseju <juantoritseyahoo.co.uk> wrote:
> hi,
> My name is Juan, i need help from you and i will be greatful if you could assist me,i have
> got an academic project to create a website .Within the page i should create a login session > for users ,i will have a database to save designs, i do know how to create the database but, > do not know how to create the loggin sessions for users and also use flash in

Have a look here for some ideas:-

http://www.intranetjournal.com/php-cms/

Alan

attached mail follows:


While we can point you in the right direction we can't build your project
for you. You cover such a wide range of topics it's like you're trying to
write a huge project but don't know actually how to use PHP. My
recomendation is to go get a good PHP book, there's been a lot of discussion
about good books in the newsgroups in the past, and read that. Most of
these topics are covered to some extent in a good book.

Also your question is really hard to follow, take a look at this
http://www.catb.org/~esr/faqs/smart-questions.html

- Dan

"esimaje juan toritseju" <juantoritseyahoo.co.uk> wrote in message
news:299901.44473.qmweb23310.mail.ird.yahoo.com...
> hi,
> My name is Juan, i need help from you and i will be greatful if you could
> assist me,i have got an academic project to create a website .Within the
> page i should create a login session for users ,i will have a database to
> save designs, i do know how to create the database but, do not know how to
> create the loggin sessions for users and also use flash in Php to enable a
> user to select one or more designs to appear on the other also to make a
> background color for the designs to be placed on,i ought to make it
> possible for the user to be able to change the background color to see
> which color suits the design,also make it possible for a user to be able
> to upload their own designs and make it sharable to other users.I will
> really appreciate if you will be able to direct me on how to go about this
> work.Looking forward to hearing from you soon.Thanks
>
>
> ---------------------------------
> Yahoo! Mail is the world's favourite email. Don't settle for less, sign up
> for your freeaccount today.

attached mail follows:


I have a situation where there is a single image let's call it somebody.jpg.
I want to be able to dynamicly create this image using php, basicilly I have
PHP set to handle .jpg files also, so I then go through and create an image
based upon some info I get from a database call and then use
header('Content-Type: image/jpeg');
passthru($file);
to send the image to the user.

My problem is once they view the image their browser "helpfully" caches it
so they don't have to download it again.

Is there any tactic short of changing the name constantly of the image to
avoid browser caching of an image?

- Dan

attached mail follows:


On 7/26/07, Dan <frozendicegmail.com> wrote:
> I have a situation where there is a single image let's call it somebody.jpg.
> I want to be able to dynamicly create this image using php, basicilly I have
> PHP set to handle .jpg files also, so I then go through and create an image
> based upon some info I get from a database call and then use
> header('Content-Type: image/jpeg');
> passthru($file);
> to send the image to the user.
>
> My problem is once they view the image their browser "helpfully" caches it
> so they don't have to download it again.
>
> Is there any tactic short of changing the name constantly of the image to
> avoid browser caching of an image?
>
> - Dan

Solution 1:
Send a header() that avoids caching (can't remember it exactly)
Solution 2:
Call the image like this:
<img src="image.jpg?arandomstringhereeachtime">
Or if you were creating it with a php script:
<img src="image.php?img=image.jpg&arandomstringhereeachtime">

Tijnema

--
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

attached mail follows:


> Solution 1:
> Send a header() that avoids caching (can't remember it exactly)
> Solution 2:
> Call the image like this:
> <img src="image.jpg?arandomstringhereeachtime">
> Or if you were creating it with a php script:
> <img src="image.php?img=image.jpg&arandomstringhereeachtime">

My preferred way of doing it, and making sure its reloaded each time is to
do it this way... the U variable pretty much guarantees a random string each
time its loaded.

image.jpg?".date("U")."

Regards
 

Chris Aitken
The Web Hub Designer and Programmer
Phone : 02 4648 0808
Mobile : 0411 132 075
 
-------------------------------------------------
 
Making The Web Work........ The Web Hub
http://www.thewebhub.com.au/
christhewebhub.com.au
 
-------------------------------------------------
 
Confidentiality Statement:
This message is intended only for the use of the Addressee and may contain
information that is PRIVILEDGED and CONFIDENTIAL. If you are not the
intended recipient, dissemination of this communication is prohibited.
If you have received this communication in error, please erase all
copies of the message and its attachments and notify us immediately.

attached mail follows:


Tijnema wrote:
> On 7/26/07, Dan <frozendicegmail.com> wrote:
>
>> I have a situation where there is a single image let's call it
>> somebody.jpg.
>> I want to be able to dynamicly create this image using php, basicilly
>> I have
>> PHP set to handle .jpg files also, so I then go through and create an
>> image
>> based upon some info I get from a database call and then use
>> header('Content-Type: image/jpeg');
>> passthru($file);
>> to send the image to the user.
>>
>> My problem is once they view the image their browser "helpfully"
>> caches it
>> so they don't have to download it again.
>>
>> Is there any tactic short of changing the name constantly of the image to
>> avoid browser caching of an image?
>>
>> - Dan
>
>
> Solution 1:
> Send a header() that avoids caching (can't remember it exactly)

You can try:

header('Cache-Control: no-store, no-cache, must-revalidate,
Post-Check=0, Pre-Check=0');

brian

attached mail follows:


On 7/27/07, brian <phplistsubtropolix.org> wrote:
> Tijnema wrote:
> > On 7/26/07, Dan <frozendicegmail.com> wrote:
> >
> >> I have a situation where there is a single image let's call it
> >> somebody.jpg.
> >> I want to be able to dynamicly create this image using php, basicilly
> >> I have
> >> PHP set to handle .jpg files also, so I then go through and create an
> >> image
> >> based upon some info I get from a database call and then use
> >> header('Content-Type: image/jpeg');
> >> passthru($file);
> >> to send the image to the user.
> >>
> >> My problem is once they view the image their browser "helpfully"
> >> caches it
> >> so they don't have to download it again.
> >>
> >> Is there any tactic short of changing the name constantly of the image to
> >> avoid browser caching of an image?
> >>
> >> - Dan
> >
> >
> > Solution 1:
> > Send a header() that avoids caching (can't remember it exactly)
>
> You can try:
>
> header('Cache-Control: no-store, no-cache, must-revalidate,
> Post-Check=0, Pre-Check=0');
>
> brian

That's HTTP/1.1 only, but this is what I got from PHP site:
<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>

Tijnema

--
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

attached mail follows:


>> header('Cache-Control: no-store, no-cache, must-revalidate,
>> Post-Check=0, Pre-Check=0');
>>
>> brian
>
>That's HTTP/1.1 only, but this is what I got from PHP site:
><?php
>header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
>header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
>?>
>

But wouldn't that make every image on the page be uncached and reloaded each
time? Not very efficient if the shell of the site keeps getting loaded if
only 1 or 2 images need to be forced.

Regards
 

Chris Aitken
The Web Hub Designer and Programmer
Phone : 02 4648 0808
Mobile : 0411 132 075
 
-------------------------------------------------
 
Making The Web Work........ The Web Hub
http://www.thewebhub.com.au/
christhewebhub.com.au
 
-------------------------------------------------
 
Confidentiality Statement:
This message is intended only for the use of the Addressee and may contain
information that is PRIVILEDGED and CONFIDENTIAL. If you are not the
intended recipient, dissemination of this communication is prohibited.
If you have received this communication in error, please erase all
copies of the message and its attachments and notify us immediately.

attached mail follows:


On 7/27/07, Chris Aitken <christhewebhub.com.au> wrote:
> >> header('Cache-Control: no-store, no-cache, must-revalidate,
> >> Post-Check=0, Pre-Check=0');
> >>
> >> brian
> >
> >That's HTTP/1.1 only, but this is what I got from PHP site:
> ><?php
> >header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
> >header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
> >?>
> >
>
> But wouldn't that make every image on the page be uncached and reloaded each
> time? Not very efficient if the shell of the site keeps getting loaded if
> only 1 or 2 images need to be forced.
>
>
>
>
> Regards
>
>
> Chris Aitken
> The Web Hub Designer and Programmer
> Phone : 02 4648 0808
> Mobile : 0411 132 075
>

Yes, that depends on which way it is used, I wouldn't recommend
loading images from the database that don't get changed...
And you can of course also use an
if-statement/switch-statement/in_array function in your image.php
script, like this:

$img = $_GET['img'];
if($img == "test_a.jpg" || $img == "test_b.jpg") {
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
}

OR:

$img = $_GET['img'];
switch($img) {
case "test_a.jpg":
case "test_b.jpg":
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
}

OR:

$img = $_GET['img'];
$noncached_images = array("test_a.jpg","test_b.jpg");
if(in_array($img,$noncached_images)) {
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
}

Tijnema

--
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

attached mail follows:


Is this header you're refering to the header of the page which contains the
image, or the image itself?

- Dan

"Tijnema" <tijnemagmail.com> wrote in message
news:d8269d910707261527o7ac08edap61802a712fbac7damail.gmail.com...
> On 7/27/07, brian <phplistsubtropolix.org> wrote:
>> Tijnema wrote:
>> > On 7/26/07, Dan <frozendicegmail.com> wrote:
>> >
>> >> I have a situation where there is a single image let's call it
>> >> somebody.jpg.
>> >> I want to be able to dynamicly create this image using php, basicilly
>> >> I have
>> >> PHP set to handle .jpg files also, so I then go through and create an
>> >> image
>> >> based upon some info I get from a database call and then use
>> >> header('Content-Type: image/jpeg');
>> >> passthru($file);
>> >> to send the image to the user.
>> >>
>> >> My problem is once they view the image their browser "helpfully"
>> >> caches it
>> >> so they don't have to download it again.
>> >>
>> >> Is there any tactic short of changing the name constantly of the image
>> >> to
>> >> avoid browser caching of an image?
>> >>
>> >> - Dan
>> >
>> >
>> > Solution 1:
>> > Send a header() that avoids caching (can't remember it exactly)
>>
>> You can try:
>>
>> header('Cache-Control: no-store, no-cache, must-revalidate,
>> Post-Check=0, Pre-Check=0');
>>
>> brian
>
> That's HTTP/1.1 only, but this is what I got from PHP site:
> <?php
> header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
> header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
> ?>
>
> Tijnema
>
> --
> Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

attached mail follows:


On 7/27/07, Dan <frozendicegmail.com> wrote:
> Is this header you're refering to the header of the page which contains the
> image, or the image itself?
>
> - Dan

The image itself.

Also note, that if you use my solution 2, you still might get
problems, as the page that is calling might be cached, and in the
cached page, it refers to the image with the same unique code, and it
will use the cached image again.

Also, if you use solution 2, the image will still stay forever in the
temp folder of the browser(unless the user is cleaning it). If you use
solution 1, the browser will keep it only for this page, and will
remove it afterwards.

Tijnema
>
> "Tijnema" <tijnemagmail.com> wrote in message
> news:d8269d910707261527o7ac08edap61802a712fbac7damail.gmail.com...
> > On 7/27/07, brian <phplistsubtropolix.org> wrote:
> >> Tijnema wrote:
> >> > On 7/26/07, Dan <frozendicegmail.com> wrote:
> >> >
> >> >> I have a situation where there is a single image let's call it
> >> >> somebody.jpg.
> >> >> I want to be able to dynamicly create this image using php, basicilly
> >> >> I have
> >> >> PHP set to handle .jpg files also, so I then go through and create an
> >> >> image
> >> >> based upon some info I get from a database call and then use
> >> >> header('Content-Type: image/jpeg');
> >> >> passthru($file);
> >> >> to send the image to the user.
> >> >>
> >> >> My problem is once they view the image their browser "helpfully"
> >> >> caches it
> >> >> so they don't have to download it again.
> >> >>
> >> >> Is there any tactic short of changing the name constantly of the image
> >> >> to
> >> >> avoid browser caching of an image?
> >> >>
> >> >> - Dan
> >> >
> >> >
> >> > Solution 1:
> >> > Send a header() that avoids caching (can't remember it exactly)
> >>
> >> You can try:
> >>
> >> header('Cache-Control: no-store, no-cache, must-revalidate,
> >> Post-Check=0, Pre-Check=0');
> >>
> >> brian
> >
> > That's HTTP/1.1 only, but this is what I got from PHP site:
> > <?php
> > header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
> > header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
> > ?>
> >
> > Tijnema
> >
> > --
> > Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

attached mail follows:


Well, this is only one specific image that constantly changes, the rest of
the page is handled regularly.
From what you've said if I go with this
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past

That will effect only the one specific image I use this on when generating
it right?

- Dan

"Tijnema" <tijnemagmail.com> wrote in message
news:d8269d910707261632k2d649476l102453e93eabf34dmail.gmail.com...
> On 7/27/07, Dan <frozendicegmail.com> wrote:
>> Is this header you're refering to the header of the page which contains
>> the
>> image, or the image itself?
>>
>> - Dan
>
> The image itself.
>
> Also note, that if you use my solution 2, you still might get
> problems, as the page that is calling might be cached, and in the
> cached page, it refers to the image with the same unique code, and it
> will use the cached image again.
>
> Also, if you use solution 2, the image will still stay forever in the
> temp folder of the browser(unless the user is cleaning it). If you use
> solution 1, the browser will keep it only for this page, and will
> remove it afterwards.
>
> Tijnema
>>
>> "Tijnema" <tijnemagmail.com> wrote in message
>> news:d8269d910707261527o7ac08edap61802a712fbac7damail.gmail.com...
>> > On 7/27/07, brian <phplistsubtropolix.org> wrote:
>> >> Tijnema wrote:
>> >> > On 7/26/07, Dan <frozendicegmail.com> wrote:
>> >> >
>> >> >> I have a situation where there is a single image let's call it
>> >> >> somebody.jpg.
>> >> >> I want to be able to dynamicly create this image using php,
>> >> >> basicilly
>> >> >> I have
>> >> >> PHP set to handle .jpg files also, so I then go through and create
>> >> >> an
>> >> >> image
>> >> >> based upon some info I get from a database call and then use
>> >> >> header('Content-Type: image/jpeg');
>> >> >> passthru($file);
>> >> >> to send the image to the user.
>> >> >>
>> >> >> My problem is once they view the image their browser "helpfully"
>> >> >> caches it
>> >> >> so they don't have to download it again.
>> >> >>
>> >> >> Is there any tactic short of changing the name constantly of the
>> >> >> image
>> >> >> to
>> >> >> avoid browser caching of an image?
>> >> >>
>> >> >> - Dan
>> >> >
>> >> >
>> >> > Solution 1:
>> >> > Send a header() that avoids caching (can't remember it exactly)
>> >>
>> >> You can try:
>> >>
>> >> header('Cache-Control: no-store, no-cache, must-revalidate,
>> >> Post-Check=0, Pre-Check=0');
>> >>
>> >> brian
>> >
>> > That's HTTP/1.1 only, but this is what I got from PHP site:
>> > <?php
>> > header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
>> > header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
>> > ?>
>> >
>> > Tijnema
>> >
>> > --
>> > Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
> --
> Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

attached mail follows:


Awesome, seems to work. Thanks Tijnema!

- Dan

""Dan"" <frozendicegmail.com> wrote in message
news:E7.21.58452.85239A64pb1.pair.com...
> Well, this is only one specific image that constantly changes, the rest of
> the page is handled regularly.
> From what you've said if I go with this
> header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
> header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
>
> That will effect only the one specific image I use this on when generating
> it right?
>
> - Dan
>
> "Tijnema" <tijnemagmail.com> wrote in message
> news:d8269d910707261632k2d649476l102453e93eabf34dmail.gmail.com...
>> On 7/27/07, Dan <frozendicegmail.com> wrote:
>>> Is this header you're refering to the header of the page which contains
>>> the
>>> image, or the image itself?
>>>
>>> - Dan
>>
>> The image itself.
>>
>> Also note, that if you use my solution 2, you still might get
>> problems, as the page that is calling might be cached, and in the
>> cached page, it refers to the image with the same unique code, and it
>> will use the cached image again.
>>
>> Also, if you use solution 2, the image will still stay forever in the
>> temp folder of the browser(unless the user is cleaning it). If you use
>> solution 1, the browser will keep it only for this page, and will
>> remove it afterwards.
>>
>> Tijnema
>>>
>>> "Tijnema" <tijnemagmail.com> wrote in message
>>> news:d8269d910707261527o7ac08edap61802a712fbac7damail.gmail.com...
>>> > On 7/27/07, brian <phplistsubtropolix.org> wrote:
>>> >> Tijnema wrote:
>>> >> > On 7/26/07, Dan <frozendicegmail.com> wrote:
>>> >> >
>>> >> >> I have a situation where there is a single image let's call it
>>> >> >> somebody.jpg.
>>> >> >> I want to be able to dynamicly create this image using php,
>>> >> >> basicilly
>>> >> >> I have
>>> >> >> PHP set to handle .jpg files also, so I then go through and create
>>> >> >> an
>>> >> >> image
>>> >> >> based upon some info I get from a database call and then use
>>> >> >> header('Content-Type: image/jpeg');
>>> >> >> passthru($file);
>>> >> >> to send the image to the user.
>>> >> >>
>>> >> >> My problem is once they view the image their browser "helpfully"
>>> >> >> caches it
>>> >> >> so they don't have to download it again.
>>> >> >>
>>> >> >> Is there any tactic short of changing the name constantly of the
>>> >> >> image
>>> >> >> to
>>> >> >> avoid browser caching of an image?
>>> >> >>
>>> >> >> - Dan
>>> >> >
>>> >> >
>>> >> > Solution 1:
>>> >> > Send a header() that avoids caching (can't remember it exactly)
>>> >>
>>> >> You can try:
>>> >>
>>> >> header('Cache-Control: no-store, no-cache, must-revalidate,
>>> >> Post-Check=0, Pre-Check=0');
>>> >>
>>> >> brian
>>> >
>>> > That's HTTP/1.1 only, but this is what I got from PHP site:
>>> > <?php
>>> > header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
>>> > header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
>>> > ?>
>>> >
>>> > Tijnema
>>> >
>>> > --
>>> > Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>>
>> --
>> Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

attached mail follows:


Ken Tozier wrote:
> Hi
>
> I wrote a serialization function to turn arbitrary PHP variables into
> Macintosh plist compatible XML but see that there is no "is_date" tester
> as there is for bool, object, array etc. Is there a relatively simple
> (and robust) way to detect if a variable is a date? For example:
>
> $person = array('name'=>'bob', 'sex'=>'male', 'date_of_birth'=>
> $someDateHere);
>
> Thanks for any help
>
> Ken
>
> --PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
Here is my suggestion. You COULD use strtotime() and try and have PHP see if it recognizes the
input string as a date time stamp or something.

Live example
http://www.cmsws.com/examples/php/is_date.php

source

<pre><?php

function is_date($in) {
        return (boolean) strtotime($in);
}

$dates = array(
                'tomorrow',
                'yesterday',
                'next week',
                'last year',
                'April 1st',
                'December 23, 1999 4pm',
                );

foreach ( $dates AS $row ) {
        echo "Time is: ".date('c', strtotime($row));
        echo " {$row} is ";
        var_dump(is_date($row));
}
        

?>

--
Jim Lucas

    "Some men are born to greatness, some achieve greatness,
        and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
     by William Shakespeare