php-general Digest 26 Jul 2007 12:21:16 -0000 Issue 4925

2007-07-26 Thread php-general-digest-help

php-general Digest 26 Jul 2007 12:21:16 - Issue 4925

Topics (messages 259544 through 259557):

Re: No is_date() function?
259544 by: Ken Tozier
259546 by: Crayon Shin Chan
259548 by: M. Sokolewicz

Malformed Email Date Header
259545 by: Chris Aitken

day in week
259547 by: Christian Hänsel
259549 by: M. Sokolewicz

Re: The Official OT Name Tedd's Grandson Thread
259550 by: Micky Hulse
259551 by: Colin Guthrie

appendChild(), removeChild()
259552 by: Man-wai Chang
259553 by: Richard Heyes
259554 by: Man-wai Chang
259555 by: Richard Heyes
259557 by: Man-wai Chang

Sessions?
259556 by: Luc

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]


--
---BeginMessage---


On Jul 25, 2007, at 10:37 AM, Edward Kay wrote:


PS: Please don't top post on mailing lists.


I'm unfamiliar with the term top post. What does it mean?
---End Message---
---BeginMessage---
On Thursday 26 July 2007 11:44, Ken Tozier wrote:
 On Jul 25, 2007, at 10:37 AM, Edward Kay wrote:
  PS: Please don't top post on mailing lists.

 I'm unfamiliar with the term top post. What does it mean?

But you are familiar with google?

-- 
Crayon
---End Message---
---BeginMessage---

This is top-posting

Ken Tozier wrote:


On Jul 25, 2007, at 10:37 AM, Edward Kay wrote:


PS: Please don't top post on mailing lists.


I'm unfamiliar with the term top post. What does it mean?


and this is bottom-posting.
Generally on mailinglists it's common to bottom-post and not top-post.
---End Message---
---BeginMessage---
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:[EMAIL PROTECTED] [EMAIL PROTECTED]

 

-

 

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.

 

---End Message---
---BeginMessage---

Good morning fellas,

I was wondering if there was a function like is_this_week()...

What I have is a statistics table for the last week, from strtotime(Last 
Monday) to strtotime(Last Sunday)... now I wanna put a different 
background colour on the rows where the shown weekday is in the current 
week... I hope you guess what I'm shooting at :o) So if today is Thursday, 
everything from last monday to last thursday should be shown in a 
different colour.


Does anybody have an idea? I was thinking of doing it with time() and 
maths but I was hoping there was a simpler approach.


All the best, the weekend is near!

Chris

--
-
My baby's first words will be
Hello World ... or maybe foo / bar ?
---End 

Re: [PHP] The Official OT Name Tedd's Grandson Thread

2007-07-26 Thread Micky Hulse

Congrats Tedd! :)

Cheers,
Micky

--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



[PHP] Re: day in week

2007-07-26 Thread M. Sokolewicz

Christian Hänsel wrote:

Good morning fellas,

I was wondering if there was a function like is_this_week()...

What I have is a statistics table for the last week, from 
strtotime(Last Monday) to strtotime(Last Sunday)... now I wanna put 
a different background colour on the rows where the shown weekday is in 
the current week... I hope you guess what I'm shooting at :o) So if 
today is Thursday, everything from last monday to last thursday 
should be shown in a different colour.


Does anybody have an idea? I was thinking of doing it with time() and 
maths but I was hoping there was a simpler approach.


All the best, the weekend is near!

Chris



for each of your days run a date('W', $thatDate) and compare it to a 
date('W', time()). the W modifier returns a weeknumber, if they match, 
it's this week, otherwise it's not.


- tul

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



[PHP] Re: The Official OT Name Tedd's Grandson Thread

2007-07-26 Thread Colin Guthrie
tedd wrote:
 At 8:53 AM -0400 7/25/07, Daniel Brown wrote:
First of all, congrats to Tedd on his 9th grandchild, a boy, at
 8lbs. 9oz.

Congrats do Tedd and to your son and his partner!

 My son just informed me that the baby's name is Jacob William Sperling.
 I now have a grandson who's name sounds older than me. Besides my son, I
 also have someone who I can pass the domain name of Sperling.com on to
 -- if that accounts for anything.
 
 Kind of neat being the first digital Sperling. Have any of you thought
 about the legacy you're leaving digitally?

Well I managed to convince the Irish domain people to let me register
guthr.ie which I think is pretty cool. Means I can create an email
address that is literally just my name with an at sign and a dot thrown
in! Also means that I can setup email addresses and websites for my
family pretty easily :)

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

Col

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



Re: [PHP] No is_date() function?

2007-07-26 Thread M. Sokolewicz

This is top-posting

Ken Tozier wrote:


On Jul 25, 2007, at 10:37 AM, Edward Kay wrote:


PS: Please don't top post on mailing lists.


I'm unfamiliar with the term top post. What does it mean?


and this is bottom-posting.
Generally on mailinglists it's common to bottom-post and not top-post.

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



[PHP] appendChild(), removeChild()

2007-07-26 Thread Man-wai Chang

