php-general Digest 22 Mar 2010 02:28:46 -0000 Issue 6652

Topics (messages 303075 through 303082):

Re: PHP SMTP Mailers
        303075 by: King Coffee

Re: Session Variable Problem
        303076 by: Gary
        303077 by: tedd

XSLTProcessor issue
        303078 by: Tom

Code samples in OOo Presenter
        303079 by: Larry Garfield
        303080 by: Ashley Sheridan
        303081 by: Larry Garfield
        303082 by: Paul M Foster

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 ---
Thanks Jan G. B., You got me over the first hump.

I'm having programs installing pear on my VISTA localhost...
So, I uploaded the Mail folder and Mail.php file to my
Shared Hosting ISP. I do not think pear is provided.

The Testing is as follows:

<?php

require_once "Mail.php";

// SSL HOST
$host = "ssl://smtp.gmail.com";
$port = "587";
$username = "sen...@gmail.com";
$password = "Password";
$from = "King Coffee <sen...@gmail.com>";
$to = "Bill <recipi...@hotmail.com>";
$subject = "PHP Mail Test";
$body = "This is a simple mail test!";

$headers = array('From' => $from,
'To' => $to,
'Subject' => $subject);

$smtp = Mail::factory('smtp',
array('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password));

$mail = $smtp->send($to, $header, $body);

if(PEAR::isError($mail)) {
        echo( "<p>" . $mail->getMessage() . "</p>");
} else {
        echo("<p>Message successfully sent</p>");
}

?>

<html>
<head>
<title>PHP EMAIL TESTER</title>
<h1>This is a test</h1>
<?php Echo "Hi King"; ?>
</head>
</html>

When I run the server page, The following error is displayed:

Warning: require_once(PEAR.php) [function.require-once]: failed to open stream: No such file or directory in D:\Hosting\ID#\html\auction\Mail.php on line 46

Fatal error: require_once() [function.require]: Failed opening required 'PEAR.php' (include_path='.;C:\php5\pear') in D:\Hosting\ID#\html\auction\Mail.php on line 46

I will be still trying the get pear installed in VISA, but meanwhile, how can I obtain the PEAR.php and supporting files to upload?

Thanks,
King
--- End Message ---
--- Begin Message ---
Thanks again for all the help, however the plot thickens.

I have put:

<?php if(!isset($_SESSION)) {
    session_start();
 }
 if (isset($_POST['lend_fname'])){
$_SESSION['lend_fname']=stripslashes($_POST['lend_fname']);
}
if (isset($_POST['lend_lname'])){
$_SESSION['lend_lname']=stripslashes($_POST['lend_lname']);
}
if (isset($_POST['lend_street'])){
$_SESSION['lend_street']=stripslashes($_POST['lend_street']);
}
if (isset($_POST['lend_city'])){
$_SESSION['lend_city']=stripslashes($_POST['lend_city']);
}
if (isset($_POST['lend_state'])){
$_SESSION['lend_state']=stripslashes($_POST['lend_state']);
}
if (isset($_POST['lend_lname'])){
$_SESSION['lend_zip']=stripslashes($_POST['lend_zip']);
}
if (isset($_POST['lend_email'])){
$_SESSION['lend_email']=stripslashes($_POST['lend_email']);
}
if (isset($_POST['lend_phone'])){
$_SESSION['lend_phone']=stripslashes($_POST['lend_phone']);
}

?>

On the first page, Now what happens is it only sticks to the first two 
(lend_fname and lend_lname), the others still get lost. Any idea how or why 
the exact code works differently?

Thanks Again.

gary




"tedd" <tedd.sperl...@gmail.com> wrote in message 
news:p06240800c7cbc0927...@[192.168.1.102]...
> At 2:22 PM -0400 3/20/10, Gary wrote:
>>I have this perplexing issue of session varibles getting dropped.  It is a 
>>4
>>page form, the last page being a review page incase the submitter wants to
>>change any of the information.If you go through the form, all of the
>>information carries forward, and from the review page if you go back to
>>edit, it is there, however is you go back to page 2, then to page 1, page
>>one info is gone.It gets worse in that page 2 sessions drop (more likely
>>over written) if you go from page 3 to 2.
>>
>>Each page is started with
>>
>><?php if(!isset($_SESSION)) {
>>     session_start();
>>  }
>>
>>Session varible:
>>
>>$_SESSION['lend_fname']=stripslashes($_POST['lend_fname']);
>>
>>Calling the session varible to the input field for review
>>
>><?php if (isset($_SESSION['lend_fname'])) {echo
>>'value="'.htmlentities($_SESSION['lend_fname']).'"';}?>
>>
>>The page starts at http://www.paulgdesigns.com/one2one/lend_bor_input.php
>>
>>Im confused as to why they keep getting dropped and how to stop it.
>>
>>Hopefully I have given enough information.
>>
>>Thank you
>>
>>Gary
>
> Gary:
>
> I think I know what the problem is. When you revisit previous pages, you 
> write over the previous data from an empty $_POST. Here's a way to stop 
> that.
>
> <?php session_start();
>
> if (isset($_POST ['lend_fname'])
>   {
>   $_SESSION['lend_fname'] = $_POST['lend_fname'];
>   }
>
> As far as using strip_slashes() and htmlentities() I wait until I am going 
> to use the variables in some manner and then clean/scrub them all at one 
> time. That makes the process simpler for me -- plus I can then keep all my 
> security checks in one location.
>
> Cheers,
>
> tedd
>
> -- 
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> __________ Information from ESET Smart Security, version of virus 
> signature database 4962 (20100321) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
> 



__________ Information from ESET Smart Security, version of virus signature 
database 4962 (20100321) __________

The message was checked by ESET Smart Security.

http://www.eset.com





--- End Message ---
--- Begin Message ---
At 10:14 AM -0400 3/21/10, Gary wrote:
Thanks again for all the help, however the plot thickens.

Gary :

It doesn't have to thicken. Here's an example of using $_SESSION that works and you can have as many fields as you want:

http://www.webbytedd.com/aa/step-form-sessions/index.php

All the code is there. Plus, it will give you a way to go from page to page without leaving the gathering page.

Cheers,

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

--- End Message ---
--- Begin Message ---
I have located what appears to me to be bug in the XSLTProcessor in
PHP5.2.13 but want to insure that I am not overlooking something before
reporting it. Any advice will be appreciated.

The issue is apparent discrepancies in output sort order in an XSLTProcessor
generated list. Following is a detailed description.

Scenario: Disk resident xml file with a top level "Places" element and a
list of subordinate "Place" elements. Each "Place" element has a "fullName"
attribute with self explanatory value. Place heirarchy is indicated by comma
separated fields in the attribute value, e.g. Accomac Co., Virginia, USA.
Also, a disk resident xsl file whose purpose is to transform the xml file
into a html file with the "Place" element collection sorted and rewritten as
a list of full place names. When the xsl translation is invoked by assigning
the xsl to the xml file and accessing the xml file in IE8, the displayed
output appears exactly as expected, e.g.

Accomack Co., VA, USA
Adams Co., PA, USA
Ahoskie Twp., Hertford Co., NC, USA
Ahoskie, Hertford Co., NC, USA
AK, USA
AL, USA
Alachua Co., FL, USA
Alamance Co., NC, USA
Alameda Co., CA, USA
Alameda, Alameda Co., CA, USA

However, when invoked via the following php script, using PHP5.2.13 -

$xml = new DOMDocument();
$xml->load("F:\Places.xml");
$xsl = new DOMDocument();
$xsl->load("F:\Places.xsl");
$xslt = new XSLTProcessor();
$xslt->importStylesheet($xsl);
echo $xslt1->transformToXML($xml);

some sort order discrepancies appear in the output, e.g.

AK, USA
AL, USA
Accomack Co., VA, USA
Adams Co., PA, USA
Ahoskie Twp., Hertford Co., NC, USA
Ahoskie, Hertford Co., NC, USA
Alachua Co., FL, USA
Alamance Co., NC, USA
Alameda Co., CA, USA
Alameda, Alameda Co., CA, USA

Note that the state records, which have upper case second character,
incorrectly appear ahead of other places. This behavior appears even if the
"case-order='lower-first'" attribute is included in the <xsl:sort> element
in the xsl stylesheet.

Question: Is this a bug or am I overlooking something? 



--- End Message ---
--- Begin Message ---
Hi all.  

I have a busy conference season coming up, and will be giving a number of 
presentations that involve code, specifically PHP.  I am going to want to put 
code onto slides in OpenOffice (3.1 specifically, using Kubuntu 9.10), but to 
date I've never figured out a good way to do that.  Anyone know of a good way 
to do syntax-highlighted code in OOo?

Things I've tried in the past:

1) Just throw code onto the slide, no highlighting.  This works, but is ugly 
and harder to read or demonstrate what I am doing.  It's my usual fallback.

2) Screen-shot from a web page that uses syntax highlighting, such as PHP's 
built-in highlighting.  Very difficult to prepare since the sizing is usually 
all off.  Ugly.  Very difficult to edit and change because the screen caps have 
to be regenerated.  And PHP's default coloring for highlighting frequently 
clashes with the slides and looks godawful on a projector.  (I once ended up 
with blue text on a black slide.  That was a major fail.)

3) Jump out of the slides into an IDE.  Works, but totally breaks the flow of 
the presentation.  The IDE usually also has text that's way too small, and I 
have to reconfigure it into a "presentation mode", often on the fly. It also 
makes discrete snippets harder to show, since there's still the entire rest of 
the IDE there.

