[PHP] __LINE__,__FILE__ + custom error handlers
hi guys i am trying to create callback error functions handlers , i was wondering if there was a way to get the file and line caught in a error function say with a database abstraction query without having to explicitly put the line and number in the query function , at the moment if i put line and file inside the error handler it will only display where the error was caught inside the handler itself :| -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 26 Jan 2003 08:39:29 -0000 Issue 1845
php-general Digest 26 Jan 2003 08:39:29 - Issue 1845 Topics (messages 133123 through 133161): Re: Minor email problem 133123 by: George E. Papadakis Re: Word Count 133124 by: George E. Papadakis Re: $object-function($parameter)-function(); 133125 by: Alex Re: a regular expression problem - split text 133126 by: George E. Papadakis Re: Script under Windows OK, under Linux, not... 133127 by: Danny Shepherd Re: GD jpg thumbnail - ugly discollored 133128 by: Mark Charette 133135 by: Victor Apachequestion 133129 by: Øystein Håland + in filenames 133130 by: Victor 133133 by: Richard Whitney 133136 by: Victor 133138 by: Richard Whitney 133139 by: Victor CRON? 133131 by: Nicole 133132 by: Leif K-Brooks 133134 by: Alex 133140 by: Nicole 133141 by: Nicole 133152 by: Tom Rogers converting a Recorset into an XML string 133137 by: Octavio Herrera 133142 by: Sean Malloy Re: Select value for driopdown box 133143 by: Ben C. 133149 by: Greg Beaver SELECT with WHILE NOT 133144 by: Andre Dubuc 133146 by: Sean Malloy 133147 by: Andre Dubuc Re: OO2relation mapping 133145 by: Manuel Lemos 133156 by: Dominik Wittenbeck XORing a string with some hash??? 133148 by: Peter Litov 133153 by: Tom Rogers Check if directory has changed 133150 by: Carlos Fernando Scheidecker Antunes 133151 by: Peter Litov 133158 by: Jason Sheets Masive mail Advice 133154 by: Maciek Ruckgaber Bielecki 133157 by: Mark Charette 133160 by: Jason Wong Java problem...need advice. 133155 by: John Wells A Date and Time Library for all seasons 133159 by: John Lim __LINE__,__FILE__ + custom error handlers 133161 by: electroteque 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] -- ---BeginMessage--- Take a look at the standard php mail function . You can set most of the available mail headers inluding from/to ones. That would do it. --georgep - Original Message - From: Denis L. Menezes [EMAIL PROTECTED] To: PHP general list [EMAIL PROTECTED] Sent: Friday, January 24, 2003 1:48 AM Subject: [PHP] Minor email problem hello friends, I am hosted with an ISP called Apexon. I have written php scripts to send mail from a webpage. When I send this mail, the from address becomes [EMAIL PROTECTED] . Their website says that the variable sendmail_from is [EMAIL PROTECTED] . I want to force my own from address in this. I also want to change the sender's name to my name rather than my website name. I have tried many ways, but not successful. Can someone help me? Please help. Thanks denis ---End Message--- ---BeginMessage--- $wordsCount = str_word_count($string); -- georgep - Original Message - From: Maxim Maletsky [EMAIL PROTECTED] To: Craig [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, January 23, 2003 11:26 PM Subject: Re: [PHP] Word Count words, for a programming language, are nothing more than just the spaces. So, as previousely was shown - could the mount of spaces in the string to get the amount of `words' in between them. -- Maxim Maletsky [EMAIL PROTECTED] Craig [EMAIL PROTECTED] wrote... : Is there a way to count the number of words in a string? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- If I am not mistaken, this feature is coming in php5, but is not yet in php4 Chris McCluskey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED].. . Hi there, I've been using PHP for about 2 years now and absolutely love it! Our company uses it as our main development language, so far though, there is one thing that has been annoying me for a while now.. the following line of code will not work: $object-function1($parameter)-function2(); I receive a parse error when i try to call another function off of the object that function1 returns. I know this is possible in java: object.function1(parameter).function2(); VB: object.function1(paremeter).function2 and i'm sure C++, although i'm not too familiar with that language. My question is, will or is there any support for this kind of call in PHP? or is there another way that i should be doing it? as for now, here is my work around: $tmp = $object-function1($parameter); $tmp-function2(); Thank you in advance! -Chris ---
Re: [PHP] __LINE__,__FILE__ + custom error handlers
from: http://www.php.net/manual/en/function.set-error-handler.php string set_error_handler ( callback error_handler) The user function needs to accept 2 parameters: the error code, and a string describing the error. From PHP 4.0.2, an additional 3 optional parameters are supplied: the filename in which the error occurred, the line number in which the error occurred, and the context in which the error occurred (an array that points to the active symbol table at the point the error occurred). example: function myErrorHandler ($errno, $errstr, $errfile, $errline, $errcontext) {...} HTH, Jason k Larson electroteque wrote: hi guys i am trying to create callback error functions handlers , i was wondering if there was a way to get the file and line caught in a error function say with a database abstraction query without having to explicitly put the line and number in the query function , at the moment if i put line and file inside the error handler it will only display where the error was caught inside the handler itself :| -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: OO2relation mapping
I am targeting a more slim solution though, solving a very specialized problem. As a developer I simply hate needing to change a database table, splitting it up, to make it fit the customers needs. I causes all those SQL statement to be revised. With the oo2rel mapping layer I have put much thought into the possibility that a project's datastructure actually might need a change when it is live and filled with data. I cannot simply change the structure, recompile my classes and submit them. I somehow need to preserve integrity within the data model as well. I know I cannot come up with a comprehensive tutorial, not even working examples, but this is the background in front of which I need to operate and somehow I feel I am not the only one I am going to keep basic SQL statements, since that's the way developers, not having a degree think in those relational SQL structures as they understand them more easily. Why take something away from them they know. SQL will just be adapted to OO-state in a manner that is readable and understandable at first glance. As I said: not as comprehensive and complete as your project, but I think its targeting a more specific solution, that occurs often enough in everyday life to need support. You didn't discourage me at all, but rather give me an idea, where thing might be going for me in the future. Tnx! I will have a look into MetaL, that's for sure, but I will also continue with the OO2REL project ;-) Manuel Lemos [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, On 01/25/2003 01:40 PM, Dominik Wittenbeck wrote: I am currently developing a object to relational mapping layer for PHP. It's NOT a simple treat all databases like one kind of layer (although it does involve it to preserve extensibility) but an XML based intermediate layer that creates both, table structures, following a conventional scheme and PHP classes that allow, OO access to these tables. I have enclosed the XML file that represents the intermediate layer. Its pretty readable even without the XML schema. I am currently under development, so don't expect anything useful in less than a few weeks Question: Does anyone of you know anyone who has tried something similar, because my research on the subject grows thin? Is something like this of public interest at all, or would you prefer accessing your datastructure the old fashion way? You have pretty much describe Metastorage. It is basically a generator application that lets you model classes of objects that are mapped and stored in relational database database. You just need to to describe your classes also in a XML file with the class variables, validation rules, relationships between classes and the types of functions that your application needs to manipulate the classes objects. Metastorage generates all the code for the classes ready to use in your applications. That includes also a separate class with code to install the database schema. The resulting classes API is database independent. This means that you do not need to change your application to use the same classes with different types databases. Many types of databases are supported. Still, you do not need to write absolutely any SQL in anywhere. Metastorage generates adequate code for you where needed. I do not mean to discourage from continuing your work, but since there is a great deal of overlap between Metastorage and what you have in mind, you are most welcomed at least to eveluate Metastorage if not also contribute in anyway to its development. Metastorage is Open Source and is avaliable here: http://www.meta-language.net/news-2002-12-09-metastorage.html http://www.meta-language.net/metastorage.html -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: OO2relation mapping
Hello, On 01/26/2003 02:59 AM, Dominik Wittenbeck wrote: Sounds most interesting (and far more ambicious, than what I had in mind). I'll probably do you wrong by not grasping the full extend of the project, but in short, did I get it right: XML2UML2ProgrammingLanguage Don't be mislead by this page. Generation of UML class diagrams is just a bonus feature. It is not even a core feature. It is just helpful to explain and document your project class relationships. The main goal is to generate code in a few seconds that otherwise would take you days or weeks to write, test and debug manually. http://www.meta-language.net/news-2002-12-09-metastorage.html -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: OO2relation mapping
Hello, On 01/26/2003 03:20 AM, Dominik Wittenbeck wrote: I am targeting a more slim solution though, solving a very specialized problem. As a developer I simply hate needing to change a database table, splitting it up, to make it fit the customers needs. I causes all those SQL statement to be revised. With the oo2rel mapping layer I have put much thought into the possibility that a project's datastructure actually might need a change when it is live and filled with data. I cannot simply change the structure, recompile my classes and submit them. I somehow need to preserve integrity within the data model as well. I know I cannot come up with a comprehensive tutorial, not even working examples, but this is the background in front of which I need to operate and somehow I feel I am not the only one That is a feature provided by Metabase schema management. Currently, Metastorage generates code that use Metabase database API. Metabase lets you define database schemas using a simple XML format that is database independent. Metabase takes care of the installation of such schema. If you change the XML schema definition, Metabase will apply the changes without affecting the data that was added to the database after it was installed for the first time or updated for the last time. If you are providing such feature in your project, basically you are replicating that capability that Metabase provides for about 4 years now when it was started being developed. I am going to keep basic SQL statements, since that's the way developers, not having a degree think in those relational SQL structures as they understand them more easily. Why take something away from them they know. SQL will just be adapted to OO-state in a manner that is readable and understandable at first glance. There are plenty of reasons to prevent developers to use SQL by hand. First because Metastorage has all the information it needs to retrieve the objects from the database using appropriate SQL code that is statically embedded in the generated classes. If you are going to let the developer specify SQL by hand, your code is more likely to be buggy because your application will not verify if the developer specified SQL code is appropriate and correct. Also, if it is the developer that enters the SQL code, you prevent the possibility to perform context specific optimizitions that the code generator could perform statically. Anyway, the most important point is that if the developer still has to supply the SQL code, you are not taking much of his work and so the developments will still take a long time, the main reason why so many IT projects fail. The solution of Metastorage is to let the developer control everything from high level. If you need to specify details that usually would require SQL, like specifying filtering conditions, Metastorage provides an high level syntax for specifying such conditions in the classes XML definition. That lets Metastorage verify the validity of the conditions and generate optimized code. As I said: not as comprehensive and complete as your project, but I think its targeting a more specific solution, that occurs often enough in everyday I am not sure what you mean about targeting a more specific solution . life to need support. You didn't discourage me at all, but rather give me an idea, where thing might be going for me in the future. Tnx! I will have a look into MetaL, that's for sure, but I will also continue with the OO2REL project ;-) No, problem. I just thought you would like to know about the overlap of the projects, so you just don't duplicate efforts re-inventing the wheel. If your project provides something better of something that Metastorage does not provide, I would most certainly would like to know. -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] xtemplate windows
hi, i try to run xtemplate on my windows machine but i get errors such like : undefined index main...(main is the name of block !-- BEGIN: main --) it seems it can not process blocks in template. theres no error in unix machine. does anyone knows the solution? __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: xtemplate windows
Cenk Uysal [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... hi, i try to run xtemplate on my windows machine but i get errors such like : hi, I am not fluent with xtemplate, but it does not seems likely that your problem is related to windows. It could be that you have not installed everything needed on it? rush -- http://www.templatetamer.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CRLF in file
Hello, I'm having trouble with /r/n when I try to write to a file. Here's my code ; The array I want to write - $ch =array( $SQL_HOST= $SQL_HOST, SQL_USER= $SQL_USER, SQL_PWD=$SQL_PWD); and the code I'm using to write the file $fp = fopen (newfig.txt, w); if (!($fp)) { print (ERROR file not open!); exit; } { fputs($fp,$ch); foreach($ch as $key = $val) { fputs($fp,$$key = $val/r/n); } fclose ($fp); }; Here's a sample of the file this produces - $host = host/r/n$SQL_USER = user/r/n$SQL_PWD = dbpass/r/n What I want is to have crlf after each var like this - $host = host $SQL_USER = user $SQL_PWD = dbpass I must be doing /r/n wrong. My host is Apache on Sun OS. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems to compile php (cvs)
Hi, I usually fetch php from cvs a couple of times in order to try new features etc. Unfortunately since the beginning of this week I have been unable to compile, no matter what I do. I have been cvsing daily, buildconf and the same ./configure settings I have been using for ages. ./configure --with-apxs2 --enable-gd-native-ttf --with-xml --with-openssl --with-zlib --with-dom --with-gd --with-ttf The error : home/php4/ext/standard/basic_functions.c: In function `php_simple_ini_parser_cb': /home/php4/ext/standard/basic_functions.c:2827: `ZEND_INI_PARSER_POP_ENTRY' undeclared (first use in this function) /home/php4/ext/standard/basic_functions.c:2827: (Each undeclared identifier is reported only once /home/php4/ext/standard/basic_functions.c:2827: for each function it appears in.) Any tips ? __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] go to detail page problem
Hope Í'm at the right place to ask this question. Am using DMX and encounter following problem: Have a connection to a database with plenty of data. On a page which shows part of these records (10 max) I have a go to detail page action which works fine when called from the 1st 10 records, but when called from any other page (not the 1st 10 records any more) it suddenly sends the following header: quote-- http://blabla.com/detailshowpage.php?pageNum_Recordset1=2totalRows_Recordse t1=1130lidnummer=515 unquote-- and now the detailshowpage doesn't work correctly, while when done from the 1st page with the 1st ten records it only sends: quote-- http://blabla.com/detailshowpage.php?lidnummer=515 unquote-- on the page I am using the recordset paging functions, and this is pbly causing it but just don't know how to solve my little problem here. Your help is appreciated, thanks, Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CRLF in file
On Sunday 26 January 2003 22:13, Malcolm Brownell wrote: Hello, I'm having trouble with /r/n when I try to write to a file. It's \r\n that you want. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* If wishes were horses, then beggars would be thieves. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] xtemplate windows
i try to run xtemplate on my windows machine but i get errors such like : undefined index main...(main is the name of block !-- BEGIN: main --) it seems it can not process blocks in template. theres no error in unix machine. does anyone knows the solution? One solution would be to use Smarty. The other would be to try and find an xtemplate list/forum and ask on there. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Perl Includes when executed with php....
I have a perl script that needs to be executed using the exec command. This perl script had a use for another library. When executing this perl script from the consol - there is no problem - the library from the use is picked up from the proper directory (the included library is in the same directory as the perl script) - but when executing it from within php, the library cannot be found. In the past I have worked around it successfully by putting the library in the perl libs directory - but on this shared host provider they will not allow that. I am at a loss first of all why the file cannot be found in the perl script where executed using php, and second of all how to get the perl script to execute successfully through php. The php code is: exec(/home/vtccanada/psigate/processor.cgi \secure.psigate.com\ \1139\ \ConfigFile=teststoreKeyFile=./teststore.pemChargeType=1UserId=TESTOid= Bname=John Q. PublicBcompany=PSiGateBaddr1=6725-6 Millcreek DriveBcity=MississaugaBstate=OntarioBzip=L5N 5V2Bcountry=CanadaAmount=1.99Comments=NO COMMENTS[EMAIL PROTECTED]CardNumber=4111ExpMonth=04 ExpYear=05\,$results); foreach($results as $x) { print $xbr; } The Perl bit that is giving trouble is: sub process_order { use ClearLink; # Unique order number. Leave blank to have the API assign one. $oid = $input{'Oid'}; Etc... } Specifically the use ClearLink line. I know that this is not a perl list - but if anyone has suggestions on how to get that file included, or executed properly through php, I would appreciate it - keeping in mind that I have no access to perl library directories. Thanks. -- Cheers Mike Morton Indeed, it would not be an exaggeration to describe the history of the computer industry for the past decade as a massive effort to keep up with Apple. - Byte Magazine Given infinite time, 100 monkeys could type out the complete works of Shakespeare. Win 98 source code? Eight monkeys, five minutes. -- NullGrey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CRLF in file
awww geeze ! Thank you sir. Again I embarass myself and slink away On Mon, 27 Jan 2003 00:35:01 +0800, [EMAIL PROTECTED] (Jason Wong) wrote: On Sunday 26 January 2003 22:13, Malcolm Brownell wrote: Hello, I'm having trouble with /r/n when I try to write to a file. It's \r\n that you want. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* If wishes were horses, then beggars would be thieves. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CRLF in file
Thank you Jason, If you'll bear with me for one more question -- The /\ fix did what I wanted but now the word Array appears before the first var -- the text file looks like this - Array$hostname = hostname $SQL_USER = username $SQL_PWD = dbpass I know this is php telling me the data is an array but can I supress this somehow so all I'll print is the keys and vals? thanks malcolm On Mon, 27 Jan 2003 00:35:01 +0800, [EMAIL PROTECTED] (Jason Wong) wrote: On Sunday 26 January 2003 22:13, Malcolm Brownell wrote: Hello, I'm having trouble with /r/n when I try to write to a file. It's \r\n that you want. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* If wishes were horses, then beggars would be thieves. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems to compile php (cvs)
I'll bet you're trying to mix v4 and v5... Make sure you're using the latest anoncvs instructions, as they have changed recently... On Sunday 26 January 2003 07:52 am, Robert Mena wrote: Hi, I usually fetch php from cvs a couple of times in order to try new features etc. Unfortunately since the beginning of this week I have been unable to compile, no matter what I do. I have been cvsing daily, buildconf and the same ./configure settings I have been using for ages. ./configure --with-apxs2 --enable-gd-native-ttf --with-xml --with-openssl --with-zlib --with-dom --with-gd --with-ttf The error : home/php4/ext/standard/basic_functions.c: In function `php_simple_ini_parser_cb': /home/php4/ext/standard/basic_functions.c:2827: `ZEND_INI_PARSER_POP_ENTRY' undeclared (first use in this function) /home/php4/ext/standard/basic_functions.c:2827: (Each undeclared identifier is reported only once /home/php4/ext/standard/basic_functions.c:2827: for each function it appears in.) Any tips ? __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- I am convinced that the teaching of the church is in theory a crafty and evil lie, and in practice a concoction of gross superstition and witchcraft -Leo Nikolaevich Tolstoy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CRLF in file
On Monday 27 January 2003 01:27, Malcolm Brownell wrote: Thank you Jason, If you'll bear with me for one more question -- The /\ fix did what I wanted but now the word Array appears before the first var -- the text file looks like this - Array$hostname = hostname $SQL_USER = username $SQL_PWD = dbpass I know this is php telling me the data is an array but can I supress this somehow so all I'll print is the keys and vals? fputs($fp,$ch); Remove the above line. foreach($ch as $key = $val) { fputs($fp,$$key = $val/r/n); } fclose ($fp); -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* I just want to be a good engineer. -- Steve Wozniak, co-founder of Apple Computer, concluding his keynote speech at the 1988 AppleFest */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] human language detection
Hi, I am creating a bilingual website (Dutch and English) and I wonder how I would best detect the human language of a visitor. I am attempting several things, but I am sure there must be a generally accepted alternative. Can anyone point me to more info? I am tinkering around with HTTP_REFERER and HTTP_USER_AGENT and a bit in JavaScript which only works with Netscape browsers. But detection usually fails. I was wondering, my server provides a REMOTE_ADDR value, but not a REMOTE_HOST. From the last I could look voor a .nl extention. Is there a way to (inline) translate a IP address to something readable? It's a remote server on which I can't control the settings. Why is this so difficult? It should be a basic feature of any international software... or am I missing something? Thanks, Marco -- Marco Bleeker, Amsterdam, NL. Please do not distribute my email address to a third party Refer to www.ecocam.com for an email form (and more) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using MySQL user variables in PHP
I'm currently developing a PHP/MySQL project, one aspect of which involves displaying a default set from the database which picks out all records for whichever individual is associated with the most recent date. I know this is a very general description, but I don't think it's necessary to burden list members with further detail, nor to pass on details of my table structures. Suffice it to say that I successfully achieved my goal with MySQL from the command line, but I'm not sure how to write this functionality into my PHP code. In MySQL, the following sequence of commands works the magic: SELECT @most_recent:=MAX(date) FROM presenters; SELECT @recent_presenter:=presenter FROM presenters WHERE date = @most_recent; SELECT p.date, p.theme, p.presenter, c.itemNo, c.composer, c.composition, c.note FROM presenters p, compositions c WHERE p.date = c.date AND p.presenter = @recent_presenter ORDER BY p.date DESC; So how do I transfer all this to PHP? I've tried a number of approaches: 1. $presenterQuery = SELECT @most_recent:=MAX(date) from presenters; SELECT @recent_presenter:=presenter FROM presenters WHERE date=@most_recent; SELECT date_format(p.date, '%d/%m/%y') AS readable_date, p.theme, p.presenter, c.itemNo, c.composer, c.composition, c.note FROM presenters p, compositions c WHERE p.date = c.date AND p.presenter = @recent_presenter ORDER BY p.date DESC; 2. $tempQuery1 = SELECT @most_recent:=MAX(date) from presenters; $tempQuery2 = SELECT @recent_presenter:=presenter FROM presenters WHERE date=@most_recent; $presenterQuery = SELECT date_format(p.date, '%d/%m/%y') AS readable_date, p.theme, p.presenter, c.itemNo, c.composer, c.composition, c.note FROM presenters p, compositions c WHERE p.date = c.date AND p.presenter = @recent_presenter ORDER BY p.date DESC; 3. $tempQuery1 = SELECT @most_recent:=MAX(date) from presenters; $tempQuery1Result = mysql_db_query($database, $tempQuery1, $connection) or die ( mysql_error() ); $tempQuery2 = SELECT @recent_presenter:=presenter FROM presenters WHERE date = \$tempQuery1Result\; $tempQuery2Result = mysql_db_query($database, $tempQuery2, $connection) or die ( mysql_error() ); $presenterQuery = SELECT date_format(p.date, '%d/%m/%y') AS readable_date, p.theme, p.presenter, c.itemNo, c.composer, c.composition, c.note FROM presenters p, compositions c WHERE p.date = c.date AND p.presenter = \$tempQuery2Result\ ORDER BY p.date DESC; All of these options are followed by $presenterResult = mysql_db_query($database, $presenterQuery, $connection) or die ( mysql_error() ); All queries indicate that they have been successfully executed when I add relevant debug code, but it seems that rather than substitute the variable values, either a variable literal (e.g. @recent_presenter) or a value like Resource ID#2 is being used instead. Is it possible to do what I desire. If so, where am I going wrong? Jim MacCormaic Dublin, Ireland iChat/AIM : [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] human language detection
On Monday 27 January 2003 01:39, Marco Bleeker wrote: Hi, I am creating a bilingual website (Dutch and English) and I wonder how I would best detect the human language of a visitor. I am attempting several things, but I am sure there must be a generally accepted alternative. Can anyone point me to more info? The most practical way to do this is to default to one language (that of your majority target audience) then let the user choose if they want to select a different one, and keep their selection in a session or cookie. Trying to second-guess a user's preference from their browser settings/IP address/whatever is IMHO a waste of time. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Men use thought only to justify their wrong doings, and speech only to conceal their thoughts. -- Voltaire */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using MySQL user variables in PHP
On Monday 27 January 2003 01:51, Jim MacCormaic wrote: I'm currently developing a PHP/MySQL project, one aspect of which involves displaying a default set from the database which picks out all records for whichever individual is associated with the most recent date. I know this is a very general description, but I don't think it's necessary to burden list members with further detail, nor to pass on details of my table structures. Suffice it to say that I successfully achieved my goal with MySQL from the command line, but I'm not sure how to write this functionality into my PHP code. In MySQL, the following sequence of commands works the magic: SELECT @most_recent:=MAX(date) FROM presenters; SELECT @recent_presenter:=presenter FROM presenters WHERE date = @most_recent; SELECT p.date, p.theme, p.presenter, c.itemNo, c.composer, c.composition, c.note FROM presenters p, compositions c WHERE p.date = c.date AND p.presenter = @recent_presenter ORDER BY p.date DESC; So how do I transfer all this to PHP? I've tried a number of approaches: 1.$presenterQuery = SELECT @most_recent:=MAX(date) from presenters; SELECT @recent_presenter:=presenter FROM presenters WHERE date=@most_recent; SELECT date_format(p.date, '%d/%m/%y') AS readable_date, p.theme, p.presenter, c.itemNo, c.composer, c.composition, c.note FROM presenters p, compositions c WHERE p.date = c.date AND p.presenter = @recent_presenter ORDER BY p.date DESC; The php-mysql interface doesn't support multiple queries in a single operation so you can forget this approach. 2.$tempQuery1 = SELECT @most_recent:=MAX(date) from presenters; $tempQuery2 = SELECT @recent_presenter:=presenter FROM presenters WHERE date=@most_recent; $presenterQuery = SELECT date_format(p.date, '%d/%m/%y') AS readable_date, p.theme, p.presenter, c.itemNo, c.composer, c.composition, c.note FROM presenters p, compositions c WHERE p.date = c.date AND p.presenter = @recent_presenter ORDER BY p.date DESC; You're not doing anything with $tempQuery1 $tempQuery2 this is complete nonsense ;-) 3.$tempQuery1 = SELECT @most_recent:=MAX(date) from presenters; $tempQuery1Result = mysql_db_query($database, $tempQuery1, $connection) or die ( mysql_error() ); $tempQuery2 = SELECT @recent_presenter:=presenter FROM presenters WHERE date = \$tempQuery1Result\; $tempQuery2Result = mysql_db_query($database, $tempQuery2, $connection) or die ( mysql_error() ); $presenterQuery = SELECT date_format(p.date, '%d/%m/%y') AS readable_date, p.theme, p.presenter, c.itemNo, c.composer, c.composition, c.note FROM presenters p, compositions c WHERE p.date = c.date AND p.presenter = \$tempQuery2Result\ ORDER BY p.date DESC; This is getting closer. Unfortunately you haven't been reading the manual. mysql_query() returns a resource ID. See examples in manual for details on how to properly query and return results from a db. Looking at your queries, it seems that you're doing more steps than is strictly required. SELECT @most_recent:=MAX(date) FROM presenters; SELECT @recent_presenter:=presenter FROM presenters WHERE date = @most_recent; Couldn't the above be condensed to: SELECT presenter FROM presenters ORDER BY date DESC LIMIT 1; Which means you can get by with 2 queries: $query = SELECT presenter FROM presenters ORDER BY date DESC LIMIT 1; $result = mysql_query($query); $row = mysql_fetch_assoc($result); $presenter = $row['presenter']; You can now use $presenter in your last query: $presenterQuery = SELECT p.date, p.theme, p.presenter, c.itemNo, c.composer, c.composition, c.note FROM presenters p, compositions c WHERE p.date = c.date AND p.presenter = $presenter ORDER BY p.date DESC; $presenterResult = mysql_db_query($database, $presenterQuery, $connection) or die ( mysql_error() ); All code untested, handle with care. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* If we won't stand together, we don't stand a chance. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Combine 3 MySql rows into one PHP output row ?
Hey all. I'm a recent PHP convert (coming from Cold Fusion).. Here's the deal: I've got a table that contains hockey game result info; for each goal scored I record the goal scorer ID (i.e. their Jersey Number), and assist1 and assist2 IDs if applicable. When I output the game box score I join in the roster and team tables (to get the team name and player names). In Cold Fusion I was able to group a goal info set on the time of goal (each goal returns from 1 to 3 rows depending on the number of players who contributed to the goal); then, in Cold Fusion I could use it's output function to display the goal info set as one row. For example, if three players were in on a goal, the output would look something like: Team Name-- goal scorer name (assist1 name, assist2 name) -- Time of goal -- Goal type. Since each goal can, and usualy does, have more than one participant, the scoring table will be returning more than one row for each goal scored -- how can I combine these rows into one PHP output row? If you need more info, let me know. Thanks for any ideas, --Noah -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using MySQL user variables in PHP
I'm currently developing a PHP/MySQL project, one aspect of which involves displaying a default set from the database which picks out all records for whichever individual is associated with the most recent date. I know this is a very general description, but I don't think it's necessary to burden list members with further detail, nor to pass on details of my table structures. Suffice it to say that I successfully achieved my goal with MySQL from the command line, but I'm not sure how to write this functionality into my PHP code. In MySQL, the following sequence of commands works the magic: SELECT @most_recent:=MAX(date) FROM presenters; SELECT @recent_presenter:=presenter FROM presenters WHERE date = @most_recent; SELECT p.date, p.theme, p.presenter, c.itemNo, c.composer, c.composition, c.note FROM presenters p, compositions c WHERE p.date = c.date AND p.presenter = @recent_presenter ORDER BY p.date DESC; So how do I transfer all this to PHP? Pretty sure you can do all that with one query. Something like: SELECT p.date, p.theme, p.presenter, c.itemNo, c.composer, c.composition, c.note FROM presenters p, compositions c WHERE p.date = c.date ORDER BY p.date DESC LIMIT 1 Not sure, though, as I don't have time to test right now. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using MySQL user variables in PHP
-Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] 2. $tempQuery1 = SELECT @most_recent:=MAX(date) from presenters; $tempQuery2 = SELECT @recent_presenter:=presenter FROM presenters WHERE date=@most_recent; $presenterQuery = SELECT date_format(p.date, '%d/%m/%y') AS readable_date, p.theme, p.presenter, c.itemNo, c.composer, c.composition, c.note FROM presenters p, compositions c WHERE p.date = c.date AND p.presenter = @recent_presenter ORDER BY p.date DESC; You're not doing anything with $tempQuery1 $tempQuery2 this is complete nonsense ;-) Not true - this is using MySQL's variable approach. The '@' represents a user variable per connection in MySQL. See http://www.mysql.com/doc/en/Variables.html for more information. mark C. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using MySQL user variables in PHP
On Sunday, January 26, 2003, at 06:26 pm, Jason Wong wrote: You're not doing anything with $tempQuery1 $tempQuery2 this is complete nonsense ;-) Bowing obsequiously, suitably chastened, I read on . . . This is getting closer. Unfortunately you haven't been reading the manual. mysql_query() returns a resource ID. See examples in manual for details on how to properly query and return results from a db. Knuckles recovering from another knock, I read further . . . Couldn't the above be condensed to: SELECT presenter FROM presenters ORDER BY date DESC LIMIT 1; Much neater indeed. Elegant, even. Which means you can get by with 2 queries: $query = SELECT presenter FROM presenters ORDER BY date DESC LIMIT 1; $result = mysql_query($query); $row = mysql_fetch_assoc($result); $presenter = $row['presenter']; You can now use $presenter in your last query All code untested, handle with care. Code successfully incorporated and working as intended. Thanks for the help. Jim MacCormaic Dublin, Ireland iChat/AIM : [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using MySQL user variables in PHP
On Monday 27 January 2003 02:36, Mark Charette wrote: -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] 2.$tempQuery1 = SELECT @most_recent:=MAX(date) from presenters; $tempQuery2 = SELECT @recent_presenter:=presenter FROM presenters WHERE date=@most_recent; $presenterQuery = SELECT date_format(p.date, '%d/%m/%y') AS readable_date, p.theme, p.presenter, c.itemNo, c.composer, c.composition, c.note FROM presenters p, compositions c WHERE p.date = c.date AND p.presenter = @recent_presenter ORDER BY p.date DESC; You're not doing anything with $tempQuery1 $tempQuery2 this is complete nonsense ;-) Not true - this is using MySQL's variable approach. The '@' represents a user variable per connection in MySQL. See http://www.mysql.com/doc/en/Variables.html for more information. I know. The important point is that although $tempQuery1 $tempQuery2 are assigned, they aren't being passed to any mysql_query(). -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Music in the soul can be heard by the universe. -- Lao Tsu */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Masive mail Advice
Thanks a lot for your sugestions guys, and i'll have a look into phpMail and write a prototype keeping in mind your advice about the size of chunks and use of sleep. Just let me bother you a little bit more if i run into trouble Michael ;-) Thanks again guys ! -- Few are those who see with their own eyes and feel with their own hearts. Albert Einstein - Maciek Ruckaber Bielecki -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Predefined Variables In Classes
Hello Everyone, I am a little confused. Why do predefined variables like $PHP_SELF or $DOCUMENT_ROOT not process within a class, in the methods secifically. For example: ?php class someClass { function someFunction () { $root = $DOCUMENT_ROOT; return $root; } function someFunction2 () { $path = $this-someFunction() . $PHP_SELF; return $path; } } ? I just threw this together to give you an example of how I might be using these two predefined variables in a class. The problem is that $DOCUMENT_ROOT or $PHP_SELF won't parse or something. It just returns blank. It is included in another page when needed, say somePage.php. Shouldn't $PHP_SELF recognize the somePage.php as the current running script file, as opposed to the class file where these two functions are called? If it doesn't work that way then how do I do this without sending predefined variable parameters to these functions? Please note that register globals is on. I could not find any documentation on this on php.net. Maybe someone can give me a hint of point it out for me on the documentation. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Predefined Variables In Classes
Read: http://www.php.net/variables.scope Also note that $_SERVER is an autoglobal. Regards, Philip On Sun, 26 Jan 2003, @ Nilaab wrote: Hello Everyone, I am a little confused. Why do predefined variables like $PHP_SELF or $DOCUMENT_ROOT not process within a class, in the methods secifically. For example: ?php class someClass { function someFunction () { $root = $DOCUMENT_ROOT; return $root; } function someFunction2 () { $path = $this-someFunction() . $PHP_SELF; return $path; } } ? I just threw this together to give you an example of how I might be using these two predefined variables in a class. The problem is that $DOCUMENT_ROOT or $PHP_SELF won't parse or something. It just returns blank. It is included in another page when needed, say somePage.php. Shouldn't $PHP_SELF recognize the somePage.php as the current running script file, as opposed to the class file where these two functions are called? If it doesn't work that way then how do I do this without sending predefined variable parameters to these functions? Please note that register globals is on. I could not find any documentation on this on php.net. Maybe someone can give me a hint of point it out for me on the documentation. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem solved
Just in case someone wants to know : I had to uncheck the passing parameters in the go to detailpage parameter box! Martin Wmb [EMAIL PROTECTED] schreef in bericht [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... | Hope Í'm at the right place to ask this question. | | Am using DMX and encounter following problem: | | Have a connection to a database with plenty of data. | On a page which shows part of these records (10 max) I have a go to detail | page action which works fine when called from the 1st 10 records, but when | called from any other page (not the 1st 10 records any more) it suddenly | sends the following header: | quote-- | http://blabla.com/detailshowpage.php?pageNum_Recordset1=2totalRows_Recordse | t1=1130lidnummer=515 | unquote-- | and now the detailshowpage doesn't work correctly, | | while when done from the 1st page with the 1st ten records it only sends: | quote-- | http://blabla.com/detailshowpage.php?lidnummer=515 | unquote-- | | on the page I am using the recordset paging functions, and this is pbly | causing it but just don't know how to solve my little problem here. | | Your help is appreciated, thanks, | Martin | | | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Java call on object causes segfault.
Working on getting Java integration going. I was able to get it to work with the online example and can create an object of java.lang.System and print various properties returned from there. However, if I create my own class, I can instantiate it, but if I call a method on that class it causes a SIGSEV. Could anyone provide some insight? Here's the code and backtrace: This is with Sun jdk 1.4.1_1, php-4.2.3 on Red Hat 8.0. ? $obj = new Java('com.x.reports.Serv'); print $obj-getMsg(); ? --- java code stored off of class path in com/x/reports --- package com.x.reports; class Serv { public String msg = THIS IS A TEST MESSAGE; Serv() { } public String getMsg() { return this.msg; } } -- BACKTRACE --- Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 8192 (LWP 9303)] 0x402da2cb in java_call_function_handler (ht=0, return_value=0x8114d14, this_ptr=0x810d604, return_value_used=1, property_reference=0xbfffdf54) at java.c:464 464 obj = zend_list_find(Z_LVAL_PP(handle), type); (gdb) bt #0 0x402da2cb in java_call_function_handler (ht=0, return_value=0x8114d14, this_ptr=0x810d604, return_value_used=1, property_reference=0xbfffdf54) at java.c:464 #1 0x40191553 in call_overloaded_function (T=0xbfffdf48, arg_count=0, return_value=0x8114d14) at zend_execute.c:953 #2 0x40194636 in execute (op_array=0x8114b6c) at zend_execute.c:1660 #3 0x401a40a3 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at zend.c:812 #4 0x401b5aaf in php_execute_script (primary_file=0xb450) at main.c:1383 #5 0x401b0aba in apache_php_module_main (r=0x8107004, display_source_mode=0) at sapi_apache.c:90 #6 0x401b18ea in send_php (r=0x8107004, display_source_mode=0, filename=0x8107b34 /opt/apache_1.3.27/htdocs/t.php) at mod_php4.c:575 #7 0x401b1963 in send_parsed_php (r=0x8107004) at mod_php4.c:590 #8 0x08074880 in ap_invoke_handler () #9 0x08088c76 in process_request_internal () #10 0x08088cd6 in ap_process_request () #11 0x0807ff9a in child_main () #12 0x0808013a in make_child () #13 0x080802a1 in startup_children () #14 0x080808ce in standalone_main () #15 0x080810ec in main () #16 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP And Apache
Zdravo php-general, Hi I'm having ptoblem how do I aneble PHP on apache..?? I've read Hot to install but Apche changed httpd.conf on new version of Apache server. Help Thanks +++Info About this E-mail+ +Poruka je napisana u 12:45:19 + +Dana Sunday, January 26, 2003 + +Files in this E-mail massage+ +none + ++ +Email: [EMAIL PROTECTED] + ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 26 Jan 2003 20:47:35 -0000 Issue 1846
php-general Digest 26 Jan 2003 20:47:35 - Issue 1846 Topics (messages 133162 through 133192): Re: __LINE__,__FILE__ + custom error handlers 133162 by: Jason k Larson Re: OO2relation mapping 133163 by: Dominik Wittenbeck 133164 by: Manuel Lemos 133165 by: Manuel Lemos xtemplate windows 133166 by: Cenk Uysal 133167 by: rush 133172 by: John W. Holmes CRLF in file 133168 by: Malcolm Brownell 133171 by: Jason Wong 133174 by: Malcolm Brownell 133175 by: Malcolm Brownell 133177 by: Jason Wong Problems to compile php (cvs) 133169 by: Robert Mena 133176 by: Evan Nemerson go to detail page problem 133170 by: WMB Perl Includes when executed with php 133173 by: Mike Morton human language detection 133178 by: Marco Bleeker 133180 by: Jason Wong Using MySQL user variables in PHP 133179 by: Jim MacCormaic 133181 by: Jason Wong 133183 by: John W. Holmes 133184 by: Mark Charette 133185 by: Jim MacCormaic 133186 by: Jason Wong Combine 3 MySql rows into one PHP output row ? 133182 by: CF High Re: Masive mail Advice 133187 by: Maciek Ruckgaber Bielecki Predefined Variables In Classes 133188 by: . Nilaab 133189 by: Philip Olson Problem solved 133190 by: WMB Java call on object causes segfault. 133191 by: John Wells PHP And Apache 133192 by: Beogradjanin 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] -- ---BeginMessage--- from: http://www.php.net/manual/en/function.set-error-handler.php string set_error_handler ( callback error_handler) The user function needs to accept 2 parameters: the error code, and a string describing the error. From PHP 4.0.2, an additional 3 optional parameters are supplied: the filename in which the error occurred, the line number in which the error occurred, and the context in which the error occurred (an array that points to the active symbol table at the point the error occurred). example: function myErrorHandler ($errno, $errstr, $errfile, $errline, $errcontext) {...} HTH, Jason k Larson electroteque wrote: hi guys i am trying to create callback error functions handlers , i was wondering if there was a way to get the file and line caught in a error function say with a database abstraction query without having to explicitly put the line and number in the query function , at the moment if i put line and file inside the error handler it will only display where the error was caught inside the handler itself :| ---End Message--- ---BeginMessage--- I am targeting a more slim solution though, solving a very specialized problem. As a developer I simply hate needing to change a database table, splitting it up, to make it fit the customers needs. I causes all those SQL statement to be revised. With the oo2rel mapping layer I have put much thought into the possibility that a project's datastructure actually might need a change when it is live and filled with data. I cannot simply change the structure, recompile my classes and submit them. I somehow need to preserve integrity within the data model as well. I know I cannot come up with a comprehensive tutorial, not even working examples, but this is the background in front of which I need to operate and somehow I feel I am not the only one I am going to keep basic SQL statements, since that's the way developers, not having a degree think in those relational SQL structures as they understand them more easily. Why take something away from them they know. SQL will just be adapted to OO-state in a manner that is readable and understandable at first glance. As I said: not as comprehensive and complete as your project, but I think its targeting a more specific solution, that occurs often enough in everyday life to need support. You didn't discourage me at all, but rather give me an idea, where thing might be going for me in the future. Tnx! I will have a look into MetaL, that's for sure, but I will also continue with the OO2REL project ;-) Manuel Lemos [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, On 01/25/2003 01:40 PM, Dominik Wittenbeck wrote: I am currently developing a object to relational mapping layer for PHP. It's NOT a simple treat all databases like one kind of layer (although it does involve it to preserve extensibility) but an XML based intermediate layer that creates both, table structures, following a conventional scheme and PHP classes that allow, OO access to these tables. I have enclosed the XML file that represents the intermediate layer. Its pretty readable even without the XML
[PHP] can't write and read on/from a file - Apache.exe access error
Hello ! I'm in a mess. Please help me. Every time I tried to write with fwrite or fputs in a file, I get an error on windows nt sp6 , ie6 from Doc. Watson saying that Apache.exe makes an application access error . Filesystem functions: is_readable, is_writable,fopen,fclose are ok . I can create, find,open the file. versions: PHP 4.2.3, APACHE 1.3 httpd.conf : Alias /test/ C:/Apache/htdocs/test/ Directory C:/Apache/htdocs/test Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all /Directory -- example1: // start buffering the output ob_start(); $filename = c:\\apache\\htdocs\\test\files\\mifile.txt; // output format - either www or file $output = file; // print some output print Welcome to the Matrix, Neo; // now decide what to do with the buffered output if ($output == www) { // either print the contents of the buffer... ob_end_flush(); } else { // ... or write it to a file $data = ob_get_contents(); chmod ($filename, 0777); $fp = fopen ($filename, wb+); //ERROR IS HERE fwrite($fp, $data); fclose($fp); ob_end_clean(); } example 2: //I tried each of the following 5 $filename assignments. //$filename = c:\\apache\\htdocs\\mcm\\mifile.txt; //$filename = /mifile.txt; //$filename = mifile.txt; //$filename = c:\\tmp\\mifile.txt; $filename = c:\\apache\\htdocs\\test\files\\mifile.txt; $somecontent = Add this to the file\n; $fp = fopen($filename,wb); //NOTHING IS DISPLAYED echo brthis is fgets .fgets ( $fp ); // Write $somecontent to our opened file. //ERROR IS HERE if (!fwrite($fp, $somecontent)) { print Cannot write to file ($filename); exit; } fclose($fp); --- Thanks in advance phplam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Java call on object causes segfault.
Whenever you get a segfault, try the latest stable release and during compile be sure to use --enable-debug : http://snaps.php.net/ If the segfault exists here, write a bug report and include the backtrace: http://bugs.php.net/how-to-report.php http://bugs.php.net/ This will be of great help to the php-dev team. Also I believe many changes to the Java extension went into 4.3.0 so maybe it'll work for you. Regards, Philip On Sun, 26 Jan 2003, John Wells wrote: Working on getting Java integration going. I was able to get it to work with the online example and can create an object of java.lang.System and print various properties returned from there. However, if I create my own class, I can instantiate it, but if I call a method on that class it causes a SIGSEV. Could anyone provide some insight? Here's the code and backtrace: This is with Sun jdk 1.4.1_1, php-4.2.3 on Red Hat 8.0. ? $obj = new Java('com.x.reports.Serv'); print $obj-getMsg(); ? --- java code stored off of class path in com/x/reports --- package com.x.reports; class Serv { public String msg = THIS IS A TEST MESSAGE; Serv() { } public String getMsg() { return this.msg; } } -- BACKTRACE --- Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 8192 (LWP 9303)] 0x402da2cb in java_call_function_handler (ht=0, return_value=0x8114d14, this_ptr=0x810d604, return_value_used=1, property_reference=0xbfffdf54) at java.c:464 464 obj = zend_list_find(Z_LVAL_PP(handle), type); (gdb) bt #0 0x402da2cb in java_call_function_handler (ht=0, return_value=0x8114d14, this_ptr=0x810d604, return_value_used=1, property_reference=0xbfffdf54) at java.c:464 #1 0x40191553 in call_overloaded_function (T=0xbfffdf48, arg_count=0, return_value=0x8114d14) at zend_execute.c:953 #2 0x40194636 in execute (op_array=0x8114b6c) at zend_execute.c:1660 #3 0x401a40a3 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at zend.c:812 #4 0x401b5aaf in php_execute_script (primary_file=0xb450) at main.c:1383 #5 0x401b0aba in apache_php_module_main (r=0x8107004, display_source_mode=0) at sapi_apache.c:90 #6 0x401b18ea in send_php (r=0x8107004, display_source_mode=0, filename=0x8107b34 /opt/apache_1.3.27/htdocs/t.php) at mod_php4.c:575 #7 0x401b1963 in send_parsed_php (r=0x8107004) at mod_php4.c:590 #8 0x08074880 in ap_invoke_handler () #9 0x08088c76 in process_request_internal () #10 0x08088cd6 in ap_process_request () #11 0x0807ff9a in child_main () #12 0x0808013a in make_child () #13 0x080802a1 in startup_children () #14 0x080808ce in standalone_main () #15 0x080810ec in main () #16 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6 -- 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] Java call on object causes segfault.
Philip, Thanks. I did submit a bug report and also compiled with debug. That's where the backtrace captured in my email came from. If you'd like to veiw the bug report, it can be found at: http://bugs.php.net/bug.php?id=21881 I'll try 4.3.0 and see what happens. I was holding back because I use the Zend Debug Server, and it doesn't support 4.3.0 just yet. But, it will soo, so might as well. Thanks! John Philip Olson said: Whenever you get a segfault, try the latest stable release and during compile be sure to use --enable-debug : http://snaps.php.net/ If the segfault exists here, write a bug report and include the backtrace: http://bugs.php.net/how-to-report.php http://bugs.php.net/ This will be of great help to the php-dev team. Also I believe many changes to the Java extension went into 4.3.0 so maybe it'll work for you. Regards, Philip On Sun, 26 Jan 2003, John Wells wrote: Working on getting Java integration going. I was able to get it to work with the online example and can create an object of java.lang.System and print various properties returned from there. However, if I create my own class, I can instantiate it, but if I call a method on that class it causes a SIGSEV. Could anyone provide some insight? Here's the code and backtrace: This is with Sun jdk 1.4.1_1, php-4.2.3 on Red Hat 8.0. ? $obj = new Java('com.x.reports.Serv'); print $obj-getMsg(); ? --- java code stored off of class path in com/x/reports --- package com.x.reports; class Serv { public String msg = THIS IS A TEST MESSAGE; Serv() { } public String getMsg() { return this.msg; } } -- BACKTRACE --- Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 8192 (LWP 9303)] 0x402da2cb in java_call_function_handler (ht=0, return_value=0x8114d14, this_ptr=0x810d604, return_value_used=1, property_reference=0xbfffdf54) at java.c:464 464 obj = zend_list_find(Z_LVAL_PP(handle), type); (gdb) bt #0 0x402da2cb in java_call_function_handler (ht=0, return_value=0x8114d14, this_ptr=0x810d604, return_value_used=1, property_reference=0xbfffdf54) at java.c:464 #1 0x40191553 in call_overloaded_function (T=0xbfffdf48, arg_count=0, return_value=0x8114d14) at zend_execute.c:953 #2 0x40194636 in execute (op_array=0x8114b6c) at zend_execute.c:1660 #3 0x401a40a3 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at zend.c:812 #4 0x401b5aaf in php_execute_script (primary_file=0xb450) at main.c:1383 #5 0x401b0aba in apache_php_module_main (r=0x8107004, display_source_mode=0) at sapi_apache.c:90 #6 0x401b18ea in send_php (r=0x8107004, display_source_mode=0, filename=0x8107b34 /opt/apache_1.3.27/htdocs/t.php) at mod_php4.c:575 #7 0x401b1963 in send_parsed_php (r=0x8107004) at mod_php4.c:590 #8 0x08074880 in ap_invoke_handler () #9 0x08088c76 in process_request_internal () #10 0x08088cd6 in ap_process_request () #11 0x0807ff9a in child_main () #12 0x0808013a in make_child () #13 0x080802a1 in startup_children () #14 0x080808ce in standalone_main () #15 0x080810ec in main () #16 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Predefined Variables In Classes
Well, I don't think this has anything to do with predefined variables being global or not because I only have use for them within the specific methods. The methods will capture their values and assign them to a variable inside the function, which will return that variable at the end. The processing of $PHP_SELF and $DOCUMENT_ROOT only happens in one place. I might be wrong, not sure. But right now all I know is that I am confused and the link you sent me didn't help explain what I need to know because it states no mention of predefined variables. Can you perhaps give me an example of what you are trying to tell me? I read about variable scope and it says nothing about predefined variables. So how will using the $_SERVER associate array help me with this? Remember that globals is on, so I don't need to use $_SERVER, $_POST, $_GET, etc. to get my values. But, in the meantime I'll go ahead and try using the associate autoglobal arrays anyway, like $_SERVER, just to test it and to see if it works for me. And if it does, it'll bug me until I find out why it works. Thanks your input Philip. If anyone else has any thoughts or explainations for me to understad this then that would be great. Read: http://www.php.net/variables.scope Also note that $_SERVER is an autoglobal. Regards, Philip -Original Message- From: @ Nilaab [mailto:[EMAIL PROTECTED]] Sent: Sunday, January 26, 2003 1:46 PM To: Php-General Subject: [PHP] Predefined Variables In Classes Hello Everyone, I am a little confused. Why do predefined variables like $PHP_SELF or $DOCUMENT_ROOT not process within a class, in the methods secifically. For example: ?php class someClass { function someFunction () { $root = $DOCUMENT_ROOT; return $root; } function someFunction2 () { $path = $this-someFunction() . $PHP_SELF; return $path; } } ? I just threw this together to give you an example of how I might be using these two predefined variables in a class. The problem is that $DOCUMENT_ROOT or $PHP_SELF won't parse or something. It just returns blank. It is included in another page when needed, say somePage.php. Shouldn't $PHP_SELF recognize the somePage.php as the current running script file, as opposed to the class file where these two functions are called? If it doesn't work that way then how do I do this without sending predefined variable parameters to these functions? Please note that register globals is on. I could not find any documentation on this on php.net. Maybe someone can give me a hint of point it out for me on the documentation. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Masive mail Advice
Hello, On 01/26/2003 02:17 AM, Maciek Ruckgaber Bielecki wrote: I'll start to write an application which will be used to send large amounts of mail to users in a DB. All these mails to be sent shoul be personalized. Since i understand, and please correct me if im wrong, the mail() function is not a good option for this purpose. (the amount of mail to be sent may vary from 50 to 800 messages). I have considered using some masive mail application such majordomo or EZMLM. EZMLM is not easily configurable for sending personalized mail, and majordomo requires sendmail, (i would prefer to use qmail), i know about patches to be done so it works with qmail, but i dont consider them really clean. What would you guys suggest ?? should i jump into majordomo - sendmail, or do you know something else that might be a better solution. That number of messages is small and with today's servers you can queue that volume of personalized is less than a minute. Your problems will start as you enter in the tens of thousands of recipients, not because qmail won't handle it but because that many message in the queue will prevent the incoming messages to arrive in time. Anyway, for that volume of messages you may want to try this class that comes with an example of how to send personalized messages to many users. For larger volumes of recipients you can still use the same class but it will take much more time, so to not choke the mail queue, you would better send the messages during a few minutes and then rest for about 3 times the same period before you resume sending for a few minutes more. For greater efficiency, if possible do not personalize the message body so you can hint the class to cache it so it does not waste time regenerating the message body for each recipient. http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Predefined Variables In Classes
Well, I don't think this has anything to do with predefined variables being global or not because I only have use for them within the specific methods. The methods will capture their values and assign them to a variable inside the function, which will return that variable at the end. The processing of $PHP_SELF and $DOCUMENT_ROOT only happens in one place. I might be wrong, not sure. But right now all I know is that I am confused and the link you sent me didn't help explain what I need to know because it states no mention of predefined variables. Can you perhaps give me an example of what you are trying to tell me? Predefined or not, it's still a variable. If you want a variable inside of your function to have the value of a variable outside of your function, then you have to make it global. $PHP_SELF inside of your function has no value because it's relative to the function, not the script. Just like $a inside of a function wouldn't have a value unless you assigned one to it. Using global $PHP_SELF at the beginning of your function (or method, same thing) will now make the variable $PHP_SELF have the same value as it does outside of your function. I read about variable scope and it says nothing about predefined variables. So how will using the $_SERVER associate array help me with this? Remember that globals is on, so I don't need to use $_SERVER, $_POST, $_GET, etc. to get my values. But, in the meantime I'll go ahead and try using the associate autoglobal arrays anyway, like $_SERVER, just to test it and to see if it works for me. And if it does, it'll bug me until I find out why it works. Thanks your input Philip. If anyone else has any thoughts or explainations for me to understad this then that would be great. $_SERVER['PHP_SELF'] will always work, regardless of variable scope or register_globals setting. The $_SERVER array is a superglobal, so it'll have the same value inside your method or outside of it, without you having to do anything special. Hope that helps. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Predefined Variables In Classes
John, YES! That's what I was looking for. Thanks for the explaination. It helps a great deal. I had $_SERVER['DOCUMENT_ROOT'] work for me. But I'm still struggling with $_SERVER['PHP_SELF'], because it's not returning anything. So here's the second part to my question stated earlier. Let's say, for example, I had a class included in someFile.php. The included class looks like the class below: ?php class someClass { function someFunction () { $root = $_SERVER['DOCUMENT_ROOT']; return $root; } function someFunction2 () { $path = $this-someFunction() . $_SERVER['PHP_SELF']; return $path; } } ? Shouldn't the value of $_SERVER['PHP_SELF'] contain the path of someFile.php and not the path of the class file which was included in someFile.php? Or what should this value be? I want the $_SERVER['PHP_SELF'] value to be /path/someFile.php, or the value of whatever page included this class file and called the methods of the class. How would I do that? Because right now it returns a blank string. -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Sunday, January 26, 2003 3:37 PM To: '@ Nilaab'; 'Php-General' Subject: RE: [PHP] Predefined Variables In Classes Well, I don't think this has anything to do with predefined variables being global or not because I only have use for them within the specific methods. The methods will capture their values and assign them to a variable inside the function, which will return that variable at the end. The processing of $PHP_SELF and $DOCUMENT_ROOT only happens in one place. I might be wrong, not sure. But right now all I know is that I am confused and the link you sent me didn't help explain what I need to know because it states no mention of predefined variables. Can you perhaps give me an example of what you are trying to tell me? Predefined or not, it's still a variable. If you want a variable inside of your function to have the value of a variable outside of your function, then you have to make it global. $PHP_SELF inside of your function has no value because it's relative to the function, not the script. Just like $a inside of a function wouldn't have a value unless you assigned one to it. Using global $PHP_SELF at the beginning of your function (or method, same thing) will now make the variable $PHP_SELF have the same value as it does outside of your function. I read about variable scope and it says nothing about predefined variables. So how will using the $_SERVER associate array help me with this? Remember that globals is on, so I don't need to use $_SERVER, $_POST, $_GET, etc. to get my values. But, in the meantime I'll go ahead and try using the associate autoglobal arrays anyway, like $_SERVER, just to test it and to see if it works for me. And if it does, it'll bug me until I find out why it works. Thanks your input Philip. If anyone else has any thoughts or explainations for me to understad this then that would be great. $_SERVER['PHP_SELF'] will always work, regardless of variable scope or register_globals setting. The $_SERVER array is a superglobal, so it'll have the same value inside your method or outside of it, without you having to do anything special. Hope that helps. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Mass Mailing
Hello, On 01/23/2003 02:40 AM, Jonathan Chum wrote: Anyway, the problem of personalizing messages is that makes your mailings take much longer to generate and queue because you need to create separate message for each recipient. I'm weighing down personalization and enveloping for this project, and probably going for the personalization of each email. This rules out BCC and enveloping with SMTP. I always advise people to not bother personalizing messages for silly purposes like starting messages like this: Dear SPAM-VICTIM-NAME-HERE, The problem is that this is now a pattern of spam that people are so much used to it that they no longer can be fooled into believing that the messages was really written by a human being to them and not some spam script. It was told that spam detection programs like SpamAssassin give extra spam points to messages that have phrases like that. OTOH, there are more reasonable motives to personalize messages like the silly decision of Hotmail to have default spam filter rule to reject messages that do not have a visible To: or Cc: header with the recipient address of the Hotmail account. The decision is silly because it makes it consider most real opt-in mailing lists like this one, php-general, as spam, which is obviously a big mistake. Anyway, since most Hotmail users with that filtering rule on are not aware, it makes sense to personalize just the To: header with each recipient address. You do not have to personalize the body though. So, I have just added an option to cache the message body between deliveries of the same message to different recipies using this MIME message composing and sending class. See the personalized bulk mail example for more details: http://www.phpclassses.org/mimemessage and run it every hour. With qmail you do not have to run the queue like sendmail. You just inject the messages and it will deliver them when possible. If it delivers when possible, won't the server flake if it get's 100,000 emails inject into Qmail? If I was to use your class and loop through 100,000 emails into Qmail, will Qmail attempt all at once? No, qmail only attempts to send upto a limited number of messages simultaneously which defaults to 20, but if you have good link you can raise it upto 120. Raising it further will not work unless you apply a patch to qmail. Anyway, the down side of injecting that many messages in qmail queue, either separately or a single message with Bcc:, is that it will choke the incoming message reception because the SMTP server delivers the messages to the local queue too. There are 2 solutions for this: if you have a spare server machine, use it as relay and configure qmail control value smtproutes pointing to the spare server that will do the actual delivery. If you do not have a spare server, you need to just inject a few messages at a time and rest for a period of time that is enough to let the messages already inthe queue be flushed. Even with a spare server, it is a good idea to rest after delivering a few hundred messages. In that case, you may consider QMQP relay which is a protocol that lets you rely entire mail queues from a server to another. This is recommended when you have many busy mailing lists served from one machine and you can use more servers do the actual delivery. I think only qmail and ezmlm support QMQP. Thanks, I'll check QMQP as well. If you really want personalization, QMQP is not really useful because it is meant to shift queues of single messages to many recipients. Personalization turns it into many messages to distinct recipients. The greatest problem that made me learn some hard lessons is that it is very problematic if you start with subscribers list that are not clean up of no longer valid users. Once you start delivering messages to those addresses, you get a flood of bounces that pratically stop your server queue. The MTV newsletter was weekly, but that affected the newsletters of other sites that were stopped during the MTV newsletter bounces. Since ezmlm does not unsubscribe bouncing addresses right away, the solution was to remove bouncing subscribers using an external validation procedure. I used this other class for the cleanup. After that it was a breeze. We had peaks of 10,000 messages sent per minute. http://www.phpclasses.org/emailvalidation We had a 72K list with about 6K bad emails that Mailman didn't unsubscribe until we used MojoMail which unsubscribes them from the database instantly as well as perform validations. Now, blasts are handled alot quicker. That is not a good idea either because you are delisting people that are temporarily bouncing as if their addresses are permanently invalid which is not the case. So far, you have given me a good case to use Qmail and using your PHP class as a foundation for this application. . . I'll have to check the other software recommendations you made and see how'd I incorporate this
RE: [PHP] Predefined Variables In Classes
Nevermind John, it worked! I had $_SERVER['PHP_SELF'] spelled as $SERVER['PHP_SELF']. I appreciate your help! :P -Original Message- From: @ Nilaab [mailto:[EMAIL PROTECTED]] Sent: Sunday, January 26, 2003 4:01 PM To: Php-General Subject: RE: [PHP] Predefined Variables In Classes John, YES! That's what I was looking for. Thanks for the explaination. It helps a great deal. I had $_SERVER['DOCUMENT_ROOT'] work for me. But I'm still struggling with $_SERVER['PHP_SELF'], because it's not returning anything. So here's the second part to my question stated earlier. Let's say, for example, I had a class included in someFile.php. The included class looks like the class below: ?php class someClass { function someFunction () { $root = $_SERVER['DOCUMENT_ROOT']; return $root; } function someFunction2 () { $path = $this-someFunction() . $_SERVER['PHP_SELF']; return $path; } } ? Shouldn't the value of $_SERVER['PHP_SELF'] contain the path of someFile.php and not the path of the class file which was included in someFile.php? Or what should this value be? I want the $_SERVER['PHP_SELF'] value to be /path/someFile.php, or the value of whatever page included this class file and called the methods of the class. How would I do that? Because right now it returns a blank string. -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Sunday, January 26, 2003 3:37 PM To: '@ Nilaab'; 'Php-General' Subject: RE: [PHP] Predefined Variables In Classes Well, I don't think this has anything to do with predefined variables being global or not because I only have use for them within the specific methods. The methods will capture their values and assign them to a variable inside the function, which will return that variable at the end. The processing of $PHP_SELF and $DOCUMENT_ROOT only happens in one place. I might be wrong, not sure. But right now all I know is that I am confused and the link you sent me didn't help explain what I need to know because it states no mention of predefined variables. Can you perhaps give me an example of what you are trying to tell me? Predefined or not, it's still a variable. If you want a variable inside of your function to have the value of a variable outside of your function, then you have to make it global. $PHP_SELF inside of your function has no value because it's relative to the function, not the script. Just like $a inside of a function wouldn't have a value unless you assigned one to it. Using global $PHP_SELF at the beginning of your function (or method, same thing) will now make the variable $PHP_SELF have the same value as it does outside of your function. I read about variable scope and it says nothing about predefined variables. So how will using the $_SERVER associate array help me with this? Remember that globals is on, so I don't need to use $_SERVER, $_POST, $_GET, etc. to get my values. But, in the meantime I'll go ahead and try using the associate autoglobal arrays anyway, like $_SERVER, just to test it and to see if it works for me. And if it does, it'll bug me until I find out why it works. Thanks your input Philip. If anyone else has any thoughts or explainations for me to understad this then that would be great. $_SERVER['PHP_SELF'] will always work, regardless of variable scope or register_globals setting. The $_SERVER array is a superglobal, so it'll have the same value inside your method or outside of it, without you having to do anything special. Hope that helps. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Masive mail Advice
-Original Message- From: Manuel Lemos [mailto:[EMAIL PROTECTED]] That number of messages is small and with today's servers you can queue that volume of personalized is less than a minute. Your problems will start as you enter in the tens of thousands of recipients, not because qmail won't handle it but because that many message in the queue will prevent the incoming messages to arrive in time. ??? There are two separate processes here - the outgoing connections to the remote SMTP servers and the incoming connections to your own SMTP servers. Tuning qmail involves setting the number of outgoing queues so as not to overload your communications line. I _personally_ have sent more than 300,000 messages with no resting mechanism - doing that means you haven't tuned your qmail system for the load. Mark C. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session Variables
I have a quirky problem that should be a breeze for someone who is smarter than I. I have a script where I am registering a HTML form post variable as a session variable and then echo it. In the real script I use it in a MySQL query, but for the sake of this post, here is the script: $user1 = $HTTP_POST_VARS[user1]; session_register(user1); echo $HTTP_SESSION_VARS[user1]; This doesn't work, however, if I hit the refresh button the var miraculously appears! What am I doing wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Masive mail Advice
Hello, On 01/26/2003 08:22 PM, Mark Charette wrote: -Original Message- From: Manuel Lemos [mailto:[EMAIL PROTECTED]] That number of messages is small and with today's servers you can queue that volume of personalized is less than a minute. Your problems will start as you enter in the tens of thousands of recipients, not because qmail won't handle it but because that many message in the queue will prevent the incoming messages to arrive in time. ??? There are two separate processes here - the outgoing connections to the remote SMTP servers and the incoming connections to your own SMTP servers. Tuning qmail involves setting the number of outgoing queues so as not to overload your communications line. I _personally_ have sent more than 300,000 messages with no resting mechanism - doing that means you haven't tuned your qmail system for the load. The problem does not have to do with SMTP but with qmail local queue handling. If you send messages to many users and the bounce address is set to some address handled by the same server, you will be starting to get bounces to the same machine and thus the same qmail server. The way to solve this is to put the bounce address point to some address that is handled by a different server or even to nowhere. Using a spare server for the actual delivery reduces that problem too. -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] human language detection
Hi, I am creating a bilingual website (Dutch and English) and I wonder how I would best detect the human language of a visitor. I am attempting several things, but I am sure there must be a generally accepted alternative. Can anyone point me to more info? I am tinkering around with HTTP_REFERER and HTTP_USER_AGENT and a bit in JavaScript which only works with Netscape browsers. But detection usually fails. I was wondering, my server provides a REMOTE_ADDR value, but not a REMOTE_HOST. From the last I could look voor a .nl extention. Is there a way to (inline) translate a IP address to something readable? It's a remote server on which I can't control the settings. Why is this so difficult? It should be a basic feature of any international software... or am I missing something? Thanks, Marco -- Marco Bleeker, Amsterdam, NL. Please do not distribute my email address to a third party Refer to www.ecocam.com for an email form (and more) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] human language detection?
Hi, I am creating a bilingual website (Dutch and English) and I wonder how I would best detect the human language of a visitor. I am attempting several things, but I am sure there must be a generally accepted alternative. Can anyone point me to more info? I am tinkering around with HTTP_REFERER and HTTP_USER_AGENT and a bit in JavaScript which only works with Netscape browsers. But detection usually fails. I was wondering, my server provides a REMOTE_ADDR value, but not a REMOTE_HOST. From the last I could look voor a .nl extention. Is there a way to (inline) translate a IP address to something readable? It's a remote server on which I can't control the settings. Why is this so difficult? It should be a basic feature of any international software... or am I missing something? Thanks, Marco -- Marco Bleeker, Amsterdam, NL. Please do not distribute my email address to a third party Refer to www.ecocam.com for an email form (and more) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Masive mail Advice
-Original Message- From: Manuel Lemos [mailto:[EMAIL PROTECTED]] On 01/26/2003 08:22 PM, Mark Charette wrote: -Original Message- From: Manuel Lemos [mailto:[EMAIL PROTECTED]] That number of messages is small and with today's servers you can queue that volume of personalized is less than a minute. Your problems will start as you enter in the tens of thousands of recipients, not because qmail won't handle it but because that many message in the queue will prevent the incoming messages to arrive in time. ??? There are two separate processes here - the outgoing connections to the remote SMTP servers and the incoming connections to your own SMTP servers. Tuning qmail involves setting the number of outgoing queues so as not to overload your communications line. I _personally_ have sent more than 300,000 messages with no resting mechanism - doing that means you haven't tuned your qmail system for the load. The problem does not have to do with SMTP but with qmail local queue handling. If you send messages to many users and the bounce address is set to some address handled by the same server, you will be starting to get bounces to the same machine and thus the same qmail server. The way to solve this is to put the bounce address point to some address that is handled by a different server or even to nowhere. Using a spare server for the actual delivery reduces that problem too. It has everything to do with qmail local queue handling. I have had no problems when both the VERP address and sending machine are the same, providing I tune the qmail queues to a reasonable number. VERP is very useful to handle bounces, no separate machines are required, you just have to think about your bandwidth. The way to solve this is use your intelligence. A stop/start sceme as you originally proposed is a kludge at best to an easily managable problem. Mark C. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Masive mail Advice
On 01/26/2003 09:25 PM, Mark Charette wrote: That number of messages is small and with today's servers you can queue that volume of personalized is less than a minute. Your problems will start as you enter in the tens of thousands of recipients, not because qmail won't handle it but because that many message in the queue will prevent the incoming messages to arrive in time. ??? There are two separate processes here - the outgoing connections to the remote SMTP servers and the incoming connections to your own SMTP servers. Tuning qmail involves setting the number of outgoing queues so as not to overload your communications line. I _personally_ have sent more than 300,000 messages with no resting mechanism - doing that means you haven't tuned your qmail system for the load. The problem does not have to do with SMTP but with qmail local queue handling. If you send messages to many users and the bounce address is set to some address handled by the same server, you will be starting to get bounces to the same machine and thus the same qmail server. The way to solve this is to put the bounce address point to some address that is handled by a different server or even to nowhere. Using a spare server for the actual delivery reduces that problem too. It has everything to do with qmail local queue handling. I have had no problems when both the VERP address and sending machine are the same, providing I tune the qmail queues to a reasonable number. VERP is very useful to handle bounces, no separate machines are required, you just have to think about your bandwidth. The way to solve this is use your intelligence. A stop/start sceme as you originally proposed is a kludge at best to an easily managable problem. I don't think you are getting the point of stop/start. If you flood the delivery queue with 300,000, no more incoming and outgoing mail will be handled until all the delivery to all recipients that you queued are handled. That may take hours depending on how hard is to deliver to all recipients. If you have a dedicated server for the bulk delivery, that may not be a problem for, but if you have other types of messages coming and going of the same server, everything will be stalled. BTW, if you are personalizing the messages, there is no need to user VERP because you are already sending the messages separately and so you may as well personalize the return path address. -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] human language detection?
Hi Marco. Try the HTTP_USER_ACCEPT_LANGUAGE variable. It simply detects the language of the visitors browser. It wouldnt work for my cause i use an english version of Mozilla (i am dutch too), although 90% of the dutch visitors probably uses MSIE in dutch eh;-) Best regards, Davy Obdam Marco Bleeker wrote: Hi, I am creating a bilingual website (Dutch and English) and I wonder how I would best detect the human language of a visitor. I am attempting several things, but I am sure there must be a generally accepted alternative. Can anyone point me to more info? I am tinkering around with HTTP_REFERER and HTTP_USER_AGENT and a bit in JavaScript which only works with Netscape browsers. But detection usually fails. I was wondering, my server provides a REMOTE_ADDR value, but not a REMOTE_HOST. From the last I could look voor a .nl extention. Is there a way to (inline) translate a IP address to something readable? It's a remote server on which I can't control the settings. Why is this so difficult? It should be a basic feature of any international software... or am I missing something? Thanks, Marco -- Marco Bleeker, Amsterdam, NL. Please do not distribute my email address to a third party Refer to www.ecocam.com for an email form (and more) -- Davy Obdam - Obdam webdesign© mailto:[EMAIL PROTECTED] web: www.davyobdam.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Transition Page?
I'm interested in how most would create a transition page.. I have an upload process that takes a bit before it changes the page displayed on the browser. I would like to create a transition page [Uploading Now .. please standby] that would refresh to a result page once the upload is done. Now I've seen this done on other sites (loading pages) and I'm sure there are many ways to do this, just looking for methods and pro/cons to the various approaches. thanks.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] I'm new in PHP
Zdravo php-general, Hi I have setup PHP Apache MySql. I;m new in this stuff where can I learn hot to make web pages in PHP...??? +++Info About this E-mail+ +Poruka je napisana u 16:24:13 + +Dana Sunday, January 26, 2003 + +Files in this E-mail massage+ +none + ++ +Email: [EMAIL PROTECTED] + ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I'm new in PHP
On Sun, 26 Jan 2003, Beogradjanin wrote: Zdravo php-general, Hi I have setup PHP Apache MySql. I;m new in this stuff where can I learn hot to make web pages in PHP...??? Go here: Learn HTML http://www.w3schools.com/html/ Learn SQL http://www.w3schools.com/sql/ http://www.sqlcourse.com/ Learn PHP http://www.faqts.com/knowledge_base/view.phtml/aid/2836/fid/51 http://www.php.net/manual/ http://www.php.net/links.php Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I'm new in PHP
www.htmlgoodies.com - The best site for HTML On Mon, 27 Jan 2003, Philip Olson wrote: On Sun, 26 Jan 2003, Beogradjanin wrote: Zdravo php-general, Hi I have setup PHP Apache MySql. I;m new in this stuff where can I learn hot to make web pages in PHP...??? Go here: Learn HTML http://www.w3schools.com/html/ Learn SQL http://www.w3schools.com/sql/ http://www.sqlcourse.com/ Learn PHP http://www.faqts.com/knowledge_base/view.phtml/aid/2836/fid/51 http://www.php.net/manual/ http://www.php.net/links.php Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Nesting level too deep
Hi, i installed php-4.3.0 on apache 2.0.34. but whenever i try to display a php script i got a PHP Fatal error: Nesting level too deep - recursive dependency? in Unknown on line 0 Even the simplest document leads to this error: index.php ?php header(LOCATION: ../login.php); ? i know these scripts worked fine with php-4.3.2 today i updated to apache 2.0.44, but i found no changes for this problem. Does anybody know, what the problem is? Thx, Sascha Jopen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Session Variables
This variable is registered in the Session, and the variable isn't active until the page refreshes. It's hard to explain. I thought I would try. There are some things you can do. If you need the variable right away, you can do this: if (isset($HTTP_SESSION_VARS[user1])) { $user1 = $HTTP_SESSION_VARS[user1]; } else { $user1 = $HTTP_POST_VARS[user1]; } echo $user1; Hope that helps. This is natural for sessions, but I have been in the situation where I needed the session variable right away, instead of the script's next activation. Jed R. Brubaker [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have a quirky problem that should be a breeze for someone who is smarter than I. I have a script where I am registering a HTML form post variable as a session variable and then echo it. In the real script I use it in a MySQL query, but for the sake of this post, here is the script: $user1 = $HTTP_POST_VARS[user1]; session_register(user1); echo $HTTP_SESSION_VARS[user1]; This doesn't work, however, if I hit the refresh button the var miraculously appears! What am I doing wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Transition Page?
--- Lee Herron [EMAIL PROTECTED] wrote: I'm interested in how most would create a transition page.. One thing you might consider is using flush() to output what you have so far to the browser rather than sending them to another page when you're done. An example of something to output might be: pThis might take a while.../p ? flush() do_hard_stuff(); ? pFinished!/p If you are using output buffering, you'll have to flush that, too. If your Web server is doing any kind of buffering, it might not work at all. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Transition Page?
Hello Lee :) Well, there is one way that I know of that some people might overlook. What you can do is use CSS positioning and set the Uploading Now message (Whether it's text, an image, a flash file, etc.) BEHIND the result page by setting the z-index value of the Uploading Now message to a lower number than the z-index of the result page. So what happens in this case is that the user will see the Uploading Now message until the other page or image loads, which will automatically load on top of the message, therefore hiding it once it's loaded. This works great with images especially. You may need to use some positioning creativity to do the same with the html pages, as you have to find a way to be able to hide the transition message (by another image, a colored table, or just about anything else. The good thing about this method is that you never need to create an extra file just to display the message. You can use it in the same file. Or if you have to use it on many pages, just include it from an include file or a function or something. Lots of room for creativity here. Anyway, that's how I would do it. I'm sure there are many other great ways. But there's my input. Hope it helps you a little. -Original Message- From: Lee Herron [mailto:[EMAIL PROTECTED]] Sent: Sunday, January 26, 2003 6:05 PM To: [EMAIL PROTECTED] Subject: [PHP] Transition Page? I'm interested in how most would create a transition page.. I have an upload process that takes a bit before it changes the page displayed on the browser. I would like to create a transition page [Uploading Now .. please standby] that would refresh to a result page once the upload is done. Now I've seen this done on other sites (loading pages) and I'm sure there are many ways to do this, just looking for methods and pro/cons to the various approaches. thanks.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] I'm new in PHP
Beogradjanin, In addition to Philip's links, don't forget that PHP works great with the MySQL database. If you plan to use MySQL, then go to the following for great tutorials: http://www.mysql.com Remember, PHP can be as creative as you want to be. If you need any help with anything else, please feel free to come here and ask again. P.S. -- Philip, thanks for helping out the newbies. PHP will continue to grow better and bolder thanks to you and others. -Original Message- From: Philip Olson [mailto:[EMAIL PROTECTED]] Sent: Sunday, January 26, 2003 7:05 PM To: Beogradjanin Cc: [EMAIL PROTECTED] Subject: Re: [PHP] I'm new in PHP On Sun, 26 Jan 2003, Beogradjanin wrote: Zdravo php-general, Hi I have setup PHP Apache MySql. I;m new in this stuff where can I learn hot to make web pages in PHP...??? Go here: Learn HTML http://www.w3schools.com/html/ Learn SQL http://www.w3schools.com/sql/ http://www.sqlcourse.com/ Learn PHP http://www.faqts.com/knowledge_base/view.phtml/aid/2836/fid/51 http://www.php.net/manual/ http://www.php.net/links.php Regards, Philip -- 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] Transition Page?
I'm interested in how most would create a transition page.. One thing you might consider is using flush() to output what you have so far to the browser rather than sending The problem I'm having is that the uploading of the file takes time, and the screen simply sits there while this is being done .. I don't know if there is a way around that. Flush would be fine if it could be done before the upload started; problem is, hitting submit starts the upload process which waits until it's done before receiving instructions included in the upload processing script. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Installation problem
I've installed PHP and Apache countless times but it seems I have forgotten something somehow because I can't for the life of me get apache to install PHP as a static module. Argh ...! I'm trying to get PHP 4.3.0, Apache 1.3.27, openssl-0.9.7, mod_ssl-2.8.12-1.3.27 all working together but to no avail. The best I can get is a mod_ssl aware apache server, but no PHP. These are the steps I am following. Can anyone spot my error? # cd openssl-0.9.7 # ./config -no-thread # cd .. # cd mod_ssl-2.8.12-1.3.27/ # ./configure --with-apache=../apache_1.3.27/ # cd ../apache_1.3.27/ # ./configure # cd ../php-4.3.0/ # ./configure --with-pgsql=/usr/local/psql/ --without-mysql --with-apache=../apache_1.3.27/ --enable-mbstring --enable-mbstr-enc-trans --enable-mbregex # make make install # cd ../apache_1.3.27/ # SSL_BASE=../openssl-0.9.7 ./configure --with-pgsql=/usr/local/pgsql/ --without-mysql --prefix=/www --activate-module=src/modules/php4/libphp4.a --enable=module=ssl # make # make install I add the following line to httpd.conf and start apache: AddType application/x-httpd-php .php But when I try and load a .php page I get a Save File dialog ... What step did I miss or where did I do something wrong? Thanks! Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Files PHP in tmp ?
Are they things like php45a45s879a787g54a21s3a12g3a21s31a3a? If so, yup i know the feeling 297,548,197 of them using up 128GB of storage on my HD! Don't worry They're just sessions Oh and don't worry Unless your site is a huge wooper with 500,000 - 1,000-,000 users loggin in a day, you won't get huge amounts lol Nico [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, I've a lot of files named php in my tmp folders .. What's these files ? Nico -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Making a file manager with PHP?
Hello there. Basically I'm trying to make a file manager with PHP. Here's what I need to do Ok I have artists and coders working for my site No FTP I want them to be able to upload/download files from me as and when they please without having to email me the files The files that will be uploaded and downloaded are with these extentions .htm .html .php .phps .jpg .gif .swf I can scrape together the upload bit, but the download bit just runs the file rather than brings up the download feature of the web browser. How can I make it download it? TIA!
[PHP] Re: How do you update multiple rows at the same time?
You on MySQL? If so do this UPDATE tblName SET firstcol = '$var41stcol', $secondcol = '$var42ndcol' and so on Steve Jackson [EMAIL PROTECTED] wrote in message 01c2c3a0$27591b50$[EMAIL PROTECTED]">news:01c2c3a0$27591b50$[EMAIL PROTECTED]... I am having trouble with this. I need to update 1column in a variable number of rows depending on how many categories are in my database at a given time. Can anyone provide any pointers or example code Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com/ http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] total file size
It can be done with ASP and JSP. ROFLMFAO! No it shouldn't be reported to their bugs database! It's not a bug! It just isn't a feature of PHP! You could suggest it to them though... Victor [EMAIL PROTECTED] wrote in message 01c2c34a$0ee9e140$237b7018@JUMPY">news:01c2c34a$0ee9e140$237b7018@JUMPY... With what then? Why not? Should this be a bug filed in their bugs database? - Vic -Original Message- From: Jim Lucas [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 23, 2003 2:00 PM To: Victor; [EMAIL PROTECTED] Subject: Re: [PHP] total file size yes, it is possible, but not with php. Jim - Original Message - From: Victor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 22, 2003 8:10 PM Subject: [PHP] total file size Is there a way to find out total upload file size from a file uploaded though an html form? I figure if I know the total size, then I can just consistently poke at the file being uploaded and math a progress bar for the file being uploaded, of course, this all hangs upon the ability of getting the total file size BEFORE it is uploaded. It IS possible I have seen it done with JSP; anybody can help me with this? Thanks - Vic __ Post your free ad now! http://personals.yahoo.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Post your free ad now! http://personals.yahoo.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: I'm new in PHP
www.php.net/manual Beogradjanin [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Zdravo php-general, Hi I have setup PHP Apache MySql. I;m new in this stuff where can I learn hot to make web pages in PHP...??? +++Info About this E-mail+ +Poruka je napisana u 16:24:13 + +Dana Sunday, January 26, 2003 + +Files in this E-mail massage+ +none + ++ +Email: [EMAIL PROTECTED] + ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php