[PHP] Fwd: can you help me ??
--- the forwarded message follows --- Akses Internet TELKOMNet-Instan beri Diskon s.d. 50 % khusus untuk wilayah Jawa Timur. Informasi selengkapnya di www.telkomnetinstan.com atau hub 0800-1-INSTAN (467826) ---BeginMessage--- hello .. dear webmaster i would like to ask few questions : 1. can php determine the mime type of file without uploading a file ?? 2. if it can how is it ?? thanks very much best regard's wahyu sp malang indonesia Akses Internet TELKOMNet-Instan beri Diskon s.d. 50 % khusus untuk wilayah Jawa Timur. Informasi selengkapnya di www.telkomnetinstan.com atau hub 0800-1-INSTAN (467826) ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Displaying MySQL data inside of a table
Hi all, I have this code so far: ? mysql_connect(localhost, USER, PASS); mysql_select_db(DB); $result = mysql_query(SELECT * FROM tbl); ? Inside one of my tables, I have one field called IP which contains just over a thousand IP addresses. I would like these IP addresses to be displayed inside of a table like this: table border=1 cellpadding=5 tr tdIP Address #1/td tdIP Address #2/td tdIP Address #3/td And so on... /tr /table How do I go about acheiving this? TIA, SP Computing -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Weird preg problem
Thanks Miguel it works now! $str = abcA; if (preg_match('/^[a-z]*$/', $str)) echo The string '$str' contains only lower-case letters.; -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: July 4, 2002 2:29 AM To: SP Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Weird preg problem On Thu, 4 Jul 2002, SP wrote: Hi I am trying to check if a word contains only capital letters. For some reason it's not working. The below example is checking the word weird to see if it's all capital letters but it's saying it's matches. I've tried checking for only lower case letters with WEIRD and it's not working there too. What am I doing wrong? $pattern = A-Z; $regexp = '/^['.$pattern.']*$/i'; if( preg_match($regexp, weird) ) echo matches; else echo does not match; Easiest approach: if ($str != strtoupper($str)) echo 'String contains lower-case letters.'; Using preg: if (preg_match('/[a-z]/', $str)) echo 'String contains lower-case letters.'; If you don't want any other characters to appear, ONLY capital letters (your question was a little ambiguous to me): if (preg_match('/[^A-Z]/', $str)) echo 'String contains something other than capital letters.'; miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: PHP: Script Security: Best coding practices
I thought it was a good site. I was reading up on the security bugs found and now I know what not to do. -Original Message- From: Jean-Christian Imbeault [mailto:[EMAIL PROTECTED]] Sent: July 4, 2002 2:41 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: PHP: Script Security: Best coding practices Manuel Lemos wrote: Check out http://www.phpadvisory.com/ . An ok site but only three articles, of which two are on security. One article is too general and the other too specific :) Jc -- 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] Re: Weird preg problem
A that's what that means. Thanks Tracker -Original Message- From: Tracker 1 [mailto:[EMAIL PROTECTED]] Sent: July 4, 2002 3:00 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: Weird preg problem the /i means case insensitive, remove the i, and it will work as intended. -- === Michael J. Ryan - tracker1[*at*]theroughnecks.com Roughneck BBS: http://www.theroughnecks.net telnet://theroughnecks.net === Y!: aztracker1 - aim: azTracker1 - icq: 4935386 - msn: see email One program for aim/icq/yahoo/msn/irc - http://www.trillian.cc/ Sp [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi I am trying to check if a word contains only capital letters. For some reason it's not working. The below example is checking the word weird to see if it's all capital letters but it's saying it's matches. I've tried checking for only lower case letters with WEIRD and it's not working there too. What am I doing wrong? $pattern = A-Z; $regexp = '/^['.$pattern.']*$/i'; if( preg_match($regexp, weird) ) echo matches; else echo does not match; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Weird preg problem
Hi I am trying to check if a word contains only capital letters. For some reason it's not working. The below example is checking the word weird to see if it's all capital letters but it's saying it's matches. I've tried checking for only lower case letters with WEIRD and it's not working there too. What am I doing wrong? $pattern = A-Z; $regexp = '/^['.$pattern.']*$/i'; if( preg_match($regexp, weird) ) echo matches; else echo does not match; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] pop-up windows
Perhaps we could agree on a standard response when someone asks about doing javascript in php. Then when someone asks that question, the first one to send out that canned response wins 1 php credit. John and Jason would be php millionaires by the year out I think. -Original Message- From: Bruce Karstedt [mailto:[EMAIL PROTECTED]] Sent: June 30, 2002 11:27 AM To: 'Justin French'; 'Kevin Stone'; [EMAIL PROTECTED] Subject: RE: [PHP] pop-up windows Here ! Here ! Everyone's time is valuable, and therefore the more we all respect each other's time and opinions, the more valuable a resource this will become. Bruce Karstedt President Technology Consulting Associates, Ltd. Tel: 847-735-9488 Fax: 847-735-9474 -Original Message- From: Justin French [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 30, 2002 2:45 AM To: Kevin Stone; [EMAIL PROTECTED] Subject: Re: [PHP] pop-up windows Importance: Low on 29/06/02 2:53 AM, Kevin Stone ([EMAIL PROTECTED]) wrote: John I hate to critisize you since you are one of the most active members on this list. But are these types of comments really useful? -Kevin No, I'm with John on this one. I'd say I type no, JavaScript is client-side, and PHP is server side around 20 times a week to this list, and that's only when I can be bothered. Searching for pop-up in the archives would have solved the writers problem in about 2 minutes. For this group to maintain it's worth, we need to encourage users to do a LITTLE research before asking obvious questions, and we need to discourage people wasting our time with repetitive questions, or those who clearly subscribe to the but it's so easy to just send an email and wait to be flamed mentality. Regards, Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Seperating presentation from logic
Very cool John, you should forward that to pattemplate and they could see what to improve. One thing they could do is just implement caching like smarty templates does and you can't beat servering up static files. -Original Message- From: John Holmes [mailto:[EMAIL PROTECTED]] Sent: June 27, 2002 12:39 AM To: 'SP'; 'Jean-Christian Imbeault'; [EMAIL PROTECTED] Subject: RE: [PHP] Seperating presentation from logic There are a ton of template systems. Look here for performance benchmarks: http://www.phpinsider.com/benchmarks_phemplate Unfortunately pattemplate isn't tested so I don't know how it rates. I downloaded the scripts and added patTemplate to the mix. It's average, rating in the middle on most tests... The big thing to notice is the last test, which runs through 100 loops on a test file. Smarty just blows everything out of the water. And think about what most of your web pages do...loop through result sets. If anyone wants the files, let me know. It's a simple unzip and run, everything is all packaged together. Results may vary on different servers; I'd like to see a *nix/Apache result set posted... Tested on Win2K / 1Ghz AMD / 512MB RAM / IIS 5.0 / PHP 4.2.1 (ISAPI Module), YRMV ---John Holmes... TEST 1.1 :: 20 registered vars :: 10 iterations name/ total time / average iteration time 100% smarty 4ms 0.0040654 103% phemplate 4ms 0.0041828 147% heyes class6ms 0.0059759 157% XTemplate 6ms 0.006363 160% phplib tpl 7ms 0.006502 256% bugi 10ms 0.0104083 290% patTemplate12ms 0.0117798 388% vTemplate 16ms 0.0157634 439% TemplatePower v2 18ms 0.0178361 1350% FastTemplate 55ms 0.0548866 TEST 1.2 :: 5 registered vars :: 10 iterations name / total time / average iteration time 100% heyes class3ms 0.0032871 106% phemplate 3ms 0.0034916 139% phplib tpl 5ms 0.0045691 148% smarty 5ms 0.0048685 160% XTemplate 5ms 0.0052609 257% FastTemplate 8ms 0.0084631 307% bugi 10ms 0.010094 332% patTemplate11ms 0.0109147 448% TemplatePower v2 15ms 0.0147268 502% vTemplate 16ms 0.0164906 TEST 1.3 :: 40 registered vars :: 5 iterations name / total time / average iteration time 100% phemplate 2ms 0.00453 141% smarty 3ms 0.0064098 159% XTemplate 4ms 0.0072178 178% phplib tpl 4ms 0.0080422 206% heyes class5ms 0.0093244 262% bugi 6ms 0.0118796 353% TemplatePower v2 8ms 0.015982 368% patTemplate8ms 0.0166856 401% vTemplate 9ms 0.0181768 1329% FastTemplate 30ms 0.0602032 TEST 2.1 :: text 10kb // loop 100 records // 10 iterations name / total time / average iteration time 100% smarty 6ms 0.0055744 379% phemplate 21ms 0.0211018 1039% bugi 58ms 0.0579146 1344% TemplatePower v2 75ms 0.0749261 1360% patTemplate 76ms 0.075819 3283% phplib tpl183ms 0.182 7096% XTemplate 396ms 0.3955393 8324% heyes class 464ms 0.4640006 -- 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] More on removing item from cart
Anytime I use arrays I use what John suggested but add pre/pre around it. If you do that then the array becomes very clear. echo pre, print_r($_SESSION), /pre; -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: June 27, 2002 12:44 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] More on removing item from cart On Thursday 27 June 2002 10:52, Analysis Solutions wrote: Hey Vicki: On Wed, Jun 26, 2002 at 11:01:31AM -0400, Vicki wrote: I'm checking the cart structure by printing the following code inserted right after the if($save); line (is this the best way to check on the contents of an array?) while (list($key,$value) = each($cart)) { print Cart = $key: $valueBR; } This returns article ID number (an integer) : 1 when new and article ID : yes after the save button has been clicked. The easiest way to print out any variable is to use print_r() or var_dump(). -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* You will forget that you ever knew me. */ -- 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] Seperating presentation from logic
I can only talk about smarty but the designers can use as little or as much of the features in the template. For example: Typing {$app_version} in an ordinary html file could display Greatest Application version 3.3. If your programmer changes the value to Greatest Application version 4.0, the designer doesn't have to do anything. It would show up automatically This is a simple idea but what if you want to support multiple languages. You tell your designer, use this tag for the welcome message {$welcome_user} and if the user chooses english the message will come up like this Welcome Mark and if the user chooses french then it will come up like this Bonjour Mark. Smarty also has a bunch of tags like {html_select_date start_year=1998 end_year=2010} which would spit out a pulldown menu of all the months, a pulldown menu of all the days, and a pulldown menu of all the years from 1998 to 2010. You could create your own tags too like {display_all_users_online} and it would spit out all the users online. Or you could create a tag like {diplay_calender bg=blue text=black} and it would spit out a calender table with a blue background and black text. I'm sure those tags I showed you aren't hard to grasp, you can make it harder with smarty cuz it has if/else and loop tags too but that's for more advanced designers. -Original Message- From: Jesper Brunholm [mailto:[EMAIL PROTECTED]] Sent: June 27, 2002 7:40 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Seperating presentation from logic John Holmes wrote: You really want a template system. Check out Smarty or patTemplate. Devshed.com has a nice two part tutorial on patTemplate and I like how it looks a little better than Smarty right now. Might want to evaluate both and see which is faster or easier. Great idea - except that... when you've taught your designer to use the template system you've ofte used about the amount of time it would take to give him enough knowledge about php to go directly into the code the way that Freeman suggested... Regards Jesper Brunholm -- Phønix - Danish folk music from young musicians - http://www.phonixfolk.dk -- 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] Re: PHP and OOP
OO is slower then procedural. You can test that out yourself or look at this article where the guy did a very basic test. Maybe they will fix the speed problem by the time php5 comes around. http://www.phpbeginner.com/columns/demitrious/objects/8 -Original Message- From: Kondwani Spike Mkandawire [mailto:[EMAIL PROTECTED]] Sent: June 27, 2002 8:10 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: PHP and OOP I still don't get what the big fuss of OO programming is about I do agree that it is stylistic hence helps someone else who hasn't written your code to follow up on what you are doing... But so far the programs I have been writing in OO supported languages have been written and scripted on an as is needed basis... i.e. I have the basic idea then I simply start scratching down methods/functions I have never sat down and drawn a single UML diagram on a project that I am about to do... How many of us have done so? Could some one please point out another feasible advantage of OO programming a part from the fact that I would make someone else's work easier by using this style of programming... Spike... Jesper Brunholm [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... [EMAIL PROTECTED] wrote: i want to build a site in fully OO style but that will significantly slow down execution time Do you have any documentation on this? - I'm getting quite used to read and hear the very opposite. Previously programmers even argued that asp was faster than php because it was more OO. Regards Jesper Brunholm -- Phønix - Danish folk music from young musicians - http://www.phonixfolk.dk -- 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] Re: PHP and OOP
Never tested it so I tried it out for the fun of it. I didn't use yours but I used the other guy's code on separate pages and did it ten times. I guess I was wrong, I got around 2% difference. Definitely not the 20% difference that guy got in his. He was probably using a older version. Mine was on 4.1.1 so everyone should be switching to OO from the looks of it. OO Procedural 3.22 2.87 3.09 3.05 2.91 3.00 2.88 2.99 3.08 3.09 3.25 3.04 2.97 2.94 2.94 3.01 3.05 2.90 3.07 2.96 3.05 2.99 avg -Original Message- From: Remy Dufour [mailto:[EMAIL PROTECTED]] Sent: June 27, 2002 1:34 PM To: SP; Kondwani Spike Mkandawire; [EMAIL PROTECTED] Subject: Re: [PHP] Re: PHP and OOP I've tested thecode and there is what i've got Proceduraltook 1.24408602715 seconds OOtook 1.24240803719 seconds Here is the code. Test it by yourself ?phpfunction getmicrotime(){list($usec, $sec) = explode( ,microtime());return ((float)$usec + (float)$sec);}function icount($vs) {$var=0;while($count $vs) { $count++;}}$time_start = getmicrotime();icount(100); echo Proceduralbr took . (getmicrotime() - $time_start) . secondsbr; class count {function icount($vs) {$var=0; while($count $vs) {$count++;}}} $time_start = getmicrotime();$icount = new count; $icount-icount(100);echo brOObr took . (getmicrotime() - $time_start) . seconds;? OO is slower then procedural. You can test that out yourself or look at this article where the guy did a very basic test. Maybe they will fix the speed problem by the time php5 comes around. http://www.phpbeginner.com/columns/demitrious/objects/8 -- 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] Seperating presentation from logic
I recommend http://smarty.php.net for seperating presentation from logic. It's one of the best template systems currently. It worked out of the box for me but it took me like the long weekend to figure out some of the config folders. It does your standard variable substitution {$bgcolor} but what I like about it is that it lets you code your own custom tags for your designers like {display_calender} so it hides all the php code for displaying a calender or something. Your designer just types in {display_calender} in the html files and it comes out a calender everytime. -Original Message- From: Jean-Christian Imbeault [mailto:[EMAIL PROTECTED]] Sent: June 25, 2002 1:00 AM To: [EMAIL PROTECTED] Subject: [PHP] Seperating presentation from logic I'm just about to start a large PHP project in which I get to work with professional designers/layout people. I want to separate all the programming logic from the presentation but I am not sure how to do this. Can anyone point me to resources (web tutorials/articles or books) that would help me figure out how best to separate my programming work from designer's work and how best to integrate them? Sorry for asking such a generic question but I don't know how to best phrase it. I did look on the web but the best I could find were some mentions of templates. While templates seems ok they don't address all the issues of separation presentation from code (if I understand them correctly). Thanks! Jc -- 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] Seperating presentation from logic
There are a ton of template systems. Look here for performance benchmarks: http://www.phpinsider.com/benchmarks_phemplate Unfortunately pattemplate isn't tested so I don't know how it rates. -Original Message- From: John Holmes [mailto:[EMAIL PROTECTED]] Sent: June 25, 2002 12:02 PM To: 'Jean-Christian Imbeault'; [EMAIL PROTECTED] Subject: RE: [PHP] Seperating presentation from logic You really want a template system. Check out Smarty or patTemplate. Devshed.com has a nice two part tutorial on patTemplate and I like how it looks a little better than Smarty right now. Might want to evaluate both and see which is faster or easier. I was going to give an example of patTemplate, but the devshed page isn't coming up. Basically, like someone else said, you teach your HTML designers to use custom tags that your template engine will recognize and place the correct values for. To make a loop, you'd tell your designers to do something like this table pattemplate:loop trtda href='{download_link}'{filename}/a/td/tr /pattemplate:loop It's not exactly like that, mind you, but you get the idea. You can't ever completely separate you designers and programmers. What you do is provide an easy to understand way for your designers to include the programming elements. What's easier, teaching them to put ?=$_POST['name']? or {name} in the document??? ---John Holmes... -Original Message- From: Jean-Christian Imbeault [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 25, 2002 3:50 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Seperating presentation from logic Thanks for the links. Hard to figure out what those things are just from their web pages. They should work on making it easier to figure what the projects are. I'll have a look but ... Maybe my message was too vague but what I meant is that my designers will come up with the site layout, colours, graphics etc ... I want them to be able to do all their work without thinking about any programming. If they want to make a page that lists in a table all the documents we have from 1999-2001, then they can can do this easily without worrying about me. And just as importantly I can code the scripts that will generate the table without worrying that maybe in the future the layout will change. So I how can I do this? i.e. if the designers want to change the background colour on one page how can they do this without coming to seem? Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Time Delay using phpscript
Take a look at this page, it uses flush to stagger the results as php processes it. pretty cool http://www.massassi.com/bTemplate/benchmarks/benchmark_var_assign.php?i=50 -Original Message- From: Uma Shankari T. [mailto:[EMAIL PROTECTED]] Sent: June 23, 2002 11:14 PM To: PHP Subject: [PHP] Time Delay using phpscript Hello, Can anyone please clear my doubt I need to display some strings one by one after some specific time..In javascript we can use setTimeout() function.Is there any function like this in phpscript ???.. Thanks Regards Uma -- 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] newbie on security
The guy behind the popular free php accelerator (http://www.php-accelerator.co.uk) is doing an encoder (http://www.php-encoder.com). It's not launched yet so you'll have to wait a bit. -Original Message- From: Craig Williams [mailto:[EMAIL PROTECTED]] Sent: June 24, 2002 7:39 PM To: [EMAIL PROTECTED] Subject: [PHP] newbie on security Will PHP ever support code protection ? Something to encrypt the php file so when customers get copies they can't tamper with the code ;-) I know Zend have a solution but its too bloody expensive and must be supported by the hosting isp. Craig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Anyone have slides for an Intro to PHP Class?
Here's a bunch of slide shows http://conf.php.net/ -Original Message- From: John Holmes [mailto:[EMAIL PROTECTED]] Sent: June 22, 2002 2:36 PM To: [EMAIL PROTECTED] Subject: [PHP] Anyone have slides for an Intro to PHP Class? Does anyone have a presentation that I could use for an introduction to PHP programming class? I've got an application that I want to bring some more developers in on, but I'll need to teach them PHP and MySQL. I want to give some classes to teach them the basics, and then we can learn through actual programming from there. Does anyone have a presentation like this? My audience will be people that have an HTML knowledge and possibly a c/c++ introduction. Thanks for any help. ---John Holmes. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Database Abstraction Suite
Hi David I am using adodb for my database abstraction http://php.weblogs.com/adodb I got it up and running in no time. Just go through this manual http://php.weblogs.com/ADOdb_manual or this tutorial http://php.weblogs.com/adodb_tutorial. It has a RecordCount since some database don't return the number of rows, it has a SelectLimit since databases do the limit syntax differently, it has GenID since some database don't support auto incrementing ids, it lets you do rollbacks for those databases that support it ... There's a whole bunch more functions so just try it out. -Original Message- From: David Russell [mailto:[EMAIL PROTECTED]] Sent: June 13, 2002 10:05 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP] Database Abstraction Suite Hi all I am busy developing a PHP DB application. I obviously want this to be as portable as possible - and then went to the Zend pages. I have looked at the DB abstraction Applications. There are five or so which have all been rated as a four dot (I presume out of 5). Does anyone have any experience with DB Absteraction suites. If so, I need one that supports InterBase/Firebird and also supports MySQL. I would like to know what they are like in terms of ease of learning the generic things, etc, etc. Thanks in advance David Russell -- 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] tutorials
Here are some tutorials: http://www.devshed.com/Server_Side/PHP/ http://www.phpbuilder.com/ http://www.phpdeveloper.org/tutorial.php -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: June 12, 2002 4:06 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] tutorials im not a newbie programmer, not all the stuff just want something on standards on PHP and how to start a script, or something to start with in the end i will use the manual on all the functions just need some basics on PHP... -Original Message- From: Niklas Lampén [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 12, 2002 10:01 AM To: Php-General Subject: RE: [PHP] tutorials Well, it depends on how well you know the basics of programming. If you're a total newbie, first of all learn how you use variables, conditional statements and loops. Without these you're powerless! :) One way is to just create a simple form on one page and then try thingies you can do with the values sent from that form. If you need a tutorial, try searching google with php tutorial.. :) Niklas -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 12. kesäkuuta 2002 10:17 To: [EMAIL PROTECTED] Subject: [PHP] tutorials hi i want to start learning this PHP, i've got the manual but i need a kind of a starting point? any suggestions Adriaan Putter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ### This message has been scanned by F-Secure Anti-Virus for Internet Mail. For more information, connect to http://www.F-Secure.com/ ### This message has been scanned by F-Secure Anti-Virus for Internet Mail. For more information, connect to http://www.F-Secure.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] e-commerce example
try this link http://www.devshed.com/Server_Side/PHP/Commerce -Original Message- From: savaidis [mailto:[EMAIL PROTECTED]] Sent: June 7, 2002 11:59 PM To: [EMAIL PROTECTED] Subject: [PHP] e-commerce example I'm looking for e-commerce example (PHP+MySQL) so I don't start from zero and save some time. Does somebody knows something about? Thanks Makis Savaidis -- 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] multisite hit counter, includin session statistics
I'm guessing you could just add as many variables you want to collect at the end of the counter.php script. Does that help? img src=http://www.my.com/counter.php?site=0011PHPSE SSID=lkjasfoia99sd9asfdsaf9 -Original Message- From: Martin Smetak [mailto:[EMAIL PROTECTED]] Sent: June 5, 2002 6:48 AM To: 1LT John W. Holmes; [EMAIL PROTECTED] Subject: Re: [PHP] multisite hit counter, includin session statistics Completely misunderstood :o) One more try: I need to put into some page(www.some.com), which is not on my server, a link to my script-counter, running on my server(www.my.com). The easiest way to do that is to place it to the page in form of an blank image, so in the index.html on www.some.com will be code like . img src=http://www.my.com/counter.php?site=0011; . When user accesses www.some.com page, he gets my image and runs a script. This way I can count number of page visits, store IP numbers of visitorsbut don't know how to store number of unique users that access page, number of sessions. ^^ This is what I need. You know how to do that? Thanks a lot, Minca No problem bud, sorry I tried to help. Anyhow, this does work, you just do not know how to write image.php so that it returns the correct data for an image counter. maybe i misunderstood your first email, but I thought you were looking for a hidden way of keeping track of page hit counts and user paths, etc. If your talking about files that can have PHP in them, then this is as simple as an include() file that generates the correct img calls to product the correct number, while tracking the other information you want. If you want to call this on a plain HTML page that can't parse PHP, then the only way I know of is to create an image call to a PHP script. Maybe you can do more with Javascript or SSI, if that's available... ---John Holmes... - Original Message - From: Martin Smetak [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 04, 2002 12:14 PM Subject: Re: [PHP] multisite hit counter, includin session statistics img src=http://www.yourserver.com/image.php?ID=xxx; Well, how can this help me? This is the way I need to use the counter on web page, it solves nothing. I need the same thing u are asking to, but this way it doesn't work. But there are counters-sites that uses this method(img) producing session statistics. Anyone know how they do that? Minca Do what you need to do with the PHP code as far as keeping a count of visitors, etc, and then create an image header and send it the data for a 1x1 pixel transparant image. Got a question for everyone else, b/c I'm not sure on this. If I have a link like the above on www.example.com, say, and it linkes to www.yourserver.com/image.php, can I start a session in that file and have -- 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] Cronjob security
Or you could do this to make the page only accessable to you. http://www.mysite.com/cronpage.php?secretpassword= iud88383 -Original Message- From: John Holmes [mailto:[EMAIL PROTECTED]] Sent: June 4, 2002 4:45 AM To: 'Edgard Berendsen'; [EMAIL PROTECTED] Subject: RE: [PHP] Cronjob security You should put a check in your script to see if the mail has already been sent for the day and don't send another if it has. That way someone can't go to the page and hit refresh a bunch of times and cram your inbox full of mails. ---John Holmes... -Original Message- From: Edgard Berendsen [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 04, 2002 2:14 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Cronjob security If you go to the URL I receive a mail telling me if anybody of my DB has birthday. Nothing special. Thanks! Analysis Solutions [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Sire: ... but I've read it is un-secure. Is this true? Depends. What happens if I go to that URI and try to run the script? If it would cause problems, then yes, it's insecure. If it doesn't matter, than no, it's not. So, what would happen if I hit your script with my web browser? --Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Intermediate Searching... screen.
Vbulletin does this for their search. Anyone know how they do it? http://www.vbulletin.com/forum/search.php -Original Message- From: Kevin Stone [mailto:[EMAIL PROTECTED]] Sent: May 28, 2002 2:36 PM To: Jeff Bearer; Php-General (E-mail) Subject: Re: [PHP] Intermediate Searching... screen. Search screens are a tricky prospect and none seem to work very well. However you could try one of the following techniques... Instead of the submit button initiating a search it initiates another script that displays the 'searching...' message and only after it has outputted that to the screen does it initiate the search. The last line in that script would be a redirect back to your results page. Another way to do it would be to set up a couple of Javascript functions. Echo one to open the 'searching...' screen prior to initiating the search. Then at the end of the script echo the other javascript function to close the 'searching.. ' screen. But I've implimted a version of this for an upload script and it didn't work so hot. Er.. umm.. anyone got any other bright ideas? -Kevin - Original Message - From: Jeff Bearer [EMAIL PROTECTED] To: Php-General (E-mail) [EMAIL PROTECTED] Sent: Tuesday, May 28, 2002 12:23 PM Subject: [PHP] Intermediate Searching... screen. I have a part of my site that searches a large database and sometimes it takes more than a few seconds to return the results. When searches take longer, people get antsy and search again. To let them know that the search is working so they don't double efforts I'd like to have an intermediate Searching... screen. I don't have a good idea on how to do this and I'm looking for some ideas or directions. How do I show one thing while the search is running and another when the search is complete and also not loose the returned record set? -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Efficient PHP
Here's an article you might want to read http://phplens.com/lens/php-book/optimizing-debugg ing-php.php -Original Message- From: Ed Gorski [mailto:[EMAIL PROTECTED]] Sent: May 28, 2002 9:46 AM To: [EMAIL PROTECTED] Subject: [PHP] Efficient PHP Anyone know any good links on papers/articles/reports on creating efficient PHP scripts (ie functions to stay away from, good practices, etc). As a C programmer, I am a nut on efficiency and speed and I have been trying to read up on efficient PHP coding practices (besides obvious general coding practices). So can anyone offer any links or experiences? ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP and JavaScript
It worked for me, what error are you getting? In the other.html, did you have this? html head title/title script language=JavaScript src=script.php/script /head body /body /html -Original Message- From: mp [mailto:[EMAIL PROTECTED]] Sent: May 26, 2002 3:05 AM To: [EMAIL PROTECTED] Subject: [PHP] PHP and JavaScript Hi, php-general, I make this kind of PHP script(script.php): script.php ? $variable = Some some long long Text Blah blah; echo document.write(\.$variable.\); ? And in HTML (other.html) file I write: script language=JavaScript src=script.php/script But there is some mistake. Does anybody can help me? Thanks... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP script
I'm not an expert but that doesn't sound like it's possible. I mean if you could upload files and chmod them on a remote server you would have some serious security issues. The only thing I can think of is you could upload files to your remote datebase. -Original Message- From: r [mailto:[EMAIL PROTECTED]] Sent: May 25, 2002 7:00 AM To: [EMAIL PROTECTED] Subject: [PHP] PHP script Hi Guys, I need a PHP script that will allow me to upload/download chmod files etc on a remote server... I know there are loads of these scripts out there but being a newbie to PHP I really dont know which one is good... can you recomend any? coming from Java I love PHP so would appreciate if you would recomend only a php script and not perl,servlet,asp etc. Another problem is my webserver is something like /wtn/cgi-bin/www/ all cgi scripts will have to be put in the cgi-bin directory of course but must be called like this mysite.com/cgibin/script.pl the php script should allow me access to this directory too! ANY ideas or recomendations will be deeply appreciated esp from John Holmes, Jason Wong, Miguel Cruz coz you guys are really brainy and have helped me in the past so I know your advise is supurb. I would tip my hat to you, but dont wear one...;-) Cheers, -Ryan A. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP script
Okay how about in your upload form, try putting in the whole url instead of upload.php. I don't know if that would work. You would have to have the upload.php script on the remote server. form ENCTYPE=multipart/form-data method=POST action=http://www.remoteserver.com/upload.php; -Original Message- From: r [mailto:[EMAIL PROTECTED]] Sent: May 25, 2002 10:03 PM To: SP Cc: [EMAIL PROTECTED] Subject: Re: [PHP] PHP script Hey there, Guess you too are a newbie, anyway, have been doing what you think is impossible for years using perl and servlets without any problems, And I know its possible with PHP too, since its possible i'm pretty sure someone has used it in some app already or is going too, the php community is FAT... The problem is I have been using it on servers with paths to cgi something like this /home/somedotcom/cgi-bin/ but now the new path i have is /home/cgi-bin/mydotTLD/ which of course resolves to http://mydotTLD/cgi-bin/ and I will need to administrator the files in the cgi-bin too. Any ideas? -Ryan. - Original Message - From: SP [EMAIL PROTECTED] To: r [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, May 25, 2002 5:30 AM Subject: RE: [PHP] PHP script I'm not an expert but that doesn't sound like it's possible. I mean if you could upload files and chmod them on a remote server you would have some serious security issues. The only thing I can think of is you could upload files to your remote datebase. -Original Message- From: r [mailto:[EMAIL PROTECTED]] Sent: May 25, 2002 7:00 AM To: [EMAIL PROTECTED] Subject: [PHP] PHP script Hi Guys, I need a PHP script that will allow me to upload/download chmod files etc on a remote server... I know there are loads of these scripts out there but being a newbie to PHP I really dont know which one is good... can you recomend any? coming from Java I love PHP so would appreciate if you would recomend only a php script and not perl,servlet,asp etc. Another problem is my webserver is something like /wtn/cgi-bin/www/ all cgi scripts will have to be put in the cgi-bin directory of course but must be called like this mysite.com/cgibin/script.pl the php script should allow me access to this directory too! ANY ideas or recomendations will be deeply appreciated esp from John Holmes, Jason Wong, Miguel Cruz coz you guys are really brainy and have helped me in the past so I know your advise is supurb. I would tip my hat to you, but dont wear one...;-) Cheers, -Ryan A. -- 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] bulletin board question...
You can make up your own tags by just adding more things to be parsed. EXAMPLE: $text = Look at [b]this[/b] website ...; echo $text; custom_tags($text); echo $text; function custom_tags($text) { /* converts special tags into the html counterpart * [b]text[/b] - bold text * [i]text[/i] - italicise text * [EMAIL PROTECTED] - automatically converts to mailto: link * [link=http://www.yahoo.com]text[/link] * * [list] * [*] text * [*] text * [/list] * * [color=value]text to colour[/color] - colourize some text * [colour=value]text to colour[/colour] - colourize some text * [font=value]text[/font] - value is a class defined in css file*/ $text = htmlentities($text); $text = eregi_replace([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]( [-.]?[0-9a-z])*\\.[a-z]{2,3}, a href=\mailto:\\0\;\\0/a,$text); $text = preg_replace(/\[link=(\S+?)\](.*?)\[\/link\]/is, a href=\\\1\\\2/a,$text); $text = preg_replace(/\[i\](.*?)\[\/i\]/is, i\\1/i,$text); $text = preg_replace(/\[b\](.*?)\[\/b\]/is, b\\1/b,$text); $text = preg_replace(/\[list\](\n)?/i,ul,$text); $text = preg_replace(/\[\/list\](\n)?/i,/ul,$text); $text = preg_replace(/\[\*\](.*?)$/ism, li\\1/li,$text); $text = preg_replace(/\[color=(.*?)\](.*?)\[\/color\]/is , font color=\\\1\\\2/font,$text); $text = preg_replace(/\[colour=(.*?)\](.*?)\[\/colour\]/i s, font color=\\\1\\\2/font,$text); $text = preg_replace(/\[font=(.*?)\](.*?)\[\/font\]/is, font class=\\\1\\\2/font,$text); return nl2br($text); } -Original Message- From: Anthony Ritter [mailto:[EMAIL PROTECTED]] Sent: May 25, 2002 8:39 PM To: [EMAIL PROTECTED] Subject: [PHP] bulletin board question... To all, On a bulletin board (non-usenet) within a website, is it possible to change the color or size of the type - or add a link from a word that the user has posted? For example, John Doe posts: Man, it's hot out here today! Where John changes the default font color - which is black - of the word hot - *to red* - and then links today with a URL to another site like weather.com If so, how would this be accomplished? Any thoughts? Thank you. Tony Ritter -- 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] gmtime?
Did you see gmdate()? http://www.php.net/manual/en/function.gmdate.php -Original Message- From: Jens Lehmann [mailto:[EMAIL PROTECTED]] Sent: May 24, 2002 2:52 PM To: [EMAIL PROTECTED] Subject: [PHP] gmtime? Any reasons why there's no gmtime()-function in PHP? I'd like to hear your thoughts. Jens Lehmann -- 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] adjusting time() to correct for time zones
Baba told me about his time zone class in pear just recently. http://pear.php.net/package-info.php?pacid=57 -Original Message- From: John Hughes [mailto:[EMAIL PROTECTED]] Sent: May 24, 2002 4:45 PM To: Miguel Cruz; [EMAIL PROTECTED] Subject: Re: [PHP] adjusting time() to correct for time zones --- Miguel Cruz [EMAIL PROTECTED] wrote: On Fri, 24 May 2002, John Hughes wrote: My server is located on the East Coast, but all of the users of my site live on the West Coast. I have an application that makes several calls to time() and as a result all of the times displayed are East Coast. Rather than changing every time() to time()-10800, I was wondering if there is a way to make one global change, perhaps with .htacess. Since this site is hosted on a commercial service I do not have access to the PHP.ini or other server-level files. How about writing a wrapper function called l_time() that does the calculation for you? Stick it in an include file, do a little searchin'-and-replacin', and you're set. One day when you get ambitious you can enhance the l_time() function to look for a cookie that identifies the current user's time zone and calculates accordingly. miguel Creating my own l_time() function would work, but it would require that every installed app on the this site be customized. Since the site makes extensive use of OpenSource projects, every time an app is upgraded it would need to be re-hacked. If there is no other choice, there is no other choice. But in a perfect world, there would be a way to locally correct the server time on a global basis and thus correct ALL applications -- present and future -- that need to know the local time. John Hughes __ Do You Yahoo!? LAUNCH - Your Yahoo! Music Experience http://launch.yahoo.com -- 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] timezone problem
Hi Baba I've been trying to get as much info on this as possible and you are right it is quite messy. Thanks for that link, I'm going to take a look at your code. -Original Message- From: Baba Buehler [mailto:[EMAIL PROTECTED]] Sent: May 21, 2002 5:37 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] timezone problem Miguel Cruz wrote: In short, I believe it's an OS rather than a PHP thing. time zones can be a messy and tricky beast. all the PHP functions rely on the underlying OS implementation of time zone information. sometimes this is controlled by the TZ environment variable, sometimes it is not. my solution was to extract as much info as reasonable from the zoneinfo database and manipulate it in PHP directly. the solution is not perfect, but is probably the best that can be done without more PHP access to the underlying zoneinfo implementation. my code (with all the time zone data zone IDs) is in PEAR: http://pear.php.net/package-info.php?pacid=57 thanks, baba -- 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] timezone problem
Here's what I was just thinking. This timezone seems too complicated and what do you guys think about me just displaying all the times in GMT and then allow the user to set to their local time by selecting a pulldown list of all the times GMT -11 to GMT +12. set local time to 1:10pm set local time to 2:10pm set local time to 3:10pm set local time to 4:10pm . . . They would have to change their settings once a year for day light savings but the good thing is I don't have to worry about tz anymore. What do you think? -Original Message- From: Christopher Riordan [mailto:[EMAIL PROTECTED]] Sent: May 21, 2002 1:05 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] timezone problem I had a similar issue, for a thing I'm doing for a Messageboard I am writing I need the timezones and offsets, so I compiled the best I could off different sites and info, and created a Mysql Table with all the timezones and offsets. there are duplicate offsets but since people know their TZ as different things depending where they live. I can do a dump if people would like Chris Riordan http://www.hal-9000.net - Original Message - From: SP [EMAIL PROTECTED] To: Baba Buehler [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, May 21, 2002 12:47 PM Subject: RE: [PHP] timezone problem Hi Baba I've been trying to get as much info on this as possible and you are right it is quite messy. Thanks for that link, I'm going to take a look at your code. -Original Message- From: Baba Buehler [mailto:[EMAIL PROTECTED]] Sent: May 21, 2002 5:37 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] timezone problem Miguel Cruz wrote: In short, I believe it's an OS rather than a PHP thing. time zones can be a messy and tricky beast. all the PHP functions rely on the underlying OS implementation of time zone information. sometimes this is controlled by the TZ environment variable, sometimes it is not. my solution was to extract as much info as reasonable from the zoneinfo database and manipulate it in PHP directly. the solution is not perfect, but is probably the best that can be done without more PHP access to the underlying zoneinfo implementation. my code (with all the time zone data zone IDs) is in PEAR: http://pear.php.net/package-info.php?pacid=57 thanks, baba -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gmdate
I am using gmdate to get the GMT timezone and it's working but how does it know what timezone my server is to make the time adjustment? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gmdate question
I am using gmdate to get the GMT timezone and it's working but how does it know what timezone my server is to make the time adjustment? Where's the setting for this? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] test
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] timezone problem
I am trying to convert date/times to different timezones using putenv but I am having problems using the right TZ names. I am trying the zones I found here http://fuck.org/~ryan/squirrel/timezone/timezones. php but it seems the only ones that work are EST5EDT, CST6CDT, MST7MDT, PST8PDT and GMT. OUTPUT === May 20 2002 10:46 am Eastern Standard Time May 20 2002 3:46 pm Ame May 20 2002 3:46 pm Ame May 20 2002 10:46 am EST May 20 2002 2:46 pm GMT May 20 2002 3:46 pm Eur May 20 2002 3:46 pm Asi CODE = echo date(F j Y g:i a T), br; putenv(TZ=America/Los_Angeles); echo date(F j Y g:i a T), br; putenv(TZ=America/New_York); echo date(F j Y g:i a T), br; putenv(TZ=EST5EDT); echo date(F j Y g:i a T), br; putenv(TZ=GMT); echo date(F j Y g:i a T), br; putenv(TZ=Europe/Paris); echo date(F j Y g:i a T), br; putenv(TZ=Asia/Hong_Kong); echo date(F j Y g:i a T), br; --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] timezone problem
hi miguel i'm testing on a windows so not sure where the timezone info would be but what you are saying that if i port my app to a unix box then it would be easy to just add the missing timezones in /usr/share/zoneinfo, right? if that's the case then i could just test with pacific, eastern and mountain time for now. also, do you know if i store all my dates as GMT then when i convert to different timezones using putenv, will this take into account the daylight savings? -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: May 20, 2002 1:27 PM To: SP Cc: [EMAIL PROTECTED] Subject: Re: [PHP] timezone problem I think these are system-specific. You'll probably have to check which time zone your machine understands. For instance, on this FreeBSD machine there are hundreds of them in /usr/share/zoneinfo but on other machines there are only a handful. In short, I believe it's an OS rather than a PHP thing. miguel On Mon, 20 May 2002, SP wrote: I am trying to convert date/times to different timezones using putenv but I am having problems using the right TZ names. I am trying the zones I found here http://fuck.org/~ryan/squirrel/timezone/timezones. php but it seems the only ones that work are EST5EDT, CST6CDT, MST7MDT, PST8PDT and GMT. OUTPUT === May 20 2002 10:46 am Eastern Standard Time May 20 2002 3:46 pm Ame May 20 2002 3:46 pm Ame May 20 2002 10:46 am EST May 20 2002 2:46 pm GMT May 20 2002 3:46 pm Eur May 20 2002 3:46 pm Asi CODE = echo date(F j Y g:i a T), br; putenv(TZ=America/Los_Angeles); echo date(F j Y g:i a T), br; putenv(TZ=America/New_York); echo date(F j Y g:i a T), br; putenv(TZ=EST5EDT); echo date(F j Y g:i a T), br; putenv(TZ=GMT); echo date(F j Y g:i a T), br; putenv(TZ=Europe/Paris); echo date(F j Y g:i a T), br; putenv(TZ=Asia/Hong_Kong); echo date(F j Y g:i a T), br; --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] passing ARRAYs through GET strings
Hi Navid Don't you have to serialize it to put it in sessions? -Original Message- From: Navid Y. [mailto:[EMAIL PROTECTED]] Sent: May 18, 2002 2:26 PM To: [EMAIL PROTECTED] Subject: [PHP] passing ARRAYs through GET strings Hello :) Can anyone suggest of another way, an easier way, to send arrays through get strings, or through any other process, without having to serializing it? For example, would it be better to use sessions in this case? Any help would be greatful, thanks. :) Navid -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] passing ARRAYs through GET strings
Okay let me clarify, if I had an array like this I would just use sessions this way: $myarray = array( array('1', '2'), array('3', '4') ); $_SESSION['myarray'] = serialize($myarray); Then you can use the array on any page the user goes to by doing this: $myarray = unserialize($_SESSION['myarray']); -Original Message- From: Navid Y. [mailto:[EMAIL PROTECTED]] Sent: May 18, 2002 2:52 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] passing ARRAYs through GET strings Thanks SP and Richard, Well, I tested it and it works fine with sessions, without serializing it. The only problem with sending it through GET url strings is that you can only send about 255 characters of data through to the next page. I was just looking to see how others pass their array values through their URLs. So far sessions is a winner, but maybe there's another way. Like what Richard suggested. But that method seems too time consuming and will be confusing later on since it uses enumerated arrays. Just need some suggestions and hints. :) -Original Message- From: SP [mailto:[EMAIL PROTECTED]] Sent: Saturday, May 18, 2002 1:31 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] passing ARRAYs through GET strings Hi Navid Don't you have to serialize it to put it in sessions? -Original Message- From: Navid Y. [mailto:[EMAIL PROTECTED]] Sent: May 18, 2002 2:26 PM To: [EMAIL PROTECTED] Subject: [PHP] passing ARRAYs through GET strings Hello :) Can anyone suggest of another way, an easier way, to send arrays through get strings, or through any other process, without having to serializing it? For example, would it be better to use sessions in this case? Any help would be greatful, thanks. :) Navid -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] passing ARRAYs through GET strings
Hey cool, didn't know that. -Original Message- From: Navid Y. [mailto:[EMAIL PROTECTED]] Sent: May 18, 2002 3:45 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] passing ARRAYs through GET strings No need to serialize arrays in PHP 4.0. They work seamlessly, as if you've passed a regular variable through. Thanks for your help and patience :) -Original Message- From: SP [mailto:[EMAIL PROTECTED]] Sent: Saturday, May 18, 2002 2:27 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] passing ARRAYs through GET strings Okay let me clarify, if I had an array like this I would just use sessions this way: $myarray = array( array('1', '2'), array('3', '4') ); $_SESSION['myarray'] = serialize($myarray); Then you can use the array on any page the user goes to by doing this: $myarray = unserialize($_SESSION['myarray']); -Original Message- From: Navid Y. [mailto:[EMAIL PROTECTED]] Sent: May 18, 2002 2:52 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] passing ARRAYs through GET strings Thanks SP and Richard, Well, I tested it and it works fine with sessions, without serializing it. The only problem with sending it through GET url strings is that you can only send about 255 characters of data through to the next page. I was just looking to see how others pass their array values through their URLs. So far sessions is a winner, but maybe there's another way. Like what Richard suggested. But that method seems too time consuming and will be confusing later on since it uses enumerated arrays. Just need some suggestions and hints. :) -Original Message- From: SP [mailto:[EMAIL PROTECTED]] Sent: Saturday, May 18, 2002 1:31 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] passing ARRAYs through GET strings Hi Navid Don't you have to serialize it to put it in sessions? -Original Message- From: Navid Y. [mailto:[EMAIL PROTECTED]] Sent: May 18, 2002 2:26 PM To: [EMAIL PROTECTED] Subject: [PHP] passing ARRAYs through GET strings Hello :) Can anyone suggest of another way, an easier way, to send arrays through get strings, or through any other process, without having to serializing it? For example, would it be better to use sessions in this case? Any help would be greatful, thanks. :) Navid -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] passing ARRAYs through GET strings
Rick, what exactly do you mean by using serialization without sessions? how do you do that? -Original Message- From: Richard Baskett [mailto:[EMAIL PROTECTED]] Sent: May 18, 2002 4:31 PM To: [EMAIL PROTECTED]; PHP General Subject: Re: [PHP] passing ARRAYs through GET strings Hey no problem.. That's what this list is for.. Asking questions and answering them :) I just use sessions to pass a lot of variables to a lot of pages.. Or some variables to a lot of pages.. Usually for site authorization that's about it. When I just want to pass arrays to another page, I use serialization, it's the fastest easiest way in my opinion and you don¹t have to mess with sessions since in my opinion it would be overkill :) Rick Nobody will ever win the Battle of the Sexes. There's just too much fraternizing with the enemy. - Henry Kissinger From: Navid Y. [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] Date: Sat, 18 May 2002 14:43:27 -0500 To: 'PHP General' [EMAIL PROTECTED] Subject: RE: [PHP] passing ARRAYs through GET strings Well Rick, Let's say I had a form with a text box and an textarea box. The text box won't contain that many strings, but the textarea box can contain thousands of characters, if the user wished to write that much. Both of the fields will be contained in a single array. If I send this array through a GET string, it will only pass 255 characters through to the next page, and the rest of the content will be cut out of the picture as if it never existed. Then, I thought maybe sessions would do the trick, and it does a great job so far. So now I'm stuck with the idea that using sessions to pass arrays, in the particular situation, would be the best thing to do. But, out of curiousity, I wanted to know how other people sent their arrays back and forth from one page to another. That's all :) Thanks for your patience, I really appreciate it. -Original Message- From: Richard Baskett [mailto:[EMAIL PROTECTED]] Sent: Saturday, May 18, 2002 2:12 PM To: [EMAIL PROTECTED]; PHP General Subject: Re: [PHP] passing ARRAYs through GET strings Well what I normally do to pass very large arrays through strings.. when NOT using sessions, I use serialize, but it sounds like you didn¹t want to serialize.. If you give me an idea of what you are doing I might be able to figure out the best way to pass those variables :) And no you don't need to serialize the data when using sessions. Sessions themselves are serialized automatically, you don¹t need to worry about that. Rick We do not have to visit a mad house to find disordered minds; our planet is the mental institution of the universe. - Unknown From: Navid Y. [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] Date: Sat, 18 May 2002 13:51:38 -0500 To: [EMAIL PROTECTED] Subject: RE: [PHP] passing ARRAYs through GET strings Thanks SP and Richard, Well, I tested it and it works fine with sessions, without serializing it. The only problem with sending it through GET url strings is that you can only send about 255 characters of data through to the next page. I was just looking to see how others pass their array values through their URLs. So far sessions is a winner, but maybe there's another way. Like what Richard suggested. But that method seems too time consuming and will be confusing later on since it uses enumerated arrays. Just need some suggestions and hints. :) -Original Message- From: SP [mailto:[EMAIL PROTECTED]] Sent: Saturday, May 18, 2002 1:31 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] passing ARRAYs through GET strings Hi Navid Don't you have to serialize it to put it in sessions? -Original Message- From: Navid Y. [mailto:[EMAIL PROTECTED]] Sent: May 18, 2002 2:26 PM To: [EMAIL PROTECTED] Subject: [PHP] passing ARRAYs through GET strings Hello :) Can anyone suggest of another way, an easier way, to send arrays through get strings, or through any other process, without having to serializing it? For example, would it be better to use sessions in this case? Any help would be greatful, thanks. :) Navid -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked
RE: [PHP] passing ARRAYs through GET strings
Thanks Rick, that's what I thinking. Thought I was missing something. -Original Message- From: Richard Baskett [mailto:[EMAIL PROTECTED]] Sent: May 18, 2002 4:49 PM To: SP; PHP General Subject: Re: [PHP] passing ARRAYs through GET strings Well you can serialize an array using the serialize function then pass it through the url then unserialize it on the next page using the unserialize function. If you check out http://www.php.net/serialize it will give you some examples. It is quite similar to sessions in that sessions also serialize the data, but there are subtle differences. You will need to use a couple other functions with serialize when passing through the URL, but that is documented on the page I just gave you :) If you have any other questions concerning it please do not hesitate to ask me :) Rick Until you have learned to be tolerant with those who do not always agree with you; until you have cultivated the habit of saying some kind word of those whom you do not admire; until you have formed the habit of looking for the good instead of the bad there is in others, you will be neither successful nor happy. - Napolean Hill From: SP [EMAIL PROTECTED] Date: Sat, 18 May 2002 16:35:00 -0400 To: Richard Baskett [EMAIL PROTECTED], [EMAIL PROTECTED], PHP General [EMAIL PROTECTED] Subject: RE: [PHP] passing ARRAYs through GET strings Rick, what exactly do you mean by using serialization without sessions? how do you do that? -Original Message- From: Richard Baskett [mailto:[EMAIL PROTECTED]] Sent: May 18, 2002 4:31 PM To: [EMAIL PROTECTED]; PHP General Subject: Re: [PHP] passing ARRAYs through GET strings Hey no problem.. That's what this list is for.. Asking questions and answering them :) I just use sessions to pass a lot of variables to a lot of pages.. Or some variables to a lot of pages.. Usually for site authorization that's about it. When I just want to pass arrays to another page, I use serialization, it's the fastest easiest way in my opinion and you don¹t have to mess with sessions since in my opinion it would be overkill :) Rick Nobody will ever win the Battle of the Sexes. There's just too much fraternizing with the enemy. - Henry Kissinger From: Navid Y. [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] Date: Sat, 18 May 2002 14:43:27 -0500 To: 'PHP General' [EMAIL PROTECTED] Subject: RE: [PHP] passing ARRAYs through GET strings Well Rick, Let's say I had a form with a text box and an textarea box. The text box won't contain that many strings, but the textarea box can contain thousands of characters, if the user wished to write that much. Both of the fields will be contained in a single array. If I send this array through a GET string, it will only pass 255 characters through to the next page, and the rest of the content will be cut out of the picture as if it never existed. Then, I thought maybe sessions would do the trick, and it does a great job so far. So now I'm stuck with the idea that using sessions to pass arrays, in the particular situation, would be the best thing to do. But, out of curiousity, I wanted to know how other people sent their arrays back and forth from one page to another. That's all :) Thanks for your patience, I really appreciate it. -Original Message- From: Richard Baskett [mailto:[EMAIL PROTECTED]] Sent: Saturday, May 18, 2002 2:12 PM To: [EMAIL PROTECTED]; PHP General Subject: Re: [PHP] passing ARRAYs through GET strings Well what I normally do to pass very large arrays through strings.. when NOT using sessions, I use serialize, but it sounds like you didn¹t want to serialize.. If you give me an idea of what you are doing I might be able to figure out the best way to pass those variables :) And no you don't need to serialize the data when using sessions. Sessions themselves are serialized automatically, you don¹t need to worry about that. Rick We do not have to visit a mad house to find disordered minds; our planet is the mental institution of the universe. - Unknown From: Navid Y. [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] Date: Sat, 18 May 2002 13:51:38 -0500 To: [EMAIL PROTECTED] Subject: RE: [PHP] passing ARRAYs through GET strings Thanks SP and Richard, Well, I tested it and it works fine with sessions, without serializing it. The only problem with sending it through GET url strings is that you can only send about 255 characters of data through to the next page. I was just looking to see how others pass their array values through their URLs. So far sessions is a winner, but maybe there's another way. Like what Richard suggested. But that method seems too time consuming and will be confusing later on since it uses enumerated arrays. Just need some suggestions and hints. :) -Original Message- From: SP [mailto:[EMAIL PROTECTED]] Sent: Saturday, May 18, 2002 1:31 PM To: [EMAIL
RE: [PHP] Augmenting an old date
Here's a nice article all about dates http://www.phpbuilder.com/columns/akent2610.ph p3 On page 6 of that article it shows a function for adding years, months, days ... to a date. function DateAdd ($interval, $number, $date) { $date_time_array = getdate($date); $hours = $date_time_array[hours]; $minutes = $date_time_array[minutes]; $seconds = $date_time_array[seconds]; $month = $date_time_array[mon]; $day = $date_time_array[mday]; $year = $date_time_array[year]; switch ($interval) { case : $year +=$number; break; case q: $year +=($number*3); break; case m: $month +=$number; break; case y: case d: case w: $day+=$number; break; case ww: $day+=($number*7); break; case h: $hours+=$number; break; case n: $minutes+=$number; break; case s: $seconds+=$number; break; } $timestamp = mktime($hours ,$minutes, $seconds,$month ,$day, $year); return $timestamp; } -Original Message- From: Andre Dubuc [mailto:[EMAIL PROTECTED]] Sent: May 19, 2002 12:03 AM To: [EMAIL PROTECTED] Subject: [PHP] Augmenting an old date Two columns in my PostgreSQL db are type 'date' (formatted '-mm-dd'): 'start_date' and 'expiry_date'. What I cannot seem to figure out is how to augment the 'expiry_date' either by 30 days, 60 days, or 1 year. I've tried the date function in PHP (getdate) but the problem is that it appears to need a timestamp of today. The dates that I'm trying to augment are sometimes a year or two ago. This doesn't work: $new_expiry_date = $expiry_date(Y-m-d, mktime(0,0,0, date(Y), date(m), date(d) + 60))); I assume it's because the '$expiry_date' should be simply 'date', but that would give the current date which is not what is wanted. Is there anyway to set 'date' as '$expiry_date'? Suggestions, admonitions, and general advice will be greatly appreciated. Btw, I've searched the archives, and haven't found anything quite on this topic. Tia, Andre -- Please pray the Holy Rosary to end the holocaust of abortion. Remember in your prayers the Holy Souls in Purgatory. May God bless you abundantly in His love! For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Augmenting an old date
Wow this is a pretty cool function. I was playing with it and you can add like +30 days + 99 seconds together and it works. -Original Message- From: Tom Rogers [mailto:[EMAIL PROTECTED]] Sent: May 19, 2002 1:07 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Augmenting an old date Hi A slightly more efficeint way :) ? $start = 2002-01-01; $expire = date(Y-m-d,strtotime($start +30 days)); echo $expire.br; ? Tom At 02:03 PM 19/05/2002, Andre Dubuc wrote: Two columns in my PostgreSQL db are type 'date' (formatted '-mm-dd'): 'start_date' and 'expiry_date'. What I cannot seem to figure out is how to augment the 'expiry_date' either by 30 days, 60 days, or 1 year. I've tried the date function in PHP (getdate) but the problem is that it appears to need a timestamp of today. The dates that I'm trying to augment are sometimes a year or two ago. This doesn't work: $new_expiry_date = $expiry_date(Y-m-d, mktime(0,0,0, date(Y), date(m), date(d) + 60))); I assume it's because the '$expiry_date' should be simply 'date', but that would give the current date which is not what is wanted. Is there anyway to set 'date' as '$expiry_date'? Suggestions, admonitions, and general advice will be greatly appreciated. Btw, I've searched the archives, and haven't found anything quite on this topic. Tia, Andre -- Please pray the Holy Rosary to end the holocaust of abortion. Remember in your prayers the Holy Souls in Purgatory. May God bless you abundantly in His love! For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/ -- 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 --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Genus who came up with Self Destruct Code Copy Pro tection
Well I've never tried it but I've gone through some of the big open source apps out there trying to learn their techniques and I can tell you I hate going through my code let anyone someone else's. -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: May 14, 2002 2:55 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] Genus who came up with Self Destruct Code Copy Pro tection Step 1: Run the files through a prettyprinter. That instantly restores the indentation and line breaks. Step 2: Open up in a text editor like TextPad that has multi-file search-and-replace and rename all the functions back from their garbled names as you determine what they do. Unless it was written to be confusing from the very beginning - in which case an awful lot of development time was wasted - it'll be very easy to do this. Just start from the functions with the greatest number of calls to PHP built-in functions and work outward from there. 1 minute or so per 25 lines of working code. Honestly, it's not a big deal. miguel On Mon, 13 May 2002, SP wrote: As an example, someone provided this link on the PHP Obfuscator http://pobs.mywalhalla.net and I'm just quoting what it says it does: POBS replaces user-defined (NOT predefined) functions, constants and variables with a MD5 key of 8 characters ... The first letter of the new functionname is a F, of a variable a V and of a constant a C. The function with name MakeImageHtml is replaced by Fee2c1bdc The variable $ImgText is replaced by $V1d9d94a6 The constant USERDIR is replaced by C389a367e It also concatenate lines and remove comments and indents and so yeah you could spend your time hunting down the killswitch and the 10 other backdoors I put in the prog but what do you end up with? A working app that no coder would even want to maintain or touch. And the good thing is the longer the guy that stiffed you uses the app, the more screwed they will be. -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: May 13, 2002 10:13 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Genus who came up with Self Destruct Code Copy Pro tection Well, I promise you that I can re-activate any solely PHP-based remote killswitch in a matter of minutes - maybe hours if the person was really good. It's just too easy when you have the source code for the interpreter. Likewise the only truly effective PHP encoder would be one that created confusion by scrambling all the variable names to be names of my former girlfriends. Anything else is just like working with bad code from a contractor or junior employee - run it through the prettyprinter, open up a Dr. Pepper, and be the PHP interpreter for a while. Coming up with robust code protection is a very very challenging task. You spend a long time working out a scheme, then someone figures it out, and you have to start over again - everything protected by your previous scheme is now out in the open. Much better to focus on the legal side of it. If you really don't think you're going to be able to police the use of your code, to a degree that piracy is going to cost you more than your time is worth, you should be looking for a new set of clients. miguel On Mon, 13 May 2002, SP wrote: Everyone is arguing that these encoders can be cracked. Does anyone know of one, have you done it yourself? How long did it take? I mean I'm not going to leave my door unlocked cuz someone can pick it open. -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: May 13, 2002 3:29 PM To: Udo Giacomozzi Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Genus who came up with Self Destruct Code Copy Pro tection On 13 May 2002, Udo Giacomozzi wrote: If the whole thing is designed the right way. A copy protection I like for example are dongles. Ok, they are not applicable to PHP and aren't 100% secure either [don't want to start a discussion about this now]. But this system makes no problems for the people that have the dongle. That was why first came up with this question. As a PHP beginner I wanted to know if there are elegant ways to make a acceptable copy protection. There seem to be only 3 possibilities: - zend encoder - a code obfuscator like POBS - encrypting the source code and then decrypting it in realtime All of these have weaknesses. And therefore the whole exercise is moot. It only takes one person with some free time to break your protection scheme, and then the cat's out of the bag. Once it has been broken, it will spread and then it won't matter how complex your scheme was. I really doubt there is any software out there that isn't being traded by high-school kids, even if they have no idea what it's for. The only exceptions would be something so arcane and obscure that nobody ever had an interest in cracking
RE: [PHP] Cool PHP Tricks/Features ?
Well if his normal page is 100k and he can cut the size down to 50k with gzip then instead of having a monthly transfer of 100 GB for example, he would only be paying for 50 GB. Seems like it's useful for extremely large sites. -Original Message- From: John Holmes [mailto:[EMAIL PROTECTED]] Sent: May 14, 2002 6:43 PM To: 'Girish Nath'; [EMAIL PROTECTED] Subject: RE: [PHP] Cool PHP Tricks/Features ? Why do you think this is useful to you? I remember reading an article on this and its conclusion was that zipping the output was only beneficial for large data between fast computers over a slow pipe. You have to look at who your clients are and if it's beneficial to have their machine use up extra time (processing power) unzipping things or not. Also, you're using more processing time on your computer having to do the zipping for every request, too. ---John Holmes... -Original Message- From: Girish Nath [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 14, 2002 9:28 AM To: [EMAIL PROTECTED] Subject: [PHP] Cool PHP Tricks/Features ? Hi I've been using PHP for about 2 years now but only just discovered ob_gzhandler and gzip/compressing http output. It's something i wish i'd found out about earlier because even though it's a simple concept the result blew me away :) Anyway, i just wanted to know of any other cool tricks/features that you guys are using that others could have overlooked. Thanks Girish -- www.girishnath.co.uk -- 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 --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Referrals
I haven't looked so don't know how they did it but you can look at the source for www.oscommerce.com to see how it was done or someone more familar with the project could enlighten us. Here's their demo site, you can see the Customers who bought ... at the bottom http://www.oscommerce.com/catalog21/product_info.p hp?products_id=21 On 05/12/2002 08:54 AM, Randum Ian wrote: Hi all, I am in the middle of writing a website for affiliate programs on the web, which one is the best and why kind of thing. I would like to be able to do something similar to what Amazon do on their website but I am struggling to work out how they do it so convincingly. Here is an example of what I mean: When you select an item to look at, there is a section named: snip Customers who bought this item also bought: blah link one - blah description blah link two - blah description Click here for more blah snip How is this done? Is there a reference to a new db which has the links and references them from there or do they look into sessions or cookies? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Genus who came up with Self Destruct Code Copy Pro tection
Everyone is arguing that these encoders can be cracked. Does anyone know of one, have you done it yourself? How long did it take? I mean I'm not going to leave my door unlocked cuz someone can pick it open. -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: May 13, 2002 3:29 PM To: Udo Giacomozzi Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Genus who came up with Self Destruct Code Copy Pro tection On 13 May 2002, Udo Giacomozzi wrote: If the whole thing is designed the right way. A copy protection I like for example are dongles. Ok, they are not applicable to PHP and aren't 100% secure either [don't want to start a discussion about this now]. But this system makes no problems for the people that have the dongle. That was why first came up with this question. As a PHP beginner I wanted to know if there are elegant ways to make a acceptable copy protection. There seem to be only 3 possibilities: - zend encoder - a code obfuscator like POBS - encrypting the source code and then decrypting it in realtime All of these have weaknesses. And therefore the whole exercise is moot. It only takes one person with some free time to break your protection scheme, and then the cat's out of the bag. Once it has been broken, it will spread and then it won't matter how complex your scheme was. I really doubt there is any software out there that isn't being traded by high-school kids, even if they have no idea what it's for. The only exceptions would be something so arcane and obscure that nobody ever had an interest in cracking it. miguel -- 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] Genus who came up with Self Destruct Code Copy Pro tection
As an example, someone provided this link on the PHP Obfuscator http://pobs.mywalhalla.net and I'm just quoting what it says it does: POBS replaces user-defined (NOT predefined) functions, constants and variables with a MD5 key of 8 characters ... The first letter of the new functionname is a F, of a variable a V and of a constant a C. The function with name MakeImageHtml is replaced by Fee2c1bdc The variable $ImgText is replaced by $V1d9d94a6 The constant USERDIR is replaced by C389a367e It also concatenate lines and remove comments and indents and so yeah you could spend your time hunting down the killswitch and the 10 other backdoors I put in the prog but what do you end up with? A working app that no coder would even want to maintain or touch. And the good thing is the longer the guy that stiffed you uses the app, the more screwed they will be. -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: May 13, 2002 10:13 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Genus who came up with Self Destruct Code Copy Pro tection Well, I promise you that I can re-activate any solely PHP-based remote killswitch in a matter of minutes - maybe hours if the person was really good. It's just too easy when you have the source code for the interpreter. Likewise the only truly effective PHP encoder would be one that created confusion by scrambling all the variable names to be names of my former girlfriends. Anything else is just like working with bad code from a contractor or junior employee - run it through the prettyprinter, open up a Dr. Pepper, and be the PHP interpreter for a while. Coming up with robust code protection is a very very challenging task. You spend a long time working out a scheme, then someone figures it out, and you have to start over again - everything protected by your previous scheme is now out in the open. Much better to focus on the legal side of it. If you really don't think you're going to be able to police the use of your code, to a degree that piracy is going to cost you more than your time is worth, you should be looking for a new set of clients. miguel On Mon, 13 May 2002, SP wrote: Everyone is arguing that these encoders can be cracked. Does anyone know of one, have you done it yourself? How long did it take? I mean I'm not going to leave my door unlocked cuz someone can pick it open. -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: May 13, 2002 3:29 PM To: Udo Giacomozzi Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Genus who came up with Self Destruct Code Copy Pro tection On 13 May 2002, Udo Giacomozzi wrote: If the whole thing is designed the right way. A copy protection I like for example are dongles. Ok, they are not applicable to PHP and aren't 100% secure either [don't want to start a discussion about this now]. But this system makes no problems for the people that have the dongle. That was why first came up with this question. As a PHP beginner I wanted to know if there are elegant ways to make a acceptable copy protection. There seem to be only 3 possibilities: - zend encoder - a code obfuscator like POBS - encrypting the source code and then decrypting it in realtime All of these have weaknesses. And therefore the whole exercise is moot. It only takes one person with some free time to break your protection scheme, and then the cat's out of the bag. Once it has been broken, it will spread and then it won't matter how complex your scheme was. I really doubt there is any software out there that isn't being traded by high-school kids, even if they have no idea what it's for. The only exceptions would be something so arcane and obscure that nobody ever had an interest in cracking it. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] E-mail Confirmation script?
I would suggest just sending them an email with a link like this and telling them to click on it to confirm their membership. http://www.mysite.com/confirm.php?uniqueid=2i3k238 s9sd0s99d The confirm.php page would look up the uniqueid and try to find it in your database. If it's there then that means the email address they gave you exists and they have access to that email account cuz they know that uniqueid. After confirming, you could send a welcome user email and include another link that they can use for all other account management like unsubscribing, changing password, changing personal info ... http://www.mysite.com/account.php -Original Message- From: Andre Dubuc [mailto:[EMAIL PROTECTED]] Sent: May 12, 2002 4:36 PM To: [EMAIL PROTECTED] Subject: [PHP] E-mail Confirmation script? I've looked about for an 'Email Confirmation' script that many sites use for verifcation of wannabee new members. That is, the person subscribes, is sent a 'confirmation' number to which they must have in the 'Subject' area of their reply. I would like to implement this on my site, but I haven't discovered a source for a script, or how to go about doing it. That is, how do you retrieve items from an incoming e-mail, and is it possible to parse the same? If anyone who has seen such a script could point me to where I could find one, I would greatly appreciate it, or in the Manual, what it would be listed under. The 'mail()' function doesn't seem to include how to access received e-mails, and to parse individual copmponents of a message. Btw, does anyone know what's up with the 'Search' function of the PHP-general lst? It always seems to be 'offline'. Rather hard to search the archives for previously asked questions. Tia, Andre -- Please pray the Holy Rosary to end the holocaust of abortion. Remember in your prayers the Holy Souls in Purgatory. May God bless you abundantly in His love! For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/ -- 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] E-mail Confirmation script?
Just make sure the url fits on one line in the email which mine doesn't. -Original Message- From: Andre Dubuc [mailto:[EMAIL PROTECTED]] Sent: May 12, 2002 5:06 PM To: SP Cc: [EMAIL PROTECTED] Subject: Re: [PHP] E-mail Confirmation script? Thanks, Now why didn't that ever occur to me? It's simple and very effective. Thanks for the idea! Regards, Andre On Sunday 12 May 2002 04:51 pm, you wrote: I would suggest just sending them an email with a link like this and telling them to click on it to confirm their membership. http://www.mysite.com/confirm.php?uniqueid=2i3k238 s9sd0s99d The confirm.php page would look up the uniqueid and try to find it in your database. If it's there then that means the email address they gave you exists and they have access to that email account cuz they know that uniqueid. After confirming, you could send a welcome user email and include another link that they can use for all other account management like unsubscribing, changing password, changing personal info ... http://www.mysite.com/account.php -Original Message- From: Andre Dubuc [mailto:[EMAIL PROTECTED]] Sent: May 12, 2002 4:36 PM To: [EMAIL PROTECTED] Subject: [PHP] E-mail Confirmation script? I've looked about for an 'Email Confirmation' script that many sites use for verifcation of wannabee new members. That is, the person subscribes, is sent a 'confirmation' number to which they must have in the 'Subject' area of their reply. I would like to implement this on my site, but I haven't discovered a source for a script, or how to go about doing it. That is, how do you retrieve items from an incoming e-mail, and is it possible to parse the same? If anyone who has seen such a script could point me to where I could find one, I would greatly appreciate it, or in the Manual, what it would be listed under. The 'mail()' function doesn't seem to include how to access received e-mails, and to parse individual copmponents of a message. Btw, does anyone know what's up with the 'Search' function of the PHP-general lst? It always seems to be 'offline'. Rather hard to search the archives for previously asked questions. Tia, Andre -- Please pray the Holy Rosary to end the holocaust of abortion. Remember in your prayers the Holy Souls in Purgatory. May God bless you abundantly in His love! For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Genus who came up with Self Destruct Code Copy Pro tection
So I should buy a commerical product from zend to protect my code but since my code will be reversed engineered anyways then what's the point of buying from zend? -Original Message- From: David Freeman [mailto:[EMAIL PROTECTED]] Sent: May 9, 2002 10:16 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Genus who came up with Self Destruct Code Copy Pro tection Obviously most coders are in the middle ground. They are not writing the killer app of all time but is of significant value. I don't know what people on here are charging but I can't add $2880 a year to my overhead for the zend encoder. Plus add $1875 per cpu for the zend accelerator for each project. My personal opinion is that your code is either worth protecting or it's not. If it's worth protecting then that protection comes at a price. Sorry, commercial reality time here. If you are going to operate on a commercial basis then you have commercial decisions to make. This is one of them. So you're bidding for a project and the guy asks, Let me get this straight, you're charging me more then everyone else and I won't be able to edit the code? I think you would simply pricing yourself out of the market. If that's what you're going to do then yes. Ask yourself what people like ISC (the people who do bind and sendmail do to make a living - after all they have seriously commercial quality products available for free) or people like RedHat (who give away their linux distro for nix if you want to download it, or pay a small fee to whatever company downloads it and sells CD-R burns of the iso's). People can, and do, make money giving away their code. When you figure out how they are doing it, and the philosophy behind it, then maybe that will ease these fears. I can pretty much guarantee that if you come up with a killer app in php that no matter how protected it is you will not be the only one with a version of killer app for long. Someone else will come along and write something similar - if that person does it open source then there's also a fair chance it will end up being better than your product due to shear weight of numbers contributing to it. In the end all this, and more, are your decisions. Of course, if you choose not to do this commercially then it's a whole different setup with different goals and so on. For the record, I pretty much release what I do to anyone who wants it. Not that my efforts are of a standard that they are worth all that much per se - they are often fairly specific to the project at hand and not overly portable (in their released format). I do have one intranet application under development for my own business that may well end up with a strong commercial basis but it will never be a single product but part of a much larger package my business is currently planning. Even then, the code associated with that project may end up open sourced in some way. Let's face it, there's even a move to replicate the zend encoder in open source. As has already been said, there also has to be a level of trust between you and your client(s) if you are going to do business with them. If your clients see you as overly paranoid about your work they may end up not wanting to deal with you anyway. If you're that paranoid about losing control of your work offer it on a complete solution basis - either you host it on a machine that they have no back end access to or you provide the hardware as well as the software and have it locked out in such a way that the code is not easily stolen. Although, even here you'll sooner or later be compromised I would think. CYA, Dave -- 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] Genus who came up with Self Destruct Code Copy Pro tection
Obviously most coders are in the middle ground. They are not writing the killer app of all time but is of significant value. I don't know what people on here are charging but I can't add $2880 a year to my overhead for the zend encoder. Plus add $1875 per cpu for the zend accelerator for each project. So you're bidding for a project and the guy asks, Let me get this straight, you're charging me more then everyone else and I won't be able to edit the code? I think you would simply pricing yourself out of the market. -Original Message- From: David Freeman [mailto:[EMAIL PROTECTED]] Sent: May 9, 2002 5:24 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Genus who came up with Self Destruct Code Copy Pro tection I was talking in general. The BBS was simply an example to make things clearer. I am *not* developing a BB system! If you want you can think of a immaginary tool that makes a website load twice as fast, need the half web space and makes the website look nicer, of course at lower OK, if you're producing something with a significant commercial value then spring for the dollars to pay for zend encoder and use it. Seems like some people want it both ways - my code is different and unique and has commercial value in and of itself but I'm not prepared to spend real dollars to protect it, I want free code to do that. I suspect that many people in this situation have an overly high opinion of their code and, in reality, there are open source or free alternatives that do much the same (albeit elegant and easily customisable or whatever) and, as such, not worth spending the money on zend. CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP compared to JSP
Does anyone think caching should be built into php for it to edge out the competition? (like what smarty is doing) I mean a static page will always serve up faster then a dynamic one. Also even if you are getting 100 pages/sec on your database, you could cache it for 5 seconds and you save 500 accesses to your database. Yeah the page would be at most 5 seconds old but no one would know. Plus if you are a crappy programmer then it would mask how slow your code is :-) -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: May 5, 2002 3:01 AM To: Pag Cc: Luc Saint-Elie; [EMAIL PROTECTED] Subject: Re: [PHP] PHP compared to JSP On Sat, 4 May 2002, Pag wrote: Does PHP compile : NO Does the user loading same page for 2nd time gets better response : YES it can if caching is provided On a side not..isnt caching a bit like going against why PHP was built in the first place? I mean, information may get a bit out of date if we get a page on the cache instead of getting it fresh from the server. Sometimes the developer knows how stale information can get before it needs to be refreshed. An awful lot of pages fetched with GET args are just straight-up retrievals from mostly-static databases, and can be cached with impunity. Also, there are other types of caching. On a multi-use machine that is busy with other stuff but not getting a lot of web traffic, httpd may have been paged out. And the PHP source file will be cached by the filesystem for a while after being read, saving subsequent repeat visits the delay of a disk operation. miguel -- 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] PRIMARY KEY vs. INDEX
Indexes are good but the only thing you have to look out for is not over using it. So don't index all your fields because it will make your database a lot bigger and add more time when inserting and updating. -Original Message- From: Dan Hardiker [mailto:[EMAIL PROTECTED]] Sent: May 2, 2002 8:41 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] PRIMARY KEY vs. INDEX To clarify, an indexed field is *not* inheriently unique. You can have an indexed field which is not unique, and a unique field which is not indexed (hence the options being available). A primary key is both indexed and unique (with the slight adaption of compound keys)... but this is majorly off topic. http://www.mysql.com/doc/ - Dan Christoph, Indexes are built on key fields, so yes. When a field is identified as a key it is indexed. To answer your second question, it is the index which maintains the uniqueness of a field. A book is a really good analogy. If you wanted to look up the references to string, you can do it very quickly in the index. Even if you don't come close to the s section, you immediately know whether to look next to the right or to the left. If you push the issue, and act extremely dumb (like a computer), you'll find the page containing string within 7 hits; once you're on that page it's a short read to find the term. That's what makes searching on indexed fields so fast. To find the term in the book requires you to start reading on page 1 and to read text until you find the term. Which why searches which do not take advantage of key fields are so slow. Indexes are your friend, they don't slow down the addition of records that much, and make retrieval of records extremely fast. Regards - Miles Thompson At 02:13 PM 5/2/2002 +0200, Christoph Starkmann wrote: Hi there! I guess I got a very easy question for the pros here... I've been searching the documentaion of mySQL, but didn't find the answer (even though I'm sure it's out there somewhere :))... Is a primary key in mySQL automatically indexed? And is a unique field indexed automatically ?(I don't think and don't hope so, but one never knows) Thanx, Kiko -- It's not a bug, it's a feature. christoph starkmann mailto:[EMAIL PROTECTED] http://www.gruppe-69.com/ ICQ: 100601600 -- -- 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 -- Dan Hardiker [[EMAIL PROTECTED]] ADAM Software Systems Engineer First Creative Ltd -- 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] PRIMARY KEY vs. INDEX
Yeah this isn't specifically about php but most people use databases so I think this is relevant. I like it when we have discussions like these instead of someone posting up a bunch of code and asking to find a missing ' or }. -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: May 2, 2002 1:21 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] PRIMARY KEY vs. INDEX On Thursday 02 May 2002 20:13, Christoph Starkmann wrote: Hi there! I guess I got a very easy question for the pros here... I've been searching the documentaion of mySQL, but didn't find the answer (even though I'm sure it's out there somewhere :))... Is a primary key in mySQL automatically indexed? And is a unique field indexed automatically ?(I don't think and don't hope so, but one never knows) Pardon, I'm new here, but what has this got to do with PHP? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* It's great to be smart 'cause then you know stuff. */ -- 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] PRIMARY KEY vs. INDEX
True. -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: May 2, 2002 3:26 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] PRIMARY KEY vs. INDEX On Friday 03 May 2002 03:17, SP wrote: Yeah this isn't specifically about php but most people use databases so I think this is relevant. I like it when we have discussions like these instead of someone posting up a bunch of code and asking to find a missing ' or }. Yes, but that's what the php-db list is for. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Remember, UNIX spelled backwards is XINU. -- Mt. */ -- 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] class PHP
Whatever it says the guy took a lot of time to write it out lol -Original Message- From: John Holmes [mailto:[EMAIL PROTECTED]] Sent: April 28, 2002 3:46 AM To: 'Peter'; [EMAIL PROTECTED] Subject: RE: [PHP] class PHP Can someone translate this to English? -Original Message- From: Peter [mailto:[EMAIL PROTECTED]] Sent: Saturday, April 27, 2002 7:21 PM To: [EMAIL PROTECTED] Subject: [PHP] class PHP The text of this proposal, test code, and updates live at petermoulding.com/class. I place it here for discussion of the best approach before people build code. Class PHP An invention for a classier PHP. This invention uses PHP classes as Web pages. The invention can be implemented as a wrapper around PHP or as an enhancement to PHP. In Apache 2, the invention can be implemented as a filter to precede PHP. I will give a quick outline of the requirement, then sketches of implementations, then detailed examples prototyped using PHP. The invention is named class. An Apache implementation could be a module named class. If you write code to implement this invention, suffix the project name with your name as in class_John. To prevent a rapacious company copyrighting this invention using the excuse that it is a business process or anything else they can copyright, I declare my copyright on everything in this invention and any processes derivable from this. Please make your code implementations GPL, www.gnu.org/copyleft/gpl.html, and mention my page at petermoulding.com/class. Invention Requirement The main requirement is to replace PHP's page input with invented input. Here is a file named any_class.class that containing a PHP class named any_class: ?php class any_class { function any_class() { /* code to build a Web page. */ } } ? Here is a Web page containing a PHP script to build the entire page using the PHP class any_class: ?php include_once(any_class.class); $any_class = new any_class(); ? The invention makes PHP initiate any_class.class as if any_class were included and instantiated by the example Web page. PHP Wrapper The invention could be implemented as a module for Apache or another Web server by writing a wrapper for PHP. The wrapper would accept a call from Apache then pass the call on to PHP so PHP could perform 100% unaltered as if PHP were called direct from Apache. The module would look for class requests with a page of the form *.class then intercept the URL and prepare to pass invented input to PHP. The Apache configuration parameters can ensure all requests for class go to class and only requests for class to class. In a mixed class/PHP environment, the requested class can go to class and the PHP requests can go direct to PHP. There could also be a check in class for a class file so that all requests are directed to class and class processes just those with a matching class file. When class finds a valid class request, class builds a PHP Web page that includes the class file and initiates the class. To make PHP read the invented Web page, you could trap PHP's Web page read and substitute the invented page. As PHP has to access files within the constraints of a Web server, the access technique could vary from release to release and across Web servers. I will describe two quick implementation possibilities. If PHP reads files via Apache's file read functions (or an equivalent on other web servers), class gets to view all file requests from PHP to Apache and monitor all replies. Class can then pass the invented page back to PHP without the request reaching Apache. PHP remains untouched by class. Where a Web server does not provide file access functions or PHP chooses to not use those functions, class would need a modification to PHP to intercept file reads. The interception depends on the exact compilation of PHP and would be in the form of a wrapper around a file access routine in PHP. The wrapper (or interception layer) needs to be at a level where the code can see file names and subvert the whole file read process. Interception at this level requires PHP release dependent coding and is a step toward the PHP enhancement described next. PHP Enhancement A PHP enhancement would be an implementation of the invention direct within PHP's code so that PHP can react to class requests in conjunction with an external process or without an external process. The ultimate enhancement would be to incorporate the whole invention within PHP so there are no additional installation steps required. A PHP enhancement could use a wrapper as described in PHP Wrapper or the Apache 2 filter described next but use those devices just to trigger class processing then perform the whole processing within PHP. This approach has the advantage that the processing is independent of the trigger method and the trigger method is free from processing code.
RE: [PHP] web application development question
How about storing it in a database like you said with variable and value but when you change a value then you write over your config.inc.php file with a new one. So you get to change the value easily in a database and by using a file you make your app faster without any database access everytime. -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: April 26, 2002 4:15 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] web application development question On Friday, April 26, 2002, at 03:58 PM, Jason Wong wrote: For those of you who write web applications (in any language), what do you recommend as the best way to store arbitrary atomic data for the web application? in other words, data that doesn't really need to be stored in a relational database, as it does not really relate to anything? Stick it in an include file? I'm sorry, I meant to be more clear -- although include files are great for storing data that will probably not change (but are now in a convenient include file in case they have to change), I was thinking of making this data updateable from within the application. So that my employer, who does not know a thing about PHP or MySQL, can change this information from the administration section of the site. Which is why I was thinking of using the database... ... well, I may just keep it in an include file, and if anyone ever needs to change the data, I'll explain in the documentation where the data should be changed. Thanks for the tips guys Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- 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] web application development question
Say if you just had the values in a file then when someone wanted to see all the values, you have to parse your config.inc.php file for all the values to display them. Also when someone made a change then you would have to find the value and replace with the new one. Just thought it would be easier to just do a select on the database to display the values and then if you make a change then just make a change in the database and overwrite the old file. -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: April 26, 2002 4:24 PM To: SP Cc: [EMAIL PROTECTED] Subject: RE: [PHP] web application development question On Fri, 26 Apr 2002, SP wrote: How about storing it in a database like you said with variable and value but when you change a value then you write over your config.inc.php file with a new one. So you get to change the value easily in a database and by using a file you make your app faster without any database access everytime. What would be the point of using the database then? miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] validating user input
Hi Drouet, I've been asking about this too and here's what I've been working on. It checks for letters, numbers, puncuation, and max and min length. I was told any of the puncation was safe as long as you addslashes before you put it into the database. function check_input($user_input, $min=0, $max=0, $text=false, $number=false, $special=false) { $pattern = ; if ($text) $pattern .= a-zA-Z; if ($number) $pattern .= 0-9; if ($special) $pattern .= 'À-ÖØ-öø-ÿ[:space:]\~\!\[\]\`\@\#\$\%\^\\*\(\)\_\+\-\={\}\|\:\\;\'\\ \?\,\.\/'; $regexp = '/^['.$pattern.']*$/i'; if( preg_match($regexp, $user_input) strlen($user_input) = $max strlen($user_input) = $min ) echo it passes; else echo didn't pass; } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: April 24, 2002 3:49 AM To: [EMAIL PROTECTED] Subject: [PHP] validating user input Hi the M.L. I have to validate forms user inputs before the construction of my query to my Oracle DB Does anybody know the list of characters that should be rejected (for example ;) ? Do you have a function to validate it ? regards Laurent Drouet -- 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] Empty $_SESSION and $_POST ??
Have you tried doing phpinfo() and seeing what values are coming up? -Original Message- From: Andre Dubuc [mailto:[EMAIL PROTECTED]] Sent: April 22, 2002 5:59 PM To: Erik Price Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Empty $_SESSION and $_POST ?? On Monday 22 April 2002 05:34 pm, you wrote: On Monday, April 22, 2002, at 03:47 PM, Andre Dubuc wrote: I tried what you suggested, and indeed globals are off. Perhaps my problem stems from my use of the $_GET[] with $vars. I guess I don't really understand what I'm doing. If you would take a peek at this code [I think I've introduced a security hole, and I'm mixing up things]: I think the problem you're having is basically understanding what register_globals does, and why some people might want to turn it off. register_globals takes a variable (doesn't matter if it's a server variable, a cookie variable, a post variable, or a get variable) and registers it as global throughout the script. This means that if someone types http://www.domain.com/index.php?firstname=andrelastname=dubuc into the Address bar of her browser, she has just requested the index.php resource from the server at www.domain.com using the HTTP protocol and sent two variables to the server using the GET method: $firstname = 'andre' $lastname = 'dubuc' If you have register_globals turned on, then your script can look like this: if ($firstname == 'andre' $lastname == 'dubuc') { // do something } and it still works. However, if you have register_globals turned off, then the above 'if test' won't work. This is because these variables are not $firstname and $lastname, they are $_GET['firstname'] and $_GET['lastname']. To do an 'if test' with register_globals off, you should do: if ($_GET['firstname'] == 'andre' $_GET['lastname'] == 'dubuc') { // do something } There's really not much of a difference. The thing is that instead of being a global variable, the data that you passed is now an element of the $_GET array. So you use the standard element notation, using the associative index of the variable name. If you do this: $firstname = $_GET['firstname']; $lastname = $_GET['lastname']; ...you make your code simpler to understand, but be careful that you don't do something in the same script like $lastname = $row['last_name']; (which could happen if you were trying to simplify your MySQL result data.) I'll take a look at what you've got On page 1: ?php session_start(); ob_start(); ? // ob_start(); so I can have html headers on this page redirect later // some other code form action=page2.php method=get ?php // The following line is where I think I've caused myself grief. input type=text size=20 name=bozo input type=submit name=submit value=Agree ? Yeah, I'd say you've caused yourself some grief. This isn't even related to register_globals -- you've got two HTML input tags in the middle of your PHP block. You need to print() or echo these, not just type them in directly. print(input type='text' size='20' name='bozo' /); print(input type='submit' name='submit' value='Agree'); $bozo = $_GET['bozo']; /* Now is this correct? Am I exposing 'bozo' to a security hole? For the rest of the script, with each $_GET['var'] from the previous page I do the same. Somehow, I don't think I've grasped what to do with $vars. From my reading elsewhere, should I, for example, in page 1 use something like input type=text size=20 name=?php echo $_SESSION['bozo'] ? I prefer to do it the way that you have read elsewhere, but it really doesn't matter. Either way, you have a variable in your script that points to some user-specified data. What you've done is simplified the results, similar to what some people do when they pull data out of a result set with mysql_fetch_array(). The only security hole is if you have written your script to do something unsafe with the $bozo variable. HOWEVER... bear in mind that now that you are referring to this variable in this fashion, you could end up inadvertently overwriting this variable with a new variable, by doing something like $bozo = $row['bozo']; -- something that is far less likely to occur when referring to it as $_GET['bozo']. It really depends on how organized your code is. If I were you, I would probably get into the habit of calling it $_GET['bozo'], since that just saves you time and stress in the long run. The only security hole would be this: $_SESSION['admin'] = 'yes'; // indicates that user is an administrator $admin = $_SESSION['admin']; // simplify our variable name if ($admin == 'yes') { // if user is an administrator // display some sensitive data } // for some stupid reason we do this $admin = $_GET['admin']; // obviously you wouldn't do something like this if ($admin == 'yes') { // display some sensitive data } Essentially, in the above code, you've
RE: [PHP] Re: ereg size limit???
Hey James, yeah you're right that was a typo, ereg was what I meant. Thanks your suggestion worked and plus I think preg is much faster then ereg so that's cool. -Original Message- From: liljim [mailto:[EMAIL PROTECTED]] Sent: April 22, 2002 4:44 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: ereg size limit??? Hi, Sp [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am trying to validate my input with ereg but I get the error Warning: REG_BADBR when I try over 255 characters. Is there anyway around this? Works = if(eregi('^[A-Za-z]{1,255}$', test sentence)) echo valid input; Doesn't Work if(eregi('^[A-Za-z]{1,256}$', test sentence)) echo valid input; First off, you're using eregi (case insensitive), but defining a-zA-Z (a through z, case insensitive) in your characters class. You could just use ereg and leave the character class as it is, or drop the A-Z from the eregi version. Secondly, I'd amend your code to: ^[a-z]+$ And thirdly, I'd just use a combination of ereg / preg_* functions and strlen. if(preg_match(/^[a-z]+$/i, $string) strlen($string) 255) { echo Whatever.; } I'm not sure why you're getting that error, but then again, I haven't bothered reading up about it :) James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ereg size limit???
I am trying to validate my input with ereg but I get the error Warning: REG_BADBR when I try over 255 characters. Is there anyway around this? Works = if(eregi('^[A-Za-z]{1,255}$', test sentence)) echo valid input; Doesn't Work if(eregi('^[A-Za-z]{1,256}$', test sentence)) echo valid input; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: [PHP-DB] Re: [PHP] Re: Cross DB application
Thanks Richard, just starting out but keeping portability in the back of my mind. I've been keeping the sql statements standard and doing everything through php so I don't get caught when moving to another database. -Original Message- From: Richard Ellerbrock [mailto:[EMAIL PROTECTED]] Sent: April 20, 2002 8:18 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: [PHP-DB] Re: [PHP] Re: Cross DB application On Thu, 18 Apr 2002 16:05:13 +0200, Manuel Lemos wrote: Hello, Sp wrote: Hi Manuel, I still don't see a problem in others telling their experiences with certain packages. If someone has just used metabase or has just used adodb then I would like to hear how easy/hard it was to port to another database. Sure, but what I meant is that since most people only have experienced one or the other, you only hear from people that can't compare both. If you want to hear experiences of people that tried Metabase, try asking in Metabase mailing list ( http://groups.yahoo.com/group/metabase-dev/ ) or BinaryCloud mailing lists ( http://binarycloud.tigris.org/servlets/ProjectMailingListList ). I think Alex Black (BinaryCloud project leader) has tried both MySQL and Oracle with Metabase. I have done MySQL (MyISAM, INNODB), PostgreSQL and Oracle 9i with AdoDB - see http://iptrack.sourceforge.net. Works just fine for me. The hardest part was to get around limitations of certain databases - like Oracle does no support record count. This is not impossible to get around, but when you are used to making use of these standard features of other databases, it takes a bit of getting used to. Other issues are syntax issues - you cannot use any funky functions which are unique to your dbf. Also, you must write very standard SQL - no shortcuts. For example, with Oracle you MUST specify the table name throughout your query when doing joins, even if the column is unambiguos. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Validating User Input
I am trying to validate an user's input. I can get the ereg function to work if I just type in the pattern I'm searching for but my problem is I want to build the pattern through a variable first and then use that variable in the ereg function. For example, I want to check an input that's only text and only between 5 to 20 characters in length. Is this possible? function check_input($user_input, $min=0, $max=0, $text=false, $number=false, $special=false, $default=) { if ($text) $pattern .= a-zA-Z; if ($number) $pattern .= 0-9; if ($special) $pattern .= [:space:]; if (ereg(^[$pattern]{$min,$max}$, $user_input)) return $user_input; else return $default; } Also, which of the following special characters is considered safe to accept? I am just allowing spaces now but would like as many of the below characters to be included. ~ ` ! # $ % ^ * ( ) _ + - = [ ] \ { } | : ; ' ? , . / -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Validating User Input
Thanks Danny, that worked! Now should I include all those special characters? I want it to be hack proof so I don't want to add the user input into my database and have something bad happen. Which ones are safe? ~ ` ! @ # $ % ^ * ( ) _ + - = [ ] \ { } | : ; ' ? , . / -Original Message- From: Danny Shepherd [mailto:[EMAIL PROTECTED]] Sent: April 19, 2002 9:32 AM To: Php Subject: Re: [PHP] Validating User Input Hi, ?php function check_input($user_input, $min=0, $max=0, $text=false, $number=false, $special=false, $default=) { $pattern=; if ($text) $pattern.='a-zA-Z'; if ($number) $pattern.='0-9'; if ($special) $pattern.='[:space:]\~\`\@\#\$\%\^\\*\(\)\_\+\-\=\\\{\}\|\:\\;\'\\\?\,\. \/'; $regexp='^['.$pattern.']{'.$min.','.$max.'}$'; if (ereg($regexp,$user_input)) return $user_input; else return $default; } ? That should take care of everything except the square brackets - not sure how to go about getting them (escaping them didn't seem to work). HTH Danny. - Original Message - From: SP [EMAIL PROTECTED] To: Php [EMAIL PROTECTED] Sent: Friday, April 19, 2002 1:57 PM Subject: [PHP] Validating User Input I am trying to validate an user's input. I can get the ereg function to work if I just type in the pattern I'm searching for but my problem is I want to build the pattern through a variable first and then use that variable in the ereg function. For example, I want to check an input that's only text and only between 5 to 20 characters in length. Is this possible? function check_input($user_input, $min=0, $max=0, $text=false, $number=false, $special=false, $default=) { if ($text) $pattern .= a-zA-Z; if ($number) $pattern .= 0-9; if ($special) $pattern .= [:space:]; if (ereg(^[$pattern]{$min,$max}$, $user_input)) return $user_input; else return $default; } Also, which of the following special characters is considered safe to accept? I am just allowing spaces now but would like as many of the below characters to be included. ~ ` ! @ # $ % ^ * ( ) _ + - = [ ] \ { } | : ; ' ? , . / -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: [PHP-DB] Re: [PHP] Re: Cross DB application
Hi Manuel, I still don't see a problem in others telling their experiences with certain packages. If someone has just used metabase or has just used adodb then I would like to hear how easy/hard it was to port to another database. -Original Message- From: Manuel Lemos [mailto:[EMAIL PROTECTED]] Sent: April 18, 2002 9:37 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; Sp Subject: Re: [PHP-DB] Re: [PHP] Re: Cross DB application Hello, Sp wrote: Can someone with database expertise who has used metabase and adodb cut through this rhetoric and give an objective view of these two packages. From what I got from this convo is that metabase is slower but more portable but adodb is faster but not as portable. No, Metabase does much more than ADODB. When you do more, eventually things may take a little longer when you do less. This should be obvious. Anyway, if you really care about portability, you're only way out is Metabase. Other abstraction packages were not meant for portability but rather for interface makeup. I think you will be the better judge of that if you try looking at least at each package documentation. It is pointless to ask to people here when most of them only know one or the other package. Regards, Manuel Lemos -- PHP Database 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] Re: Need row number from database select
Thanks for everyone who helped. I was trying to keep track of the row number from a database select and everyone who said to pass the row number variable through the function was correct. I finally got it to work by passing the variable by reference. -Original Message- From: Kevin Bucknum [mailto:[EMAIL PROTECTED]] Sent: April 15, 2002 10:29 AM To: '[EMAIL PROTECTED]' Subject: RE: [PHP] Re: Need row number from database select Keep track of it outside of the function in a global variable. -Original Message- From: SP [mailto:[EMAIL PROTECTED]] Sent: Sunday, April 14, 2002 8:28 PM To: David Robley; [EMAIL PROTECTED] Subject: RE: [PHP] Re: Need row number from database select I see what you are trying to do David but that was what I tried first but it doesn't work because the function calls itself depending if it's not a parent so the alternating colors become all messed up depending on the structure of my folders. That's why I was hoping to get the number for each of the result returned so I could change the color depending if it was odd or even. Any other suggestions? -Original Message- From: David Robley [mailto:[EMAIL PROTECTED]] Sent: April 14, 2002 6:50 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Re: Need row number from database select Well, you don't need to know what row number is. Something like: function build_folder_tree($output, $parent=1, $indent=) { $color = red; // Set var to first option $qid = mysql_query(SELECT id, name FROM folders WHERE parent_id = $parent); while ($cat = mysql_fetch_object($qid)) { $output .= $cat-name + $indent; // here is where I want to assign diff. colors $color == red ? $color = blue: $color = red; // Cycle color for each iteration if ($cat-id != $parent) build_folder_tree($output, $cat-id, $indent.nbsp;nbsp;); } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: [PHP-DB] Re: [PHP] Re: Cross DB application
There must be people on this list that have ported their web apps from different databases and could share their experiences. mysql - postesql mysql - ms sql server ms sql server - oracle -Original Message- From: John Lim [mailto:[EMAIL PROTECTED]] Sent: April 17, 2002 12:38 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP-DB] Re: [PHP] Re: Cross DB application Hi Manuel, Manuel Lemos [EMAIL PROTECTED] wrote Most of the popular database abstraction packages support prepared queries, except for your PHP ADODb. So, think about this before you keep throwing sand to the eyes of the users that do not know better, may be you understand the point of catching up on what everybody else is doing for a long time. If you read the ADOdb source, you would know it is untrue. We support prepared queries, and emulate them if the database does not support it. The reason for this is that you had the dumb idea to spam all the lists you could remember with the forged claim that ADODB was faster than every other database abstraction because your convinient benchmarks showed that. Tomas Cox rewrote PEAR DB after the benchmarks were published to speed it up. We even worked together to improve bits of PEAR DB. You just moan about how unfair the benchmarks are. Since your database abstraction could not beat others on real abstraction features you used that to drag users to your package to push them the commercial tool that you sell and requires ADODB to run. Visit http://php.weblogs.com/adodb-cool-applications for a long list of applications using adodb with multiple databases. None of the apps except the first link use our commercial product, phpLens. I think that pretty much refutes your statement. That was the lowest Microsoft-like marketing trick - trap them into your Windows clone database abstraction OS to sell them your tool for which you have no competitor because nobody else is doing anything like that for your own abstraction later. I interviewed to work at microsoft in 1989, but as a techie, i would have made microsoft bankrupt if they had let me run their marketing for them :-) Of course you may claim ADODB is faster than any other abstraction package, but that's because it does not abstract data type conversion to make user applications portable. Actually it does, but only for dates, because I find that most other types can be easily handled because PHP is a very good language. Char and varchar and numbers map easily to string and float/integer, and so forth. I have told you this before. It is the same as stating that driving a motocycle naked and without helmet you will drive faster than clothed with the helmet on. It is not the same thing, but unfortunately for the victim users that have fallen for your argument they did not notice that your abstraction can only be faster by doing less, meaning providing less portability support. Of course. Unneeded portability that is not used by most users is of no interest to me. You disagree. That is fine. The code is there for people to read. Let them judge for themselves. John, as a marketeer you still have a lot to learn before you realize that you can't fool everybody! Next you will release ADODB XP the one that makes hidden connections to your site to track what the users are doing! hehehe :-) Don't worry, nobody will sue you for the abusing the monopoly of applications for your PHP ADO DB! :-) Manuel Lemos Manuel, you might not believe me, but what you are saying will make people shy away from working with you in the future. Treating people with respect is more productive. I don't really want to spend my time defending myself when I can be doing something else. So I leave this thread to you and to you alone. The floor is yours. Keep it clean. John -- PHP Database 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] Re: Need row number from database select
I see what you are trying to do David but that was what I tried first but it doesn't work because the function calls itself depending if it's not a parent so the alternating colors become all messed up depending on the structure of my folders. That's why I was hoping to get the number for each of the result returned so I could change the color depending if it was odd or even. Any other suggestions? -Original Message- From: David Robley [mailto:[EMAIL PROTECTED]] Sent: April 14, 2002 6:50 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Re: Need row number from database select Well, you don't need to know what row number is. Something like: function build_folder_tree($output, $parent=1, $indent=) { $color = red; // Set var to first option $qid = mysql_query(SELECT id, name FROM folders WHERE parent_id = $parent); while ($cat = mysql_fetch_object($qid)) { $output .= $cat-name + $indent; // here is where I want to assign diff. colors $color == red ? $color = blue: $color = red; // Cycle color for each iteration if ($cat-id != $parent) build_folder_tree($output, $cat-id, $indent.nbsp;nbsp;); } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Need row number from database select
Thanks Kevin, someone else suggested using global variable too. I didn't want to do that but I think this is the only way around it. So if I use a global variable called $row_number and $row_number++ as I print out each row then if two people are viewing the page, there would be two $row_number variables keeping track of the running total for their respectively page, right? -Original Message- From: Kevin Bucknum [mailto:[EMAIL PROTECTED]] Sent: April 15, 2002 10:29 AM To: '[EMAIL PROTECTED]' Subject: RE: [PHP] Re: Need row number from database select Keep track of it outside of the function in a global variable. -Original Message- From: SP [mailto:[EMAIL PROTECTED]] Sent: Sunday, April 14, 2002 8:28 PM To: David Robley; [EMAIL PROTECTED] Subject: RE: [PHP] Re: Need row number from database select I see what you are trying to do David but that was what I tried first but it doesn't work because the function calls itself depending if it's not a parent so the alternating colors become all messed up depending on the structure of my folders. That's why I was hoping to get the number for each of the result returned so I could change the color depending if it was odd or even. Any other suggestions? -Original Message- From: David Robley [mailto:[EMAIL PROTECTED]] Sent: April 14, 2002 6:50 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Re: Need row number from database select Well, you don't need to know what row number is. Something like: function build_folder_tree($output, $parent=1, $indent=) { $color = red; // Set var to first option $qid = mysql_query(SELECT id, name FROM folders WHERE parent_id = $parent); while ($cat = mysql_fetch_object($qid)) { $output .= $cat-name + $indent; // here is where I want to assign diff. colors $color == red ? $color = blue: $color = red; // Cycle color for each iteration if ($cat-id != $parent) build_folder_tree($output, $cat-id, $indent.nbsp;nbsp;); } } -- 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] Re: Need row number from database select
Hi AJ, very interesting way of displaying a folder tree. Never thought of it that way. The problem I see is that you are limited to the depth of the tree because you can't just keep adding a new folder number to the end of the path. And the total number of folders is limited by the number of digits you assign per level. Also why are you using a hex? -Original Message- From: Aj Lavin [mailto:[EMAIL PROTECTED]] Sent: April 15, 2002 3:24 PM To: SP Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Re: Need row number from database select On Sun, Apr 14, 2002 at 09:27:50PM -0400, SP wrote: I see what you are trying to do David but that was what I tried first but it doesn't work because the function calls itself depending if it's not a parent so the alternating colors become all messed up depending on the structure of my folders. That's why I was hoping to get the number for each of the result returned so I could change the color depending if it was odd or even. Any other suggestions? It is possible to get all of your folders in a single query if you add a field to your database table that encodes the folder hierarchy positions. Example: id path name == = === 1 1 Home 2 12 Products 3 123 Fruits 4 124 Vegetables 5 1235Apples Here we encode the path using one digit per hierarchy level. The path encoding for any folder equals the path encoding of its parent plus the encoding of its id. If the digits are hex, then this works as long as there are no more than 16 elements in any level of the hierarchy. If you need more, you can use multiple digits per level. I use 8 hex digits to encode 4 byte int's at each level. You would have shorter path names using base 60. In PostgreSQL, to get the Products directory and all its subdirectories, in order, use: $root = 12; $result = pg_exex( $db, SELECT * FROM folders WHERE path LIKE '{$root}%' ORDER BY path ASC); Sorry, I don't know MySQL, but all you need to know here is that the '%' char above is a wild card character, like '*' on the command line. Now you can iterate over the records stored in result. They are in the proper order. The level of any record is the length of the path string divided by the number of digits per level. Hope this helps. - Aj PS: My posts don't show up on the PHP list for some reason, so I am also sending you this directly. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Need row number from database select
If this is my database result from a select then I need to know that Bob is the 1st result, Mike is the 2nd result and John is the 3rd result ... Name Address === Bob 121 King St. Mike 99 Main St. John 8433 Albert St. Does mysql keep track of this? I know I could just do a $i++ as I loop through the results but I'm doing something recursively so the counter doesn't work here. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Need row number from database select
I am displaying a folder tree and want to alternate the colors for each folder so my database table shows that for example the Apples folder is located under the Fruits folder. Therefore I want to know which row is odd or even so I can assign it different colors. Incidently, does anyone know of a more efficient way of displaying a folder tree without doing it recursively? id parent_id name == = === 1 1 Home 2 1 Products 3 2 Fruits 4 2 Vegetables 5 3 Apples function build_folder_tree($output, $parent=1, $indent=) { $qid = mysql_query(SELECT id, name FROM folders WHERE parent_id = $parent); while ($cat = mysql_fetch_object($qid)) { $output .= $cat-name + $indent; // here is where I want to assign diff. colors if ($cat-id != $parent) build_folder_tree($output, $cat-id, $indent.nbsp;nbsp;); } } -Original Message- From: John Simpson [mailto:[EMAIL PROTECTED]] Sent: April 14, 2002 7:18 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: Need row number from database select If you know you're looking for Bob or Mike or John, you could select the rows each time in your loop as an associative array. mysql_fetch_array(result, MYSQL_ASSOC) will do the trick. Sp [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... If this is my database result from a select then I need to know that Bob is the 1st result, Mike is the 2nd result and John is the 3rd result ... Name Address === Bob 121 King St. Mike 99 Main St. John 8433 Albert St. Does mysql keep track of this? I know I could just do a $i++ as I loop through the results but I'm doing something recursively so the counter doesn't work here. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Group moderation formula
Everyone gets an arbitrary 100 points ranking to start with. Everyone can vote for or against a proposal. If you vote for a proposal and it gets approved by the majority then you get more points. If you vote against a proposal and it gets approved then you lose points. The more points you have for your ranking the more weight you have in your voting. So the more times you are right in your approval the more weight you get. Does anyone have any ideas or formula they would use to figure out how the points should be awarded? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php