[PHP] [SHAMELESS PLUG] Hurricane Relief Initiative
In case anyone wants to get a neat Pocket PHP Reference and help contribute to the Red Cross fund for Hurricane Katrina relief: http://www.phparch.com/rcrs Thanks! Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] enabling OpenSSL and curl for PHP on IIS
On 8/24/05 11:39 AM, Pablo Gosse [EMAIL PROTECTED] wrote: Can anyone give any insight into what might be going wrong here? I think you just need to move your php.ini file to C:\WINDOWS... PHP is looking for it there. Cheers, Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UML/OO/Design Pattern book recommendations?
Hello Alex On 8/17/05 9:33 AM, Alex Gemmell [EMAIL PROTECTED] wrote: Can anyone recommend some books that describe: - how to plan OO projects (PHP specific would be good but isn't necessary) http://www.amazon.com/exec/obidos/tg/detail/-/1590593804/qid=1124289801/sr=8 -4/ref=pd_bbs_4/103-9475507-6895034?v=glances=booksn=507846 - OO design patterns for web applications http://www.phparch.com/shop_product.php?itemid=96 (disclaimer: I work for the company that published this book). HTH, Marco Thanks for helping me become a better programmer! Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UML/OO/Design Pattern book recommendations?
On 8/17/05 11:08 AM, Alex Gemmell [EMAIL PROTECTED] wrote: Blimey! I'm not a regular to these lists so I certainly didn't expect replies from two names I recognise and respect from my years of trawling the internet for valuable PHP and CSS information! :) The books you both recommend look like exactly what I am after, with the slight caveat that I am actually using PHP4 at work and these books seem to focus on PHP5. I appreciate the real improvements PHP5 has over PHP4 with regards to OO but I have been a little hesitant to make the leap. Perhaps now I will do so. I really think you ought to take a look at PHP 5 -- I used it for my latest project (I'll admit that I only did so because the project was an experiment and I had nothing to lose, but I'm happy I did anyway) and it made a big difference, well beyond the OOP stuff. Incidentally, Jason's book on Design Patterns covers *both* PHP 4 and PHP 5 (when appropriate, there is code for both versions, and the differences in implementations are explained). I've also been toying with a subscription to PHP Architect since it first came out. It felt a bit to advanced for me back then but maybe now I'm ready for it. Congrats Marco - I think you've bagged a new subscriber! Thanks :) Cheers, Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 'God' has spoken... :-)
On 8/13/05 5:31 PM, Jochem Maas [EMAIL PROTECTED] wrote: if you haven't seen it yet and are interested in the future of php you might be interested in the _big_ thread on php-internals that starts with the message: http://www.manucorp.com/archives/internals/200508/msg00398.php Maybe even on a website that handles threads a bit more gracefully :) http://groups-beta.google.com/group/mailing.www.php-dev/browse_frm/thread/26 8910860a3f8255/37654d19dafac8a9?lnk=stq=rasmus+lerdorf+6.0rnum=1hl=en#376 54d19dafac8a9 Or http://beeblex.com/lists/index.php/php.internals/17883 http://beeblex.com/lists/thread.php/363786 (RSS 2.0) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem detecting HTTPS connection
Hello Wee-- That's been discussed a few times on the list. For example: http://beeblex.com/lists/index.php/php.general/190410 Cheers, Marco On 8/9/05 8:59 PM, Wee Keat [EMAIL PROTECTED] wrote: Hi all, I've been struggling to detect HTTPS connection for a shopping cart. I've used $_SERVER['SERVER_PORT'] to check for 443 and it kept on showing up as 80. Does anyone have any idea why this is happening? Is it the server config? I've called the server administrator and he said that it is running through port 443 for https connections. Here's an output of $_SERVER['SERVER_PORT'] on the site that I'm working on: https://www.axentonline.com.au/port_test.php http://www.axentonline.com.au/port_test.php Both the above are showing server_port as 80. Please assist. Thanks. PHPInfo: --- Apache-AdvancedExtranetServer/2.0.50 Mandrakelinux/7.2.101mdk mod_ssl/2.0.50 OpenSSL/0.9.7d PHP/4.3.8 -- Marco Tabini President CEO Marco Tabini Associates, Inc. 28 Bombay Ave. Toronto, ON M3H 1B7 Canada Phone: +1 (416) 630-6202 Fax: +1 (416) 630-5057 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Server-Client connection via TCP port with PHP
Hi Eli-- On 8/9/05 9:40 PM, Eli [EMAIL PROTECTED] wrote: Hi, I got a PHP program on my server. I want to open a live TCP port connection between my server to a client (client is developed in .NET, not regular HTTP browser). How can I do this using PHP? You can use the socket functions in conjunction with TCP wrappers. For example, take a look at fsockopen() in the manual: http://ca.php.net/fsockopen The resulting resource can be used with fwrite() and fread() and the likes as if it were a file resource. For more complex applications, you can use the actual socket API: http://beeblex.com/manual/ref.sockets.html?s=man%3Asocket Finally (since you mention you're connecting to a .Net app), maybe what you need is a web service protocol like SOAP, in which case if you're using PHP 5 there is a built-in extension, whereas PHP 4 requires you to use a userland library like the one provided by PEAR: http://pear.php.net/package/soap/redirected Cheers, Marco -- Marco Tabini President CEO Marco Tabini Associates, Inc. 28 Bombay Ave. Toronto, ON M3H 1B7 Canada Phone: +1 (416) 630-6202 Fax: +1 (416) 630-5057 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem detecting HTTPS connection
On 8/9/05 10:30 PM, Wee Keat [EMAIL PROTECTED] wrote: Hi Marco, Thanks for taking the time to answer my questions. Marco Tabini wrote: That's been discussed a few times on the list. For example: http://beeblex.com/lists/index.php/php.general/190410 Yes. I'm truly aware of that and have tried it but to no avail. I've added the code provided in the list to the following for your review: http://www.axentonline.com.au/port_test.php https://www.axentonline.com.au/port_test.php Unfortunately, I can't seem to be able to connect to your server right now. What server software are you using? I have never heard of this approach not working on a properly configured Apache... But maybe you're using something else? Marco I've done a var dump before of $_SERVER and $_ENV and did not find any HTTPS key in the array. Is there another way that I can do this? Thanks again. -- Marco Tabini President CEO Marco Tabini Associates, Inc. 28 Bombay Ave. Toronto, ON M3H 1B7 Canada Phone: +1 (416) 630-6202 Fax: +1 (416) 630-5057 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creaing a foldout menu from an array.
Hey Gregory-- On 8/7/05 12:05 PM, Gregory Machin [EMAIL PROTECTED] wrote: Hi Please advise. There was a thread on our forums a while back and one of my colleagues posted a variant of the code we use for our menus, so maybe this will help you: http://www.phparch.com/discuss/index.php/m/3901/2 Cheers! Marco -- BeebleX - The PHP Search Engine http://beeblex.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP error tracking on new server
Hey Terry-- On 8/7/05 11:03 AM, Terry Romine [EMAIL PROTECTED] wrote: Any ideas on what flag may need to be set and how to do it on a file- by-file basis so I am only tweaking it when testing? Terry Does your hosting provider support .htaccess? If so, you may be able to change the error reporting settings by providing your own .htaccess file which contains something like: php_flag display_errors on HTH, Marco -- BeebleX - The PHP Search Engine http://beeblex.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A question on the term CFG.
On 8/7/05 4:24 PM, Jasper Bryant-Greene [EMAIL PROTECTED] wrote: Or if it's PHP 5 they might be using an __autoload() magic function which gets called whenever a class that isn't declared is instantiated. That function could be require()ing another file. Well, if it is PHP 5, then you can use introspection to find out where that class is declared: $className = get_class ($CFG); $cls = new ReflectionClass ($className); Echo Class . $className . is defined in . $cls-getFileName() . between lines . $cls-getStartLine() . and . $cls-getEndLine(); Marco Jasper Chris wrote: That isn't created by PHP, it must be declared in the code somewhere. Maybe there is an auto_prepend_file set? http://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file Chris wayne wrote: First, I'm new to PHP. I have a script that has a piece of code that looks like this - require_once($CFG-wwwroot . '/lib/mylib.php'); My question is this, I'm trying to find out how the class $CGF was initiated.There are no include or require statement before the statement. Is $CFG a global variable? If how does it get initiated? Tnaks. -- Marco Tabini President CEO Marco Tabini Associates, Inc. 28 Bombay Ave. Toronto, ON M3H 1B7 Canada Phone: +1 (416) 630-6202 Fax: +1 (416) 630-5057 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to check http:// or https:// ?
IIRC, if you're using Apache you can check If (isset ($_SERVER['HTTPS'])) You can also check this thread: http://beeblex.com/lists/index.php/php.general/190410?h=%24_SERVER%5B%27HTTP S%27%5D -- BeebleX - The PHP Search Engine http://beeblex.com On 8/5/05 2:05 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I need to check does URL use http or https? Right now I use this code: if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false) { header('location: [URL]https://www.test.com/test.php[/URL]'); exit; } but I am sure there is much better solution. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Magic Quotes or Curley Quotes or Something
Hello Lance-- On 8/5/05 2:18 PM, Lance Earl [EMAIL PROTECTED] wrote: I recently upgraded my server. It is running Ubuntu Linux with PHP and MySQL. My site allows people to post content to their own web oages through a web interface. Many of my customers compose their content on a word processer and then cust and paste it to the web interface for insertion to the database and later retrevial and display on a web page. The problem I am having is that content which includes quotes is is not being seen correctly. Rather than inserting a slashed quote (/), it inserts a bunch of strange formatted gunk. A sample of the problem anc be seen at www.dallypost.com/ranch/page5688.php You have an encoding problem--the content is being uploaded to your site using a different encoding mechanism (most likely utf-8) than the one you use to display it. I'm not much of an expert in this area, but a couple of suggestions: 1. You're already outputting UTF-8 code from the looks of it, so a simple Header (Content-type: text/html; charset=utf-8); Or even adding this to your HTML code in the HEAD: META HTTP-EQUIV=content-type CONTENT=text/html; charset=utf-8 Should do it. Remember to also use htmlentities ($data, null, utf-8); to properly encode the entities in your content. 2. Convert the text over from UTF-8 to ISO-8859-1. I think you can use utf8_decode, or you may have to go with the mbstring extension (not too sure here, I'd just go ahead and convert everything over to UTF-8). I'm sure some other people who have more experience with this stuff can give you even more pointers, but this should get you started. Cheers, Marco -- BeebleX - The PHP Search Engine http://beeblex.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to check http:// or https:// ?
On 8/5/05 2:43 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thanks Marco! :) I was looking for something like this on phpinfo() but didn't found? That's because it shows up only if you are under HTTPS! :-) Marco -afan Marco Tabini wrote: IIRC, if you're using Apache you can check If (isset ($_SERVER['HTTPS'])) You can also check this thread: http://beeblex.com/lists/index.php/php.general/190410?h=%24_SERVER%5B%27HTTP S%27%5D -- BeebleX - The PHP Search Engine http://beeblex.com On 8/5/05 2:05 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I need to check does URL use http or https? Right now I use this code: if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false) { header('location: [URL]https://www.test.com/test.php[/URL]'); exit; } but I am sure there is much better solution. :) -- Marco Tabini President CEO Marco Tabini Associates, Inc. 28 Bombay Ave. Toronto, ON M3H 1B7 Canada Phone: +1 (416) 630-6202 Fax: +1 (416) 630-5057 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to check http:// or https:// ?
On 8/5/05 3:24 PM, Jochem Maas [EMAIL PROTECTED] wrote: SIDENOTE REGARDING BEEBLEX.COM: I just added a bookmark in firefox to beeblex.com as follows http://beeblex.com/search.php?d=ALLDBs=%s and I gave it a keyword of 'beeb' now I can go to firefox and type 'beeb HTTPS' to get an direct hit - so now there is no excuse not to be using Marco's cool new resource :-) :-) There's also a Firefox search toolbar with a Google passthru: http://beeblex.com/faq/ -- (see item #4) Cheers, Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strip out too many newlines
Don't know much about the app you're writing, but does this do the trick for you? echo preg_replace ('! ( \[quote (?:=[^\]]*)? \] )# Capture the [quote=xxx] part \n*# Eliminate any extra newlines here (.+)# Get contents \n*# Eliminate any extra newlines here (\[/quote\])# Capture this part \n*# Eliminate any extra newlines here !x', \$1\$2\$3\n\n, $string); HTH, Marco -- BeebleX - The PHP Search Engine http://beeblex.com On 8/4/05 9:44 AM, Sebastian [EMAIL PROTECTED] wrote: [quote=user] foo [/quote] bunch of extra lines more text... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strip out too many newlines
Try changing the \n* patterns to (?:\r?\n)* Cheers, Marco -- BeebleX - The PHP Search Engine http://beeblex.com On 8/4/05 10:39 AM, Sebastian [EMAIL PROTECTED] wrote: [quote=user] foo [/quote] bunch of extra lines more text... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strip out too many newlines
On 8/4/05 10:56 AM, Sebastian [EMAIL PROTECTED] wrote: that works for my orginal request, but i found something else: $string = '[quote=xx]foo[/quote]\nmore text\r\n\r\n\r\n\r\nmore text'; Try removing double-instances of \r\n (or \n) before running the regex. Marco now if they enter more carriage returns i get the results from above. its no big deal, but you always have someone trying to 'break' the system. thanks, i really need to learn some regexp. Marco Tabini wrote: Try changing the \n* patterns to (?:\r?\n)* Cheers, Marco -- BeebleX - The PHP Search Engine http://beeblex.com On 8/4/05 10:39 AM, Sebastian [EMAIL PROTECTED] wrote: [quote=user] foo [/quote] bunch of extra lines more text... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Event-Driven Programing
There you go: http://beeblex.com/search.php?s=eventd=phpa_articles The first three articles are all about event-driven programming with PHP using various frameworks. Cheers, Marco On 7/27/05 3:31 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello, Anyone willing to share knowledge or points to articles that try to implement event-driven programming in PHP. And yes, I know php is not event driven language but I like the approach when working with 3 layers patterns. Regards, Angelo -- Marco Tabini President CEO Marco Tabini Associates, Inc. 28 Bombay Ave. Toronto, ON M3H 1B7 Canada Phone: +1 (416) 630-6202 Fax: +1 (416) 630-5057 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AJAX PHP
We had a webcast on PHP and Ajax a while back--the recordings are still available for free at http://blogs.phparch.com/mt/index.php?p=49. Also you may want to try looking for Ajax here: http://beeblex.com/ajax (it's a new search engine I just put online, so I thought I'd take the opportunity for some shameless self-promotion). Cheers! Marco On 7/21/05 1:52 AM, balwant singh [EMAIL PROTECTED] wrote: Have anybody tried PHP AJAX, may please share your experience. also pls. suggest good link of tutorial on this. With Best Wishes Balwant Singh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Character Encoding problem
On 7/21/05 8:32 AM, Regine Velasquez [EMAIL PROTECTED] wrote: Whenever I switch the encoding of a page to UTF-8, the characters ñ, ë, ì, û, á, etc., automatically changes to question marks. I've originally set the encoding of a page to ISO-8859-1 using header () function. header ('Content-Type: text/html; charset=ISO-8859-1'); Well, if you've set the encoding to ISO-8859-1 and then output utf-8 characters I would expect them not to display properly. Or am I not understanding the problem correctly? From what I see, you can either change the encoding of the page, or use a function like utf8_decode() to transform utf-8 characters into iso-8859-1 (which, of course, is not always possible). Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] searchbot script
You can--you need to check the signature of the visiting client and determine whether it is a spider (for example, Google indexers are called googlebots). This is in $_SERVER['HTTP_USER_AGENT']. Here's a thread on the subject: http://news.php.net/php.general/217460 You can also use the browscap-related functionality to extract more information from the user-agent string, although this is not always 100% reliable: http://ca.php.net/get-browser Remember, however, that most search engines shun this practice and may drop your site from their indices if you adopt it. Marco On 7/17/05 10:55 AM, jenny mathew [EMAIL PROTECTED] wrote: hello group, is it possible to make write a program in php ,so that only search bots can see the output of that program.i mean to say that a program echoes a line at the footer which only search bots can see,it will be invisible to general visitors. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if(true false) //??
It can't -- that looks like some leftover debugging code to me. Marco On 7/9/05 10:50 AM, Sam Smith [EMAIL PROTECTED] wrote: I have some code that I barrowed that works but I don't get how it could possible work, obviously I don't understand how false works: How can this ever pass?: if (isset($_SESSION['PrevUrl']) false) { Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Currency stored as cents
On 7/3/05 1:33 AM, Tom Rogers [EMAIL PROTECTED] wrote: function dollars2cents($value){ $value = sprintf(%0.2f,trim($value)); list($a,$b) = explode('.',$value); if(floatval($value)0) $b = $b*-1; //negative amount? return intval($a)*100 + intval($b); } Have you tried round ($value * 100) ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to implement mass emailing?
Manuel Lemos wrote: Hello, On 10/07/2004 09:24 AM, Marco Tabini wrote: Finally, you will need a fast mailing mechanism. mail() is not your only option--you can interface directly with any mailer through SMTP or pipes, for example--but in my experience, you don't need to go any further to make things work properly. What you really need, is a fast This is a common misconception. It seems that most people confuse queueing with deliverying. Not that I want to start a fight or anything... but where is the misconception? I simply illustrated several possibilities--one of which is queuing, while the other is deliverying directly (and there is a difference, and they can both be performed through PHP, although I personally wouldn't see the point of bothering with direct delivery). Mt. -- Marco Tabini President and CEO Marco Tabini Associates, Inc. 28 Bombay Ave. Toronto, ON M3H 1B7 Canada Phone: (416) 630-6202 Fax: (416) 630-5057 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to implement mass emailing?
Well, you do have a number of options. First, as someone suggested, you can write a CLI script that doesn't depend on a web browser being connected to run. That's probably the best solution overall, because you have the most control over what happens. You can even trigger it indirectly through a call to a web page. If you want to run the script through the web, you can set_time_limit(0) to prevent your script from timing out and register_shutdown_function() to ensure that your script continues running even if the user terminates the connection from the browser. Because of this, though, you will also need a mechanism that makes it possible for the script to determine whether there is another instance of the script running, so that you can prevent an overanxious usre from refreshing your script multiple times because he can't tell that it's still sending out mail and hit your mailing list more than once. Finally, you will need a fast mailing mechanism. mail() is not your only option--you can interface directly with any mailer through SMTP or pipes, for example--but in my experience, you don't need to go any further to make things work properly. What you really need, is a fast MTA that is capable of queueing your messages and deliverying them efficiently, like qmail. If you want an easier way of composing e-mail programmatically, you may want to take a look at PHPMailer (http://phpmailer.sourceforge.net/), which can simplify things significantly and can also interface directly with a fast MTA like qmail. We use a combination of these techniques to send out tens of thousands of notifications once every month, and never had a problem with it. HTH, Marco Tabini -- php|architect The PHP Magazine for PHP Professionals http://www.phparch.com Tumurbaatar S. wrote: The scenario is: 1. Site administrator logs into his admin page and writes some message on a form. 2. After clicking submit the web script should broadcast this message to several hundred subscribers. And I'm wonder how to implement this on PHP. Sending an email to each subscribers can take a much time and PHP will stop after max_execution_time. Any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Preg_match question
I guess the simplest would be to use preg_match_all on '/a +href=([^]+)/i' Assuming that all your links are in that format, this will extract all the contents of the href portion of the links in your string. There was a regex series on our magazine that also covered more complex examples of this kind. Cheers, Marco -- php|architect - The Magazine for PHP Professionals http://www.phparch.com -- Get your free issue today! -Original Message- From: Dave Carrera [mailto:[EMAIL PROTECTED] Sent: May 29, 2004 4:30 AM To: [EMAIL PROTECTED] Subject: [PHP] Preg_match question Hi List, I have managed to list files on my website using a combination of preg_match_all and str_replace in an array. What I would like to know is how do I lift out of a a tag the contents from href=. Example: Link returned = a href=./somepage.phpOf to some page/a The bit I want to play with is ./somepage.php. I think it might be something to do with another preg of some kind but I can not work it our so I ask for help from the list. Thank you in advance for any help or guidance you my give Dave C --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.691 / Virus Database: 452 - Release Date: 26/05/2004 -- 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] Preg_match question
Is there a preg to find a ? in a string since a ? is used for calculations as I see it. You just need to escape it with a backslash, e.g. \? Good luck, Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] includes...
That means the current directory Cheers, Marco -- php|architect - The Magazine for PHP Professionals Try us free at http://www.phparch.com! Complete searchable PHP mailing list archives at http://www.phparch.com/mailinglists [EMAIL PROTECTED] wrote: bit of a random thought I need answering really... when referencing external files, what's the difference between: ../ / ./ I know that ../ means back one directory and jsut a / means look from the root directory, but what is: ./ ??? Cheers all.. * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date from weeknumber
Hey-- Maybe this will help: http://www.phparch.com/mailinglists/msg.php?a=557061 Cheers, Marco Fredrik wrote: Hi I want to get the last date in a week. Is there anybody who know how i can do this. something like this: function date getDateFromWeek( $week, $year){ ... ... return date; } - Petter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zip Code Locator / Radius Search
This may help: http://phparch.com/issue.php?mid=9 ... and it's even a free issue :) Marco -- php|architect - The Magazine for PHP Professionals Try us free at http://www.phparch.com! Complete searchable PHP mailing list archives at http://www.phparch.com/mailinglists Becoming Digital wrote: I need a search by zip code, aka radius search feature for a current project. I know I've seen info on how this works but I can't seem to find it. I guess my own search abilities are malfunctioning. Would someone be so kind as to point me to a link? Thanks a lot. Edward Dudlik Those who say it cannot be done should not interrupt the person doing it. wishy washy | www.amazon.com/o/registry/EGDXEBBWTYUU -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Printing from PHP
Depends on how your overall network is configured. If the server on which PHP is running is on the same internal network as the printer, then the short answer is yes--the way you implement it depends on which OS your system is running. If PHP is running on Windows, there is a subset of printing functions (incidentally, my magazine had an article about that two months ago, see http://www.phparch.com/issue.php?mid=14). If it's running on Unix, then you can output PostScript code (or a PDF) directly to your printing queue. If your server is not on the same network, then you have at least two choices. Either use strict CSS formatting to make the browser create a printable output (good luck :-) ), or use PDF, which is much safer, although a little more complicated than plain HTML. Cheers, Marco -- php|architect - The Magazine for PHP Professionals Try us free at http://www.phparch.com! Complete searchable PHP mailing list archives at http://www.phparch.com/mailinglists Peter Goggin wrote: Is it possible to have a php a script that will run on my server but let me print to my client network printer? What I am doing is using php to generate html for a report from a data base which is displayed on the clients screen. I would like to offer the client the option of printing this report on their local printer . If php will not support access to a client printer is there any way of embedding a Form Feed in the display so that if the screen report is printed than the data will be correctly paginated? Regards Peter Goggin --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.532 / Virus Database: 326 - Release Date: 27/10/03 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [Stats] PHP Net List: October 2003
Probably because nobody wants to risk offending John--or (more likely) because no one will admit knowing who the other John Holmes is ;-) Cheers, Marco -- php|architect - The Magazine for PHP Professionals Try us free at http://www.phparch.com! Complete searchable PHP mailing list archives at http://www.phparch.com/mailinglists Roger Spears wrote: That is funny stuff..I often wonder why no one ever cracks jokes or makes a connection... John W. Holmes wrote: John Nichel wrote: Hey, I beat John Holmes You mean you're bigger than 14 inc... err, nevermind, you're talking about something else... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] High bandwidth application tips
Chris Shiflett wrote: I currently design, develop, and maintain a suite of Web applications and utilities that receive ten million hits a day, and my experience has shown that the number one thing you can do to make the biggest difference is to limit the number of times you need to hit the database. I second Chris on this. No matter how fast your servers are, there is an inherent latency in hitting the database, particularly if you do so continuously and unnecessarily. Caching is usually a good solution to this problem--there are commercial products that will help you (like the Zend Performance Suite), but if you design with caching in mind from the outset, you should be able to obtain excellent results even without them. Cheers, Marco -- php|architect - The Magazine for PHP Professionals Try us free at http://www.phparch.com! Complete searchable PHP mailing list archives at http://www.phparch.com/mailinglists -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tips on books and tutorials
Filip de Waard wrote: Hi, There are many great websites, for instance: http://www.phpdeveloper.org http://www.phpbuilder.com http://www.devshed.com http://www.phpnoise.com/ Shameless self-promotional plug of the day: And also don't forget php|architect (http://www.phparch.com), a magazine dedicate PHP. We also host a complete searchable archive of the PHP mailing lists (http://www.phparch.com/mailinglists). Cheers! Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] (ANNOUNCE) New PHP mailing list *searchable* archives
Hello All-- I'd have to agree with Richard in that there doesn't seem to be a good way to make this idea fly--at the very least, it would be annoying (also because there really is no way to guarantee that the results would be entirely relevant to the contents of the message). I've sent an e-mail to the php.net webmaster asking their opinion on adding a link to the archives (maybe to all of them, although personally I think that would be confusing) to the signature that gets added to each message that goes through the list. We'll see what they think... any support we can muster from the list itself will certainly help ;-) Cheers Marco Richard Baskett wrote: on 10/22/03 13:32, David T-G at [EMAIL PROTECTED] wrote: Richard, et al -- ...and then Richard Baskett said... % % on 10/21/03 16:40, David T-G at [EMAIL PROTECTED] wrote: % % ...and then Marco Tabini said... % % % % php.general for new messages and send back an e-mail to the list with ... % % A nice idea, but terribly difficult to implement practically. It was % tried on the mutt-users list and the manitainer was roundly flamed :-) % % It seems like it would be ok to have it sent to the person that asked the % question... And then if they did not want to receive those notices, then % they could opt out of that.. That sounds a lot like opt-out spam. Is it OK for me to send you lots of unsolicted, form-letter, machine-generated emails? :-) It wasn't pretty. I understand what you are saying, but if it's part of the agreement when you sign up for the php-general mailing list.. then... And at any time you can opt in again if you wanted. Or if that is still too intrusive then have a little notice at the bottom of each php-general mailing along with the other footer stuff and let people opt in that way from the beginning... Rick Beauty of whatever kind, in its supreme development, invariably excites the sensitive soul to tears. - Edgar Allan Poe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php and Fortune
Hello Chuck-- You can use a number of PHP functions, such as shell_exec and passthru, which will run an external app and return its result either in a variable or directly to the output. Some more info regarding this specific problem (and a script) here: http://www.phparch.com/mailinglists/msg.php?a=572205s=fortunep=g= Cheers, Marco Chuck PUP Payne wrote: Hi, Is there a way I can get php to call the program fortune then print that a web page. Thanks. Payne -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using mail() - what is max number of email addresses I can specify in To field?
I'm not sure if you've considered this possibility--but can't you send the messages to one recipient at a time? This way, the problem wouldn't present itself, and the end result would be quite the same (with the added bonus of not having to disclose your entire mailing list to each recipient). To speed things up, you may want to look at the PHPMailer project (http://phpmailer.sourceforge.net/), which provides a class that facilitates sending the same message to multiple recipients, as well as other aspects of e-mailing, like HTML bodies and attachments. Finally--if you're sending lots of e-mail I recommend you monitor your MTA carefully--Sendmail has a habit of choking on large mailings, whereas learner MTAs like Exim or Qmail seem to do better. Cheers, Marco John Christopher wrote: I am writing a script that will query a database table for some statistical information, and then email it (daily, weekly, and monthly) to a list of subscribers. I don't know ahead of time how many persons will be subscribed to receive the info (it could be 20 persons or 2000 or more). Email addresses can be added to or deleted from the subscriber list at any time. If I am not mistaken, MTAs have a limit on how many recipients can be specified on the To: line of an email message. What is the limit, or does it depend on the MTA you're using (sendmail, qmail, etc), or other factors? If there is such a limit, then what is the best way to send the message to each recipient? Thank you. __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] (ANNOUNCE) New PHP mailing list *searchable* archives
Hello Everyone-- I wanted to let you know about a new initiative that php|architect has launched: the Searchable PHP Mailing List Archive, which can be found at http://phparch.com/mailinglists. This is a fully searchable archive of the PHP mailing lists with an attempt to build proper threading, keyword highlight, automatic quoted text indentation and a few other features. It's still a bit experimental, and some features don't work as best as they could. However, it should be fairly functional, and the full-text search engine can be helpful if you're looking for fast answers to problems that are often asked on the mailing lists. It's there for everyone to try, and please feel free to drop me a note if you think something doesn't quite work the way it should or if you have ideas about possible enhancement. At the present time, one of the things we're working on is filtering the messages trough SpamAssassin and allowing for the possibility to exclude messages marked as spam from the search results. We built our archive because we found it difficult to find a good search resource dedicated only to the PHP mailing lists. I hope it will help you, as well. Cheers, Marco Tabini php|architect -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] (ANNOUNCE) New PHP mailing list *searchable* archives
I always have trouble searching for stuff with theaimsgroup archive as well. I know what you mean. Google is a good alternative, but they still can't tell between the word PHP and the extension PHP, so that the results aren't always relevant... Cheers, Marco -- php|architect - The Magazine for PHP Professionals Try us free at http://www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] (ANNOUNCE) New PHP mailing list *searchable* archives
Nice work, if the list admin would add a link to this archive in the footer (or the header) it would be even useful for new subscribers who don't know of its existence. Well, one of my original ideas was to have a process that would monitor php.general for new messages and send back an e-mail to the list with possible answers based on the message's contents. I'm not sure that would be a good idea, though :-) Cheers, Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] (ANNOUNCE) New PHP mailing list *searchable* archives
I think the idea is splendid (and new, call it DFAQ (dynamic FAQ)) but as a different service than a mailing list. Challenging? What did you have in mind exactly? How is the FAQ served? Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] (ANNOUNCE) New PHP mailing list *searchable* archives
- Edwin - wrote: Sort of a PHP-AI eh? :) Hmm... I don't think that's a bad idea at all, but... I wonder how you'd deal with new messages/posts/questions which: 1. Real people don't even understand, and 2. Real posters don't even understand what they're asking. Well, that's, of course, a problem. In the best case scenario, the search engine will recognize the patterns and provide meaningful suggestions. In the worst case scenario, it won't return anything useful. Still, it might be worth a try. The system could send only the top ten search results. The problem is that the results should be mailed to the list so that others could tell whether they satisfy the question, but I'm afraid that would become annoying. The truth, however, is that there is a lot of repetition in the questions that are asked here and a simple search through the archives would answer many questions directly--keeping the list a bit cleaner and easier to follow, IMO. ;) - E - PS Nice work, btw! Thanks :-) Cheers, Marco __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] (ANNOUNCE) New PHP mailing list *searchable* archives
Chris Shiflett wrote: Perhaps Marco can try an Ask Jeeves type of Web app. Is that the sort of thing you are suggesting? So, as another feature of this mailing list archive, there could be a place where people can ask a question, and Ask Marco will try to come up with some suggested posts to read. This would give people even fewer excuses to not check the archives. :-) Well, to a certain degree our archives already work like this. For example: http://www.phparch.com/mailinglists/results.php?s=how+do+I+alternate+table+row+colours%3Fg=75 Returns the results for the question ho do I alternate table row colours?, and AFAICS the results returned are quite on target, so we're not too far from *that* goal. The problem is that people don't know/use/want to be bothered with a Web interface, and use the mailing lists instead, so this service should IMO be somehow connected with the list proper. Cheers, Marco Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] (ANNOUNCE) New PHP mailing list *searchable* archives
Robert Cummings wrote: I think this is great but have one bit of hopefully constructive criticism... the horizontal real estate is too small, or the font is too large, I find the content wraps terribly :/ Cheers, Rob. Hi Rob-- True. Alas, it has to fit in our design, so one of the possibilities we're experimenting with is using either floating frames for the threading, or reducing the font size--the problem with the latter being that we *do* want people to be able to read the messages ;-) Thanks for the suggestion! Cheers, Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] (ANNOUNCE) New PHP mailing list *searchable* archives
Interesting thoughts... who would handle the separate list, though? Marco [EMAIL PROTECTED] wrote: Marco Tabini wrote: The problem is that the results should be mailed to the list so that others could tell whether they satisfy the question, but I'm afraid that would become annoying. Perhaps a sister list could be setup to receive these messages. This would prevent the annoyance while still providing a central location for those interested to view responses. A bit of mail server wizardry (if you'd even call it that) can ensure that messages are delivered to all those participating in the thread. Edward Dudlik Those who say it cannot be done should not interfere with the person doing it. wishy washy | www.amazon.com/o/registry/EGDXEBBWTYUU - Original Message - From: Marco Tabini [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, 21 October, 2003 11:59 Subject: Re: [PHP] (ANNOUNCE) New PHP mailing list *searchable* archives - Edwin - wrote: Sort of a PHP-AI eh? :) Hmm... I don't think that's a bad idea at all, but... I wonder how you'd deal with new messages/posts/questions which: 1. Real people don't even understand, and 2. Real posters don't even understand what they're asking. Well, that's, of course, a problem. In the best case scenario, the search engine will recognize the patterns and provide meaningful suggestions. In the worst case scenario, it won't return anything useful. Still, it might be worth a try. The system could send only the top ten search results. The problem is that the results should be mailed to the list so that others could tell whether they satisfy the question, but I'm afraid that would become annoying. The truth, however, is that there is a lot of repetition in the questions that are asked here and a simple search through the archives would answer many questions directly--keeping the list a bit cleaner and easier to follow, IMO. ;) - E - PS Nice work, btw! Thanks :-) Cheers, Marco __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using cookies
We use a standard disclaimer: 2. Use of Cookies Like many websites, we use cookies to maintain certain information about you while you are visiting our website. However, we do not share the contents of our cookies with any third party, under any circumstances. Should we allow a third party to provide advertisement through our website or through our magazine, please be advised that we are not responsible for their use of cookies, and that we do not normally have access to the information that they store in their cookies. That has kept our users at bay, but we admittedly cater to a technical audience... Cheers, Marco John Taylor-Johnston wrote: Can someone recommend a good URL on cookies and security issues please? I can program them, but am told I'm putting others at risk, forcing people to use cookies on my site. -- John Taylor-Johnston - Université de Sherbrooke: http://compcanlit.ca/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using cookies
Chris Shiflett wrote: --- Marco Tabini [EMAIL PROTECTED] wrote: However, we do not share the contents of our cookies with any third party, under any circumstances. I'm no lawyer, but that seems like a risky statement. There are many circumstances that can cause the contents of the cookies you set to be disclosed to third parties. It seems like the definition of sharing would come under scrutiny in these situations, which doesn't seem like much defense to me. Well sharing implies a will to disclose--so if we unvoluntarily disclose information we don't share it with anyone. I suppose you're safe as long as you don't willingly or intentionally share this information yourself, but browser vulnerabilities (such as those found in IE 4.0, 5.0, 5.5, and 6.0) can allow anyone to view the contents of any cookie. But if the browser causes the information to leak, we did not share (or disclose) it--the user did, through action or inaction (e.g.: not patching his or her browser). Your bank won't share your money with anybody else, but if you take the money out and someone robs you outside the branch, they're not going to refund you... Cheers, Marco I doubt I'm telling you anything you don't know, but maybe I'm saying something that someone doesn't know. :-) Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using cookies
Actually it's more like the bank storing your money in a safe with glass walls. Sure the bank stored it, and stored it securely (it was behind glass wasn't it?) but someone could easily break the glass and steal all the money. The argument from the customer would be The company I put my trust in did not take all the precautions possible to protect me and I think they misrepresented the security of my data. If they had told me there are flaws in my browser that could allow the leaking of my information I would not have signed up in the first place. Whether or not that's a good reason for a judge to rule on behalf of a customer is another thing. But I just thought I should try to clarify. Chris. Sorry, but your comparison doesn't hold together--perhaps we should drop banks altogether and actually talk about computers :-) Once the cookie is on the user's browser, it is in the hands of the user. I, or my company, have no control over what happens at that point. It is the user's responsibility--because he or she now holds that data--to handle it properly. Cheers, Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using cookies
Joseph Bannon wrote: I think it's the responsibility of whomever is holding the key (ie, the username and password). When a user logs into my site, I put their username and password in a cookie. I then check those cookies to allow them access to membership only parts of the site. It is thus their responsibility to keep people from accessing the cookies on their machine. If I don't put the username and password on their machine and just use a session id, now the responsibility is in my hands. J. The responsibility is in your hands as far as the consequence of your actions are concerned. If *your* server gets hacked into and someone steals all the usernames and passwords, you're in trouble because you let that happen. If your customer discloses his or her information to a third party, either voluntarily or by mistake, the responsibility is theirs, unless you accept in your agreement with them to take responsibility for their mistakes (which, incidentally, is essentially what you do when you open a credit card merchant account). IMHO, by storing the user's name and password in a cookie, you may be exposing that information to unnecessary risks by letting it go back and forth continuously on the Net (assuming, of course, that you're not under SSL and/or are using some encryption mechanism) and possibly someone could argue that you did not take the necessary steps to protect the user's data in an efficient way. But, then again, I'm not a lawyer, so take what I'm saying with a HUGE grain of salt :-) Cheers, Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] N/A
Hey Peter-- If the file is always local and you're using a relatively recent version of PHP, you can use file_get_contents instead: http://ca.php.net/file_get_contents Cheers, Marco -- php|architect -- The magazine for PHP professionals Try us free at http://www.phparch.com Searchable PHP Mailing Archive at http://phparch.com/mailinglists Peter Flachbart wrote: I'm trying to use this function to outpot the content of a file that I change time to time so I'd like to see the added text into file to appear in the browser window. Could you help me? (stream_select doesn't work???) ? $fh = fopen('debug.txt','r+'); stream_set_blocking($fh ,true); while(true){ $text = fgets($fh,10); echo $text; flush(); ob_flush(); } fclose($fh); ? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Eval var from query
On Mon, 2003-07-14 at 15:03, Shawn McKenzie wrote: How can I evaluate a var that is from a text field of a database? Example: Hi Shawn-- Have you looked at eval? http://www.php.net/eval. Cheers, Marco -- php|architect -- The Magazine for PHP Professionals NOW AVAILABLE IN PRINT! Get your free copy today at http://www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql detect
locate mysql.lib? Can you be a bit more specific? Marco On Wed, 2003-07-02 at 03:05, [EMAIL PROTECTED] wrote: helo all , what command in linux , to see default direcktory instalation mysql database dan mysql library ## With best regards ! Roy Daniel , ST IT Application Support Development Engineer - PT BERCA [EMAIL PROTECTED] // [EMAIL PROTECTED] ICQNumber : # 103507581 // Phone Cell : 0816-1192832 ## -- Marco Tabini President Marco Tabini Associates, Inc. 28 Bombay Avenue Toronto, ON M3H 1B7 Canada Phone: (416) 630-6202 Fax: (416) 630-5057 Web: http://www.tabini.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems compiling PHP 5.0.0b1
If you installed libxml2 from source--rather than from RPM--chances are that it's been installed in a folder other than the system library directory (/usr/lib). It's probably in /usr/local/lib instead. So you can do one of two things: either reconfigure libxml2 specifying --prefix=/usr or reconfigure PHP --with-libxml-dir= and your actual libxml2 installation path. Cheers, Marco On Tue, 2003-07-01 at 13:11, Mauricio Cuenca wrote: Hello, I've tried several times compiling PHP 5.0.0b1 on a Linux RedHat 8.0 using this configure command: ./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5 And I get the following error: configure: error: libxml2 version 2.5.1 or greater required. Then, I downloaded and compiled libxml 2.5.7 and the same error appears. I've compiled several diffrent versions of PHP before without problems. Has anyone had a similar problem ? TIA, _ Mauricio Cuenca -- Marco Tabini President Marco Tabini Associates, Inc. 28 Bombay Avenue Toronto, ON M3H 1B7 Canada Phone: (416) 630-6202 Fax: (416) 630-5057 Web: http://www.tabini.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 - Bugs
Which platform are you running on? Marco On Tue, 2003-07-01 at 13:39, Michael A Smith wrote: Hey, Can't figure this out... whenever I try to use any mysql functions or anything, I get problems. PHP throws a DNS error... what's up with that? -Michael -- Marco Tabini President Marco Tabini Associates, Inc. 28 Bombay Avenue Toronto, ON M3H 1B7 Canada Phone: (416) 630-6202 Fax: (416) 630-5057 Web: http://www.tabini.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Refreshing
Try using Javascript to reload an image instead of an HTML file. Images don't click, and you can check whether new data is available by the size of the returned image (e.g.: 1 pixel, no new data, 2pixels, new data). You will need a small PHP script on the backend that generates the image based on whether the data is available or not. Cheers, Marco -- php|architect -- The Magazine for PHP Professionals Get your free copy today at http://www.phparch.com! On Mon, 2003-06-30 at 13:50, Stephen wrote: 1. This way would probably end up sending out 500 little clicks every minute...so... Could any client side script do this like JavaScript? I doubt it could but just a question. With bubblegum in my shoe, Stephen Craton Senior Executive Web Developer Mophus.com, Inc. - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: Stephen [EMAIL PROTECTED]; PHP List [EMAIL PROTECTED] Sent: Monday, June 30, 2003 12:41 PM Subject: RE: [PHP] Refreshing [snip] I have a chat script. I want it to refresh the chat display area whenever there is a new message posted, but not every 10 seconds or so. How could I get the script to refresh only when there is a new entry into the database table? Also, this may not be PHP but...does anyone know how to stop the annoying click on Internet Explorer when something refreshes? [/snip] 1. Nope, not with PHP. Well, you could but it would require a script running in a loop in the background, checking for new data, then calling a header redirect of some sort. That is kludgy and would require the looping doohickey for each conversation within the chat. 2. You can disable sounds in a themes thingie, depends on which windoze version you own. HTH! Jay -- Marco Tabini President Marco Tabini Associates, Inc. 28 Bombay Avenue Toronto, ON M3H 1B7 Canada Phone: (416) 630-6202 Fax: (416) 630-5057 Web: http://www.tabini.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Refreshing
On Mon, 2003-06-30 at 13:57, Stephen wrote: Thank you for this method. I just have a few questions. 1. How could javascript reload the image? I'm not 100% familiar with JavaScript really... Set a timeout to x seconds (where x is the time you want to wait between checks--say one or two seconds). When the timeout occurs cause the image to reload by changing its src attribute (even to the same URL, of course). 2. How could I use PHP to find the width of the image? I was reading up on image manipulation last night but only got as far as creating an image. You don't need PHP to check the width of the image. PHP *generates* the image of a given width based on whether new data is available or not. On the frontend, you can set the onload event of the image to fire a function of your choosing when the image is reloaded, where you check its dimensions and act accordingly. Once you've done that, you reset your timer, and the cycle starts over. Cheers, Marco -- php|architect -- The Magazine for PHP Professionals Get your free copy today at http://www.phparch.com! With bubblegum in my shoe, Stephen Craton Senior Executive Web Developer Mophus.com, Inc. - Original Message - From: Marco Tabini [EMAIL PROTECTED] To: Stephen [EMAIL PROTECTED] Cc: Jay Blanchard [EMAIL PROTECTED]; PHP List [EMAIL PROTECTED] Sent: Monday, June 30, 2003 12:52 PM Subject: Re: [PHP] Refreshing Try using Javascript to reload an image instead of an HTML file. Images don't click, and you can check whether new data is available by the size of the returned image (e.g.: 1 pixel, no new data, 2pixels, new data). You will need a small PHP script on the backend that generates the image based on whether the data is available or not. Cheers, Marco -- php|architect -- The Magazine for PHP Professionals Get your free copy today at http://www.phparch.com! On Mon, 2003-06-30 at 13:50, Stephen wrote: 1. This way would probably end up sending out 500 little clicks every minute...so... Could any client side script do this like JavaScript? I doubt it could but just a question. With bubblegum in my shoe, Stephen Craton Senior Executive Web Developer Mophus.com, Inc. - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: Stephen [EMAIL PROTECTED]; PHP List [EMAIL PROTECTED] Sent: Monday, June 30, 2003 12:41 PM Subject: RE: [PHP] Refreshing [snip] I have a chat script. I want it to refresh the chat display area whenever there is a new message posted, but not every 10 seconds or so. How could I get the script to refresh only when there is a new entry into the database table? Also, this may not be PHP but...does anyone know how to stop the annoying click on Internet Explorer when something refreshes? [/snip] 1. Nope, not with PHP. Well, you could but it would require a script running in a loop in the background, checking for new data, then calling a header redirect of some sort. That is kludgy and would require the looping doohickey for each conversation within the chat. 2. You can disable sounds in a themes thingie, depends on which windoze version you own. HTH! Jay -- Marco Tabini President Marco Tabini Associates, Inc. 28 Bombay Avenue Toronto, ON M3H 1B7 Canada Phone: (416) 630-6202 Fax: (416) 630-5057 Web: http://www.tabini.ca -- 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] Refreshing
The image should take care of the click, and also reduce the amount of information transmitted somewhat (although not necessarily, depending on what you send to your iframe). Cheers, Marco On Mon, 2003-06-30 at 14:09, Jeremy Thibeaux wrote: [snip] I have a chat script. I want it to refresh the chat display area whenever there is a new message posted, but not every 10 seconds or so. How could I get the script to refresh only when there is a new entry into the database table? [/snip] I have implemented something along these lines for an online chess game (so the board would only refresh when the other player moves). It did require a loop, as suggested. I used a hidden IFRAME to check the data. Basically, I would refresh the page referred to by the IFRAME every 10 seconds or so, and this page contained JavaScript that invoked a function on the containing page. The JavaScript function on the containing page would then refresh the page when the parameter passed to it indicated that the other player had moved. I did implement the site using PHP, but this really isn't a PHP specific approach. I imagine you would do something very similar for chat (in fact, I had been considering implementing it for the online chess site so that the users could send messages to each other during the course of the game). And there is a performance issue if you are going to support a lot of users at one time; however, at least it is not as bad as refreshing the entire page every 10 seconds (this would be particularly disastrous for my chess board, which contained many images). There are a number of references that talk about this trick if you search on iframe rpc javascript in google: http://www.google.com/search?hl=enie=UTF-8oe=UTF-8q=iframe+rpc+javascript You will still get the clicking, tho. But users' can disable it if it annoys them -- sometimes it is nice to know that something is going on. Hope this helps. Jeremy -- Marco Tabini President Marco Tabini Associates, Inc. 28 Bombay Avenue Toronto, ON M3H 1B7 Canada Phone: (416) 630-6202 Fax: (416) 630-5057 Web: http://www.tabini.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recommended package for online editing of HTML files
Hiya Brad-- We published a news item on this a few days ago; there's a free WYSIWYG editor that works both on IE and Mozilla 1.3 called HTMLArea. You can find it here: http://www.interactivetools.com/products/htmlarea/reviews.html (our news item is at http://phparch.com/newsarchive.php?s=htmlarea). I use it in quite a few applications and it's both very useful and quite stable. Cheers, Marco -- php|architect -- The Magazine for PHP Professionals Get your free copy today at http://www.phparch.com On Tue, 2003-03-18 at 17:50, Brad Hubbard wrote: Can anyone recommend a package suitable for editing HTML files on a remote server through a PHP interface? Basically, an online HTML editor. Cheers in advance, Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] quick question
You should look at E-xact (http://www.e-xact.com). They have a solution they call tagged transactions that actually replaces the credit card numbers with tags that are only meaningful in the context of your merchant account. That way, you can let your customers make repeat purchases without actually having to store CC numbers on your site. Cheers, Marco -- php|architect - The Magazine for PHP Professionals Get your free copy today at http://www.phparch.com On Mon, 2003-03-10 at 11:46, Doug Parker wrote: I'm sending credit card info to a 3rd party credit card processing site. I would like to keep the inputted values and, after the approval, have them appear in the value part of the form so that they don't have to re-input the same values they had just put in for the credit card. how can i do this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Version 5?
On Thu, 2003-03-06 at 23:09, Larry Brown wrote: Someone mentioned a facet of version 5 to be expected that I am really looking forward to. Does anyone know what the release target date is? I didnt see any mention of it on php.net. Version 5 is still being actively developed (at least as far as I know), so chances are that the release date is still a ways off. I've heard anything from Q2-Q3 of 2003 on. You can, however, download the current PHP5 CVS tree. I've been experimenting with it and it's fairly stable--although I've seen some messages that it leaks memory, for testing and learning how the new stuff works it should be fine, IMO. Out of curiosity, which feature were you interested in? Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IRR Function in PHP
On Mon, 2003-02-17 at 16:44, Jonathan Pitcher wrote: We are getting ready to automate a process that was currently done in Excel to a Web page. This process involves an IRR Calculation. Or Internal Rate of Return. I have looked at PHP.net and spent the last couple hours searching for a pre-built function to handle this but have come up blank. Has anyone heard of something written in PHP that can handle this type of calculation?? Never heard of it being done in PHP... what is your scenario? Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IRR Function in PHP
If I may barge in... The IRR represents the actual return of an investment over an arbitrary period of time (usually annualized). Say, for example, that you invest $100 and, after two years, you have $120. Your overall return is 20%. If your interest rate was constant over the two-year period and you never took any money out or put any money in, your annualized IRR, that is the percentage that best approximates how much you've made on a yearly basis, is approximately 9.544% and is calculated through the simple formula IRR = (EndAmount / StartAmount) ^ (1 / NumberofPeriods) - 1. IRR = (120 / 100) ^ (1 / 2) - 1 =~ 0.95445 If it sounds like a straightforward calculation... it isn't, because you rarely have a clean-cut situation like that. Most of the time, you have to deal with variations in the cash flows (interest payments, reinvestments, disbursements, taxes, and so forth) and partial periods. In some cases, the problem can only be solved by interpolation and the calculation can become quite complex. Cheers, Marco On Mon, 2003-02-17 at 16:52, Greg Donald wrote: On Mon, 17 Feb 2003, Jonathan Pitcher wrote: This process involves an IRR Calculation. Or Internal Rate of Return. Sorry, I don't think there are any accountants lurking on the list, so please explain what the actual calculation for an IRR should be. -- Greg Donald http://destiney.com -- Marco Tabini President Marco Tabini Associates, Inc. 28 Bombay Ave. Toronto, ON M3H 1B7 Canada Phone: (416) 630-6202 Fax: (416) 630-5057 Weblog: http://blogs.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IRR Function in PHP -- MORE Info
Hey Jonathan-- This page has an excellent description of what the IRR is and how it's calculated. http://invest-faq.com/articles/analy-int-rate-return.html I'd love to help more than this, but this is quite a bit of work and without the actual spreadsheet I'm not sure that I'd be able to give you meaningful help! Cheers, Marco On Mon, 2003-02-17 at 17:08, Jonathan Pitcher wrote: I received an Excel Spread sheet with built in calculations for creating our rate sheets that we pass out to our branches and so on. In this rate sheet to calculate our APR the spread sheet calls built in Finance Functions IRR Internal Rate of Return PMT Calculates a Payment PV Calculates Present Value My goal is to turn the excel sheet into a DB Driven Rate management system for our Internal and External websites. With all input and export going through a web based system. I have all the information I need but I can't seem to find the right formulas to make the calculations. Thanks again, Jonathan -- Marco Tabini President Marco Tabini Associates, Inc. 28 Bombay Ave. Toronto, ON M3H 1B7 Canada Phone: (416) 630-6202 Fax: (416) 630-5057 Weblog: http://blogs.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file-upload.errors
On Mon, 2003-02-17 at 21:44, Nate wrote: Does this mean the file was examined by the browser and it determined it was too large OR does it have to upload the file temporarily and then check to see if its too large? It sounds like browser would first examine the file before it gets uploaded, however, if I try to upload a 1mb file it takes noticably longer to produce an error than say a 501 byte file. Please anyone that can help me with this I would really appreciate it. The browser *should* check but it doesn't. In fact, the limit that's being exceeded is probably the one set in your php.ini configuration file. In any case, it's generally a bad idea to trust the client with performing any checks for anything other than the convenience of the user, because it's very easy for a malicious user to send out a request that contains completely arbitrary data ignoring completely all the controls that are built into your HTML file. Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers bust ?
On Sat, 2003-02-15 at 09:01, Malcolm wrote: Hello, I've been fooling with this for a few days now. I'm getting a hearders already sent error. I know it means I've got output before the header but I can't figure how else to do this. Hi Malcom-- Looks like you are outputting data right after your script starts (on line to, you have an echo right away). You should either (a) turn on output buffering, which should take care of the problem, or (b) (the best solution because it makes your script behave the way it should) move things around so that the decision on the redirect is made before outputting anything. Try adding this at the beginning, before the echo: if ($dog == 'mal') header ('Location: ../aamaillist/ml_menu.php'); Hope this helps! Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Block direct image loads but allow them in PHP
On Sat, 2003-02-15 at 11:00, Michael Mulligan wrote: Hi I have a bit of a problem which might just be due to my lack of knowledge with Apache. Basically, what I want to do is to *not* allow users to enter particular URLs in their browser (namely to *.jpg and *.xml files under a particular directory, let's call it imagesDir). However, I can't simply Deny all or stick a .htaccess in the folder because I *do* want these images to load from within a particular PHP file I have coded. I guess the easiest would be to filter those images through a php script. Your PHP script would perform whatever checks are needed (for example, you could check ther HTTP_REFERER variable, or a shared token with the originating PHP script) and then output the image only if it's appropriate to do so. This way, your images would not be accessible to your users at all--unless you wanted them to be. Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Block direct image loads but allow them in PHP
On Sat, 2003-02-15 at 11:13, Michael Mulligan wrote: If the user knew the actual URL of the image though, wouldn't they be able to get around a script like this by simply typing it into their web browser? Thanks! :-) Only if you let them. The PHP script allows to put the appropriate checks in place. For example, if you use sessions, you can verify that the session is still valid and that the user has, indeed, the right to access that image. At a later time, even if another user types in the same URL but does not have a valid session (or a variable inside the session that contains the right data), you would be able to block him from reading the image. Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Block direct image loads but allow them in PHP
On Sat, 2003-02-15 at 11:24, Michael Mulligan wrote: The script that I will distribute will always make use of a very particular directory structure. In imageDir, there will always be a specifically named XML file that points to a bunch of images in the directory. However, given security checks that I put in my script, not all of those images should be publicly viewable. However, if a savvy user were to just load this XML doc up in their web browser, they will have a complete listing of URLs to all of my images. I cannot modify this XML file. (which is why I want to block a user from loading, say myserver.com/imageDir/picture.jpg) Will your proposed idea still work in this situation? Yes--but you need to make the image inaccessible to the outside (simply put them in a folder that can't be seen from the web). Here's an example. Suppose you have a script called page.php that needs an image called img.jpg. Instead of calling img.jpg, you call another script, serveimage.php as follows: img src=serveimage.php?img=img.jpg Now, in serveimage.php you do this: ?php $img = $_GET['img']; // First, check that the user is not trying to trick us // into revealing a file that we shouldn't reveal. // Note: this is a *very* simplistic approach--you will probably // want to add your own if (substr ($img, '/')) die('Invalid file name'); // Now, check if the user has permission to this file. You don't // explain how you do this, so I'll leave this to an external // function called check_permission ($file) that returns true if the // user is able to see that file and false otherwise if (check_permission ($img)) { // Tell the browser this is an image // Note, you will probably have to change this depending // on the file type header ('Content-type: img/jpg'); readfile ($img); } else die (Unauthorized access); ? Essentially, what I'm doing is I'm replacing a file with a script that first checks the permissions and then, if the user is authorized, outputs the file to the browser. This way, if the user is not authorized to download a file, it will be blocked. Obviously, the files themselves should be inaccessible to the web *except* through your scripts. Hope it's a bit clearer now! Cheers, Marco -- Marco Tabini President Marco Tabini Associates, Inc. 28 Bombay Ave. Toronto, ON M3H 1B7 Canada Phone: (416) 630-6202 Fax: (416) 630-5057 Weblog: http://blogs.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Job Opportunity
Don't apologize... pass the job offers around instead ;-) My Evolution has decided that I don't have a Calendar anymore. No matter how hard I try. *sigh* Cheers, Marco On Mon, 2003-01-20 at 13:53, Ray Hunter wrote: I apologize everyone...evolution is going crazy... Ray -- Marco Tabini [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] x12 837
On Thu, 2003-01-16 at 16:10, Rodney Green wrote: Just curious. What is an 837? I'm curious, too... what is it? Not a good start, if you were hoping to get an answer eh? :-))) Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: difference between shared and /usr/bin/mysql
On Wed, 2003-01-15 at 09:36, Leon Mergen wrote: Somebody correct me if I'm wrong, but from what I know is that when using shared it is compiled as a shared object and only loaded when needed. This decreases ram usage (which is good) , but increases load (which is bad) . AFAIK, you should use a shared module when you're also using other Apache modules that interface to MySQL. When you ./configure the PHP interpreter, you get this info: | You chose to compile PHP with the built-in MySQL support. If you | | are compiling a server module, and intend to use other server | | modules that also use MySQL (e.g, mod_auth_mysql, PHP 3.0, | | mod_perl) you must NOT rely on PHP's built-in MySQL support, and | | instead build it with your local MySQL support files, by adding| | --with-mysql=/path/to/mysql to your configure line.| Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] restrictions
Hello Bruce-- That depends on what restrictions are imposed on your box, of course. Does your company use an SMTP-compatible mail server for your internal mail? If so, you could use the server your mail client points to to perform your tests. Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! GET YOUR FREE COPY TODAY! Simply register download! ---BeginMessage--- I find that my the company that I work for is a little over protective. My machine is quite restricted (as in firewall and accessability) when it comes to ftp and telnet. Well basically my hands are tied in that sense. I am testing my database build on my local machine which runs fine and all. I am curious though as to how these restrictions may affect my attempts to send mail() I have tried various external SMTP srervers (i am running off winxp pro) in my php.ini file and I get nothing. Just the error code I have placed in (below). ?php if (mail([EMAIL PROTECTED], this title, testing)) echo Mail Sent!; else echo Mail could not be sent...; ? Warning: Failed to connect to mailserver, verify your SMTP setting in php.ini in c:\inetpub\wwwroot\_tasks\email.php on line 21 Mail could not be sent... Would my local machines restrictions be stopping the mail function from communicating with the SMTP server?? Cheers ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] restrictions
Couple of suggestions: 1) Try connection to the SMTP server manually with Telnet, and see if you discover more that way 2) Simply use the same SMTP server that is configured in your mail client at work Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! ---BeginMessage--- Well I can't be totally sure but I think all outgoing mail points to an external SMTP server. -Original Message- From: Marco Tabini [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 08, 2003 9:11 AM To: Bruce Levick Cc: [EMAIL PROTECTED] Subject: Re: [PHP] restrictions Hello Bruce-- That depends on what restrictions are imposed on your box, of course. Does your company use an SMTP-compatible mail server for your internal mail? If so, you could use the server your mail client points to to perform your tests. Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! GET YOUR FREE COPY TODAY! Simply register download! ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] restrictions
It should say port 25. If it's just a typo in your message, then it could either be the restrictions or a general network problem--I know this sounds stupid, but can you connect *at all* to anything else--ie. a website? Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! ---BeginMessage--- Thanks, Tried this and I get. Cannot opeen connection to host on port 23 -Original Message- From: Timothy Hitchens (HiTCHO) [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 08, 2003 9:32 AM To: Bruce Levick; 'Marco Tabini' Cc: [EMAIL PROTECTED] Subject: RE: [PHP] restrictions In windowsxp do the following: Start - Run Open: cmd At the shell type: telnet x.x.x.x 25 x.x.x.x being the smtp server If you get a prompt then you have other issues such as relay etc etc HiTCHO has Spoken! Timothy Hitchens (HiTCHO) [EMAIL PROTECTED] -Original Message- From: Bruce Levick [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 8 January 2003 9:25 AM To: Marco Tabini Cc: [EMAIL PROTECTED] Subject: RE: [PHP] restrictions Well I can't be totally sure but I think all outgoing mail points to an external SMTP server. -Original Message- From: Marco Tabini [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 08, 2003 9:11 AM To: Bruce Levick Cc: [EMAIL PROTECTED] Subject: Re: [PHP] restrictions Hello Bruce-- That depends on what restrictions are imposed on your box, of course. Does your company use an SMTP-compatible mail server for your internal mail? If so, you could use the server your mail client points to to perform your tests. Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! GET YOUR FREE COPY TODAY! Simply register download! -- 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 ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] loading a different web page ...
Check the header() function--you want header (Location: http://www.xyz.com;). It has to be outputted before any other output. Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! ---BeginMessage--- i know this is an elementary question, but i can't even figure out what to search for at php.net i need php code that, when executed, takes you to a different web page, i.e. when browser goes to www.abc.com, he's automatically redirected to www.xyz.com ... thanks in advance for the help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No Idea - Comparing Lines
Hi Chris-- Try this: ?php $lines = file ('test.txt'); $i = 0; while ($i count ($lines)) { preg_replace ('/([^|]*):([^|]*)|/e', '$data[$1] = $2', $lines[$i]); if ($i 0) { $kbitsout = float) $data['OctetsOut'] - $olddata['OctetsOut']) / ($data['UnixTime'] - $olddata['UnixTime'])) * 8 ) / 1000; print str_pad ($i, 2, ' ', STR_PAD_LEFT) . ' -- ' . number_format ($kbitsout, 2) . kbits/s\n; } $olddata = $data; $i++; } ? I suggest you add some code to check for divisions by zero, depending on whether your data requires it! Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! ---BeginMessage--- Ok here is what I did but it does not do anything. I verified that is opening the file ok and everything, but it shows nothing. It doesn't even produce an error. I am sure there is an easier way than looping twice, but this is how I have it for now. $Lines = array(); $TempDir = tempdata; $DataFromFile = file($TempDir/$Dat.txt); while(list(,$oneline) = each($DataFromFile)) { array_push($Lines, $oneline); } $LineCount = 1; while(list(,$oneline) = each($DataFromFile)) { $PriorLineCount = $LineCount - 1; list($OctetsInB,$OctetsOutB,$TimeB) = split(|, $Lines[$LineCount]); list($OctetsInA,$OctetsOutA,$TimeA) = split(|, $Lines[$PriorLineCount]); // After much help and work with Harry, this is the formula we came up with to show data rates over time. // (((Counter_Now - Counter_Before) / (Time_Now - Time_Before(converted to seconds))) * 8)) / 1000 = kbits per hour $kbitsout = ((($OctetsOutB - $OctetsOutA) / ($TimeB - $TimeA)) * 8 ) / 1000; print $kbitsout Kbits - $LineCountbr\n; $LineCount++; } Christopher J. Crane [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Thank you, I am going to try this now. Petre Agenbag [EMAIL PROTECTED] wrote in message 1041861992.1993.36.camel@DELL">news:1041861992.1993.36.camel@DELL... When you read the first line, split the data into it's components , then assign each value to a variable. Call them: $octet_1,$unix_time_1 etc. Now, start the loop. Inside the loop, read the next line, assign to $octet_2, $unix_time_2 etc. Do your calculations ( $answer = $octet_2 - $octet_1 etc. ) Now, before exiting the loop: $octet_1 = $octet_2; $unix_time_1 = $unix_time_1; etc On Mon, 2003-01-06 at 15:51, Christopher J. Crane wrote: Ok, this is the first time I will post a message without a line of code. I am not sure how to go about this task. So I will describe it and maybe someone will have some thoughts. I use PHP to connect to our many routers and get data using snmp. I have written a script that refreshes itself every 10 secs. It writes the data to a text file. The key element of this data is the Octet counters, or the amount of data that has been transfered both in and out. To keep it simple, I will only talk about outs. In order to find the amount od data being transfered, I have to compare two lines. Then run a calculation on that and then push that data into an array to plot on a chart later on. Here is an example of the file the data is written to: OctetsIn:4300492881|OctetsOut:4300544503|UnixTime:1041629017 OctetsIn:4305184236|OctetsOut:4305234971|UnixTime:1041629031 OctetsIn:4308716675|OctetsOut:4308782481|UnixTime:1041629044 OctetsIn:4312595737|OctetsOut:4312685815|UnixTime:1041629058 OctetsIn:4315910414|OctetsOut:4315961443|UnixTime:1041629072 OctetsIn:4318948400|OctetsOut:4318975102|UnixTime:1041629085 OctetsIn:4322040239|OctetsOut:4322091605|UnixTime:1041629098 OctetsIn:4324981522|OctetsOut:4325033235|UnixTime:1041629111 OctetsIn:4327971528|OctetsOut:4328029496|UnixTime:1041629125 OctetsIn:4332318792|OctetsOut:4332379277|UnixTime:1041629138 OctetsIn:4335594241|OctetsOut:4335635318|UnixTime:1041629153 OctetsIn:4339008729|OctetsOut:4339048246|UnixTime:1041629166 OctetsIn:4342539875|OctetsOut:4342591776|UnixTime:1041629180 OctetsIn:4346070439|OctetsOut:4346127821|UnixTime:1041629193 OctetsIn:4350288360|OctetsOut:4350355417|UnixTime:1041629206 I can open the file and read the contents line by line split up but the delimiters and get the data I needbut this is what has to happen. If PHP is on line 1, do nothing (it's needs two lines to compare against) If it's on line 2, then subtract Line 1, OctetsOut from Line Line 2 OctetsOut. Then do the same with the UnixTime. Now run a calculation on that data and push that into an array as the first data point. Now move on, with a loop I would assume, and do the same for lines 2 and 3, and so on, until we reach the end. There could be 5 lines or 500 lines. I can loop through the file and do everything, the biggest problem I am
Re: [PHP] mail attachments
Nope--it's a bit more complicated than that. However, there are a number of classes out there that can help you out with that. Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! ---BeginMessage--- I hope you all had a great New Year. Is attaching a document to an e-mail simply a matter of adding a new header in the mail function? Thanks, Eddie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] call_user_method_array
Chris-- On my system, the function works as expected (at least as I understand it): myFunc receives the parameters Hello! and array(this=that), which is what you pass to it in the first place. Were you expecting it to expand $myArrayVar into individual parameters? If so, that's not how it works--it expands the values of the array you pass to it (which, in this case, you build explicitly during the call), but doesn't expand any arrays that may be within that array. Also, call_user_method_array is now deprecated--you should use call_user_func_array instead (the manual page for call_user_method_array explains how to do this with a class method). Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! ---BeginMessage--- How does this function really work? I've been beating my head against the wall for the last 8 hours trying to figure it out. This is what I'm trying and it isn't working: {this is a very simplified version} class MyClass { function myFunc( $stringVar, $arrayVar ) { echo $stringVarbr\n; echo pre\n; print_r( $arrayVar ); echo /pre\n; } } $myClass = new MyClass(); $myStringVar = Hello!; $myArrayVar = array( this = that ); call_user_method_array( 'myFunc', $myClass, array( $myStringVar, $myArrayVar )); What's happening is that the values in the array are not being passed individually but instead is being passed as an array. Shouldn't it be passing them individually? If not, it wouldn't seem as if you could use this function generically. You'd have to specificy write your method so it can (possibly) be called by this function. And that just doesn't seem right. Any light anyone can shed on this would be very much appreciated!! Chris ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] creating a .doc file in php
My guess is that your best bet is creating either an HTML or RTF documents, both of which are readable by MS Word. RTF is well documented and it should be fairly easy to work with--you can save a template with placeholders and simply replace them, since it's entirely text-based. Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! ---BeginMessage--- I am creating a 'vacation' scheduling webpage for my company. Currently, when we want a day off, we fill out a document in word and send it to our supervisor. The page I am working on will have a calendar that displays who is off when. I would like for the employees to click on a date, enter their information and then when the info is saved to the db, I would like to have the .doc automatically created with the info and sent to their supervisor. Is this possible?? Thanks, Eddie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] creating a .doc file in php
Yep. There should be a few SMTP/Email composing classes that can help you with the attachment part. Just remember to delete your temp file once you're done and you should be fine. Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! ---BeginMessage--- Thanks Marco, So I would just create the .rtf file with php, then store it on the server and attach it to the e-mail? Thanks, Eddie -Original Message- From: Marco Tabini [mailto:[EMAIL PROTECTED]] Sent: Monday, December 30, 2002 9:17 AM To: Edward Peloke Cc: [EMAIL PROTECTED] Subject: Re: [PHP] creating a .doc file in php My guess is that your best bet is creating either an HTML or RTF documents, both of which are readable by MS Word. RTF is well documented and it should be fairly easy to work with--you can save a template with placeholders and simply replace them, since it's entirely text-based. Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple forms
You should be able to insert a hidden field in your form and that check against that in your PHP script to determine which (if any) of your form was submitted: form input type=hidden name=f value=1 /form form input type=hidden name=f value=2 /form in your script: ?php switch ($_POST['f']) { case '1': // first form break; case '2': // second form break; default: // no form } That's just one way you can do it. Hopefully it addresses your problem! Cheers, Marco -- Marco Tabini Publisher php|architect A Publication of the MTA Group, Inc. 28 Bombay Ave. Toronto, ON M3H 1B7 Canada Phone: (416) 630-6202 Fax: (416) 630-5057 ---BeginMessage--- Hi all, I have an update page that has a form in it. However, I want to add another form in the same page. My current form acts upon itself (i.e. Action = the same page). If I set up another form to do the same, how would my PHP determine with action submit button was acted upon? Currently, for the single form here is how it knows a form was submitted: if ((isset($HTTP_POST_VARS[MM_update])) ($HTTP_POST_VARS[MM_update] == form1)) { How would I test which form submitted the action? Thanks and if I didn't make myself clear, I apologize. Doug -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Load Data Infile
I'm not sure how MySQL works under Windows, but you should either use double backslashes (\\) instead of single backslashes or use forward slashes (/) instead. MySQL is trying to escape your string. Cheers, Marco -- php|architect - The Magazine for PHP Professionals The monthly magazine dedicated to the world of PHP programming Check us out on the web at http://www.phparch.com! ---BeginMessage--- Off topic but I hope somebody can help. Using MS Win98 / mySQL. I'm trying to use LOAD DATA INFILE and coming up empty. My text file is named: test.txt .. and is stored in C:\TextFiles on the command line I type: .. mysql LOAD DATA INFILE C:\TextFiles\test.txt INTO TABLE tony; ... I get: ERROR 1105 File c:\TextFile\ est.txt not found (Errcode:2) \\please note that the t in test is not there. Any help would be greatly appreciated. Happy holidays, Tony Ritter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Does PHP recognize multiple selections in a form?
Hello Micah-- Yes, PHP supports multiple selections, but you need to change the name of the control from submitID to submitID[], so that it will become an array once inside your script. Hope this helps! Marco -- php|architect - The Magazine for PHP Professionals The monthly magazine dedicated to the world of PHP programming Check us out on the web at http://www.phparch.com! ---BeginMessage--- grrr... I am trying to get several values from a selection form field (using multiple) into PHP. Is this possible? The code I'm using to test this is below. After running the code and selecting more than one field, the last field (the greatest number) is the only one that shows up as the only input from the selection part of the form!! Is there any other way?? thanks, Micah ?php $phpSelf = $_SERVER['SCRIPT_NAME']; $phpFile = $_SERVER['SCRIPT_FILENAME']; $phpName = 'Multiple Selection Test'; $phpTimeRan = date('H:i.s'); $a='a'; $b='b'; ? html headtitle?php echo $phpName; ?/title/head body h2?php echo $phpName; ?/h2 i[?php echo $phpSelf; ?] @ ?php echo $phpTimeRan; ?/i brbr form action=?php echo $phpSelf; ? method=POST table bgcolor=#003300 cellpadding=4 cellspacing=0 border=4 bordercolor=#00 style=color:#ff; trtdItem/td/tr tr tdselect name=submitID size=5 MULTIPLE ?php for ($i=0;$i10;$i++) { echo 'option value='.$i.''.$i.'/option'.\n; } ? /select/td /tr /table brbr input type=hidden name=a value=?php echo $a; ? input type=hidden name=b value=?php echo $b; ? input type=submit name=submit /form ?php echo 'textarea readonly rows=12 cols=50 name=NULL'; var_dump($_POST); echo '/textarea'; echo 'brbrhr'; highlight_file($phpFile); ? /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Subtraction
I don't think you can use strtotime in that case. However, assuming that your data is properly formatted every time, you can use a simple function like this (I'm doing it from memory, so it might not actually work): ?php function conv_time ($s) { preg_match (/^([0-9]*) days, ([0-9]*)\:([0-9]*)\:([0-9]*)(\.[0-9]*)$/, $s, $res); return $res[1] * 86400 + $res[2] * 3600 + $res[3] * 60 + $res[4] + $res[5]; } echo number_format (conv_time (181 days, 7:16:6.75) - conv_time (181 days, 7:11:06.66), 2); ? Hope this helps. Cheers, Marco -- php|architect - The Magazine for PHP Professionals The monthly magazine dedicated to the world of PHP programming Check us out on the web at http://www.phparch.com! ---BeginMessage--- I have two periods in time from a Cisco router that I would like to find the difference in seconds. I am not sure the best way to do this since it is not a date, but rather an amount of time since last reset. Here is the numbers 181 days, 7:11:06.66 //stands for 181 days, 7 hours, 11 minutes, 6.66 seconds. The next is 181 days, 7:16:6.75 //stands for 181 days, 7 hours, 16 minutes, 7.75 seconds. I would probably shave off the .66 and .75 seconds while it was still a string. It may be faster to round when it's in seconds, I really don't know. Then what do I do? I was thinking of using strtotime(); but because it's not really a date, I am at a loss for what to do. Any help with this would be great. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Resource limit/performance questions
IMHO it depends on the amount of operations you have to perform on your rows. If manipulating 2,600 rows takes several seconds, then either you're performing some really complicated data manipulation or your db could use some optimization. I have an application that manipulates ~150,000 rows on a Pentium II 350 MHz and that takes at most half a second (although I'm doing really simple statistical stuff). Cheers, Marco -- php|architect - The Magazine for PHP Professionals The monthly magazine dedicated to the world of PHP programming Check us out on the web at http://www.phparch.com! ---BeginMessage--- I'm working on a php/mysql ap, which looks as though it will be dealing with an average of 160,000 rows of short text entries = 32 megs of drives space Anybody have ideas about what if any limits I might hit? And how I might be able to determine any limits at this point when we have only 2 weeks (.6 megs and 2600 rows) of what will be 2 years of data? I have full access to my linux server. I notice that when executing one set of statements for one page, it is now using in the 80 to 90% range of CPU states, and works for maybe 3 or 4 seconds to return the querys. I am at present doing this testing on a 550 mhz processor, but will be running the ap on a dual 500s. Am I getting totally out of hand in thinking I can do this? TIA -- John Hinton - Goshen, VA. http://www.ew3d.com Those who dance are considered insane by those who can't hear the music -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Resource limit/performance questions
Well, then, assuming your complexity grows linearly, I guess you'll have to wait a few minutes with 160,000 rows on which you can expect to perform 16,000 queries... You mention that you perform the queries on objects--can you elaborate on this point? Marco -- php|architect - The Magazine for PHP Professionals The monthly magazine dedicated to the world of PHP programming Check us out on the web at http://www.phparch.com! ---BeginMessage--- In one main instance, I'm doing 10 querys on an array of 26 unique objects extracted from the database. So, I suppose it is running 260 queries on 2600 lines of code. Marco Tabini wrote: IMHO it depends on the amount of operations you have to perform on your rows. If manipulating 2,600 rows takes several seconds, then either you're performing some really complicated data manipulation or your db could use some optimization. I have an application that manipulates ~150,000 rows on a Pentium II 350 MHz and that takes at most half a second (although I'm doing really simple statistical stuff). Cheers, Marco -- php|architect - The Magazine for PHP Professionals The monthly magazine dedicated to the world of PHP programming Check us out on the web at http://www.phparch.com! Subject: [PHP] Resource limit/performance questions Date: Fri, 20 Dec 2002 15:31:58 -0500 From: John Hinton [EMAIL PROTECTED] To: [EMAIL PROTECTED] [EMAIL PROTECTED] I'm working on a php/mysql ap, which looks as though it will be dealing with an average of 160,000 rows of short text entries = 32 megs of drives space Anybody have ideas about what if any limits I might hit? And how I might be able to determine any limits at this point when we have only 2 weeks (.6 megs and 2600 rows) of what will be 2 years of data? I have full access to my linux server. I notice that when executing one set of statements for one page, it is now using in the 80 to 90% range of CPU states, and works for maybe 3 or 4 seconds to return the querys. I am at present doing this testing on a 550 mhz processor, but will be running the ap on a dual 500s. Am I getting totally out of hand in thinking I can do this? TIA -- John Hinton - Goshen, VA. http://www.ew3d.com Those who dance are considered insane by those who can't hear the music -- 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 -- John Hinton - Goshen, VA. http://www.ew3d.com Those who dance are considered insane by those who can't hear the music -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Resource limit/performance questions
Well, the execution time depends on a number of factors. If your tables are indexed properly and you take advantage of the indexes, then the growth in execution time is not linear (I'm guessing the indexes are maintained through balanced or semi-balanced trees or a similar method). However, in your case, it's not the execution time but the number of executions. Even under the best of circumstances, if the number of queries increases in relation to the number of records, then you will notice a proportional slowdown. If the queries do not use your indexes, then the slowdown will probably be geometric, since the SQL engine will have to spend more time sorting through the records for each query. I usually say queries... it's worked so far :-) Marco -- php|architect - The Magazine for PHP Professionals The monthly magazine dedicated to the world of PHP programming Check us out on the web at http://www.phparch.com! ---BeginMessage--- I was wondering if this would grow linearly... as the data collects? So, if it takes 3 seconds to do 2600 rows, will it take 30 seconds to do 26000 rows? I am using a simple for statement to send the 26 records through the 10 querys. A typical select is: SELECT DISTINCT DATE_FORMAT(date, '%Y%m%d'), field2 FROM $table WHERE field2 NOT LIKE '$anoption' AND field3 LIKE '$field2[$i]' AND TO_DAYS(NOW()) - TO_DAYS(date) = 30; This select is run over with five different date = numbers... then done without the DISTINCT again over the same five time periods. The array of records being sent through the 10 querys should not grow too very large (26 in fact is a fairly high representation of what would be average), whereas the number of records will grow at a fairly predictable rate, with the same basic number of records added each day. I should have said records, instead of objects. (too many sessions with crAccess, too little time talking to real people about databases) Now... would you spell that querys or queries? Marco Tabini wrote: Well, then, assuming your complexity grows linearly, I guess you'll have to wait a few minutes with 160,000 rows on which you can expect to perform 16,000 queries... You mention that you perform the queries on objects--can you elaborate on this point? Marco -- php|architect - The Magazine for PHP Professionals The monthly magazine dedicated to the world of PHP programming Check us out on the web at http://www.phparch.com! Subject: Re: [PHP] Resource limit/performance questions Date: Fri, 20 Dec 2002 15:47:07 -0500 From: John Hinton [EMAIL PROTECTED] To: Marco Tabini [EMAIL PROTECTED] CC: [EMAIL PROTECTED] [EMAIL PROTECTED] References: [EMAIL PROTECTED] [EMAIL PROTECTED] In one main instance, I'm doing 10 querys on an array of 26 unique objects extracted from the database. So, I suppose it is running 260 queries on 2600 lines of code. Marco Tabini wrote: IMHO it depends on the amount of operations you have to perform on your rows. If manipulating 2,600 rows takes several seconds, then either you're performing some really complicated data manipulation or your db could use some optimization. I have an application that manipulates ~150,000 rows on a Pentium II 350 MHz and that takes at most half a second (although I'm doing really simple statistical stuff). Cheers, Marco -- php|architect - The Magazine for PHP Professionals The monthly magazine dedicated to the world of PHP programming Check us out on the web at http://www.phparch.com! Subject: [PHP] Resource limit/performance questions Date: Fri, 20 Dec 2002 15:31:58 -0500 From: John Hinton [EMAIL PROTECTED] To: [EMAIL PROTECTED] [EMAIL PROTECTED] I'm working on a php/mysql ap, which looks as though it will be dealing with an average of 160,000 rows of short text entries = 32 megs of drives space Anybody have ideas about what if any limits I might hit? And how I might be able to determine any limits at this point when we have only 2 weeks (.6 megs and 2600 rows) of what will be 2 years of data? I have full access to my linux server. I notice that when executing one set of statements for one page, it is now using in the 80 to 90% range of CPU states, and works for maybe 3 or 4 seconds to return the querys. I am at present doing this testing on a 550 mhz processor, but will be running the ap on a dual 500s. Am I getting totally out of hand in thinking I can do this? TIA -- John Hinton - Goshen, VA. http://www.ew3d.com Those who dance are considered insane by those who can't hear the music -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] key pairs
This is a bit crude but should work: ?php $data = EOT SHIP TO: Business Name: Contact Name: Ashley Kirchner Day Number: 303 442-6410 Evening Number: Fax Number: Address: 3550 Arapahoe Ave., Ste. #6 Address: Address: City: Boulder State/Province: CO Zip/Postal Code: 80303 Country: USA BILL TO: Business Name: Contact Name: Ashley M. Kirchner Day Number: 303 4426410 Evening Number: Fax Number: 303 442-9010 Address: 3550 Arapahoe Avenue Address: Suite #6 Address: City: Boulder State/Province: CO Zip/Postal Code: 80303 Country: USA EOT; $ship_to = array(); $bill_to = array(); $state = 0; // 0 = ship_to, 1 = bill_to function create_data ($s) { global $ship_to; global $bill_to; global $state; $s[1] = trim ($s[1]); $s[2] = trim ($s[2]); if (!strcmp ($s[1], 'SHIP TO')) $state = 0; elseif (!strcmp ($s[1], 'BILL TO')) $state = 1; else { if ($state) $bill_to[$s[1]] = $s[2]; else $ship_to[$s[1]] = $s[2]; } return $s[0]; } preg_replace_callback (/(.*)\:[ ]*(.*)?[\n]?/, create_data, $data); print_r ($ship_to); print_r ($bill_to); ? Note that I made a bunch of assumptions here--that the data is always properly formatted, that there is only one record in the $data, and that you will later manipulate the key names so that they will actually work as database columns. Still, this way you can manipulate each value directly in the function, which is something that I always find very practical, so you can add whatever additional checks need to be performed. Hope this helps! Cheers, Marco -- php|architect - The magazine for PHP Professionals The monthly worldwide magazine dedicated to PHP programmers Come visit us at http://www.phparch.com! ---BeginMessage--- I have the following bit of information coming in that I need to generate key pairs of so I can drop it all into a database. I'm creating tables for each section (SHIP_TO and BILL_TO) with matching Unique_IDs. What's the best way to go about this (creating the pairs, stripping off excess spaces from some fields that have them after the last character, etc., etc.) -- data -- SHIP TO: Business Name: Contact Name: Ashley Kirchner Day Number: 303 442-6410 Evening Number: Fax Number: Address: 3550 Arapahoe Ave., Ste. #6 Address: Address: City: Boulder State/Province: CO Zip/Postal Code: 80303 Country: USA BILL TO: Business Name: Contact Name: Ashley M. Kirchner Day Number: 303 4426410 Evening Number: Fax Number: 303 442-9010 Address: 3550 Arapahoe Avenue Address: Suite #6 Address: City: Boulder State/Province: CO Zip/Postal Code: 80303 Country: USA -- -- W | I haven't lost my mind; it's backed up on tape somewhere. + Ashley M. Kirchner mailto:[EMAIL PROTECTED] . 303.442.6410 x130 IT Director / SysAdmin / WebSmith . 800.441.3873 x130 Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6 http://www.pcraft.com . . .. Boulder, CO 80303, U.S.A. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail()
You need to use HTML mail. There's an example on how to this in the manual. Marco -- php|architect - The Magazine for PHP Professionals The monthly magazine dedicated to the world of PHP programming Check us out on the web at http://www.phparch.com! ---BeginMessage--- Is there anything special you have to do to send a link in an e-mail with the mail function? I used the mail function this weekend and set the mail contents like this: $mailcontents=Thank you for registering with us /n .http://www.oursite.com;; But in the actual e-mail sent, the link was plain text,not a link. Can I force it to be a link? Thanks, Eddie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP shell scripting not working right?
In Unix you need to specify the working folder when you are launching an executable, otherwise Bash will try to look into its search path, which does not include the current folder. Try: ./test.php That should work. BTW--running test by itself only *looks* like hitting enter--it's really a valid command. Try man test for more info. Cheers, Marco -- php|architect - The Magazine for PHP Professionals The monthly magazine dedicated to the world of PHP programming Check us out on the web at http://www.phparch.com! ---BeginMessage--- I'm trying to do shell scripting in PHP. I have PHP installed in /usr/bin/php. I have the following script: #!/usr/bin/php -q ?php print Success!\n; ? It's saved as test.php and CHMODed to 777. When I type test.php at the command line, it says: bash: test.php: command not found When I type test, it acts like I just hit enter. Typing /usr/bin/php -q test.php does work. Does anyone know what I'm doing wrong? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Divide into words
You could use strpos--there are easier ways if you don't need the offsets. Example: ?php $inputstring = This is a string ; $pos = 0; $oldpos = 0; $result = array(); $inputstring .= ' '; while (!(($pos = (strpos ($inputstring, ' ', $pos))) === false)) { if ($pos != $oldpos) $result [substr ($inputstring, $oldpos, $pos - $oldpos)] = $oldpos; $pos++; $oldpos = $pos; } print_r ($result); ? This is from memory, but it looks like it should work even for weird strings like the one above. Cheers, Marco -- php|architect - The magazine for PHP Professionals The monthly worldwide magazine dedicated to PHP programmers Come visit us at http://www.phparch.com! ---BeginMessage--- Hi! For example i have some words: Today is very beautiful day and sun is shining What i want to get from this is array words [Today] = 0 [Is] = 6,30 [Very] = 8 [beautiful] = 12 .. Can somebody please help me with this. Those nubers are position of special word in above sentence. If word repeates i want to have both positions saved in same row like word is. I tried something but i think it's to lame. -- bye, Uros -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Divide into words
John, I'm not sure this will work if there is more than one space between words. Also, my previous example won't work if there are duplicate words (although it's easy to make an array out of each word and solve the problem), nor if the words are delimited by any character other than spaces, in which case regex are probably our best bet. Cheers, Marco -- php|architect - The magazine for PHP Professionals The monthly worldwide magazine dedicated to PHP programmers Come visit us at http://www.phparch.com! ---BeginMessage--- For example i have some words: Today is very beautiful day and sun is shining What i want to get from this is array words [Today] = 0 [Is] = 6,30 [Very] = 8 [beautiful] = 12 .. Can somebody please help me with this. Those nubers are position of special word in above sentence. If word repeates i want to have both positions saved in same row like word is. I tried something but i think it's to lame. Well you could've at least shown us what you had so far instead of letting us solve the problem for you: $string = Today is a very beautiful day and the sun is shining; $words = explode( ,$string); $pos = 0; foreach($words as $word) { if(isset($w[$word])) { $w[$word] .= ,$pos; } else { $w[$word] = $pos; } $pos += strlen($word) + 1; } print_r($w); ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] Divide into words
Yes, but my example was geared towards trying to work through a more generic scenario. I'll bet if you try using perl regex with callback it'll be even faster. Marco -- php|architect - The magazine for PHP Professionals The monthly worldwide magazine dedicated to PHP programmers Come visit us at http://www.phparch.com! ---BeginMessage--- Hi! I have dome almost the same $input = 'Today is a very beautiful day and the sun is shining'; $output = array(); $words = explode(' ',$input); $cur_pos = 0; foreach($words as $word) { if(!empty($output[$word])){ $output[$word] .= ','.$cur_pos; } else { $output[$word] = $cur_pos; } $cur_pos += strlen($word) + 1; } unset ($word); but i thought if there is some better way. I also tried Marco's example and adjust it a little bit to get the same results. And here is some benchmark i have. with this example i get 0.0024310350418091 and with Marco's i get 0.0034389495849609s So using two array is faster anyway. Probably of explode speed. -- bye, Uros Monday, December 16, 2002, 6:36:37 PM, you wrote: For example i have some words: Today is very beautiful day and sun is shining What i want to get from this is array words [Today] = 0 [Is] = 6,30 [Very] = 8 [beautiful] = 12 .. Can somebody please help me with this. Those nubers are position of special word in above sentence. If word repeates i want to have both positions saved in same row like word is. I tried something but i think it's to lame. JWH Well you could've at least shown us what you had so far instead of JWH letting us solve the problem for you: JWH $string = Today is a very beautiful day and the sun is shining; JWH $words = explode( ,$string); JWH $pos = 0; JWH foreach($words as $word) JWH { JWH if(isset($w[$word])) JWH { $w[$word] .= ,$pos; } JWH else JWH { $w[$word] = $pos; } JWH $pos += strlen($word) + 1; JWH } JWH print_r($w); JWH ---John W. Holmes... JWH PHP Architect - A monthly magazine for PHP Professionals. Get your copy JWH today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session: I RTFM
Single quotes are normal strings. Double quotes are strings in which substitutions can take place. For example: ?php $a = 'test'; echo '$a'; // outputs $a echo $a; // outputs test ? Double quotes also expand escape strings (e.g.\n) whereas single quotes don't. Cheers, Marco -- php|architect - The Magazine for PHP Professionals The monthly magazine dedicated to the world of PHP programming Check us out on the web at http://www.phparch.com! ---BeginMessage--- Marco (or anyone) What is the difference between: $familyname = getvar(familyname); and $familyname = getvar('familyname'); What do single quotes do, as a general rule, that double cannot (he asks remembering something, but not sure what)? Marco Tabini wrote: I haven't followed the rest of the thread, but how about using a function? function getvar ($varname) { if (isset ($_POST[$varname]) { $_SESSION[$varname] = $_POST[$varname]; return $_POST[$varname]; } elseif (isset ($_SESSION[$varname])) return $_SESSION[$varname]; } session_start(); // You don't need session_register anymore $familyname = getvar('familyname'); and so on--just one line per variable. Hope this helps. Cheers, Marco -- php|architect - The Magazine for PHP Professionals The monthly magazine dedicated to the world of PHP programming Check us out on the web at http://www.phparch.com! --- Subject: [PHP] Session: I RTFM Date: Sat, 14 Dec 2002 18:41:40 -0500 From: John Taylor-Johnston [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] Organization: FLSH, U-de-S To: [EMAIL PROTECTED] Jason wrote: RTFM again. Jason, again, I RTFM, but did not get it working. Otherwise I wouldn't have dared ask a question. Sessions depends on a number of factors including your version of PHP and the setting of register_globals. The FM manual says: $_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended So I am using PHP Version 4.1.2 (and 4.2.3 on my localhost to test offline) Ok. I quit using $HTTP_POST_VARS[familyname]. With a little rethinking, I have this working, I hope. Now ... is there a cleaner way to assign my variable familyname? Pseudo code: if _post[familyname] exists set session variable (no sense in setting it until I post it) if _session[familyname] exists, $familyname = $_SESSION[familyname]; I'll have about 30 variables. Going to be alot of lines. There must be an easier, cleaner way? ?php #session_name(TestALS); session_start(); if (isset($_POST[familyname])) { session_register(familyname); $familyname = $_POST[familyname]; echo Yay: \$familyname= $familynamebr; } if (isset($_SESSION[familyname])) { $familyname = $_SESSION[familyname]; echo yay session works, \$familyname= $familynamebr; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- John Taylor-Johnston - If it's not open-source, it's Murphy's Law. ' ' ' Collège de Sherbrooke: ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/ - Université de Sherbrooke: http://compcanlit.ca/ 819-569-2064 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fw: Formatting dates (from MySQL)
You should be able to use strtotime() to transform the datetime string into a UNIX timestamp, which you can then format back using date(). However, this is a very circuitous way--either use SQL to format it or, if your DBMS supports it, have it returned already as a UNIX timestamp. The actual SQL commands depend on which DBMS you actually use. Marco -- php|architect - The Magazine for PHP Professionals The monthly magazine dedicated to the world of PHP programming Check us out on the web at http://www.phparch.com! ---BeginMessage--- Hey there, I was just looking at the date/time functions (http://www.php.net/manual/en/function.time.php) and I can't seem to find a function that can format a date that is supplied in the format of a DATETIME column. So, I was wondering, is there a function that can format it properly or should I let the database handle the formatting (I'm really new to SQL, I didn't come across anything to mod in the select statement yet). I could ofcourse split it on space for a time and a date var and then split the date on -'s for years, months and days but efficient is something else I think :-) In the archives I saw some examples doing exactly that, but nothing with a single function (unless home defined ofcourse). Kind regards and TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Undefined Variable
Best guess, your local server has register_globals on and your ISP doesn't. However, without seeing your code it's going to be difficult to tell for sure! :-) Marco -- php|architect - The Magazine for PHP Professionals The monthly magazine dedicated to the world of PHP programming Check us out on the web at http://www.phparch.com! ---BeginMessage--- Using MS Win 98 / Apache Server: I'm trying to test a form box using the php mail() function. All is well when I fill in the text boxes and hit submit. I receive the e-mail. The form action in the html page is: FORM ACTION=http://localhost/getform.php; METHOD=POST _Now_ when I copy both of those files which are: 1. The html file for the form box - I have now changed the form action to read: FORM ACTION=http://www.narrowsburg.org/getform.php; METHOD=POST and 2. the .php file for the script and publish them to my site which is hosted on my ISP's MS Server, and then input data in the form boxes and hit submit: I now get the following: .. NOTICE: Undefined Variable: name in d:\inetpub\www.narrowsburg.org\getform.php in line 7 Then, when I check my e-mail I get a message with no input data from the variables like the name, e-mail, address, etc. Thanking all in advance who might help me out. Tony Ritter -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Undefined Variable
Hey Anthony-- It's definitely a register_globals problem. Your ISP has turned it off because it's generally considered a significant security risk. The best way to solve it is to use the superglobal $_POST to access your post data. In your PHP script, change all the variables that you take from the form into their $_POST[''] equivalent (see below for a rough example--I put the assignments at the beginning because I wanted to touch your code as little as possible). Also, keep in mind that you're not performing any checks on the data--I'm sure you want to do it once you've sorted the current problem out, but the way it is now you're leaving yourself exposed to a number of possible attacks. $thename = $_POST['thename']; $email = $_POST['email']; $description = $_POST['description']; $bizname = $_POST['bizname']; $contactname = $_POST['contactname']; $phone = $_POST['phone']; $email = $_POST['email']; $mailing = $_POST['mailing']; $town = $_POST['town']; $state = $_POST['state']; $zip = $_POST['zip']; $cat = $_POST['cat']; if (($thename == ) ($email == ) ($description == )) { header(Location: http://localhost/n_proserv_x.html;); exit; } $msg = This e-mail was sent from:\n; $msg .= Sender's Name:$thename\n; $msg .= $thename .'s business name is:$bizname\n; $msg .= The contact person is:$contactname\n; $msg .= $thename. 's phone number is:$phone\n; $msg .= $thename. 's e-mail address is: $email\n; $msg .= $thename. 's mailing address is: $mailing\n; $msg .= Town: $town\n; $msg .= State: $state\n; $msg .= Zip Code: $zip\n; $msg .= $thename.'s category is: $cat\n; $msg .= and the message is: $description\n\n; $to = [EMAIL PROTECTED]; $subject = Narrowsburg Chamber of Commerce; $mailheaders = From: $thename\n; $mailheaders .= Reply to:$email\n\n; mail($to, $subject, $msg, $mailheaders); ? -- php|architect - The Magazine for PHP Professionals The monthly magazine dedicated to the world of PHP programming Check us out on the web at http://www.phparch.com! ---BeginMessage--- Marco Tabini [EMAIL PROTECTED] wrote in message: Best guess, your local server has register_globals on and your ISP doesn't. However, without seeing your code it's going to be difficult to tell for sure! :-) Marco Thanks for the reply Marco. The following is the code. Any advice would be greatly appreciated. Happy holidays... Tony //this is the the html page HTML FORM ACTION=http://www.narrowsburg.org/getform.php; METHOD=POST Your Name:BRINPUT TYPE=TEXT NAME=thename SIZE=40BR Business Name:BRINPUT TYPE=TEXT NAME=bizname SIZE=40BR Contact Person:BRINPUT TYPE=TEXT NAME=contactname SIZE=40BR Telephone Number:BRINPUT TYPE=TEXT NAME=phone SIZE=40BR e-mail address:BRINPUT TYPE=TEXT NAME=email SIZE=40BR Mailing Address:BRINPUT TYPE=TEXT NAME=mailing SIZE=40BR Town:INPUT TYPE=TEXT NAME=town SIZE=40BRState:INPUT TYPE=TEXT NAME=state SIZE=7nbspnbspZip Code:INPUT TYPE=TEXT NAME=zip SIZE=11BR Category:BRINPUT TYPE=TEXT NAME=cat SIZE=40BR Description of your business: TEXTAREA NAME=description ROWS=5 COLS=27/TEXTAREABRBR INPUT TYPE=SUBMIT NAME=SUBMIT VALUE=Submit FormBR /FORM /HTML //this is the .php file called getform.php ? if (($thename == ) ($email == ) ($description == )) { header(Location: http://localhost/n_proserv_x.html;); exit; } $msg = This e-mail was sent from:\n; $msg .= Sender's Name:$thename\n; $msg .= $thename .'s business name is:$bizname\n; $msg .= The contact person is:$contactname\n; $msg .= $thename. 's phone number is:$phone\n; $msg .= $thename. 's e-mail address is: $email\n; $msg .= $thename. 's mailing address is: $mailing\n; $msg .= Town: $town\n; $msg .= State: $state\n; $msg .= Zip Code: $zip\n; $msg .= $thename.'s category is: $cat\n; $msg .= and the message is: $description\n\n; $to = [EMAIL PROTECTED]; $subject = Narrowsburg Chamber of Commerce; $mailheaders = From: $thename\n; $mailheaders .= Reply to:$email\n\n; mail($to, $subject, $msg, $mailheaders); ? . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session: I RTFM
I haven't followed the rest of the thread, but how about using a function? function getvar ($varname) { if (isset ($_POST[$varname]) { $_SESSION[$varname] = $_POST[$varname]; return $_POST[$varname]; } elseif (isset ($_SESSION[$varname])) return $_SESSION[$varname]; } session_start(); // You don't need session_register anymore $familyname = getvar('familyname'); and so on--just one line per variable. Hope this helps. Cheers, Marco -- php|architect - The Magazine for PHP Professionals The monthly magazine dedicated to the world of PHP programming Check us out on the web at http://www.phparch.com! ---BeginMessage--- Jason wrote: RTFM again. Jason, again, I RTFM, but did not get it working. Otherwise I wouldn't have dared ask a question. Sessions depends on a number of factors including your version of PHP and the setting of register_globals. The FM manual says: $_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended So I am using PHP Version 4.1.2 (and 4.2.3 on my localhost to test offline) Ok. I quit using $HTTP_POST_VARS[familyname]. With a little rethinking, I have this working, I hope. Now ... is there a cleaner way to assign my variable familyname? Pseudo code: if _post[familyname] exists set session variable (no sense in setting it until I post it) if _session[familyname] exists, $familyname = $_SESSION[familyname]; I'll have about 30 variables. Going to be alot of lines. There must be an easier, cleaner way? ?php #session_name(TestALS); session_start(); if (isset($_POST[familyname])) { session_register(familyname); $familyname = $_POST[familyname]; echo Yay: \$familyname= $familynamebr; } if (isset($_SESSION[familyname])) { $familyname = $_SESSION[familyname]; echo yay session works, \$familyname= $familynamebr; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about if statement evaluating (0==string)as TRUE
I think this is happening because you're comparing apples to oranges. Your first comparison causes an integer to be compared to a string. Because the string string evaluates to the integer value 0, the comparison succeeds. The manual recommends the use of the identical comparison operator (===) instead, or--better yet--the strcmp() function when comparing two strings. Cheers, Marco -- php|architect - The magazine for PHP Professionals The monthly worldwide magazine dedicated to PHP programmers Come visit us at http://www.phparch.com! ---BeginMessage--- Erm... this seems a bit odd to me. I'm using PHPv4.2.2 on Win32 Is that becuase PHP is not properly comparing the numerical value with the string value? ? $no = 0; if ($no == string) { print this eval's to TRUE... since when is '0' == 'no' ?; } if ($no == string) { print whereas this eval's to FALSE, as you'd expect; } ? -- Scott Hurring Systems Programmer EAC Corporation scott (*) eac.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php