If the child refers to a file, is it client-side only? I meant it's
nothing like AJAX, right?

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

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



Re: [PHP] query not working properly

2007-07-26 Thread Richard Davey
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

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



[PHP] query not working properly

2007-07-26 Thread Joey B

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


[PHP] Re: Hide the real URL

2007-07-26 Thread elk dolk


Paul Novitski [EMAIL PROTECTED] wrote: Date: Thu, 26 Jul 2007 06:50:47 -0700
To: php-general@lists.php.net
From: Paul Novitski [EMAIL PROTECTED]
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.

[PHP] HTML Email Composing Problem.

2007-07-26 Thread Tom Ray [Lists]
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 [EMAIL PROTECTED]; 
$from=Support [EMAIL PROTECTED];

$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 bHTML/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.

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



[PHP] Found the problem...

2007-07-26 Thread Rob Adams
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 [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
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. 


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



RE: [PHP] Is it possible to stop an image from being cached?

2007-07-26 Thread Chris Aitken
 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.jpgarandomstringhereeachtime

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/
[EMAIL PROTECTED]
 
-
 
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.

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



Re: [PHP] Is it possible to stop an image from being cached?

2007-07-26 Thread brian

Tijnema wrote:

On 7/26/07, Dan [EMAIL PROTECTED] 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

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



RE: [PHP] Re: Malformed Email Date Header

2007-07-26 Thread Chris Aitken

 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/
[EMAIL PROTECTED]
 
-
 
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.

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



Re: [PHP] need help,pls

2007-07-26 Thread Alan Milnes

On 26/07/07, esimaje juan toritseju [EMAIL PROTECTED] 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

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



Re: [PHP] Re: DOM

2007-07-26 Thread Larry Garfield
On Thursday 26 July 2007, 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.

Java has absolutely nothing to do with the subject at hand.  Java is a 
compiled bytecode language.  DOM is a language-agnostic API for managing 
tree-based data structure.

I suspect you're referring to Javascript, which has even less to do with Java 
than PHP does.  

Javascript is also not a specialized language-agnostic API.  Javascript is a 
fully capable and quite powerful semi-functional language in its own right 
(semi-functional meaning you can do functional programming in it, not that it 
only sort-of works g).  It is very frequently used for manipulating the DOM 
of an HTML page in a browser, but that is by no means its only ability any 
more than PHP is just a specialized HTML.  

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   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

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



Re: [PHP] Hide the real URL

2007-07-26 Thread tedd

At 6:18 AM -0700 7/26/07, elk dolk wrote:

Hi all,

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

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


elk:

Yes, but for what purpose do you want to hide the image url, for 
protection? If so, if the user can see your image, then they already 
have it.


If you want to pretty up your url's so that they look nice, there's 
several ways to do it as suggested on this list.


Additionally, you can use a mod-rewrite to do that -- you can read 
about it here:


http://www.roscripts.com/Pretty_URLs_-_a_guide_to_URL_rewriting-168.html

Neat stuff, but it doesn't protect your images.

There's a couple of protect your image schemes that will frustrate 
the typical user, but they can be easily broken, like the one I 
created here:


http://www.webbytedd.com/b/protect_image/

Others might have done it, but I haven't seen anyone do it this way.

Cheers,

tedd

PS: Okay guys, I know all of you can find where my dog picture 
actually is, but the point is can the typical user?

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Hide the real URL

2007-07-26 Thread Robert Cummings
On Thu, 2007-07-26 at 22:08 -0400, tedd wrote:

 There's a couple of protect your image schemes that will frustrate 
 the typical user, but they can be easily broken, like the one I 
 created here:
 
 http://www.webbytedd.com/b/protect_image/
 
 Others might have done it, but I haven't seen anyone do it this way.
 

 PS: Okay guys, I know all of you can find where my dog picture 
 actually is, but the point is can the typical user?

Firefox - Tools - Page Info - Media - Scroll Till Find - Bingo!

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



[PHP] Re: need help,pls

2007-07-26 Thread Dan
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 [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

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. 


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



Re: [PHP] Is it possible to stop an image from being cached?

2007-07-26 Thread Dan
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 [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

On 7/27/07, Dan [EMAIL PROTECTED] 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 [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On 7/27/07, brian [EMAIL PROTECTED] wrote:
 Tijnema wrote:
  On 7/26/07, Dan [EMAIL PROTECTED] 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 


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



Re: [PHP] Is it possible to stop an image from being cached?

2007-07-26 Thread Dan
Is this header you're refering to the header of the page which contains the 
image, or the image itself?


- Dan

Tijnema [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

On 7/27/07, brian [EMAIL PROTECTED] wrote:

Tijnema wrote:
 On 7/26/07, Dan [EMAIL PROTECTED] 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



Re: [PHP] Is it possible to stop an image from being cached?

2007-07-26 Thread Tijnema

On 7/27/07, Chris Aitken [EMAIL PROTECTED] 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

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



Re: [PHP] How to get stored procedure return values via PDO?

2007-07-26 Thread Bruce Cowin
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 [EMAIL PROTECTED] 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 

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



[PHP] Is it possible to stop an image from being cached?

2007-07-26 Thread Dan
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 


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



Re: [PHP] Is it possible to stop an image from being cached?

2007-07-26 Thread Tijnema

On 7/26/07, Dan [EMAIL PROTECTED] 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.jpgarandomstringhereeachtime

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



[PHP] need help,pls

2007-07-26 Thread esimaje juan toritseju
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.

[PHP] Re: HTML Email Composing Problem.

2007-07-26 Thread Dan
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] [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
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 [EMAIL PROTECTED]; $from=Support 
[EMAIL PROTECTED];

$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 bHTML/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. 


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



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

2007-07-26 Thread Tijnema

On 7/26/07, Stut [EMAIL PROTECTED] 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



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

2007-07-26 Thread Tijnema

On 7/26/07, Daniel Brown [EMAIL PROTECTED] wrote:

On 7/26/07, Tijnema [EMAIL PROTECTED] wrote:
 On 7/26/07, Stut [EMAIL PROTECTED] 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

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



Re: [PHP] Re: The Official OT Name Tedd's Grandson Thread

2007-07-26 Thread Daniel Brown

On 7/26/07, Robert Cummings [EMAIL PROTECTED] 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

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



[PHP] Re: The Official OT Name Tedd's Grandson Thread

2007-07-26 Thread Colin Guthrie
Daniel Brown wrote:
 On 7/26/07, Robert Cummings [EMAIL PROTECTED] 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


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



Re: [PHP] Hide the real URL

2007-07-26 Thread Paul Novitski

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 


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



Re: [PHP] Hide the real URL

2007-07-26 Thread Paul Novitski

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 


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



Re: [PHP] Hide the real URL

2007-07-26 Thread Paul Novitski

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 


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



Re: [PHP] Re: The Official OT Name Tedd's Grandson Thread

2007-07-26 Thread Daniel Brown

On 7/26/07, Daniel Brown [EMAIL PROTECTED] 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

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



Re: [PHP] Hide the real URL

2007-07-26 Thread Eric Butera

On 7/26/07, elk dolk [EMAIL PROTECTED] 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  to your image via a database call such as
SELECT imagename FROM hiddenimages WHERE id =  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



[PHP] Re: DOM

2007-07-26 Thread M. Sokolewicz

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.


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



[PHP] Hide the real URL

2007-07-26 Thread elk dolk
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.

[PHP] Re: How to get stored procedure return values via PDO?

2007-07-26 Thread M. Sokolewicz

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

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



[PHP] How to get stored procedure return values via PDO?

2007-07-26 Thread Richard Davey
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



[PHP] Re: appendChild(), removeChild()

2007-07-26 Thread Man-wai Chang
JavaScript (The main part of AJAX) runs on the client. Using AJAX you 
can have it call stuff on your server, but mainly it is client side only.




THX

--
  @~@   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:20:01 up 14 days 22:24 1 user load average: 0.00 0.01 0.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

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



[PHP] Sessions?

2007-07-26 Thread Luc
 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.

 Am i right in assuming this is done with a session, and if so how
 would i do that?

 here's my script:

$contact_form_action = $_SERVER['PHP_SELF'];
if ((isset($_POST[sendcontact]))  ($_POST[sendcontact] == contactsent)) 
{
$contacter_form_error = array();
if (empty($_POST['empresa_name'])){
$contacter_form_error[] = 'favor preencher nome da empresa';
}
if (empty($_POST['contato_name'])){
$contacter_form_error[] = 'favor preencher nome do contato';
}
if (empty($_POST['fone'])){
$contacter_form_error[] = 'favor preencher número do telefone';
}
if (empty($_POST['contato_email'])){
$contacter_form_error[] = 'favor preencher seu e-mail';
}
if (empty($_POST['produto'])){
$contacter_form_error[] = 'favor preencher o produto';
}
if (empty($_POST['origem'])){
$contacter_form_error[] = 'favor preencher origem';
}
if (empty($_POST['destino'])){
$contacter_form_error[] = 'favor preencher destino';
}
if (empty($_POST['quantidade'])){
$contacter_form_error[] = 'favor preencher quantidade';
}
if (empty($_POST['peso'])){
$contacter_form_error[] = 'favor preencher peso';
}
if (empty($_POST['comprimento'])){
$contacter_form_error[] = 'favor preencher comprimento';
}
if (empty($_POST['altura'])){
$contacter_form_error[] = 'favor preencher altura';
}
if (empty($_POST['largura'])){
$contacter_form_error[] = 'favor preencher largura';
}
else {
$empresa_name = stripslashes($_POST['empresa_name']);
$contato_email = stripslashes($_POST['contato_email']);

$body =EOB
 Prezado,
 Favor cotar, conforme os seguintes dados: 

Empresa: $_POST[empresa_name]
Contato: $_POST[contato_name]
Fone: $_POST[fone]
Fax: $_POST[fax]
Email: $_POST[contato_email]
Produto: $_POST[produto]
Origem: $_POST[origem]
Destino: $_POST[destino]
Quantidade: $_POST[quantidade]
Peso: $_POST[peso]
Comprimento: $_POST[comprimento]
Altura: $_POST[altura]
Largura: $_POST[largura]

Grato.
   
Atenciosamente,

$_POST[contato_name]
EOB;
$contato_name = $_POST['contato_name'];
$subjectline = $websitetitle | Orçamento de empresa;
$notification_message = Obrigado por nos contatar, $contato_name. Recebemos 
sua mensagem e entraremos em contato em breve.;
$notification_subject = Obrigado por sua mensagem para $websitetitle.;

@mail($contato_email,$subjectline,$body, From: $contato_email); 
@mail($contato_email,$notification_subject,$notification_message, From: 
$youremail);  

header(Location:$thankyoupage);   
}
}

 Some html text 
?
// Print form field errors if present
if (count($contacter_form_error)0){
print 'p id=bottomstrongAlgo está errado:/strong/p'.\n;
print 'ul'.\n;
foreach($contacter_form_error as $form_err) {
print li class=\error\$form_err/li\n;
}
print '/ul'.\n;
}
? 
form method=post id=contactform action=? print $contact_form_action; ?
pTodos os campos obrigatórios são marcados com asteriscos (span 
class=required*/span)./p
fieldset
legendSeus Dados/legend
label for=empresa_nameEmpresa span class=required*/span/label
br /
input type=text id=empresa_name name=empresa_name size=30 value=? 
print $empresa_name; ? /
br /
label for=contato_nameContato span class=required*/span/label
br /
input type=text id=contato_name name=contato_name size=30 value=? 
print $contato_name; ? /
br /
label for=foneNúmero do telefone span class=required*/span/label
br /
input type=text id=fone name=fone size=30 value=? print $fone; ? /
br /
label for=faxFax/label
br /
input type=text id=fax name=fax size=30 value=? print $fax; ? /
br /
label for=contato_emailE-mail span class=required*/span/label
br /
input type=text id=contato_email name=contato_email size=30 value=? 
print $contato_email; ? /
br /
label for=produtoProduto span class=required*/span/label
br /
input type=text id=produto name=produto size=30 value=? print 
$produto; ? /
br /
label for=origemOrigem span class=required*/span/label
br /
input type=text 

[PHP] Re: appendChild(), removeChild()

2007-07-26 Thread Man-wai Chang

If the child refers to a file, is it client-side only? I meant it's
nothing like AJAX, right?

Since JS runs on the client, yes.


... or unless the file was cached, right?

I am reading about these stuffs lately. :)

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

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



[PHP] error reporting

2007-07-26 Thread Bruce Cowin
I'm running PHP 5.1 on IIS.  My dev environment is all local on my
machine.  My php.ini has the following error reporting settings:

error_reporting  =  E_ALL
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
error_log = syslog

To test, I've written a little script that divides by 0.  When I run
the script from the command line, I get entries in my Event Log as
expected, but if I load the page into my browser (Firefox), no error is
reported in the Event Log.  

I've checked http://www.php.net/manual/en/ref.errorfunc.php but can't
find anything there.  I figure I must be missing something pretty
obvious but not sure what it is.  The script and logged error from the
command line are below.  Thanks for any help.

script:
html
titlehead/head/title
body
?php

$a = 5;
$b = 0;
$c = $a / $b;
echo $c;
?
/body
/html

logged error from command line:
The description for Event ID ( 2 ) in Source ( PHP-5.1.2 ) cannot be
found. The local computer may not have the necessary registry
information or message DLL files to display messages from a remote
computer. You may be able to use the /AUXSOURCE= flag to retrieve this
description; see Help and Support for details. The following information
is part of the event: php[2132], PHP Warning:  Division by zero in
C:\Inetpub\wwwroot\PHP\Testing\error.php on line 11.

Regards,

Bruce

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



Re: [PHP] DOM

2007-07-26 Thread Larry Garfield
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
[EMAIL PROTECTED]   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

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



Re: [PHP] Is it possible to stop an image from being cached?

2007-07-26 Thread Dan

Awesome, seems to work.  Thanks Tijnema!

- Dan

Dan [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
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 [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

On 7/27/07, Dan [EMAIL PROTECTED] 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 [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On 7/27/07, brian [EMAIL PROTECTED] wrote:
 Tijnema wrote:
  On 7/26/07, Dan [EMAIL PROTECTED] 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 


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



Re: [PHP] No is_date() function?

2007-07-26 Thread Jim Lucas

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

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



Re: [PHP] Is it possible to stop an image from being cached?

2007-07-26 Thread Tijnema

On 7/27/07, Dan [EMAIL PROTECTED] 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 [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On 7/27/07, brian [EMAIL PROTECTED] wrote:
 Tijnema wrote:
  On 7/26/07, Dan [EMAIL PROTECTED] 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

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



[PHP] Re: Malformed Email Date Header

2007-07-26 Thread Dan
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 [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

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:[EMAIL PROTECTED] [EMAIL PROTECTED]



-



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.






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



Re: [PHP] Hide the real URL

2007-07-26 Thread Nathan Nobbe

eric,

thanks for taking time to explain this.

-nathan

On 7/26/07, Eric Butera [EMAIL PROTECTED] wrote:


On 7/26/07, Nathan Nobbe [EMAIL PROTECTED] 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 [EMAIL PROTECTED] wrote:
 
  On 7/26/07, elk dolk [EMAIL PROTECTED] 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  to your image via a database call such as
  SELECT imagename FROM hiddenimages WHERE id =  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.



Re: [PHP] Hide the real URL

2007-07-26 Thread Eric Butera

On 7/26/07, Nathan Nobbe [EMAIL PROTECTED] 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 [EMAIL PROTECTED] wrote:

 On 7/26/07, elk dolk [EMAIL PROTECTED] 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  to your image via a database call such as
 SELECT imagename FROM hiddenimages WHERE id =  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.

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



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

2007-07-26 Thread Stut

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/

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



Re: [PHP] Re: The Official OT Name Tedd's Grandson Thread

2007-07-26 Thread Tijnema

On 7/26/07, Ford, Mike [EMAIL PROTECTED] wrote:

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

 Daniel Brown wrote:
  On 7/26/07, Daniel Brown [EMAIL PROTECTED] 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



Re: [PHP] Re: The Official OT Name Tedd's Grandson Thread

2007-07-26 Thread Robert Cummings
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



Re: [PHP] Re: The Official OT Name Tedd's Grandson Thread

2007-07-26 Thread M. Sokolewicz

Daniel Brown wrote:

On 7/26/07, Daniel Brown [EMAIL PROTECTED] 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.


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



Re: [PHP] Re: How to get stored procedure return values via PDO?

2007-07-26 Thread Richard Davey
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

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



[PHP] Re: DOM

2007-07-26 Thread Man-wai Chang

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

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



Re: [PHP] Re: appendChild(), removeChild()

2007-07-26 Thread Richard Heyes

Man-wai Chang wrote:

If the child refers to a file, is it client-side only? I meant it's
nothing like AJAX, right?

Since JS runs on the client, yes.


... or unless the file was cached, right?

I am reading about these stuffs lately. :)


JavaScript (The main part of AJAX) runs on the client. Using AJAX you 
can have it call stuff on your server, but mainly it is client side only.


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

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



[PHP] HELP: Text editor that deals with BOM very well

2007-07-26 Thread Ryan Lao
Hello everyone,

Just need to ask a simple question, where can a find a text editor that 
deals with byte order mark very well?
I've been using dreamweaver for a few years now but im not impressed by how 
it deals with BOM. i need a text editor that can view a bom and can remove 
it from the file and still save it as utf8.
any suggestions?

Ryan 

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



Re: [PHP] Is it possible to stop an image from being cached?

2007-07-26 Thread Tijnema

On 7/27/07, brian [EMAIL PROTECTED] wrote:

Tijnema wrote:
 On 7/26/07, Dan [EMAIL PROTECTED] 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



RE: [PHP] Re: The Official OT Name Tedd's Grandson Thread

2007-07-26 Thread Ford, Mike
On 26 July 2007 16:10, M. Sokolewicz wrote:

 Daniel Brown wrote:
  On 7/26/07, Daniel Brown [EMAIL PROTECTED] 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: [EMAIL PROTECTED]
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

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



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

2007-07-26 Thread Daniel Brown

On 7/26/07, Tijnema [EMAIL PROTECTED] wrote:

On 7/26/07, Stut [EMAIL PROTECTED] 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

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



Re: [PHP] Re: The Official OT Name Tedd's Grandson Thread

2007-07-26 Thread Daniel Brown

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

On 7/26/07, Tijnema [EMAIL PROTECTED] wrote:

On 7/26/07, Ford, Mike [EMAIL PROTECTED] wrote:
 On 26 July 2007 16:10, M. Sokolewicz wrote:

  Daniel Brown wrote:
   On 7/26/07, Daniel Brown [EMAIL PROTECTED] 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

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



Re: [PHP] Hide the real URL

2007-07-26 Thread M. Sokolewicz

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


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



Re: [PHP] Hide the real URL

2007-07-26 Thread Nathan Nobbe

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 [EMAIL PROTECTED] wrote:


On 7/26/07, elk dolk [EMAIL PROTECTED] 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  to your image via a database call such as
SELECT imagename FROM hiddenimages WHERE id =  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




Re: [PHP] Hide the real URL

2007-07-26 Thread Richard Heyes

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

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



Re: [PHP] HELP: Text editor that deals with BOM very well

2007-07-26 Thread Chris

Ryan Lao wrote:

Hello everyone,

Just need to ask a simple question, where can a find a text editor that 
deals with byte order mark very well?
I've been using dreamweaver for a few years now but im not impressed by how 
it deals with BOM. i need a text editor that can view a bom and can remove 
it from the file and still save it as utf8.

any suggestions?


Jedit can (http://www.jedit.org/) - yeh it's java but it works.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP] Createing a Test DB Object.

2007-07-26 Thread Rob Adams
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.


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



[PHP] Re: Pirate PHP books online?

2007-07-26 Thread Michelle Konzack
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/6192519367100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


Re: [PHP] Re: The Official OT Name Tedd's Grandson Thread

2007-07-26 Thread Daniel Brown

On 7/26/07, Colin Guthrie [EMAIL PROTECTED] 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

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



Re: [PHP] Is it possible to stop an image from being cached?

2007-07-26 Thread Richard Lynch
On Thu, July 26, 2007 6:32 pm, Tijnema wrote:
 Also, if you use solution 2, the image will still stay forever in the

Not forever.

Just until something else being downloaded shoves it out due to the
folder size restriction.

The browser might even be smart and keep oft-used resources in the
cache in favor of others rather than be strictly FIFO.

So a random URL makes browsers that were dumb enough to cache
something they shouldn't have cached (if you sent no cache headers)
clog up their cache with the un-re-usable files that it shouldn't
have saved anyway.

Oooh, hurt me. :-)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



RE: [PHP] Hide the real URL

2007-07-26 Thread Paul Novitski

At 7/26/2007 08:40 PM, Chris Aitken wrote:

  There's a couple of protect your image schemes that will frustrate
  the typical user, but they can be easily broken, like the one I
  created here:
 
  http://www.webbytedd.com/b/protect_image/
 

 Firefox - Tools - Page Info - Media - Scroll Till Find - Bingo!

Say Firefox to a typical user and they will assume you are swearing at
them in another language.

...

Typical users don't even KNOW they have a printscreen button just like
most typical users don't know there is ANOTHER kind of browser :)



That said, I don't think the hypothetical typical clueless user is 
relevant here.  A user who really wants to scrape images off websites 
will find a way with very little effort -- just google and a few 
clicks -- to view background images, to view page source, to disable 
javascript disabling of context menus, to install Firefox and the web 
developer toolbar, whatever; it's all within easy reach of anyone 
with motivation and average intelligence.  Sure, you can make it 
difficult for X% of computer users to locate your images, but those 
aren't the people you're worried about, it's the Y% who don't take no 
for an answer and try, try again.


Trying to solve the problem of theft of intellectual property at the 
browser level always seems to end in failure.  Just go back to the 
source and provide content that you don't mind people taking cuz you 
can't stop them if they really want to.


Had to smile yesterday, was walking past an espresso bar that doubles 
as an internet cafe.  A customer had approached the counter and was 
asking the barrista how to access his email because he couldn't find 
Explorer, and she advised him to click on Foxfire.  (Great movie, though.)


Regards,

Paul
__

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

Re: [PHP] Is it possible to stop an image from being cached?

2007-07-26 Thread Richard Lynch
On Thu, July 26, 2007 4:56 pm, Dan wrote:
 Is there any tactic short of changing the name constantly of the image
 to
 avoid browser caching of an image?

You can try to use all the zillion header calls people will send you.

Somewhere out there is a really stupid browser that will insist on
caching it.

src=somebody.jpg??php echo uniqid()? will make it very difficult
for any halfway-decent browser to cache.

However, that can lead to some issues when the URL of the image is
embedded elsewhere, as some folks will strip off the GET arg on the
assumption that it's invalid for a JPEG.

Embedding the random bit so that it LOOKS like a directory, but isn't,
will avoid that problem.

I blogged about how to do this kind of thing (in another context) over
here:
http://richardlynch.blogspot.com/2006/06/php-downloads-content-disposition.html

There are shorter / better explanations out there, but I don't know
where without Googling, and you know how to Google, right?

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



RE: [PHP] Hide the real URL

2007-07-26 Thread Chris Aitken
  There's a couple of protect your image schemes that will frustrate
  the typical user, but they can be easily broken, like the one I
  created here:
 
  http://www.webbytedd.com/b/protect_image/
 
 
 Firefox - Tools - Page Info - Media - Scroll Till Find - Bingo!
 

Say Firefox to a typical user and they will assume you are swearing at
them in another language.

No different to me saying...

CTRL - SHIFT - Print Screen - Paste into Photoshop.

Typical users don't even KNOW they have a printscreen button just like
most typical users don't know there is ANOTHER kind of browser :)



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/
[EMAIL PROTECTED]
 
-
 
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.

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



Re: [PHP] appendChild(), removeChild()

2007-07-26 Thread Richard Heyes
Man-wai Chang wrote:
 If the child refers to a file, is it client-side only? I meant it's
 nothing like AJAX, right?

Since JS runs on the client, yes.

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

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



[PHP] DOM

2007-07-26 Thread Man-wai Chang

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

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



[PHP] Re: The Official OT Name Tedd's Grandson Thread

2007-07-26 Thread Colin Guthrie
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

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



Re: [PHP] Sessions?

2007-07-26 Thread brian

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=ErrorThere was an error with the submission. See below./p
?php
}
?

...

fieldset
  legendname/legend

  label for=first_namefirst 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.

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



Re[2]: [PHP] Sessions?

2007-07-26 Thread Luc
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

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



RE: [PHP] Is it possible to stop an image from being cached?

2007-07-26 Thread Chris Aitken
 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/
[EMAIL PROTECTED]
 
-
 
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.

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



Re: [PHP] DOM

2007-07-26 Thread Richard Lynch
On Thu, July 26, 2007 7:39 am, 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?

No, that would be a useful feature, and browser-makers have much more
important (read: inane) features to implement.

:-)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] global variable does not exist anymore?

2007-07-26 Thread Richard Lynch
It's register_globals, and you should fix this ancient script to not
rely on register_globals being on

On Wed, July 25, 2007 5:30 pm, Patrik Hasibuan wrote:
 Dear my friends...

 I create a very simple script in html and php as a first step. I use
 suse, apache2, mysql and php.

 I wonder why this script does not work:
 !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 html
 head

   meta content=text/html; charset=ISO-8859-1
 http-equiv=content-type
   titleGuru - Virtual bookstore who understands you for those want
 to be a GURU/title


 /head
 body

 Help us for statistic data collection for increasing our service by
 'filling our guestbook'.br
 form action=cgi/cgibukutamu.php method=post
 table
 trtd align=rightName: /tdtd align=leftinput type=text
 name=tfnama/td/tr
 trtd align=rightLocation: /tdtd align=leftinput
 type=text name=tflokasi/td/tr
 trtd align=rightE-Mail: /tdtd align=leftinput type=text
 name=tfemail/td/tr
 trtd align=rightURL: /tdtd align=leftinput type=text
 name=tfurl/td/tr
 trtd align=rightComments: /tdtd align=leftinput
 type=text name=tfkomentar/td/tr
 trtd align=rightinput type=submit/tdtd
 align=leftinput type=reset/td/tr
 /table
 /form

 /body
 /html

 The value of tfnama is empty.
 cgi/cgibukutamu.php
 html
 table
 trtd/tdtd/td/tr
 trtd align=rightName/tdtd align=left?php echo $tfnama
 ?/td/tr
 /table
 /html

 I had a look the into the /etc/apache2 but I didn't find any
 global_variable switch as I used to find in httpd.conf
 
 suseonthelap:/etc/apache2 # grep -n -r global_variable ./*
 suseonthelap:/etc/apache2 #
 

 I got used to find global_variable=on line in the httpd.conf.

 What should I do now? Please tell me.
 --
 Patrik Hasibuan [EMAIL PROTECTED]
 Junior Programmer

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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Hide the real URL

2007-07-26 Thread Richard Lynch
On Thu, July 26, 2007 8:18 am, elk dolk 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' /

Change the URL to exactly what you typed and write a show.php script
that does a http://php.net/readfile on $FileName

You've missed a few minor bits and pieces, like $FileName never
actually gets pulled out of $row, but you're almost finished, except
for the debugging code and security issues:
http://phpsec.org/

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Hide the real URL

2007-07-26 Thread Richard Lynch
On Thu, July 26, 2007 8:41 am, Eric Butera wrote:
 filenames.  Are you trying to protect them from unauthorized viewing?

If you are trying to protect from unauthorized viewing, they probably
shouldn't be in the webtree at all, as it's not exactly rocket science
to guess that your images are in an images sub-directory, even if you
never show a URL to it...

You'd still do the same stuff, just put the images outside the webtree
so that the ONLY way to get to them is through your PHP script.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



RE: [PHP] Hide the real URL

2007-07-26 Thread Richard Lynch
On Thu, July 26, 2007 10:40 pm, Chris Aitken wrote:
  There's a couple of protect your image schemes that will
 frustrate
  the typical user, but they can be easily broken, like the one I
  created here:
 
  http://www.webbytedd.com/b/protect_image/
 

 Firefox - Tools - Page Info - Media - Scroll Till Find - Bingo!


 Say Firefox to a typical user and they will assume you are swearing
 at
 them in another language.

 No different to me saying...

 CTRL - SHIFT - Print Screen - Paste into Photoshop.

 Typical users don't even KNOW they have a printscreen button just
 like
 most typical users don't know there is ANOTHER kind of browser :)

Most of them will find it by accident in Google.

Probably while they are searching for something about doggie totally
unrelated to your picture. :-)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Malformed Email Date Header

2007-07-26 Thread Richard Lynch
Looks to me like the \270 is some kinda Unicode character instead of,
like, you know ASCII '+'...

Dunno how you managed to convince your mail system that you wanted it
to convert + to Unicode \270, mind you, but there it is.

On Wed, July 25, 2007 11:22 pm, Chris Aitken wrote:
 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:[EMAIL PROTECTED] [EMAIL PROTECTED]



 -



 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.






-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Re: Malformed Email Date Header

2007-07-26 Thread Richard Lynch
If the sysadmin told the BIOS that s/he was using UTC, but told the OS
that s/he was not using UTC (or vice versa) and then the clocks are
being adjusted, and if it's in time zone -5, then you'd have the
10-hour offset right there, I think...

Course, that has zilch to do with the \270 for '+' mind you, so the OP
may be looking at 2 bugs at once and assuming they are related when
they are not...

On Thu, July 26, 2007 4:23 pm, Dan wrote:
 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 [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 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:[EMAIL PROTECTED] [EMAIL PROTECTED]



 -



 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.





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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] HTML Email Composing Problem.

2007-07-26 Thread Richard Lynch
On Thu, July 26, 2007 2:46 pm, Tom Ray [Lists] wrote:
 I'm trying to use PHP to compose an HTML formatted email

Don't do that...

 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

The only people who send out these stupid HTML enhanced (cough, cough)
messages are spammers.

Okay, and people not clueful enough to turn off HTML in bad email
clients that default it on, so that they can send a zero-value-added
email with the HTML enhancment (cough, cough).

Still, the point is that you will most likely never ever fix problem 3.

[opinion]
HTML enhanced email is a blight up on the universe and should be
eradicated whenever and wherever possible.
[/opinion]

YMMV
NAIAA

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Malformed Email Date Header

2007-07-26 Thread Chris



X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char B8 hex): Date: Wed,
04 


Jul 2007 10:11:39 \2701000\n


Looks like a problem when you're building the headers.
Are you doing this manually (building the headers)?
What's the code look like to do this?

--
Postgresql  php tutorials
http://www.designmagick.com/

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



RE: [PHP] Malformed Email Date Header

2007-07-26 Thread Chris Aitken
 Looks to me like the \270 is some kinda Unicode character instead of,
 like, you know ASCII '+'...
 
 Dunno how you managed to convince your mail system that you wanted it
 to convert + to Unicode \270, mind you, but there it is.


Hi Richard,

Odd thing is all of the other headers of the email (see below for a
snippet of the headers) show the date stamp with the correct + and the
actual Date: header shows a ? instead of a +

I assumed that the 270 is a corrupted character that was substituted with a
? because it didn't know what else to put there. 

This error is spread throughout my google searches as some people have had
it happen from versions as old as mid 3 version of PHP through to later
versions of 4.

My only guess is that it seems to be some sort of inbuilt glitch within PHP
that reacts with some common denominator (version of IIS, version of
operating syetem etc) but noones been able to discover a reason.

--
Received: from storm by lightstorm.com.au 
(MDaemon PRO v9.5.6)
with ESMTP id md50002484423.msg
for [EMAIL PROTECTED]; Wed, 04 Jul 2007 10:11:41 +1000
Date: Wed, 04 Jul 2007 10:11:39 ?1000
--

Note the above how it puts the correct +1000 on the internal header, but the
one that becomes more of an external (or visible) header, has the ?1000


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/
[EMAIL PROTECTED]
 
-
 
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.

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



Re: [PHP] Re: The Official OT Name Tedd's Grandson Thread

2007-07-26 Thread Richard Lynch
On Thu, July 26, 2007 8:47 am, Daniel Brown wrote:
 On 7/26/07, Daniel Brown [EMAIL PROTECTED] 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.

I dunno what they are thinking to rip out the [PHP] whether it's on
threads you started or not.

Do they expect that you actually remember something you typed
yesterday as a thread you started?

Sheesh!

Nobody does that.

.
.
.

Okay, so maybe that's just me.
:-)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Objects

2007-07-26 Thread Richard Lynch
On Wed, July 25, 2007 6:33 am, Suporte - DPRJ Sistemas wrote:
 Is there anyone here interested in teaching (lond distance, off
 course) OOP?

 I would like to learn how to use objects (I have been working all my
 life using structured language). All the books I have tried just
 talk about theory not practical issues.

 I intend to pay for the classes.

You might find it more fruitful to find a local class in OOP practices
in general, or even Java OOP or almost any OOP-heavy language.

PHP OOP didn't grow out of nowhere, and while it's not all the same,
you'll probably get just as much out of any OOP class as you would a
PHP OOP class.

And the practical issues, well, few OOP courses really dive into that,
to tell you the truth...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] temp files

2007-07-26 Thread Richard Lynch
On Wed, July 25, 2007 3:55 am, admin wrote:
 $lines = gzfile(http://www.example.com/some/resource;);

 for its internal needs gzfile() creates a temp file such as
 /var/tmp/phpFjJxNX where the gzipped resource is kept. The file stays
 there forever and eventually the fs runs out of inodes. Any way to
 unlink the temp file from the script? I've found no api for that.
 Alternative code:

 $lines = file(compress.zlib://http://www.example.com/some/resource;);

 does the same thing still leaving the file around.

 Using PHP 4.3.3RC4 (built: Aug 24 2003 14:59:14)
 This could be a bug, but upgrading is not an option.

$files = glob('/var/tmp/php*');
foreach($files as $file){
  if (fileatime($file)  time() - 60*60*24*7) unlink($file);
}

You're on your own to convert that into something PHP 4.3.3RC4 can
actually do with:
http://php.net/readdir


-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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