|
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 30 Mar 2005 18:19:02 -0000 Issue 3368
php-general-digest-help
lists.php.net
Date: Wed Mar 30 2005 - 12:19:02 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 30 Mar 2005 18:19:02 -0000 Issue 3368
Topics (messages 211844 through 211901):
Re: ISO encoding of subject in mail?
211844 by: Lars B. Jensen
211845 by: Kim Madsen
211849 by: Kim Madsen
Re: PHP 5 Strings are References?!
211846 by: Chris
211869 by: Jochem Maas
Enabling MySQL support Problemmmmm!!!!
211847 by: wan nordiana Wan Abd Kadir
211848 by: Burhan Khalid
Re: filtering uploaded files
211850 by: A. S. Milnes
Re: URL restriction on XML file
211851 by: Marek Kilimajer
HELP!
211852 by: Íõ³ÉÇÇ
211853 by: Íõ³ÉÇÇ
211857 by: Kim Madsen
Generate random number
211854 by: William Stokes
211855 by: Kim Madsen
211856 by: William Stokes
211858 by: PtitRun
How can I parse a xml file like this?
211859 by: Å£À¤
211862 by: Burhan Khalid
Error Generated but no error?
211860 by: Geoff Martin
211861 by: Burhan Khalid
Re: Best Server OS
211863 by: Nobody Special
211873 by: Brent Baisley
How to insert and select images from postgres db
211864 by: J.F.Kishor
asking comment
211865 by: William Stokes
211866 by: Richard Davey
211867 by: Angelo Zanetti
211868 by: Frank Arensmeier
211879 by: Jared Williams
211880 by: Richard Davey
211885 by: Jared Williams
211894 by: Richard Davey
211896 by: Jared Williams
211897 by: Richard Davey
211899 by: Jared Williams
211901 by: Richard Davey
Parsing... the hell of PHP
211870 by: Mário Gamito
211871 by: Richard Davey
211872 by: Martin.C.Austin.supervalu.com
211888 by: Mário Gamito
211889 by: Mário Gamito
211892 by: Martin.C.Austin.supervalu.com
deleting all my cookies
211874 by: AndreaD
211875 by: Ken
211876 by: John Nichel
Re: Validating XML structure with PHP
211877 by: Jason Barnett
Re: PHPXref is awesome!
211878 by: Jason Barnett
Mail with acknowledgement of delivery
211881 by: marc serra
211884 by: Leif Gregory
211886 by: Markus Mayer
XML/HTML specific instructions
211882 by: Satyam
How to format every secound row in a database result
211883 by: Georg
211890 by: Jochem Maas
211891 by: Miles Thompson
211893 by: Martin.C.Austin.supervalu.com
211898 by: Leif Gregory
211900 by: Richard Davey
DBF to MySQL using PHP Script
211887 by: Rahul S. Johari
Parsing bounced emails
211895 by: aldo.mailinglistphp.tiscali.it
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:
>> i vaguely recall some new (aka 5.04) functions added to the mbstring
>> extension to handle this.
>Hmm... I´m programming on a platform with 4.3.10, so that won´t work for
>me. Might just create my own function since it´s 6 chars that needs to be
>converted...
beware of biting dog when proceeding with mbstring functions, as some is
buggy for some languages (in my case Japanese)
--
Lars B. Jensen, Internet Architect
CareerCross Japan
Japan's premier online career resource for english speaking professionals
http://www.careercross.com
attached mail follows:
> -----Original Message-----
> From: M. Sokolewicz [mailto:tularis
php.net]
> Sent: Tuesday, March 29, 2005 6:09 PM
> convert it to quoted-printable using eg. imap_8bit()
That seems to be, what I want _but_ NO PHP is printed after I call this function. I turns out that we haven´t got PHP compiled with imap support and the setup shows no errors as default (never worked with that, it confused me a lot :-)
/kim
attached mail follows:
> -----Original Message-----
> From: Kim Madsen [mailto:km
comx.dk]
> Sent: Tuesday, March 29, 2005 3:56 PM
> I´d like to encode the subject in mails generated and sent by PHP, so
> Danish letters like æ,ø and å can be used too... like this:
>
> Subject: Problemer med =?ISO-8859-1?Q?f=E6llesdrev_m=2Em=2E?=
>
> I can´t seem to find a proper function for this? I´ve tried with encode(),
> htmlentities() and htmlspecialchars():
mb_send_mail() did the trick for me... Somehow there a need for a reference to this function on encoding sites or a search function on specific words (like ISO-8859)
/kim
attached mail follows:
Richard Lynch wrote:
>
>
>On Tue, March 29, 2005 7:58 pm, Chris said:
>
>
>>Richard Lynch wrote:
>>
>>
>>
>>>Aha!
>>>
>>>Okay, here's the previous session question boiled down to its simplest:
>>>
>>><?php
>>> session_start();
>>> if (!isset($_SESSION['name'])){
>>> $_SESSION['name'] = 'Richard Lynch';
>>> }
>>> else{
>>> $name = $_SESSION['name'];
>>> }
>>> /* Assume a ton of code goes here */
>>> $name = 'Fooey';
>>> echo "Session name is: ", $_SESSION['name'], "<br />\n";
>>>?>
>>>
>>>Now, hit this page, re-load it, and what do *YOU* expect
>>>$_SESSION['name']
>>>to output?
>>>
>>>A) 'Richard Lynch', because you never re-assigned $_SESSION['name']
>>>B) 'Fooey' because $name is a reference, and you changed it, so that
>>>changed your session data.
>>>
>>>*I* expected A)
>>>Alas, the reality is B)
>>>
>>>Grrrrrrrr. I do *NOT* want all my strings to suddenly turn into
>>>pointers.
>>>If I wanted that kind of headache, I'd be coding in C! :-)
>>>
>>>I should have known this from the get-go, when I saw & in my session data
>>>with var_dump($_SESSION); *WHY* are strings suddenly turning into
>>>references? They're *NOT* objects!
>>>
>>>I'm about to go re-read the PHP 5 sections of the manual with a
>>>fine-tooth
>>>comb to see if I just missed this as an upgrade issue.
>>>
>>>It's pretty much going to break a hell of a lot of scripts, that's for
>>>sure.
>>>
>>>Somebody please tell me this is a Bug, not a "Feature"
>>>
>>>PHP 5.0.3
>>>FreeBSD 5.3-RELEASE
>>>
>>>
>>>
>>>
>>>
>>Are you sure you don't have register_globals enabled?
>>
>>
>
>Actually, they *ARE* enabled by my webhost.
>
>I don't really think that's relevant, however, as PHP is storing $name
>back *IN* to my $_SESSION data, just because I did:
>$name = $_SESSION['name'];
>$name = "Fooey";
>
>$name is a STRING.
>
>It's not an object.
>
>It should *NOT* be a Reference!
>
>But it is a Reference, so changing $name alters $_SESSION['name']
>
>
>
Sorry, meant to reply to list, not just you.
All I'm saying is that Sessions act extremely oddly with
register_globals enabled.
With register_globals on I believe the global variable, acts as a
reference. It's not because it's a string, it's because it's a session
variable, and it needs to keep track of changes to the variable.
attached mail follows:
Chris wrote:
> Richard Lynch wrote:
>
>>
>>
>> On Tue, March 29, 2005 7:58 pm, Chris said:
>>
>>
>>> Richard Lynch wrote:
>>>
>>>
...
>>>
>>> Are you sure you don't have register_globals enabled?
>>>
I tested Richards reproduce script on php 5.0.3 on a Debian
machine with the following ini settings:
register_globals = Off
register_long_arrays = Off
register_argc_argv = Off
magic_quotes_gpc = Off
magic_quotes_runtime = Off
(i.e. all relevant ini settings are php5 defaults)
and I get the same freakin' references from/in the SESSION array.
>>
>>
>> Actually, they *ARE* enabled by my webhost.
>>
>> I don't really think that's relevant, however, as PHP is storing $name
>> back *IN* to my $_SESSION data, just because I did:
>> $name = $_SESSION['name'];
>> $name = "Fooey";
>>
>> $name is a STRING.
>>
>> It's not an object.
>>
>> It should *NOT* be a Reference!
>>
>> But it is a Reference, so changing $name alters $_SESSION['name']
>>
>>
>>
> Sorry, meant to reply to list, not just you.
>
> All I'm saying is that Sessions act extremely oddly with
> register_globals enabled.
>
> With register_globals on I believe the global variable, acts as a
> reference. It's not because it's a string, it's because it's a session
> variable, and it needs to keep track of changes to the variable.
I agree with Chris that register_globals can only cause more pain and misery :-/
but in this case the problem exists regardless of register_globals setting.
here is a func I sometimes use when going to war with a register_globals=On server :-)
nothing special and I blagged the idea from somewhere/someone (probably in the
user comments somewhere in the php manual :-/)
function unRegisterGlobals()
{
if (ini_get('register_globals')) {
$SGs = array($_SERVER, $_ENV, $_FILES, $_COOKIE, $_POST, $_GET);
if (isset($_SESSION)) { array_unshift($SGs, $_SESSION); }
// SG == super global
foreach ($SGs as $sg) {
foreach ($sg as $k => $v) { unset($GLOBALS[ $k ]); }
}
ini_set('register_globals', false);
}
}
>
attached mail follows:
Hello,
I am having problem with enabling MySQL Support. I am using PHP 5 and mysql 4.3.1
The problem is that when I start my PHP info page, PHP
module gives me an error: "PHP Startup: Unable to load
dynamic library '...' - The specified module could not
be found". BUT THEY ARE!!! A part of my php.ini file
is:
;Windows Extensions
;Note that ODBC support is built in, so no dll is needed for it.
;
;extension=php_bz2.dll
;extension=php_cpdf.dll
;extension=php_curl.dll
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_dbx.dll
;extension=php_exif.dll
;extension=php_fdf.dll
;extension=php_filepro.dll
;extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_ifx.dll
;extension=php_iisfunc.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_java.dll
;extension=php_ldap.dll
;extension=php_mbstring.dll
;extension=php_mcrypt.dll
;extension=php_mhash.dll
;extension=php_mime_magic.dll
;extension=php_ming.dll
;extension=php_mssql.dll
;extension=php_msql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll
;extension=php_openssl.dll
;extension=php_oracle.dll
;extension=php_pdf.dll
;extension=php_pgsql.dll
;extension=php_shmop.dll
;extension=php_snmp.dll
;extension=php_sockets.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
;extension=php_w32api.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
;extension=php_yaz.dll
;extension=php_zip.dll
The one without ; line is the one that the PHP could not find suach as php_mysql.dll
in my C:\PHP folder should i have those file? because when i check in the folder, i do not have any file named php_mysql.dll. and also should i have the ext folder in there? Pleaseeee help me.
---------------------------------
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
attached mail follows:
wan nordiana Wan Abd Kadir wrote:
> Hello,
>
> I am having problem with enabling MySQL Support. I am using PHP 5 and mysql 4.3.1
>
> The problem is that when I start my PHP info page, PHP
> module gives me an error: "PHP Startup: Unable to load
> dynamic library '...' - The specified module could not
> be found". BUT THEY ARE!!! A part of my php.ini file
> is:
Did you download the executable or zip for Windows? The zip file has
many more extensions, and they are located in the extensions folder.
Also make sure you have set the extensions directory correctly in php.ini
attached mail follows:
On Wed, 2005-03-30 at 04:59, Richard Lynch wrote:
> Please reference their publications, if possible.
At hand immediately I have:-
PHP and MySQL Web Development 3rd edition by Luke Welling (Senior Web
Developer at MySQL) and Laura Thomson, published by
www.developers-library.com.
> It's just plain BAD security to trust this value for any real-world usage.
Surely it's part of the toolkit - you can filter out people sending
dangerous stuff if they are not that sophisticated. I would never want
to rely on one line of defence.
> And it's made meaningless by the browsers not standardizing what they send
> anyway.
It's an interesting point which I will need to investigate further.
Alan
attached mail follows:
That's because the character data is split on the borders of the
entities, so for
http://feeds.example.com/?rid=318045f7e13e0b66&cat=48cba686fe041718&f=1
characterData() will be called 5 times:
http://feeds.example.com/?rid=318045f7e13e0b66
&
cat=48cba686fe041718
&
f=1
Solution is inlined below
Roger Thomas wrote:
> I have a short script to parse my XML file. The parsing produces no error and all output looks good EXCEPT url-links were truncated IF it contain the '&' characters.
>
> My XML file looks like this:
> --- start of XML ---
> <?xml version="1.0" encoding="iso-8859-1"?>
> <rss version="2.0">
> <channel>
> <title>Test News .Net - Newspapers on the Net</title>
> <copyright>Small News Network.com</copyright>
> <link>http://www.example.com/</link>
> <description>Continuously updating Example News.</description>
> <language>en-us</language>
> <pubDate>Tue, 29 Mar 2005 18:01:01 -0600</pubDate>
> <lastBuildDate>Tue, 29 Mar 2005 18:01:01 -0600</lastBuildDate>
> <ttl>30</ttl>
> <item>
> <title>Group buys SunGard for US$10.4bil</title>
> <link>http://feeds.example.com/?rid=318045f7e13e0b66&cat=48cba686fe041718&f=1</link>
> <description>NEW YORK: A group of seven private equity investment firms agreed yesterday to buy financial technology company SunGard Data Systems Inc in a deal worth US$10.4bil plus debt, making it the biggest lev...</description>
> <source url="http://biz.theexample.com/">The Paper</source>
> </item>
> <item>
> <title>Strong quake hits Indonesia coast</title>
> <link>http://feeds.example.com/news/world/quake.html</link>
> <description>a "widely destructive tsunami" and the quake was felt as far away as Malaysia.</description>
> <source url="http://biz.theexample.com.net/">The Paper</source>
> </item>
> <item>
> <title>Final News</title>
> <link>http://feeds.example.com/?id=abcdef&cat=somecat</link>
> <description>We are going to expect something new this weekend ...</description>
> <source url="http://biz.theexample.com/">The Paper</source>
> </item>
> </channel>
> </rss>
> --- end of XML ---
>
> For the sake of testing, my script only print out the url-link to those news above. I got these:
> f=1
> http://feeds.example.com/news/world/quake.html
> cat=somecat
>
> The output for line 1 is truncated to 'f=1' and the output of line 3 is truncated to 'cat=somecat'. ie, the script only took the last parameter of the url-link. The output for line 2 is correct since it has NO parameters.
>
> I am not sure what I have done wrong in my script. Is it bcos the RSS spec says that you cannot have parameters in URL ? Please advise.
>
> -- start of script --
> <?
> $file = "test.xml";
> $currentTag = "";
>
> function startElement($parser, $name, $attrs) {
> global $currentTag;
> $currentTag = $name;
> }
>
> function endElement($parser, $name) {
> global $currentTag, $TITLE, $URL, $start;
>
> switch ($currentTag) {
> case "ITEM":
> $start = 0;
> case "LINK":
> if ($start == 1)
> #print "<A HREF = \"".$URL."\">$TITLE</A><BR>";
> print "$URL"."<BR>";
> break;
> }
> $currentTag = "";
// Reset also other variables:
$URL = '';
$TITLE = '';
> }
>
> function characterData($parser, $data) {
> global $currentTag, $TITLE, $URL, $start;
>
> switch ($currentTag) {
> case "ITEM":
> $start = 1;
> case "TITLE":
> $TITLE = $data;
// append instead:
$TITLE .= $data;
> break;
> case "LINK":
> $URL = $data;
// append instead:
$URL .= $data;
// Warning: entities are decoded at this point, you will receive &, not
&
> break;
> }
> }
>
> $xml_parser = xml_parser_create();
> xml_set_element_handler($xml_parser, "startElement", "endElement");
> xml_set_character_data_handler($xml_parser, "characterData");
>
> if (!($fp = fopen($file, "r"))) {
> die("Cannot locate XML data file: $file");
> }
>
> while ($data = fread($fp, 4096)) {
> if (!xml_parse($xml_parser, $data, feof($fp))) {
> die(sprintf("XML error: %s at line %d",
> xml_error_string(xml_get_error_code($xml_parser)),
> xml_get_current_line_number($xml_parser)));
> }
> }
>
> xml_parser_free($xml_parser);
>
> ?>
> -- end of script --
>
> TIA.
> Roger
>
>
> ---------------------------------------------------
> Sign Up for free Email at http://ureg.home.net.my/
> ---------------------------------------------------
>
attached mail follows:
Hi,
Would somebone give me a examble of regulation expression to check
account(or money) type which start with ¡°$¡±.
For examble, ¡°$65,786.00¡±
I am a newer.
Thanks.
Yours,
Justin zoe
attached mail follows:
Hi,
Would somebone give me a example of regulation expression to check
account(or money) type which start with ¡°$¡±.
For example, ¡°$65,786.00¡±
I am a newer.
Thanks.
Yours,
Justin zoe
attached mail follows:
> -----Original Message-----
> From: 王æˆä¹” [mailto:wangchq
china-channel.com]
> Sent: Wednesday, March 30, 2005 11:46 AM
> To: php-general
lists.php.net
> Cc: php-general
lists.php.net
Why to AND cc?
> Would somebone give me a example of regulation expression to check
> account(or money) type which start with “$â€.
> For example, “$65,786.00â€
Same question was asked yesterday?
$str = "$65,786.00";
if(ereg("^([\$]([0-9]+,)?[0-9]+\.[0-9]+)",$str, $pricetag))
print "we found a price tag: $pricetag[1]";
else
print "no prices found";
This is untested, the ([0-9]+,)? Means that there _may_ be digits and then a komma, but it´s not necessary, threfore $786.00 and $1.00 matches too. The () around all expressions means, that we save whatever is matched into $pricetag
--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/systemdeveloper
attached mail follows:
Hello
How can I generate a ramdom number let's say between 1- 1 000 000 and store
it in a variable?
Thanks
-Will
attached mail follows:
> -----Original Message-----
> From: William Stokes [mailto:kalles
operamail.com]
> Sent: Wednesday, March 30, 2005 12:02 PM
> How can I generate a ramdom number let's say between 1- 1 000 000 and
> store
> it in a variable?
Go to php.net, search for random and You will find...
http://php.net/manual/en/function.rand.php
--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/systemdeveloper
attached mail follows:
never mind...
:-)
"William Stokes" <kalles
operamail.com> kirjoitti
viestissä:20050330100117.463.qmail
lists.php.net...
> Hello
>
> How can I generate a ramdom number let's say between 1- 1 000 000 and
> store it in a variable?
>
> Thanks
> -Will
attached mail follows:
For example :
$number = mt_rand(1,1000000);
-----Message d'origine-----
De : William Stokes [mailto:kalles
operamail.com]
Envoyé : mercredi 30 mars 2005 12:02
À : php-general
lists.php.net
Objet : [PHP] Generate random number
Hello
How can I generate a ramdom number let's say between 1- 1 000 000 and store
it in a variable?
Thanks
-Will
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Dear php users,
I'll have to parse a xml file like this:
<?xml version="1.0" encoding="utf-8"?>.
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance".
xmlns:xsd="http://www.w3.org/2001/XMLSchema".
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/".
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">.
<SOAP-ENV:Header>.
<TransactionID xmlns="http://www.monternet.com/dsmp/schemas/">00110366325534</TransactionID>.
</SOAP-ENV:Header>.
<SOAP-ENV:Body>.
<SyncOrderRelationReq xmlns="http://www.monternet.com/dsmp/schemas/"><Version>1.5.0</Version><MsgType>SyncOrderRelationReq</MsgType><Send_Address><DeviceType>0</DeviceType><DeviceID>0011</DeviceID></Send_Address><Dest_Address><DeviceType>400</DeviceType><DeviceID>0</DeviceID></Dest_Address><FeeUser_ID><UserIDType>2</UserIDType><MSISDN></MSISDN><PseudoCode>00110046548986</PseudoCode></FeeUser_ID><DestUser_ID><UserIDType>2</UserIDType><MSISDN></MSISDN><PseudoCode>00110046548986</PseudoCode></DestUser_ID><LinkID>SP</LinkID><ActionID>1</ActionID><ActionReasonID>1</ActionReasonID><SPID>819592</SPID><SPServiceID>03010537</SPServiceID><AccessMode>2</AccessMode><FeatureStr>IA==</FeatureStr></SyncOrderRelationReq></SOAP-ENV:Body>.
</SOAP-ENV:Envelope>
But it seems that xml_parse_into_struct doesn't work well.
Any help will be appreciated:)
Thanks in advance.
Sincerely,
Kun
attached mail follows:
Å£À¤ wrote:
> Dear php users,
>
> I'll have to parse a xml file like this:
> <?xml version="1.0" encoding="utf-8"?>.
> <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance".
> xmlns:xsd="http://www.w3.org/2001/XMLSchema".
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/".
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">.
> <SOAP-ENV:Header>.
> <TransactionID xmlns="http://www.monternet.com/dsmp/schemas/">00110366325534</TransactionID>.
> </SOAP-ENV:Header>.
> <SOAP-ENV:Body>.
> <SyncOrderRelationReq xmlns="http://www.monternet.com/dsmp/schemas/"><Version>1.5.0</Version><MsgType>SyncOrderRelationReq</MsgType><Send_Address><DeviceType>0</DeviceType><DeviceID>0011</DeviceID></Send_Address><Dest_Address><DeviceType>400</DeviceType><DeviceID>0</DeviceID></Dest_Address><FeeUser_ID><UserIDType>2</UserIDType><MSISDN></MSISDN><PseudoCode>00110046548986</PseudoCode></FeeUser_ID><DestUser_ID><UserIDType>2</UserIDType><MSISDN></MSISDN><PseudoCode>00110046548986</PseudoCode></DestUser_ID><LinkID>SP</LinkID><ActionID>1</ActionID><ActionReasonID>1</ActionReasonID><SPID>819592</SPID><SPServiceID>03010537</SPServiceID><AccessMode>2</AccessMode><FeatureStr>IA==</FeatureStr></SyncOrderRelationReq></SOAP-ENV:Body>.
> </SOAP-ENV:Envelope>
>
> But it seems that xml_parse_into_struct doesn't work well.
> Any help will be appreciated:)
This is a SOAP envelope, so you need to use the many SOAP classes that
are available to parse it.
attached mail follows:
I have a page that receives data from a form. Using $_POST['foo'], I am
able to use this data in the page but I continually receive an error
notice (PHP Notice: Undefined index: foo in
/Library/WebServer/Documents/.. etc).
This happens to all three indices that are passed by this form, yet the
data IS appearing. How do I prevent these error messages?
Geoff M
attached mail follows:
Geoff Martin wrote:
> I have a page that receives data from a form. Using $_POST['foo'], I am
> able to use this data in the page but I continually receive an error
> notice (PHP Notice: Undefined index: foo in
> /Library/WebServer/Documents/.. etc).
>
> This happens to all three indices that are passed by this form, yet the
> data IS appearing. How do I prevent these error messages?
You have two options, you can either
[a] disable notices (by using error_reporting())
or
[b] verify indices by using functions such as array_key_exists() etc.
attached mail follows:
On Tue, 29 Mar 2005 11:10:18 -0500, Gerald Artman <gartm
lssm.org> wrote:
>
> I would recommend OSX
>
Inserts foot in mouth.
> Top ratings on security compared to Linux or Windows
Unless you enable outside services. And who rated it anyway?
Probably paid by Apple.
> Fast processors in many configurations, most include 1000T
> Starting at $500 to $3500 for up to +15MIPS performance
Starting at $500. Are you talking about the mac-mini. hahahahaha
What a joke. For OSX on good hardware you are talking $2000 and up.
Plus, you will have to PAY for upgrades in the future. That is why
they call it FeeBSD.
In certain ways OSX/Apple is worse than Microsoft. With Apple you
have proprietary software and HARDWARE.
> Excellent GUI interface
It's a server. Who needs a GUI running that will use up valuable memory.
> Supported by Apache, PHP, MySQL and comes pre-installed
>
Pre-Installed = I didn't set it up = security risk.
--
Use Linux.
W=Wrong
Proud member of the reality-based community!
In opposing the Federalists, [Jefferson] ushered in a
kind of sustained partisan activity that had never existed
before. Initially called the Republican party, it became known
in the era of Andrew Jackson as simply the Democracy;
later on, it was called the Democratic party. But even the modern
Republican party, formed in 1854, chose its name in part to honor
Jefferson. -- Joyce Appleby on Jefferson
attached mail follows:
I've used Macs for a long time and think it's a great client and OS.
The GUI stuff they have for the server I think is great too. But when
considering the best OS for a server, I would hardly recommend it,
except from an ease of use and setup standpoint. Apple is still coming
up to speed on all the underpinnings, partly because of the changes BSD
is going through (i.e. changing the threading model). Tiger I think
will be a big boost and the planned eventual transition to gcc 4 will
be an even bigger boost.
I read an article recently that compared MySQL and other software
performance on various operating systems, including Windows, Solaris,
FreeBSD, OpenBSD, NetBSD and Linux (gentoo). Linux pretty much stole
the show, mainly because of it's threading design. Using Linux threads
on BSD improved performance on BSD systems. While OSX wasn't tested,
you could extrapolate where it might fall in the review since it is
based on BSD.
http://software.newsforge.com/article.pl?sid=04/12/27/1243207&from=rss
On Mar 29, 2005, at 11:10 AM, Gerald Artman wrote:
>
> I would recommend OSX
>
> Top ratings on security compared to Linux or Windows
> Fast processors in many configurations, most include 1000T
> Starting at $500 to $3500 for up to +15MIPS performance
> Excellent GUI interface
> Supported by Apache, PHP, MySQL and comes pre-installed
>
>
> Jerry Artman
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
attached mail follows:
Hi,
I am having a problem in storing and selecting images in and
from postgres.
My requirement is I have to select the image from the database
and display it in User Interface.
Can anyone help me through this problem, I'am in need of this
solution by today.
Regards,
- JFK
kishor
Nilgiri Networks
attached mail follows:
Hello,
I got a bit frustrated with image upload stuff with different image name
problems. So I created a system that gives the uploaded imaged a random
numeric name between 1-10 000 000 and saves the file to a server folder and
the image name to mysql DB.
Is there a so sort of a problem here that I am not thinking of? I only can
imagine problem that the rand() gives the same value twice. But I cant see
this as a major problem because there would be maybe not more than 1000
uploaded pictures. So the chance is at worst something like 1:10 000 that
same name is created to the image.
Anyway if same name is created what's the best way to check that? I was
thinking of putting the image name field in DB as a unique field. That would
do it? Right?
Thanks again
-Will
attached mail follows:
Hello William,
Wednesday, March 30, 2005, 1:44:01 PM, you wrote:
WS> Is there a so sort of a problem here that I am not thinking of? I
WS> only can imagine problem that the rand() gives the same value
WS> twice. But I cant see this as a major problem because there would
WS> be maybe not more than 1000 uploaded pictures. So the chance is at
WS> worst something like 1:10 000 that same name is created to the
WS> image.
Actually that's only true of the very first image you upload. For
every image uploaded there-after your odds get worse and worse for a
conflict happening.
If you really must use this method please at least do a file_exists()
check first to make sure your random number hasn't been used.
WS> Anyway if same name is created what's the best way to check that?
Depends how you are storing it - if it's in a database then check to
see if that ID is used. If just a plain file, use file_exists.
WS> I was thinking of putting the image name field in DB as a unique
WS> field. That would do it? Right?
Yes it would ensure the filename was unique, but unless you actually
need it in a database it's probably not worth the effort. Just check
for the actual file itself.
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I do not fear computers. I fear the lack of them." - Isaac Asimov
attached mail follows:
use a SQL statement to check if that number exists if not then its fine
if it does then generate another no and check again, until there is a
unique number generated.
hope this helps
angelo
William Stokes wrote:
>Hello,
>
>I got a bit frustrated with image upload stuff with different image name
>problems. So I created a system that gives the uploaded imaged a random
>numeric name between 1-10 000 000 and saves the file to a server folder and
>the image name to mysql DB.
>
>Is there a so sort of a problem here that I am not thinking of? I only can
>imagine problem that the rand() gives the same value twice. But I cant see
>this as a major problem because there would be maybe not more than 1000
>uploaded pictures. So the chance is at worst something like 1:10 000 that
>same name is created to the image.
>
>Anyway if same name is created what's the best way to check that? I was
>thinking of putting the image name field in DB as a unique field. That would
>do it? Right?
>
>Thanks again
>-Will
>
>
>
--
Angelo Zanetti
Z Logic
[c] +27 72 441 3355
[t] +27 21 464 1363
[f] +27 21 464 1371
www.zlogic.co.za
attached mail follows:
Instead of generating filenames with random numbers, why not take a
timestamp and use this as filenames?
/frank
2005-03-30 kl. 14.44 skrev William Stokes:
> Hello,
>
> I got a bit frustrated with image upload stuff with different image
> name
> problems. So I created a system that gives the uploaded imaged a random
> numeric name between 1-10 000 000 and saves the file to a server
> folder and
> the image name to mysql DB.
>
> Is there a so sort of a problem here that I am not thinking of? I only
> can
> imagine problem that the rand() gives the same value twice. But I cant
> see
> this as a major problem because there would be maybe not more than 1000
> uploaded pictures. So the chance is at worst something like 1:10 000
> that
> same name is created to the image.
>
> Anyway if same name is created what's the best way to check that? I was
> thinking of putting the image name field in DB as a unique field. That
> would
> do it? Right?
>
> Thanks again
> -Will
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
attached mail follows:
>
> I got a bit frustrated with image upload stuff with different
> image name problems. So I created a system that gives the
> uploaded imaged a random numeric name between 1-10 000 000
> and saves the file to a server folder and the image name to mysql DB.
>
> Is there a so sort of a problem here that I am not thinking
> of? I only can imagine problem that the rand() gives the same
> value twice. But I cant see this as a major problem because
> there would be maybe not more than 1000 uploaded pictures. So
> the chance is at worst something like 1:10 000 that same name
> is created to the image.
>
> Anyway if same name is created what's the best way to check
> that? I was thinking of putting the image name field in DB as
> a unique field. That would do it? Right?
Append a datetime to the filenames, or use a folder per date?
If want to create a unique filename, and are using PHP4.3.2 or better, use fopen() with the 'x' or 'x+' mode, rather than
file_exists().
Something like the function below,
The filename parameter is passed by reference, so you can retrieve the filename the function actually created.
Returns a FALSE, or a standard file handle which can fwrite() etc.
function createFileWithUniqueName(&$filename)
{
$f =
fopen($filename, 'x');
if ($f === FALSE)
{
$pathInfo = pathinfo($filename);
$dirname = $pathInfo['dirname'];
$basename = $pathInfo['basename'];
$extension = $pathInfo['extension'];
if (!empty($dirname))
$dirname .= DIRECTORY_SEPARATOR;
if (!empty($extension))
{
$extension = '.'.$extension;
$basename = substr($basename, 0, -strlen($extension)); // Remove extension from basename
}
$prefix = $dirname.$basename.'_';
/* Keep trying to create new files ... The $n < 100 is just to prevent any extreme situations happening */
for ($n = 1; $f === FALSE && $n < 100; ++$n)
{
$name = $prefix.$n.$extension;
$f =
fopen($name, 'x');
}
if ($f !== FALSE)
$filename = $name;
}
return $f;
}
$basename = 'test.txt';
$n = $basename;
$f = createFileWithUniqueName($n);
if ($f !== FALSE)
{
fwrite($f, 'test '.$n);
fclose($f);
}
$n = $basename;
$f = createFileWithUniqueName($n);
if ($f !== FALSE)
{
fwrite($f, 'test '.$n);
fclose($f);
}
Jared
attached mail follows:
Hello Jared,
Wednesday, March 30, 2005, 4:16:31 PM, you wrote:
JW> If want to create a unique filename, and are using PHP4.3.2
JW> or better, use fopen() with the 'x' or 'x+' mode, rather than
JW> file_exists().
If you're happy with your scripts generating E_WARNING's all over the
place then yes. Personally, I'm not.
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I do not fear computers. I fear the lack of them." - Isaac Asimov
attached mail follows:
> JW> If want to create a unique filename, and are using PHP4.3.2 or
> JW> better, use fopen() with the 'x' or 'x+' mode, rather than
> JW> file_exists().
>
> If you're happy with your scripts generating E_WARNING's all
> over the place then yes. Personally, I'm not.
Use
to surpress them.
You cannot guarentee the filename you think doesn't exist with the file_exists() doesn't exist when you eventually fopen() it,
otherwise. This problem falls into a category called "Race conditions". http://en.wikipedia.org/wiki/Race_condition and
http://www.dwheeler.com/secure-programs/Secure-Programs-HOWTO/avoid-race.html.
Jared
attached mail follows:
Hello Jared,
Wednesday, March 30, 2005, 4:51:01 PM, you wrote:
>> If you're happy with your scripts generating E_WARNING's all
>> over the place then yes. Personally, I'm not.
JW> You cannot guarentee the filename you think doesn't exist with the
JW> file_exists() doesn't exist when you eventually fopen() it,
JW> otherwise.
Using the original posters method, I agree. But there are plenty of
ways around this without forcing a warning to occur (or having to
suppress one), that avoids any sort of "race condition". It's just the
way the OP is doing it is IMHO messy to begin with, but was obviously a
solution born out of frustration.
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I do not fear computers. I fear the lack of them." - Isaac Asimov
attached mail follows:
> JW> You cannot guarentee the filename you think doesn't exist with the
> JW> file_exists() doesn't exist when you eventually fopen() it,
> JW> otherwise.
>
> Using the original posters method, I agree. But there are
> plenty of ways around this without forcing a warning to occur
> (or having to suppress one), that avoids any sort of "race
> condition". It's just the way the OP is doing it is IMHO
> messy to begin with, but was obviously a solution born out of
> frustration.
If you think you have another method please elaborate.
Jared
attached mail follows:
Hello Jared,
Wednesday, March 30, 2005, 6:27:14 PM, you wrote:
JW> If you think you have another method please elaborate.
Sure, at the base level the issue is simply the uniqueness of the
filename. So there are several options open in this regard. Either use
an md5'd uniqid rand combination (as on the uniqid manual page) and
just go with that, operating under the assumption that the chances of a
conflicting hash are remote at best.
Or another method (which the OP touched upon) would be using some SQL
space and simply getting the next available ID back and using it as
the filename. There are no race conditions here, the ID you will get
is unique to that session. Assuming the site was correctly set-up you
wouldn't then even need to check the file exists, just
move_uploaded_file on it. But for the overly paranoid you could do and
if a file does exist, get another ID. While it involves DB overhead it
ensures relatively bullet-proof uniqueness and no warning generation /
suppression.
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I do not fear computers. I fear the lack of them." - Isaac Asimov
attached mail follows:
> Sure, at the base level the issue is simply the uniqueness of
> the filename. So there are several options open in this
> regard. Either use an md5'd uniqid rand combination (as on
> the uniqid manual page) and just go with that, operating
> under the assumption that the chances of a conflicting hash
> are remote at best.
> Or another method (which the OP touched upon) would be using
> some SQL space and simply getting the next available ID back
> and using it as the filename. There are no race conditions
> here, the ID you will get is unique to that session. Assuming
> the site was correctly set-up you wouldn't then even need to
> check the file exists, just move_uploaded_file on it. But for
> the overly paranoid you could do and if a file does exist,
> get another ID. While it involves DB overhead it ensures
> relatively bullet-proof uniqueness and no warning generation
> / suppression.
I'll take absolutely bullet-proof and handled/supressed warnings, over relatively bullet-proof.
Jared
attached mail follows:
Hello Jared,
Wednesday, March 30, 2005, 7:02:58 PM, you wrote:
JW> I'll take absolutely bullet-proof and handled/supressed warnings,
JW> over relatively bullet-proof.
That would be fine if your previous solution was absolutely
bullet-proof, or for that matter provided a solution for the original
problem of renaming uploaded files and keeping them unique. Appending
a datetime to a file, or using a loop that hopes you get a unique name
within 100 iterations is wildly far from "bullet proof" in just about
every respect.
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I do not fear computers. I fear the lack of them." - Isaac Asimov
attached mail follows:
Hi,
I'm trying to transform a url taken from the DB from "plain text", to
the same, but linkable url.
All i get is parse errors and alike.
Here is my last (of many) attempt:
$url = "<a href =\".$url."\">.HtmlEntities($url)."\">".</a>";
A warning and a parse error is what i get.
Can't get there :(
Any help would be apreciated.
Warm regards,
Mário Gamito
attached mail follows:
Hello Mário,
Wednesday, March 30, 2005, 2:51:02 PM, you wrote:
MG> Here is my last (of many) attempt:
MG> $url = "<a href =\".$url."\">.HtmlEntities($url)."\">".</a>";
$url = "<a href=\"$url\">" . htmlentities($url) . '</a>';
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I do not fear computers. I fear the lack of them." - Isaac Asimov
attached mail follows:
$url = "<a href =\".$url."\">.HtmlEntities($url)."\">".</a>";
It appears the parse error is at the end of your opening link tag, so PHP
doesn't know what >.HtmlEntities($url) means. I'm at work so I can't test
it, but that appears the culprit to me.
$url = "<a href=\"$url\">" . HtmlEntities($url) . "</a>"; should suffice.
Martin Austin
Mário Gamito <lists
tuxdoit.com>
03/30/2005 07:51 AM
To: php-general
lists.php.net
cc:
Subject: [PHP] Parsing... the hell of PHP
Hi,
I'm trying to transform a url taken from the DB from "plain text", to
the same, but linkable url.
All i get is parse errors and alike.
Here is my last (of many) attempt:
$url = "<a href =\".$url."\">.HtmlEntities($url)."\">".</a>";
A warning and a parse error is what i get.
Can't get there :(
Any help would be apreciated.
Warm regards,
Mário Gamito
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hi,
Thank you all that answered my question.
It worked.
I think i'll never get used to this parsing PHP stuff :(
Warm Regards,
Mário Gamito
Martin.C.Austin
supervalu.com wrote:
> $url = "<a href =\".$url."\">.HtmlEntities($url)."\">".</a>";
>
> It appears the parse error is at the end of your opening link tag, so PHP
> doesn't know what >.HtmlEntities($url) means. I'm at work so I can't test
> it, but that appears the culprit to me.
>
> $url = "<a href=\"$url\">" . HtmlEntities($url) . "</a>"; should suffice.
>
> Martin Austin
>
>
>
>
>
> Mário Gamito <lists
tuxdoit.com>
> 03/30/2005 07:51 AM
>
> To: php-general
lists.php.net
> cc:
> Subject: [PHP] Parsing... the hell of PHP
>
>
> Hi,
>
> I'm trying to transform a url taken from the DB from "plain text", to
> the same, but linkable url.
>
> All i get is parse errors and alike.
>
> Here is my last (of many) attempt:
>
> $url = "<a href =\".$url."\">.HtmlEntities($url)."\">".</a>";
>
> A warning and a parse error is what i get.
> Can't get there :(
>
> Any help would be apreciated.
>
> Warm regards,
> Mário Gamito
>
attached mail follows:
Hi,
Thank you all that answered my question.
It worked.
I think i'll never get used to this parsing PHP stuff :(
Warm Regards,
Mário Gamito
Martin.C.Austin
supervalu.com wrote:
> $url = "<a href =\".$url."\">.HtmlEntities($url)."\">".</a>";
>
> It appears the parse error is at the end of your opening link tag, so
PHP doesn't know what >.HtmlEntities($url) means. I'm at work so I
can't test it, but that appears the culprit to me.
>
> $url = "<a href=\"$url\">" . HtmlEntities($url) . "</a>"; should suffice.
>
> Martin Austin
>
>
>
>
>
> Mário Gamito <lists
tuxdoit.com>
> 03/30/2005 07:51 AM
>
> To: php-general
lists.php.net
> cc: Subject: [PHP] Parsing... the hell of PHP
>
>
> Hi,
>
> I'm trying to transform a url taken from the DB from "plain text", to
the same, but linkable url.
>
> All i get is parse errors and alike.
>
> Here is my last (of many) attempt:
>
> $url = "<a href =\".$url."\">.HtmlEntities($url)."\">".</a>";
>
> A warning and a parse error is what i get.
> Can't get there :(
>
> Any help would be apreciated.
>
> Warm regards,
> Mário Gamito
>
attached mail follows:
Glad to have helped (though someone else beat me to the punch with the
right answer!)
You'll get the hang of it -- the way I learned is to write out your tag
that you'd like to use like this:
"<a href="$url">text here</a>"
Then go through and escape the characters that need it:
"<a href=\"$url\">text here</a>"
You can place variables into a string, but if you are using a function to
work on that variable, you must concatenate it.
"<a href=\"$url\">" . htmlentities($url) . "</a>"; (needs concatenation)
"<a href=\"$url\">$url</a>"; (no function used, no concatenation
necessary)
Good luck!
Martin Austin
Shared Services A/R
Ph 952.906.6653
Fax 952.906.6500
SUPERVALU
Tradition .:. Excellence .:. Future Promise
135 Years of Fresh Thinking ...
Mário Gamito <lists
tuxdoit.com>
03/30/2005 10:15 AM
To: php-general
lists.php.net
cc:
Subject: Re: [PHP] Parsing... the hell of PHP
Hi,
Thank you all that answered my question.
It worked.
I think i'll never get used to this parsing PHP stuff :(
Warm Regards,
Mário Gamito
Martin.C.Austin
supervalu.com wrote:
> $url = "<a href =\".$url."\">.HtmlEntities($url)."\">".</a>";
>
> It appears the parse error is at the end of your opening link tag, so
PHP doesn't know what >.HtmlEntities($url) means. I'm at work so I
can't test it, but that appears the culprit to me.
>
> $url = "<a href=\"$url\">" . HtmlEntities($url) . "</a>"; should
suffice.
>
> Martin Austin
>
>
>
>
>
> Mário Gamito <lists
tuxdoit.com>
> 03/30/2005 07:51 AM
>
> To: php-general
lists.php.net
> cc: Subject: [PHP] Parsing... the hell of PHP
>
>
> Hi,
>
> I'm trying to transform a url taken from the DB from "plain text", to
the same, but linkable url.
>
> All i get is parse errors and alike.
>
> Here is my last (of many) attempt:
>
> $url = "<a href =\".$url."\">.HtmlEntities($url)."\">".</a>";
>
> A warning and a parse error is what i get.
> Can't get there :(
>
> Any help would be apreciated.
>
> Warm regards,
> Mário Gamito
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
I have a button that sets a variable when pressed. I then try delete any
cookies using the following code but no joy.
if (isset($scrub)){
echo "this works";
if (isset($_COOKIE['cookie'])) {
foreach ($_COOKIE['cookie'] as $name => $quantity) {
setcookie($name, "");
}
}
}
Please help. Any suggestions welcome.
AD
attached mail follows:
setcookie("$name",'',time()-3600);
cheers
On Wed, 30 Mar 2005 15:29:47 +0100, AndreaD
<andrea.davidson
silene.co.uk> wrote:
> I have a button that sets a variable when pressed. I then try delete any
> cookies using the following code but no joy.
>
> if (isset($scrub)){
> echo "this works";
> if (isset($_COOKIE['cookie'])) {
> foreach ($_COOKIE['cookie'] as $name => $quantity) {
>
> setcookie($name, "");
> }
> }
> }
>
> Please help. Any suggestions welcome.
>
> AD
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
AndreaD wrote:
> I have a button that sets a variable when pressed. I then try delete any
> cookies using the following code but no joy.
>
> if (isset($scrub)){
> echo "this works";
> if (isset($_COOKIE['cookie'])) {
> foreach ($_COOKIE['cookie'] as $name => $quantity) {
>
> setcookie($name, "");
> }
> }
> }
>
Give your cookie an expire time in the past....
setcookie ( $name, "", time() - 3600 );
If you don't give it a time, it will be a 'session' cookie, and will
remain as long as you have your browser window(s) open.
http://us4.php.net/setcookie
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john
kegworks.com
attached mail follows:
Eli wrote:
> Hi,
>
> I want to validate an XML structure using PHP.
> I thought of using PHP's DOM and XSD or DTD for validation. This does
> the job ok, except on invalid XML structure I get the same error code.
There are schema validation techniques within the DOM extension... those
error messages aren't the greatest, but they're going to improve soon.
If this is a new project / area that you're venturing into (and it
sounds like that's the case) then just wait for the dev team to release
PHP 5.1 (I think this is slated to be fixed in 5.1 anyhow)
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
attached mail follows:
Daevid Vincent wrote:
> Yes! That's the point. We use PHPDoc tags in our project, but it's become so
> large that PHPDocumentor itself can't make the documentation anymore. Go
> figure.
large != high quality
supporting existing coding standards == "A Good Thing"
Is interested but doesn't have time to invest in Perl == Me :-/
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
attached mail follows:
Hi,
I got a problem with mail function. I want to know if it's possible to
send a email in php and to get back an acknowledgement of delivery. My
problem is that i want to know if my emails are delivered successfully
to recipients.
Can you please tell how to do this if there is a solution.
thank you in advance,
Marc.
attached mail follows:
Hello marc,
Wednesday, March 30, 2005, 8:31:48 AM, you wrote:
m> I got a problem with mail function. I want to know if it's possible
m> to send a email in php and to get back an acknowledgement of
m> delivery. My problem is that i want to know if my emails are
m> delivered successfully to recipients.
About the only way to do that is to add a Return-Path header to the
e-mail so if it bounces the Return-Path address gets the bounce
message.
There is no way to do it more or less real-time because some SMTP
servers will try to send the message to the recipient for sometimes
five days before generating a bounce.
--
Leif (TB lists moderator and fellow end user).
Using The Bat! 3.0.9.9 Return (pre-beta) under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB
attached mail follows:
The mail() function allows you to specify additional headers that go into the
mail. Delivery acknowledgement is done using specific headers, the exact
format of which I don't know off hand. You will have to find the exact
formatting information yourself, however this is the way to go.
Markus
On Wednesday 30 March 2005 17:31, marc serra wrote:
> Hi,
>
> I got a problem with mail function. I want to know if it's possible to
> send a email in php and to get back an acknowledgement of delivery. My
> problem is that i want to know if my emails are delivered successfully
> to recipients.
>
> Can you please tell how to do this if there is a solution.
>
> thank you in advance,
>
> Marc.
attached mail follows:
This is just an idea I'm (quite unsuccessfully) been working on.
It appears to me that PHP sits between a database and a web browser.
On the database side, something I would love to have is embedded SQL, as it
exists in some other languages such as C (for example, see:
http://www.csee.umbc.edu/help/oracle8/server.815/a68022/sql.htm)
At least, what the minimum I would like is to have the very same variable
types all the way from the database end to the browser end.
Anyway, Embedded SQL is to much to ask. What I was working on, though I got
nowhere due to my lack of experience with Yacc and Lex is to have HTML or
XML directly as part of the language (I will just say XML from now on, to
indicate both HTML and XML) .
You see, both PHP and XML are block structured. Nevertheless, when we
program PHP, we only see one set of blocks, those enclosed by curly
braces{}. Most IDEs even check those for pairing, and we have Code
Beautifiers to indent them properly. The other set of blocks, those
enclosed by XML tags are invisible to the program, though keeping track of
those blocks is just as important.
Moreover, logic indicates that one set of blocks is compatible with the
other. That is, if you are generating an XML block within an if (condition)
block, the XML block has to be closed, you can't just open it and leave it
open. When the if() block closes, the XML block has to as well. Can you
point any case when this might not be so? Don't bother, I can give you
examples myself, but good programming practice can straigten that code out
nicely.
So, this is what I thought. I probably re-invented the wheel and if anybody
can point me to the source, I'll be just as happy.
I would like to see a couple of additions to PHP, which could very well be
implemented as a pre-compiler, in
the form of two new instructions, TAG and ATT which could also be
abbreviated to < and
.
The following piece of code show how to use them:
<p {
align 'center';
echo 'este es el texto del párrafo';
}
Which would produce, after precompiled:
echo '<p align="center">este es el texto del párrafo</p>';
Just in case you wonder, yes, the text is in Spanish and it is alread
optimized in the sense that all the literal string segments that could be
strung together has been put in just one string in just a single call to
echo.
So, the TAG or < instruction would be followed by a valid tag name and then
a statement. The statement, as usual, can be replaced by a statement block,
enclosed in curly braces. I don't see any need for the tag name to be
enclosed in any kind of quotes. A variable instead of a literal tag name
should also be valid. Thus:
$p = 'p';
<$p { etc. }
would do the same. This syntax would prevent functions as a source of tag
names, which would be a very rare case and taking it under consideration
would really make the whole thing too cumbersome.
The ATT (attribute) or
instruction is to be followed by a valid attribute
name and an expression providing the value. The attribute name can be the
value of a variable, so that
$attribute = 'align';
$attribute 'center';
Once again functions cannot be used.
Why all these?
Basically, I don't want to keep track manually of how my XML blocks are
build.
Even a Code Beautifier would be able to handle the proper nesting of XML
(with these instructions) along PHP. The code would simply look good, and
that means it would be easy to get it right. Actually, while re-writing the
example code below, the brace matching in my IDE caught a missing curly
brace in one <input instruction.
I would also add a declarative statement to handle XML validation. The
declaration would have a reference to a DTD or Schema that describes the XML
to be generated. Optionally, the declaration would also give an xpath
string which would indicate what part of the schema is being validated. This
would allow the declaration to be used in functions or classes where only
fragments of the full schema are being generated.
And, by the by, I wouldn't mind the precompiler to take ? as a synonym for
echo.
Please notice that I am not trying to solve any specific programming
problem, and yes, I could use templates (actually I do) and I could do a
library of functions to echo XML without my actually having to assemble the
XML strings. It doesn't matter how many layers you put in between your
application and your XML strings, in the end, at some point, you have to
echo some XML. It is not a problem I am trying to solve, it is a feature I
would like to see.
Just an example of a more substantial piece of code:
<table {
<tr {
<th {
rowspan 2;
valign "top";
// Here I am using the ? instead of echo
? 'Dirección';
}
<td {
<input {
name 'Direccion1';
size 50;
value $row['Direccion1'];
}
}
}
// notice the use of curly braces is just as optional
// as anywhere else in PGP
// This might be not propper coding practice, but it's up to the coder.
<tr <td <input {
name 'Direccion2';
size 50;
value $row['Direccion2'];
}
<tr {
// Same thing here. There is no need to put curly braces in the TH
and TD tags
// but it is in the previous TR and the following INPUT
<th 'Código Postal';
<td <input {
name 'CodPos';
value $row['CodPos'];
}
}
}
So, this is what I had in mind and, though I tried to get somewhere with
Bison and Flex, the results have not been good, it is way over my abilities.
Thus, I though that someone is sure to know way more than I do and might be
interested.
Cheers
Satyam
attached mail follows:
Hi!
I wish to format the output of a database select.
The result is presented in a table, in which i'd like to present everey
secound row with a different background color.
My idea was to test if the remaining number of rows where a prime number or
not, and by that determent if the background color should be white or som
ivory-like color to improve the readability in the result table...
Hope to hear from anyone with experience in similar matters...
TIA! Georg Herland, Norway
attached mail follows:
Georg wrote:
> Hi!
>
> I wish to format the output of a database select.
> The result is presented in a table, in which i'd like to present everey
> secound row with a different background color.
> My idea was to test if the remaining number of rows where a prime number or
modulo 2 .... is the current row 'number' divisible by 2 with no remainder?
(i.e. is it an odd row or an even row)
hint code:
$i = 1;
// assume $rows is your DB resultset
foreach($rows as $row) {
$bgcolor = ($i % 2) ? '#fff': '#f00';
$i++;
$yourColumns = '';
foreach ($row as $field) {
$yourColumns =. "<td>$field</td>";
}
echo '<tr style="'.$bgcolor.'">',$yourColumns,'<tr>';
}
I really think that prime numbers are not what your looking for....
but maybe you have very specific formatting requirements?!!??
> not, and by that determent if the background color should be white or som
> ivory-like color to improve the readability in the result table...
>
> Hope to hear from anyone with experience in similar matters...
btw there are quite a few javascript libs that do auto coloring of HTML tables
in the way you describe - they are pretty much drag'n'drop scripts - I'll
leave finding them up to you ;-)
>
> TIA! Georg Herland, Norway
>
attached mail follows:
Maintain a counter as you display the returned results.
Mod the counter by 2 (rowcounter % 2), set colour according to presence /
absence of a remainder.
Miles
At 11:05 AM 3/30/2005, Georg wrote:
>Hi!
>
>I wish to format the output of a database select.
>The result is presented in a table, in which i'd like to present everey
>secound row with a different background color.
>My idea was to test if the remaining number of rows where a prime number or
>not, and by that determent if the background color should be white or som
>ivory-like color to improve the readability in the result table...
>
>Hope to hear from anyone with experience in similar matters...
>
>TIA! Georg Herland, Norway
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Or you could simply test the $color variable to see its contents, and
change it if it's what you expected:
$color = "#FFFFFF";
if($color = "#FFFFFF") {
$color = "#000000";
//output
} else {
$color = "#FFFFFF";
}
There may be something inherently wrong in this approach, but it has
always worked for me. :o)
Martin Austin
Miles Thompson <miles
allnovascotia.com>
03/30/2005 10:18 AM
To: php-general
lists.php.net
cc:
Subject: Re: [PHP] How to format every secound row in a
database result
Maintain a counter as you display the returned results.
Mod the counter by 2 (rowcounter % 2), set colour according to presence /
absence of a remainder.
Miles
At 11:05 AM 3/30/2005, Georg wrote:
>Hi!
>
>I wish to format the output of a database select.
>The result is presented in a table, in which i'd like to present everey
>secound row with a different background color.
>My idea was to test if the remaining number of rows where a prime number
or
>not, and by that determent if the background color should be white or som
>ivory-like color to improve the readability in the result table...
>
>Hope to hear from anyone with experience in similar matters...
>
>TIA! Georg Herland, Norway
>
>--
>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
attached mail follows:
Date: Wed, 30 Mar 2005 10:54:15 -0700
From: Leif Gregory <Leifg
doh.state.nm.us>
Reply-To: Leif Gregory <Leifg
doh.state.nm.us>
Message-ID: <523789655.20050330105415
doh.state.nm.us>
To: Georg <php-general
lists.php.net>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=us-ascii
Subject: Re: [PHP] How to format every secound row in a database result
Hello Georg,
Wednesday, March 30, 2005, 8:05:30 AM, you wrote:
G> I wish to format the output of a database select. The result is
G> presented in a table, in which i'd like to present everey secound
G> row with a different background color. My idea was to test if the
G> remaining number of rows where a prime number or not, and by that
G> determent if the background color should be white or som ivory-like
G> color to improve the readability in the result table...
http://www.devtek.org/tutorials/alternate_row_colors.php
--
Leif (TB lists moderator and fellow end user).
Using The Bat! 3.0.9.9 Return (pre-beta) under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB
attached mail follows:
Hello Leif,
Wednesday, March 30, 2005, 6:54:15 PM, you wrote:
LG> http://www.devtek.org/tutorials/alternate_row_colors.php
There is no need to involve a math heavy modulus function just to
alternate row colours! The following single line will do it just as
well, swap the colours for whatever you need and echo them where
required:
$bgcolor = ($bgcolor === '#daf2ff' ? '#c9e1ef' : '#daf2ff');
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I do not fear computers. I fear the lack of them." - Isaac Asimov
attached mail follows:
Ave,
Does anybody know of a working PHP script to convert DBF data into mySQL
table?
Thanks,
Rahul S. Johari
Coordinator, Internet & Administration
Informed Marketing Services Inc.
251 River Street
Troy, NY 12180
Tel: (518) 266-0909 x154
Fax: (518) 266-0909
Email: rahul
informed-sources.com
http://www.informed-sources.com
attached mail follows:
Date: Wed, 30 Mar 2005 19:05:57 +0200
Message-ID: <4212FD67000915AA
mail-1.tiscali.it>
From: aldo.mailinglistphp
tiscali.it
To: php-general
lists.php.net
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Subject: Parsing bounced emails
I need to parse bounced email I receive when I send a newsletter, to know=
the bounced address, the error code and the Id of the newsletter I sent.
The bounced emails return to "bounce
myserver.com" address, so I can eith=
er
read them with imap functions or sending to a php script by a pipe. What
is better? IMAP or pipe?
Now, the most important question: once I read the message, how can I pars=
e
it and read the bounced email address and the error code? Has anyone wor=
ked
on these questions? Is there anything (classes, scripts, functions, whate=
ver
you want) I can use?
Or is it such a strange problem?
Thanks
Aldo
__________________________________________________________________
Tiscali Adsl 3 Mega Flat con 3 MESI GRATIS!
Con Tiscali Adsl 3 Mega Flat navighi con la Supervelocita'
a soli 29.95 euro al mese, senza limiti di tempo. E se attivi
entro il 31 Marzo, 3 MESI sono GRATIS!
Scopri come su http://abbonati.tiscali.it/adsl/sa/2flat_tc/
- application/pgp-signature attachment: OpenPGP digital signature
- application/pgp-signature attachment: OpenPGP digital signature
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]