I don't like any of these options. :-)  I don't know what the alternative is, 
though.  Ideally I'd love to have a custom text region or format or something 
that is "take this and highlight it properly", but I don't know if such a 
plugin exists.

I could be talked into using KPresenter / KOffice instead if that would be 
easier, but as I am on Linux I have no access to KeyNote or PowerPoint.

Any suggestions?

--Larry Garfield

--- End Message ---
--- Begin Message ---
On Sun, 2010-03-21 at 17:25 -0500, Larry Garfield wrote:

> Hi all.  
> 
> I have a busy conference season coming up, and will be giving a number of 
> presentations that involve code, specifically PHP.  I am going to want to put 
> code onto slides in OpenOffice (3.1 specifically, using Kubuntu 9.10), but to 
> date I've never figured out a good way to do that.  Anyone know of a good way 
> to do syntax-highlighted code in OOo?
> 
> Things I've tried in the past:
> 
> 1) Just throw code onto the slide, no highlighting.  This works, but is ugly 
> and harder to read or demonstrate what I am doing.  It's my usual fallback.
> 
> 2) Screen-shot from a web page that uses syntax highlighting, such as PHP's 
> built-in highlighting.  Very difficult to prepare since the sizing is usually 
> all off.  Ugly.  Very difficult to edit and change because the screen caps 
> have 
> to be regenerated.  And PHP's default coloring for highlighting frequently 
> clashes with the slides and looks godawful on a projector.  (I once ended up 
> with blue text on a black slide.  That was a major fail.)
> 
> 3) Jump out of the slides into an IDE.  Works, but totally breaks the flow of 
> the presentation.  The IDE usually also has text that's way too small, and I 
> have to reconfigure it into a "presentation mode", often on the fly. It also 
> makes discrete snippets harder to show, since there's still the entire rest 
> of 
> the IDE there.
> 
> I don't like any of these options. :-)  I don't know what the alternative is, 
> though.  Ideally I'd love to have a custom text region or format or something 
> that is "take this and highlight it properly", but I don't know if such a 
> plugin exists.
> 
> I could be talked into using KPresenter / KOffice instead if that would be 
> easier, but as I am on Linux I have no access to KeyNote or PowerPoint.
> 
> Any suggestions?
> 
> --Larry Garfield
> 


