php-general Digest 24 Dec 2009 04:30:24 -0000 Issue 6503

Topics (messages 300646 through 300658):

Re: File upload directive: $_FILES['filename']['name'] instead of 
$_FILES['filename']['tmp_name']
        300646 by: Richard Quadling
        300652 by: Richard Quadling

Re: Checking for internet connection.
        300647 by: Bob McConnell
        300648 by: Daniel Egeberg
        300650 by: Kim Madsen
        300651 by: Kim Madsen

Re: DailyWTF - Maybe I Needing Later
        300649 by: John Meyer
        300655 by: Adam Randall

PHP on-line instructor led TRAINING with ZEND Technologies
        300653 by: Debbie Otterstetter

Re: [PHP-DB] RE: Help for a beginner
        300654 by: Andy Shellam

sending email with php
        300656 by: Sudhakar
        300657 by: Andy Shellam
        300658 by: kranthi

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
2009/12/22 Andrei Iarus <poni1...@yahoo.com>:
> Hello,
>
> On my production & testing servers (production runs on a centrino and testing 
> runs on Windows) I can only access the temporary uploaded file using
> ini_get( 'upload_tmp_dir' . '/' . $_FILES['filename']['name'];
> while the file $_FILES['filename']['tmp_name'] simply does not exist (checked 
> with file_exists() function, and also looking in the temporary folder).
>
> Is there a problem with my PHP installations? Is there any directive to 
> change this bihaviour?
>
> On production: PHP 5.2.10 and on testing: PHP 5.2.8 and 5.3.0
>
> Thanks in advance.
>
>
>

2 functions to get to grips with:

1 - is_uploaded_file()
2 - move_uploaded_file()

Example from http://php.net/is_uploaded_file

<?php

if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
   echo "File ". $_FILES['userfile']['name'] ." uploaded successfully.\n";
   echo "Displaying contents\n";
   readfile($_FILES['userfile']['tmp_name']);
} else {
   echo "Possible file upload attack: ";
   echo "filename '". $_FILES['userfile']['tmp_name'] . "'.";
}

?>


-- 
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

--- End Message ---
--- Begin Message ---
2009/12/23 Andrei Iarus <poni1...@yahoo.com>:
> Of course: also tried the is_uploaded_file, exactly like in the manual. And
> it fails.... :(
>
> --- On Wed, 12/23/09, Richard Quadling <rquadl...@googlemail.com> wrote:
>
> From: Richard Quadling <rquadl...@googlemail.com>
> Subject: Re: [PHP] File upload directive: $_FILES['filename']['name']
> instead of $_FILES['filename']['tmp_name']
> To: "Andrei Iarus" <poni1...@yahoo.com>
> Cc: php-gene...@lists.php.net
> Date: Wednesday, December 23, 2009, 6:10 PM
>
> 2009/12/22 Andrei Iarus <poni1...@yahoo.com>:
>> Hello,
>>
>> On my production & testing servers (production runs on a centrino and
>> testing runs on Windows) I can only access the temporary uploaded file using
>> ini_get( 'upload_tmp_dir' . '/' . $_FILES['filename']['name'];
>> while the file $_FILES['filename']['tmp_name'] simply does not exist
>> (checked with file_exists() function, and also looking in the temporary
>> folder).
>>
>> Is there a problem with my PHP installations? Is there any directive to
>> change this bihaviour?
>>
>> On production: PHP 5.2.10 and on testing: PHP 5.2.8 and 5.3.0
>>
>> Thanks in advance.
>>
>>
>>
>
> 2 functions to get to grips with:
>
> 1 - is_uploaded_file()
> 2 - move_uploaded_file()
>
> Example from http://php.net/is_uploaded_file
>
> <?php
>
> if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
>    echo "File ". $_FILES['userfile']['name'] ." uploaded successfully.\n";
>    echo "Displaying contents\n";
>    readfile($_FILES['userfile']['tmp_name']);
> } else {
>    echo "Possible file upload attack: ";
>    echo "filename '". $_FILES['userfile']['tmp_name'] . "'.";
> }
>
> ?>
>
>
> --
> -----
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
>
>

What version of Windows?

Can you provide a really basic test?

And a var_dump($_FILES) please?

-- 
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

--- End Message ---
--- Begin Message ---
From: Kim Madsen

> Bob McConnell wrote on 23/12/2009 14:35:
>> From: Andy Shellam
>> 
>>>> And I was pointing out that this would not be a valid
>>>> test when there is a caching DNS on the LAN.
>> 
>>> I also pointed out how to avoid caching issues - the
>>> comment was aimed at the author of the message before mine.
>>>
>>>> Too much of the conversation and most of the attribution
>>>> was stripped too early for this to be coherent.
>>> Why the negativity?  A question was asked and several
>>> possible solutions were provided based on that original
>>> question.  All the "conversation" was relevant IMO.
>> 
>> But long before it was done it was impossible to tell who had asked
>> which questions, who had provided which answers and who had countered
>> those answers. In several instances, replies appeared to be directed
to
>> the wrong individuals.
> 
>> Some people here tend to go way too far when trimming context from
>> replies. Yes, I know it gets difficult to read when there are more
than
>> ten or twelve levels of attribution, but stripping all but the last
>> layer is even worse.
> 
> No, that's called netetiquette, have a look at: 
> http://www.the-eggman.com/writings/etiquitte_1.html
> 
> Quote: "When responding to E-Mail, don't quote the entire original 
> message in your reply. Only quote the relevant parts, and only to the 
> extent that they will help orient the recipient on your reply."

The problem arises when too many of the relevant parts are also removed,
which happened far too often on this thread as well as others. When the
core context is not retained, the conversation drifts and quickly
becomes useless to either the early posters or later readers.

I did not mean to be rude, but to point out what I see as a serious
problem that has been growing on this list recently. On the other hand,
I have not had my cup of hot chocolate yet this morning, so am probably
not completely awake yet.

Bob McConnell

--- End Message ---
--- Begin Message ---
On Wed, Dec 23, 2009 at 14:35, Bob McConnell <r...@cbord.com> wrote:
> I don't keep copies of every message in any of the
> dozens of mailing lists and news groups I follow, so there is no simple
> way to go back through the conversation to figure out where it all came
> from.

Fortunately, other people keep complete archives for you:
http://news.php.net/php.general
http://marc.info/?l=php-general

--- End Message ---
--- Begin Message ---
Bob McConnell wrote on 23/12/2009 15:55:

> The problem arises when too many of the relevant parts are also removed,
> which happened far too often on this thread as well as others. When the
> core context is not retained, the conversation drifts and quickly
> becomes useless to either the early posters or later readers.

just don't delete mails that are recent, delete after 3 months for instance? And if possible (I see some Exchange dirt in the mailheader :-)) use a mailclient that supports thread, I use Thunderbird and when subscribing to maillists this is really cool, I have a quick overview of the mails on the subject.

> I did not mean to be rude, but to point out what I see as a serious
> problem that has been growing on this list recently. On the other hand,
> I have not had my cup of hot chocolate yet this morning, so am probably
> not completely awake yet.

Okay, explanation excepted, E-mails can easily be misunderstood :-) May you have a merry Christmas (grab another cup of choco, just in case ;-))

