[PHP] array_unique() and count issue
OK, I want to count the number of unique elements in an array, then print the total. However, both methods I've tried return "1"; the man pages explain that the count() function will return 1 if the var is set but not an array. But if you look at the 2nd method esp., I've set an if-else !is_set() alert which doesn't appear... Either way, it's a 1. Help! Method 1: Method 2: $value) { $count[$key] = $value++; } print($value); } ?> __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] advantage of php
hi. php good for design web server because ,it use the best function of java,perl,html,...in itself. but I dont know about difference between cgi and php?? love your enemies,because they cause to work harder. nafiseh. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] advantage of php
Hello, it is quite simple, php is a programming language. CGI is an interface that execute programming language, usually Perl, but can be C, C++... py - Original Message - From: "nafiseh saberi" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, August 18, 2001 4:46 AM Subject: [PHP] advantage of php > > hi. > php good for design web server because ,it > use the best function of java,perl,html,...in itself. > > but I dont know about difference between cgi and php?? > > > love your enemies,because they cause to work harder. > nafiseh. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] cgi 2 php
Has anyone ever come across a cgi 2 php program at all, similar to the asp2php program ? or has anyone got a quick and easy tutorial for me to read through on what needs converting to what , language 2 language . Steven -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] FW: Large sites using PHP
Dear PHP fans, Knowing large sites that use php is one thing (it shows the language can support heavy loads). But what I would really like to know is the time difference to design, code and implement web application in PHP versus java solution, or ColdFusion, or another language. I switch to PHP because I love the language but mainly because I could develop application about 30% faster than ASP. (the language I used before) The staff I hire can learn PHP and be very productive within a few days, soory but I can't say the same for other language... py - Original Message - From: "Maxim Maletsky" <[EMAIL PROTECTED]> To: "PHP" <[EMAIL PROTECTED]> Sent: Saturday, August 18, 2001 1:45 AM Subject: [PHP] FW: Large sites using PHP > > Dear PHP gurus: > > I've been following here the ever-growing-never-to-be-stopped discussions > related to the largest sites using PHP. Apparently, most of the PHP > developers are trying to convince their bosses to use Open Source language > PHP instead of other 'silly' commercial solutions those 'brains' have in > mind. > > It is just happened to me to be asked the same thing on a meeting with one > of our clients. Therefore I have composed a dirty list of sites you all were > posting during the time. I've done no research on this at all. My work > consisted only in organizing your comments into one single resource. > > The forwarded email below is what I came up with. > > Please, who cares, update this list and perhaps even make it available to > public online. Could be a good idea to have such resource running somewhere. > I will definitely create a section for it on PHPBeginner.com and another > portal I am planning to open soon. All of you are welcome to contribute > and/or to reproduce it on your own sites. > > Thanks all, > hope it's helpful. > > > Regards, > Maxim Maletsky > > www.PHPBeginner.com > > > > > -Original Message- > From: Maxim Maletsky [mailto:[EMAIL PROTECTED]] > Sent: Saturday, August 18, 2001 2:30 PM > To: Terrie * > Subject: Large sites using PHP > > > > Terrie, > On the meeting we had last Thursday you asked me about the large sites that > use PHP. I have composed a small list of such sites. > > Here it goes: > > > > www.sourceforge.net (30 millions pv/month) > > www.audiogalaxy.com (Napster follow-up, > dozens of millions per/month) > > http://livebid.amazon.com (a part of Amazon.com, > bet has a good traffic) > > http://mp3.lycos.com (One of the largest MP3 search > engines in the world by Lycos. > Their traffic but must be > measured in several dozens of > millions pv/mon) > > http://xoom.com (a huge online multi-service site. > the #1 competitor to GeoCities) > > www.capitalone.com (well known credit card company) > > www.ecrush.com (14 million hits a month on avg) > > www.bangable.com (4 million page views a month. > All PHP/mySQL) > > www.amdmb.com (uses MySQL and PHP for > everything. 5 million pages/mon) > > www.insight.com (is a publicly traded > fortune 1000 company. > The site is 90% PHP) > > www.ig.com.br (the 3rd largest Brazilian portal) > > www.goeureka.com.au/super.php (AltaVista in Australia) > > www.kinderstart.com (Major children's portal. > PHP and mySQL and some Perl.) > > www.marketplayer.com (provides the real-time stock > market simulations for sites like > etrade.com and smartmoney.com > that have these games) > > www.dc.com (Deloitte Consulting) > > www.dialpad.com (user registration and member > backend is PHP driven) > > www.thewb.com (uses PHP for the interactive > areas such as message boards, > polls, etc.) > > > also: > > www.nbci.com > www.sprint.ca > www.ElectronicArts.com > www.f2s.com > www.indy500.com > www.planetsourceocde.com > www.easydns.com > www.admworld.com > www.communityconnect.com > www.viant.com > www.chek.com > > > Some say that also HP, IBM, and even Mr. Microsoft run "some" Apache/PHP > servers (looking it up on Netcraft.com--use their OS vendors search) > > Here is the link to a related discussion on PHP developers mailing list > archive: > http://marc.theaimsgroup.com/?t=99616558100011&w=4&r=1 > > ** > All this data was composed from the posts of respectable developers on the > international PHP mailing list. > ** > > > Sincerely, > > Maxim Maletsky > Founder, Chief Developer > > PHPBeginner.com (Where PHP Begins) > [EMAIL PROTECTED] > www.phpbeginner.com > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] FW: Large sites using PHP
I come from asp world, too, but I wouldn't say php is quicker to develop. Sometimes it can take longer. But it's really worth it. -Message d'origine- De : pierre-yves [mailto:[EMAIL PROTECTED]] Envoyé : samedi 18 août 2001 14:45 À : [EMAIL PROTECTED] Objet : Re: [PHP] FW: Large sites using PHP Dear PHP fans, Knowing large sites that use php is one thing (it shows the language can support heavy loads). But what I would really like to know is the time difference to design, code and implement web application in PHP versus java solution, or ColdFusion, or another language. I switch to PHP because I love the language but mainly because I could develop application about 30% faster than ASP. (the language I used before) The staff I hire can learn PHP and be very productive within a few days, soory but I can't say the same for other language... py - Original Message - From: "Maxim Maletsky" <[EMAIL PROTECTED]> To: "PHP" <[EMAIL PROTECTED]> Sent: Saturday, August 18, 2001 1:45 AM Subject: [PHP] FW: Large sites using PHP > > Dear PHP gurus: > > I've been following here the ever-growing-never-to-be-stopped discussions > related to the largest sites using PHP. Apparently, most of the PHP > developers are trying to convince their bosses to use Open Source language > PHP instead of other 'silly' commercial solutions those 'brains' have in > mind. > > It is just happened to me to be asked the same thing on a meeting with one > of our clients. Therefore I have composed a dirty list of sites you all were > posting during the time. I've done no research on this at all. My work > consisted only in organizing your comments into one single resource. > > The forwarded email below is what I came up with. > > Please, who cares, update this list and perhaps even make it available to > public online. Could be a good idea to have such resource running somewhere. > I will definitely create a section for it on PHPBeginner.com and another > portal I am planning to open soon. All of you are welcome to contribute > and/or to reproduce it on your own sites. > > Thanks all, > hope it's helpful. > > > Regards, > Maxim Maletsky > > www.PHPBeginner.com > > > > > -Original Message- > From: Maxim Maletsky [mailto:[EMAIL PROTECTED]] > Sent: Saturday, August 18, 2001 2:30 PM > To: Terrie * > Subject: Large sites using PHP > > > > Terrie, > On the meeting we had last Thursday you asked me about the large sites that > use PHP. I have composed a small list of such sites. > > Here it goes: > > > > www.sourceforge.net (30 millions pv/month) > > www.audiogalaxy.com (Napster follow-up, > dozens of millions per/month) > > http://livebid.amazon.com (a part of Amazon.com, > bet has a good traffic) > > http://mp3.lycos.com (One of the largest MP3 search > engines in the world by Lycos. > Their traffic but must be > measured in several dozens of > millions pv/mon) > > http://xoom.com (a huge online multi-service site. > the #1 competitor to GeoCities) > > www.capitalone.com (well known credit card company) > > www.ecrush.com (14 million hits a month on avg) > > www.bangable.com (4 million page views a month. > All PHP/mySQL) > > www.amdmb.com (uses MySQL and PHP for > everything. 5 million pages/mon) > > www.insight.com (is a publicly traded > fortune 1000 company. > The site is 90% PHP) > > www.ig.com.br (the 3rd largest Brazilian portal) > > www.goeureka.com.au/super.php (AltaVista in Australia) > > www.kinderstart.com (Major children's portal. > PHP and mySQL and some Perl.) > > www.marketplayer.com (provides the real-time stock > market simulations for sites like > etrade.com and smartmoney.com > that have these games) > > www.dc.com (Deloitte Consulting) > > www.dialpad.com (user registration and member > backend is PHP driven) > > www.thewb.com (uses PHP for the interactive > areas such as message boards, > polls, etc.) > > > also: > > www.nbci.com > www.sprint.ca > www.ElectronicArts.com > www.f2s.com > www.indy500.com > www.planetsourceocde.com > www.easydns.com > www.admworld.com > www.communityconnect.com > www.viant.com > www.chek.com > > > Some say that also HP, IBM, and even Mr. Microsoft run "some" Apache/PHP > servers (looking it up on Netcraft.com--use their OS vendors search) > > Here is the link to a related discussion on PHP developers mailing list > archive: > http://marc.theaimsgroup.com/?t=99616558100011&w=4&r=1 > > ** > All this data was composed from the posts of respectable developers on the > international PHP mailing list. > ** > > > Sincerely, > > Maxim Maletsky > Founder, Chief Developer > > PHPBeginner.com (Where PHP Begins) > [EMAIL PROTECTED] > www.phpbeginner.com > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For
[PHP] Re: cgi 2 php
cgi is not actually a programming langauage, but is a way of accessing programs through a webserver. php can be run as a 'cgi' if you like. i think what you mean is, has anyone seen a 'perl' to 'php' converter. perl is one of the most common languages used through cgi, and many of the scripts you see on the web are written in perl (look at the first line of the script). i personally havent any such converter. jamie burns. "Steven Dowd" <[EMAIL PROTECTED]> wrote in message 036601c127e2$a78f67d0$0100a8c0@win2k">news:036601c127e2$a78f67d0$0100a8c0@win2k... > Has anyone ever come across a cgi 2 php program at all, similar to the > asp2php program ? > > or has anyone got a quick and easy tutorial for me to read through on what > needs converting to what , language 2 language . > > Steven > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] accents and postgresql
[I already sent this message to the php-db mailing list, but since it seems to be a low-traffic list, I thought I'd also send it to this list, thanks a lot for your answers :-)] Hi everybody ! I've got a quite confusing problem : Yesterday, I upgraded my postgresql server from 7.0.3 to 7.1. I did some pg_dumps and created the DBS on the new server. Everything went fine. But now, I've got some problems : When accessed through php, *sometimes* characters with accents don't come out right. I did some testing and the results are here : -psql doesn't have this problem, so I think it is not a postgresql related thing. -When the database is created with a UNICODE encoding, accentuated characters appears as (xx). With a SQL_ANSII encoding, accentuated characters come out as other letters. phpPgAdmin also has this problem, as well as all the websites I have written. Has anybody else had this problem, or does someone sees where I could watch further, I'm quite stuck ? Thanks a lot for your replies. Florian Blaser -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] error: input in flex scanner failed
anyone got any inside info on waht this error means? I changed one line of code.. and caboom.. - Peter
Re: [PHP] accents and postgresql
On Sáb 18 Ago 2001 10:19, Florian Blaser wrote: > Hi everybody ! > > I've got a quite confusing problem : > > Yesterday, I upgraded my postgresql server from 7.0.3 to 7.1. I did some > pg_dumps and created the DBS on the new server. Everything went fine. > > But now, I've got some problems : When accessed through php, *sometimes* > characters with accents don't come out right. I did some testing and the > results are here : > > -psql doesn't have this problem, so I think it is not a postgresql related > thing. psql, as well as pgaccess give me the encoded caracter instead of the acentuated vocal, but I don't mind, cuase psql is only for personal use. PHP gives me the right caracter. > -When the database is created with a UNICODE encoding, accentuated > characters appears as (xx). With a SQL_ANSII encoding, accentuated > characters come out as other letters. Which locale are you using (I think this has nothing to do with the problem, but who knows). > phpPgAdmin also has this problem, as well as all the websites I have > written. I just checked a database which is been loaded with phpPgAdmin 2.3 and I got the acents OK. > Has anybody else had this problem, or does someone sees where I could watch > further, I'm quite stuck ? I really don't know where your problem can be. Try to set the environment variables correcty to your local locale. It could help. Saludos... :-) -- Porqué usar una base de datos relacional cualquiera, si podés usar PostgreSQL? - Martín Marqués |[EMAIL PROTECTED] Programador, Administrador, DBA | Centro de Telematica Universidad Nacional del Litoral - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Overlaying text on jpegs
I hear this is achievable via php. My GD information is: GD Support enabled GD Version 1.6.2 or higher FreeType Support enabled FreeType Linkage with TTF library GIF Support enabled JPG Support enabled PNG Support enabled WBMP Support enabled So could someone show me an example of how to overlay "hello2 onto file test.jpg. thanks, - seb -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
php-general Digest 18 Aug 2001 16:31:47 -0000 Issue 823
php-general Digest 18 Aug 2001 16:31:47 - Issue 823 Topics (messages 63266 through 63288): question from a php newbie 63266 by: 602e23 63269 by: Maxim Maletsky Re: looong date formatting for MySQL 63267 by: Maxim Maletsky Re: debugger_on() undefined? 63268 by: Matthew Loff Re: History of the browser 63270 by: Maxim Maletsky Re: Large sites that use PHP 63271 by: Tom Malone ADODB Library 63272 by: Jochen Kaechelin Problems with cookies 63273 by: Marius Pertravèius Help compiling CVS 63274 by: Evan Nemerson Re: Large sites using PHP 63275 by: Maxim Maletsky 63282 by: pierre-yves 63283 by: Quentin Gillet Search for PHP Motivation Studies 63276 by: Björn Schotte SQL Highlighting in PHP? 63277 by: Chris Lambert array_unique() and count issue 63278 by: CGI GUY advantage of php 63279 by: nafiseh saberi 63280 by: pierre-yves cgi 2 php 63281 by: Steven Dowd 63284 by: Jamie Burns accents and postgresql 63285 by: Florian Blaser 63286 by: Martín Marqués error: input in flex scanner failed 63287 by: PeterOblivion.aol.com Overlaying text on jpegs 63288 by: Seb Frost Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- I'm so new to this, in fact, that I may not be able to even frame my question correctly. Please bear with me. Suppose that I had a list in a data base of, say, countries and that I built an array as $states = array ( array("abbr"=>"MA", "name"=>"Massachusetts"), array("abbr"=>"NY", "name"=>"New York"), array("abbr"=>"CA", "name"=>"California"), [. . .] ) is there a way to dump this array in a form which would allow it to be written to an 'include' file. I tried both var_dump and print_r but neither method seems to have worked correctly. The actual array which I have in mind is much more complicated structurally than the states array shown above, but it is unlikely to change more than once a day so it seems wastefull to probe the database each time a copy is needed. av0- You know, what you can do (strongly not recommended, but still) is to insert that whole thing into a database and then pull this string out and pass it through eval(). ie: eval($record); another way would be to take all that, addslashes($it) and then write into a file with stripslashes($it). But, you are going to need that statement to be a string, not code. Otherwise you can "read yourself", fread() your own file to take your code as a string. After all, those are kinda silly methods. I am sure you can find a better solution for your needs. Storing codes is a very powerful but not always necessary procedure. Cheers, Maxim Maletsky www.PHPbeginner.com -Original Message- From: 602e23 [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 18, 2001 12:26 PM To: [EMAIL PROTECTED] Subject: [PHP] question from a php newbie I'm so new to this, in fact, that I may not be able to even frame my question correctly. Please bear with me. Suppose that I had a list in a data base of, say, countries and that I built an array as $states = array ( array("abbr"=>"MA", "name"=>"Massachusetts"), array("abbr"=>"NY", "name"=>"New York"), array("abbr"=>"CA", "name"=>"California"), [. . .] ) is there a way to dump this array in a form which would allow it to be written to an 'include' file. I tried both var_dump and print_r but neither method seems to have worked correctly. The actual array which I have in mind is much more complicated structurally than the states array shown above, but it is unlikely to change more than once a day so it seems wastefull to probe the database each time a copy is needed. av0- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] Still, read this php.net/date it has a variety of functions, dates with zeros and without... Another thing you can do is using the mySQL manual. Did you know that mySQL has a WHOLE BUNCH of date functions? Cheers, Maxim Maletsky -Original Message- From: CGI GUY [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 18, 2001 8:30 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] looong date formatting for MySQL Thanks for the reply, however, that function call doesn't zero-substitute (i.e., "07" for "7", "03" for "3", etc.); that's why I've added this: if ($month < 10) { $month = "0"; $month .=
[PHP] Re: [PHP-DB] Help with update...
Well, might not be the good answer, since it's been a long time I haven't used mysql. But, does mysql is case sensitive on table names ? try using albums instead of ALBUMS in your update query. Just my .002 cents Florian Le Samedi, 18 Août 2001 18.21, vous avez écrit : > I'm working under the gun here, so please excuse me if this turns out to be > something really simple, but it's got me stumped... I'm trying to update > the "cover" field in a table by using the album_id field in the table and > adding a ".jpg" extention to it... > For example: > "Update albums set cover = "1.jpg" where album_id = 1" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] accents and postgresql
Le Samedi, 18 Août 2001 16.45, Martín Marqués a écrit : > Which locale are you using (I think this has nothing to do with the > problem, but who knows). fr_CH iso-8859-1 > I just checked a database which is been loaded with phpPgAdmin 2.3 and I > got the acents OK. I did further testing : - I set up a server on another machine with the old version (7.0.3) and tried to load the DB using the SQL output of a 'pg_dump -D' : The problem still occurs. I then copied the old $PG_DATA directory to the new server and tried. At first, I always got encoded chars (which at least better to me), then I restated apache/php and everything went back to normal (ie I got the right accentuated chars). A thing that I have to say is that I'm not using the latest version of PHP, since I'm always trying to keep myself using the stable version of debian. (postgresql being one of two exceptions, since version 6.5 is quite obsolete now.) >psql, as well as pgaccess give me the encoded caracter instead of the >acentuated vocal, but I don't mind, cuase psql is only for personal use. PHP >gives me the right caracter. Well, my problem is that php *sometimes* (~ every 2 connexions) returns the right characters, while I get an encoded character every other time. If only it would give the same answer everytime ! > I really don't know where your problem can be. Try to set the environment > variables correcty to your local locale. It could help. Well, at least the locale is right... > > Saludos... :-) Thanks a lot for your answer, Saludos ... :-P Florian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] IDE
Can anyone suggest a decent IDE for php? Currently, I'm using phped and I'm not overly happy with it's performance... Max -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] IDE
Are you using NuSphere's version of PHPEd, or the old free one? So far, the best Windows IDE I've used has been NuSphere's upgraded PHPEd. Zend's 2.0 IDE also looks promising, though. /* Chris Lambert, CTO - [EMAIL PROTECTED] WhiteCrown Networks - More Than White Hats Web Application Security - www.whitecrown.net */ - Original Message - From: Max Mouse <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, August 18, 2001 6:17 PM Subject: [PHP] IDE | Can anyone suggest a decent IDE for php? Currently, I'm using phped and I'm | not overly happy with it's performance... | | Max | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | To contact the list administrators, e-mail: [EMAIL PROTECTED] | | | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] MySql or flat database using PHP ?
Before I start creating an Sql table/database, thought I would ask for advice first. I am creating a directory online, with urls information, links, email addresses etc etc. What do you think is best a MySql database or writing it to a file using fopen/fwrite (flat file) ??? Your thoughts would be very much appreciated. Thanks Dave
[PHP] Re: MySql or flat database using PHP ?
It depends... if you have a handful of records, you might start with a flat file. but if you think you'll get to hundreds of records, go with a database. Even if all you want is a small array of data, go with a database. If all you want is a simple array, you might consider use DBM files (Look at, for example, http://www.php.net/manual/en/ref.dbm.php ). If you really need SQL goodies, also consider PostgreSQL. Both MySQL and PostgreSQL work great with PHP. Emilio - Original Message - "David Ovens" <[EMAIL PROTECTED]> wrote in message 001301c12824$8cd3a9a0$24047ad5@tinypc">news:001301c12824$8cd3a9a0$24047ad5@tinypc... Before I start creating an Sql table/database, thought I would ask for advice first. I am creating a directory online, with urls information, links, email addresses etc etc. What do you think is best a MySql database or writing it to a file using fopen/fwrite (flat file) ??? Your thoughts would be very much appreciated. Thanks Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Slow LDA Queries
I have OpenLDAP and PHP 4.0.4p1 on a RedHat 7.1 (plain distribution, didn't recompile anything, and I use MOD_LDAP to authenticate users to an intranet site. I want PHP pages to show the real username so I have this function I call when I want to know the username. the mod_ldap queries and ldap queries from a Perl CGI return very fast. On Perl I don't notice an performance issue (with less than a couple queries/second), but each query using PHP takes about two full seconds (or more). I did a workaround keeping the result on a session variable, but it's still slow every time I call this function. mod_ldap stores the user's dn on the REMOTE_USER environment variable. Here's the function. I don't know how to make it faster. Thanks, Emilio Panighetti ldap://".$s_ldapserver.":".$s_ldapport ); ldap_set_option( $ds, LDAP_OPT_PROTOCOL_VERSION, 3); $qar[] = "cn"; if ( $ds ) { $r = ldap_bind( $ds ); $sr = ldap_read( $ds, getenv( "REMOTE_USER" ), "cn=*", $qar, 0, 1, 1 ); $info = ldap_get_entries($ds, $sr); $s_RealName = $info[0]["cn"][0]; ldap_close( $ds ); return( $s_RealName ); } } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Search for PHP Motivation Studies
IN the book "Web Application Development with PHP 4.0" There is an entire chapter towards the end of the book that describes such case studies. Hope this helps. -Original Message- From: Björn Schotte [mailto:[EMAIL PROTECTED]] Sent: Friday, August 17, 2001 11:36 PM To: [EMAIL PROTECTED] Subject: [PHP] Search for PHP Motivation Studies Hi, for a well-known PHP advocacy site we are searching for motivation studies of (big) companies who decided to use PHP. A "PHP motivation study" is not like a normal case study where you tell the reader about the application foobar.com. Instead, you tell 'em about why, when and how you decided to use PHP for foobar.com, i.e. "because PHP is so easy to learn" or sth. like that (also interesting if you had the choice between PHP and [Perl|Java|Python|foo] and why you finally chose PHP). If you're interested in that, please contact me for further details. TIA, Björn Schotte. -- Die Marktumfrage zu PHP Schulungen, Consultingdienstleistungen und frei verfügbaren Artikeln. Mitmachen? http://www.thinkphp.de/survey/survey.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] MySql or flat database using PHP ?
Dave, Unless there is a strong reason for using files (like for example it interfaces with a different app which uses files) then the case for a proper RDBMS (eg MySQL) is the better choice. Databases are much easier (/quicker) to add and delete records from, search etc HTH, Tom - Original Message - From: "David Ovens" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, August 18, 2001 9:29 PM Subject: [PHP] MySql or flat database using PHP ? Before I start creating an Sql table/database, thought I would ask for advice first. I am creating a directory online, with urls information, links, email addresses etc etc. What do you think is best a MySql database or writing it to a file using fopen/fwrite (flat file) ??? Your thoughts would be very much appreciated. Thanks Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: MySql or flat database using PHP ?
Dear Emilio, For about 20 years, I've wanted to develop a mineral identification program. I bought a PHP tutorial book on June 25th, and had the site running by July 14th. if you're planning something similar to http://www.ironorchid.com/minerals/ , then php with mysql is the way to go. Oh, and by the way, the only software writing experience I've had, was a course in BASIC 23 years ago. Good luck. - Original Message - From: Emilio Panighetti <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, August 18, 2001 2:06 PM Subject: [PHP] Re: MySql or flat database using PHP ? > It depends... if you have a handful of records, you might start with a flat > file. but if you think you'll get to hundreds of records, go with a > database. > > Even if all you want is a small array of data, go with a database. > If all you want is a simple array, you might consider use DBM files (Look > at, for example, http://www.php.net/manual/en/ref.dbm.php ). > > If you really need SQL goodies, also consider PostgreSQL. Both MySQL and > PostgreSQL work great with PHP. > > Emilio > > - Original Message - > "David Ovens" <[EMAIL PROTECTED]> wrote in message > 001301c12824$8cd3a9a0$24047ad5@tinypc">news:001301c12824$8cd3a9a0$24047ad5@tinypc... > Before I start creating an Sql table/database, thought I would ask for > advice first. > > I am creating a directory online, with urls information, links, email > addresses etc etc. What do you think is best a MySql database or writing it > to a file using fopen/fwrite (flat file) ??? Your thoughts would be very > much appreciated. > > > Thanks > > Dave > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: MySql or flat database using PHP ?
Sorry Emilio, this should have gone to Dave. - Original Message - From: Hugh Danaher <[EMAIL PROTECTED]> To: Emilio Panighetti <[EMAIL PROTECTED]> Cc: Php-General <[EMAIL PROTECTED]> Sent: Saturday, August 18, 2001 5:16 PM Subject: Re: [PHP] Re: MySql or flat database using PHP ? > Dear Emilio, > For about 20 years, I've wanted to develop a mineral identification program. > I bought a PHP tutorial book on June 25th, and had the site running by July > 14th. if you're planning something similar to > http://www.ironorchid.com/minerals/ , then php with mysql is the way to go. > Oh, and by the way, the only software writing experience I've had, was a > course in BASIC 23 years ago. Good luck. > - Original Message - > From: Emilio Panighetti <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Saturday, August 18, 2001 2:06 PM > Subject: [PHP] Re: MySql or flat database using PHP ? > > > > It depends... if you have a handful of records, you might start with a > flat > > file. but if you think you'll get to hundreds of records, go with a > > database. > > > > Even if all you want is a small array of data, go with a database. > > If all you want is a simple array, you might consider use DBM files (Look > > at, for example, http://www.php.net/manual/en/ref.dbm.php ). > > > > If you really need SQL goodies, also consider PostgreSQL. Both MySQL and > > PostgreSQL work great with PHP. > > > > Emilio > > > > - Original Message - > > "David Ovens" <[EMAIL PROTECTED]> wrote in message > > 001301c12824$8cd3a9a0$24047ad5@tinypc">news:001301c12824$8cd3a9a0$24047ad5@tinypc... > > Before I start creating an Sql table/database, thought I would ask for > > advice first. > > > > I am creating a directory online, with urls information, links, email > > addresses etc etc. What do you think is best a MySql database or writing > it > > to a file using fopen/fwrite (flat file) ??? Your thoughts would be very > > much appreciated. > > > > > > Thanks > > > > Dave > > > > > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP 4.0.6 Problem with ImageTTFText
Hello all, I have just recently found out that there is a bug in the function ImageTTFText regarding the font name. Apparently no matter what you enter, the font is unable to be loaded regardless if you put an absolute path or not to the filename. I read some where that it was fixed in the CSV. My problem is that I need 4.0.6 as I am doing some work with 24-bit PNG images and 4.0.5 doesn't seem to support the high colours. The images work fine in 4.0.6 but now the font function doesn't work. So I guess I am asking is if I want to get the new version working before the next release, I will need to download the CSV tree and manually compile everything? If this is the case, is there some where that explains what is necessary to compile the PHP, GD, FreeType and ODBC libraries under the Win32 platform? Do when know when the next release will be coming out? Any help that you can provide would be appreciated. Thanks. -- Richard Morris [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] security concerns using PHP in shared, name based virtual server setup
currently only offer full php, postgres, mysql, et al access with virtual server accounts (chrootd hacks, or jailed environments) these are cumbersome though. Anyone have input regarding the potential security concerns with allowing users (right now only chrooted ftp users with no permissions) to run PHP files from a shared apache server. Hardening that should take place... obviously want to give users as much freedone to implement customized PHP code as possible wihout comprimising security of other users on these servers. Looking for comments and pointers to faq's/toaster instructions, etc... Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Ayuda para hace funcionar PHP
Hola amigos necesito ayuda para hacer funcionar PHP en mi maquina Utilizo Windows 98SE y PWS y no me reconoce las paginas PHP cuando le doy que ejecute el browser me sale el siguiente error Error 403 de HTTP 403.1 Prohibido: prohibido el acceso de ejecución Este error puede producirse si intenta ejecutar un programa CGI, ISAPI u otro programa ejecutable desde un directorio que no permite ejecutar programas. Póngase en contacto con el administrador del servidor Web si el problema persiste. Baje de Internet la versión 4 de PHP de la dirección www.php.net/downloads baje los siguientes archivos php406-installer.exe php-4.0.6-Win32.zip Instale el uno y el otro lo descomprimí dentro de la carpeta c:\PHP Esta parte no entiendo en la sección de pedir ayuda dice los siguiente si está ejecutando el PHP como CGI o como módulo de servidor, etc. --- Edgar Baldiviezo V. Est. Ing. Sistemas --- Visita Mi sitio: http://www.ebaldiviezo.cjb.net --- Ponte en contacto conmigo por el MSN: mailto:[EMAIL PROTECTED] --- Para mensajes sin datos adjuntos: mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] class variables and methods
I've been doing some reading up on OOP in PHP, and looking at some of the classes available on the web, and I've got what is probably a stupid question. I've seen this many many times.. class someclass { var $somevar = "someval"; function set( $key, $val ) { $this->$key = $val; } } $myClass = new someclass; $myClass->set( "somevar", "someotherval" ); why write a set method when you can just as easily call $myClass->somevar = "someotherval"; Is there a reason for this? Also, alot of the different table classes (an OOP approach to HTML tables) stores the data in arrays, but at what point is it too much to store into an array? Say you have a forum and the text entered for a single respone could be quite lengthy, much less for 100 replies... wouldn't that be a bit much to store into an array? I know it depends on the system resources, but is there a practical limit that people follow? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Slow LDA Queries
Emilio, Few thoughts: o Is the call syntax you're using for ldap_read() correct? The online manual page describes the second parameter as being the base dn, you're passing the user's username. ( getenv("REMOTE_USER")). I'm surprised that this code works. o The comparisons you're making: Are they comparing similar LDAP searches. There are issues that may not involve PHP at all that could be the cause of you're performance issue. For example, you're search could find all entries with a cn attribute at the base dn. This could potentially be a large number of entries. Also, if you search for something and the attributes you reference in your search filter are not indexed performance will degrade linearly as you add more entries to your directory. o Session Caching. At CommNav, we've had good success with this strategy. We store quite a bit of information in the users session. It's not uncommon for our user sessions to grow to above 100Kb, and I've seen them as big as 300Kb. Retrieving data from the session (i.e. the unserialize() function) is much less expensive then going to LDAP for every hit to the web app. Since these thoughts are not related to PHP, you can feel free to contact me off-list to discuss further. Andy On Sat, Aug 18, 2001 at 05:07:26PM -0400, Emilio Panighetti wrote: > I have OpenLDAP and PHP 4.0.4p1 on a RedHat 7.1 (plain distribution, didn't > recompile anything, and I use MOD_LDAP to authenticate users to an intranet > site. I want PHP pages to show the real username so I have this function I > call when I want to know the username. > > the mod_ldap queries and ldap queries from a Perl CGI return very fast. On > Perl I don't notice an performance issue (with less than a couple > queries/second), but each query using PHP takes about two full seconds (or > more). I did a workaround keeping the result on a session variable, but it's > still slow every time I call this function. > mod_ldap stores the user's dn on the REMOTE_USER environment variable. > > Here's the function. I don't know how to make it faster. > > Thanks, > Emilio Panighetti > > // Retrieves user's real name from LDAP > function ldapcnsearch() > { >$s_ldapserver = "localhost"; >$s_ldapport = 389; >$ds = ldap_connect( "ldap://".$s_ldapserver.":".$s_ldapport ); >ldap_set_option( $ds, LDAP_OPT_PROTOCOL_VERSION, 3); >$qar[] = "cn"; >if ( $ds ) { > $r = ldap_bind( $ds ); > $sr = ldap_read( $ds, getenv( "REMOTE_USER" ), "cn=*", $qar, 0, 1, > 1 ); > $info = ldap_get_entries($ds, $sr); > $s_RealName = $info[0]["cn"][0]; > ldap_close( $ds ); > return( $s_RealName ); >} > } > ?> > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- -- Andrew Libby Director of Technology CommNav, Inc [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] MySql or flat database using PHP ?
Dave, IMHO, a major consideration for Web apps is contention and s synchronization. If you intend to allow users to update data on in the app it becomes important to coordinate writes (with locking) so that no two users can write to the same (region) of the file at the same time. An RDBMS (MySQL, PostgreSQL) or a directory (OpenLDAP) takes care of this (as well as many other problems with data storage and retrieval). I agree with the other statements I've seen here, but wanted to add this as well. I've done it both ways and the DBMS, Directory route tends to be a better solution. This is code reuse of the best kind. My humble $0.02. Andy On Sat, Aug 18, 2001 at 09:29:56PM +0100, David Ovens wrote: > Before I start creating an Sql table/database, thought I would ask for advice first. > > I am creating a directory online, with urls information, links, email addresses etc >etc. What do you think is best a MySql database or writing it to a file using >fopen/fwrite (flat file) ??? Your thoughts would be very much appreciated. > > > Thanks > > Dave > > > -- -- Andrew Libby Director of Technology CommNav, Inc [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Display Image
Hi, I tried below to display the picture on the webpage. I have in the pcture column a http address. echo "" . $row["description"] . " and I get this: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' Your help is very much appreciated. Andonny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Display Image
well you've got that unmatched " at the end... - seb -Original Message- From: Andonny [mailto:[EMAIL PROTECTED]] Sent: 19 August 2001 03:28 To: [EMAIL PROTECTED] Subject: [PHP] Display Image Hi, I tried below to display the picture on the webpage. I have in the pcture column a http address. echo "" . $row["description"] . " and I get this: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' Your help is very much appreciated. Andonny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Fw: [PHP] Display Image
echo "" . $row["description"] . " - Original Message - From: "Andonny" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, August 18, 2001 7:27 PM Subject: [PHP] Display Image > Hi, > I tried below to display the picture on the webpage. I have in the pcture > column a http address. > > echo "" . $row["description"] . " > > and I get this: > > Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or > `T_NUM_STRING' > > Your help is very much appreciated. > Andonny > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Help with weird error..
Hey guys, anyone know what Fatal error: input in flex scanner failed in /home/k/kyle/public_html on line means? thanks
Fw: [PHP] Display Image (correcting myself) :P
echo "" . $row["description"] . ""; - Original Message - From: "Chris Schneck" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, August 18, 2001 7:29 PM Subject: Fw: [PHP] Display Image > echo "" . $row["description"] . " > > > - Original Message - > From: "Andonny" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Saturday, August 18, 2001 7:27 PM > Subject: [PHP] Display Image > > > > Hi, > > I tried below to display the picture on the webpage. I have in the pcture > > column a http address. > > > > echo "" . $row["description"] . " > > > > and I get this: > > > > Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or > > `T_NUM_STRING' > > > > Your help is very much appreciated. > > Andonny > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Display Image
Thanks for your reply. This is the whole line and I am not sure which one to take out echo "" . $row["description"] . ""; Andonny Seb Frost <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > well you've got that unmatched " at the end... > > - seb > > -Original Message- > From: Andonny [mailto:[EMAIL PROTECTED]] > Sent: 19 August 2001 03:28 > To: [EMAIL PROTECTED] > Subject: [PHP] Display Image > > > Hi, > I tried below to display the picture on the webpage. I have in the pcture > column a http address. > > echo "" . $row["description"] . " > > and I get this: > > Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or > `T_NUM_STRING' > > Your help is very much appreciated. > Andonny > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] class variables and methods
Joe, There are varying opinions on this issue. The argument for methods is that it hides the internal structure of your class. This is always a good thing. This means that the internals of the class can be changed, but the user interface (the user is the programmer here) does not change. So this alternative implementation of someclass class someclass { var $data = false; function set($key,$val) { $this->data[$key] = $val; } } is no different the the calling code. In general, I tend to have an accessor/mutator method for each 'property' that I would like to provide access to. I'd have a method for each $key that I want to support (this may not apply in your case). class someclass { var $name = false; var $age = false; function name() { if(func_num_args()) $this->name = func_get_arg(0); return $this->name; } function age() { if(func_num_args()) $this->age= func_get_arg(0); return $this->age; } } Now, this gets a big annoying to code since the lions share of my classes have the name method implementations. I've been hunting for a way to create methods dynamically, but I've only found one. To create class definitions on the fly and eval() them. This works great when you've got a huge number of properties (class/instance vars). I'll construct a static method on the class that processes examines the class vars (get_class_vars()) and defines a class extending my implementation. The sub class has the methods implemented for accessing/mutating the properties I'd like to have methods for. If anyone knows of a means to do this to an existing class (say using create_function() or something), I'd love to hear about it. Andy On Sat, Aug 18, 2001 at 07:09:08PM -0700, Joe Sheble (Wizaerd) wrote: > I've been doing some reading up on OOP in PHP, and looking at some of the > classes available on the web, and I've got what is probably a stupid > question. I've seen this many many times.. > > class someclass { > var $somevar = "someval"; > > function set( $key, $val ) { > $this->$key = $val; > } > } > > $myClass = new someclass; > $myClass->set( "somevar", "someotherval" ); > > why write a set method when you can just as easily call > $myClass->somevar = "someotherval"; > > Is there a reason for this? > > Also, alot of the different table classes (an OOP approach to HTML tables) > stores the data in arrays, but at what point is it too much to store into an > array? Say you have a forum and the text entered for a single respone could > be quite lengthy, much less for 100 replies... wouldn't that be a bit much > to store into an array? I know it depends on the system resources, but is > there a practical limit that people follow? > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- -- Andrew Libby Director of Technology CommNav, Inc [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Display Image
I always split it up if I'm having errors... echo ""; echo $row["description"]; - seb - Original Message - From: "Chris Schneck" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, August 18, 2001 7:29 PM Subject: Fw: [PHP] Display Image > echo "" . $row["description"] . " > > > - Original Message - > From: "Andonny" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Saturday, August 18, 2001 7:27 PM > Subject: [PHP] Display Image > > > > Hi, > > I tried below to display the picture on the webpage. I have in the pcture > > column a http address. > > > > echo "" . $row["description"] . " > > > > and I get this: > > > > Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or > > `T_NUM_STRING' > > > > Your help is very much appreciated. > > Andonny > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Extract email address from string
I need to parse a string and extract only the email address. What is the best way to do this? i.e. $string = "Please send all email to [EMAIL PROTECTED] with a subject line of Test."; $email_addr would be equal to [EMAIL PROTECTED] . Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Extract email address from string
Well you need to search for "@" then search forwards and backwards till you get to whitespaces store those positions then use the substr function. - seb -Original Message- From: Gaylen Fraley [mailto:[EMAIL PROTECTED]] Sent: 19 August 2001 03:37 To: [EMAIL PROTECTED] Subject: [PHP] Extract email address from string I need to parse a string and extract only the email address. What is the best way to do this? i.e. $string = "Please send all email to [EMAIL PROTECTED] with a subject line of Test."; $email_addr would be equal to [EMAIL PROTECTED] . Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Extract email address from string
Seb, Seomthing like Well you need to search for "@" > > then search forwards and backwards till you get to whitespaces > > store those positions > > then use the substr function. > > - seb > > -Original Message- > From: Gaylen Fraley [mailto:[EMAIL PROTECTED]] > Sent: 19 August 2001 03:37 > To: [EMAIL PROTECTED] > Subject: [PHP] Extract email address from string > > > I need to parse a string and extract only the email address. What is the > best way to do this? > > i.e. > > $string = "Please send all email to [EMAIL PROTECTED] with a subject > line of Test."; > > $email_addr would be equal to [EMAIL PROTECTED] . > > Thanks. > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- -- Andrew Libby Director of Technology CommNav, Inc [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Need Regex Help
I'm reading a book and have a little confusion in my mind. Consider the following table. Assume that I grabbed it from another web site using: http://www.abc123xyz.com'; $lines_array = file($url); $lines_string = implode('', $lines_array); ?> === banana .46 .55 pear .38 .51 apple .59 .33 === The fruit lables don't change, but prices change daily. How would I parse JUST the two prices to the right of the word pear into a new html table? How would I parse the word pear AND the two prices to the right into a new html table? I think the answers will help me understand better. Thanks Craig ><> [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Need Regex Help
I'd take the results of file() and then walk through the array looking for the lines for the various fruit you're concerned with. Then I'd grab the next two lines and process them, with something like: $line = ".46"; ereg('^([^<]+)',$line,$m); echo $m[1] . "\n"; echo $m[2] . "\n"; IMHO, it's bad to do this kind of thing because any change in the content means a breakage of your processing code. I think that using something like XML or the DOM may be a better approach. Individuals with knowledge in this area can speak more to this idea. Good luck. Andy On Sat, Aug 18, 2001 at 09:48:11PM -0500, Craig Westerman wrote: > I'm reading a book and have a little confusion in my mind. > Consider the following table. Assume that I grabbed it from another web site > using: > $url = 'http://www.abc123xyz.com'; > $lines_array = file($url); > $lines_string = implode('', $lines_array); > ?> > > === > > > > > banana > .46 > .55 > > > pear > .38 > .51 > > > apple > .59 > .33 > > > > > === > > The fruit lables don't change, but prices change daily. > How would I parse JUST the two prices to the right of the word pear into a > new html table? > > How would I parse the word pear AND the two prices to the right into a new > html table? > I think the answers will help me understand better. > Thanks > Craig ><> > [EMAIL PROTECTED] > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- -- Andrew Libby Director of Technology CommNav, Inc [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Protecting include files
Hi, I have a php script which includes .inc files. Is there any way in which I can prevent a normal surferfrom viewing these files. Is there any command that I can add to a .htaccess file. Thanks ~~~ \\__ ! SIDDHARTH HEGDE / CHAOSGAMERZ.COM ! ! Webmaster \ For PC Game screeshots, cheat! ! http://www.ChaosGamerz.COM o| o codes, trainers, downloads, ! ![EMAIL PROTECTED]( |_ game music, FREE e-mail and even ! ! ICQ 84475206 |-- FREE FULL VERSION games for that ! ~~ \___/ 486-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: code to see files in directories
Try this -- shorter. I only tested it out in Win(32)though At 03:00 PM 8/8/01 +0200, you wrote: >[EMAIL PROTECTED] (Eduardo Kokubo) wrote: > > > I think I saw a code to list the files, subdirectories and the files > > in the subdirectories of a simple directory in this list some time > > ago, but I didn't save it. Considering the quantitie of messages in > > this list, It's quite dificult to find this specific code, so ask the > > person who did it or someone else to write this code again. > > > > I'm using this one: > > > > $publico = ftp_nlist ($servidor, "public_html/publico"); > > $cont = 0; > > while ($publico[$cont]){ > > print "$publico[$cont]"; > > $cont++;} > > > > This code doesn't show the files in the subdirectories and it requires > > ftp connection. Not very efficient. > > > > Thanks in advance. > > > > Is there a problem if I just write "thanks in advance"??? It's easier > > then writting back to thanks everybody :) > > > >is this what your looking for? > >function getDirContents($slashdir) { > $dh = opendir($slashdir); > > while (($file = readdir ($dh))) { > if (is_dir($slashdir . $file) && $file != "." && $file != "..") { > getDirContents ($slashdir . $file . "/"); > } else if ($file != "." && $file != "..") { > echo $file . ""; > } > } > closedir($dh); >} > >getDirContents("/test/"); > >-- >Henrik Hansen > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Protecting include files
Order allow,deny Deny from all On Mon, 14 Aug 2000, Sid wrote: > Hi, > > I have a php script which includes .inc files. Is there any way in which I > can prevent a normal surferfrom viewing these files. Is there any command > that I can add to a .htaccess file. > > Thanks > > ~~~ \\__ > ! SIDDHARTH HEGDE / CHAOSGAMERZ.COM ! > ! Webmaster \ For PC Game screeshots, cheat! > ! http://www.ChaosGamerz.COM o| o codes, trainers, downloads, ! > ![EMAIL PROTECTED]( |_ game music, FREE e-mail and even ! > ! ICQ 84475206 |-- FREE FULL VERSION games for that ! > ~~ \___/ 486-- > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Protecting include files
At 08:26 PM 8/18/01 -0700, Rasmus Lerdorf wrote: > > Order allow,deny > Deny from all BTW, .inc files can include PHP code that is executed, right? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Uploading Image to Database
> database ... the script seems to be working, in that its not giving errors You're not asking it to give you error messages :-) > > if ($submit) { > > MYSQL_CONNECT("localhost","user","pass"); ... or die("Could not connect to database") > mysql_select_db("binary_date"); ... or die("Could not select binary_date"); > > $data = addslashes(fread(fopen($form_data, "r"), filesize($form_data))); This is pretty scary... You'll have to tear this apart into several lines to get any useful error messages... $file = fopen($form_data, 'r') or die("Could not open $form_data"); $size = filesize($form_data) or die("Could not get size of $form_data"); # php.net doesn't say what fread returns in the event of a failure... # Let's assume nobody is uploading an empty file: $rawdata = fread($file, $size) or die("Could not read data from $form_data"); $data = addslashes($rawdata); > $result=MYSQL_QUERY("INSERT INTO binary_date > (description,bin_data,filename,filesize,filetype) ". > "VALUES > ('$form_description','$data','$form_data_name','$form_data_size','$form_data _type')"); or die("Query Failed"); > > $id= mysql_insert_id(); > print "This file has the following Database ID: $id"; Is this printing a non-zero ID?... -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: newbie installation help needed - LinuxPPC
> I've been playing around a little with php/mysql/apache on my NT box but I > have just set up one of my Macs as a LinuxPPC machine. I have downloaded > PHP-4.0.6 but now I want to install it to work with the apache server > software already installed. > > I'm a complete newbie as far as linux is concerned so can someone give me > simple step by step instructions on how to do this. > > I also need a little help getting started with MySQL. I have somehow managed > to set it up with my username and password (I think) but I don't know how to > get it stated. Any help there? There's a much lower-volume mailing list specifically for Macintosh Apache/MySQL/PHP called 'AMP' which is hosted at... http://www.dynapolis.com??? Getting MySQL started just once to play with it is probably do-able by opening up a shell, and doing: cd XXX/mysql ./scripts/safe_mysqld & You'll have to replace XXX with where-ever MySQL got installed. Making it start automatically on boot on Mac OS X was a thread on the AMP list whose outcome I forget, but there's a handy URL in the archives for doing it. Note: I'm subscribed to the AMP list, but don't actually have OS X installed anywhere... -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Putting Include files outside of document root
> If my document root is something like /home/myname/dir/ (as per phpinfo()), > and I put my include files in /home/myname/includes/, is that actually > outside of the document root, or is anything under /home/myname/ actually > the document root? Yes, that's outside. If phpinfo() says: /home/myname/dir/ then these are bad: /home/myname/dir/foo.inc /home/myname/dir/includes/foo.inc /home/myname/dir/as/deep/as/you/want/foo.inc and these are okay: /home/myname/includes/foo.inc /home/myname/includes/as/deep/as/you/want/foo.inc /any/other/random/directory/foo.inc Of course, you now have the challenge of configuring 'include_path' in php.ini to have all the paths you need :-) -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: cookie expire...
> Could I expire a cookie on a determinate date?? I mean tell the cookie > that will expire on 17/08/2001... Unless I'm missing something, that's trivial using: http://php.net/manual/en/function.setcookie.php -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Help.
You may be able to use http://php.net/exec Alas, I'm not sure it works under Windows anymore... Or maybe only thread-safe versions of Windows. Or maybe... -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm - Original Message - From: Rajarajeswari Balasubramanian <[EMAIL PROTECTED]> Newsgroups: php.general To: <[EMAIL PROTECTED]> Sent: Friday, August 17, 2001 1:39 AM Subject: Help. > Hi, > > I have created a database with the backend of Mysql > and i am accesing the database using PHP scripts. > > In the database there is one field, which has the > information of the structure of a molecule as a > Coordinate data. > > when i am using the mysql_fetch_array() command to > retrive the data, it's just taking the text part of > the file, which is simply a ASCII characters and > displaying that on the browser screen. > > I have a program whihc will take that coordinate file > as the input and it will convert that file into a 3D > structure, i have the exe file of that program. > > Now my query is > > how do i access this exe file in the php script???, > > Is that Possible in some way??? > > so the data is retrived it has to automatically invoke > the ./xxx file and it will give the 3D rendering of > that data which is in the form of coordinate file. > > Please give me some suggestiosn about this. > > Thanks in advance. > > Raji > > > __ > Do You Yahoo!? > Make international calls for as low as $.04/minute with Yahoo! Messenger > http://phonecard.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Invoking PHP scripts from a redirect location
> 1) Within Apache's httpd.conf file I have the following set: > DocumentRoot "D:/Program Files/Apache Group/Apache/realdocs" > > RedirectMatch permanent ^/$ "P:/Main Projects/Test/index.php" > ScriptAlias /php/ "d:/php/" > AddType application/x-httpd-php .php .phtml > Action application/x-httpd-php "/php/php.exe I don't think you can have files outside of DocumentRoot be served up... I suspect RedirectMatch only works to mangle one path within DocumentRoot to another... Even if Apache was willing to do it, PHP as a CGI is probably compiled to not allow that, *especially* if safe_mode is on, or any of the other security directives. Check those with a phpinfo() You *COULD* create VirtualHosts with different DocumentRoot, and make P:/whatever be a different hostname... -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Reload - erase ------------- please help!
> SHORT: how can I erase the content of a page currently displayed in client's > browser? Or other solutions (see LONG) I don't understand big chunks of this question... You can't erase what they have. You can set no-cache and expiration headers. See http://php.net/header -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: mysql_db_name not working
> The command "mysql_db_name" is not working in our installation. > We get no error, but no database listing either if we use this command. > - > // This is the code which does NOT work: > $dbs = mysql_list_dbs(); ... or die(mysql_error()); > $num_dbs = mysql_numrows($dbs); > for($i=0; $i<$num_dbs; $i++) > { > $db = mysql_dbname($dbs, $i); ... or die(mysql_error()); > echo "db=".$db.""; > } > - > // And this is adopted code from the manual which DOES work: > $db_list = mysql_list_dbs($conn); > while ($row = mysql_fetch_object($db_list)) { >echo "db=".$row->Database . ""; > } > - > > I tried both: mysql_db_name, mysql_dbname. > We need this function to use phpMyAdmin. > Solaris 8, Apache 1.3.20, PHP 4.0.6, MySQL 3.23.40 > > Any ideas why this command does not work? > > > TIA, > Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: HTTPS w/ header() ?
> Is there is a way with PHP (most probably headers) to go HTTPS mode? > I don't want to specify https://www.myserver.com/secured_page.php > I just want it normal but in it's header to tell the browser to initiate an > HTTPS mode. I don't think you can do that... You could send a header to do: header("Location: https://www.myserver.com/secured_page.php";); but pretty much the user will then see the https when the page shows up... What's the big picture here? I've got a feeling you've gone down a wrong path that's making you ask this question... -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] hacks we should know about
> just found this article and the author recommends the following for secure php > scripting. what do the expects think? This article has been discussed in excruciating detail on [EMAIL PROTECTED] and the expert's opinions are archived... http://php.net/support.php should lead you to this archive. > - Set register_globals off > This option will stop PHP creating global variables for user input. That is, > if a user submits the form variable 'hello' PHP won't set $hello, only > HTTP_GET/POST_VARS['hello']. This is the mother of all other options and is > best single option for PHP security, it will also kill basically every third > party application available and makes programming PHP a whole lot less > convenient. Expect to see register_globals off as the default setting in PHP 4.1, I *THINK*. > *** - Set safe_mode on > I'd love to describe exactly what safe_mode does but it isn't documented > completely. I dunno what more documentation he *WANTS* than what is on the web-site... Not that I claim to *UNDERSTAND* it all :-^ > - Kills file upload completely I *think* safe_mode can be on and files can be uploaded if the ISP works at it... But they have to want it bad enough to do some configuration. Most ISPs want to just install stuff as-is and not take the time to find out how to really configure it for optimum safety/functionality. > ** - Set open_basedir > This option prevents any file operations on files outside specified > directories. This can effectively kill a variety of local include() and > remote file attacks. > Caution is still required in regards to file upload and > session files. Which is why safe_mode exists. > ** - Set display_errors off, log_errors on > This prevents PHP error messages being displayed in the returned web page. > This can effectively limit an attackers exploration of the function of the > script they are attacking. It can also make debugging very frustrating. Not really. First of all, you *OUGHT* to be developing on a different, non-public box than your live server. Throw PHP on your laptop or desktop and write your new code there, where you have display_errors on. Only on the live site do you need display_errors off, and hopefully your code is mostly debugged by that point. Even so, you just open up another window and tail -f your error log file if you need to debug something. For any particularly tricky debugging, you can use something like this: if ($REMOTE_ADDR == 'your.IP.address.here'){ echo "whatever"; } Only you want to use $HTTP_ENV_VARS['REMOTE_ADDR'] or whatever it is. > * - Set allow_url_fopen off > This stops remote files functionality. Very few sites really need this > functionality, I absolutely recommend every site set this option. Well, I use it, but I suppose it's up to you. The things that go wrong with this being on are (I think) the result of stupid code like: include $foo; which is already problematic, regardless of whether $foo is hacked to be a remote file or a local one... Anybody else can weigh in on this, go ahead. I think the *REAL* issues raised here is that far too many PHP scripters, self included, are pushing code out to make it work and not focussing on security enough. It's *POSSIBLE* to write more safe code, and the PHP Dev team is working to make it easier. But for now, the onus is on *YOU* to figure out what's "safe enough" and what's not for *YOUR* application. -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Reload a page when a user press the back button
>not show after the user press the reload button. Is there a way that the page reaload >automatically the data from the database without the user pressing the reload button? Thanks Not really -- You can send no-cache and expiration headers, so they'll *HAVE* to reload to see anything at all, but it won't auto-reload. Another option: Have the page POST to itself, and re-generate the new list after the INSERT. Here's a crude example: \n"; echo "\n"; while (list($id, $name) = mysql_fetch_row($cats)){ echo "$name\n"; } echo "\n"; echo "\n"; echo "\n"; echo "\n"; ?> Since the INSERT happens at the top, the new entry will always show up as he goes. -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Weird problems passing variables
> I've got some strange problems whilst passing variables from forms into my > php-script. When I use IE5 it works like a charm. Using Opera or IE4* the > referred "action" script crashes due to memory restrictions on the server, > in a function I use to get all the dates between two given dates, presumably > due to my while condition never turning false. This lead me to believe that > my variables were being gargled in some way as to make the parsing fail, > this is however not the case as far as I can tell. Are you printing out the data?... > This is the function I use to retrieve all the dates inbetween $from and $to > inclusive (yes, it's butt ugly, I know, but I'm in kinda of a hurry, my > deadline is approaching ;) : > > /* > Function geDates(from, to) takes strings containing dates in the form > "-MM-DD" > and returns an array containing the dates between "from" and "to" > inclusive > */ > > function getDates($from, $to) { > (int) $year=substr($from,0,4)+0; /* Adding the zero is a kluge to force > away leading zeros */ > (int) $month=substr($from,5,2)+0; > > (int) $day=substr($from,8,2)+0; > > $datearray[0]=$from; > $current=$from; > while($current!=$to) { > $day=$day+1; > if(checkdate($month, $day, $year)) { >$current=zeroPadDate($year, $month, $day); >$datearray[]=$current; > } else { >$month=$month+1; >$day=1; >if (checkdate($month, $day, $year)) { > $current=zeroPadDate($year, $month, $day); > $datearray[]=$current; >} else { > $year=$year+1; > $month=1; > $current=zeroPadDate($year, $month, $day); > $datearray[]=$current; >} > } > > } > return $datearray; > } Uhhh. You're working *WAY* too hard :-) function getDates($from, $to){ # Change the 1's to 0's to turn off debugging output: if (1){ echo "Computing Dates Between '$from' and '$to'\n"; } $year = substr($from, 0, 4); $month = substr($from, 5, 2); $day = substr($from, 8, 2); $start = mktime(0, 0, 0, $month, $day, $year); $year = substr($to, 0, 4); $month = substr($to, 5, 2); $day = substr($to, 8, 2); $end = mktime(0, 0, 0, $month, $day, $year); # Change this to <= to get the $end date included: while ($start < $end){ $datearray[] = date('Y-m-d', $start); if (1){ echo $datearray[count($datearray)-1], "\n"; } $day++; # Let PHP worry about wrapping days and months and leap years $start = mktime(0, 0, 0, $month, $day, $year); } return $datearray; ?> > /* Accessory function to getDates above. */ > > function zeroPadDate($year, $month, $day) { > if ($month<10) $mstr="0$month"; > if ($day<10) $dstr="0$day"; > return "$year-$mstr-$dstr"; > } You don't need this function. :-) > What could it possibly be due to? Are there any differencies in the way the > above mentioned browsers pass the form variables? > > If you do find it in your heart to help me out with this one, please also > reply by e-mail to [EMAIL PROTECTED] > > Thanks in advance, > > Claes Andersson > Webmaster, www.palladiumbio.com > > PS Exchanging "GET" and "POST" in the referring form made no difference in > the world DS > > > -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: passing variables from PHP to Perl script
> I'm trying to integrate an Internet Telephony service for a client. I have a > number of variables I need to dump into the clients database and then to > pass to the Internet Telephony service via a Perl script they have provided > for me that will reside on the client's server. Can I somehow pass them > "behind the scenes" or should I use a redirect. There is info I need to keep > away from the end user, mainly the phone number. exec("/path/to/perl/script '$phone_number' '$more_data' '$whatever'", $results, $errorcode); while (list(,$line) = each($results)){ echo $line, "\n"; } if ($errorcode){ echo "OS Error Code: $errorcode. Usually path/permissions. man errno.\n"); } Or is the Perl script on a *DIFFERENT* server from your PHP script?... Then you'll need to use "cURL" or fopen or something to talk to that server. -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: to richard lynch
Warning to all: I usually ignore a thread once I threw in my 2 cents... Emailing me off-list to continue is always kosher though. :-) Emailing me off-list with a whole new question is silly, but I try to respond... No promises to continue that practice. > on response to a question about variable $PATH_INFO , you said me: > > Is Apache configured to pass that variable on? > > Did you compile as CGI -- IE, are you using "Action" in your httpd.conf or > LoadModule/AddModule? > > > but how to configure to pass that variable ? I dunno. I just know that virutally all of the pre-defined variables such as $PATH_INFO are either sent in by Apache because it was configured to, or not. If $PATH_INFO is one of those, you'll need to find your httpd.conf file and dig through there to see if it has anything related to something that looks like a setting to pass on path information to Modules. I asked about the CGI thing because there's a --enable-discard-path that you use for CGI that, umm, I never have understood those CGI-related directives, so it might (or might not) be related to PATH_INFO. Fortunately, there's only two or three of them, so it's only a matter of four or a dozen attempts to ./configure;make to get one that works. Yes, that's how I do it :-) Actually, I guess you *COULD* have used --enable-discard-path with your Module compilation... Dunno for sure what the effect would be... Hopefully, you now realize that I have only a vague understanding of all the install issues, but it's enough to focus you down to only a few things to look at. Try the [EMAIL PROTECTED] list if you want real experts on install issues. :-) > what is action ? > i'm using LoadModule/AddModule for php4 If you were running PHP as a CGI (ie, *not* using LoadModule/AddModule) you would be using Alias/Action *instead* of LoadModule/AddModule in httpd.conf All of these Apache directives are documented far better than I could explain at http://apache.org -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Problems with cookies....
> $pav='nustatymai.php'; > if ( $nustatymaslangas == 1 ) { > setcookie("nustlangas", 1, time()+3600*24*30); > } else { > setcookie("nustlangas", 0, time()+3600*24*30); > } > if ( $nustatymaspastas == 1 ) { > setcookie("nustpastas", 1, time()+3600*24*30); > } else { > setcookie("nustpastas", 0, time()+3600*24*30); > } > if ( $jau == 1 ){ > header("Location: main.htm"); > exit; > } > > ?> > > > > > --- Pasirinkite --- > Same Window > New Window > > > > --- Choose --- > Same Window > New Window > > > Doing both SetCookie and Location header in the same script is problematic. No matter which order you pick, some browsers will do the Location before the SetCookie, and you have no Cookies set. -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: PHP and Perl script in same file?
> Can php and perl code reside in the same file? When the document is served > up it parses the PHP and then the Perl? No. Apache does not allow "stacked handlers". Actually, Apache 2.0 was to offer this feature, IIRC. Dunno if it made it through the process though... http://apache.org -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: ISO-8859-2 to Windows-1250
Try these: http://www.php.net/manual/en/ref.recode.php http://php.net/manual/en/function.convert-cyr-string.php -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm - Original Message - From: Vmáš ł{âiš <[EMAIL PROTECTED]> Newsgroups: php.general To: Php-General@Lists. Php. Net <[EMAIL PROTECTED]> Sent: Thursday, August 16, 2001 2:20 AM Subject: ISO-8859-2 to Windows-1250 > Hi, > is there any function which can converts strings from ISO-8859-2 to > Windows-1250? > > Thanks for your answers. > Tomas > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Auth atalk and samba
I *THINK* somebody worked out the Samba stuff... Search the archives. http://php.net/support.php Also ask on [EMAIL PROTECTED] for the Samba. There's a Mac list for PHP, and they might have some ideas on the AppleTalk stuff. http://www.dynapolis.com (It's called "AMP" or "Apache/MySQL/PHP") -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm - Original Message - From: Knut sætre <[EMAIL PROTECTED]> Newsgroups: php.general To: <[EMAIL PROTECTED]> Sent: Friday, August 17, 2001 7:18 AM Subject: Auth atalk and samba Hi Is there a way to authenticate users who are connected to the linux-box with samba or the AppleTalk protocol (Netatalk)? I don't need strong security, this is on the Intranett behind a firewall. I only want to recognise the users, and give them a personalised WebPage. It's simple to get the users ID address with php, but I need the corresponding usernames from the smb or netatalk users. I'm running php 4.06, netatalk 1.5pre6 and smb 2.2.1a on RH 7.1 Knut G. Sætre Harstad Tidende Gruppen AS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: mysql_db_name not working (followup)
> Does Apache with static compiled PHP not work on Solaris 8? > Since the pages behave really crazy, we think it has something to do > with our PHP. > Does someone have a similar installation - which versions? > Or any help? Ding! This just set off a ringer in my head. :-) Go back to your /usr/src/php* directory (or whever Solaris hides it) and dig through config.log and config.cache and whatnot to figure out if: Did PHP use the "built-in" MySQL library rather than the source headers for the MySQL you are actually running? If so, and it it's a different version from what you are actually running, then you'd see behaviour like this. MySQL sorta works, cuz some functions in the binary files are where/how PHP expects them, but a bunch aren't and they act all crazy. If all else fails, just do: ./config.nice and read the last 50 lines or so. Either you get this big ASCII box about using the MySQL built-in libraries, or you're okay on that score. -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Attempt At Prev/Next Links
> $max_row = 5; > if ($op == "next") { > $low = $low + $max_row; > $high = $low + $max_row; Either this... > $result = mysql_query("SELECT * FROM TABLENAME where Post='yes' LIMIT $low, $high"); > while($row = mysql_fetch_row($result)) { > echo "$row[1] writes:\n"; > echo " $row[2]\n"; > echo "AskLee writes:\n"; > echo " $row[3]\n"; > echo "\n"; > } > } > elseif ($op == "prev") { > $low = $low - $max_row; > $high = $high - $max_row; Or this is wrong. :-) I think $high should *always* be $low + $max_row; > $result = mysql_query("SELECT * FROM TABLENAME where Post='yes' LIMIT $low, $high"); > while($row = mysql_fetch_row($result)) { > echo "$row[1] writes:\n"; > echo " $row[2]\n"; > echo "AskLee writes:\n"; > echo " $row[3]\n"; > echo "\n"; > } > } else { Also, you really should compute your low/high, and *THEN* do one query, and one output. As it stands now, if you change your query/output, you have to change it in three places at once. > $low = 0; > $high = $low + $max_row; > $result = mysql_query("SELECT * FROM TABLENAME where Post='yes' LIMIT $low, $high"); > while($row = mysql_fetch_row($result)) { > echo "$row[1] writes:\n"; > echo " $row[2]\n"; > echo "AskLee writes:\n"; > echo " $row[3]\n"; > echo "\n"; > } > } > $result = mysql_query("SELECT * FROM mpn_asklee where Post='yes'"); > $num_rows = mysql_num_rows($result); > if ($num_rows > $max_row) { > echo "\n"; > echo "\n"; > if ($low > $max_row) { > echo "Previous"; > } > echo "\n"; > if ($num_rows > $high) { > echo "Next"; > echo "\n" > } > } > ?> Oh yeah: Start indenting between { and } The hair you save may be your own. -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: need "Working..." pop up dialog
> I'm trying to get a "working..." informational dialog or window going > with my PHP page but I'm not getting anywhere. Here's the situation: > > When the user clicks on a link that has to gunzip a very large file, I > want a popup to say "Working..." while the file is uncompressing. > Then, when the file is uncompressed, I want the "Working..." popup to > close itself and then the parent window to load a new URL (where it > will use the uncompressed file). > > I've tried doing this with Javascript and window.open(), but I'm having > no luck. Any ideas? You also need to use those layer thingies with DHTML or whatever... I archived a sample somewhere... Ah, here it is: (This is somebody else's code, not mine) [ code ] . One moment please... Loading directory listing . ==[ end code ]== NOTE: You should change 'if (IE)' to something usefull. If you just copy/paste this code, you'll get a javascript-error because IE isn't defined (it is on my site, :-)). * R&zE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- H: +31 23 5516190 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- -- http://www.datalink.nl -- -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Using cURL on windows?
> How would I go about installing cURL for PHP on windows box? Start searching for a file named curlphp.dll or similar. First your PHP install, then http://php4win.de if it's back up, then http://php.net then, like Google or http://dogpile.com or whatever. If all of that fails, then probably nobody has created such a DLL for you, and the real fun starts... You *COULD* start looking for a cURL COM object out there on the Microsoft-centric sites (expect to pay for it) and try to use PHP's COM support to talk to it. Or, you *COULD* snag the cURL sources and VC++ 6.0 or higher and try to compile them yourself. You'll probably soon find out why it doesn't exist, but with diligence and some work might become famous for being the guy who *made* it work :-) [That's pretty much how OpenSource software works...] You may find it easier to just switch to Un*x where it just works :-) -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: SESSION question.
You should be able to configure Apache to force the www. to appear, no matter what they type, or to keep using what they typed, if you didn't use any full URLs. -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm - Original Message - From: Mehmet Kamil Erisen <[EMAIL PROTECTED]> Newsgroups: php.general To: <[EMAIL PROTECTED]> Sent: Friday, August 17, 2001 6:05 PM Subject: SESSION question. > Hello, > I have implemented a user login with PHP Session functions. > THe problem I have is that if the user is logged in the > site using > http://mysite.com/login.php and starts a session, the > session is not recognized when user is trying to utilize > the site with > http://www.mysite.com/dosomething.php > > any suggestions? > > thanks, > erisen. > ultrAslan. > > = > Mehmet Erisen > http://www.erisen.com > > __ > Do You Yahoo!? > Make international calls for as low as $.04/minute with Yahoo! Messenger > http://phonecard.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Help with linux / apache / php
> We have just (in the last month or so) leased a cobalt raq all for our own > use. Great. However, the sites using this box are setup and maintained > using a web interface that comes as default with the box. when setting up > sites (subs or otherwise), it adds sites (and you have to specify users for > those sites) with directory trees like this: Yeah, getting those babies up and running is easy. Figuring out where they do things and how to change it without breaking everything is not so easy :-( > /home/sites/site1/web > /home/sites/site2/web > (etc) > > Obviously, this causes problems (like for the php scripts that are running > on the current setup, where files are included / required as a part of the > main directory, and out of the document root (/home/mainsite/includes might > be an example)). This part is fairly easy and innocuous :-) /home/sites/site1/web is the same as your old /home/mainsite/www You can safely put your includes for mainsite in /home/sites/site1 or create /home/sites/site1/includes and put them there. Similarly, all your sub sites will have /home/sites/siteX/web and you can put the include files in /home/sites/siteX/includes. If you have some "commmon" includes that span all the sub sites, I'd put them in /home/sites/includes/ But that's just me. You can put them anywhere that makes sense. You'll need to find php.ini (Use a page to do that) and change include_path You may even want to make a chart of "old directory" | "new directory" for the two boxes until you get the hang of it. > So, I'd like to learn how to use linux (bearing in mind that I have very > limited experience of unix based systems). I can perform the very basic > commands, but would like to learn how to use / mainpulate the box through > shell access rather than over a web interface (which ultimately, I'm > assuming, will give me more flexibility - for example, I'd rather know how > to install the latest version of php onto the server following the > installation instructions than to attempt to do it through another medium). What *I* did was to pretent it was a RedHat box and threw source code into /usr/src/ and went on with life, but that's only cuz I was more familiar with RedHat than because it was the right thing to do... > I've bought a couple of books and hope to delve into them in the course of > the weekend and the next few weeks to come. I'm assuming that one of the > first steps would be to install linux on my home machine and get a feel for > it (currently I'm running windows ouch). Smart move. RedHat is probably still the easiest to install... > So, here come the questions. > Where can I find the latest version of linux? I have had a brief look at > freshmeat.net and linux.com, but didn't find any download sections (I didn't > look too hard, for reasons soon to be explained). Woof. You're just asking for a Linux distro argument :-) There are a dozen (or more) different distributions of Linux with varying pros and cons. The more commonly recommended include: RedHat FreeBSD Mandrake SuSe and others I forget. I'm still gonna stick with the RedHat answer as "easiest" for newbies. I'm sure others will weigh in with other opinions. > If I install linux, can I still use windows as a secondary OS (perhaps > running over the top of linux?) You *CAN*, indeed, re-partition your hard drive into two "halves" and install Linux in the new "half" that you stole from Windows. > If I can run windows as well as linux, am I best formatting my main drive, > installing linux, then windows? Well, if you don't have either on the box yet, I think you install Windows first, cuz it's more stupid about installing, and would wipe out Linux. (Or maybe that's by evil design...) At any rate, there's a http://www.Linux-HowTo.org or somesuch that will have detailed instructions on dual-boot installation > Is the httpdconf file one of the main files i need to confifure for sites, > or are there many others (I've read a little about setting users up in vi > and will read more on that, but are there mounds of files that you need to > configure when setting up a new virtual site?) Honestly, if you're using a Cobalt RaQ, you're *probably* best off to just keep using that to add acounts/sites for now on the real server. On your development box, you need to edit httpd.conf (and only httpd.conf) to create a new Host. You usually want to create a new user on the machine (or at least an FTP user, if you don't provide shell access [ick!]) to associate with that site. man adduser will tell you all about that, and it's probably also in that Linux how to site. (Most everything is) In fact, I'd suggest you bookmark that one, and use it. Most of these instructions there are targetted at your level :-) Though you may find that to do X, you need to do Y, which requires Z, and back track quite a bit before you get to something that makes sense. :-) -- WARNING [EMAIL PROTECTED] address is an endangere
[PHP] if then else?
-Original Message- From: Glyndower [mailto:[EMAIL PROTECTED]] Sent: Sunday, August 19, 2001 12:12 AM Cc: [EMAIL PROTECTED] Subject: Ok, here we go I'm new to PHP and also to MySql, but i'm making a pretty good go so far. Until now, lol I have a mysql database with several optional feilds (pe1.pe2.pe2,e1,e2,e3, etc) What I'm looking for is a way to check the value of each optional feild and if said feild is "not null" or contains data. I want to create a header for that feild and then a bulleted list of the options in the feilds under the header. i.e something along the lines of: So the final output would end up like: Professional Education * College * High School * Middle School TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Accessing an array of objects
I can't seem to figure out the correct syntax of acessing an array of objects with creating a temp. variable... Is there a workaround for not creating it, or do I just need to deal with using $tempvar = $test[1]; $tempvar->variable? here is an example of code // Start Code Snipet: for ($i = 0;$i < 11;$i++) { $test[$i] = new class(); } echo "$test[1]->variable"; //End code Snipet The echo statement would return Object->variable on the webpage Environemt info: PHP 4.06 W2k, running Apache Any help would be much appreciated, Sincerely, Athas Nikolakakos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Shuffle Cards Function
I've written a ShuffleCards function that will actually shuffle a deck of cards just like would happen in real life (divide the deck in half and stick them into each other with 1-3 cards between each other card) function ShuffleCards(&$cardsArray, $times) { // Randomizes where to split within center (-3 to +3 from dead center) (MINIMUM 10 CARDS IN DECK) // Splits into two array. Randomizes how many cards from left and how many cards from right (between 1 and 3) // Alternates sides. Continues until both arrays are empty. $arraySize = count($cardsArray); if($arraySize<10) return; $deadCenter = $arraySize/2; for($i=0;$i<$times;$i++) { reset($cardsArray); $cutVariant = rand(-3, 3); $cutLocation = $deadCenter+$cutVariant; $firstArray = array(); $secondArray = array(); for($z=0;$z<$arraySize;$z++) { if($z<$cutLocation) array_push($firstArray, $cardsArray[$z]); else array_push($secondArray, $cardsArray[$z]); } $bottomFirst = rand(0, 1); $cardsArray = array(); while(count($firstArray) && count($secondArray)) { $leftNewCards = array(); $rightNewCards = array(); $leftVariant = rand(1, 3); if($leftVariant>count($firstArray)) $leftVariant = count($firstArray); $rightVariant = rand(1, 3); if($rightVariant>count($secondArray)) $rightVariant = count($secondArray); for($x=0;$x<$leftVariant;$x++) { array_push($leftNewCards, array_shift($firstArray)); } for($y=0;$y<$rightVariant;$y++) { array_push($rightNewCards, array_shift($secondArray)); } if($bottomFirst==0) { $newCardsArray = array_merge($leftNewCards, $rightNewCards); $bottomFirst = 1; } else { $newCardsArray = array_merge($rightNewCards, $leftNewCards); $bottomFirst = 0; } reset($newCardsArray); while(count($newCardsArray)) { array_push($cardsArray, array_shift($newCardsArray)); } } if(count($firstArray)) { while(count($firstArray)) array_push($cardsArray, array_shift($firstArray)); } if(count($secondArray)) { while(count($secondArray)) array_push($cardsArray, array_shift($secondArray)); } } } Robert Schultz - [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Accessing an array of objects
> echo "$test[1]->variable"; Get rid of the quotes, they are useless and just confuse the parser. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Protecting include files
Previously, John Meyer said: > > BTW, .inc files can include PHP code that is executed, right? Any file can contain such code, if the server is configured to interpret the file as a PHP file, or if another file which is PHP include()'s the file in question. The ".inc" extension just happens to be a popular choice that a lot of people tend to use for "included" PHP code. But typically as far as the server cares they're just text files. -dan -- It's been said that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now thanks to the Internet, we can say that this is not true. -Unknown -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Printf fails on large files
Hello, I don't think the problem you have is not the size of the file. It seems to depend on the content of that. (line 1) $a = 'abc%d'; (line 2) printf( "$a" ); will cause too-few-arguments error because variable $a contains the sequence of '%','d', which should be interpreted as formatting characters if you don't want it. use print() instead of printf(), or do like this: printf ( "%s\n", $conteudo );h Moriyoshi "In$BqS(Bcia Sensorial Trabalhando" <[EMAIL PROTECTED]> wrote: > He said no, here's the error: > > Warning: printf(): too few arguments in /htdocs/content.php on line 20 > > And here's the code. Remember that only fails on large files: > > > > > SITUA$B%L%F(BO DA CAIXA POSTAL > > > Resultado da Consulta para: . > >opendir ("/var/mail"); > chdir ("/var/mail"); > // A vari$BaW(Bel $login_usuario obtida em index.html > // xxx.xxx.com.br/gbj/index.html > if (file_exists("$login_usuario")) { > printf ("SITUA$B%L%F(BO DA CAIXA POSTAL\n\n"); > $situacao = `ls -ld $login_usuario`; > printf ("$situacao\n"); > printf ("CONTE$B%l(BDO DA CAIXA POSTAL\n\n"); > $conteudo = `mailx -H -f /var/mail/$login_usuario`; > printf ("$conteudo\n"); > } > else > { > printf ("O usu$BaS(Bio $login_usuario n$BeP(B foi encontrado.\n"); > } > ?> > > > > > -- > > Julio Nobrega > > A hora est chegando: > http://toca.sourceforge.net > "John Meyer" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > At 05:14 PM 8/17/01 -0300, In$BqS(Bcia Sensorial Trabalhando wrote: > > Hi All, > > > > A friend of mine said his printf is failing when he parses a variable > from > >a 4.5 mega file. On smaller files, it works fine. > > > > There's a limit on the printf or somewhere else? > > > > Thanks. > > > Is he throwing the _entire_ 4.5 MB file into that variable and trying to > print that? > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] if then else?
btw...this is the code i'm trying Please keep the laughter to a minimum...ah heck with it...laugh all you want...its good for ya Professional Experience: This field is empty output for users with a variable other than value1 or value2 This field is empty output for users with a variable other than value1 or value2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] force download in IE
Can anybody tell me why this doesn't work in IE? I need to force download mp3 files instead of IE5.5 trying to apply a helper app. This code works fine for NN. // detect for MSIE bug if (strstr($HTTP_USER_AGENT, "MSIE")) $attachment = ""; else $attachment = " attachment;"; // stream file to user header("Content-Type: application/octet-stream"); header("Content-Disposition:$attachment filename=$filename"); header("Content-Length: ".filesize($tmp_file)); header("Content-Transfer-Encoding: binary"); readfile($tmp_file); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] function like exit?
hi. do we have function like "exit" in php?? for exit from program. best regards. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Slow LDAP Queries
Andrew, Thanks for your input. Comments below... "Andrew Libby" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Emilio, > > Few thoughts: > > o Is the call syntax you're using for ldap_read() correct? The online > manual page describes the second parameter as being the base dn, > you're passing the user's username. ( getenv("REMOTE_USER")). I'm > surprised that this code works. There's a parameter on httpd.conf that is: AuthLDAPRemoteUserIsDN On. I'm using the auth_ldap.so 1.6.0 from Dave Carrigan. When executing phpinfo(), REMOTE_USER returns this: uid=username,ou=People,dc=mydomain,dc=com That's why it works. > o The comparisons you're making: Are they comparing similar LDAP searches. > There are issues that may not involve PHP at all that could be the cause > of you're performance issue. For example, you're search could find all > entries with a cn attribute at the base dn. This could potentially be > a large number of entries. Also, if you search for something and the > attributes you reference in your search filter are not indexed performance > will degrade linearly as you add more entries to your directory. The searches are comparable. The perl function does the same, but in perl. This is the way I got around it. Actually, the PHP seems more efficient, but in Perl is a lot faster: #!/usr/bin/perl # General Declarations - use Net::LDAP qw(:all); $webpage = new CGI; # Declare instanced. $client_user = getldapcn( $webpage->user_name ); # Web client user - from Auth. sub getldapcn { my ( $query )=@_; my $retstr; $ldap = Net::LDAP->new( "localhost" ) or die "$@"; $mesg = $ldap->bind( version => 3 ); $result = $ldap->search( base => "$query", scope => "sub", filter => "cn=*" ); foreach my $entr ( $result->entries ) { $retstr = $entr->get_value( "cn" ); } # close $ldap->unbind; return( $retstr ); } # That's it! --- > o Session Caching. At CommNav, we've had good success with this strategy. > We store quite a bit of information in the users session. It's not > uncommon for our user sessions to grow to above 100Kb, and I've seen > them as big as 300Kb. Retrieving data from the session (i.e. the > unserialize() function) is much less expensive then going to LDAP for > every hit to the web app. Thanks. That's what I'm doing now, and it really makes a difference., but still, I don't know why the LDAP query takes so much time in the first place. > Since these thoughts are not related to PHP, you can feel free to contact > me off-list to discuss further. > > Andy Thanks, Emilio > > > On Sat, Aug 18, 2001 at 05:07:26PM -0400, Emilio Panighetti wrote: > > I have OpenLDAP and PHP 4.0.4p1 on a RedHat 7.1 (plain distribution, didn't > > recompile anything, and I use MOD_LDAP to authenticate users to an intranet > > site. I want PHP pages to show the real username so I have this function I > > call when I want to know the username. > > > > the mod_ldap queries and ldap queries from a Perl CGI return very fast. On > > Perl I don't notice an performance issue (with less than a couple > > queries/second), but each query using PHP takes about two full seconds (or > > more). I did a workaround keeping the result on a session variable, but it's > > still slow every time I call this function. > > mod_ldap stores the user's dn on the REMOTE_USER environment variable. > > > > Here's the function. I don't know how to make it faster. > > > > Thanks, > > Emilio Panighetti > > > > > // Retrieves user's real name from LDAP > > function ldapcnsearch() > > { > >$s_ldapserver = "localhost"; > >$s_ldapport = 389; > >$ds = ldap_connect( "ldap://".$s_ldapserver.":".$s_ldapport ); > >ldap_set_option( $ds, LDAP_OPT_PROTOCOL_VERSION, 3); > >$qar[] = "cn"; > >if ( $ds ) { > > $r = ldap_bind( $ds ); > > $sr = ldap_read( $ds, getenv( "REMOTE_USER" ), "cn=*", $qar, 0, 1, > > 1 ); > > $info = ldap_get_entries($ds, $sr); > > $s_RealName = $info[0]["cn"][0]; > > ldap_close( $ds ); > > return( $s_RealName ); > >} > > } > > ?> > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > -- > -- > Andrew Libby > Director of Technology > CommNav, Inc > [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] $var , '$var'
hi. what is the difference between $var and '$var' ?/ thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Search for PHP Motivation Studies
* Ralph Guzman wrote: > IN the book "Web Application Development with PHP 4.0" There is an entire > chapter towards the end of the book that describes such case studies. I know them but I don't search case studies. -- Die Marktumfrage zu PHP Schulungen, Consultingdienstleistungen und frei verfügbaren Artikeln. Mitmachen? http://www.thinkphp.de/survey/survey.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] cookie
hi. what is cookie?? thanks much. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: function like exit?
"Nafiseh Saberi" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > hi. > do we have function like "exit" in php?? > for exit from program. > > > best regards. For the love of. 1) yes. its called "exit" you can also use "die" 2) the simplest of searches on www.php.net would have told you that http://www.php.net/manual/en/function.exit.php http://www.php.net/manual/en/function.die.php http://www.php.net/manual/en/ <---SmartThing[tm] Christopher -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: cookie
"Nafiseh Saberi" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > hi. > > what is cookie?? > > thanks much. what the... oh its you again. I am too tired to give you the complete setup. Here is the short term explanation. Read the links below for more info. Chris INTRODUCTION Cookies are a general mechanism which server side connections (such as CGI scripts) can use to both store and retrieve information on the client side of the connection. The addition of a simple, persistent, client-side state significantly extends the capabilities of Web-based client/server applications. or 1.1 What is a Cookie? A cookie is simply an HTTP header that consists of a text-only string that gets entered into the memory of a browser. This string contains the domain, path, lifetime, and value of a variable that a website sets. If the lifetime of this variable is longer than the time the user spends at that site, then this string is saved to file for future reference http://www.cookiecentral.com/faq/ <--- recommended! http://www.php.net/manual/en/function.setcookie.php http://home.netscape.com/newsref/std/cookie_spec.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] $var , '$var'
In what context? print $var; // prints the value of $var print "$var"; // prints the value of $var print '$var'; // prints $var /* Chris Lambert, CTO - [EMAIL PROTECTED] WhiteCrown Networks - More Than White Hats Web Application Security - www.whitecrown.net */ - Original Message - From: nafiseh saberi <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, August 19, 2001 2:33 AM Subject: [PHP] $var , '$var' | | hi. | what is the difference between $var and '$var' ?/ | thanks. | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | To contact the list administrators, e-mail: [EMAIL PROTECTED] | | | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: $var , '$var'
"Nafiseh Saberi" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > hi. > what is the difference between $var and '$var' ?/ > thanks. '$var' has little marks like this --> ' <--- around it call it a "border" useful when adding such item to a sql query or printing distinct. (when you get to regexping you cant live without such items) Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] $var , '$var'
nothing, execpt, think there would be about 0.1 time difference... :D I use $var = $blah."bleh'.$foo because syntax highlighting looks better :D - James "ReDucTor" Mitchelll - Original Message - From: "nafiseh saberi" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, August 19, 2001 4:33 PM Subject: [PHP] $var , '$var' > > hi. > what is the difference between $var and '$var' ?/ > thanks. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]