Could you use highlight_string() on the code example in a web page then
copy that from the browser and paste that into your presentation? It
should then preserve the formatting used on the browser display, and let
you easily modify the font size.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
On Sunday 21 March 2010 05:41:55 pm Ashley Sheridan wrote:

> > I don't like any of these options. :-)  I don't know what the alternative
> > is, though.  Ideally I'd love to have a custom text region or format or
> > something that is "take this and highlight it properly", but I don't know
> > if such a plugin exists.
> >
> > I could be talked into using KPresenter / KOffice instead if that would
> > be easier, but as I am on Linux I have no access to KeyNote or
> > PowerPoint.
> >
> > Any suggestions?
> >
> > --Larry Garfield
> 
> Could you use highlight_string() on the code example in a web page then
> copy that from the browser and paste that into your presentation? It
> should then preserve the formatting used on the browser display, and let
> you easily modify the font size.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk

I will have to see if OOo preserves formatting when I do that.  However, that 
still leaves the problem of highlight_string()'s colors being rather poor for 
on-screen.  Are those easily configurable?  That would at least give me a 
decent result, kinda, even if it's not as clean as doing it all within the 
presentation program.

--Larry Garfield

--- End Message ---
--- Begin Message ---
On Sun, Mar 21, 2010 at 07:14:56PM -0500, Larry Garfield wrote:

> On Sunday 21 March 2010 05:41:55 pm Ashley Sheridan wrote:
> 
> > > I don't like any of these options. :-)  I don't know what the alternative
> > > is, though.  Ideally I'd love to have a custom text region or format or
> > > something that is "take this and highlight it properly", but I don't know
> > > if such a plugin exists.
> > >
> > > I could be talked into using KPresenter / KOffice instead if that would
> > > be easier, but as I am on Linux I have no access to KeyNote or
> > > PowerPoint.
> > >
> > > Any suggestions?
> > >
> > > --Larry Garfield
> >
> > Could you use highlight_string() on the code example in a web page then
> > copy that from the browser and paste that into your presentation? It
> > should then preserve the formatting used on the browser display, and let
> > you easily modify the font size.
> >
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> 
> I will have to see if OOo preserves formatting when I do that.  However, that
> still leaves the problem of highlight_string()'s colors being rather poor for
> on-screen.  Are those easily configurable?  That would at least give me a
> decent result, kinda, even if it's not as clean as doing it all within the
> presentation program.

I think Ash's idea is brilliant, though I probably would show the code
from within the browser, rather than importing it. Also check the
user-supplied code under both the highlight_string() and
highlight_file() function at php.net:

http://us2.php.net/manual/en/function.highlight-string.php
http://us2.php.net/manual/en/function.highlight-file.php

There is also code there to provide line numbers, which would be very
useful for presentations. There are some hints about how you might
change the colors.

Paul

-- 
Paul M. Foster

--- End Message ---

Reply via email to