--
Kind regards
Kim Emax - masterminds.dk

--- End Message ---
--- Begin Message ---
Kim Madsen wrote on 23/12/2009 17:01:

Okay, explanation excepted, E-mails can easily be misunderstood :-) May you have a merry Christmas (grab another cup of choco, just in case ;-))

correction: accepted

Now _I'M_ gonna get a cup of chocolate :-)

--
Kind regards
Kim Emax - masterminds.dk

--- End Message ---
--- Begin Message ---
On 12/22/2009 9:10 PM, Daevid Vincent wrote:
http://thedailywtf.com/Articles/Maybe-I-Needing-Later.aspx


Read this, just loved it. Moral of the story (though some may turn it racist or otherwise moronic): maybe hiring at the lowest possible bidder isn't always the best idea.
--- End Message ---
--- Begin Message ---
Unfortunately, this is how government works too. About 10 years ago while
maintaining the Golden Gate website I had to post contracts to their site.
These would be for things like seismic retrofits, etc. Contractors would bid
on the contracts, and whoever came up the lowest was the winner.

Nice to know that the guys making your bridges more earthquake resistant are
the ones who are the cheapest.

Adam.

On Wed, Dec 23, 2009 at 7:34 AM, John Meyer
<johnme...@pueblocomputing.com>wrote:

> On 12/22/2009 9:10 PM, Daevid Vincent wrote:
>
>> http://thedailywtf.com/Articles/Maybe-I-Needing-Later.aspx
>>
>>
>
>
> Read this, just loved it.  Moral of the story (though some may turn it
> racist or otherwise moronic): maybe hiring at the lowest possible bidder
> isn't always the best idea.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Adam Randall
http://www.xaren.net
AIM: blitz574

--- End Message ---
--- Begin Message ---
Did you know that Zend Technologies is known as The PHP Company?  And,
that we offer training?  Check out details about our upcoming on-line
instructor led classes at
http://www.zend.com/en/services/training/administration/course-schedule.
Here are the classes we have coming up in January:

 

PHP I: Foundations:  Jan. 4, 6, 8, 11, 13, 15, 18, 20 & 22  from 8-10am
PST

 

PHPII: Higher Structures:  Jan. 4, 6, 8, 11, 13, 15, 18, 20 & 22  from
4-6pm PST

 

