|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 25 Oct 2005 15:11:33 -0000 Issue 3757
php-general-digest-help
lists.php.net
Date: Tue Oct 25 2005 - 10:11:33 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 25 Oct 2005 15:11:33 -0000 Issue 3757
Topics (messages 224608 through 224636):
Re: JPG Slide show
224608 by: Richard Lynch
php session variables limited to 1 character -- please help
224609 by: Zac Smith
SMTP & PHP: Spam Tagging Problem
224610 by: Cabbar Duzayak
GUID or any other unique IDs
224611 by: Denis Gerasimov
224612 by: Richard Davey
224613 by: Jasper Bryant-Greene
224614 by: Denis Gerasimov
224626 by: Rosty Kerei
224627 by: Ben Litton
Re: cleanly written shop-system (php5, object-oriented)?
224615 by: Jochem Maas
selected index
224616 by: Ross
224618 by: Adrian Bruce
224623 by: Rosty Kerei
224625 by: Al
224628 by: Sascha Braun
Re: how to display GD graphic in web page
224617 by: Chris
Re: Ugh, w32 anything is making me want to drink!
224619 by: Jay Blanchard
Re: Email Validation built-in? RFC
224620 by: Robin Vickery
224622 by: Robin Vickery
Re: Problem reading SimpleXML array NOT SOLVED but NO LONGER A PROBLEM
224621 by: George Pitcher
Re: php 5.0.5 segfaults apache2 on ubuntu, 5.0.4 ok
224624 by: Petr Smith
cURL to re-post form iinformation
224629 by: Jay Blanchard
Re: PDF printing under windows.
224630 by: Dave Lists
224635 by: tg-php.gryffyndevelopment.com
How to read word document by php script
224631 by: Roman Duriancik
224632 by: Oliver Grätz
224633 by: Jay Blanchard
Re: How to protect a php script that sends variables to itself
224634 by: Graham Anderson
create HTML page on the fly
224636 by: Angelo Zanetti
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
On Mon, October 24, 2005 9:58 pm, John Taylor-Johnston wrote:
> I remember trying this. It required GD version 2 or higher, not
> mentioned on their requirements page. Most of these galleries do. I'm
> waiting to get my sysadmin to install GD 2.x +. I have 1.6.x and only
> PHP Version 4.1.2
> It also requires changing disable_functions in the php.ini file, which
> luckily I can do. But not always for everyone.
Woof.
Okay, restricting oneself solely to GD 1.x (gak) and PHP 4.1.2 does
change the ground rules quit a bit...
Honestly, your BEST bet is getting current GD and using one of the
pre-existing galleries.
That said, the two requirements you gave initially:
slide show
thumbnails
are both completely do-able in GD 1.x
SLIDE-SHOW:
<?php
//Change the next 2 lines for sure:
$path = "/full/path/to/your/photo/directory/here";
$url_path = "/just/from/homepage/to/your/photo/directory/here";
$dir = opendir($path) or die("Could not opendir $path");
if (!isset($_REQUEST['file'])){
readdir($dir); //skip dir commonly known as "."
readdir($dir); //skip the ".." also
$file = readdir($dir); //should be a real image
}
else{
while (readdir($dir) != $file){
//do nothing, just skipping merrily along to find the file
}
//Okay, that was the image they just saw. Show the NEXT one:
$file = readdir($dir);
if ($file === false){
//They have seen the whole show... Start over? What?
//You get to code this part yourself.
}
}
?>
<html>
<head>
<title><?php echo htmlentities($file);?></title>
<meta http-equiv="refresh" content="1;<?php echo
$_SERVER['PHP_SELF'], "?file=", htmlentities(urlencode($file))?>"
/>
</head>
<body bgcolor="#ffffff"><table width="100%" height="100%"><tr><td
align="center">
<img src="<?php echo "$url_path/$file"?>" /></body>
</td></tr></body>
</html>
For making thumbnail, see http://php.net/imagecopyresized
That was in GD 1.x
The cooler, better, much nicer-looking imagecopyresampled came in 2.x,
I think.
There's a BUNCH of notes and examples there for this bit, so I'm not
typing another one.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
Hi!
I've got a very strange issue that is basically cutting off session variable
data after 1 character. When I set the session variable as "50" it comes
back as "5". When I set it to "XYZ" it comes back as "X". I have a script
that is taking $_GET['State'] variable and setting it to a session variable
named $USER['State']. This worked fine until a few days ago, but now it's
persistent! Any ideas what might be causing this?? I've searched the
web/lists and can't find any reference.
http://www.triptrivia.com/step2-debug.php?State=abc
Thanks,
Zac
attached mail follows:
Hi,
I am having a problem with my system when sending e-mails to yahoo
accounts, and it has been baffling me for the last couple of days,
actually I should say it is driving me crazy...
As I mentioned, I have a cpanel and have 2 domains/sites with
dedicated IP addresses on my system. The base account has domain name:
host.mydomain.com with IP address, let's say is x.x.x.x, the first
domain first.com is x.x.x.[x+1], the second domain second.com is
x.x.x.[x+2]. And, as you know, all e-mails for both domains are sent
from host.mydomain.com with source IP as x.x.x.x
Now, I wrote a php script, and placed it on both sites. It is exactly
the same script, with only one difference, from address, reply-to
address, etc. are set to admin
first.com for the first domain and
admin
second.com for the second domain.
When I execute this script, it sends an e-mail to a yahoo address. The
problem is: the e-mail sent from first.com is sent fine meaning it
reaches the recipient Yahoo INBOX, but the one sent from second.com is
dropping into Yahoo's Bulk Folder...
For the second domain, I tried sending e-mail for that domain from
another hosting service, and that one got into the INBOX, not Bulk...
Both first.com and second.com have proper A records and MX records.
host.mydomain.com has an A record setup, and mydomain.com has an MX
record setup (pointing to some other mail server)...
Now, this is very confusing because:
1. If my hosts IP address (x.x.x.x) was blocked, then both
admin
first.com and admin
second.com should be blocked, but one of
them is reaching its destination, while the second one is tagged as
SPAM.
2. If there was a problem with the way SMTP is configured, again both
should not have been dispatched. In fact, EHLO domain
(host.mydomain.com) is resolving to source IP (x.x.x.x) and source IP
(x.x.x.x) is resolving to the EHLO domain (again host.mydomain.com)...
And, two headers are almost same (other than return-path, etc. of
course)
3. If admin
second.com (or the whole domain second.com for that
matter) e-mail address(es) was/were blocked, then both mail sent from
x.x.x.x and other hosting service should have been blocked. But, as I
mentioned, other hosting services e-mail goes thru fine!
Can someone please shead a light onto this before I lost my sanity
E-MAIL HEADER AS RECEIVED BY YAHOO: [IT IS ALMOST THE SAME FOR
SECOND.COM, just replace FIRST.COM with SECOND.COM]
X-Apparently-To: yahooaddress
yahoo.com via 68.142.228.52; Mon, 24 Oct
2005 09:54:48 -0700
X-YahooFilteredBulk: x.x.x.x
X-Originating-IP: [x.x.x.x]
Return-Path: <admin
first.com>
Authentication-Results: mta295.mail.scd.yahoo.com from=first.com;
domainkeys=neutral (no sig)
Received: from x.x.x.x (EHLO host.mydomain.com) (x.x.x.x) by
mta295.mail.scd.yahoo.com with SMTP; Mon, 24 Oct 2005 09:54:47 -0700
Received: from nobody by host.mydomain.com with local (Exim 4.52) id
XXXXXXX for yahooaddress
yahoo.com; Mon, 24 Oct 2005 19:54:44 +0300
To: yahooaddress
yahoo.com
Subject: TESTING
MIME-Version: 1.0
Content-type: text/plain; charset=iso-8859-9
From: admin
first.com
Message-Id: <XXXXXXXX
host.mydomain.com>
Date: Mon, 24 Oct 2005 19:54:44 +0300
X-AntiAbuse: This header was added to track abuse, please include it
with any abuse report
X-AntiAbuse: Primary Hostname - host.mydomain.com
X-AntiAbuse: Original Domain - yahoo.com
X-AntiAbuse: Originator/Caller UID/GID - [99 99] / [47 12]
X-AntiAbuse: Sender Address Domain - first.com
X-Source:
X-Source-Args:
X-Source-Dir:
Content-Length: 12
PHP CODE USED FOR SENDING E-MAIL:
<?php
$fromMail = "admin
first.com";
$to = "yahooaddress
yahoo.com";
$subject = "TESTING";
$msg = "TEST MESSAGE";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Return-Path: <$fromMail>\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-9\r\n";
$headers .= "From: $fromMail\r\n";
print "<h1>TEST: " . mail($to, $subject, $msg, $headers,
"-f$fromMail") . "</h1>";
?>
attached mail follows:
Hello list,
I am in a need of GUID generator but it seems that PHP doesn't have this as
a built-in feature.
I looked at http://pear.php.net <http://pear.php.net/> and
http://pecl.php.net <http://pecl.php.net/> but found nothing suitable
there.
I really need "true" unique identifiers - md5() hash is not OK because of
the "birthday paradox".
Can anyone recommend a way for solving this trouble?
Have a great day,
Denis S Gerasimov
Web Developer
Team Force LLC
Web: <http://www.team-force.org/> www.team-force.org
RU & Int'l: +7 8362-468693
email: denis.gerasimov
team-force.org
attached mail follows:
Hi Denis,
Tuesday, October 25, 2005, 10:01:48 AM, you wrote:
> I am in a need of GUID generator but it seems that PHP doesn't have
> this as a built-in feature.
uniqid() ?
Bearing in mind of course that no unique ID generator can ever be 100%
unique unless it keeps a record of previously generated IDs. So you
may wish to add this check.
Cheers,
Rich
--
Zend Certified Engineer
http://www.launchcode.co.uk
attached mail follows:
On Tue, 2005-10-25 at 13:01 +0400, Denis Gerasimov wrote:
> I am in a need of GUID generator but it seems that PHP doesn't have this as
> a built-in feature.
>
> I looked at http://pear.php.net <http://pear.php.net/> and
> http://pecl.php.net <http://pecl.php.net/> but found nothing suitable
> there.
>
> I really need "true" unique identifiers - md5() hash is not OK because of
> the "birthday paradox".
>
> Can anyone recommend a way for solving this trouble?
I use:
$unique_id = sha1( uniqid( mt_rand(), true ) );
which should be very unique and suitable for most purposes.
--
Jasper Bryant-Greene
General Manager
Album Limited
e: jasper
album.co.nz
w: http://www.album.co.nz/
p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303
a: PO Box 579, Christchurch 8015, New Zealand
attached mail follows:
Hello Jasper,
> $unique_id = sha1( uniqid( mt_rand(), true ) );
>
> which should be very unique and suitable for most purposes.
I really need millions of unique IDs - hashing is not suitable for this task
(I think so) :-(. Any more ideas?
Is there a PHP extension or an external library for generating GUIDs?
Have a great day,
Denis S Gerasimov
Web Developer
Team Force LLC
Web: www.team-force.org
RU & Int'l: +7 8362-468693
email: denis.gerasimov
team-force.org
attached mail follows:
I would use simple auto_increment DB's feature..
Sincerely,
Rosty Kerei <rosty.kerei
gmail.com>
""Denis Gerasimov"" <denis.gerasimov
team-force.org> wrote in message
news:200510250901.j9P91jrM027214
tx7.yournewhosting.com...
> Hello list,
>
>
>
> I am in a need of GUID generator but it seems that PHP doesn't have this
> as
> a built-in feature.
>
> I looked at http://pear.php.net <http://pear.php.net/> and
> http://pecl.php.net <http://pecl.php.net/> but found nothing suitable
> there.
>
>
>
> I really need "true" unique identifiers - md5() hash is not OK because of
> the "birthday paradox".
>
>
>
> Can anyone recommend a way for solving this trouble?
>
>
>
> Have a great day,
>
>
>
> Denis S Gerasimov
> Web Developer
> Team Force LLC
>
> Web: <http://www.team-force.org/> www.team-force.org
>
> RU & Int'l: +7 8362-468693
>
> email: denis.gerasimov
team-force.org
>
>
>
>
attached mail follows:
While not ideal, you could do a select on a db. MS SQL and MySQL both have
functions to generate unique id's and I imagine the other databases do as
well. While running a "SELECT uuid()" and hitting the database for each
one of these things is annoying, it is one possible pseudo-solution.
On Tue, 25 Oct 2005 06:47:26 -0400, "Denis Gerasimov"
<denis.gerasimov
team-force.org> wrote:
> Hello Jasper,
>
>> $unique_id = sha1( uniqid( mt_rand(), true ) );
>>
>> which should be very unique and suitable for most purposes.
>
> I really need millions of unique IDs - hashing is not suitable for this
> task
> (I think so) :-(. Any more ideas?
>
> Is there a PHP extension or an external library for generating GUIDs?
>
> Have a great day,
>
> Denis S Gerasimov
> Web Developer
> Team Force LLC
>
> Web: www.team-force.org
> RU & Int'l: +7 8362-468693
> email: denis.gerasimov
team-force.org
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
attached mail follows:
James Benson wrote:
> Bad choice of words.
>
>
> I was comparing PHP4 to PHP5 and how long PHP4 has been around compared
> to PHP5, it's bound to be more stable aint it?
is it. probably , yes, but not by definition. you can say that php4 has
had more coverage which probably means it contains less bugs that nobody
has encountered.
>
> I was not trying to say PHP5 is not stable because im sure it is very
> much so.
how sure ;-)
>
> Or am I not allowed to say anything like that in this forum?
thankfully you are allowed to say what you want, although some of
the more sensitive types (and those work for large fearful corporations)
may block your posts due to 'rude' language ;-)
> Ill just silently exit through the back door then :)
lol
>
>
>
>
>
> Jochem Maas wrote:
>
>> James Benson wrote:
>>
>>> PHP5 has yet to see the maturity and stability PHP4 offers which is
>>> why most applications use it.
>>>
>>> Worst thing you can do is design a website in entirely flash :)
>>
>>
>>
>> no the worst thing you can do is spread FUD.
>> which you have just done, unless you are capable of backing up your
>> off the cuff
>> remarks (about the stability of php5) with hard imperical data, which
>> I doubt.
>>
>> actually 'the worst thing you can do' is more likely to be something like
>> 'invading a sovereign state in order to be able to subsidise your own
>> oil-addicted,
>> brainwashed, selfrighteous society' than something that's anything to
>> do with
>> php or the web. but then again maybe not ;-)
>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Phillip Oertel wrote:
>>>
>>>> hi,
>>>>
>>>> i want to create a "shop server" application. the shop client interface
>>>> will be in flash (communication with php over xml, soap or amfphp), the
>>>> administration interface will be html. most likely it will probably
>>>> be a
>>>> long-running application that will be extended in several steps, so we
>>>> need a solid foundation. we also need to get started quickly (who
>>>> doesn't), otherwise i would consider starting from scratch.
>>>>
>>>> i have already looked around quite a lot for a nicely adaptable
>>>> shop/ecommerce implementation, but haven't been very successful so far.
>>>> everything i found was conceived in php4 times, where OO wasn't as
>>>> wide-spread in the php community as it is today. some of the packages
>>>> are poorly documented (both in-code and separate documentation),
>>>> have an
>>>> inconsistent coding style, are dead, are copies of oscommerce with a
>>>> worse interface, ...
>>>>
>>>> feature-wise the best i found was xtcommerce (oscommerce fork)
>>>> admin interface wise: zencart (oscommerce fork)
>>>> code-wise: randshop
>>>> non of them use php5's features, though, none are written
>>>> object-oriented.
>>>>
>>>> i have no info on the performance of these shops, although that
>>>> shouldn't be a prob as long as it's not desastrous (to some extend, you
>>>> can always scale hardware-wise).
>>>>
>>>> so i am looking for a cleanly layered application where i could swap
>>>> out
>>>> the presentation layer. and all important shop data (products, product
>>>> categories, cart, etc.) should be represented as objects, so i could
>>>> extend them to implement required customizations.
>>>> it would be a big plus if the admin interface was well thought-out.
>>>>
>>>> we need quite some features like multiple languages, multiple
>>>> categories, discounts on certain products, payment provider
>>>> integration,
>>>> customer newsletters, possibly administration of several slightly
>>>> different shops in one installation, etc.
>>>>
>>>> is there such an application or am i stuck with oscommerce and its
>>>> forks?
>>>> i don't need it to be feature complete, as long as there is a way to
>>>> adapt the code without hacking the whole thing (and loosing the
>>>> possibility of upgrading).
>>>>
>>>> as long as the code was open, i would be happy to pay a certain amount
>>>> for the application.
>>>>
>>>> anyone?
>>>>
>>>> phil
>>>
>>>
>>>
>>>
>
attached mail follows:
Hi,
I have an array
$people= array ("ross", "bob", "chris")
I have a variable
$selected_person = "chris"
I want to do the find out the index of the $selected_person in the $people
array. Is there a function that can do this??
ta,
Ross
attached mail follows:
dont know of a function but this should work
$size = count($array);
for($i=0;$i<$size;$i++){
if($selected_person == $array[$i]){
echo"index: $i";
}
}
Adrian
Ross wrote:
>Hi,
>
>I have an array
>
>$people= array ("ross", "bob", "chris")
>I have a variable
>
>$selected_person = "chris"
>
>
>
>I want to do the find out the index of the $selected_person in the $people
>array. Is there a function that can do this??
>
>ta,
>
>
>
>Ross
>
>
>
attached mail follows:
try array_search()
Sincerely,
Rosty Kerei
<rosty.kerei
gmail.com>
""Ross"" <ross
aztechost.com> wrote in message
news:86.83.22886.13B1E534
pb1.pair.com...
> Hi,
>
> I have an array
>
> $people= array ("ross", "bob", "chris")
> I have a variable
>
> $selected_person = "chris"
>
>
>
> I want to do the find out the index of the $selected_person in the $people
> array. Is there a function that can do this??
>
> ta,
>
>
>
> Ross
attached mail follows:
Ross wrote:
> Hi,
>
> I have an array
>
> $people= array ("ross", "bob", "chris")
> I have a variable
>
> $selected_person = "chris"
>
>
>
> I want to do the find out the index of the $selected_person in the $people
> array. Is there a function that can do this??
>
> ta,
>
>
>
> Ross
It appears you are learning php.
I suggest that you will find it very rewarding to learn the array functions. I certainly did when I first started work
with php.
There is an array function that does exactly what you want.
attached mail follows:
Hi,
just take a look at this function:
http://www.php.net/manual/en/function.array-keys.php
______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193
attached mail follows:
Thanks for the detailed explanation.
I should have expanded further on my design goals though. I initiated my
examination of this problem when I tried to generate my "on-the-fly" images
with a class method like:
// on_the_fly.php
<script language="php">
class on_the_fly {
function on_the_fly() {
}
function a_graphic() {
$image = imagecreatefrompng("my_graphic.png");
imagepng($image);
}
}
</script>
then call the method as needed as in:
// my_page.php
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<script language="php">
include ('on_the_fly.php');
$otf_graphic = new on_the_fly();
echo "<img src=$otf_graphic->a_graphic()">;
</script>
</body>
</html>
This resulted in a page filled with random characters.
So I interpret from your response that I'm still unable to reference "<img
src=$otf_graphic->a_graphic()"> and MUST create my on-the-fly graphic in a
*.php file or *.png as you suggest.
Thanks
Chris
""Richard Lynch"" <ceo
l-i-e.com> wrote in message
news:59747.71.57.116.88.1130205670.squirrel
www.l-i-e.com...
> On Mon, October 24, 2005 7:14 pm, Chris wrote:
>> I don't understand what is going on with a simple example I created to
>> understand how GD graphics are presented in a web page.
>
> Basically, you were right the first time.
>
> Think of it this way:
>
> HTML pages generally have, well, HTML in them.
>
> Sometimes that HTML has an IMG tag, and that provides a URL to an image.
>
> But, with static images, you don't copy/paste the image itself right
> into your HTML.
>
> It's just another URL that the browser gets after it gets the HTML.
>
> PHP doesn't change any of this, really, except that now the URL for
> the image just *happens* to be an image that is composed on the fly.
>
>> Now if I treat graphic.php as an image, and reference in another page
>
> graphic.php *is* an image, just like, any other image.
>
> So you should treat it like an image.
>
>> my_graphic.png is no longer displayed and the web page gets filled
>> with
>> random characters.
>
> If you had a PNG, and if you opened up that file in Notepad/BBEdit/vi
> and you copied all the stuff out of it and pasted it into your HTML,
> that's pretty much what you would get, right?
>
> Just like you just did with PHP doing the "paste"
>
> Now, one little caveat:
>
> Microsoft, in its infinite wisdom, frequently IGNORES the
> "Content-type:" head from the HTTP specification in various versions
> of Internet Explorer.
>
> Instead, MS IE will examine the URL and see: graphic.php and say, "Oh,
> never mind that silly HTTP specification and Content-type, *this* must
> be a .php file because it ends in .php, and everybody uses 8.3,
> right?"
>
> Then, of course, MS IE says, "Oh my goodness! I don't know how to
> handle a '.php' file! Woe is me!" and then pops up a Window telling
> the user it has encountered a file of type .php and doesn't know what
> to do with it.
> [I'll tell 'em what to do with it... :-)]
>
> Anyway, if you're going to do much with dynamic images, you might as
> well start getting them to have ".png" filenames now.
>
> There are lots of techniques for this, but the whole ignoring
> Content-type mess of MS IE, and because of their similar idiocy with
> GET parameters for .pdf and .swf files, I recommend this:
>
> Make your HTML and your URL indistinguishable from static HTML/URL, so
> that MS IE can't *possibly* [bleep] up.
>
> Put this in an .htaccess file next to the graphic.php script:
>
> <Files graphic.png>
> ForceType application/x-httpd-php
> </Files>
>
> Now, rename graphic.php to graphic.png
>
> Voila.
>
> MS IE "sees" graphic.png and "knows" it's a PNG.
>
> Apache was told that graphic.png is *really* a PHP script, so Apache
> fires up PHP and PHP/GD make the image and spit it out.
>
> Your HTML and PNG are indistinguishable by the browser from a static
> image, and they'd have to break every PNG out there to make yours not
> work. Which, knowing MS, is not *impossible* but it's a lot less
> likely than their various versions of IE that will break on
> http://example.com/graphic.php as a PNG image URL.
>
> --
> Like Music?
> http://l-i-e.com/artists.htm
attached mail follows:
[snip]
This before or after you switched to Apache?...
[/snip]
Before...the switch to Apache solved many, many problems.
[snip - for informational purposes]
Can you surf to a static page?
Can you surf to a static page in the same directory as the PHP page?
PHP CGI or Service/Module?
Anything in the log files?
Do all browsers say 404, or is that just the badly-broken MS IE
generalized message?
[/snip]
I could surf to static pages, including ones in the PHP directory. PHP was
running as ISAPI. The log files showed 404 errors regardless of browser. The
PHP was working fine until I rebooted the server, which was done to see if I
could solve the extensions problem. With Apache installed the only thing I
have to worry about will be some PERL stuff and I will probably install
Apache::ASP to handle some legacy stuff until I can convert it to PHP.
attached mail follows:
On 10/24/05, Manuel Lemos <mlemos
acm.org> wrote:
> on 10/23/2005 07:21 PM Robin Vickery said the following:
> >>
> >>> ... would it not make sense for there to be a BUILT-IN PHP function of
> >>> a TRUE email syntactic validation?
> >> I don't see that being much better than passing a good regular
> >> expression to preg_match.
> >
> > 1. Technically you can't write a regular expression that matches
> > *all* valid email addresses as part of the address specification is
> > recursive.
> >
> > ccontent = ctext / quoted-pair / comment
> > comment = "(" *([FWS] ccontent) [FWS] ")"
> >
> > Admittedly 99.99% of people don't even know you *can* comment email
> > addresses so it's not a huge problem...
>
> If I am not mistaken, PCRE supports recursive regular expressions.
I'm afraid not. You can hack recursion in Perl with the (??{ })
postponed expression construct. But PCRE doesn't support it.
Without recursion, the best you can do is decide on a reasonable depth
of nested comments and hardcode that.
> Anyway, the way I got the RFC that is not quite the form of an address
> but the way it may be presented in message header. Meaning, you can add
> comments in To: or other e-mail header but in reality the comments are
> not part of the address.
I'm not sure exactly what you mean here. It's true that comments don't
affect how mail gets delivered, but they're very definitely part of
the address and may well have a meaning to the recipient that you
can't predict. They could be using it for anti-spam or to disinguish
between users of a mailbox or... well, anything really.
Which is the reason that RFC-2821 recommends that they be passed to
the recipient unchanged.
> > 2. Very few people seem to be capable of recognising a *good* regular
> > expression, let alone writing one. It seems clear that validating an
> > address is a task that many people want to do, but few can do
> > properly. I'd say that's a good reason for making it a built-in
> > function.
>
> Yes. What I meant is that just copying a good enough regular expression
> would be sufficient to use it. There is no need to understand it.
I had a quick look through my email last night and found 14 different
email validation regular expressions posted to this list in the last
few months. All of them would falsely reject valid addresses even
without taking comments into account. 6 of them wouldn't even allow
"judy.o'grady
example.com" and another 3 would reject mail from the
entire .museum TLD.
What that would indicate to me, is that many people can't even
recognise what a "good enough" regular expression looks like.
> What I meant is that despite I use that regular expression for many
> years without complaints, it could be improved to reject only invalid
> characters, but of course that is not what that expression does.
Possibly because those whose email addresses it rejected couldn't
contact you to complain? :-)
Actually, I have very little problem with your regexp - I'd like it to
handle domain literals, as they can be useful in communicating with
people with broken DNS. But that's about it.
-robin
attached mail follows:
On 10/25/05, Mark Charette <charette
woodwind.org> wrote:
> Ben Litton wrote:
>
> > You could certainly write an extension to do so. That's what I did
> > (mostly I was writing one for another purpose and added a function I
> > stole from O'Reilly.
>
> As you stated in your article, it isn't rfc822 compliant (it isn't even
> close). Richard was pretty specific in his needs.
Just in case anyone's inspired to read through the specs; It's
RFC-2822 these days. RFC-822 is obsolete.
-robin
attached mail follows:
Hi,
Got round the problem by doing this instead:
$param = array(
'country1' => 'uk',
'country2' => 'usa'
);
$wsdl="http://www.xmethods.net/sd/2001/CurrencyExchangeService.wsdl";
$curr_client = new nusoapclient($wsdl, 'wsdl');
$rate = $curr_client->call('getRate' ,$param);
The ends justified the means, though I am still using SimpleXML to parse my
Copyright Clearance Center processes.
Cheers
George
> -----Original Message-----
> From: Jochem Maas [mailto:jochem
iamjochem.com]
> Sent: 24 October 2005 8:50 pm
> To: ceo
l-i-e.com
> Cc: George Pitcher; php-general
lists.php.net
> Subject: Re: [PHP] Problem reading SimpleXML array
>
>
> Richard,
>
> I'm guessing you haven't played with simpleXML ...
>
> (apologies inadvance for any/all mistakes :-)
>
> chances are the var_dump() pointer you gave (which under
> normal circumstances would be spot on) will probably
> lead to more confusion. to put it lightly SimpleXML
> doesn't lend itself to introspection (ATM?) because of the
> very #%^$ (for the totally naive: that was masking the word 'nice')
> string casting magic. at least it drove me absolutely nuts.
>
> anyway copious and experimental use of explicit casting to
> strings [i.e. using '(string)'] was the order of the day for me.
>
> as far as I understand it the problem lies in the fact that the object
> you get back has properties which behave as strings and objects which
> for good measure can (all) can be iterated [foreach] like arrays.
>
> all very simple, well ... you decide. :-)
>
> Richard Lynch wrote:
> > On Mon, October 24, 2005 3:50 am, George Pitcher wrote:
> >
> >>Hi,
> >>
> >>I'm having a problem reading an xml feed. This is my object:
> >>
> >>SimpleXMLElement Object (
> >> [Header] => SimpleXMLElement Object (
> >> [ID] => FX12GB
> >> [Test] => false
> >> [Name] => Foreign Exchange United Kingdom Pound Noon Rates
> >> [Prepared] => 2005-10-24
> >> [Sender] => SimpleXMLElement Object (
> >> [Name] => Federal Reserve Bank of New York
> >> [Contact] => SimpleXMLElement Object (
> >> [Name] => George Matthes
> >> [Email] => george.matthes
ny.frb.org ) )
> >> [ReportingBegin] => 1994-01-06 )
> >> [DataSet] => SimpleXMLElement Object (
> >> [Series] => SimpleXMLElement Object (
> >> [Key] => SimpleXMLElement Object (
> >> [FREQ] => D
> >> [CURR] => GBP
> >> [FX_TIME] => 12
> >> [FX_TYPE] => S )
> >> [Obs] => SimpleXMLElement Object (
> >> [TIME_PERIOD] => 2005-10-21
> >> [OBS_VALUE] => 1.7692 ) ) ) )
> >>
> >>I'm trying to get those last two lines: TIME_PERIOD and OBS_VALUE.
> >>
> >>I can get the ID (third line) using $s->Header->ID (where $s is my
> >>object).
> >>$s->DataSet->Series->Obs->TIME_PERIOD; // 'Trying to get property of
> >>non-object'
> >
> >
> >
> > echo "<PRE>";
> > var_dump($s);
> > echo "<hr />\n";
> > var_dump($s->DataSet);
> > echo "<hr />\n";
> > var_dump($s->DataSet->Series);
> > echo "<hr />\n";
> > .
> > .
> > .
> >
>
>
attached mail follows:
I just found this is known bug and was already fixed in CVS.
http://bugs.php.net/bug.php?id=34450&edit=2
thanks to all!
attached mail follows:
Howdy all,
I am trying a new technique, for me, when processing a form. The form is
filled out and submitted, during processing it is determined that there is
an error with the posted data...such as a blank or mismatched password,
I want to return the form with the data filled out using curl....as a test I
did this....
/* curl post test */
$post_data['username'] = $_POST['username'];
$post_data['password'] = $_POST['password'];
$url = "http://TEST20051010/FMSRegister.php";
/* assemble POST data in string */
$pd="";
foreach ($post_data as $k=>$v){
$pd.= "$k=".$v."&";
}
$post_data=substr($pd,0,-1);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_URL, $url);
curl_exec($ch);
curl_close($ch);
Now, this works OK...save for one little problem that I cannot seem to
figure out. The URL now reads
http://TEST20051010/NameOfProcessingScript.php instead of
FMSRegister.php.
I am searching the curl options http://www.php.net/curl_setopt but have not
found what I am looking for. Can someone clue me in?
Thanks!
attached mail follows:
Richard Lynch wrote:
>On Mon, October 24, 2005 1:48 pm, Dave Lists wrote:
>
>
>>I'm generating PDFs under windows using PDFlib and all is easy. What I
>>am wondering though, and google reveals nothing usefull, can I print
>>the
>>PDF to a network printer from windows? I'm presuming to print the file
>>I
>>would ahve to use COM and open it under Acrobat? Anyone done this
>>before
>>and have any pointers? I'm printing out invoices and what to automate
>>the task.
>>
>>
>
>If, for some weird reason, you want to allow the user (authenticated,
>logged in, trusted) to print to a networked computer on the WEB
>SERVER, then your best bet is probably to figure out how to print that
>PDF from MS-DOS and then to use http://php.net/exec to print it, I
>would guess...
>
>
It's from a cli PHP install on a local machine :-)
>You might be able to use PHP to open up a COM object to convince
>Adobe/Windows/whatever to print...
>
>
COM makes me want to cry ;-) At the moment I'm trying to convince
OpenOffiice it wants to play with PHP and COM.
I have tried to exec print on the windows box but that just hung.
>If it was a Un*x server, you'd just send the document to lpr or CUPS
>or something, and be done with it, probably in a half-hour of work,
>even allowing for a protracted battle with file/exec permissions.
>
>
>
I'm not sure I could just fire a PDF at lpr, but no doubt it would be
much easier under Unix :-)
Dave.
attached mail follows:
Two (and a half) things:
1. Even though DOS/Windows machines don't have, specifically, /dev/printer or /dev/lpr or whatever the *nix specific is, it does have a LPTx: device
According to the page listed below, it may be possible to do:
copy /b filename LPTx
The /b indicates it's a binary file. How it'd handle PDF fonts and such, I'm not sure, but I know that some printers can decode PDF's internally so that'd work out great.
2. Second point... If all you need is a simple print function and you have exec() privs, why not try to find a DOS based printing solution. The copy command above was mentioned on this page:
http://www.lerup.com/printfile/
It says it works with Windows 3.1 to XP. And it even works with command line options:
"PrintFile also works well with command line (DOS) programs. It has several command line options and can read data from command line standard input, e.g. a command line pipe. A command like:
dir | prfile32"
So I guess it sets up it's own print device that you can pipe to.
And finally... the half a point. All of this may not be necessary because you can configure Windows printers to support DOS (although I havn't done this in ages, I assume you still can in XP) so in theory the normal DOS "print" command would pipe through Windows drivers and print handling to the printer of choice.
So in general, there's probably zero need to use COM to print. One of these options should pipe the file through Windows which in turn, could possibly send it through the proper printing method. If not, you might be able to look in your registry and find the right-click "Print..." option and see if it's something you can execute from command line.
Ok, I know this email's too long already, but I know someone's going to say "How do you do that?" So here's the 50 cent tour:
1. Pull up "regedit"
2. Search for the file extension ".pdf"
3. Make note of the "(Default)" value, in this case "AcroExch.Document" (I think this is specific to having the full Acrobat installed)
3. Below the area where all the file extensions are in HKEY_CLASSES_ROOT there are the actual named app section (that way, ".gif" and ".jpg" can both point to Photoshop.document" or something.. get it?) So search for "AcroExch.Document" in this case
4. Expand that tree and look for "shell". These are all the things that show up on your right-click menu. In this case, we have a "print" section. Under each of these entries, there should be (but sometimes not) a "command" branch. This is what's run when you select that option from the right-click menu. And voila! We find that the command to use Acrobat to print (which can be executed from command line on a Windows machine) is:
"C:\Program Files\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe" /p /h "%1"
Substituting the %1 for the filename.
Using that command line in a php exec() call should exactly simulate selecting right-click PRINT on a PDF file.
Crossposting this to PHP-Win for their benefit too since this is more Windows related than PHP General.
I see lots of ways to potentially solve this problem without using COM.
I loved messing with COM (with or without PHP) for a while, but it's not a great general solution to things unless you absolutely HAVE to control the app (which is very cool and slick sometimes, but not for something as simple as printing).
Hope this gives you some new avenues to persue. Best of luck!
-TG
= = = Original message = = =
Richard Lynch wrote:
>On Mon, October 24, 2005 1:48 pm, Dave Lists wrote:
>
>
>>I'm generating PDFs under windows using PDFlib and all is easy. What I
>>am wondering though, and google reveals nothing usefull, can I print
>>the
>>PDF to a network printer from windows? I'm presuming to print the file
>>I
>>would ahve to use COM and open it under Acrobat? Anyone done this
>>before
>>and have any pointers? I'm printing out invoices and what to automate
>>the task.
>>
>>
>
>If, for some weird reason, you want to allow the user (authenticated,
>logged in, trusted) to print to a networked computer on the WEB
>SERVER, then your best bet is probably to figure out how to print that
>PDF from MS-DOS and then to use http://php.net/exec to print it, I
>would guess...
>
>
It's from a cli PHP install on a local machine :-)
>You might be able to use PHP to open up a COM object to convince
>Adobe/Windows/whatever to print...
>
>
COM makes me want to cry ;-) At the moment I'm trying to convince
OpenOffiice it wants to play with PHP and COM.
I have tried to exec print on the windows box but that just hung.
>If it was a Un*x server, you'd just send the document to lpr or CUPS
>or something, and be done with it, probably in a half-hour of work,
>even allowing for a protracted battle with file/exec permissions.
>
>
>
I'm not sure I could just fire a PDF at lpr, but no doubt it would be
much easier under Unix :-)
Dave.
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
attached mail follows:
How can I read data from word document (*.doc) use by php script ?
I konw only how to write and how to open word document.
Thanks
roman
attached mail follows:
Roman Duriancik schrieb:
> How can I read data from word document (*.doc) use by php script ?
> I konw only how to write and how to open word document.
Convert the .doc to a .txt document before opening it with PHP.
There are external tools available to do this but I won't do the
searching for you ;-)
OLLi
attached mail follows:
[snip]
How can I read data from word document (*.doc) use by php script ?
I konw only how to write and how to open word document.
[/snip]
http://www.php.net/com
attached mail follows:
thanks, Richard :)
The simplest solution is usually the best
As you suggested, I used php to created a 'log in' movie which upon
authentication loads the playlist of movies
Also, as you suggested, I think I'll create a session id with a
master password, can see everything, and a 'movie specific' password
head spinning slowing.....
g
On Oct 24, 2005, at 7:20 PM, Richard Lynch wrote:
>> The script , makeMoviePlaylist.php, is calling itself on the server
>> with
>> makeMoviePlaylist.php?cmd=getmovie&path=encrypted_path_to_the_movie
>> The script, makeMoviePlaylist.php, accepts the request because it
>> originated from ITSELF on the server...
>>
>
> How do you *KNOW* it originated from ITSELF?
>
> Can't I just fake it out by copying the URL you are using?
>
>
>> This request was sent from OUTSIDE the server. The main script,
>> makeMoviePlaylist.php, realizes the this request did not originate
>> from itself on the server
>>
>
> Again, how you do *KNOW* that to be true?
>
>
>
> What's the big picture again?
>
> They need to login to see the movies, right?
>
> Or is it something else?
>
> If just need login, use http://php.net/session_start and friends as I
> just posted.
>
> If it's something else, session_start() may not help.
>
> --
> Like Music?
> http://l-i-e.com/artists.htm
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Hi guys.
I've created a small newsletter application and the content of the
newsletter is stored in a DB (the HTML).
However once the newsletter is complete and the user clicks a button I
want the newsletter/html file to be created on the server. How do I go
about this?
I assume that I will use fwrite() to add the HTML to the file, I need to
know how to actually create the file before adding the content to it.
thanks in advance.
Angelo
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]