Re: [PHP] Enabling MySQL support Problemmmmm!!!!
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ISO encoding of subject in mail?
-Original Message- From: Kim Madsen [mailto:[EMAIL PROTECTED] 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: filtering uploaded files
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] URL restriction on XML file
That's because the character data is split on the borders of the entities, so for http://feeds.example.com/?rid=318045f7e13e0b66amp;cat=48cba686fe041718amp;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 'amp;' characters. My XML file looks like this: --- start of XML --- ?xml version=1.0 encoding=iso-8859-1? rss version=2.0 channel titleTest News .Net - Newspapers on the Net/title copyrightSmall News Network.com/copyright linkhttp://www.example.com//link descriptionContinuously updating Example News./description languageen-us/language pubDateTue, 29 Mar 2005 18:01:01 -0600/pubDate lastBuildDateTue, 29 Mar 2005 18:01:01 -0600/lastBuildDate ttl30/ttl item titleGroup buys SunGard for US$10.4bil/title linkhttp://feeds.example.com/?rid=318045f7e13e0b66amp;cat=48cba686fe041718amp;f=1/link descriptionNEW 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 titleStrong quake hits Indonesia coast/title linkhttp://feeds.example.com/news/world/quake.html/link descriptiona quot;widely destructive tsunamiquot; and the quake was felt as far away as Malaysia./description source url=http://biz.theexample.com.net/;The Paper/source /item item titleFinal News/title linkhttp://feeds.example.com/?id=abcdefamp;cat=somecat/link descriptionWe 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/ABR; 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 amp; 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/ --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HELP!
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
[PHP] HELP!
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
[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
RE: [PHP] Generate random number
-Original Message- From: William Stokes [mailto:[EMAIL PROTECTED] 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Generate random number
never mind... :-) William Stokes [EMAIL PROTECTED] kirjoitti viestissä:[EMAIL PROTECTED] 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
RE: [PHP] HELP!
-Original Message- From: [mailto:[EMAIL PROTECTED] 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 its 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
RE: [PHP] Generate random number
For example : $number = mt_rand(1,100); -Message d'origine- De : William Stokes [mailto:[EMAIL PROTECTED] 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How can I parse a xml file like this?
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/;Version1.5.0/VersionMsgTypeSyncOrderRelationReq/MsgTypeSend_AddressDeviceType0/DeviceTypeDeviceID0011/DeviceID/Send_AddressDest_AddressDeviceType400/DeviceTypeDeviceID0/DeviceID/Dest_AddressFeeUser_IDUserIDType2/UserIDTypeMSISDN/MSISDNPseudoCode00110046548986/PseudoCode/FeeUser_IDDestUser_IDUserIDType2/UserIDTypeMSISDN/MSISDNPseudoCode00110046548986/PseudoCode/DestUser_IDLinkIDSP/LinkIDActionID1/ActionIDActionReasonID1/ActionReasonIDSPID819592/SPIDSPServiceID03010537/SPServiceIDAccessMode2/AccessModeFeatureStrIA==/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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Error Generated but no error?
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error Generated but no error?
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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can I parse a xml file like this?
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/;Version1.5.0/VersionMsgTypeSyncOrderRelationReq/MsgTypeSend_AddressDeviceType0/DeviceTypeDeviceID0011/DeviceID/Send_AddressDest_AddressDeviceType400/DeviceTypeDeviceID0/DeviceID/Dest_AddressFeeUser_IDUserIDType2/UserIDTypeMSISDN/MSISDNPseudoCode00110046548986/PseudoCode/FeeUser_IDDestUser_IDUserIDType2/UserIDTypeMSISDN/MSISDNPseudoCode00110046548986/PseudoCode/DestUser_IDLinkIDSP/LinkIDActionID1/ActionIDActionReasonID1/ActionReasonIDSPID819592/SPIDSPServiceID03010537/SPServiceIDAccessMode2/AccessModeFeatureStrIA==/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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: Best Server OS
On Tue, 29 Mar 2005 11:10:18 -0500, Gerald Artman [EMAIL PROTECTED] 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to insert and select images from postgres db
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] asking comment
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
Re: [PHP] asking comment
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] asking comment
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] asking comment
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5 Strings are References?!
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); } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[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
Re: [PHP] Parsing... the hell of PHP
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing... the hell of PHP
$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 [EMAIL PROTECTED] 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
Re: [PHP] RE: Best Server OS
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/1243207from=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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] deleting all my cookies
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
Re: [PHP] deleting all my cookies
setcookie($name,'',time()-3600); cheers On Wed, 30 Mar 2005 15:29:47 +0100, AndreaD [EMAIL PROTECTED] 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] deleting all my cookies
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 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Validating XML structure with PHP
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-generalw=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=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
Re: [PHP] PHPXref is awesome!
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-generalw=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=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
RE: [PHP] asking comment
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] asking comment
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mail with acknowledgement of delivery
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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XML/HTML specific instructions
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=centereste 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 ? 'Direccioacute;n'; } td { input { @name 'Direccion1'; @size 50; @value $row['Direccion1']; } } } // notice
[PHP] How to format every secound row in a database result
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
Re: [PHP] Mail with acknowledgement of delivery
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] asking comment
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail with acknowledgement of delivery
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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] DBF to MySQL using PHP Script
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: [EMAIL PROTECTED] http://www.informed-sources.com
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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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
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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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
Re: [PHP] How to format every secound row in a database result
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
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
Re: [PHP] Parsing... the hell of PHP
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=$urltext 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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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
Re: [PHP] How to format every secound row in a database result
Or you could simply test the $color variable to see its contents, and change it if it's what you expected: $color = #FF; if($color = #FF) { $color = #00; //output } else { $color = #FF; } There may be something inherently wrong in this approach, but it has always worked for me. :o) Martin Austin Miles Thompson [EMAIL PROTECTED] 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
Re[2]: [PHP] asking comment
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 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 [EMAIL PROTECTED] address, so I can either 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 parse it and read the bounced email address and the error code? Has anyone worked on these questions? Is there anything (classes, scripts, functions, whatever 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/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: Re[2]: [PHP] asking comment
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[4]: [PHP] asking comment
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: Re[4]: [PHP] asking comment
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] How to format every secound row in a database result
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[6]: [PHP] asking comment
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: Re[6]: [PHP] asking comment
How about a filename based upon a user id and the time the file was uploaded. Unless you have multiple instances of the same user then it will not be possible for the same user to upload a file at exactly the same time as himself. Just a thought... Mikey -Original Message- From: Richard Davey [mailto:[EMAIL PROTECTED] Sent: 30 March 2005 19:19 To: php-general@lists.php.net Subject: Re[6]: [PHP] asking comment 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 -- 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
RE: Re[6]: [PHP] asking comment
I agree with this solution, though it only effects the OP if he is using a login system of sorts. Martin Austin Mikey [EMAIL PROTECTED] 03/30/2005 12:39 PM Please respond to frak To: php-general@lists.php.net cc: Subject:RE: Re[6]: [PHP] asking comment How about a filename based upon a user id and the time the file was uploaded. Unless you have multiple instances of the same user then it will not be possible for the same user to upload a file at exactly the same time as himself. Just a thought... Mikey -Original Message- From: Richard Davey [mailto:[EMAIL PROTECTED] Sent: 30 March 2005 19:19 To: php-general@lists.php.net Subject: Re[6]: [PHP] asking comment 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 -- 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
RE: Re[6]: [PHP] asking comment
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. Oh and generating random filenames from md5(), crossing your fingers and hoping you've got a unique filename is better? Or assume that files don't already exist in the directory? You are going against convential wisdom about ensuring unique filenames. Jared -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to format every secound row in a database result
On Mar 30, 2005, at 12:08 PM, Richard Davey wrote: 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 It does not involve heavy math to color every other line. I use this line when looping and determining if the background should be colored or not: ?php if (($i % 2) == 0) echo ' style=background: #A8B1E9;'; ? Obviously, the first part is the important part. Good luck! ~Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to format every secound row in a database result
I've used the mod (%) function to do this, which also gives you the flexibility of defining how many lines to alternate the colors or do whatever you need to do every X lines. Another method (and forgive me if this was mentioned, I didn't see it yet) is to use a bitwise NOT to flip-flop a value. I think I did something like this before: $bgcolors[0] = #FF; $bgcolors[1] = #00; $a = 0; echo 'table\n'; for ($i = 0; $i = 100; $i++) { $a = ~$a echo 'trtd bgcolor=' . $bgcolors[$a] . 'Some text/td/tr\n'; } echo '/table\n'; Maybe it was 0 and -1 instead of 0 and 1.. I forget. But you get the idea. The $a = ~$a flips the value of $a back and forth. You only have two options but that maybe all you need. And hey.. I've been known to do some goofy things so if there's some major drawback to this in processing time or if I'm just stupid in some way, that's cool.. feel free to speak up. But it does present another way to do what was requested and the theory might help someone at least :) -TG = = = Original message = = = On Mar 30, 2005, at 12:08 PM, Richard Davey wrote: 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 It does not involve heavy math to color every other line. I use this line when looping and determining if the background should be colored or not: ?php if (($i % 2) == 0) echo ' style=background: #A8B1E9;'; ? Obviously, the first part is the important part. Good luck! ~Philip ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sourcelabs releases AMP Stack and Test Data
SourceLabs released its AMP Stack and associated test data this morning. Please forgive the (debatable) spam in advance; this post does contain pointers to useful test information for capacity planners who are building out AMP infrastructure for demanding deployments and others who are working with PHP. Consisting of pre-configured versions of Apache, MySQL and PHP, the SourceLabs AMP Stack provides documented test results to give customers a higher level of confidence in the reliability, scalability and security of AMP than has been available to date. The stack is available free of charge from our website at www.sourcelabs.com/AMPstack.htm. This initial release of the stack has been tested per three of the Seven CERT7 dependability criteria: unit testing, security hardening and scalability. CERT7 augments the testing approaches that are typical of open source projects by adding tests that focus on the performance, stability and scale characteristics of integrated systems. Not only is this the first time that an integrated open source stack has been tested this way, this is the first time the results of the tests and the tests themselves (provided through GPL) have been made publicly available. While many enterprise software vendors do this kind of testing, they don't open the process for customer review. We think that open testing is a big part of the future of open source, and we're looking forward to the community taking our testing harness and adapting it to their needs. Some highlights of our findings from the test process: . We performed a 72 hour burn-in acceptance test utilizing a subset of the CERT7 scalability tests, resulting in 70-100% CPU utilization on a 2 CPU Hyper-threaded machine, confirming the absence of detectable memory leaks for these scenarios. . Over 7,000 individual security checks were performed, showing that a number of potential security vulnerabilities exist in default configurations of components of the AMP stack. We configured the AMP Stack to protect against these vulnerabilities. CERT7 Scalability tests were performed in three areas: Static HTML, Computational PHP and Database scalability, resulting in scale-out and configuration recommendations for AMP deployments. Key findings include: . Apache Web Server scalability was limited by bandwidth in all cases tested, and not CPU or memory capacity. . PHP processing scaled linearly with respect to CPU capacity. For capacity planning purposes, this means that the desired number of servers running Apache Web Server/PHP for a given application can be calculated based on the processing speed of an individual user scenario. For this, an understanding of the processing speed, the number of concurrent users, and the desired user experience/response time would be used. . MySQL scalability was limited by memory. For capacity planning purposes, MySQL implementations should be optimized for the greatest available memory rather than adding CPU capacity. Complete Test results are at http://www.sourcelabs.com/SourceLabsApacheMySQLPHPTestResults.pdf To promote the new stack we are also announcing a maven contest in our forums. Users that download our AMP stack and provide feedback, make clever puns, ask or answer questions in our forum qualify for the grand prize: A 100 Watt Marshall Guitar Amplifier and a Fender Stratocaster Electric Guitar. Just like the SourceLabs AMP stack, this is the kit that will let you go to 11. Each Friday afternoon for eleven weeks we will be giving away a weekly prize consisting of an Ipod Shuffle and a DVD copy of This is Spinal Tap, culminating in the announcement of our grand prize winner on June 10, 2005. Complete rules will be found at www.sourcelabs.com/mavencontest.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sourcelabs releases AMP Stack and Test Data
[snip] Please forgive the (debatable) spam in advance; [/snip] Not debatable at all. An unrequested solicitation such as this is, on a list such as this, regarded as spam. I am sure that several would like to see something like [ANNOUNCEMENT] in the subject line...at least that way everyone knows that there is no request for help and can choose to skip over it should they desire. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sourcelabs releases AMP Stack and Test Data
Cornelius Willis wrote: snip SPAM So, what is the PHP question? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include file
This way is faster: include('..includes/' . $include); Its always better to avoid using doublequotes. meatbread. On Tue, 29 Mar 2005 20:55:17 -0500, James Pancoast [EMAIL PROTECTED] wrote: Try it with double quotes instead: include( ../includes/$include ); That way works for me. And I also hope you're cleansing or filtering $include in some way. On Tue, 29 Mar 2005 19:41:15 -0600, Marquez Design [EMAIL PROTECTED] wrote: Does anyone know how to include a variable page? The variable is a page name. Such as inluded_file.html Include ('../includes/$include'); Does not seem to work. Thanks! -- Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Include file
[snip] This way is faster: include('..includes/' . $include); Its always better to avoid using doublequotes. [/snip] Why is it faster? And why should you avoid using double quotes? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include file
Why is it faster? And why should you avoid using double quotes? ...Scripts using single quotes run slightly faster because the PHP parser can include the string directly. Double quoted strings are slower because they need to be parsed Quoted from: http://www.zend.com/zend/tut/using-strings.php?article=using-stringskind=tid=1399open=1anc=0view=1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Include file
[snip] Personally, I go almost exclusively with double quotes, so I'm interested to see how your include is faster. include('..includes/' . $include); Jay Blanchard [EMAIL PROTECTED] 03/30/2005 02:58 PM To:xfedex [EMAIL PROTECTED], php-general@lists.php.net cc: Subject:RE: [PHP] Include file [snip] This way is faster: include('..includes/' . $include); Its always better to avoid using doublequotes. [/snip] Why is it faster? And why should you avoid using double quotes? [/snip] 1. Always reply to the list ('reply-all') B. It's hard to read in context. Why? Top-posting is bad. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Include file
[snip] Why is it faster? And why should you avoid using double quotes? ...Scripts using single quotes run slightly faster because the PHP parser can include the string directly. Double quoted strings are slower because they need to be parsed Quoted from: http://www.zend.com/zend/tut/using-strings.php?article=using-stringskin d=tid=1399open=1anc=0view=1 [/snip] I try to use both types of quotes in the proper circumstance. Having said that, I came to computing in the age where we worried over CPU cycles, but I don't see how in this day and age the difference between the two would even matter. Even on a high load site the difference between the two would be negligible. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include file
Jay Blanchard wrote: snip I try to use both types of quotes in the proper circumstance. Having said that, I came to computing in the age where we worried over CPU cycles, but I don't see how in this day and age the difference between the two would even matter. Even on a high load site the difference between the two would be negligible. Let's see if you still say that after you run your php scripts on my Atari 800XL. ;) -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include file
On Wed, 30 Mar 2005 15:14:27 -0600, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] Why is it faster? And why should you avoid using double quotes? ...Scripts using single quotes run slightly faster because the PHP parser can include the string directly. Double quoted strings are slower because they need to be parsed Quoted from: http://www.zend.com/zend/tut/using-strings.php?article=using-stringskin d=tid=1399open=1anc=0view=1 [/snip] I try to use both types of quotes in the proper circumstance. Having said that, I came to computing in the age where we worried over CPU cycles, but I don't see how in this day and age the difference between the two would even matter. Even on a high load site the difference between the two would be negligible. Welli have a 30k script, with double i get 8 or 9 seconds, with sigle i get 0.05 or 0.08 seconds. The script basically made a lot of querys, its part of a user manager module of a system im writing. Remember, the hole world is not US or EUi live in argentina and my web server is a PIII 550Mhz 128mb and if you count that almost the half of the people got a 56k dialup connectionI think that in some cases it does make difference. sorry my englishtoo taired to worry meatbread. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[suspicious - maybe spam] [PHP] [suspicious - maybe spam] Re: [PHP] Include file
Jay Blanchard wrote: I try to use both types of quotes in the proper circumstance. Having said that, I came to computing in the age where we worried over CPU cycles, but I don't see how in this day and age the difference between the two would even matter. Even on a high load site the difference between the two would be negligible. This has been talked about on this list so many times. Another way to put it would be: ...because in most real-world scripts, the execution time for this kind of operation (the string parsing) is negligible compared to the script's total execution time. So even if you could reduce the time it took to parse strings to nothing, you wouldn't speed up the total execution time very much. If you want to optimize the performance of your scripts, there are probably a lot of other things that should be much higher on your priority list than substituting double quotes with single quotes. /Mattias Thorslund -- More views at http://www.thorslund.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Include file
Hello Jay, Wednesday, March 30, 2005, 10:14:27 PM, you wrote: JB I try to use both types of quotes in the proper circumstance. JB Having said that, I came to computing in the age where we worried JB over CPU cycles, but I don't see how in this day and age the JB difference between the two would even matter. Even on a high load JB site the difference between the two would be negligible. I agree it's going to be negligible, but even so the difference does exist. The real question is which is faster between: include path/$file and include 'path/' . $file Can the compiler handle the in-line variables quicker than string concatenation? It'll take a C guru who knows the PHP code well to answer this fully. 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include file
Because I'm bored, I decided to test the theory. AMD 3200xp 1.5gb Memory RHEL AS 3 I ran the test 20 times, and 18 of those times, double quotes were faster than single quotes. Don't always trust what you read. Not to mention the fact that the 'faster' of the two was 'faster' by an average of less than .003 seconds to include 1000 files. ?php function microtime_float() { list ( $usec, $sec ) = explode ( , microtime() ); return ( ( float ) $usec + ( float ) $sec ); } for ( $i = 0; $i 1000; $i++ ) { $fp = fopen ( file_ . $i . .php, w ); fwrite ( $fp, ?php\n\n\n? ); fclose ( $fp ); } $single_start = microtime_float(); for ( $i = 0; $i 1000; $i++ ) { include ( 'file_' . $i . '.php' ); } $single_end = microtime_float(); $double_start = microtime_float(); for ( $i = 0; $i 1000; $i++ ) { include ( file_ . $i . .php ); } $double_end = microtime_float(); $single = $single_end - $single_start; $double = $double_end - $double_start; echo ( Single Quotes : . $single . seconds.br /\n ); echo ( Double Quotes : . $double . seconds.br /br /\n ); if ( $double $single ) { $time = $double - $single; echo ( Single Quotes are . $time . seconds faster than double quotes. ); } else { $time = $single - $double; echo ( Double Quotes are . $time . seconds faster than single quotes. ); } ? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include file
xfedex wrote: Welli have a 30k script, with double i get 8 or 9 seconds, with sigle i get 0.05 or 0.08 seconds. The script basically made a lot of querys, its part of a user manager module of a system im writing. Could the speed have more to do with whatever database server you are using, than with PHP? I assume database since you are querying something. Just curious. And Jay: I'm using Lotus Notes R6, not much I can do about top quoting. Martin Austin xfedex [EMAIL PROTECTED] 03/30/2005 06:27 PM Please respond to xfedex To: php-general@lists.php.net cc: Subject:Re: [PHP] Include file On Wed, 30 Mar 2005 15:14:27 -0600, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] Why is it faster? And why should you avoid using double quotes? ...Scripts using single quotes run slightly faster because the PHP parser can include the string directly. Double quoted strings are slower because they need to be parsed Quoted from: http://www.zend.com/zend/tut/using-strings.php?article=using-stringskin d=tid=1399open=1anc=0view=1 [/snip] I try to use both types of quotes in the proper circumstance. Having said that, I came to computing in the age where we worried over CPU cycles, but I don't see how in this day and age the difference between the two would even matter. Even on a high load site the difference between the two would be negligible. Welli have a 30k script, with double i get 8 or 9 seconds, with sigle i get 0.05 or 0.08 seconds. The script basically made a lot of querys, its part of a user manager module of a system im writing. Remember, the hole world is not US or EUi live in argentina and my web server is a PIII 550Mhz 128mb and if you count that almost the half of the people got a 56k dialup connectionI think that in some cases it does make difference. sorry my englishtoo taired to worry meatbread. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] an app to generate 'yahoo groups' features/functionality..
hi.. after a lot of fruitless searching via google, i've decided to ask here... does anyone know of an app that will allow a site to provide functionality similar to 'yahoo groups' to the users. i want to be able to allow users to be able to create their own 'groups' and to be able to have the user allow other users/members to join the group. i also want to be able to have the user be able to admin the group, with the ability to manage members/handle message posting/(up/download) pics/etc... i asumed that there would be a number of these kinds of apps, i haven't found any yet. i have found plenty of bbs/forum types of apps that try to pass themselves off as being in the 'yahoo group' area. i've also seen the drupal based civic app... thanks for any help/pointers/etc, bruce [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include file
On Wed, 30 Mar 2005 16:45:32 -0500, John Nichel [EMAIL PROTECTED] wrote: Because I'm bored, I decided to test the theory. AMD 3200xp 1.5gb Memory RHEL AS 3 I ran the test 20 times, and 18 of those times, double quotes were faster than single quotes. Don't always trust what you read. Not to mention the fact that the 'faster' of the two was 'faster' by an average of less than .003 seconds to include 1000 files. ?php function microtime_float() { list ( $usec, $sec ) = explode ( , microtime() ); return ( ( float ) $usec + ( float ) $sec ); } for ( $i = 0; $i 1000; $i++ ) { $fp = fopen ( file_ . $i . .php, w ); fwrite ( $fp, ?php\n\n\n? ); fclose ( $fp ); } $single_start = microtime_float(); for ( $i = 0; $i 1000; $i++ ) { include ( 'file_' . $i . '.php' ); } $single_end = microtime_float(); $double_start = microtime_float(); for ( $i = 0; $i 1000; $i++ ) { include ( file_ . $i . .php ); } $double_end = microtime_float(); $single = $single_end - $single_start; $double = $double_end - $double_start; echo ( Single Quotes : . $single . seconds.br /\n ); echo ( Double Quotes : . $double . seconds.br /br /\n ); if ( $double $single ) { $time = $double - $single; echo ( Single Quotes are . $time . seconds faster than double quotes. ); } else { $time = $single - $double; echo ( Double Quotes are . $time . seconds faster than single quotes. ); } ? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Here is my test in a PIII 550Mhz 128mb with gentoo: for ($i = 0; $i = ; $i++) { $include = 'db_connect.php'; include('include/'.$include); } 3.623316 seconds -- for ($i = 0; $i = ; $i++) { $include = db_connect.php; include(include/$include); } 3.696468 seconds meatbread. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] strncmp function (Forgot code snippit)
Chris W. Parker wrote: Russ mailto:[EMAIL PROTECTED] on Wednesday, March 30, 2005 1:18 PM said: I'm new to php and linux. I am trying to replace a password program I used under windows with a mysql based login. I want to compare the first character of the first and last name of the user for a capital letter. Why? What does that accomplish? ?php $fname=John; $lname=Smith; Where's the quotes? if(strncmp(S,${lname},1) ===0) { ? h1strncmp() must have returned returned non-false/h1 non-false = true ?php } else { h3Strncmp() must have returned false/h3 ?php } ? Rewrite: ?php $fname = John; $lname = Smith; if(preg_match(/[A-Z]/, substr($fname ,0 ,1))) { echo first letter is uppercase.; } else { echo first letter is not uppercase; } ? There might be a better way than a regex but that's the first thing that came to my mind. HTH, Chris. Thanks Chris, I'll try that. I'm not really a programmer, done a little and trying to learn as I go. I had quotes at one point but took them out tring to get it to work. -- Russ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Simple CMS program
When I went to a site that lists and compares CMS programs, I was overwhelmed by at least 100 listings. Again, I would like to rely on personal experience. What I am seeking is a CMS that will provide users at my client (a Yacht Club) to update news items, and if possible, update a calendar using a Web based editor. Not a full fledged portal CMS. Whatever you do, do not use PHP-Nuke or PostNuke. They are popular and they seem good at the beginning, but you will regret using them after a while. (Their internal design is not thought-through.) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to insert and select images from postgres db
Hi Kim, Thanks for your reply, I have'nt recived any other other help or suggestion from anyone other then you. Any how I have made it work it is working fine. Thanks again for your acknowledgement. Have a great day.! Regards, - JFK kishor Nilgiri Networks Hi, I´ve never worked with postgres, but 2 things I can tell You. 1. look at php.net, search for postgres 2. If You expect quick help, You better copy some of the code into Your mails, otherwise You will receive no or poor help since the question is HUGE Sincerely Kim Madsen Systemdeveloper -Original Message- From: J.F.Kishor [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 30, 2005 1:41 PM To: php-general@lists.php.net Subject: [PHP] How to insert and select images from postgres db 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 -- 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
Re: [PHP] Parsing... the hell of PHP
[EMAIL PROTECTED] 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. Please don't make a habit of changing the case of built-in PHP functions. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML/HTML specific instructions
Satyam wrote: 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) . http://www.php.net/sqlite 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. I don't agree with you here at all. Why should PHP (which is not a XML parsing/validating engine) give two hoots about how you are generating content? 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=centereste es el texto del párrafo/p'; Here you are building a templating engine into PHP, which IMHO is not a very good idea. Why? Many reasons. You'd have to compensate for other forms of markup, such as XML, XHTML, the different XML standards floating out there (like Docbook). Others might say what about CSS? I can go on and on here. 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. This is not the job of the programming language either. PHP is not a XML validating/generating engine. Its your job (as the developer) to make sure what your program creates is valid. 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. There are already technologies that beautify XML (namely xsl); and programs that will do this for you. Again, this should not be in the core of PHP since part of the attraction and popularity of PHP is that its extremely flexible. 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
[PHP] image_type
Hello, I was under impression that php automatically gives values to image_type and image_name if one tries to upload image from a web form if the name of the uploaded image field is image. If I do this I can see that there is a path for the uploaded image in a variable but the echo won't print anything. Where I am mistaken here? var_dump($_GET); echo $image_name; Thanks -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] image_type
-Original Message- From: William Stokes [mailto:[EMAIL PROTECTED] Sent: Thursday, March 31, 2005 8:58 AM I was under impression that php automatically gives values to image_type and image_name if one tries to upload image from a web form if the name of the uploaded image field is image. If I do this I can see that there is a path for the uploaded image in a variable but the echo won't print anything. Where I am mistaken here? var_dump($_GET); echo $image_name; You´re all wrong here... Have a look at http://dk.php.net/manual/en/features.file-upload.php -- Med venlig hilsen / best regards ComX Networks A/S Kim Madsen Systemudvikler/systemdeveloper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: asking comment
If you are storing the name of the uploaded image in a table (mySQL DB), then the row in which you gonna store this name must have a unique id (auto_increment field) ... why don't you use this id as your image name. here you'll NEVER have the same image name. Example You have an HTML form where surfer enter details + upload an image. On submitting the form, the PHP script stores all the details + uploads the image and put it in the right folder on the server. Table myTable id int(6) unsigned auto_increment imagename varchar(15) otherdetails varchar(255) once you insert a row in the table, get the id of the row. Use this id to name ur image. steps: 1. mysql_query(insert into myTable (imagename, otherdetails) values ('', '$otherdetails')); 2. get rowid - mysql_insert_id() 3. rename image to id.ext 4. update row in table: update myTable set imagename = 'id.ext' where id = 'id' You may use this script to do step 3 http://www.alienworkers.com/misc/uploadImage.htm Hope it helps... Nadim Attari, Alienworkers.com 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
Re: [PHP] Any personal experience with MySQL/Calendar application
Joe - Can you send me the name? [EMAIL PROTECTED] Todd Joe Harman wrote: Hey Todd... I have one that I created and posted at Zend.com ... it can be easily adapted to store data n MySQL... Joe On Tue, 29 Mar 2005 12:33:12 -0500, Peter G. Brown [EMAIL PROTECTED] wrote: I have used egroupware in a company setting and found it to be largely satisfactory. It might be overkill in your case but you can restrict module access. www.egroupware.org HTH Peter Brown Todd Cary wrote: I am looking for an open source calendar program that uses MySQL to store the data and has an online Admin feature. Rather than trying the many that are listed, I am hoping that someone may have some personal experience with a application of this type and make a recommendation. Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Simple CMS program
When I went to a site that lists and compares CMS programs, I was overwhelmed by at least 100 listings. Again, I would like to rely on personal experience. What I am seeking is a CMS that will provide users at my client (a Yacht Club) to update news items, and if possible, update a calendar using a Web based editor. Not a full fledged portal CMS. Also, it would be nice if it was written in PHP and use MySQL for the server DB. Has anyone had experience with such a CMS? Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session_save_path() issue
Hey there- I went to install phpopenchat today and when I run the test.php script that comes with, I get this error: *Fatal error*: Call to undefined function: session_save_path() in */path/to/website/htdocs/phpopenchat/config.inc.php* on line *98 *I'm not sure why this is coming up since the session support is installed by default.. Can anyone enlighten me? I did an out of the box install of SuSE 9.1 with apache2.0 and php4.3, is there something I might have missed in the php.ini file I need to adjust? TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] URL restriction on XML file
Hi Marek, Thank you for the solution. -- Roger Quoting Marek Kilimajer [EMAIL PROTECTED]: That's because the character data is split on the borders of the entities, so for http://feeds.example.com/?rid=318045f7e13e0b66amp;cat=48cba686fe041718amp;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 'amp;' characters. My XML file looks like this: --- start of XML --- ?xml version=1.0 encoding=iso-8859-1? rss version=2.0 channel titleTest News .Net - Newspapers on the Net/title copyrightSmall News Network.com/copyright linkhttp://www.example.com//link descriptionContinuously updating Example News./description languageen-us/language pubDateTue, 29 Mar 2005 18:01:01 -0600/pubDate lastBuildDateTue, 29 Mar 2005 18:01:01 -0600/lastBuildDate ttl30/ttl item titleGroup buys SunGard for US$10.4bil/title linkhttp://feeds.example.com/?rid=318045f7e13e0b66amp;cat=48cba686fe041718amp;f=1/link descriptionNEW 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 titleStrong quake hits Indonesia coast/title linkhttp://feeds.example.com/news/world/quake.html/link descriptiona quot;widely destructive tsunamiquot; and the quake was felt as far away as Malaysia./description source url=http://biz.theexample.com.net/;The Paper/source /item item titleFinal News/title linkhttp://feeds.example.com/?id=abcdefamp;cat=somecat/link descriptionWe 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/ABR; 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 amp; 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/ --- --- Sign Up for free Email at http://ureg.home.net.my/ --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] strncmp function
I'm new to php and linux. I am trying to replace a password program I used under windows with a mysql based login. I want to compare the first character of the first and last name of the user for a capital letter. My login program passes a user name and password. Below is a start to the program but I'm alittle confused on how to set str1 to check all letters of the alphabet. Can anyone point me to a document or give me an idea on how to do this? I can not use .htaccess do to ISP (host) rules. Access is to a members only sectionof the webpages for my Lions club. -- Russ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] strncmp function (Forgot code snippit)
Russ mailto:[EMAIL PROTECTED] on Wednesday, March 30, 2005 1:18 PM said: I'm new to php and linux. I am trying to replace a password program I used under windows with a mysql based login. I want to compare the first character of the first and last name of the user for a capital letter. Why? What does that accomplish? ?php $fname=John; $lname=Smith; Where's the quotes? if(strncmp(S,${lname},1) ===0) { ? h1strncmp() must have returned returned non-false/h1 non-false = true ?php } else { h3Strncmp() must have returned false/h3 ?php } ? Rewrite: ?php $fname = John; $lname = Smith; if(preg_match(/[A-Z]/, substr($fname ,0 ,1))) { echo first letter is uppercase.; } else { echo first letter is not uppercase; } ? There might be a better way than a regex but that's the first thing that came to my mind. HTH, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple CMS program
Todd Cary wrote: When I went to a site that lists and compares CMS programs, I was overwhelmed by at least 100 listings. Again, I would like to rely on personal experience. What I am seeking is a CMS that will provide users at my client (a Yacht Club) to update news items, and if possible, update a calendar using a Web based editor. Not a full fledged portal CMS. Also, it would be nice if it was written in PHP and use MySQL for the server DB. Has anyone had experience with such a CMS? Todd http://www.cmsmatrix.org/ -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include file
xfedex wrote: snip all my stuff Here is my test in a PIII 550Mhz 128mb with gentoo: for ($i = 0; $i = ; $i++) { $include = 'db_connect.php'; include('include/'.$include); } 3.623316 seconds -- for ($i = 0; $i = ; $i++) { $include = db_connect.php; include(include/$include); } 3.696468 seconds meatbread. So basically, I run the test 20 times, include 1000 _different_ files for both single and double quotes in each test, and come up with a mean of about 3 one-thousands of a second in favor of double quotes. Not totally scientific but produces a fairly accurate result. You on the other hand, run a test including the _same_ file 10,000 times (which brings into play error handling if you define a function in that include file) and produce a result with a difference of about 7 one-hundredth of a second. A bit less scientific, but still produces a fairly accurate result. With all that said... 1) The time difference in either test if way too small to make a difference. 2) It's a far cry from one of your earlier posts which read, Welli have a 30k script, with double i get 8 or 9 seconds, with sigle i get 0.05 or 0.08 seconds. The script basically made a lot of querys, its part of a user manager module of a system im writing. 3) Meatbread indeed. -- By-Tor.com ...it's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] strncmp function (Forgot code snippit)
Subject: strncmp function Date: Wednesday 30 March 2005 01:14 pm From: Russ [EMAIL PROTECTED] To: PHP General php-general@lists.php.net I'm new to php and linux. I am trying to replace a password program I used under windows with a mysql based login. I want to compare the first character of the first and last name of the user for a capital letter. My login program passes a user name and password. Below is a start to the program but I'm alittle confused on how to set str1 to check all letters of the alphabet. Can anyone point me to a document or give me an idea on how to do this? I can not use .htaccess do to ISP (host) rules. Access is to a members only sectionof the webpages for my Lions club. ?php $fname=John; $lname=Smith; if(strncmp(S,${lname},1) ===0) { ? h1strncmp() must have returned returned non-false/h1 ?php } else { ? h3Strncmp() must have returned false/h3 ?php } ? -- Russ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple CMS program
On Wednesday 30 March 2005 08:19 pm, Josip Dzolonga wrote: Todd Cary wrote: When I went to a site that lists and compares CMS programs, I was overwhelmed by at least 100 listings. Again, I would like to rely on personal experience. What I am seeking is a CMS that will provide users at my client (a Yacht Club) to update news items, and if possible, update a calendar using a Web based editor. Not a full fledged portal CMS. Also, it would be nice if it was written in PHP and use MySQL for the server DB. Has anyone had experience with such a CMS? Todd Try: http://www.mamboserver.com easy to install, update, etc. Hth, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php