Test Prep: PHP 5 Certification:  Jan. 4, 5, 6, 7, 8, 11, 12, 13 & 14
from 8-10am PST

 

Quick Start for Experienced Programmers:  Jan. 19, 20, 21, 22, 25, 26,
27, 28 & 29  from 8-10am PST

 

PHP I: Foundations for i5:  Jan. 4, 6, 8, 11, 13, 15, 19, 20 & 22  from
12-2pm PST 

 

Building Security into your PHP Applications:  Jan. 26, 27 & 28  from
9-11am PST

 

Zend Framework: Jan. 4, 5, 6, 7, 8, 11, 12, 13 & 14  from 8-10am  PST

and another class starting  Jan. 19, 20, 21, 22, 25, 26, 27, 28 & 29
from 4-6pm PST

 

Zend Studio:  Jan. 19, 20, 22, 25, 27 & 29  from 12-2:30pm PST

 

Please let me know if you have any questions.

 

Debbie Ottestetter

Training Program Manager

Zend Technologies, Inc.

 

 


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


On 23 Dec 2009, at 17:21, Adam Sonzogni wrote:

> If you read the thread I useda php page totest mysql connectivity after 
> phpmyadmin did not work...
> 
> At this point I am willing to pay someone to troubleshoot this as I am 
> baffled there is no definitive troubleshooting documentation for Windows 
> installs.

That's because nobody likes Windows ;-)

> 
> What is at Line 4 in your test.asp? The error you provided said that there
> was a problem where it could not find the default driver to use.
> 
> Also when you get the connection failed you were trying to connect to MYSQL
> from the system running MYSQL correct?

I'd suggest installing the MySQL GUI tools (from http://dev.mysql.com) on your 
server - they may give you a better picture of what's going on.

I take it you've installed the ODBC connector for MySQL?  You didn't mention in 
your post if you had or not and I'm not familiar enough with MySQL on Windows 
to know if the essentials package includes it.

The error you're getting from ASP means it doesn't recognise the driver "mySQL" 
or is looking for an ODBC connection called "mySQL" which doesn't exist.

Regards,
Andy


--- End Message ---
--- Begin Message ---
<?php

$headers = "Content-type: text/html; charset=iso-8859-1";
$to="myemailaddress";
$subject="Email Newsletter";

$message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<title>Email Newsletter</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex, nofollow" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>

<body>
<div id="wrapper">
<div id="topmenu">
</div>
<div id="content">
<div class="leftcolumn">
</div>
<div class="rightcolumn">
</div>
</div>
<div id="footer">
</div>
</div>
</body>
</html>';

if(! mail($to, $subject, $message, $headers)){
echo "There was an error is sending the email";
}
else{
echo "The email has been sent";
}
?>

hi

my question is about send an email with php like a newsletter, when we read
a newsletter email its similar to a webpage which contains content, images,
css and other elements

i created a static webpage initially with html css and images folder after
creating the page i wanted to test to see how it would look if i were to
send this as an email like a newsletter.

so i have created a php file with
$headers = "Content-type: text/html; charset=iso-8859-1";
$to="myemailaddress";
$subject="Email Newsletter";
and
$message as mentioned above has the entire html code as i used it in my
static html page
i also copied the style.css in the server and created images folder and
copied all the images i used in my static page to the server.

i created a separate folder in my webserver called newsletter and copied the
php file, css file and images folder with the images i used

when i accessed the index.php as http://website.com/emailnewsletter i am
getting a message that The email has been sent and i am getting the email

however my question is when i open this email the styles and images are not
being applied and i see only the text in the static page i created.


can someone let me know how i can fix this so that when i open the email it
would look like the static page i created with all the styles applies and
images displayed

is this only possible by using specialized email softwares or can it be done
by php as well with the logic used.


any help will be appreciated.

thanks

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

> <link rel="stylesheet" type="text/css" href="style.css" />

Relative URLs won't work - when it's rendered inside the e-mail client, the 
relative URL has no meaning (I believe Outlook renders relative URLs relative 
to the temporary directory the HTML is being rendered in.)  Other clients may 
do it relative to an imap://.... URL.

Try uploading the images and stylesheet to your website and putting them within 
the newsletter as absolute URLs (including the images) - e.g. <link 
rel="stylesheet" type="text/css" href="http://www.yourwebsite.com/style.css"; />

Also I know this is OT and is completely up to you, but remember to include a 
plain-text part, and also realise that a lot of mail clients don't render 
images/stylesheets by default - therefore straight after the <body> tag before 
the rest of the content, put a link to an external website where recipients can 
view the content online.

Regards,
Andy


--- End Message ---
--- Begin Message ---
another point worth noting...

most of the major email clients does not display external css/images by
default. The user will have to grant permission explicitly.

--- End Message ---

Reply via email to