php-general Digest 8 Aug 2005 02:12:11 -0000 Issue 3612
php-general Digest 8 Aug 2005 02:12:11 - Issue 3612 Topics (messages 220170 through 220189): Re: Fast count of recordset in php... 220170 by: Marcus Bointon 220172 by: Satyam Re: sorry for asking here,a small apache query 220171 by: mviron.findaschool.net PHP error tracking on new server 220173 by: Terry Romine 220176 by: Marco Tabini Creaing a foldout menu from an array. 220174 by: Gregory Machin 220175 by: Marco Tabini Re: Regex help 220177 by: Dotan Cohen Re: Average time spent on a page 220178 by: virtualsoftware.gmail.com 220180 by: M Saleh EG A question on the term CFG. 220179 by: wayne 220182 by: Chris 220183 by: Jasper Bryant-Greene 220185 by: Marco Tabini 220187 by: Jochem Maas 220189 by: wayne writing to file 220181 by: Sebastian 220188 by: Jochem Maas Re: Java - toString() - php - ? 220184 by: Jasper Bryant-Greene Re: mkdir, Shared Hosting? 220186 by: Esteamedpw.aol.com 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: php-general@lists.php.net -- ---BeginMessage--- On 7 Aug 2005, at 05:04, TalkativeDoggy wrote: be coz this way is slow and costs more overload. $sql = SELECT COUNT(IDVara) cn FROM tbvara WHERE Varunamn LIKE '$checkLev%'; $querys = mysql_query($sql); //Count products in db // $dbArray = mysql_fetch_row($querys); $nrOfProducts = $dbArray[0]; According to the docs, MySQL has a particular optimisation that means that it should be: $sql = SELECT COUNT(*) FROM tbvara WHERE Varunamn LIKE '$checkLev%'; Also if you want the full count value when you've done a query that uses a LIMIT clause, instead of doing a separate full count query, you can get it by using the SQL_CALC_FOUND_ROWS keyword, e.g. $sql = SELECT SQL_CALC_FOUND_ROWS * FROM tbvara WHERE Varunamn LIKE '$checkLev%' LIMIT 10; Of course count(*) could only ever return up to 10 in this query - you can find out how many it would have found by then asking: $sql = SELECT FOUND_ROWS(); Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture [EMAIL PROTECTED] | http://www.synchromedia.co.uk ---End Message--- ---BeginMessage--- Marcus Bointon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] According to the docs, MySQL has a particular optimisation that means that it should be: $sql = SELECT COUNT(*) FROM tbvara WHERE Varunamn LIKE '$checkLev%'; It is not just a MySql optimization but this holds true for every database. When you specify a field in the count() function, you are telling SQL to count the number of occurences of that field which does not include those records in which the field is set tu null. Thus, to do such count, SQL has to access each record to check whether the field is null or not. For a table where a certain field allows nulls, asking for a count of that field will give a lower row count than asking for count(*). On the other hand, if you say count(*) SQL knows that you mean a plain recordcount, regardless of whether any particular field is null or not. To do that, SQL does not need to access the actual data in each record, it just needs to travel the primary key tree, never getting to the actual records. Some database engine might be smart enough to figure that if the particular field you asked for does not allow nulls, a count of that field is the same as a count(*) and us a better strategy but you are better off not relying on that. By the way, I wouldn't count on mysql_num_rows() being as fast as doing a count(*). The SQL engine can play a lot of tricks knowing for certain that you just mean a count(*) which cannot do if you do a plain query which you don't actually mean to use but for counting. I would assume that depending on the engine, a whole batch of records would be read into memory to have them ready for the fetches that never come. It is safer to explicitly tell the SQL engine what you actually mean than to rely on smart optimizations that might or might not be there. Satyam ---End Message--- ---BeginMessage--- There are two ways to accomplish what you are asking. The quickest way, without any modfication to httpd.conf, is to place an empty index.html or other default index page into that directory. This will prevent the directory listing from showing up. The other method, is to change httpd.conf to disallow indexing on all directories for the docroot on down. To do this, -Indexes needs to be added to the directory/directory directives for the docroot, although this may be one of the many configuration directives which have changed between v1.3, v2.0, and v2.1 -- see http://httpd.apache.org/docs-project/ for more
Re: [PHP] mkdir, Shared Hosting?
[EMAIL PROTECTED] wrote: In a message dated 8/6/2005 10:59:44 P.M. Central Standard Time, [EMAIL PROTECTED] writes: As far as I know, it's not a shared hosting issue, but a permission issue. The site admin has not given the user under which your php scripts run permission to create directories and most likely files and other file system operations. It's a security issue. Robbert I see... I guess I could ask to see if I could get permission to do so then? lol never hurts to ask :) Open up your FTP client and log into your website, then change the permissions on your folder so that the apache process has write access to it. Its really hit and miss depending on your setup. The sure fire way (but highly insecure) way is to change the permissions to the directory in question to 777. A better solution would be 755, but it may not work. Try it, and see what you get. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fast count of recordset in php...
Hi again! Thanx!!! I think this will help a lot!!! /mr G @varupiraten.se - Original Message - From: TalkativeDoggy [EMAIL PROTECTED] To: Sebastian [EMAIL PROTECTED] Cc: Gustav Wiberg [EMAIL PROTECTED]; php-general@lists.php.net Sent: Sunday, August 07, 2005 6:04 AM Subject: Re: [PHP] Fast count of recordset in php... if you just wana get count of recordset, don't do this: $sql = mysql_query(SELECT col FROM tbvara WHERE Varunamn LIKE '$checkLev%'); // record count echo mysql_num_rows($sql); be coz this way is slow and costs more overload. $sql = SELECT COUNT(IDVara) cn FROM tbvara WHERE Varunamn LIKE '$checkLev%'; $querys = mysql_query($sql); //Count products in db // $dbArray = mysql_fetch_row($querys); $nrOfProducts = $dbArray[0]; Sebastian wrote: you'd be suprized how fast an index can be.. you should read the manual on indexes, http://dev.mysql.com/doc/mysql/en/mysql-indexes.html If a table has 1,000 rows, this is at least 100 times faster than reading sequentially while you may not get 100x faster, it will be faster than having no index.. also try using mysql_num_rows() $sql = mysql_query(SELECT col FROM tbvara WHERE Varunamn LIKE '$checkLev%'); // record count echo mysql_num_rows($sql); PS, 'reply all' to list. Gustav Wiberg wrote: Hi there! There are about 300 records. You're right, I can add an index, but Is that the only way to get a faster solution? /mr G @varupiraten.se - Original Message - From: Sebastian [EMAIL PROTECTED] To: Gustav Wiberg [EMAIL PROTECTED] Sent: Saturday, August 06, 2005 11:08 PM Subject: Re: [PHP] Fast count of recordset in php... how many records in the table? its going to be slow no matter what, especially if you have a lot of records.. your searching each record then counting them.. do you have any indexes? judging by your query you can add index on Varunamn and it should be more speedy.. Gustav Wiberg wrote: Hello there! How do i get a fast count of a recordset in php? Look at this code: $sql = SELECT COUNT(IDVara) cn FROM tbvara WHERE Varunamn LIKE '$checkLev%'; $querys = mysql_query($sql); //Count products in db // $dbArray = mysql_fetch_array($querys); $nrOfProducts = $dbArray[cn]; It's slow... Why? Any suggestions? /mr G @varupiraten.se -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.10.0/63 - Release Date: 2005-08-03 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Java - toString() - php - ?
Um - did you read my last email regarding var_dump var_export and print_r Did you try them? Do they do what you want? On 8/2/05, Adi Zebic [EMAIL PROTECTED] wrote: Rory Browne a écrit : I haven't a monkies what that code(your java) does, and I don't have time to analyse it(in expensive cybercafe), but you may want to consider www.php.net/print-r www.php.net/var-dump and www.php.net/var-export I think they may do what you want without using the toString method, which for what you're describing is basicly an ugly hack. One more thing: Enlighten me: What exactly do you mean by live evolution in your php/java context. If in php context you have class, say, A: class A { var $t1; var $t2; var $t3; //After, you have object contructor of type A //we have something like this function A ($var1, $var2, $var3) { $this - t1 = $var1; $this - t2 = $var2; $this - t3 = $var3; } some other code } //than in some other class we have something like this: class someOtherClass { $aConstructor = new A(1,2,3); //values of t1, t2 and t3 are 1,2 and 3 now } Right? yes. How you can you do something like this inside of someOtherClass print ($aConstructor); to finally have some nice output like Value of t1 is 1; Value of t2 is 2; Value of T3 is 3; or just: 1 2 3 Without creating functions like getValues() function getValues() { print ($this - t1); print ($this - t2); print ($this - t3); } and after explicit invoke function: $aConstructor - getValues(); So, what I want is this: print ($aConstructor); and not this: $aContructor - getValues(); Am I clear :-) ADI -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fast count of recordset in php...
On 7 Aug 2005, at 05:04, TalkativeDoggy wrote: be coz this way is slow and costs more overload. $sql = SELECT COUNT(IDVara) cn FROM tbvara WHERE Varunamn LIKE '$checkLev%'; $querys = mysql_query($sql); //Count products in db // $dbArray = mysql_fetch_row($querys); $nrOfProducts = $dbArray[0]; According to the docs, MySQL has a particular optimisation that means that it should be: $sql = SELECT COUNT(*) FROM tbvara WHERE Varunamn LIKE '$checkLev%'; Also if you want the full count value when you've done a query that uses a LIMIT clause, instead of doing a separate full count query, you can get it by using the SQL_CALC_FOUND_ROWS keyword, e.g. $sql = SELECT SQL_CALC_FOUND_ROWS * FROM tbvara WHERE Varunamn LIKE '$checkLev%' LIMIT 10; Of course count(*) could only ever return up to 10 in this query - you can find out how many it would have found by then asking: $sql = SELECT FOUND_ROWS(); Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture [EMAIL PROTECTED] | http://www.synchromedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] sorry for asking here,a small apache query
There are two ways to accomplish what you are asking. The quickest way, without any modfication to httpd.conf, is to place an empty index.html or other default index page into that directory. This will prevent the directory listing from showing up. The other method, is to change httpd.conf to disallow indexing on all directories for the docroot on down. To do this, -Indexes needs to be added to the directory/directory directives for the docroot, although this may be one of the many configuration directives which have changed between v1.3, v2.0, and v2.1 -- see http://httpd.apache.org/docs-project/ for more specific information on guidance on how to accomplish this. -- Michael Viron President CEO General Education Online -Original Message- From: babu [mailto:[EMAIL PROTECTED] Sent: Saturday, August 06, 2005 2:38 PM To: php-general@lists.php.net Subject: [PHP] sorry for asking here,a small apache query Hi all, I am sorry for asking in php forum.i am subscribed to php and not to apache.but i hope many people in this group also the solution to this query. how can i configure apache so that users are forbidden to see my docroot file structure. for example i have a file at http://localhost/dir1/xyz.html , if the user try to access http://localhost, or http://localhost/dir1 he shud get a message forbidden. Thanks babu. - To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fast count of recordset in php...
Marcus Bointon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] According to the docs, MySQL has a particular optimisation that means that it should be: $sql = SELECT COUNT(*) FROM tbvara WHERE Varunamn LIKE '$checkLev%'; It is not just a MySql optimization but this holds true for every database. When you specify a field in the count() function, you are telling SQL to count the number of occurences of that field which does not include those records in which the field is set tu null. Thus, to do such count, SQL has to access each record to check whether the field is null or not. For a table where a certain field allows nulls, asking for a count of that field will give a lower row count than asking for count(*). On the other hand, if you say count(*) SQL knows that you mean a plain recordcount, regardless of whether any particular field is null or not. To do that, SQL does not need to access the actual data in each record, it just needs to travel the primary key tree, never getting to the actual records. Some database engine might be smart enough to figure that if the particular field you asked for does not allow nulls, a count of that field is the same as a count(*) and us a better strategy but you are better off not relying on that. By the way, I wouldn't count on mysql_num_rows() being as fast as doing a count(*). The SQL engine can play a lot of tricks knowing for certain that you just mean a count(*) which cannot do if you do a plain query which you don't actually mean to use but for counting. I would assume that depending on the engine, a whole batch of records would be read into memory to have them ready for the fetches that never come. It is safer to explicitly tell the SQL engine what you actually mean than to rely on smart optimizations that might or might not be there. Satyam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP error tracking on new server
My hosting service recently switched to a newer server and in transporting the websites (many) over, they set up php different (vers 4.3.10). I know it's not nice to show errors on a published website, but I don't have a testing server, and I need to debug scripts once in a while. The problem is that when an error occurs, the page just comes up blank, and I have to practically pick it apart one line at a time to track down the problem. I tried ini_set('display_errors',TRUE); error_reporting(E_ERROR | E_WARNING | E_PARSE); but that doesn't seem to matter either. From phpinfo() it says display_errors is set off and error_reporting is 7. Any ideas on what flag may need to be set and how to do it on a file- by-file basis so I am only tweaking it when testing? Terry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Creaing a foldout menu from an array.
Hi Please advise. I need to create menu that has the following html body ul id=nav lia href=#Home/a/li lia href=#About/a ul lia href=#History/a/li lia href=#Team/a/li lia href=#Offices/a/li /ul /li lia href=#Services/a ul lia href=#Web Design/a/li lia href=#Internet Marketing/a/li lia href=#Hosting/a/li lia href=#Domain Names/a/li lia href=#Broadband/a/li /ul /li lia href=#Contact Us/a ul lia href=#United Kingdom/a/li lia href=#France/a/li lia href=#USA/a/li lia href=#Australia/a/li /ul /li /ul /body The menu is structured with an array where each field holds an ID a PerantID the name and the link . the PeratID refers to the ID of the item in the array wich it is attached to.. My problem is I cant figure out the correct loop / logic to put the ul tags in the rite places etc.. Many thanks -- Gregory Machin [EMAIL PROTECTED] [EMAIL PROTECTED] www.linuxpro.co.za Web Hosting Solutions Scalable Linux Solutions www.iberry.info (support and admin) www.goeducation (support and admin) +27 72 524 8096 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creaing a foldout menu from an array.
Hey Gregory-- On 8/7/05 12:05 PM, Gregory Machin [EMAIL PROTECTED] wrote: Hi Please advise. There was a thread on our forums a while back and one of my colleagues posted a variant of the code we use for our menus, so maybe this will help you: http://www.phparch.com/discuss/index.php/m/3901/2 Cheers! Marco -- BeebleX - The PHP Search Engine http://beeblex.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP error tracking on new server
Hey Terry-- On 8/7/05 11:03 AM, Terry Romine [EMAIL PROTECTED] wrote: Any ideas on what flag may need to be set and how to do it on a file- by-file basis so I am only tweaking it when testing? Terry Does your hosting provider support .htaccess? If so, you may be able to change the error reporting settings by providing your own .htaccess file which contains something like: php_flag display_errors on HTH, Marco -- BeebleX - The PHP Search Engine http://beeblex.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex help
On 8/4/05, Lizet Pena de Sola [EMAIL PROTECTED] wrote: Ok, it's not the regexp for detecting email addresses what I need, that's widely published, thanks. I'm using ereg to match this regular expression: (On)[\s\w\d\W\S\D\n]*(wr[i|o]te[s]?:) That will match phrases like On 8/3/05, Carol Swinehart [EMAIL PROTECTED] wrote: the type On date, name email wrote or writes: The thing is I tried this regexp with Regex Coach and it matches fine, but ereg returns no match ereg($regexpstr, $str, $regs) I know there are some comments at php.net about how ereg has some bugs, any idea if this could be one? Tia, Lizet You're not going to get far with that. Lots of people make 'funny' You Wrote lines, and not all of them start with 'On' or contain the word 'wr[o|i]te'. You might be better off just searching for any sentance that contains an @ sign, because they are very seldom used outside of email addresses nowadays. And that doesn't make any promises, either, because sometimes the whole email address isn't in the line, just the person's name. Dotan Cohen http://lyricslist.com/lyrics/artist_albums/286/judas_priest.php Judas Priest Song Lyrics -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Average time spent on a page
Yes, I'm looking for the algorithm. - Original Message - From: M Saleh EG To: [EMAIL PROTECTED] Cc: php-general@lists.php.net ; Frank de Bot Sent: Sunday, August 07, 2005 6:36 AM Subject: Re: [PHP] Average time spent on a page Try using one of the log reader/analysis packages available for Apache or try doing it urself. Are you looking for the algorithm? let me know. On 8/6/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: LOL. This got nothing to do with my question . LOL again - Original Message - From: Frank de Bot [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Saturday, August 06, 2005 10:20 PM Subject: Re: [PHP] Average time spent on a page [EMAIL PROTECTED] wrote: Hi, How can i found out the average time users spent on a page. Anyone know a tutorial? Thanks in advance for your help !!! A hello world page will take me around 15 secs I guess... A full blown website with everything you can imagine a few months orso. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- M.Saleh.E.G 97150-4779817
[PHP] A question on the term CFG.
First, I'm new to PHP. I have a script that has a piece of code that looks like this - require_once($CFG-wwwroot . '/lib/mylib.php'); My question is this, I'm trying to find out how the class $CGF was initiated.There are no include or require statement before the statement. Is $CFG a global variable? If how does it get initiated? Tnaks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Average time spent on a page
My Algorithm would look something close to this, ForEach Session ForEach Page_Visit Record Page_Load Record Page_Unload (could be clicking on a link on a page or just leaving the whole domain which might end the session as well) This would be the simplest form I coult put a rough algorithm for that. The actual solution would be a mixture of PHP, JS, SQL, and Apache Log reading. Wow!!! I'm starting to visualize an application full of graphs and analysys for usabilty analysys and results. I'm so excited. I'm going to research more on this subject. On 8/7/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Yes, I'm looking for the algorithm. - Original Message - *From:* M Saleh EG [EMAIL PROTECTED] *To:* [EMAIL PROTECTED] *Cc:* php-general@lists.php.net ; Frank de Bot [EMAIL PROTECTED] *Sent:* Sunday, August 07, 2005 6:36 AM *Subject:* Re: [PHP] Average time spent on a page Try using one of the log reader/analysis packages available for Apache or try doing it urself. Are you looking for the algorithm? let me know. On 8/6/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: LOL. This got nothing to do with my question . LOL again - Original Message - From: Frank de Bot [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Saturday, August 06, 2005 10:20 PM Subject: Re: [PHP] Average time spent on a page [EMAIL PROTECTED] wrote: Hi, How can i found out the average time users spent on a page. Anyone know a tutorial? Thanks in advance for your help !!! A hello world page will take me around 15 secs I guess... A full blown website with everything you can imagine a few months orso. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- M.Saleh.E.G 97150-4779817 -- M.Saleh.E.G 97150-4779817
[PHP] writing to file
i have this app where a user fills out a form and after submit it displays the values they entered. i want to save this info to a file after they submit, then allow them to download the file. some other user does the same, fills in the form and allow that person to download the file... and so on. i don't know how i should go about doing this.. rather than keep creating files i would like to recycle the file each time someone uses the system, but that can lead to other problems.. like several users using the app at once.. any suggestion/ideas/tips how i should do this? basically, just write the info from POST to a file and allow them to download the file. obviously i am worried how secure i will be able to make this. -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.10.2/65 - Release Date: 8/7/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A question on the term CFG.
That isn't created by PHP, it must be declared in the code somewhere. Maybe there is an auto_prepend_file set? http://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file Chris wayne wrote: First, I'm new to PHP. I have a script that has a piece of code that looks like this - require_once($CFG-wwwroot . '/lib/mylib.php'); My question is this, I'm trying to find out how the class $CGF was initiated.There are no include or require statement before the statement. Is $CFG a global variable? If how does it get initiated? Tnaks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A question on the term CFG.
Or if it's PHP 5 they might be using an __autoload() magic function which gets called whenever a class that isn't declared is instantiated. That function could be require()ing another file. Jasper Chris wrote: That isn't created by PHP, it must be declared in the code somewhere. Maybe there is an auto_prepend_file set? http://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file Chris wayne wrote: First, I'm new to PHP. I have a script that has a piece of code that looks like this - require_once($CFG-wwwroot . '/lib/mylib.php'); My question is this, I'm trying to find out how the class $CGF was initiated.There are no include or require statement before the statement. Is $CFG a global variable? If how does it get initiated? Tnaks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Java - toString() - php - ?
If you use PHP 5 just use the __toString() magic method which does exactly that. http://www.php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring Jasper Rory Browne wrote: Um - did you read my last email regarding var_dump var_export and print_r Did you try them? Do they do what you want? On 8/2/05, Adi Zebic [EMAIL PROTECTED] wrote: Rory Browne a écrit : I haven't a monkies what that code(your java) does, and I don't have time to analyse it(in expensive cybercafe), but you may want to consider www.php.net/print-r www.php.net/var-dump and www.php.net/var-export I think they may do what you want without using the toString method, which for what you're describing is basicly an ugly hack. One more thing: Enlighten me: What exactly do you mean by live evolution in your php/java context. If in php context you have class, say, A: class A { var $t1; var $t2; var $t3; //After, you have object contructor of type A //we have something like this function A ($var1, $var2, $var3) { $this - t1 = $var1; $this - t2 = $var2; $this - t3 = $var3; } some other code } //than in some other class we have something like this: class someOtherClass { $aConstructor = new A(1,2,3); //values of t1, t2 and t3 are 1,2 and 3 now } Right? yes. How you can you do something like this inside of someOtherClass print ($aConstructor); to finally have some nice output like Value of t1 is 1; Value of t2 is 2; Value of T3 is 3; or just: 1 2 3 Without creating functions like getValues() function getValues() { print ($this - t1); print ($this - t2); print ($this - t3); } and after explicit invoke function: $aConstructor - getValues(); So, what I want is this: print ($aConstructor); and not this: $aContructor - getValues(); Am I clear :-) ADI -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A question on the term CFG.
On 8/7/05 4:24 PM, Jasper Bryant-Greene [EMAIL PROTECTED] wrote: Or if it's PHP 5 they might be using an __autoload() magic function which gets called whenever a class that isn't declared is instantiated. That function could be require()ing another file. Well, if it is PHP 5, then you can use introspection to find out where that class is declared: $className = get_class ($CFG); $cls = new ReflectionClass ($className); Echo Class . $className . is defined in . $cls-getFileName() . between lines . $cls-getStartLine() . and . $cls-getEndLine(); Marco Jasper Chris wrote: That isn't created by PHP, it must be declared in the code somewhere. Maybe there is an auto_prepend_file set? http://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file Chris wayne wrote: First, I'm new to PHP. I have a script that has a piece of code that looks like this - require_once($CFG-wwwroot . '/lib/mylib.php'); My question is this, I'm trying to find out how the class $CGF was initiated.There are no include or require statement before the statement. Is $CFG a global variable? If how does it get initiated? Tnaks. -- Marco Tabini President CEO Marco Tabini Associates, Inc. 28 Bombay Ave. Toronto, ON M3H 1B7 Canada Phone: +1 (416) 630-6202 Fax: +1 (416) 630-5057 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mkdir, Shared Hosting?
Thanks, but I've tried that when I first got the Error message, it still gave me the error. Thanks though! In a message dated 8/7/2005 1:29:26 A.M. Central Standard Time, [EMAIL PROTECTED] writes: Open up your FTP client and log into your website, then change the permissions on your folder so that the apache process has write access to it. Its really hit and miss depending on your setup. The sure fire way (but highly insecure) way is to change the permissions to the directory in question to 777. A better solution would be 755, but it may not work. Try it, and see what you get.
Re: [PHP] A question on the term CFG.
wayne wrote: First, I'm new to PHP. I have a script that has a piece of code that looks like this - require_once($CFG-wwwroot . '/lib/mylib.php'); My question is this, I'm trying to find out how the class $CGF was initiated.There are no include or require statement before the statement. Is $CFG a global variable? If how does it get initiated? Tnaks. you already had a couple of really good tips on finding the relevanty class - regarding 'CFG' Ill bet the guy that wrote it meant 'config', thats often shorten to 'cfg' or 'conf' - programmers like to type a little as possible :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] writing to file
Sebastian wrote: i have this app where a user fills out a form and after submit it displays the values they entered. i want to save this info to a file after they submit, then allow them to download the file. some other user does the same, fills in the form and allow that person to download the file... and so on. i don't know how i should go about doing this.. rather than keep creating files i would like to recycle the file each time someone uses the system, but that can lead to other problems.. like several users using the app at once.. any suggestion/ideas/tips how i should do this? basically, just write the info from POST to a file and allow them to download the file. obviously i am worried how secure i will be able to make this. alot depends on whether the user will be allowed to download the file only in the current session or at any time in the future. also security has 2 sides - protection on the server (from other people hosting on the same machine, and protection on the 'outside' from unauthorized users trying to download other peoples files (which would require some kind of login mechanism) note that in order to give a user a file to download when he/she clicks something does not require an actual file to exist ... you could store the data ('file contents') in a DB and have a script which when requested with the correct parameters (GET args) will extract the data from the DB (or whereever) and output it with the correct headers (to force a download) there is lots of info out there on how to create/output headers to tell a browser that it should download whatever is returned from a request. have a search - chances are you'll find something chances are also that you'll get stuck because of the way certain browsers f*** up when given 'download' headers - I've found it as much art as science in the past ;-) any way if this turns out to be the case we'll be seeing you :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A question on the term CFG.
Hi Marco, The version of php I have is 4.3.10. Is there something similar to the below example in the version I have? Thanks. On Sun, 2005-08-07 at 16:39 -0400, Marco Tabini wrote: On 8/7/05 4:24 PM, Jasper Bryant-Greene [EMAIL PROTECTED] wrote: Or if it's PHP 5 they might be using an __autoload() magic function which gets called whenever a class that isn't declared is instantiated. That function could be require()ing another file. Well, if it is PHP 5, then you can use introspection to find out where that class is declared: $className = get_class ($CFG); $cls = new ReflectionClass ($className); Echo Class . $className . is defined in . $cls-getFileName() . between lines . $cls-getStartLine() . and . $cls-getEndLine(); Marco Jasper Chris wrote: That isn't created by PHP, it must be declared in the code somewhere. Maybe there is an auto_prepend_file set? http://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file Chris wayne wrote: First, I'm new to PHP. I have a script that has a piece of code that looks like this - require_once($CFG-wwwroot . '/lib/mylib.php'); My question is this, I'm trying to find out how the class $CGF was initiated.There are no include or require statement before the statement. Is $CFG a global variable? If how does it get initiated? Tnaks. -- Marco Tabini President CEO Marco Tabini Associates, Inc. 28 Bombay Ave. Toronto, ON M3H 1B7 Canada Phone: +1 (416) 630-6202 Fax: +1 (416) 630-5057 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A question on the term CFG.
Hi Jasper, I thought about this and so I did a grep on autoload and came up empty. Is there a different way of checking for the magic function? Thanks On Mon, 2005-08-08 at 08:24 +1200, Jasper Bryant-Greene wrote: Or if it's PHP 5 they might be using an __autoload() magic function which gets called whenever a class that isn't declared is instantiated. That function could be require()ing another file. Jasper Chris wrote: That isn't created by PHP, it must be declared in the code somewhere. Maybe there is an auto_prepend_file set? http://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file Chris wayne wrote: First, I'm new to PHP. I have a script that has a piece of code that looks like this - require_once($CFG-wwwroot . '/lib/mylib.php'); My question is this, I'm trying to find out how the class $CGF was initiated.There are no include or require statement before the statement. Is $CFG a global variable? If how does it get initiated? Tnaks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A question on the term CFG.
Well if you're using 4.3.10 as you said in your other post then __autoload is not supported anyway. A grep on autoload would've turned it up. I'm assuming you've tried a grep for CFG to find the declaration? Jasper wayne wrote: Hi Jasper, I thought about this and so I did a grep on autoload and came up empty. Is there a different way of checking for the magic function? Thanks On Mon, 2005-08-08 at 08:24 +1200, Jasper Bryant-Greene wrote: Or if it's PHP 5 they might be using an __autoload() magic function which gets called whenever a class that isn't declared is instantiated. That function could be require()ing another file. Jasper Chris wrote: That isn't created by PHP, it must be declared in the code somewhere. Maybe there is an auto_prepend_file set? http://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file Chris wayne wrote: First, I'm new to PHP. I have a script that has a piece of code that looks like this - require_once($CFG-wwwroot . '/lib/mylib.php'); My question is this, I'm trying to find out how the class $CGF was initiated.There are no include or require statement before the statement. Is $CFG a global variable? If how does it get initiated? Tnaks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php